Skip to content

fix: default non-interactive init to copilot integration#2414

Open
afurm wants to merge 2 commits intogithub:mainfrom
afurm:af/fix-noninteractive-init-agent-default
Open

fix: default non-interactive init to copilot integration#2414
afurm wants to merge 2 commits intogithub:mainfrom
afurm:af/fix-noninteractive-init-agent-default

Conversation

@afurm
Copy link
Copy Markdown
Contributor

@afurm afurm commented Apr 29, 2026

Description

This PR fixes a non-interactive specify init crash path where init would still try to open the interactive integration picker when stdin is not a TTY.
When --ai/--integration is not provided in non-interactive environments, the command now defaults to copilot and proceeds without prompting.

Fixes: github/spec-kit#267

It also adds a regression test to ensure non-interactive initialization:

  • does not invoke the integration picker
  • writes copilot to .specify/integration.json
  • creates expected Copilot scaffold files

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest
    (ran focused pytest targets instead)
  • Tested with a sample project (if applicable)

Additional executed checks:

  • uv run --with pytest pytest tests/integrations/test_cli.py::TestInitIntegrationFlag::test_noninteractive_init_defaults_to_copilot -q
  • uv run --with pytest pytest tests/integrations/test_cli.py -q
  • uv run --with pytest pytest tests/integrations/test_integration_copilot.py -q

AI Disclosure

  • I did use AI assistance (describe below)

This PR was authored with help from ChatGPT/Codex for issue triage, implementation, test additions, and write-up.

  • I did not use AI assistance for this contribution

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a non-interactive specify init crash by preventing the interactive integration picker from running when stdin is not a TTY; in that case (and with no --ai/--integration provided) it defaults to the copilot integration and continues. Adds a regression test to ensure non-interactive initialization selects Copilot and produces expected scaffold output.

Changes:

  • Default specify init to copilot when sys.stdin.isatty() is false and no agent was explicitly provided.
  • Add a CLI-level regression test that monkeypatches the picker to ensure it is not invoked in non-interactive mode.
Show a summary per file
File Description
src/specify_cli/__init__.py Adds a non-interactive guard to bypass arrow-key selection and default to copilot.
tests/integrations/test_cli.py Adds a regression test verifying non-interactive init does not open the picker and writes copilot to .specify/integration.json.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

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.

uvx init does not work from within claude code CLI

3 participants