feat: add PROJECTS_EXCLUDED_PATHS to hide unwanted projects from /projects - #197
Open
Johell1NS wants to merge 2 commits into
Open
feat: add PROJECTS_EXCLUDED_PATHS to hide unwanted projects from /projects#197Johell1NS wants to merge 2 commits into
Johell1NS wants to merge 2 commits into
Conversation
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.
Motivation
The
/projectscommand lists every project OpenCode has ever tracked (the whole worktree of every session). When a user works from many paths — including system or home directories — the list gets polluted with projects they never want to switch to. This makes switching projects via/projectsslower and noisy.Change
Adds an optional
PROJECTS_EXCLUDED_PATHSenv var (comma-separated absolute paths, same format asOPEN_BROWSER_ROOTS). Any project whose worktree matches one of these paths is filtered out of the/projectslist.PROJECTS_EXCLUDED_PATHS=/home/me/.config/opencode/skills,/home/me/backupThe filter is applied after the existing linked-worktree hiding, keeps the previous behaviour when the var is unset, and is logged for transparency.
Files changed
src/config.ts— parsePROJECTS_EXCLUDED_PATHSintoconfig.bot.excludedProjectPathssrc/app/services/project-service.ts— filter resolved projects.env.example— document the new variabletests/config.test.ts— cover env parsing (unset, comma-separated, whitespace/empty entries)tests/app/services/project-service.test.ts— cover filtering (unset, single/multiple paths, applied after linked-worktree hiding)Testing
npm run lint && npm test && npm run buildall pass (1224 tests).