mirror of
https://github.com/Fission-AI/OpenSpec.git
synced 2026-09-14 20:16:53 +08:00
93326be3e9
Fixes #195 ## Problem Users with existing tool config files (like CLAUDE.md) would see those tools marked as "already configured" even when running `openspec init` for the first time. This caused confusion as users thought OpenSpec was already set up when it wasn't. Root causes: 1. Tool detection checked only for file existence, not OpenSpec ownership 2. Detection ran even in fresh projects without openspec/ folder ## Solution Two-part fix: 1. **Conditional detection**: Only check tool configuration when in extend mode (when openspec/ directory already exists). Fresh initializations skip the check entirely, treating all tools as unconfigured. 2. **Marker-based validation**: For tools to be considered "configured by OpenSpec", their files must contain OpenSpec markers (<!-- OPENSPEC:START --> and <!-- OPENSPEC:END -->). For tools with both config files and slash commands (like Claude Code), BOTH must have markers. ## Changes - Modified getExistingToolStates() to accept extendMode parameter - Rewrote isToolConfigured() to verify OpenSpec markers in files - Added OPENSPEC_MARKERS to imports - Added 4 comprehensive test cases covering the new behavior ## Test Coverage - Fresh init with existing CLAUDE.md → NOT shown as configured ✅ - Fresh init with existing slash commands → NOT shown as configured ✅ - Extend mode with OpenSpec files → shown as configured ✅ - Fresh init with global Codex prompts → NOT shown as configured ✅ All 240 tests pass.