Merges 8 V1 plugins into 1 unified plugin, adds 4 new components (dep, tst, sec, rvr). 12 sub-modes: arc, eng, do, dbg, xdb, sdb, ndb, ctx, dep, tst, sec, rvr. L1 code-level guarantees: atomic writes, file locks, evidence gating, forced debug routing, 3-phase arc gate, evidence-first debug gate, Chinese language lock, scheduler boundary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""AirDep mode — V2 部署器。"""
|
|
|
|
from pathlib import Path
|
|
from air_runtime.deploy_runtime import deploy, DeployTarget
|
|
from air_runtime.io import safe_json_load
|
|
from air_runtime.paths import airplan_root, event_log_path
|
|
from air_runtime.events import EventLog, DEPLOY_COMPLETED
|
|
|
|
|
|
def main(args) -> None:
|
|
project_root = Path(args.project).expanduser().resolve()
|
|
tid = args.task_id
|
|
sub = args.sub or "deploy"
|
|
|
|
if sub == "deploy" and args.host:
|
|
target = DeployTarget(host=args.host)
|
|
binary = Path(args.binary).expanduser().resolve() if args.binary else Path(".")
|
|
result = deploy(tid, project_root, target, binary, tid)
|
|
|
|
log = EventLog(event_log_path(project_root))
|
|
log.emit(DEPLOY_COMPLETED, {
|
|
"taskId": tid,
|
|
"success": result.success,
|
|
"host": args.host,
|
|
"binaryMd5": result.binary_md5,
|
|
"serviceStatus": result.service_status,
|
|
})
|
|
|
|
print("airplan_mode=dep")
|
|
print(f"task_id={tid}")
|
|
print(f"success={result.success}")
|
|
print(f"md5={result.binary_md5}")
|
|
print(f"service_status={result.service_status}")
|
|
if result.error:
|
|
print(f"error={result.error}")
|
|
else:
|
|
paths = airplan_root(project_root) / "state" / "airdep"
|
|
state = safe_json_load(paths / "state.json") or {}
|
|
print(f"airplan_mode=dep\nenabled={state.get('enabled', False)}")
|