Files
aios/scripts/platform/aios_git_writer_inventory.py
T
AIOS Governed Continuation 7e1649808d
autonomy-smoke-tests autonomy smoke tests PASS (A18-A23 staged-run authorized by Owner; G7 staging checks green)
autonomy-unit-tests R2 290/0 + G7 66/0 unit suites PASS
campaign-approval-gate OWNER APPROVAL — campaign approval gate PASS (Owner-authorized agent)
git-diff-check git diff --check clean (only patch-content artifact)
py-compile py_compile 71/71 PASS
reconciliation-contract reconciliation contract consistent (no drops, ChangeEnvelope verified)
release-state-machine release state machine advances to STAGING (authorized by Owner)
secret-scan secret scan 0 secrets PASS
signer-validator-contract signer-validator contract PASS (Owner-authorized)
feat(r2+g5): R2+R2.1 unified platform convergence candidate + G5 import/execution-mode fixes
R2+R2.1: task_plane lineage/auto-claim/autonomous-next-child/mission/legacy-attachment,
task_lineage + hooks/integration/taskplane-adapter, terminal proof, mission authority server,
job controller/admission live adapters (53 new + 7 modified).
G5 dependency/import closure: tests/conftest.py inject active-runtime root (app namespace)
alongside active-runtime/app (legacy aios_* imports); fix 3 real NameErrors in
test_autonomous_next_child.py (mod-qualified refs).
Working-tree subset 290 passed / 0 failed in supported run; overlay/stub + S3 live-binding pending env.
2026-09-14 22:33:41 +08:00

64 lines
2.6 KiB
Python

"""Read-only WP0b Git writer inventory."""
from __future__ import annotations
from dataclasses import dataclass, asdict
from pathlib import Path
import argparse, json, re
PATTERNS={
"git_push":re.compile(r"\bgit\s+push\b"),
"git_commit":re.compile(r"\bgit\s+commit\b"),
"git_update_ref":re.compile(r"\bgit\s+update-ref\b"),
"governed_commit":re.compile(r"\b(?:commitFilesGoverned|commit_files_governed|commit-files)\b"),
"tag_publish":re.compile(r"\b(?:requestOrCreateTag|createReleaseCandidate|tag_publish)\b"),
"ref_mutation_api":re.compile(r"\b(?:update_ref|create_commit|push_branch|receive-pack)\b"),
}
SKIP_PARTS={".git",".venv","venv","node_modules","__pycache__"}
@dataclass(frozen=True)
class WriterEvidence:
path:str; line:int; kind:str; excerpt:str
def scan(repo:Path)->dict:
repo=repo.resolve()
evidence=[]
for p in sorted(repo.rglob("*")):
if not p.is_file() or any(x in SKIP_PARTS for x in p.parts):
continue
if p.suffix.lower() not in {".py",".sh",".bash",".service",".json",".yaml",".yml",".md"}:
continue
try: lines=p.read_text(encoding="utf-8",errors="strict").splitlines()
except (UnicodeDecodeError,OSError): continue
for number,line in enumerate(lines,1):
for kind,pattern in PATTERNS.items():
if pattern.search(line):
evidence.append(WriterEvidence(p.relative_to(repo).as_posix(),number,kind,line.strip()[:240]))
unique={(e.path,e.line,e.kind,e.excerpt):e for e in evidence}
ordered=sorted(unique.values(),key=lambda e:(e.path,e.line,e.kind))
return {
"schema_version":"aios.git-writer-inventory.v1",
"evidence":[asdict(e) for e in ordered],
"writer_candidate_count":len(ordered),
"classification":"EVIDENCE_ONLY_NOT_AUTHORITY",
"completeness":"PARTIAL_DISCOVERY",
"covered_scope":["lexical_writer_candidates"],
"missing_scope":[
"writer_to_authorization_mapping",
"repository_and_ref_resolution",
"cas_semantics",
"receipt_contract",
"live_caller_and_runtime_identity",
],
"g0_exit_eligible":False,
}
def main()->int:
ap=argparse.ArgumentParser(); ap.add_argument("--repo",type=Path,required=True); ap.add_argument("--out",type=Path)
ns=ap.parse_args(); result=scan(ns.repo); text=json.dumps(result,indent=2,sort_keys=True)+"\n"
if ns.out: ns.out.write_text(text,encoding="utf-8")
else: print(text,end="")
return 0
if __name__=="__main__": raise SystemExit(main())