You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, love the work you're putting into this project!
Have one more .gitignore -related suggestion to add alongside #489 & #499, plus a suggestion for #497... (theme being gitignore gaps & overrides) in case there's opportunity to batch all into one PR.
Specifically, I've noticed:
index_repository seems to miss .gitignore rules (both dir-level and interited from parents) when called on a folder not at repo root, e.g., a subpackage
Suggested solution for 1. would be to either warn the user, loudly, when non git repo is passed and gitignore is present (something to the effect of "NOT A GIT REPO -- .GITIGNORE WON'T BE RESPECTED"), or to take on the recursive journey up to find parent git repo (where other generally applied ignore rules might reside), or to do a combination and warn + respect any within-folder .gitignore files.
Suggested for 2 would be to take the same approach as git itself: give .cbmignore priority as last instruction, so any conflicts (e.g., .gitignore shows dir, but .cbmignore shows !dir / !dir/* -> leads to dir being included in index).
MfG
Silas
Reproduction
Repro 1 — .gitignore skipped when indexing a non-root subfolder
T=$(mktemp -d); cd "$T"
git init -q # repo root = $T
mkdir pkg
echo 'def secret(): return "SECRET_TOKEN_111"' > pkg/secret.py
echo 'def ok(): return 1' > pkg/keep.py
echo 'secret.py' > pkg/.gitignore # committed, at the subpackage's own root
git add -A && git commit -qm init
# git itself agrees secret.py is ignored, even addressed from inside pkg:
git -C "$T/pkg" check-ignore secret.py
# secret.py ← git says: ignored
# (A) index the SUBPACKAGE (not the repo root):
OUT=$(codebase-memory-mcp cli index_repository "{\"repo_path\":\"$T/pkg\"}")
echo "$OUT" # note: "excluded" lists no .gitignore'd entry
PKG=$(printf '%s' "$OUT" | sed -n 's/.*"project":"\([^"]*\)".*/\1/p')
codebase-memory-mcp cli search_code "{\"pattern\":\"SECRET_TOKEN_111\",\"project\":\"$PKG\"}"
# EXPECTED (bug): a hit — secret.py was indexed despite pkg/.gitignore
# (B) contrast: index the actual repo ROOT — same files, same .gitignore:
OUT2=$(codebase-memory-mcp cli index_repository "{\"repo_path\":\"$T\"}")
ROOT=$(printf '%s' "$OUT2" | sed -n 's/.*"project":"\([^"]*\)".*/\1/p')
codebase-memory-mcp cli search_code "{\"pattern\":\"SECRET_TOKEN_111\",\"project\":\"$ROOT\"}"
# EXPECTED (correct): no hit — nested pkg/.gitignore is honored when indexing the root
# cleanup
codebase-memory-mcp cli delete_project "{\"project\":\"$PKG\"}"
codebase-memory-mcp cli delete_project "{\"project\":\"$ROOT\"}"
rm -rf "$T"
Repro 2 — .cbmignore is additive; ! can't override .gitignore (on a valid repo root)
T=$(mktemp -d); cd "$T"
git init -q
mkdir build extra
echo 'def gen(): return "OVERRIDE_MARKER_222"' > build/gen.py
echo 'def x(): return "CONTROL_MARKER_333"' > extra/x.py
echo 'def normal(): return 1' > main.py
echo 'build/' > .gitignore # gitignore excludes build/
printf '!build/\nextra/\n' > .cbmignore # try to re-include build/, AND plainly exclude extra/
git add -A && git commit -qm init
OUT=$(codebase-memory-mcp cli index_repository "{\"repo_path\":\"$T\"}")
echo "$OUT"
PROJ=$(printf '%s' "$OUT" | sed -n 's/.*"project":"\([^"]*\)".*/\1/p')
codebase-memory-mcp cli search_code "{\"pattern\":\"CONTROL_MARKER_333\",\"project\":\"$PROJ\"}"
# EXPECTED: no hit → proves .cbmignore IS loaded and applied (its `extra/` exclude works)
codebase-memory-mcp cli search_code "{\"pattern\":\"OVERRIDE_MARKER_222\",\"project\":\"$PROJ\"}"
# EXPECTED (current behavior): no hit → `!build/` did NOT re-include; .gitignore wins, cbmignore is additive
# cleanup
codebase-memory-mcp cli delete_project "{\"project\":\"$PROJ\"}"
rm -rf "$T"
Logs
Project scale (if relevant)
No response
Confirmations
I searched existing issues and this is not a duplicate.
My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
Version
codebase-memory-mcp 0.8.1
Platform
Windows (x64)
Install channel
GitHub release archive / install.sh / install.ps1
Binary variant
standard
What happened, and what did you expect?
Hello, love the work you're putting into this project!
Have one more .gitignore -related suggestion to add alongside #489 & #499, plus a suggestion for #497... (theme being gitignore gaps & overrides) in case there's opportunity to batch all into one PR.
Specifically, I've noticed:
index_repositoryseems to miss .gitignore rules (both dir-level and interited from parents) when called on a folder not at repo root, e.g., a subpackage.cbmignoremight be a useful place to add in overrides as described in Support .ignore files that act as a local override layer on top of .gitignore. #497 but currently (whenindex_repositoryis called on a valid git repo root), is additive with.gitignoreSuggested solution for 1. would be to either warn the user, loudly, when non git repo is passed and gitignore is present (something to the effect of "NOT A GIT REPO -- .GITIGNORE WON'T BE RESPECTED"), or to take on the recursive journey up to find parent git repo (where other generally applied ignore rules might reside), or to do a combination and warn + respect any within-folder .gitignore files.
Suggested for 2 would be to take the same approach as git itself: give .cbmignore priority as last instruction, so any conflicts (e.g., .gitignore shows
dir, but .cbmignore shows!dir / !dir/*-> leads to dir being included in index).MfG
Silas
Reproduction
Repro 1 — .gitignore skipped when indexing a non-root subfolder
Repro 2 — .cbmignore is additive; ! can't override .gitignore (on a valid repo root)
Logs
Project scale (if relevant)
No response
Confirmations