Skip to content

Commit ca67847

Browse files
ozgesolidkeyclaude
andcommitted
Add MCP investigation tools and fix native module packaging
Add 5 new MCP tools (triage, investigate-crashes, investigate-component, compare-baseline, investigate-timerange) with corresponding API endpoints. Fix native module packaging by adding asarUnpack for better-sqlite3, node-pty, and serialport so packaged apps load correctly on all platforms. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a4cb774 commit ca67847

File tree

4 files changed

+730
-1
lines changed

4 files changed

+730
-1
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "logan",
3-
"version": "0.2.0",
3+
"version": "0.4.0",
44
"description": "Fast log file viewer and analyzer for large files with pattern detection, search, and bookmarks",
55
"main": "dist/main/index.js",
66
"scripts": {
@@ -63,6 +63,12 @@
6363
"dist/**/*",
6464
"package.json"
6565
],
66+
"asarUnpack": [
67+
"node_modules/better-sqlite3/**",
68+
"node_modules/node-pty/**",
69+
"node_modules/serialport/**",
70+
"node_modules/@serialport/**"
71+
],
6672
"mac": {
6773
"category": "public.app-category.developer-tools",
6874
"icon": "icon.png",

src/main/api-server.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export interface ApiContext {
3131
navigateToLine(lineNumber: number): void;
3232
getBaselineStore(): BaselineStore;
3333
getAnalysisResult(): AnalysisResult | null;
34+
getLinesRaw(startLine: number, count: number): any;
35+
investigateCrashes(options: { contextLines?: number; maxCrashes?: number; autoBookmark?: boolean; autoHighlight?: boolean }): Promise<any>;
36+
investigateComponent(options: { component: string; maxSamplesPerLevel?: number; includeErrorContext?: boolean; contextLines?: number }): Promise<any>;
37+
investigateTimerange(options: { startTime: string; endTime: string; maxSamples?: number }): Promise<any>;
3438
}
3539

3640
let server: http.Server | null = null;
@@ -276,6 +280,40 @@ export function startApiServer(ctx: ApiContext): void {
276280
return;
277281
}
278282

283+
if (url === '/api/investigate-crashes') {
284+
const result = await ctx.investigateCrashes({
285+
contextLines: body.contextLines,
286+
maxCrashes: body.maxCrashes,
287+
autoBookmark: body.autoBookmark,
288+
autoHighlight: body.autoHighlight,
289+
});
290+
sendJson(res, result);
291+
return;
292+
}
293+
294+
if (url === '/api/investigate-component') {
295+
if (!body.component) return sendError(res, 'component required');
296+
const result = await ctx.investigateComponent({
297+
component: body.component,
298+
maxSamplesPerLevel: body.maxSamplesPerLevel,
299+
includeErrorContext: body.includeErrorContext,
300+
contextLines: body.contextLines,
301+
});
302+
sendJson(res, result);
303+
return;
304+
}
305+
306+
if (url === '/api/investigate-timerange') {
307+
if (!body.startTime || !body.endTime) return sendError(res, 'startTime and endTime required');
308+
const result = await ctx.investigateTimerange({
309+
startTime: body.startTime,
310+
endTime: body.endTime,
311+
maxSamples: body.maxSamples,
312+
});
313+
sendJson(res, result);
314+
return;
315+
}
316+
279317
sendError(res, 'Not found', 404);
280318
return;
281319
}

0 commit comments

Comments
 (0)