fix(hooks): detect git branch force-delete flag variants - #299
Open
atomicdjt wants to merge 2 commits into
Open
Conversation
Signed-off-by: David Turner <davidelsey9513@gmail.com>
Signed-off-by: David Turner <davidelsey9513@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #296
Why
The
git-branch-deleteguard only recognized literalgit branch -D, even though Git accepts equivalent force-delete forms such as-d -f,-fd,-df, and--delete --force.Those variants could bypass the existing
reconsidersafety guard.What changed
git branchforce-delete detection into independent delete + force checksgit branch -d/--deletebehaviorevaluateDangerous()deny behavior# Rosetta-AI-reviewedoverride behaviorScope
Two files only:
src/hooks/src/hooks/dangerous-actions/patterns.tssrc/hooks/tests/git-branch-delete.test.tsNo unrelated refactor or guardrail-policy changes.
Validation
mainatfca6be111aec87c55c877047184f723d671d3598Signed-off-bytrailersThe full repository dependency/test suite could not be executed from the ChatGPT tool environment because that runtime cannot fetch the repository's npm dependencies. The change was instead kept narrowly scoped and validated against the relevant behavior directly.
Risk / behavior boundary
This only broadens the existing
git-branch-deletereconsiderguard to equivalent force-delete syntax.It does not introduce a hard-deny path, and normal non-force branch deletion remains unguarded as before.
AI assistance was used to implement and review this change. I reviewed and take responsibility for the submitted diff, consistent with the repository's AI-assisted contribution policy.