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