From 1220e6b95a2b550441c82c6dc643ab9510896817 Mon Sep 17 00:00:00 2001 From: Ander Date: Tue, 4 Aug 2026 09:47:16 +0200 Subject: [PATCH 1/2] chore(errors): remove unused capabilityUnavailable() helper Dead code: nothing in src/ or tests/ references it (assertUsable is the sole CAPABILITY_UNAVAILABLE thrower). Drop the exported helper. Co-Authored-By: Claude Opus 4.8 --- src/core/errors.ts | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/core/errors.ts b/src/core/errors.ts index 23d57af..bbecb7a 100644 --- a/src/core/errors.ts +++ b/src/core/errors.ts @@ -98,19 +98,3 @@ export function quotaExhausted( suggested_commands: claimUrl ? [] : ["zenrows usage"], }); } - -/** Build the canonical "this capability is not configured" error. */ -export function capabilityUnavailable( - capabilityLabel: string, - command: string, - suggested: string[], -): ToolkitError { - return new ToolkitError({ - code: "CAPABILITY_UNAVAILABLE", - message: `${capabilityLabel} is not configured for this backend yet.`, - likely_cause: `The cloud primitive behind \`${command}\` is not enabled for this account or has not shipped.`, - next_action: - "Use a local spec / validation path, or escalate to a confirmed primitive (Protected Fetch / Extract).", - suggested_commands: suggested, - }); -} From 52ec794308403807b0f5b5851578887da017df46 Mon Sep 17 00:00:00 2001 From: Ander Date: Tue, 4 Aug 2026 09:47:16 +0200 Subject: [PATCH 2/2] docs(cli): tighten the top-level exit-code comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit State the contract plainly (any error exits 1; read error.code from --json for the kind) instead of explaining why the removed CAPABILITY_UNAVAILABLE→2 branch was dead — that archaeology belongs in the commit that removed it, not inline. Co-Authored-By: Claude Opus 4.8 --- src/cli/index.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cli/index.ts b/src/cli/index.ts index d574602..e8e2bdc 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -94,10 +94,8 @@ export async function main(rawArgv: string[]): Promise { return await cmd.run(argv, ctx); } catch (err) { printError(err, json); - // Any error exits 1. We do not overload the exit code to signal error kind: - // the capability-gated commands catch internally and return 1 already, so a - // CAPABILITY_UNAVAILABLE→2 mapping here never fired. Machine consumers read - // the precise `error.code` from --json output instead. + // Any error exits 1 — the exit code doesn't encode error kind. Machine + // consumers read the precise `error.code` from the --json output instead. return 1; } }