its-magic 0.1.2-43 → 0.1.2-49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +119 -0
  2. package/package.json +1 -1
  3. package/scripts/check_intake_template_parity.py +90 -2
  4. package/scripts/guard_installer_publish.py +19 -1
  5. package/template/.cursor/commands/architecture.md +16 -6
  6. package/template/.cursor/commands/auto.md +42 -0
  7. package/template/.cursor/commands/execute.md +49 -0
  8. package/template/.cursor/commands/qa.md +37 -0
  9. package/template/.cursor/commands/release.md +11 -0
  10. package/template/.cursor/commands/verify-work.md +43 -1
  11. package/template/.cursor/rules/caveman.mdc +43 -0
  12. package/template/.cursor/scratchpad.local.example.md +39 -4
  13. package/template/.cursor/scratchpad.md +34 -4
  14. package/template/.github/workflows/ci.yml +4 -114
  15. package/template/README.md +113 -0
  16. package/template/docs/engineering/auto-orchestration-reference.md +62 -1
  17. package/template/docs/engineering/context/installer-owned-paths.manifest +12 -0
  18. package/template/docs/engineering/context/readme-section-affinity.json +30 -0
  19. package/template/docs/engineering/runbook.md +151 -5
  20. package/template/scripts/auto_outer_driver.py +521 -0
  21. package/template/scripts/check_downstream_ci_guard.py +67 -0
  22. package/template/scripts/check_intake_template_parity.py +90 -2
  23. package/template/scripts/downstream_ci_guard_lib.py +222 -0
  24. package/template/scripts/enforce-triad-hot-surface.py +135 -8
  25. package/template/scripts/readme_feature_coverage_lib.py +608 -0
  26. package/template/scripts/uat_probe_lib.py +868 -0
  27. package/template/scripts/validate_readme_feature_coverage.py +140 -0
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Validate README feature coverage vs backlog (US-0091 / DEC-0074).
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import argparse
9
+ import os
10
+ import sys
11
+
12
+ _SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
13
+ _REPO_ROOT = os.path.normpath(os.path.join(_SCRIPT_DIR, ".."))
14
+
15
+ if _REPO_ROOT not in sys.path:
16
+ sys.path.insert(0, _REPO_ROOT)
17
+ if _SCRIPT_DIR not in sys.path:
18
+ sys.path.insert(0, _SCRIPT_DIR)
19
+
20
+ import installer # noqa: E402
21
+ import readme_feature_coverage_lib as rfc # noqa: E402
22
+
23
+
24
+ def _enforce_flag(merged: dict) -> bool:
25
+ raw = (merged.get("README_FEATURE_COVERAGE_ENFORCE") or "0").strip()
26
+ return raw == "1"
27
+
28
+
29
+ def main() -> int:
30
+ parser = argparse.ArgumentParser(
31
+ description="Validate README feature coverage vs backlog (DEC-0074)."
32
+ )
33
+ parser.add_argument(
34
+ "--repo",
35
+ default=_REPO_ROOT,
36
+ help="Target repository root (default: parent of scripts/).",
37
+ )
38
+ parser.add_argument(
39
+ "--backlog",
40
+ default=None,
41
+ help="Backlog file (default: docs/product/backlog.md under --repo).",
42
+ )
43
+ parser.add_argument(
44
+ "--self-test",
45
+ action="store_true",
46
+ help="Run predicate matrix + schema stability checks.",
47
+ )
48
+ parser.add_argument(
49
+ "--report",
50
+ action="store_true",
51
+ help="Emit stable JSON report to stdout.",
52
+ )
53
+ parser.add_argument(
54
+ "--audit-out",
55
+ metavar="PATH",
56
+ default=None,
57
+ help="Write gap audit artifact (JSON) to PATH.",
58
+ )
59
+ parser.add_argument(
60
+ "--enforce",
61
+ action="store_true",
62
+ help="Blocking mode (required for /release when enforce=1).",
63
+ )
64
+ parser.add_argument(
65
+ "--no-template-parity",
66
+ action="store_true",
67
+ help="Skip active vs template/ README and script parity sub-check.",
68
+ )
69
+ args = parser.parse_args()
70
+
71
+ if args.self_test:
72
+ try:
73
+ rfc.self_test_predicate_matrix()
74
+ rfc.self_test_report_schema()
75
+ except AssertionError as exc:
76
+ print(f"self-test failed: {exc}", file=sys.stderr)
77
+ return 2
78
+ print("[README_FEATURE_COVERAGE_SELF_TEST_OK]")
79
+ return 0
80
+
81
+ target = os.path.abspath(args.repo)
82
+ backlog = args.backlog or os.path.join(target, "docs", "product", "backlog.md")
83
+ if not os.path.isfile(backlog):
84
+ print(f"{rfc.REASON_INPUT_INVALID}: backlog not found: {backlog}", file=sys.stderr)
85
+ return 2
86
+
87
+ merged, _paths = installer.merge_scratchpad_layers(target)
88
+ enforce = args.enforce or _enforce_flag(merged)
89
+
90
+ merged_profile = None if args.no_template_parity else merged
91
+ report, stderr_lines = rfc.build_report(
92
+ target,
93
+ backlog,
94
+ enforce=enforce,
95
+ merged=merged_profile,
96
+ skip_parity=args.no_template_parity,
97
+ )
98
+
99
+ if args.audit_out:
100
+ audit_path = args.audit_out
101
+ if not os.path.isabs(audit_path):
102
+ audit_path = os.path.join(target, audit_path)
103
+ os.makedirs(os.path.dirname(audit_path), exist_ok=True)
104
+ audit_obj = {
105
+ "audit_schema_version": 1,
106
+ "coverage_total": report["coverage_total"],
107
+ "gaps": report["gaps"],
108
+ "items": report["coverage_present"] + report["coverage_missing"],
109
+ "status": report["status"],
110
+ }
111
+ with open(audit_path, "w", encoding="utf-8", newline="\n") as f:
112
+ f.write(rfc.canonical_json(audit_obj))
113
+
114
+ blocking = bool(stderr_lines) or report["status"] != "PASS"
115
+
116
+ if args.report or not args.audit_out:
117
+ sys.stdout.write(rfc.canonical_json(report))
118
+
119
+ if blocking and (args.enforce or args.report):
120
+ print(rfc.REASON_BLOCKED, file=sys.stderr)
121
+ for line in sorted(set(stderr_lines)):
122
+ print(line, file=sys.stderr)
123
+ return 1
124
+
125
+ if blocking and args.audit_out and not args.report:
126
+ return 0
127
+
128
+ if blocking:
129
+ print(rfc.REASON_BLOCKED, file=sys.stderr)
130
+ for line in sorted(set(stderr_lines)):
131
+ print(line, file=sys.stderr)
132
+ return 1
133
+
134
+ if args.enforce:
135
+ print("[README_FEATURE_COVERAGE_VALIDATE_OK]")
136
+ return 0
137
+
138
+
139
+ if __name__ == "__main__":
140
+ raise SystemExit(main())