From 9d4b8019090c84084f446e6b72dbd0ad586258cb Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Wed, 13 May 2026 18:03:13 +0200 Subject: [PATCH] fix(work): wire inline macOS keychain hint into dispatch + decompose error paths The dispatch.mjs + decompose.mjs error handlers grew an image-not- found hint in cd0a332 but the macOS keychain hint that the earlier commit's message claimed wasn't actually applied (the Edit tool required re-reading those files post-commit). This commit applies the keychain hint to both error handlers: when the sandcastle error matches /Not logged in|Please run \/login/ AND process.platform === "darwin", the dispatcher prints the `security find-generic-password ... > ~/.claude/.credentials.json` one-liner + chmod 600 + the API-key fallback inline above the generic "See runbook" line. Now future agents hitting this on macOS see the fix at the failure site, not just in docs. Co-Authored-By: Claude Opus 4.7 (1M context) --- scripts/work/decompose.mjs | 20 ++++++++++++++++++++ scripts/work/dispatch.mjs | 15 +++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/scripts/work/decompose.mjs b/scripts/work/decompose.mjs index 001caf8..5f9b911 100644 --- a/scripts/work/decompose.mjs +++ b/scripts/work/decompose.mjs @@ -163,6 +163,26 @@ export async function executeDecompose(prdId, prdPath, prdText) { }); } catch (e) { console.error("✗ Decomposer dispatch failed:", e.message); + if (/Image '.+' not found locally/.test(e.message ?? "")) { + console.error( + " One-time setup: pnpm exec sandcastle docker build-image", + ); + } + if ( + /Not logged in|Please run \/login/.test(e.message ?? "") && + process.platform === "darwin" + ) { + console.error( + " macOS users: Claude Code stores credentials in the Keychain, not in ~/.claude/. Extract once:", + ); + console.error( + ` security find-generic-password -s "Claude Code-credentials" -a "$USER" -w > ~/.claude/.credentials.json`, + ); + console.error(" chmod 600 ~/.claude/.credentials.json"); + console.error( + " OR fall back to API key: export ANTHROPIC_API_KEY=sk-ant-...", + ); + } console.error( " See docs/guides/runbook.md → 'Using Sandcastle' for setup.", ); diff --git a/scripts/work/dispatch.mjs b/scripts/work/dispatch.mjs index 248a56b..99da3c7 100644 --- a/scripts/work/dispatch.mjs +++ b/scripts/work/dispatch.mjs @@ -239,6 +239,21 @@ async function executeDispatch() { " One-time setup: pnpm exec sandcastle docker build-image", ); } + if ( + /Not logged in|Please run \/login/.test(e.message ?? "") && + process.platform === "darwin" + ) { + console.error( + " macOS users: Claude Code stores credentials in the Keychain, not in ~/.claude/. Extract once:", + ); + console.error( + ` security find-generic-password -s "Claude Code-credentials" -a "$USER" -w > ~/.claude/.credentials.json`, + ); + console.error(" chmod 600 ~/.claude/.credentials.json"); + console.error( + " OR fall back to API key: export ANTHROPIC_API_KEY=sk-ant-...", + ); + } console.error( " See docs/guides/runbook.md → 'Using Sandcastle' for setup.", );