MCPcopy Create free account
hub / github.com/microsoft/AI-Engineering-Coach / processWorkspaceEntry

Function processWorkspaceEntry

src/core/parser-vscode.ts:238–302  ·  view source on GitHub ↗
(
  logsDir: string,
  wsId: string,
  harness: string,
  ctx: ParseContext,
)

Source from the content-addressed store, hash-verified

236}
237
238export function processWorkspaceEntry(
239 logsDir: string,
240 wsId: string,
241 harness: string,
242 ctx: ParseContext,
243): string {
244 const { workspaces, sessions, editLocIndex, sessionSourceIndex } = ctx;
245 const startIdx = sessions.length;
246 const { entryPath, wsName, isCLI, customInstructionsBytes } = initializeWorkspaceEntry(logsDir, wsId, harness, workspaces);
247
248 if (isCLI) {
249 const eventsFile = path.join(entryPath, 'events.jsonl');
250 const cliSession = parseCLIEventsFile(eventsFile, wsId, wsName, customInstructionsBytes);
251 if (cliSession) {
252 sessions.push(cliSession);
253 sessionSourceIndex.set(cliSession.sessionId, {
254 kind: 'cli-events',
255 filePath: eventsFile,
256 workspaceId: wsId,
257 workspaceName: wsName,
258 harness,
259 });
260 }
261 stripSessionsFrom(sessions, startIdx);
262 return wsName;
263 }
264
265 const chatDir = path.join(entryPath, 'chatSessions');
266 for (const sessionFile of listChatSessionFiles(chatDir)) {
267 const session = parseSessionFile(sessionFile, wsId, wsName, harness, customInstructionsBytes);
268 if (session) {
269 sessions.push(session);
270 sessionSourceIndex.set(session.sessionId, {
271 kind: 'vscode-session-file',
272 filePath: sessionFile,
273 workspaceId: wsId,
274 workspaceName: wsName,
275 harness,
276 });
277 }
278 }
279
280 const eventsFile = path.join(entryPath, 'events.jsonl');
281 const cliSession = parseCLIEventsFile(eventsFile, wsId, wsName, customInstructionsBytes);
282 if (cliSession) {
283 sessions.push(cliSession);
284 sessionSourceIndex.set(cliSession.sessionId, {
285 kind: 'cli-events',
286 filePath: eventsFile,
287 workspaceId: wsId,
288 workspaceName: wsName,
289 harness,
290 });
291 }
292
293 const esDir = path.join(entryPath, 'chatEditingSessions');
294 for (const stateFile of listEditStateFiles(esDir)) {
295 parseEditStateFile(stateFile, editLocIndex);

Callers 1

parseAllLogsFunction · 0.90

Calls 7

parseCLIEventsFileFunction · 0.90
initializeWorkspaceEntryFunction · 0.85
stripSessionsFromFunction · 0.85
listChatSessionFilesFunction · 0.85
parseSessionFileFunction · 0.85
listEditStateFilesFunction · 0.85
parseEditStateFileFunction · 0.85

Tested by

no test coverage detected