MCPcopy Create free account
hub / github.com/arctic-cli/interface / resolveProjectIDsForCwd

Function resolveProjectIDsForCwd

packages/arctic/src/cli/recent-sessions.ts:63–83  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

61}
62
63function resolveProjectIDsForCwd(cwd: string): string[] {
64 const normalizedCwd = path.resolve(cwd)
65 let files: string[]
66 try {
67 files = fs.readdirSync(PROJECT_ROOT)
68 } catch {
69 return []
70 }
71
72 const matches: string[] = []
73 for (const file of files) {
74 if (!file.endsWith(".json")) continue
75 const project = readJson<StoredProjectRecord>(path.join(PROJECT_ROOT, file))
76 if (!project?.worktree) continue
77 const normalizedWorktree = path.resolve(project.worktree)
78 if (pathsOverlap(normalizedWorktree, normalizedCwd)) {
79 matches.push(project.id ?? file.replace(/\.json$/, ""))
80 }
81 }
82 return matches
83}
84
85function listAllProjectIDs(): string[] {
86 try {

Callers 1

loadRecentSessionsFunction · 0.85

Calls 3

readJsonFunction · 0.85
pathsOverlapFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected