-
Notifications
You must be signed in to change notification settings - Fork 0
Harden runtime packaging and clean up onboarding #232
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5b26e0e
fix: harden runtime packaging and onboarding setup
zvadaadam 3147bdc
fix: remove manifesto from onboarding welcome step
zvadaadam 4bae581
fix: tighten onboarding and runtime edge cases
zvadaadam 681cc6f
fix: harden recent project parsing and desktop restarts
zvadaadam 58aceda
fix: bound recent project discovery probes
zvadaadam 67d6542
fix: report invalid Claude workspace paths
zvadaadam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,101 +1,10 @@ | ||
| import { Hono } from "hono"; | ||
| import Database from "better-sqlite3"; | ||
| import { existsSync, readdirSync } from "fs"; | ||
| import { homedir } from "os"; | ||
| import { join, basename } from "path"; | ||
| import type { RecentProject } from "@shared/types/onboarding"; | ||
| import { listRecentProjects } from "../services/recent-projects.service"; | ||
|
|
||
| const app = new Hono(); | ||
|
|
||
| app.get("/onboarding/recent-projects", (c) => { | ||
| const home = homedir(); | ||
| const projects: RecentProject[] = []; | ||
| const seenPaths = new Set<string>(); | ||
|
|
||
| // Read from Cursor state.vscdb | ||
| const cursorDbPath = join( | ||
| home, | ||
| "Library/Application Support/Cursor/User/globalStorage/state.vscdb" | ||
| ); | ||
| readVscdbProjects(cursorDbPath, "cursor", projects, seenPaths); | ||
|
|
||
| // Read from VSCode state.vscdb | ||
| const vscodeDbPath = join( | ||
| home, | ||
| "Library/Application Support/Code/User/globalStorage/state.vscdb" | ||
| ); | ||
| readVscdbProjects(vscodeDbPath, "vscode", projects, seenPaths); | ||
|
|
||
| // Read from Claude projects directory | ||
| readClaudeProjects(join(home, ".claude/projects"), projects, seenPaths); | ||
|
|
||
| return c.json({ projects: projects.slice(0, 30) }); | ||
| return c.json({ projects: listRecentProjects() }); | ||
| }); | ||
|
|
||
| // Worktree directories created by AI coding tools — filter these from recent projects | ||
| // so only root repos are shown, not individual worktree checkouts. | ||
| const WORKTREE_SEGMENTS = [ | ||
| "/.deus/", // Deus worktrees | ||
| "/.conductor/", // OpenDevs worktrees | ||
| "/.claude/worktrees/", // Claude Code worktrees | ||
| "/.cursor/worktrees/", // Cursor parallel agent worktrees | ||
| "/copilot-worktree/", // GitHub Copilot CLI worktrees | ||
| ]; | ||
|
|
||
| function isWorktreePath(fsPath: string): boolean { | ||
| return WORKTREE_SEGMENTS.some((seg) => fsPath.includes(seg)); | ||
| } | ||
|
|
||
| function readVscdbProjects( | ||
| dbPath: string, | ||
| source: "cursor" | "vscode", | ||
| projects: RecentProject[], | ||
| seen: Set<string> | ||
| ) { | ||
| if (!existsSync(dbPath)) return; | ||
| let db: InstanceType<typeof Database> | undefined; | ||
| try { | ||
| db = new Database(dbPath, { readonly: true }); | ||
| const row = db | ||
| .prepare("SELECT value FROM ItemTable WHERE key = 'history.recentlyOpenedPathsList'") | ||
| .get() as { value: string } | undefined; | ||
|
|
||
| if (!row?.value) return; | ||
| const data = JSON.parse(row.value); | ||
| const entries = data.entries || []; | ||
|
|
||
| for (const entry of entries) { | ||
| const uri = entry.folderUri; | ||
| if (!uri || !uri.startsWith("file://")) continue; | ||
| const fsPath = decodeURIComponent(uri.replace("file://", "")); | ||
| if (seen.has(fsPath) || isWorktreePath(fsPath) || !existsSync(fsPath)) continue; | ||
| seen.add(fsPath); | ||
| projects.push({ path: fsPath, name: basename(fsPath), source }); | ||
| } | ||
| } catch { | ||
| // Silently skip if DB is locked or malformed | ||
| } finally { | ||
| db?.close(); | ||
| } | ||
| } | ||
|
|
||
| function readClaudeProjects(dir: string, projects: RecentProject[], seen: Set<string>) { | ||
| if (!existsSync(dir)) return; | ||
| try { | ||
| const entries = readdirSync(dir, { withFileTypes: true }); | ||
| for (const entry of entries) { | ||
| if (!entry.isDirectory()) continue; | ||
| // Claude encodes paths: leading dash + dashes as path separators | ||
| // e.g., "-Users-zvada-Developer-myproject" -> "/Users/zvada/Developer/myproject" | ||
| const decoded = entry.name.replace(/-/g, "/"); | ||
| if (!decoded.startsWith("/")) continue; | ||
| if (seen.has(decoded) || isWorktreePath(decoded) || !existsSync(decoded)) continue; | ||
| seen.add(decoded); | ||
| projects.push({ path: decoded, name: basename(decoded), source: "claude" }); | ||
| } | ||
| } catch { | ||
| // Silently skip | ||
| } | ||
| } | ||
|
|
||
| export default app; |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.