@rvdbreemen/adr-kit-opencode 0.55.1 → 0.56.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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +11 -11
- package/bin/adr +64 -7
- package/bin/adr_catalog.py +12 -34
- package/bin/adr_format.py +112 -4
- package/bin/adr_schema.py +28 -10
- package/package.json +1 -1
- package/scripts/bump-version.py +8 -1
- package/scripts/check-release-version.py +29 -4
- package/templates/adr-kit-guide.md +1 -1
- package/templates/cc-settings/guardian-hook-entry.json +1 -1
- package/templates/githooks/pre-commit +1 -1
- package/templates/github-workflows/adr-readiness.yml +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adr-kit",
|
|
3
3
|
"description": "Architecture Decision Record toolkit for AI coding agents: bootstrap, multi-format authoring, bounded deterministic enforcement, lifecycle workflows, context injection, generated graph indexes, and local health checks.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.56.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Robert van den Breemen",
|
|
7
7
|
"url": "https://github.com/rvdbreemen"
|
package/README.md
CHANGED
|
@@ -135,8 +135,8 @@ And because decisions age, a periodic guardian flags drift between code and deci
|
|
|
135
135
|
### One engine, three certified CLIs plus OpenCode
|
|
136
136
|
|
|
137
137
|
ADR Kit ships separate integration payloads for Claude Code CLI, OpenAI Codex
|
|
138
|
-
CLI, and the standalone GitHub Copilot CLI. All three carry the same
|
|
139
|
-
workflows, the same deterministic engines, the same key-free
|
|
138
|
+
CLI, and the standalone GitHub Copilot CLI. All three carry the same 17
|
|
139
|
+
workflows, the same deterministic engines, the same key-free seven-tool MCP
|
|
140
140
|
server, and English skill metadata; only the native event surface differs. A
|
|
141
141
|
separate native OpenCode plugin uses the same engines and adds OpenCode-native
|
|
142
142
|
config, skills, commands, hooks, compaction context, and MCP registration. The
|
|
@@ -241,7 +241,7 @@ required.
|
|
|
241
241
|
|
|
242
242
|
The Claude integration keeps only its manifest under `.claude-plugin/`.
|
|
243
243
|
Plugin-root `skills/`, `hooks/hooks.json`, `.mcp.json`, agents, and bundled
|
|
244
|
-
executables provide
|
|
244
|
+
executables provide 17 workflows, eight bounded hooks, and the seven-tool MCP
|
|
245
245
|
server.
|
|
246
246
|
|
|
247
247
|
### OpenAI Codex
|
|
@@ -255,8 +255,8 @@ codex mcp list
|
|
|
255
255
|
Codex does not use Claude's `/adr-kit:...` slash-command syntax. ADR Kit
|
|
256
256
|
workflows appear as namespaced skills: open `/skills`, or invoke
|
|
257
257
|
`$adr-kit:context`, `$adr-kit:judge`, `$adr-kit:lint`, and the other skills.
|
|
258
|
-
The separate `codex/` distribution contains all
|
|
259
|
-
|
|
258
|
+
The separate `codex/` distribution contains all 17 workflows and the key-free
|
|
259
|
+
seven-tool MCP server. See the official [Codex skills](https://learn.chatgpt.com/docs/build-skills)
|
|
260
260
|
and [plugin](https://learn.chatgpt.com/docs/build-plugins) contracts.
|
|
261
261
|
|
|
262
262
|
### Standalone GitHub Copilot CLI
|
|
@@ -295,7 +295,7 @@ Agents should use these native update commands instead of editing the installed
|
|
|
295
295
|
### OpenCode
|
|
296
296
|
|
|
297
297
|
OpenCode is supported through a separate native plugin package. It uses the
|
|
298
|
-
same deterministic Python engines and
|
|
298
|
+
same deterministic Python engines and seven-tool MCP server as the certified
|
|
299
299
|
clients, while adding OpenCode-native configuration, skills, commands, context,
|
|
300
300
|
compaction, edit, shell, and session hooks.
|
|
301
301
|
|
|
@@ -309,12 +309,12 @@ configured:
|
|
|
309
309
|
}
|
|
310
310
|
```
|
|
311
311
|
|
|
312
|
-
For another project, use the published package
|
|
312
|
+
For another project, use the published package:
|
|
313
313
|
|
|
314
314
|
```json
|
|
315
315
|
{
|
|
316
316
|
"$schema": "https://opencode.ai/config.json",
|
|
317
|
-
"plugin": ["@rvdbreemen/adr-kit-opencode@0.
|
|
317
|
+
"plugin": ["@rvdbreemen/adr-kit-opencode@0.56.0"]
|
|
318
318
|
}
|
|
319
319
|
```
|
|
320
320
|
|
|
@@ -671,7 +671,7 @@ jobs:
|
|
|
671
671
|
- uses: actions/checkout@v4
|
|
672
672
|
with:
|
|
673
673
|
fetch-depth: 0 # both sides of the diff must be available
|
|
674
|
-
- uses: rvdbreemen/adr-kit/.github/actions/adr-judge@v0.
|
|
674
|
+
- uses: rvdbreemen/adr-kit/.github/actions/adr-judge@v0.56.0
|
|
675
675
|
with:
|
|
676
676
|
adr-dir: docs/adr/
|
|
677
677
|
```
|
|
@@ -685,7 +685,7 @@ The action also takes `max-diff-bytes` (default 32 MiB, available from the relea
|
|
|
685
685
|
```yaml
|
|
686
686
|
repos:
|
|
687
687
|
- repo: https://github.com/rvdbreemen/adr-kit
|
|
688
|
-
rev: v0.
|
|
688
|
+
rev: v0.56.0
|
|
689
689
|
hooks:
|
|
690
690
|
- id: adr-judge
|
|
691
691
|
```
|
|
@@ -796,7 +796,7 @@ A plain ADR template gives you a markdown file with sections to fill in. What `a
|
|
|
796
796
|
| Enforcement | absent | declarative rules vs every commit and PR, key-free; opt-in LLM judge |
|
|
797
797
|
| Aging | absent | guardian (drift, missing, stale), retirement audit, trend history, coverage KPI |
|
|
798
798
|
| Team workflows | absent | CI sweeps with tracking issue, collision-safe numbering, audited overrides, guided supersession |
|
|
799
|
-
| Tool integration | none | Claude Code, OpenAI Codex, GitHub Copilot CLI, and OpenCode integrations plus a
|
|
799
|
+
| Tool integration | none | Claude Code, OpenAI Codex, GitHub Copilot CLI, and OpenCode integrations plus a 7-tool MCP server |
|
|
800
800
|
|
|
801
801
|
If your team is happy with a plain template and the discipline lives in your culture, you do not need this. If you want the discipline to survive contact with an AI agent at 2 a.m., this is what `adr-kit` is for.
|
|
802
802
|
|
package/bin/adr
CHANGED
|
@@ -54,6 +54,7 @@ from adr_format import (
|
|
|
54
54
|
normalize_profile,
|
|
55
55
|
profile_catalog,
|
|
56
56
|
profile_template_path,
|
|
57
|
+
section_span,
|
|
57
58
|
unresolved_open_questions,
|
|
58
59
|
)
|
|
59
60
|
from adr_schema import (
|
|
@@ -102,6 +103,24 @@ def find_adr_file(adr_dir: Path, adr_id: str) -> Path:
|
|
|
102
103
|
return matches[0]
|
|
103
104
|
|
|
104
105
|
|
|
106
|
+
_ADR_RECORD_RE = re.compile(r"(?i)^ADR-\d{1,4}-")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def iter_adr_records(adr_dir: Path):
|
|
110
|
+
"""Yield ADR record paths, skipping the generated ADR-INDEX.* artefacts.
|
|
111
|
+
|
|
112
|
+
``glob("ADR-*.md")`` also matches ``ADR-INDEX.md``, which every lifecycle
|
|
113
|
+
command writes in the same transaction as the record it mutates. Feeding
|
|
114
|
+
that generated file to ``load_adr`` was only ever harmless because the
|
|
115
|
+
frontmatter inference invented ``status: Proposed`` for it. Once inference
|
|
116
|
+
started failing closed instead of guessing (issue #118), the generated
|
|
117
|
+
index became a hard error in the middle of an otherwise valid supersede.
|
|
118
|
+
"""
|
|
119
|
+
for path in sorted(adr_dir.glob("ADR-*.md")):
|
|
120
|
+
if _ADR_RECORD_RE.match(path.name):
|
|
121
|
+
yield path
|
|
122
|
+
|
|
123
|
+
|
|
105
124
|
def load_adr(path: Path) -> Tuple[Dict, str]:
|
|
106
125
|
text = path.read_text(encoding="utf-8")
|
|
107
126
|
migrated, _changed, issues = migrate_text(text, path)
|
|
@@ -236,6 +255,30 @@ def history_entry(status: str, changed_by: str, reason: str, changed_via: str, w
|
|
|
236
255
|
)
|
|
237
256
|
|
|
238
257
|
|
|
258
|
+
def _splice_after_yaml_block(body: str, pos: int, limit: int, entry: str) -> str:
|
|
259
|
+
"""Insert `entry` after the last line of an unfenced ``status_history`` block.
|
|
260
|
+
|
|
261
|
+
A line belongs to the block while it is blank or indented; the first
|
|
262
|
+
unindented non-blank line inside the section ends it. Bounded by `limit`
|
|
263
|
+
so a malformed document cannot walk out of the section.
|
|
264
|
+
"""
|
|
265
|
+
newline = body.find("\n", pos)
|
|
266
|
+
insert_at = newline + 1 if newline != -1 and newline < limit else limit
|
|
267
|
+
cursor = insert_at
|
|
268
|
+
while cursor < limit:
|
|
269
|
+
newline = body.find("\n", cursor)
|
|
270
|
+
if newline == -1 or newline >= limit:
|
|
271
|
+
line, end = body[cursor:limit], limit
|
|
272
|
+
else:
|
|
273
|
+
line, end = body[cursor:newline], newline + 1
|
|
274
|
+
if line.strip():
|
|
275
|
+
if not line[:1].isspace():
|
|
276
|
+
break
|
|
277
|
+
insert_at = end
|
|
278
|
+
cursor = end
|
|
279
|
+
return body[:insert_at] + entry + body[insert_at:]
|
|
280
|
+
|
|
281
|
+
|
|
239
282
|
def append_status_history(
|
|
240
283
|
body: str,
|
|
241
284
|
status: str,
|
|
@@ -245,11 +288,25 @@ def append_status_history(
|
|
|
245
288
|
when: str,
|
|
246
289
|
) -> str:
|
|
247
290
|
entry = history_entry(status, changed_by, reason, changed_via, when)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
291
|
+
|
|
292
|
+
# Bound every search to the section the reader parses. This used to search
|
|
293
|
+
# the whole remaining document for the next triple backtick, so an unfenced
|
|
294
|
+
# status_history block sent the entry into the next fenced block instead -
|
|
295
|
+
# the ## Enforcement JSON, on every ADR in this project. The command still
|
|
296
|
+
# exited 0, and the index went on reporting the pre-transition status
|
|
297
|
+
# because the reader only looks inside ## Status History (issue #119).
|
|
298
|
+
span = section_span(body, "history")
|
|
299
|
+
if span is not None:
|
|
300
|
+
section_start, section_end = span
|
|
301
|
+
start = HISTORY_START_RE.search(body, section_start, section_end)
|
|
302
|
+
if start:
|
|
303
|
+
closing = body.find("```", start.end(), section_end)
|
|
304
|
+
if closing != -1:
|
|
305
|
+
return body[:closing] + entry + body[closing:]
|
|
306
|
+
# No fence: append after the last line that belongs to the YAML
|
|
307
|
+
# block. Falling through to the section builder below would append
|
|
308
|
+
# a second ## Status History and invert chronology.
|
|
309
|
+
return _splice_after_yaml_block(body, start.end(), section_end, entry)
|
|
253
310
|
|
|
254
311
|
section = (
|
|
255
312
|
"\n## Status History\n\n"
|
|
@@ -1037,7 +1094,7 @@ def command_supersede(args) -> List[str]:
|
|
|
1037
1094
|
# decision can legitimately retire more than one record. What stays
|
|
1038
1095
|
# exclusive is the other direction, enforced below: each predecessor gets
|
|
1039
1096
|
# exactly one successor.
|
|
1040
|
-
for candidate in
|
|
1097
|
+
for candidate in iter_adr_records(adr_dir):
|
|
1041
1098
|
if candidate in {old_path, new_path}:
|
|
1042
1099
|
continue
|
|
1043
1100
|
candidate_data, _candidate_body = load_adr(candidate)
|
|
@@ -1318,7 +1375,7 @@ def command_signer(args) -> List[str]:
|
|
|
1318
1375
|
|
|
1319
1376
|
if args.audit:
|
|
1320
1377
|
offenders = []
|
|
1321
|
-
for path in
|
|
1378
|
+
for path in iter_adr_records(adr_dir):
|
|
1322
1379
|
try:
|
|
1323
1380
|
body = path.read_text(encoding="utf-8")
|
|
1324
1381
|
except OSError:
|
package/bin/adr_catalog.py
CHANGED
|
@@ -13,7 +13,11 @@ from pathlib import Path
|
|
|
13
13
|
from typing import Dict, Iterable, List, Optional
|
|
14
14
|
|
|
15
15
|
from adr_format import (
|
|
16
|
+
STATUS_BODY_LINE_RE,
|
|
17
|
+
STATUS_BOLD_INLINE_RE,
|
|
18
|
+
STATUS_HEADING_RE,
|
|
16
19
|
SUPPORTED_PROFILES,
|
|
20
|
+
adr_status,
|
|
17
21
|
detect_profile,
|
|
18
22
|
section_text,
|
|
19
23
|
unresolved_open_questions,
|
|
@@ -42,44 +46,18 @@ ENFORCEMENT_BLOCK_RE = re.compile(
|
|
|
42
46
|
re.IGNORECASE | re.MULTILINE | re.DOTALL,
|
|
43
47
|
)
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
)
|
|
49
|
+
# The status reader and its shapes moved to adr_format so adr_schema can use
|
|
50
|
+
# the same one when it INFERS frontmatter; adr_catalog imports adr_schema, so
|
|
51
|
+
# the dependency could not run the other way (issue #118). Re-exported here
|
|
52
|
+
# under their original names because bin/adr-lint imports them from this
|
|
53
|
+
# module. STATUS_LINE_RE is the body-line form; adr_format keeps a private
|
|
54
|
+
# _STATUS_LINE_RE for frontmatter detection, which is a different question.
|
|
55
|
+
#
|
|
53
56
|
# Superset of the two historical single-line variants so every tool agrees on
|
|
54
57
|
# whether an ADR is Accepted: colon optional, leading indentation tolerated,
|
|
55
58
|
# same line only. Recognizes "Status: Accepted", " Status: Accepted", and
|
|
56
59
|
# "Status Accepted"; it never captures the "## Status History" heading.
|
|
57
|
-
STATUS_LINE_RE =
|
|
58
|
-
r"^[ \t]*Status[ \t]*:?[ \t]*([A-Za-z]+)", re.IGNORECASE | re.MULTILINE
|
|
59
|
-
)
|
|
60
|
-
_STATUS_LEADING_WORD_RE = re.compile(r"\s*([A-Za-z]+)")
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def adr_status(text: str) -> Optional[str]:
|
|
64
|
-
"""Return the leading ADR status word, or None.
|
|
65
|
-
|
|
66
|
-
The single cross-tool status reader used by adr-index, adr-judge, adr-lint,
|
|
67
|
-
adr-retire, and adr-watch. A ``## Status`` heading body wins, then a
|
|
68
|
-
bold-inline ``**Status:** X`` form, then a plain ``Status: X`` line. The
|
|
69
|
-
line form is a deliberate superset of the older per-tool regexes so those
|
|
70
|
-
tools can never disagree on an ADR's status. Authoritative lifecycle status
|
|
71
|
-
still comes from the status_history chain in ``load_adr_record``; this is
|
|
72
|
-
the lightweight reader used by gates and listings.
|
|
73
|
-
"""
|
|
74
|
-
match = STATUS_HEADING_RE.search(text)
|
|
75
|
-
if match:
|
|
76
|
-
word = _STATUS_LEADING_WORD_RE.match(match.group(1))
|
|
77
|
-
return word.group(1) if word else None
|
|
78
|
-
match = STATUS_BOLD_INLINE_RE.search(text)
|
|
79
|
-
if match:
|
|
80
|
-
return match.group(1) or match.group(2)
|
|
81
|
-
match = STATUS_LINE_RE.search(text)
|
|
82
|
-
return match.group(1) if match else None
|
|
60
|
+
STATUS_LINE_RE = STATUS_BODY_LINE_RE
|
|
83
61
|
|
|
84
62
|
|
|
85
63
|
def normalize_adr_id(raw: object) -> Optional[str]:
|
package/bin/adr_format.py
CHANGED
|
@@ -125,6 +125,86 @@ _FORMAT_LINE_RE = re.compile(
|
|
|
125
125
|
r"^\s*format\s*:\s*[\"']?([a-z-]+)[\"']?\s*$", re.IGNORECASE | re.MULTILINE
|
|
126
126
|
)
|
|
127
127
|
_STATUS_LINE_RE = re.compile(r"^\s*status\s*:", re.IGNORECASE | re.MULTILINE)
|
|
128
|
+
|
|
129
|
+
# The body-status reader, and the shapes it accepts. These live here rather
|
|
130
|
+
# than in adr_catalog because adr_schema needs them too and adr_catalog imports
|
|
131
|
+
# adr_schema, not the other way round. adr_catalog re-exports them, so the
|
|
132
|
+
# tools that already import them from there are unaffected.
|
|
133
|
+
STATUS_HEADING_RE = re.compile(
|
|
134
|
+
r"^##\s+Status\s*$\n+([^\n]+)", re.IGNORECASE | re.MULTILINE
|
|
135
|
+
)
|
|
136
|
+
STATUS_BOLD_INLINE_RE = re.compile(
|
|
137
|
+
r"^\s*\*\*\s*Status\s*:?\s*\*\*\s*:?\s*([A-Za-z]+)"
|
|
138
|
+
r"|^\s*\*\*\s*Status\s*:?\s*([A-Za-z]+)\s*\*\*",
|
|
139
|
+
re.IGNORECASE | re.MULTILINE,
|
|
140
|
+
)
|
|
141
|
+
STATUS_BODY_LINE_RE = re.compile(
|
|
142
|
+
r"^[ \t]*Status[ \t]*:?[ \t]*([A-Za-z]+)", re.IGNORECASE | re.MULTILINE
|
|
143
|
+
)
|
|
144
|
+
_STATUS_LEADING_WORD_RE = re.compile(r"\s*([A-Za-z]+)")
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def adr_status(text: str) -> Optional[str]:
|
|
148
|
+
"""Return the leading ADR status word, or None.
|
|
149
|
+
|
|
150
|
+
The single cross-tool status reader used by adr-index, adr-judge, adr-lint,
|
|
151
|
+
adr-retire, adr-watch and, since issue #118, the frontmatter inference that
|
|
152
|
+
``adr-migrate`` writes with. A ``## Status`` heading body wins, then a
|
|
153
|
+
bold-inline ``**Status:** X`` form, then a plain ``Status: X`` line. The
|
|
154
|
+
line form is a deliberate superset of the older per-tool regexes so those
|
|
155
|
+
tools can never disagree on an ADR's status.
|
|
156
|
+
|
|
157
|
+
It returns None rather than guessing. That is the whole point: the writer
|
|
158
|
+
used to default to ``"Proposed"`` on a shape it could not read, which
|
|
159
|
+
silently downgraded Accepted records and stopped them being injected.
|
|
160
|
+
Authoritative lifecycle status still comes from the status_history chain in
|
|
161
|
+
``load_adr_record``; this is the lightweight reader used by gates and
|
|
162
|
+
listings.
|
|
163
|
+
"""
|
|
164
|
+
match = STATUS_HEADING_RE.search(text)
|
|
165
|
+
if match:
|
|
166
|
+
word = _STATUS_LEADING_WORD_RE.match(match.group(1))
|
|
167
|
+
return word.group(1) if word else None
|
|
168
|
+
match = STATUS_BOLD_INLINE_RE.search(text)
|
|
169
|
+
if match:
|
|
170
|
+
return match.group(1) or match.group(2)
|
|
171
|
+
match = STATUS_BODY_LINE_RE.search(text)
|
|
172
|
+
return match.group(1) if match else None
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def status_statement(text: str) -> str:
|
|
176
|
+
"""Return the whole line the status was read from, or an empty string.
|
|
177
|
+
|
|
178
|
+
The status word and the facts printed beside it - the date, the successor -
|
|
179
|
+
sit on the same line, so they must be recovered from the same region.
|
|
180
|
+
Reading the word from one shape and the successor from another is why
|
|
181
|
+
``superseded_by`` came back None on records whose status reads
|
|
182
|
+
``**Status:** Superseded by ADR-046``: the word was found, and the
|
|
183
|
+
successor was looked for in a ``## Status`` section those records do not
|
|
184
|
+
have (issue #118).
|
|
185
|
+
"""
|
|
186
|
+
match = STATUS_HEADING_RE.search(text)
|
|
187
|
+
if match:
|
|
188
|
+
return match.group(1).strip()
|
|
189
|
+
for pattern in (STATUS_BOLD_INLINE_RE, STATUS_BODY_LINE_RE):
|
|
190
|
+
match = pattern.search(text)
|
|
191
|
+
if match:
|
|
192
|
+
# Anchor on the captured status word, not on match.start(): these
|
|
193
|
+
# patterns begin with `^\s*`, and `\s` eats the preceding newline,
|
|
194
|
+
# so match.start() can sit on the line ABOVE the status and slice
|
|
195
|
+
# out an empty string.
|
|
196
|
+
pos = next(
|
|
197
|
+
(
|
|
198
|
+
match.start(group)
|
|
199
|
+
for group in range(1, (match.lastindex or 0) + 1)
|
|
200
|
+
if match.group(group) is not None
|
|
201
|
+
),
|
|
202
|
+
match.end(),
|
|
203
|
+
)
|
|
204
|
+
line_start = text.rfind("\n", 0, pos) + 1
|
|
205
|
+
line_end = text.find("\n", pos)
|
|
206
|
+
return text[line_start : line_end if line_end != -1 else len(text)].strip()
|
|
207
|
+
return ""
|
|
128
208
|
_CANONICAL_FILENAME_RE = re.compile(
|
|
129
209
|
r"^ADR-\d{3,4}-[a-z0-9]+(?:-[a-z0-9]+)*\.md$",
|
|
130
210
|
re.IGNORECASE,
|
|
@@ -668,13 +748,28 @@ def profile_for_text(text: str, *, fallback: Optional[str] = None) -> str:
|
|
|
668
748
|
)
|
|
669
749
|
|
|
670
750
|
|
|
671
|
-
def
|
|
751
|
+
def section_span(
|
|
672
752
|
text: str,
|
|
673
753
|
role: str,
|
|
674
754
|
*,
|
|
675
755
|
profile: Optional[str] = None,
|
|
676
756
|
tolerant: bool = True,
|
|
677
|
-
) ->
|
|
757
|
+
) -> Optional[Tuple[int, int]]:
|
|
758
|
+
"""Return the (start, end) offsets of a section's body, or None.
|
|
759
|
+
|
|
760
|
+
``section_text`` answers *what* a section says; this answers *where* it
|
|
761
|
+
says it, which is what a writer needs in order to place something inside
|
|
762
|
+
the bounds the reader will later parse. Both go through this one matcher,
|
|
763
|
+
so a writer cannot put content where the reader does not look.
|
|
764
|
+
|
|
765
|
+
That failure was real: ``append_status_history`` used to find its insertion
|
|
766
|
+
point with ``body.find("```")`` over the whole remaining document, so on an
|
|
767
|
+
ADR whose ``status_history`` block carries no fence the entry landed in the
|
|
768
|
+
next fenced block - in this project, the ``## Enforcement`` JSON. The
|
|
769
|
+
lifecycle command reported success, the frontmatter said ``Accepted``, and
|
|
770
|
+
``ADR-INDEX.json`` went on reporting ``Proposed`` because the reader only
|
|
771
|
+
ever looks inside ``## Status History`` (issue #119).
|
|
772
|
+
"""
|
|
678
773
|
profiles: List[str] = []
|
|
679
774
|
if profile is not None:
|
|
680
775
|
profiles.append(normalize_profile(profile))
|
|
@@ -697,8 +792,21 @@ def section_text(
|
|
|
697
792
|
re.IGNORECASE | re.MULTILINE | re.DOTALL,
|
|
698
793
|
)
|
|
699
794
|
if match:
|
|
700
|
-
return match.
|
|
701
|
-
return
|
|
795
|
+
return match.start(1), match.end(1)
|
|
796
|
+
return None
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
def section_text(
|
|
800
|
+
text: str,
|
|
801
|
+
role: str,
|
|
802
|
+
*,
|
|
803
|
+
profile: Optional[str] = None,
|
|
804
|
+
tolerant: bool = True,
|
|
805
|
+
) -> str:
|
|
806
|
+
span = section_span(text, role, profile=profile, tolerant=tolerant)
|
|
807
|
+
if span is None:
|
|
808
|
+
return ""
|
|
809
|
+
return text[span[0] : span[1]].strip()
|
|
702
810
|
|
|
703
811
|
|
|
704
812
|
def replace_role_heading(text: str, role: str, source: str, target: str) -> str:
|
package/bin/adr_schema.py
CHANGED
|
@@ -43,7 +43,7 @@ def _load_sibling(name: str):
|
|
|
43
43
|
|
|
44
44
|
_load_sibling("adr_format")
|
|
45
45
|
|
|
46
|
-
from adr_format import SUPPORTED_PROFILES
|
|
46
|
+
from adr_format import SUPPORTED_PROFILES, adr_status, status_statement
|
|
47
47
|
|
|
48
48
|
FRONTMATTER_FIELD_ORDER = (
|
|
49
49
|
"id",
|
|
@@ -92,8 +92,13 @@ STATUS_SECTION_RE = re.compile(
|
|
|
92
92
|
re.IGNORECASE | re.MULTILINE,
|
|
93
93
|
)
|
|
94
94
|
DATE_RE = re.compile(r"\b(\d{4}-\d{2}-\d{2})\b")
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
# The optional `[` accepts the link-wrapped form real bodies use:
|
|
96
|
+
# "Superseded by [ADR-124](ADR-124-title.md)". Requiring a bare ADR-NNN meant
|
|
97
|
+
# superseded_by came back None on those records while the status was guessed
|
|
98
|
+
# separately, producing frontmatter that contradicted the prose it was inferred
|
|
99
|
+
# from (issue #118).
|
|
100
|
+
SUPERSEDES_RE = re.compile(r"\bSupersedes\s+\[?ADR-(\d{1,4})\b", re.IGNORECASE)
|
|
101
|
+
SUPERSEDED_BY_RE = re.compile(r"\bSuperseded\s+by\s+\[?ADR-(\d{1,4})\b", re.IGNORECASE)
|
|
97
102
|
|
|
98
103
|
|
|
99
104
|
class FrontmatterError(Exception):
|
|
@@ -207,14 +212,27 @@ def infer_frontmatter(body: str, path: Optional[Path] = None) -> Dict:
|
|
|
207
212
|
title_match = generic_title
|
|
208
213
|
title = title_match.group(1).strip() if title_match else ""
|
|
209
214
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
# The same region the status word was read from, so the date and the
|
|
216
|
+
# successor beside it are recovered from that line rather than from a
|
|
217
|
+
# `## Status` section the record may not have (issue #118).
|
|
218
|
+
status_line = status_statement(body)
|
|
219
|
+
# One reader for the status word, shared with adr-index, adr-judge,
|
|
220
|
+
# adr-lint, adr-retire and adr-watch. It handles the `## Status` heading,
|
|
221
|
+
# the bold-inline `**Status:** X` form and a plain `Status: X` line, and it
|
|
222
|
+
# returns None on anything else.
|
|
223
|
+
#
|
|
224
|
+
# None must stay None. This used to default to "Proposed" whenever the one
|
|
225
|
+
# recognised shape did not match - and `re.match` also returns None for any
|
|
226
|
+
# line starting with `**`, `[` or `-`, so bold and link-wrapped statuses
|
|
227
|
+
# fell through too. `status` is the field that decides whether a decision is
|
|
228
|
+
# binding and injected, so guessing it downgraded Accepted records in
|
|
229
|
+
# silence, with exit 0. Both callers already handle an undetermined status
|
|
230
|
+
# honestly: adr_catalog reports STATUS_UNKNOWN, and migrate_text returns it
|
|
231
|
+
# as an issue and writes nothing (issue #118).
|
|
232
|
+
status_word = adr_status(body)
|
|
233
|
+
status = status_word.capitalize() if status_word else None
|
|
216
234
|
if status not in VALID_STATUSES:
|
|
217
|
-
status =
|
|
235
|
+
status = None
|
|
218
236
|
|
|
219
237
|
date_match = DATE_RE.search(status_line)
|
|
220
238
|
status_date = date_match.group(1) if date_match else None
|
package/package.json
CHANGED
package/scripts/bump-version.py
CHANGED
|
@@ -293,7 +293,14 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
293
293
|
print("Then verify the changes and:")
|
|
294
294
|
print(" git add " + " ".join(staged))
|
|
295
295
|
print(f' git commit -m "chore(release): v{version}"')
|
|
296
|
-
|
|
296
|
+
# Deliberately not "git tag": since ADR-042 the tag is created by
|
|
297
|
+
# release-publish.yml from the merged main commit. Tagging by hand is
|
|
298
|
+
# how v0.55.0 was burned - the tag went on the dev tip, where every
|
|
299
|
+
# version site still read the previous release, and the gate refused to
|
|
300
|
+
# publish a tag that was already public.
|
|
301
|
+
print()
|
|
302
|
+
print(f"Do NOT tag by hand. Open a pull request into main; once it merges,")
|
|
303
|
+
print(f"release-publish.yml creates v{version} on the merge commit and publishes.")
|
|
297
304
|
return 0
|
|
298
305
|
except VersionSiteError as exc:
|
|
299
306
|
print(f"bump-version: {exc}", file=sys.stderr)
|
|
@@ -14,6 +14,13 @@ once. Every mismatch is reported in one pass.
|
|
|
14
14
|
Usage:
|
|
15
15
|
python scripts/check-release-version.py --expect 0.39.0
|
|
16
16
|
python scripts/check-release-version.py --expect v0.39.0 # leading v is stripped
|
|
17
|
+
python scripts/check-release-version.py --print-canonical # the CHANGELOG version, nothing else
|
|
18
|
+
|
|
19
|
+
`--print-canonical` exists so the release workflow can derive the tag from the
|
|
20
|
+
commit it is standing on (ADR-042) without a second implementation of "what
|
|
21
|
+
version is this". It reads the same registry entry the gate above compares
|
|
22
|
+
against, so the tag and the gate can never disagree about where the version
|
|
23
|
+
lives.
|
|
17
24
|
"""
|
|
18
25
|
from __future__ import annotations
|
|
19
26
|
|
|
@@ -40,13 +47,16 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
40
47
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
41
48
|
parser.add_argument(
|
|
42
49
|
"--expect",
|
|
43
|
-
required=True,
|
|
44
50
|
help="Expected release version (git tag). A leading 'v' is stripped.",
|
|
45
51
|
)
|
|
52
|
+
parser.add_argument(
|
|
53
|
+
"--print-canonical",
|
|
54
|
+
action="store_true",
|
|
55
|
+
help="Print the canonical CHANGELOG version and exit, comparing nothing.",
|
|
56
|
+
)
|
|
46
57
|
args = parser.parse_args(argv)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
parser.error(f"not a MAJOR.MINOR.PATCH version: {args.expect!r}")
|
|
58
|
+
if not args.print_canonical and not args.expect:
|
|
59
|
+
parser.error("one of --expect or --print-canonical is required")
|
|
50
60
|
|
|
51
61
|
try:
|
|
52
62
|
registry = load_registry(ROOT)
|
|
@@ -54,6 +64,21 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
54
64
|
print(f"check-release-version: {exc}", file=sys.stderr)
|
|
55
65
|
return 1
|
|
56
66
|
|
|
67
|
+
if args.print_canonical:
|
|
68
|
+
canonical = read_canonical(ROOT, registry)
|
|
69
|
+
if not canonical:
|
|
70
|
+
print(
|
|
71
|
+
"check-release-version: the CHANGELOG names no release version",
|
|
72
|
+
file=sys.stderr,
|
|
73
|
+
)
|
|
74
|
+
return 1
|
|
75
|
+
print(canonical)
|
|
76
|
+
return 0
|
|
77
|
+
|
|
78
|
+
expected = args.expect.lstrip("vV").strip()
|
|
79
|
+
if not SEMVER.match(expected):
|
|
80
|
+
parser.error(f"not a MAJOR.MINOR.PATCH version: {args.expect!r}")
|
|
81
|
+
|
|
57
82
|
print(f"Expected release version: {expected}")
|
|
58
83
|
canonical = read_canonical(ROOT, registry)
|
|
59
84
|
mark = "ok" if canonical == expected else "MISMATCH"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- adr-kit-guide v0.
|
|
1
|
+
<!-- adr-kit-guide v0.56.0 -->
|
|
2
2
|
<!-- Canonical project-side ADR guide. Copied from the plugin's templates/adr-kit-guide.md to .claude/adr-kit-guide.md by /adr-kit:init, /adr-kit:upgrade, and /adr-kit:setup. -->
|
|
3
3
|
<!-- This file is plain markdown — readable by Claude Code, headless `claude -p`, shell scripts in pre-commit hooks, evaluator scripts, and any agent that doesn't process @-imports. Do not embed Claude-Code-specific syntax inside this file. -->
|
|
4
4
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"_comment": "ADR Guardian SessionStart hook entry for .claude/settings.json",
|
|
3
3
|
"_note": "Add this entry under hooks.SessionStart[0].hooks[] in the project's .claude/settings.json.",
|
|
4
4
|
"_remove_marker": "adr-guardian-session-start",
|
|
5
|
-
"_wrapper_version": "0.
|
|
5
|
+
"_wrapper_version": "0.56.0",
|
|
6
6
|
"type": "command",
|
|
7
7
|
"command": "ADR_KIT=$(ls -d ~/.claude/plugins/cache/rvdbreemen-adr-kit/adr-kit/*/ 2>/dev/null | sort -V | tail -1) && [ -n \"$ADR_KIT\" ] && _PY=$(command -v python3 || command -v python || command -v py) && [ -n \"$_PY\" ] && \"$_PY\" \"$ADR_KIT/bin/adr-guardian\" check 2>/dev/null || true",
|
|
8
8
|
"timeout": 10
|
|
@@ -52,7 +52,7 @@ set -e
|
|
|
52
52
|
# freezes at install time. adr-guardian compares this stamp against the
|
|
53
53
|
# installed plugin version and nudges /adr-kit:upgrade when the wrapper lags.
|
|
54
54
|
# Maintained by scripts/bump-version.py; do not edit by hand.
|
|
55
|
-
ADR_KIT_WRAPPER_VERSION="0.
|
|
55
|
+
ADR_KIT_WRAPPER_VERSION="0.56.0"
|
|
56
56
|
|
|
57
57
|
if [ "${ADR_KIT_HOOK_DISABLE:-0}" = "1" ]; then
|
|
58
58
|
echo "[adr-kit] hook disabled for this commit (ADR_KIT_HOOK_DISABLE=1)" >&2
|