Skip to content

fix: use global branch numbering instead of per-short-name detection#1757

Merged
mnriem merged 2 commits intogithub:mainfrom
fsilvaortiz:fix/global-branch-numbering
Mar 9, 2026
Merged

fix: use global branch numbering instead of per-short-name detection#1757
mnriem merged 2 commits intogithub:mainfrom
fsilvaortiz:fix/global-branch-numbering

Conversation

@fsilvaortiz
Copy link
Contributor

Summary

  • The specify.md prompt instructed the AI to search for existing branches filtered by exact short-name, so every new feature started at 001 since no branches matched the new short-name
  • The underlying create-new-feature.sh already has correct global numbering logic via check_existing_branches() that searches ALL branches and spec directories
  • Simplified step 2 to tell the AI to NOT pass --number, letting the script auto-detect the next globally available number

Closes #1744
Closes #1468

Root cause

The prompt at step 2b told the AI to grep for branches matching the exact short-name:

git ls-remote --heads origin | grep -E 'refs/heads/[0-9]+-<short-name>$'

And step 2c said: "If no existing branches/directories found with this short-name, start with number 1". Since each new feature has a unique short-name, the search always returned empty and numbering reset to 001.

Test plan

  • Verified the script correctly assigns 001, 002, 003 to 3 different features when --number is NOT passed
  • Reproduced the bug: passing --number 1 manually causes duplicate 001 prefixes (confirming the AI override was the problem)
  • Full test suite passes (120 tests)
  • Verified the change is a net removal of 24 lines of flawed logic, replaced with 4 lines of clear instructions

🤖 Generated with Claude Code

The specify.md prompt instructed the AI to search for existing branches
filtered by the exact short-name, causing every new feature to start at
001 since no branches matched the new short-name. The underlying
create-new-feature.sh script already has correct global numbering logic
via check_existing_branches() that searches ALL branches and spec
directories.

The fix removes the AI's flawed number-detection steps and tells it to
NOT pass --number, letting the script auto-detect the next globally
available number.

Closes github#1744
Closes github#1468

