Skip to content

fix: add --version flag and scanner preflight for missing claude CLI#114

Merged
George-iam merged 1 commit intomainfrom
fix/cli-version-and-scanner-preflight-20260417
Apr 17, 2026
Merged

fix: add --version flag and scanner preflight for missing claude CLI#114
George-iam merged 1 commit intomainfrom
fix/cli-version-and-scanner-preflight-20260417

Conversation

@George-iam
Copy link
Copy Markdown
Contributor

Summary

Two user-visible bugs found during WSL2 E2E testing.

1. axme-code --version returned "Unknown command"

The README Quick Start tells users to run axme-code right after install. The natural first command — axme-code --version — dumped the usage text. Added --version / -v handler at the top of src/cli.ts that prints AXME_CODE_VERSION and exits 0.

2. LLM scanner leaked TypeError: path must be string stack trace when claude CLI not installed

When axme-code setup runs without the claude CLI on PATH (e.g. fresh WSL install that only has our binary), the Agent SDK bundled inside us crashes on fileURLToPath(undefined) in each of the 4 scanners, leaking the stack trace 3x to the user through errors.push. Deterministic fallback already runs, so .axme-code/ is unaffected — the fix is purely UX.

Added a pre-flight findClaudePath() check in src/tools/init.ts before Promise.allSettled. If claude is missing, log a friendly message with the install command and skip scanner invocation entirely. Downstream processing loop iterates the empty array and the existing deterministic-oracle fallback block kicks in.

Test plan

  • node dist/axme-code.js --version prints 0.2.9, exits 0
  • node dist/axme-code.js -v prints 0.2.9, exits 0
  • node dist/axme-code.js --unknown-flag still prints "Unknown command" + usage (regression guard)
  • node dist/axme-code.js status still works
  • npm test 511/511 pass
  • npm run build clean
  • npx tsc --noEmit clean

Not added: new unit tests. The --version path is trivial and covered manually; the preflight branch is defensive against an SDK interaction that's hard to mock cleanly.

🤖 Generated with Claude Code

- axme-code --version / -v now prints AXME_CODE_VERSION and exits 0
  (previously: "Unknown command: --version" + usage dump, discovered
  during WSL2 E2E testing when verifying install.sh worked).

- initProjectWithLLM now pre-flights findClaudePath() before spawning
  scanners. Without the `claude` CLI, the bundled Agent SDK crashes on
  fileURLToPath(undefined) and leaks the stack trace 3x (once per
  scanner) via errors.push. The friendly message points the user at the
  install command instead. Deterministic fallback still runs, so the
  output of .axme-code/ is unchanged.

#!axme pr=none repo=AxmeAI/axme-code
@George-iam George-iam merged commit b172a72 into main Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant