@perfonext/render-mcp 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -81
- package/dist/index.js +1 -1
- package/dist/ingest/server.d.ts +1 -0
- package/dist/ingest/server.d.ts.map +1 -1
- package/dist/ingest/server.js +15 -12
- package/dist/ingest/server.js.map +1 -1
- package/dist/parser/analysis.d.ts +4 -0
- package/dist/parser/analysis.d.ts.map +1 -1
- package/dist/parser/analysis.js +120 -54
- package/dist/parser/analysis.js.map +1 -1
- package/dist/parser/react-profile.d.ts.map +1 -1
- package/dist/parser/react-profile.js +2 -3
- package/dist/parser/react-profile.js.map +1 -1
- package/dist/parser/react-scan-lite.d.ts.map +1 -1
- package/dist/parser/react-scan-lite.js +72 -2
- package/dist/parser/react-scan-lite.js.map +1 -1
- package/dist/parser/types.d.ts +23 -0
- package/dist/parser/types.d.ts.map +1 -1
- package/dist/store.js +1 -1
- package/dist/store.js.map +1 -1
- package/dist/tools/begin-render-analysis.d.ts.map +1 -1
- package/dist/tools/begin-render-analysis.js +1 -1
- package/dist/tools/begin-render-analysis.js.map +1 -1
- package/dist/tools/compare-renders.d.ts.map +1 -1
- package/dist/tools/compare-renders.js +16 -4
- package/dist/tools/compare-renders.js.map +1 -1
- package/dist/tools/get-captured-renders.d.ts.map +1 -1
- package/dist/tools/get-captured-renders.js +8 -2
- package/dist/tools/get-captured-renders.js.map +1 -1
- package/dist/tools/get-hot-commits.d.ts.map +1 -1
- package/dist/tools/get-hot-commits.js +24 -7
- package/dist/tools/get-hot-commits.js.map +1 -1
- package/dist/tools/get-render-summary.d.ts.map +1 -1
- package/dist/tools/get-render-summary.js +23 -10
- package/dist/tools/get-render-summary.js.map +1 -1
- package/dist/tools/get-rerender-causes.d.ts.map +1 -1
- package/dist/tools/get-rerender-causes.js +25 -18
- package/dist/tools/get-rerender-causes.js.map +1 -1
- package/dist/tools/get-slow-components.d.ts.map +1 -1
- package/dist/tools/get-slow-components.js +20 -5
- package/dist/tools/get-slow-components.js.map +1 -1
- package/dist/tools/load-render-profile.d.ts.map +1 -1
- package/dist/tools/load-render-profile.js +7 -3
- package/dist/tools/load-render-profile.js.map +1 -1
- package/dist/tools/run-render-capture.d.ts.map +1 -1
- package/dist/tools/run-render-capture.js +11 -5
- package/dist/tools/run-render-capture.js.map +1 -1
- package/dist/tools/stop-render-capture.d.ts.map +1 -1
- package/dist/tools/stop-render-capture.js +22 -4
- package/dist/tools/stop-render-capture.js.map +1 -1
- package/package.json +17 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-rerender-causes.js","sourceRoot":"","sources":["../../src/tools/get-rerender-causes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"get-rerender-causes.js","sourceRoot":"","sources":["../../src/tools/get-rerender-causes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,4HAA4H;QAC9H,WAAW,EAAE;YACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,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AW;wBACjB,kBAAkB,EAAE;4BAClB,OAAO,EACL,qIAAqI;4BACvI,UAAU,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE;yBACpE;wBACD,MAAM;qBACP,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-slow-components.d.ts","sourceRoot":"","sources":["../../src/tools/get-slow-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"get-slow-components.d.ts","sourceRoot":"","sources":["../../src/tools/get-slow-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA8DjE"}
|
|
@@ -8,9 +8,22 @@ export function registerGetSlowComponents(server) {
|
|
|
8
8
|
description: 'Return the slowest components in a loaded Next.js render profile, ranked by total actual render time.',
|
|
9
9
|
inputSchema: {
|
|
10
10
|
profileId: z.string().describe('Profile ID from load_render_profile'),
|
|
11
|
-
limit: z
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
limit: z
|
|
12
|
+
.number()
|
|
13
|
+
.int()
|
|
14
|
+
.positive()
|
|
15
|
+
.max(25)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe('How many components to return. Defaults to 10.'),
|
|
18
|
+
sortBy: z
|
|
19
|
+
.enum(['total', 'average', 'max'])
|
|
20
|
+
.optional()
|
|
21
|
+
.describe('Sort metric: "total" = total render time (default), "average" = average per render, "max" = peak single render time.'),
|
|
22
|
+
minDuration: z
|
|
23
|
+
.number()
|
|
24
|
+
.nonnegative()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Minimum total actual duration in ms to include. Filters sub-millisecond noise. Defaults to 0.'),
|
|
14
27
|
},
|
|
15
28
|
}, async ({ profileId, limit, sortBy, minDuration }) => {
|
|
16
29
|
const profile = getRenderProfile(profileId);
|
|
@@ -25,10 +38,12 @@ export function registerGetSlowComponents(server) {
|
|
|
25
38
|
maxActualDuration: formatMs(component.maxActualDuration),
|
|
26
39
|
}));
|
|
27
40
|
return {
|
|
28
|
-
content: [
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
29
43
|
type: 'text',
|
|
30
44
|
text: JSON.stringify({ profileId, slowComponents }, null, 2),
|
|
31
|
-
}
|
|
45
|
+
},
|
|
46
|
+
],
|
|
32
47
|
};
|
|
33
48
|
});
|
|
34
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-slow-components.js","sourceRoot":"","sources":["../../src/tools/get-slow-components.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"get-slow-components.js","sourceRoot":"","sources":["../../src/tools/get-slow-components.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,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SAAS,CAAC,iBAAiB,CAAC;SACzD,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBAC7D;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-render-profile.d.ts","sourceRoot":"","sources":["../../src/tools/load-render-profile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"load-render-profile.d.ts","sourceRoot":"","sources":["../../src/tools/load-render-profile.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0CjE"}
|
|
@@ -11,7 +11,9 @@ export function registerLoadRenderProfile(server) {
|
|
|
11
11
|
'This is the entry point for the manual profiling path: open React DevTools in the browser → Profiler tab → Record → interact → Stop → Export JSON → share the file path here. ' +
|
|
12
12
|
'Returns a profileId for use with get_render_summary, get_slow_components, get_rerender_causes, and the other analysis tools.',
|
|
13
13
|
inputSchema: {
|
|
14
|
-
filePath: z
|
|
14
|
+
filePath: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe('Absolute or relative path to the exported React Profiler JSON file'),
|
|
15
17
|
},
|
|
16
18
|
}, async ({ filePath }) => {
|
|
17
19
|
const absPath = resolve(filePath);
|
|
@@ -19,7 +21,8 @@ export function registerLoadRenderProfile(server) {
|
|
|
19
21
|
const profile = parseRenderProfile(content, absPath);
|
|
20
22
|
storeRenderProfile(profile);
|
|
21
23
|
return {
|
|
22
|
-
content: [
|
|
24
|
+
content: [
|
|
25
|
+
{
|
|
23
26
|
type: 'text',
|
|
24
27
|
text: JSON.stringify({
|
|
25
28
|
profileId: profile.id,
|
|
@@ -29,7 +32,8 @@ export function registerLoadRenderProfile(server) {
|
|
|
29
32
|
componentCount: profile.components.length,
|
|
30
33
|
totalCommitDuration: formatMs(profile.totalCommitDuration),
|
|
31
34
|
}, null, 2),
|
|
32
|
-
}
|
|
35
|
+
},
|
|
36
|
+
],
|
|
33
37
|
};
|
|
34
38
|
});
|
|
35
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-render-profile.js","sourceRoot":"","sources":["../../src/tools/load-render-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"load-render-profile.js","sourceRoot":"","sources":["../../src/tools/load-render-profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,UAAU,yBA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
1
|
+
{"version":3,"file":"run-render-capture.d.ts","sourceRoot":"","sources":["../../src/tools/run-render-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA0EhE"}
|
|
@@ -18,10 +18,14 @@ export function registerRunRenderCapture(server) {
|
|
|
18
18
|
const session = getCaptureSession(sessionId);
|
|
19
19
|
if (!session || session.status !== 'active') {
|
|
20
20
|
return {
|
|
21
|
-
content: [
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
22
23
|
type: 'text',
|
|
23
|
-
text: JSON.stringify({
|
|
24
|
-
|
|
24
|
+
text: JSON.stringify({
|
|
25
|
+
error: `No active session for sessionId "${sessionId}". Call begin_render_analysis first.`,
|
|
26
|
+
}, null, 2),
|
|
27
|
+
},
|
|
28
|
+
],
|
|
25
29
|
isError: true,
|
|
26
30
|
};
|
|
27
31
|
}
|
|
@@ -46,8 +50,10 @@ export function registerRunRenderCapture(server) {
|
|
|
46
50
|
sessionId,
|
|
47
51
|
instructions: [
|
|
48
52
|
'1. Start the dev server if not already running (e.g. `npm run dev`).',
|
|
49
|
-
'2.
|
|
50
|
-
'3.
|
|
53
|
+
'2. Inspect the project to find available Playwright test files. Pick one relevant to what you want to profile.',
|
|
54
|
+
'3. Run the test suite with the --headed flag:',
|
|
55
|
+
' npx playwright test <test-file> --headed',
|
|
56
|
+
'4. When the test run finishes, call stop_render_capture to end the session.',
|
|
51
57
|
].join('\n'),
|
|
52
58
|
nextStep: `stop_render_capture({ sessionId: "${sessionId}" })`,
|
|
53
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-render-capture.js","sourceRoot":"","sources":["../../src/tools/run-render-capture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"run-render-capture.js","sourceRoot":"","sources":["../../src/tools/run-render-capture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,oBAAoB;QAC3B,WAAW,EACT,iFAAiF;YACjF,4EAA4E;YAC5E,oFAAoF;YACpF,sFAAsF;QACxF,WAAW,EAAE;YACX,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;YAClF,MAAM,EAAE,CAAC;iBACN,IAAI,CAAC,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;iBAC1C,QAAQ,CACP,yEAAyE;gBACvE,6GAA6G,CAChH;SACJ;KACF,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC5C,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;4BACE,KAAK,EAAE,oCAAoC,SAAS,sCAAsC;yBAC3F,EACD,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,IAAI,MAAM,KAAK,oBAAoB,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG;gBACb,MAAM;gBACN,SAAS;gBACT,YAAY,EAAE;oBACZ,+CAA+C;oBAC/C,wFAAwF;oBACxF,4DAA4D;iBAC7D,CAAC,IAAI,CAAC,IAAI,CAAC;gBACZ,QAAQ,EAAE,qCAAqC,SAAS,MAAM;aAC/D,CAAC;YACF,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC5E,CAAC;QACJ,CAAC;QAED,aAAa;QACb,MAAM,MAAM,GAAG;YACb,MAAM;YACN,SAAS;YACT,YAAY,EAAE;gBACZ,sEAAsE;gBACtE,gHAAgH;gBAChH,+CAA+C;gBAC/C,6CAA6C;gBAC7C,6EAA6E;aAC9E,CAAC,IAAI,CAAC,IAAI,CAAC;YACZ,QAAQ,EAAE,qCAAqC,SAAS,MAAM;SAC/D,CAAC;QACF,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;SAC5E,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop-render-capture.d.ts","sourceRoot":"","sources":["../../src/tools/stop-render-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"stop-render-capture.d.ts","sourceRoot":"","sources":["../../src/tools/stop-render-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAsFjE"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { deleteCaptureSession, getCaptureSession, stopCaptureSession } from '../ingest/server.js';
|
|
3
|
+
import { isAnalyzableComponent } from '../parser/analysis.js';
|
|
3
4
|
import { adaptReactScanEvents } from '../parser/react-scan-lite.js';
|
|
4
5
|
import { storeRenderProfile } from '../store.js';
|
|
5
6
|
import { formatMs } from '../format.js';
|
|
@@ -16,13 +17,23 @@ export function registerStopRenderCapture(server) {
|
|
|
16
17
|
const session = getCaptureSession(sessionId);
|
|
17
18
|
if (!session) {
|
|
18
19
|
return {
|
|
19
|
-
content: [
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
type: 'text',
|
|
23
|
+
text: JSON.stringify({ error: `Session "${sessionId}" not found` }, null, 2),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
20
26
|
isError: true,
|
|
21
27
|
};
|
|
22
28
|
}
|
|
23
29
|
if (session.status === 'stopped') {
|
|
24
30
|
return {
|
|
25
|
-
content: [
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: JSON.stringify({ error: `Session "${sessionId}" is already stopped` }, null, 2),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
26
37
|
isError: true,
|
|
27
38
|
};
|
|
28
39
|
}
|
|
@@ -37,7 +48,12 @@ export function registerStopRenderCapture(server) {
|
|
|
37
48
|
: 'No commits captured. Make sure the instrumentation snippet was loaded ' +
|
|
38
49
|
'and you interacted with the app while the session was active.';
|
|
39
50
|
return {
|
|
40
|
-
content: [
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: 'text',
|
|
54
|
+
text: JSON.stringify({ warning, sessionId, commitCount: 0 }, null, 2),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
41
57
|
};
|
|
42
58
|
}
|
|
43
59
|
const profile = adaptReactScanEvents(session.commits, sessionId);
|
|
@@ -48,9 +64,11 @@ export function registerStopRenderCapture(server) {
|
|
|
48
64
|
profileId: profile.id,
|
|
49
65
|
sessionId,
|
|
50
66
|
commitCount: profile.commits.length,
|
|
51
|
-
componentCount: profile.components.
|
|
67
|
+
componentCount: profile.components.filter((c) => isAnalyzableComponent(c.componentName))
|
|
68
|
+
.length,
|
|
52
69
|
totalCommitDuration: formatMs(profile.totalCommitDuration),
|
|
53
70
|
profilingAvailable: session.profilingAvailable,
|
|
71
|
+
dataQuality: profile.hasChangeDescriptions ? 'exact' : 'heuristic',
|
|
54
72
|
nextStep: `call get_render_summary with profileId "${profile.id}"`,
|
|
55
73
|
};
|
|
56
74
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop-render-capture.js","sourceRoot":"","sources":["../../src/tools/stop-render-capture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"stop-render-capture.js","sourceRoot":"","sources":["../../src/tools/stop-render-capture.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,UAAU,yBAAyB,CAAC,MAAiB;IACzD,MAAM,CAAC,YAAY,CACjB,qBAAqB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profiler exports: render summaries, rerender causes, hot commits, and profile diffing",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,9 +19,13 @@
|
|
|
19
19
|
"node": ">=18"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "tsc && chmod +x dist/index.js",
|
|
22
|
+
"build": "tsc && shx chmod +x dist/index.js",
|
|
23
23
|
"dev": "tsc --watch",
|
|
24
24
|
"test": "vitest run",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"lint:fix": "eslint . --fix",
|
|
27
|
+
"format": "prettier --write .",
|
|
28
|
+
"format:check": "prettier --check .",
|
|
25
29
|
"inspector": "npx @modelcontextprotocol/inspector node dist/index.js",
|
|
26
30
|
"prepublishOnly": "npm run build"
|
|
27
31
|
},
|
|
@@ -37,20 +41,28 @@
|
|
|
37
41
|
],
|
|
38
42
|
"repository": {
|
|
39
43
|
"type": "git",
|
|
40
|
-
"url": "git+https://github.com/
|
|
44
|
+
"url": "git+https://github.com/souvikdu/perfonext-render-mcp.git"
|
|
41
45
|
},
|
|
42
46
|
"bugs": {
|
|
43
|
-
"url": "https://github.com/
|
|
47
|
+
"url": "https://github.com/souvikdu/perfonext-render-mcp/issues"
|
|
44
48
|
},
|
|
45
|
-
"homepage": "https://github.com/
|
|
49
|
+
"homepage": "https://github.com/souvikdu/perfonext-render-mcp#readme",
|
|
46
50
|
"license": "MIT",
|
|
47
51
|
"dependencies": {
|
|
48
52
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
53
|
+
"@perfonext/build-mcp": "file:../perfonext-build-mcp",
|
|
49
54
|
"zod": "^4.4.1"
|
|
50
55
|
},
|
|
51
56
|
"devDependencies": {
|
|
57
|
+
"@eslint/js": "^9.17.0",
|
|
52
58
|
"@types/node": "^25.6.0",
|
|
59
|
+
"eslint": "^9.17.0",
|
|
60
|
+
"eslint-config-prettier": "^10.0.1",
|
|
61
|
+
"globals": "^15.14.0",
|
|
62
|
+
"prettier": "^3.4.2",
|
|
63
|
+
"shx": "^0.4.0",
|
|
53
64
|
"typescript": "^6.0.3",
|
|
65
|
+
"typescript-eslint": "^8.18.2",
|
|
54
66
|
"vitest": "^3.2.4"
|
|
55
67
|
}
|
|
56
68
|
}
|