honesty_status.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """``overseer honesty-status`` command (§K9.8 / §K9.9).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import sys |
| 6 | from argparse import Namespace |
| 7 | |
| 8 | from adapters.config import load_config |
| 9 | from adapters.errors import ConfigError |
| 10 | from cli.context import CliContext |
| 11 | from cli.paths import resolve_config_path, resolve_repo_root |
| 12 | from cli.sanitize import config_exit_code, format_config_error |
| 13 | from tools.honesty.status import HonestyStatusOptions, run_honesty_status |
| 14 | from tools.honesty.types import HonestyStatusJson |
| 15 | |
| 16 | |
| 17 | def run_honesty_status_command(args: Namespace, ctx: CliContext) -> int: |
| 18 | """Execute ``overseer honesty-status``.""" |
| 19 | repo_root = resolve_repo_root(cwd=ctx.cwd, repo_arg=args.repo, command="honesty-status") |
| 20 | overseer_dir = repo_root / ".overseer" |
| 21 | if not overseer_dir.is_dir(): |
| 22 | ctx.output.error("not initialized — run ok init first") |
| 23 | if args.json: |
| 24 | ctx.output.emit_json( |
| 25 | HonestyStatusJson( |
| 26 | ok=False, |
| 27 | exit_code=2, |
| 28 | hook=getattr(args, "hook", None), |
| 29 | artifact=getattr(args, "artifact", None), |
| 30 | producer_session=getattr(args, "producer_session", None), |
| 31 | error="config", |
| 32 | ).to_dict() |
| 33 | ) |
| 34 | return 2 |
| 35 | |
| 36 | config_path = resolve_config_path(repo_root, args.config) |
| 37 | try: |
| 38 | config = load_config(config_path) |
| 39 | except ConfigError as exc: |
| 40 | exit_code = config_exit_code(exc) |
| 41 | ctx.output.error(format_config_error(exc, repo_root)) |
| 42 | if args.json: |
| 43 | ctx.output.emit_json( |
| 44 | HonestyStatusJson( |
| 45 | ok=False, |
| 46 | exit_code=exit_code, |
| 47 | hook=getattr(args, "hook", None), |
| 48 | artifact=getattr(args, "artifact", None), |
| 49 | producer_session=getattr(args, "producer_session", None), |
| 50 | error="config", |
| 51 | ).to_dict() |
| 52 | ) |
| 53 | return exit_code |
| 54 | |
| 55 | for warning in config.extension_warnings: |
| 56 | ctx.output.warn(warning) |
| 57 | |
| 58 | options = HonestyStatusOptions( |
| 59 | hook=args.hook, |
| 60 | artifact=args.artifact, |
| 61 | producer_session=args.producer_session, |
| 62 | verification_evidence=getattr(args, "verification_evidence", None), |
| 63 | frozen_spec=getattr(args, "frozen_spec", None), |
| 64 | deploy_health=getattr(args, "deploy_health", None), |
| 65 | independent_second_review=getattr(args, "independent_second_review", None), |
| 66 | emit_json=bool(args.json), |
| 67 | ) |
| 68 | result = run_honesty_status(config=config, repo_root=repo_root, options=options) |
| 69 | |
| 70 | if result.stderr_extra: |
| 71 | for line in result.stderr_extra.splitlines(): |
| 72 | if line.startswith("warning:"): |
| 73 | ctx.output.warn(line) |
| 74 | else: |
| 75 | print(line, file=sys.stderr) |
| 76 | |
| 77 | if options.emit_json: |
| 78 | ctx.output.emit_json(result.json_payload.to_dict()) |
| 79 | elif result.exit_code == 4: |
| 80 | ctx.output.error("refused") |
| 81 | elif result.exit_code == 20: |
| 82 | ctx.output.error("missing independent verdict") |
| 83 | elif result.exit_code == 25: |
| 84 | ctx.output.error("provenance signature verification failed") |
| 85 | elif result.exit_code == 26: |
| 86 | ctx.output.error("signature required but absent") |
| 87 | elif result.exit_code == 33: |
| 88 | ctx.output.error("missing verification evidence") |
| 89 | elif result.exit_code == 34: |
| 90 | ctx.output.error("missing deploy health") |
| 91 | elif result.exit_code == 38: |
| 92 | ctx.output.error("missing independent second review") |
| 93 | elif result.exit_code == 1: |
| 94 | ctx.output.error("usage") |
| 95 | |
| 96 | return result.exit_code |
File History
2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
52 days ago