@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,70 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/rvdbreemen/adr-kit/schemas/marketplace.json.schema.json",
4
+ "title": "Claude Code plugin marketplace manifest (.claude-plugin/marketplace.json)",
5
+ "description": "Hand-curated schema for the Claude Code marketplace manifest. A marketplace manifest registers one or more plugins under a marketplace name so users can install them via /plugin install <plugin>@<marketplace>. Bug prevented: v0.7.1 bug was that the repo only had .claude-plugin/plugin.json (per-plugin manifest) but lacked .claude-plugin/marketplace.json (this file), which caused /plugin marketplace add <user>/<repo> to register the marketplace name correctly but /plugin install <plugin>@<marketplace> to fail with 'Unknown command' for the plugin's own slash commands. The required-files CI step covers presence; this schema covers structure.",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": ["name", "description", "owner", "plugins"],
9
+ "properties": {
10
+ "name": {
11
+ "type": "string",
12
+ "description": "Marketplace identifier. Used as the suffix in /plugin install <plugin>@<marketplace>. Kebab-case lowercase.",
13
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
14
+ "minLength": 2,
15
+ "maxLength": 64
16
+ },
17
+ "description": {
18
+ "type": "string",
19
+ "description": "Short description of the marketplace.",
20
+ "minLength": 1,
21
+ "maxLength": 500
22
+ },
23
+ "owner": {
24
+ "type": "object",
25
+ "description": "Marketplace owner metadata. Must be an object with at least name; optional url.",
26
+ "additionalProperties": true,
27
+ "required": ["name"],
28
+ "properties": {
29
+ "name": { "type": "string", "minLength": 1 },
30
+ "url": { "type": "string", "format": "uri" }
31
+ }
32
+ },
33
+ "plugins": {
34
+ "type": "array",
35
+ "description": "List of plugins offered by this marketplace. Each entry must declare name, source, version, and description.",
36
+ "minItems": 1,
37
+ "items": {
38
+ "type": "object",
39
+ "additionalProperties": true,
40
+ "required": ["name", "source", "version", "description"],
41
+ "properties": {
42
+ "name": {
43
+ "type": "string",
44
+ "description": "Plugin name. Must match the name field in the plugin's own .claude-plugin/plugin.json.",
45
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
46
+ "minLength": 2,
47
+ "maxLength": 64
48
+ },
49
+ "source": {
50
+ "type": "string",
51
+ "description": "Path or URL where the plugin is located. './' for plugins co-located with the marketplace manifest.",
52
+ "minLength": 1
53
+ },
54
+ "version": {
55
+ "type": "string",
56
+ "description": "Plugin version. Should match the version in the plugin's own manifest.",
57
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[A-Za-z0-9.-]+)?(\\+[A-Za-z0-9.-]+)?$"
58
+ },
59
+ "description": {
60
+ "type": "string",
61
+ "minLength": 1,
62
+ "maxLength": 500
63
+ },
64
+ "homepage": { "type": "string", "format": "uri" },
65
+ "license": { "type": "string", "minLength": 1, "maxLength": 64 }
66
+ }
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://github.com/rvdbreemen/adr-kit/schemas/plugin.json.schema.json",
4
+ "title": "Claude Code plugin manifest (.claude-plugin/plugin.json)",
5
+ "description": "Hand-curated schema for the Claude Code per-plugin manifest. Documents the field types observed in the published Claude Code plugin manifest spec and rejects the historical bug patterns that broke install for adr-kit users. Bugs prevented: (1) v0.7.2 bug -- repository declared as object {type, url}, npm-style; the manifest schema requires a plain URL string. (2) v0.7.1 bug was a missing marketplace.json, covered by the sibling schema marketplace.json.schema.json plus the required-files CI step. (3) Defensive: author must be an object {name, ...}, not a plain string.",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "required": ["name", "description", "version"],
9
+ "properties": {
10
+ "name": {
11
+ "type": "string",
12
+ "description": "Plugin name. Kebab-case, lowercase, starts with a letter.",
13
+ "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$",
14
+ "minLength": 2,
15
+ "maxLength": 64
16
+ },
17
+ "description": {
18
+ "type": "string",
19
+ "description": "Short human-readable description shown in the plugin picker.",
20
+ "minLength": 1,
21
+ "maxLength": 500
22
+ },
23
+ "version": {
24
+ "type": "string",
25
+ "description": "Semantic version: MAJOR.MINOR.PATCH with optional pre-release suffix.",
26
+ "pattern": "^\\d+\\.\\d+\\.\\d+(-[A-Za-z0-9.-]+)?(\\+[A-Za-z0-9.-]+)?$"
27
+ },
28
+ "author": {
29
+ "description": "Author info. Must be an object; plain strings are rejected (some manifests in the wild used a string, the official spec wants an object).",
30
+ "type": "object",
31
+ "additionalProperties": true,
32
+ "required": ["name"],
33
+ "properties": {
34
+ "name": { "type": "string", "minLength": 1 },
35
+ "email": { "type": "string", "format": "email" },
36
+ "url": { "type": "string", "format": "uri" }
37
+ }
38
+ },
39
+ "homepage": {
40
+ "type": "string",
41
+ "description": "Plugin homepage URL.",
42
+ "format": "uri"
43
+ },
44
+ "repository": {
45
+ "type": "string",
46
+ "description": "Repository URL as a plain string. Historical bug fixed in v0.7.2: the field was declared as an object {type, url} (npm package.json style), which the Claude Code plugin manifest schema rejects with 'expected string, received object'. Use a plain URL string instead.",
47
+ "format": "uri"
48
+ },
49
+ "license": {
50
+ "type": "string",
51
+ "description": "SPDX license identifier or short license name.",
52
+ "minLength": 1,
53
+ "maxLength": 64
54
+ },
55
+ "keywords": {
56
+ "type": "array",
57
+ "description": "Search keywords for plugin marketplaces.",
58
+ "items": { "type": "string", "minLength": 1, "maxLength": 64 },
59
+ "maxItems": 30
60
+ },
61
+ "dependencies": {
62
+ "type": "array",
63
+ "description": "Other plugins this plugin depends on. Empty array for none.",
64
+ "items": { "type": "string" }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,239 @@
1
+ """Deterministic global/project settings resolution for ADR Kit."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ import os
7
+ import stat
8
+ import tempfile
9
+ import urllib.error
10
+ import urllib.request
11
+ from copy import deepcopy
12
+ from pathlib import Path
13
+ from typing import Any, Iterable
14
+
15
+
16
+ DEFAULTS: dict[str, Any] = {
17
+ "pre_commit": {"enabled": True},
18
+ "update": {
19
+ "policy": "verified-stable-auto",
20
+ "trigger": "project-setup",
21
+ "frequency_hours": 24,
22
+ "offline": False,
23
+ "pinned_version": None,
24
+ },
25
+ "clients": {
26
+ "claude": {"enabled": None},
27
+ "codex": {"enabled": None},
28
+ "copilot": {"enabled": None},
29
+ },
30
+ "doctor": {
31
+ "auto_repair": True,
32
+ "check_only": False,
33
+ },
34
+ }
35
+
36
+ ALLOWED_KEYS = frozenset()
37
+
38
+
39
+ class SettingsError(RuntimeError):
40
+ """Raised when a settings document or key is invalid."""
41
+
42
+
43
+ def _flatten(value: dict[str, Any], prefix: str = "") -> dict[str, Any]:
44
+ result: dict[str, Any] = {}
45
+ for key, item in value.items():
46
+ dotted = f"{prefix}.{key}" if prefix else key
47
+ if isinstance(item, dict):
48
+ result.update(_flatten(item, dotted))
49
+ else:
50
+ result[dotted] = item
51
+ return result
52
+
53
+
54
+ ALLOWED_KEYS = frozenset(_flatten(DEFAULTS))
55
+
56
+
57
+ def global_settings_path(env: dict[str, str] | None = None) -> Path:
58
+ values = os.environ if env is None else env
59
+ if values.get("ADR_KIT_GLOBAL_SETTINGS"):
60
+ return Path(values["ADR_KIT_GLOBAL_SETTINGS"]).expanduser()
61
+ if os.name == "nt":
62
+ base = Path(values.get("APPDATA", Path.home() / "AppData" / "Roaming"))
63
+ else:
64
+ base = Path(values.get("XDG_CONFIG_HOME", Path.home() / ".config"))
65
+ return base / "adr-kit" / "settings.json"
66
+
67
+
68
+ def project_settings_path(project_root: Path) -> Path:
69
+ return project_root / ".adr-kit" / "settings.json"
70
+
71
+
72
+ def load_document(path: Path) -> dict[str, Any]:
73
+ if not path.exists():
74
+ return {}
75
+ try:
76
+ value = json.loads(path.read_text(encoding="utf-8"))
77
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
78
+ raise SettingsError(f"cannot read settings {path}: {exc}") from exc
79
+ if not isinstance(value, dict):
80
+ raise SettingsError(f"settings root must be an object: {path}")
81
+ unknown = sorted(set(_flatten(value)) - ALLOWED_KEYS)
82
+ if unknown:
83
+ raise SettingsError(
84
+ f"unknown settings in {path}: {', '.join(unknown)}"
85
+ )
86
+ for key, item in _flatten(value).items():
87
+ _validate_value(key, item)
88
+ return value
89
+
90
+
91
+ def _set_nested(target: dict[str, Any], dotted: str, value: Any) -> None:
92
+ parts = dotted.split(".")
93
+ cursor = target
94
+ for part in parts[:-1]:
95
+ child = cursor.setdefault(part, {})
96
+ if not isinstance(child, dict):
97
+ raise SettingsError(f"setting path is not an object: {dotted}")
98
+ cursor = child
99
+ cursor[parts[-1]] = value
100
+
101
+
102
+ def _delete_nested(target: dict[str, Any], dotted: str) -> None:
103
+ parts = dotted.split(".")
104
+ stack: list[tuple[dict[str, Any], str]] = []
105
+ cursor = target
106
+ for part in parts[:-1]:
107
+ child = cursor.get(part)
108
+ if not isinstance(child, dict):
109
+ return
110
+ stack.append((cursor, part))
111
+ cursor = child
112
+ cursor.pop(parts[-1], None)
113
+ for parent, key in reversed(stack):
114
+ child = parent.get(key)
115
+ if isinstance(child, dict) and not child:
116
+ parent.pop(key)
117
+
118
+
119
+ def resolve_settings(
120
+ project_root: Path,
121
+ *,
122
+ global_path: Path | None = None,
123
+ ) -> dict[str, Any]:
124
+ global_file = global_path or global_settings_path()
125
+ project_file = project_settings_path(project_root)
126
+ values = deepcopy(DEFAULTS)
127
+ sources = {key: "default" for key in ALLOWED_KEYS}
128
+
129
+ for source, document in (
130
+ ("global", load_document(global_file)),
131
+ ("project", load_document(project_file)),
132
+ ):
133
+ for key, value in _flatten(document).items():
134
+ _set_nested(values, key, value)
135
+ sources[key] = source
136
+
137
+ entries = [
138
+ {"key": key, "value": value, "source": sources[key]}
139
+ for key, value in sorted(_flatten(values).items())
140
+ ]
141
+ return {
142
+ "values": values,
143
+ "entries": entries,
144
+ "paths": {
145
+ "global": str(global_file),
146
+ "project": str(project_file),
147
+ },
148
+ }
149
+
150
+
151
+ def parse_cli_value(raw: str) -> Any:
152
+ try:
153
+ return json.loads(raw)
154
+ except json.JSONDecodeError:
155
+ return raw
156
+
157
+
158
+ def write_setting(
159
+ project_root: Path,
160
+ scope: str,
161
+ key: str,
162
+ value: Any = None,
163
+ *,
164
+ unset: bool = False,
165
+ global_path: Path | None = None,
166
+ ) -> Path:
167
+ if key not in ALLOWED_KEYS:
168
+ raise SettingsError(f"unknown setting: {key}")
169
+ if scope not in {"global", "project"}:
170
+ raise SettingsError(f"invalid scope: {scope}")
171
+ if not unset:
172
+ _validate_value(key, value)
173
+ path = (
174
+ (global_path or global_settings_path())
175
+ if scope == "global"
176
+ else project_settings_path(project_root)
177
+ )
178
+ document = load_document(path)
179
+ if unset:
180
+ _delete_nested(document, key)
181
+ else:
182
+ _set_nested(document, key, value)
183
+ _atomic_json_write(path, document)
184
+ return path
185
+
186
+
187
+ def _validate_value(key: str, value: Any) -> None:
188
+ boolean_keys = {
189
+ "pre_commit.enabled",
190
+ "update.offline",
191
+ "doctor.auto_repair",
192
+ "doctor.check_only",
193
+ }
194
+ if key in boolean_keys and type(value) is not bool:
195
+ raise SettingsError(f"{key} must be boolean")
196
+ if key.startswith("clients.") and key.endswith(".enabled"):
197
+ if value is not None and type(value) is not bool:
198
+ raise SettingsError(f"{key} must be boolean or null")
199
+ if key == "update.policy" and value not in {
200
+ "verified-stable-auto",
201
+ "notify",
202
+ "manual",
203
+ "pinned",
204
+ }:
205
+ raise SettingsError(f"invalid update policy: {value}")
206
+ if key == "update.trigger" and value not in {
207
+ "project-setup",
208
+ "deferred-maintenance",
209
+ "manual",
210
+ }:
211
+ raise SettingsError(f"invalid update trigger: {value}")
212
+ if key == "update.frequency_hours":
213
+ if type(value) is not int or value < 1:
214
+ raise SettingsError("update.frequency_hours must be an integer >= 1")
215
+ if key in {
216
+ "update.pinned_version",
217
+ } and value is not None:
218
+ if not isinstance(value, str) or not value.strip():
219
+ raise SettingsError(f"{key} must be a non-empty string or null")
220
+
221
+
222
+ def _atomic_json_write(path: Path, value: dict[str, Any]) -> None:
223
+ path.parent.mkdir(parents=True, exist_ok=True)
224
+ payload = json.dumps(value, indent=2, sort_keys=True) + "\n"
225
+ old_mode = stat.S_IMODE(path.stat().st_mode) if path.exists() else None
226
+ descriptor, temporary_name = tempfile.mkstemp(
227
+ prefix=f".{path.name}.", suffix=".tmp", dir=path.parent
228
+ )
229
+ temporary = Path(temporary_name)
230
+ try:
231
+ with os.fdopen(descriptor, "w", encoding="utf-8", newline="\n") as out:
232
+ out.write(payload)
233
+ out.flush()
234
+ os.fsync(out.fileno())
235
+ if old_mode is not None:
236
+ os.chmod(temporary, old_mode)
237
+ os.replace(temporary, path)
238
+ finally:
239
+ temporary.unlink(missing_ok=True)