Skip to content

fix: detectBranch handles cd && git pattern + docs update#28

Merged
George-iam merged 2 commits intomainfrom
fix/detectbranch-cd-and-docs-20260407
Apr 7, 2026
Merged

fix: detectBranch handles cd && git pattern + docs update#28
George-iam merged 2 commits intomainfrom
fix/detectbranch-cd-and-docs-20260407

Conversation

@George-iam
Copy link
Copy Markdown
Contributor

Summary

  • Safety bug fix: detectBranch now parses cd /path && prefix from Bash commands and runs git branch --show-current in the correct directory. Previously, chained commands like cd /path && git commit bypassed merged-PR detection because the hook ran in workspace root.
  • Merged PR check: changed startsWith("git push") to includes("git push") so chained commands are caught
  • Docs: remove axme_search_memory (removed in PR#25), add axme_memories (added in PR#24), update axme_context description

Root cause

Agent pushed commits to fix/compact-kb-stricter-20260407 after PR#27 was merged. Safety hook didn't block because:

  1. Command was cd /home/.../axme-code && git commit ...
  2. checkGit used startsWith("git commit") which didn't match (starts with cd)
  3. detectBranch ran git branch --show-current in workspace root (not axme-code), got wrong branch

Test plan

  • After merge+reload: cd /path && git commit on a merged branch should be blocked

Safety hook detectBranch now parses cd target from "cd /path && git ..."
commands and runs git branch --show-current in the correct directory.
Also uses .includes() instead of .startsWith() for merged PR check
so chained commands (cd && git commit) are caught.

Docs: remove axme_search_memory, add axme_memories, update
axme_context description in README and ARCHITECTURE.
Replace fragile cd-only regex with extractGitCwd that handles:
- cd /path && ..., cd /path; ...
- pushd /path && ...
- git -C /path (including multiple -C flags)
Remove subdirectory scan fallback (returned random repo branch).
@George-iam George-iam merged commit 87e6879 into main Apr 7, 2026
@George-iam George-iam deleted the fix/detectbranch-cd-and-docs-20260407 branch April 7, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant