generated from coulomb/repo-seed
engine and lifecycle
This commit is contained in:
@@ -6,6 +6,7 @@ import sys
|
||||
from pathlib import Path
|
||||
|
||||
from .checks import run_collection_checks
|
||||
from .engine import engine_capability_contract, plan_asset_sync, sync_assets
|
||||
from .errors import InfospaceError
|
||||
from .history import find_snapshot, get_history, metric_trend, record_check_results
|
||||
from .lifecycle import add_artifact, create_infospace, load_infospace
|
||||
@@ -86,6 +87,28 @@ def build_parser() -> argparse.ArgumentParser:
|
||||
workflow_run.add_argument("root")
|
||||
workflow_run.add_argument("workflow_id")
|
||||
|
||||
engine = sub.add_parser("engine", help="Inspect and sync engine boundary state")
|
||||
engine_sub = engine.add_subparsers(dest="engine_command", required=True)
|
||||
|
||||
engine_inspect = engine_sub.add_parser(
|
||||
"inspect",
|
||||
help="Inspect the optional engine capability contract",
|
||||
)
|
||||
engine_inspect.add_argument("root")
|
||||
|
||||
engine_plan = engine_sub.add_parser(
|
||||
"plan-sync",
|
||||
help="Plan artifact-to-asset sync without mutation",
|
||||
)
|
||||
engine_plan.add_argument("root")
|
||||
|
||||
engine_sync = engine_sub.add_parser(
|
||||
"sync",
|
||||
help="Dry-run artifact-to-asset sync unless --apply is passed",
|
||||
)
|
||||
engine_sync.add_argument("root")
|
||||
engine_sync.add_argument("--apply", action="store_true")
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
@@ -194,6 +217,22 @@ def main(argv: list[str] | None = None) -> int:
|
||||
)
|
||||
else:
|
||||
parser.error(f"Unhandled workflow command: {args.workflow_command}")
|
||||
elif args.command == "engine":
|
||||
if args.engine_command == "inspect":
|
||||
_write_json(
|
||||
{
|
||||
"root": str(Path(args.root)),
|
||||
"contract": engine_capability_contract().to_dict(),
|
||||
}
|
||||
)
|
||||
elif args.engine_command == "plan-sync":
|
||||
_write_json(plan_asset_sync(Path(args.root)).to_dict())
|
||||
elif args.engine_command == "sync":
|
||||
_write_json(
|
||||
sync_assets(Path(args.root), dry_run=not args.apply).to_dict()
|
||||
)
|
||||
else:
|
||||
parser.error(f"Unhandled engine command: {args.engine_command}")
|
||||
else:
|
||||
parser.error(f"Unhandled command: {args.command}")
|
||||
except InfospaceError as exc:
|
||||
|
||||
Reference in New Issue
Block a user