Commit 56f2675
fix(guardex): auto-stash dirty primary on branch-switch (#417)
Previously the post-checkout guard only reverted a primary-tree switch
back to the protected branch when the working tree was clean. A dirty
tree caused the guard to print "auto-revert skipped" and silently leave
the primary checkout on the agent branch - the exact symptom that flips
local main to an agent/* worktree branch.
- templates/githooks/post-checkout: stash dirty worktree as
`guardex-auto-revert <ts> <prev>-><new>` (include untracked) before
reverting; primary always ends up back on the protected branch in an
agent session. Fallback message only fires when stash itself fails.
- AGENTS.md + templates/AGENTS.multiagent-safety.md: promote the
primary-tree lock to an explicit blocking rule enumerating every
disallowed command (git checkout/switch/checkout -b/switch -c/worktree
add onto an existing agent branch) and add a dirty-tree rule that
points at the new auto-stash safety net without making it a workflow.
Co-authored-by: NagyVikt <nagy.viktordp@gmail.com>1 parent 0e9131b commit 56f2675
3 files changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
385 | | - | |
| 385 | + | |
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
389 | 393 | | |
390 | 394 | | |
391 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
78 | 84 | | |
79 | 85 | | |
80 | 86 | | |
| |||
0 commit comments