MCPcopy Create free account
hub / github.com/Eversmile12/sharedcontext / discoverClaudeCodeFiles

Function discoverClaudeCodeFiles

src/core/watcher.ts:85–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83}
84
85function discoverClaudeCodeFiles(): ConversationFileRef[] {
86 const results: ConversationFileRef[] = [];
87 const claudeDir = join(homedir(), ".claude", "projects");
88
89 if (!existsSync(claudeDir)) return results;
90
91 try {
92 for (const projectDir of readdirSync(claudeDir)) {
93 const fullProjectDir = join(claudeDir, projectDir);
94 const stat = statSync(fullProjectDir);
95 if (!stat.isDirectory()) continue;
96
97 const project = projectDir.split("-").pop() ?? projectDir;
98
99 for (const file of readdirSync(fullProjectDir)) {
100 if (!file.endsWith(".jsonl")) continue;
101 const filePath = join(fullProjectDir, file);
102 const fileStat = statSync(filePath);
103 if (fileStat.size === 0) continue;
104
105 results.push({
106 path: filePath,
107 client: "claude-code",
108 format: "jsonl",
109 project,
110 fileId: file.replace(".jsonl", ""),
111 });
112 }
113 }
114 } catch {
115 // Directory access error — skip
116 }
117
118 return results;
119}
120
121/**
122 * ConversationWatcher polls known Cursor and Claude Code directories

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected