Skip to content

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

Merged
mnriem merged 4 commits intogithub:mainfrom
afurm:af/fix-noninteractive-init-agent-default
May 6, 2026
Merged

fix: default non-interactive init to copilot integration#2414
mnriem merged 4 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

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.

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: 2

Comment thread src/specify_cli/__init__.py Outdated
Comment thread src/specify_cli/__init__.py Outdated
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.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new

mnriem
mnriem previously approved these changes May 6, 2026
@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented May 6, 2026

Looks like we have some Test & Lint errors. Can you please fix those? Thanks!

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.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new

@mnriem mnriem merged commit 2d5e630 into github:main May 6, 2026
15 checks passed
@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented May 6, 2026

Thank you!

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