🤖 Generated with [Claude Code](https://claude.com/code)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
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

Updates the /speckit.specify command prompt to rely on the existing create-new-feature scripts’ global branch/spec numbering logic, avoiding accidental resets to 001 caused by short-name–scoped detection.

Changes:

  • Removes the prompt’s manual branch-number detection steps (remote/local/spec-dir scanning).
  • Instructs running the feature creation script without --number, letting it auto-select the next global number.
  • Simplifies the “IMPORTANT” guidance to prevent AI-driven overrides of numbering.

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

Copy link
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

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

@fsilvaortiz Can you address the Copilot suggestions where applicable. And what about the PowerShell variant of the script?

- Rephrased step 2 to mention both --short-name and --json flags
- Added explicit note to always include the JSON flag for reliable output parsing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@fsilvaortiz
Copy link
Contributor Author

@mnriem Applied the Copilot suggestion in b6bccdd — clarified that --json must also be included, not just --short-name.

Regarding PowerShell: the bug is not in the scripts — both create-new-feature.sh and create-new-feature.ps1 already have correct global numbering logic. The PowerShell script's Get-NextBranchNumber (line 108) explicitly searches "ALL branches (not just matching short name)" when -Number is not passed. The bug was solely in the prompt telling the AI to manually detect a per-short-name number and override --number/-Number. The updated prompt already includes the PowerShell example without -Number (line 45).

🤖 Generated with Claude Code

@mnriem mnriem merged commit 8618d0a into github:main Mar 9, 2026
8 checks passed
kanfil added a commit to tikalk/agentic-sdlc-spec-kit that referenced this pull request Mar 9, 2026
…port

Upstream changes merged:
- fix: use global branch numbering instead of per-short-name detection (github#1757)
- fix: Remove duplicate options in specify.md (github#1765)
- feat: add review extension to community catalog (github#1775)
- feat: add fleet extension to community catalog (github#1771)
- feat: Integration of Mistral vibe support into speckit (github#1725)

Conflict resolution:
- templates/commands/specify.md: Kept our namespace (adlc.spec.*) and --json flag requirement
- README.md: Added Mistral Vibe to supported agents and CLI options
- Release scripts: Added Mistral Vibe to agent arrays
- All release scripts now include vibe agent in ALL_AGENTS array

All 5 conflicts resolved successfully.
kanfil added a commit to tikalk/agentic-sdlc-spec-kit that referenced this pull request Mar 9, 2026
Upstream changes merged (8 commits total):
- fix: use global branch numbering instead of per-short-name detection (github#1757)
- fix: Remove duplicate options in specify.md (github#1765)
- feat: add review extension to community catalog (github#1775)
- feat: add fleet extension to community catalog (github#1771)
- feat: Integration of Mistral vibe support into speckit (github#1725)
- feat: Add Understanding extension to community catalog (github#1778)
- feat: Add ralph extension to community catalog (github#1780)
- docs: Update README with project initialization instructions (github#1772)

Conflict resolution:
- templates/commands/specify.md: Kept --json flag and clearer instructions
- README.md: Preserved detailed CLI docs + added vibe agent
- Release scripts: Added vibe agent support
- extensions/catalog.community.json: All 4 new extensions added (review, fleet, understanding, ralph)

All conflicts resolved by keeping our enhancements.
kanfil added a commit to tikalk/agentic-sdlc-spec-kit that referenced this pull request Mar 9, 2026
…rt (#74)

* fix: use global branch numbering instead of per-short-name detection (github#1757)

* fix: remove per-short-name number detection from specify prompt

The specify.md prompt instructed the AI to search for existing branches
filtered by the exact short-name, causing every new feature to start at
001 since no branches matched the new short-name. The underlying
create-new-feature.sh script already has correct global numbering logic
via check_existing_branches() that searches ALL branches and spec
directories.

The fix removes the AI's flawed number-detection steps and tells it to
NOT pass --number, letting the script auto-detect the next globally
available number.

Closes github#1744
Closes github#1468

🤖 Generated with [Claude Code](https://claude.com/code)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: clarify --json flag requirement per Copilot review

- Rephrased step 2 to mention both --short-name and --json flags
- Added explicit note to always include the JSON flag for reliable output parsing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix: Remove duplicate options in specify.md (github#1765)

* Integration of Mistral vibe support into speckit (github#1725)

* Add Mistral Vibe support to Spec Kit

This commit adds comprehensive support for Mistral Vibe as an AI agent in the
Spec Kit project. The integration includes:

- Added Mistral Vibe to AGENT_CONFIG with proper CLI tool configuration
- Updated README.md with Mistral Vibe in supported agents table and examples
- Modified release package scripts to generate Mistral Vibe templates
- Updated both bash and PowerShell agent context update scripts
- Added appropriate CLI help text and documentation

Mistral Vibe is now fully supported with the same level of integration as
other CLI-based agents like Claude Code, Gemini CLI, etc.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* Add Mistral Vibe support to Spec Kit

- Added Mistral Vibe (vibe) to AGENT_CONFIG with proper TOML format support
- Updated CLI help text to include vibe as a valid AI assistant option
- Added Mistral Vibe to release scripts with correct .vibe/agents/ directory structure
- Updated agent context scripts (bash and PowerShell) with proper TOML file paths
- Added Mistral Vibe to README.md supported agents table with v2.0 slash command notes
- Used correct argument syntax {{args}} for Mistral Vibe TOML configurations

Mistral Vibe is now fully integrated with the same level of support as other
CLI-based agents like Gemini and Qwen. Users can now use specify init --ai vibe
to create projects with Mistral Vibe support.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

* Add Vibe templates to GitHub release script

creation of Mistral vibe zip

* Add 'vibe' agent to release package script

* Add 'vibe' to the list of agents in create-release-packages.sh

* chore: bump version to v1.0.1 [skip ci]

* Add generic spec kit templates to release script

* chore: bump version to v1.0.2 [skip ci]

* Update project version to 0.1.5

* Add generic spec kit templates to release script

* Add 'generic' and 'qodercli' to agent list to be aligned

* Update supported agents in update-agent-context.sh to be aligned

* Update README with new AI assistant options to be aligned

* Document --ai-commands-dir option in README to be aligned

Added new option for AI commands directory in README.

* Fix formatting in README.md for init arguments to be aligned

* Update README with AI assistant options to be aligned

Added AI options to specify init arguments in README.

* Fix formatting in README.md for project-name argument

* Update expected agent types in update-agent-context.sh to be aligned

* Update agent types and usage in update-agent-context.ps1 to be aligned

* Add support for generic AI assistant configuration to be aligned

* Fix formatting in __init__.py clean space

* Update AI assistant options in init command to be aligned

* Add 'qodercli' to expected agent types to be aligned

* Remove 'vibe' case from release package script

Removed the 'vibe' case from the create-release-packages script.

* Update README.md

ok for this

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .github/workflows/scripts/create-release-packages.ps1

ok to commit

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add commands_subdir key to Mistral Vibe configuration

* Rename specify-agents.toml to specify-agents.md

* Update scripts/bash/update-agent-context.sh

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .github/workflows/scripts/create-release-packages.sh

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/specify_cli/__init__.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/specify_cli/__init__.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Fix duplicate 'commands_subdir' in vibe configuration

Removed duplicate 'commands_subdir' entries for 'vibe'.

* Add support for 'vibe' command in release script

add an mkdir and generate command

* Change commands_subdir from 'commands' to 'prompts'

* Update README.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update update-agent-context.ps1

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update create-release-packages.sh

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update create-release-packages.ps1

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update agent list in update-agent-context.sh

Kiro

---------

Co-authored-by: Lénaïc Huard <lenaic@lhuard.fr>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add fleet extension to community catalog (github#1771)

- Extension ID: fleet
- Version: 1.0.0
- Author: sharathsatish
- Description: Orchestrate a full feature lifecycle with human-in-the-loop gates across all SpecKit phases

* feat: add review extension to community catalog (github#1775)

Add spec-kit-review to catalog.community.json
and the Available Community Extensions table in extensions/README.md.

Co-authored-by: Ismael <ismael.jimenez-martinez@bmw.de>

* Update README with project initialization instructions (github#1772)

* Update README with project initialization instructions

Added instructions for creating a new project and initializing in an existing project.

* Update README.md with alternative one-time usage command for existing projects

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Added --ai option to prevent interactive AI selection

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add ralph extension to community catalog (github#1780)

- Extension ID: ralph
- Version: 1.0.0
- Author: Rubiss
- Description: Autonomous implementation loop using AI agent CLI

* Add Understanding extension to community catalog (github#1778)

* Add Understanding extension to community catalog

31 deterministic requirements quality metrics based on IEEE/ISO standards.
Catches ambiguity, missing testability, and structural issues before implementation.
Includes experimental energy-based ambiguity detection.

Repository: https://github.com/Testimonial/understanding
Commands: scan, validate, energy
Hook: after_tasks validation prompt

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Sort README table and catalog entries alphabetically

Move Understanding extension entry between Spec Sync and V-Model
to maintain alphabetical ordering in both files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Ladislav Bihari <ladislav.bihari@statsperform.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Fabián Silva <fabiansilvaortiz@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Ryo Hasegawa <49798519+ryo8000@users.noreply.github.com>
Co-authored-by: Gaël <liaudetgael@gmail.com>
Co-authored-by: Lénaïc Huard <lenaic@lhuard.fr>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Sharath Satish <2109335+sharathsatish@users.noreply.github.com>
Co-authored-by: Ismael <712805+ismaelJimenez@users.noreply.github.com>
Co-authored-by: Ismael <ismael.jimenez-martinez@bmw.de>
Co-authored-by: Lautaro Lubatti <12738908+lubatti@users.noreply.github.com>
Co-authored-by: Ben Lawson <Rubiss@Gmail.com>
Co-authored-by: LADISLAV BIHARI <51442396+Testimonial@users.noreply.github.com>
Co-authored-by: Ladislav Bihari <ladislav.bihari@statsperform.com>
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.

[Bug]: All new specs start with 001 Bug: speckit.specify Sometimes Resets New Branch Name Back to 001 [already reported]

3 participants