feat: discover local repos and reconnect OpenCode sessions#158
Open
itz4blitz wants to merge 3 commits intochriswritescode-dev:mainfrom
Open
feat: discover local repos and reconnect OpenCode sessions#158itz4blitz wants to merge 3 commits intochriswritescode-dev:mainfrom
itz4blitz wants to merge 3 commits intochriswritescode-dev:mainfrom
Conversation
Replace one-by-one local repo setup with parent-folder discovery and path-aware repo linking so first-time installs can recover existing OpenCode chats. Add first-run import support and onboarding docs for standalone OpenCode users, including Docker path-matching guidance.
There was a problem hiding this comment.
Pull request overview
This PR improves onboarding by adding folder-based Git repository discovery, linking existing local repos in place via a persisted sourcePath, and importing standalone OpenCode config/state on first startup so existing sessions reconnect when paths match.
Changes:
- Add backend discovery + linking flow (symlink-based workspace aliases) and persist
sourcePathin the repo model/DB. - Update frontend repo naming/UI and add “Folder Discovery” to the add-repo dialog.
- Document the new onboarding flow (including Docker path-matching and host state import).
Reviewed changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| shared/src/types/index.ts | Exposes new discover request/response types. |
| shared/src/schemas/repo.ts | Adds sourcePath to repo schema + discover request/response schemas. |
| frontend/src/pages/SessionDetail.tsx | Displays repo names using sourcePath when available. |
| frontend/src/pages/RepoDetail.tsx | Uses updated display-name helper including sourcePath. |
| frontend/src/pages/Memories.tsx | Uses updated display-name helper including sourcePath. |
| frontend/src/lib/utils.ts | Extends repo display-name helper to prefer sourcePath. |
| frontend/src/components/repo/RepoList.tsx | Dedup/search now considers sourcePath. |
| frontend/src/components/repo/RepoCard.tsx | Card label now prefers sourcePath when no URL. |
| frontend/src/components/repo/AddRepoDialog.tsx | Adds “Folder Discovery” mode and toasts for discovery results. |
| frontend/src/api/types.ts | Updates frontend repo shape for optional repoUrl/sourcePath. |
| frontend/src/api/repos.ts | Adds discoverRepos API call. |
| docs/index.md | Updates feature bullets to mention discovery/reconnect. |
| docs/images/session-discovery/03-imported-opencode-sessions.png | Adds screenshot for imported-session discovery. |
| docs/getting-started/quickstart.md | Updates onboarding steps (clone vs folder discovery). |
| docs/features/git.md | Documents folder discovery feature. |
| docs/configuration/docker.md | Documents Docker bind-mount path matching + state import env vars. |
| backend/test/services/repo.test.ts | Adds tests for symlink-based local linking + discovery. |
| backend/test/db/queries.test.ts | Updates tests for source_path + is_local insert behavior. |
| backend/src/types/repo.ts | Extends create input with optional sourcePath. |
| backend/src/services/repo.ts | Implements local repo linking (sourcePath), discovery walk, and uses fullPath for git ops. |
| backend/src/services/notification.ts | Resolves repo by sourcePath when directory is outside workspace. |
| backend/src/routes/repos.ts | Adds /repos/discover endpoint. |
| backend/src/index.ts | Adds first-run import of OpenCode config/state (incl. DB snapshot). |
| backend/src/db/queries.ts | Persists source_path and computes fullPath accordingly. |
| backend/src/db/migrations/index.ts | Registers new migration for repo source_path. |
| backend/src/db/migrations/009-repo-source-path.ts | Adds source_path column + index. |
| .env.example | Documents optional OpenCode import env vars and Docker mount helpers. |
You can also share your feedback on Copilot code review. Take the survey.
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.
Summary
sourcePath, allowing imported repos to reconnect to existing OpenCode chats instead of recloning or copying themWhy
OpenCode Manager already works well once repositories are manually mapped, but first-time setup is still too manual for people who already live in OpenCode.
If someone already has a repo folder like
~/Developmentand already has OpenCode chats for those projects, onboarding should feel automatic: add one folder, discover repos, and immediately see the existing sessions for matching paths.Walkthrough
1. Add one folder instead of one repo at a time
The add-repository dialog now includes Folder Discovery, which scans a parent folder for nested git repositories and registers them in one step.
2. Existing local repos are linked in place
Discovered repositories keep their original source path and are linked into the workspace instead of being copied, so OpenCode Manager can work against the real repo location.
3. Existing OpenCode chats reconnect on first install
When OpenCode state already exists, a fresh install can import that state and show prior chats as soon as the discovered repo path matches the original OpenCode path.
What Is Included
sourcePathValidation
pnpm testpnpm lintpnpm build/Users/blitz/Developmentdiscovered reposNotes
Type Of Change
Checklist
pnpm testpassespnpm lintpassespnpm buildpasses