@rvdbreemen/adr-kit-opencode 0.52.0

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 (129) hide show
  1. package/.claude-plugin/plugin.json +29 -0
  2. package/LICENSE +21 -0
  3. package/README.md +850 -0
  4. package/bin/adr +1552 -0
  5. package/bin/adr-audit +454 -0
  6. package/bin/adr-context +584 -0
  7. package/bin/adr-discover +546 -0
  8. package/bin/adr-doctor +166 -0
  9. package/bin/adr-generate-scripts +421 -0
  10. package/bin/adr-grill-signal +131 -0
  11. package/bin/adr-guardian +1263 -0
  12. package/bin/adr-index +199 -0
  13. package/bin/adr-judge +2832 -0
  14. package/bin/adr-judge-precommit +87 -0
  15. package/bin/adr-lint +2087 -0
  16. package/bin/adr-mcp +1093 -0
  17. package/bin/adr-migrate +644 -0
  18. package/bin/adr-quality +275 -0
  19. package/bin/adr-readiness +211 -0
  20. package/bin/adr-readiness-ci +111 -0
  21. package/bin/adr-related +401 -0
  22. package/bin/adr-renumber +254 -0
  23. package/bin/adr-retire +467 -0
  24. package/bin/adr-settings +399 -0
  25. package/bin/adr-status +797 -0
  26. package/bin/adr-suggest +803 -0
  27. package/bin/adr-watch +674 -0
  28. package/bin/adr_catalog.py +536 -0
  29. package/bin/adr_config.py +280 -0
  30. package/bin/adr_doctor_checks.py +407 -0
  31. package/bin/adr_doctor_core.py +342 -0
  32. package/bin/adr_doctor_models.py +186 -0
  33. package/bin/adr_doctor_probes.py +216 -0
  34. package/bin/adr_format.py +786 -0
  35. package/bin/adr_grill_signal.py +123 -0
  36. package/bin/adr_guardian_queue.py +218 -0
  37. package/bin/adr_history_scan.py +278 -0
  38. package/bin/adr_index_core.py +443 -0
  39. package/bin/adr_llm.py +333 -0
  40. package/bin/adr_llm_judge_migration.py +314 -0
  41. package/bin/adr_quality_core.py +674 -0
  42. package/bin/adr_query.py +678 -0
  43. package/bin/adr_readiness.py +442 -0
  44. package/bin/adr_readiness_ci.py +123 -0
  45. package/bin/adr_regex.py +165 -0
  46. package/bin/adr_regex_worker.py +30 -0
  47. package/bin/adr_retrieval_health.py +385 -0
  48. package/bin/adr_schema.py +448 -0
  49. package/bin/adr_state.py +172 -0
  50. package/bin/bump-version +71 -0
  51. package/clients/workflows.json +229 -0
  52. package/hooks/__init__.py +1 -0
  53. package/hooks/adapters/__init__.py +13 -0
  54. package/hooks/adapters/claude.py +27 -0
  55. package/hooks/adapters/codex.py +26 -0
  56. package/hooks/adapters/copilot.py +11 -0
  57. package/hooks/adr-hook.py +128 -0
  58. package/hooks/adr_hook_core.py +843 -0
  59. package/hooks/adr_pr_guard.py +367 -0
  60. package/instructions/ADR-guide.md +48 -0
  61. package/instructions/adr.coding.md +82 -0
  62. package/instructions/adr.review.md +182 -0
  63. package/opencode/plugin.ts +451 -0
  64. package/package.json +41 -0
  65. package/schemas/adr-context-probes.schema.json +56 -0
  66. package/schemas/adr-enforcement.schema.json +57 -0
  67. package/schemas/adr-frontmatter.schema.json +144 -0
  68. package/schemas/adr-index.schema.json +276 -0
  69. package/schemas/adr-kit-config.schema.json +371 -0
  70. package/schemas/adr-readiness.schema.json +41 -0
  71. package/schemas/client-capabilities.schema.json +503 -0
  72. package/schemas/client-certification.schema.json +101 -0
  73. package/schemas/doctor-output.schema.json +92 -0
  74. package/schemas/marketplace.json.schema.json +70 -0
  75. package/schemas/plugin.json.schema.json +67 -0
  76. package/scripts/adr_settings.py +239 -0
  77. package/scripts/benchmark-adr-grilling.py +323 -0
  78. package/scripts/benchmark-client-generation.py +178 -0
  79. package/scripts/build-client-adapters.py +139 -0
  80. package/scripts/bump-version.py +304 -0
  81. package/scripts/check-branch-sync.py +243 -0
  82. package/scripts/check-release-version.py +81 -0
  83. package/scripts/client_certification.py +153 -0
  84. package/scripts/client_evidence.py +280 -0
  85. package/scripts/client_generation.py +288 -0
  86. package/scripts/client_generation_artifacts.py +351 -0
  87. package/scripts/client_generation_model.py +173 -0
  88. package/scripts/client_generation_state.py +260 -0
  89. package/scripts/client_support_matrix.py +360 -0
  90. package/scripts/install-agent-envs.py +300 -0
  91. package/scripts/probe-client-events.py +183 -0
  92. package/scripts/project_setup.py +379 -0
  93. package/scripts/refresh-otgw-corpus.py +219 -0
  94. package/scripts/settings.py +81 -0
  95. package/scripts/setup-project.py +205 -0
  96. package/scripts/sync-agent-plugins.py +17 -0
  97. package/scripts/version_sites.py +377 -0
  98. package/skills/adr/SKILL.md +780 -0
  99. package/skills/audit/SKILL.md +103 -0
  100. package/skills/context/SKILL.md +77 -0
  101. package/skills/grill/SKILL.md +84 -0
  102. package/skills/grill/agents/openai.yaml +4 -0
  103. package/skills/guardian/SKILL.md +316 -0
  104. package/skills/init/SKILL.md +499 -0
  105. package/skills/install-hooks/SKILL.md +154 -0
  106. package/skills/judge/SKILL.md +168 -0
  107. package/skills/lint/SKILL.md +321 -0
  108. package/skills/migrate/SKILL.md +313 -0
  109. package/skills/related/SKILL.md +62 -0
  110. package/skills/retire/SKILL.md +41 -0
  111. package/skills/review/SKILL.md +167 -0
  112. package/skills/settings/SKILL.md +73 -0
  113. package/skills/setup/SKILL.md +128 -0
  114. package/skills/supersede/SKILL.md +136 -0
  115. package/skills/upgrade/SKILL.md +273 -0
  116. package/templates/adr-kit-guide.md +354 -0
  117. package/templates/adr-template.canonical.md +115 -0
  118. package/templates/adr-template.madr.md +131 -0
  119. package/templates/adr-template.md +131 -0
  120. package/templates/adr-template.nygard.md +111 -0
  121. package/templates/cc-settings/guardian-hook-entry.json +9 -0
  122. package/templates/githooks/pre-commit +337 -0
  123. package/templates/github-workflows/adr-audit.yml +58 -0
  124. package/templates/github-workflows/adr-guardian-audit.yml +133 -0
  125. package/templates/github-workflows/adr-index-check.yml +30 -0
  126. package/templates/github-workflows/adr-judge.yml +31 -0
  127. package/templates/github-workflows/adr-readiness.yml +18 -0
  128. package/templates/validate_adr_template.py +38 -0
  129. package/templates/validate_adr_template.sh +74 -0
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env python3
2
+ """Emit bounded, non-blocking ADR grill advisories from the generated index."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import importlib.machinery
8
+ import importlib.util
9
+ import json
10
+ import subprocess
11
+ import sys
12
+ from pathlib import Path
13
+
14
+ _BIN_DIR = Path(__file__).resolve().parent
15
+
16
+
17
+ def _load_sibling(name: str):
18
+ """Import bin/<name>.py by explicit path, WITHOUT touching sys.path.
19
+
20
+ SEC-HIGH (TASK-62): this script carried no sys.path.insert, but it still
21
+ resolved its siblings through CPython's implicit sys.path[0] -- the script's
22
+ own directory. That is the same shadowing surface the insert created (a
23
+ module committed next to this file wins over the standard library), and it
24
+ meant the script could not run under -P / PYTHONSAFEPATH at all. Siblings
25
+ are registered in sys.modules under their bare name so the plain
26
+ `from adr_* import ...` below resolves from the cache instead of the path.
27
+ bin/adr-judge carries the full rationale.
28
+ """
29
+ cached = sys.modules.get(name)
30
+ if cached is not None:
31
+ return cached
32
+ loader = importlib.machinery.SourceFileLoader(name, str(_BIN_DIR / f"{name}.py"))
33
+ spec = importlib.util.spec_from_loader(name, loader)
34
+ module = importlib.util.module_from_spec(spec)
35
+ sys.modules[name] = module
36
+ loader.exec_module(module)
37
+ return module
38
+
39
+
40
+ _load_sibling("adr_grill_signal")
41
+
42
+
43
+ from adr_grill_signal import analyze_index, normalize_path
44
+
45
+
46
+ def _staged(root: Path) -> tuple[list[str], str]:
47
+ names = subprocess.run(
48
+ ["git", "diff", "--cached", "--name-only", "-M"],
49
+ cwd=root,
50
+ capture_output=True,
51
+ text=True,
52
+ encoding="utf-8",
53
+ errors="replace",
54
+ timeout=5,
55
+ )
56
+ diff = subprocess.run(
57
+ ["git", "diff", "--cached", "--unified=0", "-M"],
58
+ cwd=root,
59
+ capture_output=True,
60
+ text=True,
61
+ encoding="utf-8",
62
+ errors="replace",
63
+ timeout=5,
64
+ )
65
+ if names.returncode or diff.returncode:
66
+ raise ValueError(names.stderr.strip() or diff.stderr.strip() or "git diff failed")
67
+ return (
68
+ sorted(
69
+ {normalize_path(line) for line in names.stdout.splitlines() if line.strip()},
70
+ key=str.casefold,
71
+ ),
72
+ diff.stdout,
73
+ )
74
+
75
+
76
+ def _human(report: dict) -> str:
77
+ lines = []
78
+ for item in report["linked_proposed"]:
79
+ lines.append(
80
+ f"[adr-grill] STRONG {item['adr_id']} "
81
+ f"({','.join(item['evidence'])}) -> {item['command']}"
82
+ )
83
+ for item in report["suspected_decisions"]:
84
+ lines.append(
85
+ f"[adr-grill] ADVISORY {item['path']} may contain a durable decision "
86
+ f"-> {item['command']}"
87
+ )
88
+ return "\n".join(lines)
89
+
90
+
91
+ def main() -> int:
92
+ parser = argparse.ArgumentParser(description=__doc__)
93
+ parser.add_argument("--repo-root", default=".")
94
+ parser.add_argument("--index", default="docs/adr/ADR-INDEX.json")
95
+ parser.add_argument("--staged", action="store_true")
96
+ parser.add_argument("--paths", nargs="*", default=[])
97
+ parser.add_argument("--source-text", default="")
98
+ parser.add_argument("--shell", choices=("posix", "powershell"), default="posix")
99
+ parser.add_argument("--format", choices=("human", "json"), default="human")
100
+ args = parser.parse_args()
101
+ try:
102
+ root = Path(args.repo_root).expanduser().resolve()
103
+ index_input = Path(args.index).expanduser()
104
+ index_path = index_input if index_input.is_absolute() else root / index_input
105
+ if not root.is_dir() or not index_path.is_file():
106
+ raise ValueError("repository root or ADR index not found")
107
+ if index_path.stat().st_size > 2 * 1024 * 1024:
108
+ raise ValueError("ADR index exceeds size limit")
109
+ index = json.loads(index_path.read_text(encoding="utf-8"))
110
+ paths, source = _staged(root) if args.staged else (args.paths, args.source_text)
111
+ report = analyze_index(index, paths, source, shell=args.shell)
112
+ except (
113
+ OSError,
114
+ UnicodeError,
115
+ ValueError,
116
+ json.JSONDecodeError,
117
+ subprocess.TimeoutExpired,
118
+ ) as exc:
119
+ print(f"adr-grill-signal: {exc}", file=sys.stderr)
120
+ return 2
121
+ if args.format == "json":
122
+ print(json.dumps(report, indent=2, ensure_ascii=False, sort_keys=True))
123
+ else:
124
+ output = _human(report)
125
+ if output:
126
+ print(output)
127
+ return 0
128
+
129
+
130
+ if __name__ == "__main__":
131
+ raise SystemExit(main())