[Bug]: `bundle init <bundle>` initialises with the default integration instead of the bundle's, then aborts with a clash

未關閉 適合新手
#5,089 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@chelsealong 已經在處理了。

開始於 2026年10月25日。

  • #5111 來自 @chelsealong —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
cli

研究方向

從 src/specify_cli/bundles/command_init.py:33 開始,並比較 bundle install 如何在 src/specify_cli/bundles/command_install.py:98 解析整合;issue 也指出了 src/specify_cli/bundles/_commands.py:132 中的 _resolve_init_integration。執行提供的離線重現步驟,以確認不一致。完成標準是 bundle init 使用 bundle 宣告的整合初始化一個新專案,並在沒有衝突錯誤的情況下完成。

由索引模型根據 Issue 內容生成。

描述

triage-must-have
Bug Description

In a directory that is not yet a Spec Kit project, specify bundle init <bundle> picks the init integration with _resolve_init_integration(integration, None) (src/specify_cli/bundles/command_init.py:33). Because it passes None instead of the manifest, it skips the bundle-declared integration and initialises the project with the default (copilot). The follow-up install then fails because the bundle targets a different integration.

The project is left initialised with the wrong integration, although the error message says "aborting with no changes". specify bundle install <bundle> in the same situation passes the manifest (command_install.py:98) and initialises with the bundle's integration.

Steps to Reproduce

From the root of a fresh clone after uv sync, save the script below as repro.py and run uv run python -I repro.py. It runs the real specify CLI with --offline. No network access is needed, and HOME points at the temp directory so user configuration is not read.

import json, os, subprocess, tempfile
from pathlib import Path

work = Path(tempfile.mkdtemp())
bundle = work / "claude-bundle"; bundle.mkdir()
(bundle / "bundle.yml").write_text(
    'schema_version: "1.0"\n'
    'bundle: {id: claude-bundle, name: C, version: "1.0.0", role: dev, description: d, author: a, license: MIT}\n'
    'requires: {speckit_version: ">=0.0.1"}\n'
    'integration: {id: claude}\n'
)
env = {"PATH": os.environ["PATH"], "HOME": str(work), "COLUMNS": "200"}

for command in (["bundle", "install"], ["bundle", "init"]):
    project = work / command[1]; project.mkdir()
    run = subprocess.run(["specify", *command, str(bundle), "--offline"],
                         cwd=project, capture_output=True, text=True, env=env)
    state = project / ".specify" / "integration.json"
    integration = json.loads(state.read_text())["default_integration"] if state.exists() else None
    errors = [line for line in (run.stdout + run.stderr).splitlines() if "Error" in line]
    print(f"specify {' '.join(command)}: exit {run.returncode}, project integration={integration}, "
          f"bundle recorded={(project / '.specify' / 'bundle-records.json').exists()}")
    for line in errors:
        print("   ", line)
Expected Behavior

bundle init <bundle> should behave like bundle install <bundle> and initialise with the bundle's declared integration (claude):

  • src/specify_cli/bundles/_commands.py:132: "Precedence (FR-013): explicit override → bundle-declared → default."
  • docs/reference/bundles.md:192 describes bundle init as "an explicit one-step bootstrap for a new checkout".
  • docs/reference/bundles.md:77: if a bundle targets a different integration, install "aborts with no changes".
Actual Behavior
specify bundle install: exit 0, project integration=claude, bundle recorded=True
specify bundle init: exit 1, project integration=copilot, bundle recorded=False
    Error: Bundle 'claude-bundle' targets integration 'claude', but this project's active integration is 'copilot'. Installing it would conflict; aborting with no changes.

After the failed bundle init, .specify/integration.json records copilot, and the project has been scaffolded for it.

Error Logs
Error: Bundle 'claude-bundle' targets integration 'claude', but this project's active integration is 'copilot'. Installing it would conflict; aborting with no changes.
Specify CLI Version

1.2.4.dev0 (main at 27d14e2)

AI Agent

Claude Code

Operating System

Linux 6.18 (Ubuntu container)

Python Version

Python 3.12.3

Additional Context

Passing --integration claude explicitly avoids the problem. A likely fix is for bundle init to load the bundle's manifest before initialising, as bundle install does.

Also reproduced on macOS (Darwin 25.6, arm64) with Python 3.14.4 and uv run python -I repro.py against 27d14e2; the output matches the above.

AI Disclosure

Found and reproduced with Claude Code (model: Claude Opus 4.8), run autonomously under human supervision. The human reporter re-ran every reproduction above before filing.

主要語言
Python
星號
144k
分支
12.9k
平均合併
1 天 4 小時
30 天內合併 PR
181

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/spec-kit 的其他 Issue

查看 github/spec-kit 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。