[Bug]: Removing Vibe event hooks deletes user comments that follow a Spec Kit hook block
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
Rechercherichtung
Lies src/specify_cli/integrations/vibe/__init__.py, besonders die Zeilen 440–490 zur Erkennung verwalteter Blöcke und zu _without_managed_hooks, und prüfe anschließend remove_vibe_event_hooks sowie die zugehörigen Tests in tests/integrations/test_integration_vibe.py. Führe die Vibe-Integrationstests aus, die den Erhalt von Kommentaren und das Entfernen abdecken; fertig ist es, wenn Benutzerkommentare und Hooks das Entfernen überstehen und eine Datei mit Benutzerinhalt erhalten bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Bug Description
VibeIntegration finds the [[hooks]] blocks that Spec Kit owns (marked speckit_marker = true) and treats each one as running until the next table header or the end of the file (src/specify_cli/integrations/vibe/__init__.py:440-470). Comment and blank lines after a managed block therefore count as part of it. When the hooks are removed, those user comments are deleted. If a comment is the only user content left, remove_vibe_event_hooks deletes the whole .vibe/hooks.toml file. _merge_managed_hooks, used when hooks are written again, uses the same block detection and drops the comments as well.
Steps to Reproduce
From the root of a fresh clone, after uv sync, save the script below as repro.py and run it with uv run python repro.py.
import tempfile
from pathlib import Path
from specify_cli.integrations import get_integration
vibe = get_integration("vibe")
managed = (
'[[hooks]]\nname = "speckit-pre_tool-validate"\ntype = "pre_tool"\n'
'command = "c"\ntimeout = 65\nspeckit_marker = true\n'
)
cases = {
"comment before a user hook": managed
+ '\n# NOTE: keep guard-bash first\n[[hooks]]\nname = "user-hook"\n'
'type = "pre_tool"\ncommand = "guard-bash"\n',
"trailing user comment only": managed + "\n# my notes about vibe hooks\n",
}
for label, text in cases.items():
root = Path(tempfile.mkdtemp())
path = root / ".vibe" / "hooks.toml"
path.parent.mkdir()
path.write_text(text)
vibe.remove_vibe_event_hooks(root, ensure_safe_destination=lambda p: None)
print(f"[{label}]")
print(" file exists after removal:", path.exists())
print(" content:", repr(path.read_text()) if path.exists() else None)
The script writes a .vibe/hooks.toml containing a Spec Kit managed hook followed by user content, then calls remove_vibe_event_hooks, the method used when Vibe event hooks are removed.
Expected Behavior
Only the Spec Kit managed hook is removed. The user's comment and the user's hook stay, and a file that still holds a user comment is kept. The _without_managed_hooks docstring says it preserves "every other source slice verbatim" (src/specify_cli/integrations/vibe/__init__.py:477-490), and the remove_vibe_event_hooks docstring says it removes "only Specify-owned Vibe hooks and delete[s] an owned-only file" (vibe/__init__.py:553-590). The tests test_empty_events_preserve_comments_only_file and test_removal_preserves_user_comment_with_marker_text (tests/integrations/test_integration_vibe.py:496-528) treat user comments as content to keep.
Actual Behavior
[comment before a user hook]
file exists after removal: True
content: '[[hooks]]\nname = "user-hook"\ntype = "pre_tool"\ncommand = "guard-bash"\n'
[trailing user comment only]
file exists after removal: False
content: None
In the first case the line # NOTE: keep guard-bash first is gone. In the second case the file is deleted together with the user's comment.
Specify CLI Version
1.2.4.dev0 (main at 27d14e2)
AI Agent
Mistral Vibe
Operating System
Linux 6.18 (Ubuntu container)
Python Version
Python 3.12.3
Additional Context
A comment placed after a managed block is likely to describe the user content that follows it, as in the first case, so attaching it to the managed block loses user content.
Related: #4646 (merged) added this removal path. A review comment on that pull request flagged the comment loss, and no later commit addressed it.
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.
- Vorherrschende Sprache
- Python
- Sterne
- 149k
- Forks
- 13.4k
- Ø Merge
- 1 T. 5 Std.
- Gemergte PRs (30 T.)
- 223
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus github/spec-kit
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
triage-must-have
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Workflow-step verifier test fixture breaks when the checkout path contains whitespace (4 failures on macOS)Evtl. vergeben @mehdikarimi55 hat das vor 3 Tagen übernommen. Offentriage-can-wait
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
Maintainer antworten meist innerhalb von 1 Tag
-
Parity tests fail under the documented direct pytest invocation when the ambient python3 lacks PyYAML (11 failures)Evtl. vergeben @mehdikarimi55 hat das vor 3 Tagen übernommen. Offentriage-must-have
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug triage-out-of-scope
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in github/spec-kit
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
glossyio/traffic-monitor#312 ·
Maintainer antworten meist innerhalb von 1 Tag
-
local devenv exampleOffendocumentation enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
es-ude/elastic-ai.creator#1046 ·
Maintainer antworten meist innerhalb von 3 Tagen
-
feature request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
confident-ai/deepteam#306 ·
Maintainer antworten meist innerhalb von 1 Tag
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsEvtl. vergeben @himanchalkaushale hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
OWASP/Nettacker#1884 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag