Skip to content

CLI: --version, -v, -V and -version fail with "Not in a git repository" outside a repo #1443

@leex279

Description

@leex279

Summary

The archon version command works without a git repo, but the conventional flag aliases (--version, -v, -V, -version) all hit the git-repo check and exit with an error. Users expect any of these to print version info from anywhere — that's the convention node, npm, bun, and git follow.

Reproduction

From any non-git directory (e.g. C:\Users\<user> on Windows or ~ on Unix):

$ archon version
Archon CLI v0.3.9
  Platform: win32-x64
  Build: source (bun)
  Database: sqlite
  Git commit: unknown

$ archon -v
Error: Not in a git repository.
The Archon CLI must be run from within a git repository.
Either navigate to a git repo or use --cwd to specify one.

$ archon --version
Error: Not in a git repository.
...

$ archon -version
Error: Not in a git repository.
...

Root cause

packages/cli/src/cli.ts only short-circuits the git-repo check for the literal positional commands listed in noGitCommands (['version', 'help', 'setup', 'chat', 'continue', 'serve', 'skill']). Flag-style aliases like --version go through parseArgs (where they're either ignored or parsed as values.verbose) and then fall through to the git-repo check with no command, which fails.

Expected behavior

Invocation Should do
archon version print version (already works)
archon --version print version
archon -V print version
archon -version print version
archon -v (alone) print version
archon -v workflow list keep -v as --verbose (existing behavior)

Notes

  • -v is the existing short alias for --verbose. When used alone (no command), there's no workflow to be verbose about, so falling back to version output is harmless and matches user expectation.
  • Fix should bypass parseArgs for these aliases so they work even from directories where parsing later checks would fail.

Tested on: Windows 11, source build (bun), Archon CLI v0.3.9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions