feat: per-project disable/exclude functionality#1321
feat: per-project disable/exclude functionality#1321StevenLi-phoenix wants to merge 5 commits intothedotmack:mainfrom
Conversation
- Added `isProjectExcluded` and `isProjectLocallyDisabled` checks to context, observation, session initialization, and summarization handlers to skip processing for excluded or locally disabled projects. - Introduced utility functions for managing project exclusion in `repo-exclude-utils.ts`. - Updated tests to cover new functionality for project exclusion and local disable checks.
- Updated `project-filter.ts` to include `realpathSync` for resolving symlinks in project paths, ensuring accurate path handling on systems like macOS. - Enhanced `isProjectExcluded` function to support exclusion patterns that match subdirectories, improving project exclusion logic. - Added comments for clarity on new functionality and path normalization processes.
# Conflicts: # plugin/scripts/mcp-server.cjs # plugin/scripts/worker-service.cjs # plugin/ui/viewer-bundle.js
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffa845a0fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| case 'disable': { | ||
| const repoPath = process.argv[3] || process.cwd(); |
There was a problem hiding this comment.
Normalize repo path before persisting disable entry
The command stores process.argv[3] verbatim, so claude-mem disable . (or any relative path) writes a context-dependent pattern. Later, isProjectExcluded() resolves non-glob patterns relative to each hook process cwd, which can make the same saved entry match different projects and also makes enable unreliable unless invoked from the same directory. Persisting an absolute normalized path avoids these false exclusions.
Useful? React with 👍 / 👎.
Summary
Closes #1320
.claude-mem-disabletouch file for instant per-repo disable (no settings needed)CLAUDE_MEM_EXCLUDED_PROJECTSsettings-based exclusion with glob pattern supportdisable/enableCLI commands to manage exclusion list/tmp→/private/tmp)/fooalso excludes/foo/bar)Changed Files
src/utils/project-filter.ts—isProjectExcludedenhanced with symlink resolution + subdirectory matching, newisProjectLocallyDisabledsrc/utils/repo-exclude-utils.ts— new utility foraddToExcluded/removeFromExcludedsrc/cli/handlers/context.ts— early exit for excluded/disabled projectssrc/cli/handlers/observation.ts— early exit for locally disabled projectssrc/cli/handlers/session-init.ts— early exit for locally disabled projectssrc/cli/handlers/summarize.ts— early exit for excluded/disabled projectssrc/services/worker-service.ts—disable/enableCLI commandsTest plan
touch .claude-mem-disablein a repo → verify all hooks skip processingrm .claude-mem-disable→ verify hooks resumedisable /path/to/repo→ verify added to settingsenable /path/to/repo→ verify removed from settings/tmp/test-repo)