-
Notifications
You must be signed in to change notification settings - Fork 6.4k
feat(session): filter sessions by current directory #6724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat(session): filter sessions by current directory #6724
Conversation
1e2b5cf to
673ed2b
Compare
673ed2b to
576b348
Compare
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Bumping this with a fresh force-push that now sits on v1.1.16 plus the three session-filtering files. Ran • Packages in scope: @opencode-ai/app, @opencode-ai/console-app, @opencode-ai/console-core, @opencode-ai/console-function, @opencode-ai/console-mail, @opencode-ai/console-resource, @opencode-ai/desktop, @opencode-ai/enterprise, @opencode-ai/function, @opencode-ai/plugin, @opencode-ai/script, @opencode-ai/sdk, @opencode-ai/slack, @opencode-ai/ui, @opencode-ai/util, @opencode-ai/web, opencode Tasks: 12 successful, 12 total installed @opentui/core@0.1.72 [209.00ms] done installed @parcel/watcher@2.5.1 [113.00ms] done |
0af5040 to
e38b10f
Compare
|
Rebased this branch onto the latest (includes commit ), reinstalled dependencies, and reran • Packages in scope: @opencode-ai/app, @opencode-ai/console-app, @opencode-ai/console-core, @opencode-ai/console-function, @opencode-ai/console-mail, @opencode-ai/console-resource, @opencode-ai/desktop, @opencode-ai/enterprise, @opencode-ai/function, @opencode-ai/plugin, @opencode-ai/script, @opencode-ai/sdk, @opencode-ai/slack, @opencode-ai/ui, @opencode-ai/util, @opencode-ai/web, opencode Tasks: 12 successful, 12 total |
Summary
This PR adds directory-based filtering to session listing, so sessions are scoped to the current working directory by default rather than showing all sessions across the entire project.
Problem
Currently, when running
ocin different directories within the same git repository, all sessions from all directories are visible. This creates noise and confusion - for example, runningoc session listin/project/frontendshows sessions created in/project/backend,/project/docs, etc.This is a common workflow issue for developers working on monorepos or projects with multiple subdirectories.
Solution
Session.list()now filters to only return sessions wheresession.directorymatches the current working directory (Instance.directory){ all: true }to get all sessions (previous behavior)--all/-aflag tooc session list?all=truequery parameter to/sessionendpointPrior Art
This behavior aligns with how Codex and Claude Code handle session visibility - they scope sessions to the current working directory rather than globally across the machine or project. This provides better isolation when:
Changes
src/session/index.tsListOptionsinterface, modifiedlist()to filter by directorysrc/cli/cmd/session.ts--allflag tosession listcommandsrc/server/server.ts?all=truequery param supportTesting
oc session listreturns empty when no sessions match current directoryoc session list --allreturns all sessions (previous behavior)--helpshows the new flag correctly