spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

Two critical bugs in specify CLI: hangs during download and broken arrow key navigation

Open Rodaddy-Bullish opened this issue 1 year ago • 2 comments

Two Critical Bugs in Specify CLI

Environment

  • OS: macOS 14.6.0 (Darwin 24.6.0)
  • Python: 3.13.6
  • uv: 0.8.11
  • specify-cli: 0.0.2
  • Installation method: Both uv tool install . and local development

Bug 1: CLI hangs indefinitely during template download

Description

The specify init command hangs indefinitely after AI assistant selection during the template download process, regardless of installation method or directory state.

Steps to Reproduce

# Method 1: System-wide installation
uv tool install .
specify init test-project --ai claude --ignore-agent-tools

# Method 2: Direct from repo
uvx --from git+https://github.com/github/spec-kit.git specify init test-project --ai claude

# Method 3: Existing directory
cd /path/to/existing/project
echo "y" | specify init --here --ai claude --ignore-agent-tools

Expected Behavior

CLI should download template, extract files, and complete initialization.

Actual Behavior

CLI hangs indefinitely after printing:

Using provided AI assistant: claude

Debugging Information

  • Manual download works fine: curl -L -o test.zip "$(curl -s https://api.github.com/repos/github/spec-kit/releases/latest | jq -r '.assets[] | select(.name | contains("claude")) | .browser_download_url')"
  • GitHub API is accessible: specify check passes
  • Internet connectivity confirmed
  • Occurs with all AI options (claude, gemini, copilot)
  • Happens in both clean and existing directories
  • --ignore-agent-tools flag doesn't affect the hang

Suspected Root Cause

Issue appears to be in the httpx request handling in the download_template_from_github() function around line 400-500 in src/specify_cli/__init__.py. Likely a timeout or async handling bug.

Bug 2: Arrow key navigation broken in interactive mode

Description

When running specify init without specifying --ai, the interactive AI selection menu doesn't respond to arrow keys.

Steps to Reproduce

cd /path/to/any/directory
specify init --here
# Try using up/down arrow keys in the selection menu

Expected Behavior

Arrow keys should navigate between AI assistant options.

Actual Behavior

Arrow keys are not recognized, menu doesn't respond to navigation input.

Root Cause

The readchar library (line 164 in get_key() function) has compatibility issues with certain terminal environments, particularly:

  • VS Code integrated terminal
  • Some macOS terminal configurations
  • Remote/SSH sessions

Workaround

Always specify AI explicitly: specify init --here --ai claude

Impact

  • Bug 1: Makes the CLI completely unusable - it never completes initialization
  • Bug 2: Makes interactive mode unusable, forces users to always specify AI explicitly

Additional Notes

  • Both bugs are reproducible across different installation methods
  • Manual network operations work fine, suggesting the issue is in the CLI's network handling
  • The hanging bug prevents any successful use of the CLI for its primary purpose

These bugs effectively make the specify CLI non-functional for its intended use case.

Rodaddy-Bullish avatar Sep 08 '25 22:09 Rodaddy-Bullish

About bug 1, I was able to workaround it by specifying the git tag of the version I want to run:

 uvx --from git+https://github.com/github/[email protected] specify init my-cool-project

dmarav avatar Sep 09 '25 06:09 dmarav

This is now fixed - feel free to open another issue if the problem persists.

localden avatar Oct 19 '25 03:10 localden