@rvdbreemen/adr-kit-opencode 0.54.0 → 0.55.1

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.
@@ -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.54.0",
4
+ "version": "0.55.1",
5
5
  "author": {
6
6
  "name": "Robert van den Breemen",
7
7
  "url": "https://github.com/rvdbreemen"
package/README.md CHANGED
@@ -100,6 +100,7 @@ patch releases, is in [CHANGELOG.md](CHANGELOG.md).
100
100
 
101
101
  | Version | What landed | Why it matters |
102
102
  | --- | --- | --- |
103
+ | **0.55.1** | [ADR-029](docs/adr/ADR-029-retire-the-native-hook-binary-rather-than-maintain-a-second-retrieval-engine.md) is carried out: the committed `adr-hook.exe`, its Rust sources, the dispatcher branch that preferred it and the `ADR_KIT_NATIVE_HOOK` opt-in are gone from all three client trees, so Python is the only hook host on every platform. `adr-mcp` now rejects malformed JSON-RPC frames instead of answering them. | The binary was measurably wrong, not merely untested: against the Python oracle it returned one of four governing ADRs on an edit event, and the parity test that should have caught it read a constant out of the Rust source instead of running the build. One retrieval engine means the hook answers what the CLI answers. On the MCP side, a server that answers a malformed frame hides a client defect the client cannot see in its own logs. |
103
104
  | **0.54.0** | Automatic interactive ADR grilling ([ADR-041](docs/adr/ADR-041-automatically-hand-off-unfinished-proposed-adrs-to-interactive-grilling.md)) hands one unfinished Proposed decision to the native grill workflow at the next user-visible prompt. `/adr-kit:upgrade` materializes `grill.auto_start: true` while preserving explicit opt-outs. | Incomplete decisions reach the human while their implementation context is still available, without starting interviews in CI, pre-commit, background, or unattended lifecycle paths. |
104
105
  | **0.52.0** | Native [OpenCode](docs/clients/opencode.md) support through a separate TypeScript plugin, backed by the shared deterministic engines and MCP server ([ADR-039](docs/adr/ADR-039-add-a-native-opencode-plugin-without-expanding-the-certified-cli-gate.md)). The certified Claude Code, Codex, and Copilot CLI registry and release gate remain unchanged. | OpenCode gets its documented native configuration, skills, commands, context, compaction, edit, shell, and MCP integration without weakening the existing certification boundary. |
105
106
  | **0.48.0** | Retrieval is lexical scoring over the generated index plus one-hop graph neighbours, and the LLM judge runs on the CLI you are already signed in to ([ADR-036](docs/adr/ADR-036-retire-the-vector-layer-and-run-the-judge-on-the-host-model-only.md)): the vector subsystem, `bin/adr-embed` and the openrouter/ollama/openai backends are gone, and eight retired config keys now fail validation by name. The guardian records a verdict per ADR and prints it as the sweep lands ([ADR-037](docs/adr/ADR-037-keep-per-adr-judge-verdicts-in-the-advisory-per-machine-guardian-state.md)). | Two subsystems were carrying their own credentials, install paths and failure modes to answer questions the index already answers. A sweep is also long enough to be interrupted, so a per-sweep timestamp discarded everything it had established; per-ADR verdicts keep it. |
@@ -670,7 +671,7 @@ jobs:
670
671
  - uses: actions/checkout@v4
671
672
  with:
672
673
  fetch-depth: 0 # both sides of the diff must be available
673
- - uses: rvdbreemen/adr-kit/.github/actions/adr-judge@v0.54.0
674
+ - uses: rvdbreemen/adr-kit/.github/actions/adr-judge@v0.55.1
674
675
  with:
675
676
  adr-dir: docs/adr/
676
677
  ```
@@ -684,7 +685,7 @@ The action also takes `max-diff-bytes` (default 32 MiB, available from the relea
684
685
  ```yaml
685
686
  repos:
686
687
  - repo: https://github.com/rvdbreemen/adr-kit
687
- rev: v0.54.0
688
+ rev: v0.55.1
688
689
  hooks:
689
690
  - id: adr-judge
690
691
  ```
package/bin/adr-mcp CHANGED
@@ -783,6 +783,8 @@ TOOL_HANDLERS = {
783
783
  # JSON-RPC 2.0 plumbing (newline-delimited over stdio)
784
784
  # ---------------------------------------------------------------------------
785
785
 
786
+ JSONRPC_VERSION = "2.0"
787
+
786
788
  PARSE_ERROR = -32700
787
789
  INVALID_REQUEST = -32600
788
790
  METHOD_NOT_FOUND = -32601
@@ -837,8 +839,27 @@ def _write_message(payload: Dict[str, Any]) -> None:
837
839
  sys.stdout.flush()
838
840
 
839
841
 
842
+ def request_id_is_valid(value: Any) -> bool:
843
+ """True when this server may echo `value` as a JSON-RPC id.
844
+
845
+ `RequestId` is `string | number` in schema.ts and `string | integer` in the
846
+ generated schema.json. Floats are refused even when integral: Python cannot
847
+ echo 1.0 without serialising it as `1.0`, which is not an integer in JSON,
848
+ and the echo lands in the server's OWN outgoing frame - the one place a
849
+ non-conformant peer cannot correct for us. Normalising 1.0 to 1 would keep
850
+ the value but silently change the representation the client chose, against
851
+ "It MUST be the same as the value of the id member in the Request Object".
852
+ JSON-RPC 2.0 itself says numbers SHOULD NOT contain fractional parts.
853
+
854
+ `bool` is excluded explicitly, because isinstance(True, int) is True.
855
+ """
856
+ if isinstance(value, bool):
857
+ return False
858
+ return isinstance(value, (str, int))
859
+
860
+
840
861
  def _reply_result(req_id: Any, result: Dict[str, Any]) -> None:
841
- _write_message({"jsonrpc": "2.0", "id": req_id, "result": result})
862
+ _write_message({"jsonrpc": JSONRPC_VERSION, "id": req_id, "result": result})
842
863
 
843
864
 
844
865
  def _reply_error(
@@ -847,7 +868,7 @@ def _reply_error(
847
868
  error: Dict[str, Any] = {"code": code, "message": message}
848
869
  if data is not None:
849
870
  error["data"] = data
850
- _write_message({"jsonrpc": "2.0", "id": req_id, "error": error})
871
+ _write_message({"jsonrpc": JSONRPC_VERSION, "id": req_id, "error": error})
851
872
 
852
873
 
853
874
  # ---------------------------------------------------------------------------
@@ -922,6 +943,15 @@ def modern_envelope_error(
922
943
  f"Invalid params: '{PROTOCOL_VERSION_META_KEY}' must be a string",
923
944
  None,
924
945
  )
946
+ if not isinstance(meta[CLIENT_CAPABILITIES_META_KEY], dict):
947
+ # Also a shape defect, and deliberately decided before negotiation:
948
+ # RequestMetaObject types this key as ClientCapabilities, so a scalar
949
+ # there is a malformed envelope rather than a version disagreement.
950
+ return (
951
+ INVALID_PARAMS,
952
+ f"Invalid params: '{CLIENT_CAPABILITIES_META_KEY}' must be an object",
953
+ None,
954
+ )
925
955
  if requested not in MODERN_PROTOCOL_VERSIONS:
926
956
  # Era-scoped: a modern answer lists modern versions only, because a
927
957
  # handshake revision cannot be reached through a modern envelope.
@@ -938,7 +968,7 @@ def _modern_result(
938
968
  ) -> Dict[str, Any]:
939
969
  """Stamp a modern-era result: resultType, cache hints, _meta.serverInfo.
940
970
 
941
- `resultType` is always "complete": the five tools are fully parameterised
971
+ `resultType` is always "complete": the seven tools are fully parameterised
942
972
  by their arguments, so the server never emits "input_required" and never
943
973
  invents a value of its own. Cache hints are stamped on `server/discover`
944
974
  and `tools/list` only - `CallToolResult` extends `Result`, not
@@ -1027,6 +1057,24 @@ def dispatch(message: Dict[str, Any], root: Path, adr_dir: Path) -> None:
1027
1057
  if not isinstance(params, dict):
1028
1058
  params = {}
1029
1059
 
1060
+ # Base protocol first, before anything era-specific. `jsonrpc` and the id
1061
+ # shape are JSON-RPC 2.0 rather than MCP, so both eras answer them alike,
1062
+ # and clearing them here means every echo further down is a shape this
1063
+ # server is allowed to emit.
1064
+ if message.get("jsonrpc") != JSONRPC_VERSION:
1065
+ if not is_notification:
1066
+ _reply_error(None, INVALID_REQUEST,
1067
+ f"Invalid request: 'jsonrpc' must be {JSONRPC_VERSION!r}")
1068
+ return
1069
+
1070
+ if not is_notification and not request_id_is_valid(req_id):
1071
+ # The id cannot be echoed without repeating the defect it carries, so
1072
+ # the reply takes the null id JSON-RPC 2.0 reserves for exactly this
1073
+ # case - the same convention serve() already uses for a parse error.
1074
+ _reply_error(None, INVALID_REQUEST,
1075
+ "Invalid request: 'id' must be a string or an integer")
1076
+ return
1077
+
1030
1078
  if not isinstance(method, str):
1031
1079
  if not is_notification:
1032
1080
  _reply_error(req_id, INVALID_REQUEST, "Invalid request: missing method")
@@ -1035,7 +1083,7 @@ def dispatch(message: Dict[str, Any], root: Path, adr_dir: Path) -> None:
1035
1083
  if method.startswith("notifications/"):
1036
1084
  # notifications/initialized, notifications/cancelled,
1037
1085
  # notifications/progress, ...: accepted and ignored in both eras.
1038
- # The notification rules forbid a response, and the five tool
1086
+ # The notification rules forbid a response, and the seven tool
1039
1087
  # handlers are synchronous subprocess calls that cannot be
1040
1088
  # interrupted mid-flight, so nothing further is emitted either.
1041
1089
  return
@@ -192,9 +192,11 @@ def check_hook_package(plugin_root: Path, client: str) -> dict[str, Any]:
192
192
  actions=[{"detail": f"Reinstall ADR Kit for {client}."}],
193
193
  )
194
194
  runtime = root / "hooks" / "adr-hook.py"
195
- native = root / "hooks" / "bin" / "windows-x64" / "adr-hook.exe"
196
195
  wrapper = root / "hooks" / "run-hook.cmd"
197
- required_files = [runtime, native]
196
+ # The Rust host used to be required here too. ADR-029 retired it, so
197
+ # demanding the artefact would now fail every healthy install: Python is
198
+ # the runtime on every platform.
199
+ required_files = [runtime]
198
200
  if client != "copilot":
199
201
  required_files.append(wrapper)
200
202
  missing = [str(path) for path in required_files if not path.is_file()]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rvdbreemen/adr-kit-opencode",
3
- "version": "0.54.0",
3
+ "version": "0.55.1",
4
4
  "description": "Native OpenCode plugin for ADR Kit, backed by the shared deterministic Python engines.",
5
5
  "type": "module",
6
6
  "main": "./opencode/plugin.ts",
@@ -263,7 +263,7 @@ def generate(
263
263
  if not path.is_file() or "__pycache__" in path.parts:
264
264
  continue
265
265
  relative = path.relative_to(output_root).as_posix()
266
- if "/hooks/bin/" in f"/{relative}" or relative in expected_set:
266
+ if relative in expected_set:
267
267
  continue
268
268
  drift.append(relative)
269
269
  if not check:
@@ -204,16 +204,13 @@ def _copilot_hook_config(manifest: dict) -> dict:
204
204
  f"--client github-copilot-cli --event {command} || true"
205
205
  ),
206
206
  "powershell": (
207
- # The native exe is opt-in via ADR_KIT_NATIVE_HOOK=1, exactly as
208
- # hooks/run-hook.cmd gates it: preferring it by default silently
209
- # narrowed governance on Windows (the host is not
210
- # parity-certified), and Copilot was the one client that did.
211
- '$native = "${PLUGIN_ROOT}/hooks/bin/windows-x64/adr-hook.exe"; '
212
- f'if ($env:ADR_KIT_NATIVE_HOOK -eq "1" -and (Test-Path $native)) '
213
- f'{{ & $native --client github-copilot-cli --event {command} }} '
214
- "else { $python = Get-Command python -ErrorAction SilentlyContinue; "
207
+ # Python is the only host (ADR-029). This branch used to prefer
208
+ # a committed Rust exe, gated behind ADR_KIT_NATIVE_HOOK=1; the
209
+ # binary was retired rather than maintained as a second
210
+ # retrieval engine, so there is nothing left to select.
211
+ "$python = Get-Command python -ErrorAction SilentlyContinue; "
215
212
  f'if ($python) {{ & $python.Source "${{PLUGIN_ROOT}}/hooks/adr-hook.py" '
216
- f"--client github-copilot-cli --event {command} }} }}; exit 0"
213
+ f"--client github-copilot-cli --event {command} }}; exit 0"
217
214
  ),
218
215
  "cwd": "${PLUGIN_ROOT}",
219
216
  "timeoutSec": runner_timeout,
@@ -47,7 +47,6 @@ HOOK_RUNTIME_FILES = (
47
47
  "hooks/adapters/claude.py",
48
48
  "hooks/adapters/codex.py",
49
49
  "hooks/adapters/copilot.py",
50
- "hooks/bin/windows-x64/adr-hook.exe",
51
50
  )
52
51
  # The modules bin/ entrypoints import from OUTSIDE bin/. Mirrored at their own
53
52
  # relative paths, because bin/adr-doctor resolves them by appending ROOT and
@@ -1,4 +1,4 @@
1
- <!-- adr-kit-guide v0.54.0 -->
1
+ <!-- adr-kit-guide v0.55.1 -->
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.54.0",
5
+ "_wrapper_version": "0.55.1",
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.54.0"
55
+ ADR_KIT_WRAPPER_VERSION="0.55.1"
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