feat: add repository rename orchestration CLI
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a049a4-ee9f-78e1-9d66-2cb0f9bea3e3
This commit is contained in:
parent
6312db8700
commit
6b82215ae7
11 changed files with 1373 additions and 4 deletions
|
|
@ -31,6 +31,7 @@ from api.services.repository_rename import (
|
|||
create_operation,
|
||||
list_operations,
|
||||
load_operation,
|
||||
load_operation_by_id,
|
||||
rollback_preflight,
|
||||
verify_forge_identity,
|
||||
verify_operation,
|
||||
|
|
@ -38,6 +39,9 @@ from api.services.repository_rename import (
|
|||
|
||||
|
||||
router = APIRouter(prefix="/repos/{repo_id}", tags=["repository-renames"])
|
||||
operation_router = APIRouter(
|
||||
prefix="/repository-renames", tags=["repository-renames"]
|
||||
)
|
||||
|
||||
|
||||
def _raise(exc: RenameLifecycleError) -> None:
|
||||
|
|
@ -122,7 +126,22 @@ async def create_repository_rename_operation(
|
|||
gateway: ForgeRepositoryGateway = Depends(get_forge_repository_gateway),
|
||||
) -> dict[str, Any]:
|
||||
try:
|
||||
operation = await create_operation(session, gateway, repo_id, body)
|
||||
operation, no_op = await create_operation(session, gateway, repo_id, body)
|
||||
except RenameLifecycleError as exc:
|
||||
_raise(exc)
|
||||
return _operation_read(operation, no_op=no_op)
|
||||
|
||||
|
||||
@operation_router.get(
|
||||
"/operations/{operation_id}", response_model=RepositoryRenameOperationRead
|
||||
)
|
||||
async def get_repository_rename_operation_by_id(
|
||||
operation_id: uuid.UUID,
|
||||
session: AsyncSession = Depends(get_session),
|
||||
) -> dict[str, Any]:
|
||||
"""Resolve an operation journal without requiring its repository UUID."""
|
||||
try:
|
||||
operation = await load_operation_by_id(session, operation_id)
|
||||
except RenameLifecycleError as exc:
|
||||
_raise(exc)
|
||||
return _operation_read(operation)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue