its-magic 0.1.3-0 → 0.1.3-2

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 (61) hide show
  1. package/installer.ps1 +8 -0
  2. package/installer.py +8 -0
  3. package/installer.sh +1 -0
  4. package/package.json +1 -1
  5. package/scripts/check_intake_template_parity.py +62 -0
  6. package/template/.cursor/agents/curator.mdc +1 -0
  7. package/template/.cursor/agents/po.mdc +1 -0
  8. package/template/.cursor/agents/release.mdc +1 -0
  9. package/template/.cursor/commands/auto.md +90 -0
  10. package/template/.cursor/commands/execute.md +26 -0
  11. package/template/.cursor/commands/refresh-context.md +32 -0
  12. package/template/.cursor/commands/sovereign-critic.md +104 -0
  13. package/template/.cursor/model-catalog.local.example.cursor-only.json +9 -0
  14. package/template/.cursor/model-catalog.local.example.json +9 -0
  15. package/template/.cursor/model-catalog.local.example.level-1-easy.json +9 -0
  16. package/template/.cursor/model-catalog.local.example.level-2-complex.json +9 -0
  17. package/template/.cursor/model-catalog.local.example.level-3-mega.json +9 -0
  18. package/template/.cursor/model-catalog.local.example.level-4-super.json +9 -0
  19. package/template/.cursor/model-catalog.local.example.role-based-balanced.json +18 -0
  20. package/template/.cursor/model-catalog.local.example.role-based-highend.json +18 -0
  21. package/template/.cursor/rules/sovereign-role-manifest.mdc.example +27 -0
  22. package/template/.cursor/scratchpad.local.example.md +55 -0
  23. package/template/.cursor/scratchpad.md +203 -0
  24. package/template/.cursor/sovereign-role-manifest.yaml.example +53 -0
  25. package/template/decisions/DEC-0104.md +279 -0
  26. package/template/decisions/DEC-0105.md +231 -0
  27. package/template/decisions/DEC-0107.md +246 -0
  28. package/template/docs/engineering/architecture.md +78 -0
  29. package/template/docs/engineering/auto-orchestration-reference.md +7 -0
  30. package/template/docs/engineering/context/installer-owned-paths.manifest +8 -0
  31. package/template/docs/engineering/reason_codes.md +411 -0
  32. package/template/docs/engineering/runbook.md +1119 -0
  33. package/template/docs/engineering/sovereign-memory/.gitkeep +0 -0
  34. package/template/docs/engineering/sovereign-memory/retrospectives/.gitkeep +0 -0
  35. package/template/handoffs/sovereign_decisions/.gitkeep +0 -0
  36. package/template/handoffs/sovereign_deferrals/.gitkeep +0 -0
  37. package/template/handoffs/sovereign_role_reviews.jsonl +0 -0
  38. package/template/scripts/__pycache__/decision_ledger_lib.cpython-312.pyc +0 -0
  39. package/template/scripts/check_intake_template_parity.py +181 -0
  40. package/template/scripts/decision_ledger_lib.py +732 -0
  41. package/template/scripts/ledger_validate.py +153 -0
  42. package/template/scripts/model_tier_lib.py +680 -0
  43. package/template/scripts/model_tier_validate.py +368 -0
  44. package/template/scripts/parallel_dev_arbiter.py +923 -0
  45. package/template/scripts/release_trigger_adapters.py +843 -0
  46. package/template/scripts/self_healing_deploy_lib.py +463 -0
  47. package/template/scripts/self_healing_deploy_validate.py +78 -0
  48. package/template/scripts/sovereign_convergence_lib.py +994 -0
  49. package/template/scripts/sovereign_convergence_validate.py +206 -0
  50. package/template/scripts/sovereign_critic_lib.py +629 -0
  51. package/template/scripts/sovereign_critic_validate.py +131 -0
  52. package/template/scripts/sovereign_loop_lib.py +828 -0
  53. package/template/scripts/sovereign_loop_validate.py +122 -0
  54. package/template/scripts/sovereign_memory_lib.py +869 -0
  55. package/template/scripts/sovereign_memory_validate.py +153 -0
  56. package/template/scripts/sovereign_role_manifest_lib.py +547 -0
  57. package/template/scripts/sovereign_role_manifest_validate.py +105 -0
  58. package/template/tests/us0108_contract_test.py +207 -0
  59. package/template/tests/us0109_contract_test.py +209 -0
  60. package/template/tests/us0109_us0110_compose_test.py +34 -0
  61. package/template/tests/us0111_contract_test.py +345 -0
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Sovereign Loop deferral register validator (US-0107 / DEC-0107).
4
+
5
+ Exit codes:
6
+ - 0: validation passed (or --self-test OK)
7
+ - 1: fail-closed validation error (with --enforce)
8
+ - 2: usage error
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import argparse
14
+ import json
15
+ import sys
16
+ import tempfile
17
+ import uuid
18
+ from pathlib import Path
19
+ from typing import List, Tuple
20
+
21
+ _SCRIPT_DIR = Path(__file__).resolve().parent
22
+ sys.path.insert(0, str(_SCRIPT_DIR))
23
+
24
+ from sovereign_loop_lib import ( # noqa: E402
25
+ build_sample_deferral,
26
+ resolve_deferrals_path,
27
+ schema_check_deferral,
28
+ self_test,
29
+ )
30
+
31
+
32
+ def validate_jsonl_file(path: Path) -> Tuple[bool, List[str]]:
33
+ errors: List[str] = []
34
+ if not path.is_file():
35
+ return True, errors
36
+
37
+ for line_no, raw in enumerate(path.read_text(encoding="utf-8", errors="replace").splitlines(), start=1):
38
+ if not raw.strip():
39
+ continue
40
+ try:
41
+ obj = json.loads(raw)
42
+ except json.JSONDecodeError as exc:
43
+ errors.append(f"{path}:{line_no}: JSON decode error: {exc}")
44
+ continue
45
+ ok, err = schema_check_deferral(obj)
46
+ if not ok:
47
+ errors.append(f"{path}:{line_no}: {err}")
48
+
49
+ return len(errors) == 0, errors
50
+
51
+
52
+ def validate_repo(repo: Path) -> Tuple[bool, List[str]]:
53
+ path = resolve_deferrals_path(repo)
54
+ if not path.is_file():
55
+ return True, []
56
+ return validate_jsonl_file(path)
57
+
58
+
59
+ def run_self_test() -> bool:
60
+ if not self_test():
61
+ return False
62
+
63
+ good = build_sample_deferral()
64
+ good["deferral_id"] = str(uuid.uuid4())
65
+ ok, err = schema_check_deferral(good)
66
+ if not ok:
67
+ print(f" fixture deferral: {err}", file=sys.stderr)
68
+ return False
69
+
70
+ with tempfile.TemporaryDirectory() as tmp:
71
+ bad_path = Path(tmp) / "bad.jsonl"
72
+ bad_path.write_text('{"schema_version": 1}\n', encoding="utf-8")
73
+ ok_file, errors = validate_jsonl_file(bad_path)
74
+ if ok_file or not errors:
75
+ print(" expected invalid fixture to fail", file=sys.stderr)
76
+ return False
77
+
78
+ print("[SOVEREIGN_LOOP_VALIDATION_OK]")
79
+ return True
80
+
81
+
82
+ def main() -> int:
83
+ parser = argparse.ArgumentParser(description="Sovereign loop deferral validator (US-0107 / DEC-0107)")
84
+ parser.add_argument("--file", type=Path, help="Validate single JSONL file")
85
+ parser.add_argument("--repo", type=Path, help="Validate repo deferrals path if present")
86
+ parser.add_argument("--self-test", action="store_true", help="Run lib self-test + schema fixtures")
87
+ parser.add_argument("--enforce", action="store_true", help="Exit non-zero on validation failure")
88
+
89
+ args = parser.parse_args()
90
+
91
+ if args.self_test:
92
+ return 0 if run_self_test() else 1
93
+
94
+ errors: List[str] = []
95
+
96
+ if args.file is not None:
97
+ ok, file_errors = validate_jsonl_file(args.file)
98
+ if not ok:
99
+ errors.extend(file_errors)
100
+
101
+ if args.repo is not None:
102
+ ok_repo, repo_errors = validate_repo(args.repo)
103
+ if not ok_repo:
104
+ errors.extend(repo_errors)
105
+
106
+ if args.file is None and args.repo is None:
107
+ parser.print_help()
108
+ return 2
109
+
110
+ if errors:
111
+ for item in errors:
112
+ print(item, file=sys.stderr)
113
+ if args.enforce:
114
+ return 1
115
+ return 0
116
+
117
+ print("[SOVEREIGN_LOOP_VALIDATION_OK]")
118
+ return 0
119
+
120
+
121
+ if __name__ == "__main__":
122
+ sys.exit(main())