2ed2b3ae0f
One nova/<name>.py per user-facing core/ module. Each ≤50 lines, ≤3 FunctionDef (add_parser + run [+1 helper]), every user-function call resolves to a core.* import, no `if` statements except `if __name__`. Subcommands: - nova resolve → core.contract_resolver.resolve - nova decommission → core.decommission_transform.decommission_transform - nova env-transition detect|record → core.env_transition - nova env-check → core.environment_check.check - nova hitl → core.hitl_gates.attest (+ approver_from_env) - nova onboard → core.onboarding.generate_env_file - nova outbox → core.outbox_writer.write_event - nova publish-outputs → core.output_publisher.publish_to_ssm + format_comment - nova policy → core.policy_engine.get_engine + get_policy_root (status) - nova regression → core.regression_verify.run_regression + write_report - nova sod → core.separation_of_duties.check - nova readiness → core.submission_readiness.cli_main - nova attestation-matrix → core.attestation_matrix.cli_main (new thin wrapper) - nova confidence → core.confidence_signal.cli_main (new thin wrapper) core wrappers added (minimal): attestation_matrix.cli_main, confidence_signal.cli_main — extracted from their __main__ blocks so the nova subcommands stay thin. ---ci--- project: acdl phase: 1 milestone: v1.28 status: execute persona: cli-engineer ---/ci---
33 lines
1019 B
Python
33 lines
1019 B
Python
"""nova hitl — attest a promotion gate (REQ-108)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
|
|
from core.hitl_gates import attest, approver_from_env
|
|
|
|
|
|
def add_parser(subparsers):
|
|
p = subparsers.add_parser("hitl", help="attest a promotion gate")
|
|
p.add_argument("--contract-id", required=True)
|
|
p.add_argument("--env", required=True, help="dev/qa/prod/dr")
|
|
p.add_argument("--evidence", default=None, help="evidence JSON path")
|
|
p.set_defaults(_run=run)
|
|
|
|
|
|
def run(args) -> int:
|
|
evidence = _load_evidence(args.evidence)
|
|
approver = approver_from_env() or ""
|
|
ok, reason = attest(args.contract_id, args.env, approver, evidence)
|
|
print(f"HITL PASS: {reason}") if ok else sys.stderr.write(f"HITL BLOCK: {reason}\n")
|
|
return 0 if ok else 1
|
|
|
|
|
|
def _load_evidence(path):
|
|
return {} if path is None else json.loads(open(path).read())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import sys
|
|
print("use: nova hitl --contract-id <id> --env <env> [--evidence f.json]", file=sys.stderr) |