Skip to content

feat: add PROJECTS_EXCLUDED_PATHS to hide unwanted projects from /projects - #197

Open
Johell1NS wants to merge 2 commits into
grinev:mainfrom
Johell1NS:feat/projects-excluded-paths
Open

feat: add PROJECTS_EXCLUDED_PATHS to hide unwanted projects from /projects#197
Johell1NS wants to merge 2 commits into
grinev:mainfrom
Johell1NS:feat/projects-excluded-paths

Conversation

@Johell1NS

Copy link
Copy Markdown

Motivation

The /projects command 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 /projects slower and noisy.

Change

Adds an optional PROJECTS_EXCLUDED_PATHS env var (comma-separated absolute paths, same format as OPEN_BROWSER_ROOTS). Any project whose worktree matches one of these paths is filtered out of the /projects list.

PROJECTS_EXCLUDED_PATHS=/home/me/.config/opencode/skills,/home/me/backup

The 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 — parse PROJECTS_EXCLUDED_PATHS into config.bot.excludedProjectPaths
  • src/app/services/project-service.ts — filter resolved projects
  • .env.example — document the new variable
  • tests/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 build all pass (1224 tests).

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