From 45df68fff9bf7e2e9ef0bd25870f0af79b002472 Mon Sep 17 00:00:00 2001 From: Gabriele Pavanello Date: Mon, 26 Oct 2026 09:31:06 +0100 Subject: [PATCH] Rename the card check to cardText, so register.tsx parses again PR #66 added a local async function shownText that checks that the file still has the text the card showed. PR #68 imports shownText from the protocol module for the cut of a run_code result. Together the two give a duplicate name, so hooks/register.tsx does not parse on main. Rename the local function to cardText and keep the import. Raise the version to 0.12.16, because 0.12.15 has the hooks module that does not load. Closes #72 --- .claude-plugin/plugin.json | 2 +- hooks/register.tsx | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index b4b111e..77df2b6 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "code-mode", - "version": "0.12.15", + "version": "0.12.16", "description": "Code mode for MCP: the model writes one JavaScript program that calls MCP tools in a sandbox, instead of one tool call per step.", "types": "./types/index.d.ts", "author": { diff --git a/hooks/register.tsx b/hooks/register.tsx index 794ffac..1a39d1e 100644 --- a/hooks/register.tsx +++ b/hooks/register.tsx @@ -685,7 +685,7 @@ async function approveRemoval($: EngineInterface, hint: Hint, edit: HintEdit, pr // Approve: merge the proposal's bullets into the active file beside pending/ // (or move the whole file when there is none yet), then remove the proposal. // A bullet the file has already is not added again (see appendItems). -// `proposal` is the text the card showed (see shownText). +// `proposal` is the text the card showed (see cardText). async function approvePending( $: EngineInterface, path: string, @@ -765,7 +765,7 @@ async function decideOnce( // The proposal text that a card showed, when its file still has it. Approve // and Discard act on this text and fail when the file changed after the card // drew it, so the person decides on the text they read (as decideUnapproved). -async function shownText($: EngineInterface, path: string, shown: string): Promise { +async function cardText($: EngineInterface, path: string, shown: string): Promise { if ((await readIfExists($, path)) !== shown) throw new Error(`${path} changed after the card showed it; review it again`) return shown @@ -779,7 +779,7 @@ function decidePending( projectHints: boolean, ): Promise { return decideOnce($, path, async () => { - const proposal = await shownText($, path, shown) + const proposal = await cardText($, path, shown) const hint = parseHint(proposal, path, 'user') const dest = action === 'approved' @@ -1090,7 +1090,7 @@ async function loadFunctionProposals($: EngineInterface): Promise.md, without its reason, and // replaces a function with that name. An Approve that cannot write it fails -// and keeps the proposal. `text` is the text the card showed (see shownText). +// and keeps the proposal. `text` is the text the card showed (see cardText). async function saveFunction($: EngineInterface, path: string, text: string): Promise { const proposal = parseFunction(text, path) const dir = await functionsDir($) @@ -1113,7 +1113,7 @@ function decideFunction( action: Action, ): Promise { return decideOnce($, path, async () => { - const text = await shownText($, path, shown) + const text = await cardText($, path, shown) const dest = action === 'approved' ? await saveFunction($, path, text) : undefined await $.process.run(['rm', '-f', path]) return { action, dest, kind: 'function' }