Skip to content

Commit 6efad2b

Browse files
committed
refactor: update note handling in MCPAdapter to use note category
1 parent 2ef2405 commit 6efad2b

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

packages/ai/src/__tests__/parsers/copilot.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('CopilotParser Integration Tests', () => {
7676
});
7777

7878
describe('getWorkspaces', () => {
79-
it.skipIf(!hasVSCodeData)('should return workspaces for valid application', async () => {
79+
it.runIf(() => hasVSCodeData)('should return workspaces for valid application', async () => {
8080
const applications = await parser.getApplications();
8181

8282
if (applications.length === 0) {
@@ -115,7 +115,7 @@ describe('CopilotParser Integration Tests', () => {
115115
});
116116

117117
describe('getChatSessions', () => {
118-
it.skipIf(!hasVSCodeData)('should return chat sessions for valid workspace', async () => {
118+
it.runIf(() => hasVSCodeData)('should return chat sessions for valid workspace', async () => {
119119
const applications = await parser.getApplications();
120120

121121
if (applications.length === 0) {
@@ -168,7 +168,7 @@ describe('CopilotParser Integration Tests', () => {
168168
});
169169

170170
describe('parseChatSession', () => {
171-
it.skipIf(!hasVSCodeData)('should parse individual chat session correctly', async () => {
171+
it.runIf(() => hasVSCodeData)('should parse individual chat session correctly', async () => {
172172
const applications = await parser.getApplications();
173173

174174
if (applications.length === 0) {
@@ -248,7 +248,7 @@ describe('CopilotParser Integration Tests', () => {
248248
});
249249

250250
describe('Chat message extraction', () => {
251-
it.skipIf(!hasVSCodeData)('should extract messages with correct structure', async () => {
251+
it.runIf(() => hasVSCodeData)('should extract messages with correct structure', async () => {
252252
const applications = await parser.getApplications();
253253

254254
if (applications.length === 0) {
@@ -353,7 +353,7 @@ describe('CopilotParser Integration Tests', () => {
353353
});
354354

355355
describe('Performance and scalability', () => {
356-
it.skipIf(!hasVSCodeData)('should handle large numbers of sessions efficiently', async () => {
356+
it.runIf(() => hasVSCodeData)('should handle large numbers of sessions efficiently', async () => {
357357
const startTime = Date.now();
358358

359359
const applications = await parser.getApplications();
@@ -391,7 +391,7 @@ describe('CopilotParser Integration Tests', () => {
391391
});
392392

393393
describe('Data integrity and consistency', () => {
394-
it.skipIf(!hasVSCodeData)('should maintain consistent data relationships', async () => {
394+
it.runIf(() => hasVSCodeData)('should maintain consistent data relationships', async () => {
395395
const applications = await parser.getApplications();
396396

397397
if (applications.length === 0) {
@@ -421,7 +421,7 @@ describe('CopilotParser Integration Tests', () => {
421421
}
422422
});
423423

424-
it.skipIf(!hasVSCodeData)('should have consistent timestamps', async () => {
424+
it.runIf(() => hasVSCodeData)('should have consistent timestamps', async () => {
425425
const applications = await parser.getApplications();
426426

427427
if (applications.length === 0) {

packages/ai/src/parsers/copilot.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export class CopilotParser extends BaseParser {
5151
const workspaceCount = Object.keys(workspaceMapping).length;
5252

5353
if (workspaceCount > 0) {
54-
console.log(chalk.green(`✓ Found VS Code ${appName} with ${workspaceCount} workspaces`));
5554
applications.push({
5655
id: appId,
5756
name: appName,
@@ -62,10 +61,15 @@ export class CopilotParser extends BaseParser {
6261
});
6362
}
6463
} catch (error) {
65-
console.warn(`VS Code path not found: ${basePath}`);
64+
// Skip inaccessible paths silently
6665
}
6766
}
6867

68+
if (applications.length > 0) {
69+
const totalWorkspaces = applications.reduce((sum, app) => sum + (app.workspaceCount || 0), 0);
70+
console.log(chalk.green(`✓ Found ${applications.length} VS Code installation(s) with ${totalWorkspaces} total workspaces`));
71+
}
72+
6973
return applications;
7074
}
7175

@@ -115,7 +119,7 @@ export class CopilotParser extends BaseParser {
115119
}
116120
}
117121
} catch (error) {
118-
console.error(chalk.red(`Failed to get workspaces for application ${applicationId}:`), error);
122+
// Return empty array on error
119123
}
120124

121125
return workspaces;
@@ -140,7 +144,6 @@ export class CopilotParser extends BaseParser {
140144
for (const sessionFile of sessionFiles) {
141145
const sessionId = sessionFile.split('/').pop()?.replace('.json', '');
142146
if (!sessionId) {
143-
console.warn(chalk.yellow(`Session file without ID found: ${sessionFile}`));
144147
continue;
145148
}
146149
const session = await this.parseChatSession(applicationId, workspaceId, sessionId);
@@ -165,7 +168,6 @@ export class CopilotParser extends BaseParser {
165168
): Promise<ChatSession | null> {
166169
const targetBasePath = this.getTargetBasePath(applicationId);
167170
if (!targetBasePath) {
168-
console.error(chalk.red(`Application not found: ${applicationId}`));
169171
return null;
170172
}
171173
const filePath = resolve(
@@ -223,7 +225,6 @@ export class CopilotParser extends BaseParser {
223225
turns: this.extractChatTurns(sessionId, sessionData),
224226
};
225227

226-
console.info(chalk.blue(`✓ Parsed chat session ${actualSessionId} with ${(sessionData.requests || []).length} turns`));
227228
return session;
228229
} catch (error) {
229230
console.error(chalk.red(`Error parsing chat session ${sessionId}:`), error instanceof Error ? error.message : String(error));
@@ -278,7 +279,7 @@ export class CopilotParser extends BaseParser {
278279
stat(basePath);
279280
return basePath;
280281
} catch (error) {
281-
console.warn(chalk.yellow(`VS Code path not found: ${basePath}`));
282+
// Path not accessible, continue
282283
}
283284
}
284285
}

packages/mcp/src/adapters/mcp-adapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class MCPAdapter {
198198
// Handle update with optional note
199199
if (args.note) {
200200
// Then add the note
201-
await this.apiClient.addDevlogNote(args.id, args.note.content, 'progress');
201+
await this.apiClient.addDevlogNote(args.id, args.note.content, args.note.category);
202202

203203
return this.toStandardResponse(true, { id: args.id }, `Updated entry ${args.id} with note`);
204204
} else {

0 commit comments

Comments
 (0)