alma coding-agent subcommand broken

alma coding-agent status and alma coding-agent run commands always fall through to the usage message, regardless of arguments provided.

Root Cause

In the coding-agent subcommand handler (located in cli/alma), there's an args index off-by-one error:

if (cmd === 'coding-agent') {
    const sub = args[0];  // ← BUG: should be args[1]
    if (sub === 'status') {
        // ...
    }
    if (sub === 'run') {
        // ...
        for (let i = 1; i < args.length; i++) {  // ← BUG: should start at i = 2

Why this is wrong:

  • When user runs alma coding-agent status, the args array is ['coding-agent', 'status']

  • args[0] is 'coding-agent' (same as cmd), so sub never equals 'status' or 'run'

  • The condition always fails and falls through to the usage message

Comparison with Other Subcommands

All other subcommands correctly use args[1]:

// config subcommand
if (cmd === 'config') {
    const subcmd = args[1];  // ✓ correct
    // ...
}

// provider subcommand
if (cmd === 'provider') {
    const sub = args[1];  // ✓ correct
    // ...
}

// skill subcommand
if (cmd === 'skill') {
    const sub = args[1] || 'list';  // ✓ correct
    // ...
}

How to Reproduce

$ alma coding-agent status
Usage: alma coding-agent <status|run>
  status              Check if Claude Code is available
  run [opts] "task"   Delegate a coding task
    --dir <path>      Working directory (default: cwd)
    --yolo            Skip permission prompts

# Expected: should check Claude Code installation status
# Actual: shows usage message and exits

Fix

Two lines need to be changed in the coding-agent handler:

Line 1: Fix subcommand detection

- const sub = args[0];
+ const sub = args[1];

Line 2: Fix argument parsing in run handler

- for (let i = 1; i < args.length; i++) {
+ for (let i = 2; i < args.length; i++) {

The for loop needs to start at index 2 because:

  • args[0] = 'coding-agent'

  • args[1] = 'run'

  • args[2] onwards = actual flags and task description

Impact

  • alma coding-agent status is completely broken

  • alma coding-agent run is completely broken

  • The coding-agent skill cannot function properly

Verification After Fix

$ alma coding-agent status
Claude Code: installed (2.1.63) but NOT authenticated
Run "claude" interactively to complete OAuth login

# ✓ Works correctly

Environment:

  • macOS

  • Alma version: (check with alma --version)

  • Location: /Applications/Alma.app/Contents/Resources/cli/alma

Please authenticate to join the conversation.

Upvoters
Status

In Review

Board
🐛

Bug Reports

Date

3 days ago

Author

喂,在吗?

Subscribe to post

Get notified by email when there are changes.