@recapt/mcp 0.0.7-beta → 0.0.9-beta
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/dist/api/client.js +3 -1
- package/dist/cli/index.js +0 -0
- package/dist/index.js +34 -35
- package/dist/tools/catalog/toolCatalog.json +397 -382
- package/dist/tools/detectRegressions.js +23 -6
- package/dist/tools/diagnostic.js +4 -1
- package/package.json +1 -2
- package/dist/cli/skill.d.ts +0 -14
- package/dist/cli/skill.js +0 -249
- package/dist/utils/orgContext.d.ts +0 -6
- package/dist/utils/orgContext.js +0 -22
package/dist/api/client.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP client for calling external-api query endpoints.
|
|
3
3
|
*/
|
|
4
|
-
const API_URL = process.env.
|
|
4
|
+
const API_URL = process.env.RECAPT_API_URL ||
|
|
5
|
+
process.env.EXTERNAL_API_URL ||
|
|
6
|
+
"https://api.recapt.app";
|
|
5
7
|
const SECRET_KEY = process.env.RECAPT_SECRET_KEY;
|
|
6
8
|
const REQUEST_TIMEOUT_MS = 120_000;
|
|
7
9
|
export function isApiConfigured() {
|
package/dist/cli/index.js
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
@@ -48,30 +48,20 @@ function createApiHandler(method, endpoint, buildParams) {
|
|
|
48
48
|
}
|
|
49
49
|
const url = typeof endpoint === "function" ? endpoint(args) : endpoint;
|
|
50
50
|
const params = buildParams ? buildParams(args) : args;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
case "PATCH":
|
|
60
|
-
result = await apiPatch(url, params);
|
|
61
|
-
break;
|
|
62
|
-
case "DELETE":
|
|
63
|
-
result = await apiDelete(url);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
if (result.error) {
|
|
51
|
+
const apiCall = {
|
|
52
|
+
GET: () => apiGet(url, params),
|
|
53
|
+
POST: () => apiPost(url, params),
|
|
54
|
+
PATCH: () => apiPatch(url, params),
|
|
55
|
+
DELETE: () => apiDelete(url),
|
|
56
|
+
}[method];
|
|
57
|
+
const { data, error } = await apiCall();
|
|
58
|
+
if (error) {
|
|
67
59
|
return {
|
|
68
|
-
content: [
|
|
69
|
-
{ type: "text", text: JSON.stringify({ error: result.error }) },
|
|
70
|
-
],
|
|
60
|
+
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
71
61
|
isError: true,
|
|
72
62
|
};
|
|
73
63
|
}
|
|
74
|
-
return { content: [{ type: "text", text: JSON.stringify(
|
|
64
|
+
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
75
65
|
};
|
|
76
66
|
}
|
|
77
67
|
function registerHiddenTools() {
|
|
@@ -132,20 +122,12 @@ function registerHiddenTools() {
|
|
|
132
122
|
isError: true,
|
|
133
123
|
};
|
|
134
124
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
144
|
-
}
|
|
145
|
-
const ids = session_ids ?? [session_id];
|
|
146
|
-
const { data, error } = await apiPost("/sessions/details", {
|
|
147
|
-
session_ids: ids,
|
|
148
|
-
});
|
|
125
|
+
const isSingleSession = session_id && !session_ids;
|
|
126
|
+
const { data, error } = isSingleSession
|
|
127
|
+
? await apiGet(`/sessions/${session_id}`)
|
|
128
|
+
: await apiPost("/sessions/details", {
|
|
129
|
+
session_ids: session_ids ?? [session_id],
|
|
130
|
+
});
|
|
149
131
|
if (error) {
|
|
150
132
|
return {
|
|
151
133
|
content: [{ type: "text", text: JSON.stringify({ error }) }],
|
|
@@ -209,10 +191,19 @@ call_tool({ tool_name: "analyze_flow", arguments: { start_page: "/pricing", end_
|
|
|
209
191
|
|
|
210
192
|
These tools are always visible (no search needed):
|
|
211
193
|
- **get_domains** — List tracked domains (good starting point)
|
|
212
|
-
- **run_full_diagnostic** —
|
|
194
|
+
- **run_full_diagnostic** — Quick site health overview (lightweight, fast)
|
|
213
195
|
- **triage_sessions** — Find sessions needing attention
|
|
214
196
|
- **memory_*** — Store/retrieve intermediate results
|
|
215
197
|
|
|
198
|
+
## Comprehensive Site Analysis
|
|
199
|
+
|
|
200
|
+
For a full site analysis, run these tools in sequence:
|
|
201
|
+
1. **run_full_diagnostic** — Get health score, issues, problem pages
|
|
202
|
+
2. **detect_regressions** — Check for recent behavioral regressions (separate call)
|
|
203
|
+
3. **get_ux_health_report** — Detailed per-page breakdown if needed
|
|
204
|
+
|
|
205
|
+
This split approach is faster and more reliable than a single heavy query.
|
|
206
|
+
|
|
216
207
|
## Metric Interpretation
|
|
217
208
|
|
|
218
209
|
All behavioral scores are 0-1 where higher = more of that signal:
|
|
@@ -231,6 +222,14 @@ All behavioral scores are 0-1 where higher = more of that signal:
|
|
|
231
222
|
- High frustration + low confusion = users know what to do but can't (broken UI)
|
|
232
223
|
- Use \`memory_save\` to store intermediate results when doing multi-step analysis
|
|
233
224
|
|
|
225
|
+
## Tool Limits
|
|
226
|
+
|
|
227
|
+
Some tools have built-in limits for performance:
|
|
228
|
+
- **detect_regressions**: Default 50 pages per call, 200 snapshots per page. Use \`offset\` and \`limit\` to paginate. Use \`sort_by='low_traffic'\` to check overlooked pages.
|
|
229
|
+
- **discover_personas**: Max 8 personas
|
|
230
|
+
- **list_pages**: Default 50 pages, configurable
|
|
231
|
+
- **get_session_details**: Max 20 sessions per batch
|
|
232
|
+
|
|
234
233
|
## Installable Skills
|
|
235
234
|
|
|
236
235
|
For guided workflows (self-healing, deep-dive analysis, regression hunting), install recapt skills:
|
|
@@ -6484,400 +6484,415 @@
|
|
|
6484
6484
|
},
|
|
6485
6485
|
{
|
|
6486
6486
|
"name": "detect_regressions",
|
|
6487
|
-
"description": "Detect behavioral regressions by comparing recent data against rolling 7-day baselines. Returns pages where frustration, confusion, or rage click rate have deviated significantly.",
|
|
6487
|
+
"description": "Detect behavioral regressions by comparing recent data against rolling 7-day baselines. By default analyzes top 50 pages by traffic. Use sort_by='low_traffic' to check low-traffic pages that might otherwise be missed. Use offset/limit to paginate through all pages. Returns pages where frustration, confusion, or rage click rate have deviated significantly.",
|
|
6488
6488
|
"category": "monitoring",
|
|
6489
6489
|
"parameters": {
|
|
6490
6490
|
"window_hours": {
|
|
6491
6491
|
"type": "number",
|
|
6492
6492
|
"required": false,
|
|
6493
6493
|
"description": "How many recent hours to compare against baseline (default 24)"
|
|
6494
|
+
},
|
|
6495
|
+
"limit": {
|
|
6496
|
+
"type": "number",
|
|
6497
|
+
"required": false,
|
|
6498
|
+
"description": "Number of pages to check per request (default 50, max 100)"
|
|
6499
|
+
},
|
|
6500
|
+
"offset": {
|
|
6501
|
+
"type": "number",
|
|
6502
|
+
"required": false,
|
|
6503
|
+
"description": "Skip this many pages for pagination (default 0)"
|
|
6504
|
+
},
|
|
6505
|
+
"sort_by": {
|
|
6506
|
+
"type": "string",
|
|
6507
|
+
"required": false,
|
|
6508
|
+
"description": "Sort order: 'traffic' (default, high-traffic first) or 'low_traffic' (check overlooked pages)"
|
|
6494
6509
|
}
|
|
6495
6510
|
},
|
|
6496
6511
|
"embedding": [
|
|
6497
|
-
0.
|
|
6498
|
-
-0.
|
|
6499
|
-
0.
|
|
6500
|
-
0.
|
|
6501
|
-
0.
|
|
6502
|
-
0.
|
|
6503
|
-
-0.
|
|
6504
|
-
-0.
|
|
6505
|
-
-0.
|
|
6506
|
-
|
|
6507
|
-
0.
|
|
6508
|
-
0.
|
|
6509
|
-
0.
|
|
6510
|
-
0.
|
|
6511
|
-
-0.
|
|
6512
|
-
0.
|
|
6513
|
-
0.
|
|
6514
|
-
|
|
6515
|
-
0.
|
|
6516
|
-
-0.
|
|
6517
|
-
-0.
|
|
6518
|
-
0.
|
|
6519
|
-
-0.
|
|
6520
|
-
0.
|
|
6521
|
-
-0.
|
|
6522
|
-
0.
|
|
6523
|
-
-0.
|
|
6524
|
-
-0.
|
|
6525
|
-
|
|
6526
|
-
-0.
|
|
6527
|
-
-0.
|
|
6528
|
-
0.
|
|
6529
|
-
0.
|
|
6530
|
-
0.
|
|
6531
|
-
-0.
|
|
6532
|
-
-0.
|
|
6533
|
-
0.
|
|
6534
|
-
-0.
|
|
6535
|
-
0.
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
-0.
|
|
6539
|
-
0.
|
|
6540
|
-
|
|
6541
|
-
0.
|
|
6542
|
-
-0.
|
|
6543
|
-
-0.
|
|
6544
|
-
0.
|
|
6545
|
-
-0.
|
|
6546
|
-
0.
|
|
6547
|
-
-0.
|
|
6548
|
-
-0.
|
|
6549
|
-
0.
|
|
6550
|
-
-0.
|
|
6551
|
-
-0.
|
|
6552
|
-
-0.
|
|
6553
|
-
0.
|
|
6554
|
-
0.
|
|
6555
|
-
0.
|
|
6556
|
-
0.
|
|
6557
|
-
0.
|
|
6558
|
-
-0.
|
|
6559
|
-
-0.
|
|
6560
|
-
0.
|
|
6561
|
-
-0.
|
|
6562
|
-
0.
|
|
6563
|
-
-0.
|
|
6564
|
-
|
|
6565
|
-
0.
|
|
6566
|
-
0.
|
|
6567
|
-
-0.
|
|
6568
|
-
|
|
6569
|
-
-0.
|
|
6570
|
-
-0.
|
|
6571
|
-
0.
|
|
6572
|
-
-0.
|
|
6573
|
-
|
|
6574
|
-
0.
|
|
6575
|
-
0.
|
|
6576
|
-
-0.
|
|
6577
|
-
-0.
|
|
6578
|
-
0.
|
|
6579
|
-
0.
|
|
6580
|
-
|
|
6581
|
-
0.
|
|
6582
|
-
-0.
|
|
6583
|
-
0.
|
|
6584
|
-
0.
|
|
6585
|
-
-0.
|
|
6586
|
-
0.
|
|
6587
|
-
0.
|
|
6588
|
-
|
|
6589
|
-
-0.
|
|
6590
|
-
0.
|
|
6591
|
-
-0.
|
|
6592
|
-
0.
|
|
6593
|
-
-0.
|
|
6594
|
-
-0.
|
|
6595
|
-
0.
|
|
6596
|
-
0.
|
|
6597
|
-
-0.
|
|
6598
|
-
0.
|
|
6599
|
-
|
|
6600
|
-
0.
|
|
6601
|
-
0.
|
|
6602
|
-
|
|
6603
|
-
0.
|
|
6604
|
-
-0.
|
|
6605
|
-
-0.
|
|
6606
|
-
0.
|
|
6607
|
-
-0.
|
|
6608
|
-
0.
|
|
6609
|
-
0.
|
|
6610
|
-
-0.
|
|
6611
|
-
0.
|
|
6612
|
-
-0.
|
|
6613
|
-
-0.
|
|
6614
|
-
-0.
|
|
6615
|
-
0.
|
|
6616
|
-
0.
|
|
6617
|
-
0.
|
|
6618
|
-
0.
|
|
6619
|
-
0.
|
|
6620
|
-
|
|
6621
|
-
0.
|
|
6622
|
-
0.
|
|
6623
|
-
-0.
|
|
6512
|
+
0.029739,
|
|
6513
|
+
-0.037854,
|
|
6514
|
+
-0.007498,
|
|
6515
|
+
0.050917,
|
|
6516
|
+
0.06084,
|
|
6517
|
+
-0.016029,
|
|
6518
|
+
-0.019992,
|
|
6519
|
+
-0.006213,
|
|
6520
|
+
-0.077974,
|
|
6521
|
+
0.024877,
|
|
6522
|
+
-0.026286,
|
|
6523
|
+
0.046091,
|
|
6524
|
+
0.001876,
|
|
6525
|
+
0.025006,
|
|
6526
|
+
-0.055402,
|
|
6527
|
+
0.024394,
|
|
6528
|
+
-0.00967,
|
|
6529
|
+
0.015183,
|
|
6530
|
+
0.048272,
|
|
6531
|
+
-0.074896,
|
|
6532
|
+
-0.005384,
|
|
6533
|
+
0.062265,
|
|
6534
|
+
-0.00324,
|
|
6535
|
+
0.022973,
|
|
6536
|
+
-0.040664,
|
|
6537
|
+
0.067751,
|
|
6538
|
+
-0.073004,
|
|
6539
|
+
-0.03681,
|
|
6540
|
+
0.002883,
|
|
6541
|
+
-0.022037,
|
|
6542
|
+
-0.004448,
|
|
6543
|
+
0.055557,
|
|
6544
|
+
-0.029818,
|
|
6545
|
+
0.06324,
|
|
6546
|
+
-0.015527,
|
|
6547
|
+
-0.091029,
|
|
6548
|
+
-0.025808,
|
|
6549
|
+
-0.090558,
|
|
6550
|
+
0.0871,
|
|
6551
|
+
0.002504,
|
|
6552
|
+
0.003779,
|
|
6553
|
+
-0.063624,
|
|
6554
|
+
0.006187,
|
|
6555
|
+
0.006841,
|
|
6556
|
+
-0.002103,
|
|
6557
|
+
-0.044959,
|
|
6558
|
+
-0.061788,
|
|
6559
|
+
0.01194,
|
|
6560
|
+
-0.003896,
|
|
6561
|
+
-0.052659,
|
|
6562
|
+
-0.038156,
|
|
6563
|
+
-0.020247,
|
|
6564
|
+
0.052098,
|
|
6565
|
+
-0.035897,
|
|
6566
|
+
-0.035624,
|
|
6567
|
+
-0.064473,
|
|
6568
|
+
0.012612,
|
|
6569
|
+
-0.059332,
|
|
6570
|
+
-0.000848,
|
|
6571
|
+
0.008588,
|
|
6572
|
+
0.004709,
|
|
6573
|
+
-0.043208,
|
|
6574
|
+
-0.010858,
|
|
6575
|
+
0.021742,
|
|
6576
|
+
-0.100977,
|
|
6577
|
+
0.088991,
|
|
6578
|
+
-0.01991,
|
|
6579
|
+
0.043597,
|
|
6580
|
+
0.055709,
|
|
6581
|
+
0.099795,
|
|
6582
|
+
-0.035567,
|
|
6583
|
+
0.023794,
|
|
6584
|
+
-0.040071,
|
|
6585
|
+
-0.013235,
|
|
6586
|
+
0.077832,
|
|
6587
|
+
-0.130459,
|
|
6588
|
+
0.007821,
|
|
6589
|
+
-0.052328,
|
|
6590
|
+
-0.003133,
|
|
6591
|
+
-0.100751,
|
|
6592
|
+
-0.096811,
|
|
6593
|
+
-0.064354,
|
|
6594
|
+
-0.008996,
|
|
6595
|
+
0.022161,
|
|
6596
|
+
0.06765,
|
|
6597
|
+
-0.028383,
|
|
6598
|
+
0.044112,
|
|
6599
|
+
0.021452,
|
|
6600
|
+
-0.078971,
|
|
6601
|
+
0.032096,
|
|
6602
|
+
0.03627,
|
|
6603
|
+
0.011746,
|
|
6604
|
+
-0.027071,
|
|
6605
|
+
0.033822,
|
|
6606
|
+
-0.048214,
|
|
6607
|
+
0.028052,
|
|
6608
|
+
-0.054125,
|
|
6609
|
+
-0.059643,
|
|
6610
|
+
0.035839,
|
|
6611
|
+
0.082955,
|
|
6612
|
+
-0.036822,
|
|
6613
|
+
0.066503,
|
|
6614
|
+
0.01187,
|
|
6615
|
+
0.006232,
|
|
6616
|
+
-0.009584,
|
|
6617
|
+
0.01431,
|
|
6618
|
+
0.094968,
|
|
6619
|
+
-0.016097,
|
|
6620
|
+
-0.088064,
|
|
6621
|
+
0.054678,
|
|
6622
|
+
-0.065112,
|
|
6623
|
+
0.046471,
|
|
6624
|
+
0.033751,
|
|
6625
|
+
-0.026071,
|
|
6626
|
+
0.014287,
|
|
6627
|
+
-0.04657,
|
|
6628
|
+
-0.013398,
|
|
6629
|
+
-0.043076,
|
|
6630
|
+
-0.003179,
|
|
6631
|
+
0.026761,
|
|
6632
|
+
0.137574,
|
|
6633
|
+
0.024168,
|
|
6634
|
+
0.005613,
|
|
6635
|
+
0.036922,
|
|
6636
|
+
0.055716,
|
|
6637
|
+
0.140864,
|
|
6638
|
+
-0.111314,
|
|
6624
6639
|
0,
|
|
6625
|
-
0.
|
|
6626
|
-
0.
|
|
6627
|
-
-0.
|
|
6628
|
-
-0.
|
|
6629
|
-
-0.
|
|
6630
|
-
0.
|
|
6631
|
-
-0.
|
|
6632
|
-
|
|
6633
|
-
0.
|
|
6634
|
-
0.
|
|
6635
|
-
-0.
|
|
6636
|
-
0.
|
|
6637
|
-
-0.
|
|
6638
|
-
0.
|
|
6639
|
-
0.
|
|
6640
|
-
0.
|
|
6641
|
-
-0.
|
|
6642
|
-
0.
|
|
6643
|
-
-0.
|
|
6644
|
-
0.
|
|
6645
|
-
0.
|
|
6646
|
-
-0.
|
|
6647
|
-
-0.
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
0.
|
|
6651
|
-
-0.
|
|
6652
|
-
0.
|
|
6653
|
-
-0.
|
|
6654
|
-
0.
|
|
6655
|
-
0.
|
|
6656
|
-
0.
|
|
6657
|
-
-0.
|
|
6658
|
-
|
|
6659
|
-
0.
|
|
6660
|
-
0.
|
|
6661
|
-
0.
|
|
6662
|
-
0.
|
|
6663
|
-
-0.
|
|
6664
|
-
-0.
|
|
6665
|
-
-0.
|
|
6666
|
-
|
|
6667
|
-
-0.
|
|
6668
|
-
-0.
|
|
6669
|
-
-0.
|
|
6670
|
-
0.
|
|
6671
|
-
-0.
|
|
6672
|
-
-0.
|
|
6673
|
-
0.
|
|
6674
|
-
0.
|
|
6675
|
-
0.
|
|
6676
|
-
0.
|
|
6677
|
-
0.
|
|
6678
|
-
0.
|
|
6679
|
-
-0.
|
|
6680
|
-
0.
|
|
6681
|
-
-0.
|
|
6682
|
-
-0.
|
|
6683
|
-
|
|
6684
|
-
-0.
|
|
6685
|
-
0.
|
|
6686
|
-
-0.
|
|
6687
|
-
0.
|
|
6688
|
-
-0.
|
|
6689
|
-
|
|
6690
|
-
0.
|
|
6691
|
-
0.
|
|
6692
|
-
0.
|
|
6693
|
-
0.
|
|
6694
|
-
0.
|
|
6695
|
-
0.
|
|
6696
|
-
0.
|
|
6697
|
-
|
|
6698
|
-
-0.
|
|
6699
|
-
0.
|
|
6700
|
-
-0.
|
|
6701
|
-
0.
|
|
6702
|
-
-0.
|
|
6703
|
-
0.
|
|
6704
|
-
-0.
|
|
6705
|
-
0.
|
|
6706
|
-
-0.
|
|
6707
|
-
|
|
6708
|
-
-0.
|
|
6709
|
-
0.
|
|
6710
|
-
-0.
|
|
6711
|
-
0.
|
|
6712
|
-
-0.
|
|
6713
|
-
-0.
|
|
6714
|
-
0.
|
|
6715
|
-
-0.
|
|
6716
|
-
|
|
6717
|
-
-0.
|
|
6718
|
-
0.
|
|
6719
|
-
-0.
|
|
6640
|
+
0.041824,
|
|
6641
|
+
0.019412,
|
|
6642
|
+
-0.033757,
|
|
6643
|
+
-0.080961,
|
|
6644
|
+
-0.062727,
|
|
6645
|
+
0.075514,
|
|
6646
|
+
-0.012199,
|
|
6647
|
+
0.004653,
|
|
6648
|
+
0.051502,
|
|
6649
|
+
0.027879,
|
|
6650
|
+
-0.047042,
|
|
6651
|
+
0.063608,
|
|
6652
|
+
-0.060384,
|
|
6653
|
+
0.077243,
|
|
6654
|
+
0.042728,
|
|
6655
|
+
0.02025,
|
|
6656
|
+
-0.000889,
|
|
6657
|
+
0.074956,
|
|
6658
|
+
-0.015263,
|
|
6659
|
+
0.022017,
|
|
6660
|
+
0.026597,
|
|
6661
|
+
-0.072091,
|
|
6662
|
+
-0.068947,
|
|
6663
|
+
0.002572,
|
|
6664
|
+
0.017823,
|
|
6665
|
+
0.028407,
|
|
6666
|
+
-0.062443,
|
|
6667
|
+
0.042962,
|
|
6668
|
+
-0.034435,
|
|
6669
|
+
0.013257,
|
|
6670
|
+
0.001228,
|
|
6671
|
+
0.017691,
|
|
6672
|
+
-0.036305,
|
|
6673
|
+
0.009104,
|
|
6674
|
+
0.011312,
|
|
6675
|
+
0.016391,
|
|
6676
|
+
-0.032245,
|
|
6677
|
+
0.036844,
|
|
6678
|
+
-0.030212,
|
|
6679
|
+
-0.019025,
|
|
6680
|
+
-0.062218,
|
|
6681
|
+
0.01787,
|
|
6682
|
+
-0.035959,
|
|
6683
|
+
-0.07145,
|
|
6684
|
+
-0.082602,
|
|
6685
|
+
0.058847,
|
|
6686
|
+
-0.032067,
|
|
6687
|
+
-0.002645,
|
|
6688
|
+
0.034337,
|
|
6689
|
+
0.072578,
|
|
6690
|
+
0.013094,
|
|
6691
|
+
-0.04352,
|
|
6692
|
+
0.007624,
|
|
6693
|
+
0.065604,
|
|
6694
|
+
-0.094586,
|
|
6695
|
+
-0.015157,
|
|
6696
|
+
-0.043702,
|
|
6697
|
+
-0.036224,
|
|
6698
|
+
0.040929,
|
|
6699
|
+
-0.011489,
|
|
6700
|
+
0.063186,
|
|
6701
|
+
-0.130861,
|
|
6702
|
+
0.040064,
|
|
6703
|
+
-0.152796,
|
|
6704
|
+
0.003327,
|
|
6705
|
+
0.024565,
|
|
6706
|
+
0.020197,
|
|
6707
|
+
0.090647,
|
|
6708
|
+
0.005792,
|
|
6709
|
+
0.072089,
|
|
6710
|
+
0.016977,
|
|
6711
|
+
0.062858,
|
|
6712
|
+
0.040581,
|
|
6713
|
+
-0.046475,
|
|
6714
|
+
0.075046,
|
|
6715
|
+
-0.048003,
|
|
6716
|
+
0.005048,
|
|
6717
|
+
-0.043309,
|
|
6718
|
+
0.007499,
|
|
6719
|
+
-0.045662,
|
|
6720
|
+
0.107233,
|
|
6721
|
+
-0.080935,
|
|
6722
|
+
0.018719,
|
|
6723
|
+
-0.112389,
|
|
6724
|
+
-0.032005,
|
|
6725
|
+
-0.02721,
|
|
6726
|
+
0.034682,
|
|
6727
|
+
-0.003679,
|
|
6728
|
+
-0.090258,
|
|
6729
|
+
-0.003373,
|
|
6730
|
+
-0.111179,
|
|
6731
|
+
0.022778,
|
|
6732
|
+
-0.015117,
|
|
6733
|
+
0.034344,
|
|
6734
|
+
-0.038471,
|
|
6720
6735
|
0,
|
|
6721
|
-
-0.
|
|
6722
|
-
0.
|
|
6723
|
-
0.
|
|
6724
|
-
0.
|
|
6725
|
-
-0.
|
|
6726
|
-
0.
|
|
6727
|
-
0.
|
|
6728
|
-
0.
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
0.
|
|
6732
|
-
-0.
|
|
6733
|
-
|
|
6734
|
-
0.
|
|
6735
|
-
0.
|
|
6736
|
-
0.
|
|
6737
|
-
0.
|
|
6738
|
-
-0.
|
|
6739
|
-
0.
|
|
6740
|
-
0.
|
|
6741
|
-
-0.
|
|
6742
|
-
0.
|
|
6743
|
-
-0.
|
|
6744
|
-
-0.
|
|
6745
|
-
-0.
|
|
6746
|
-
-0.
|
|
6747
|
-
-0.
|
|
6748
|
-
0.
|
|
6749
|
-
0.
|
|
6750
|
-
-0.
|
|
6751
|
-
0.
|
|
6752
|
-
0.
|
|
6753
|
-
-0.
|
|
6754
|
-
0.
|
|
6755
|
-
0.
|
|
6756
|
-
0.
|
|
6757
|
-
-0.
|
|
6758
|
-
-0.
|
|
6759
|
-
-0.
|
|
6760
|
-
|
|
6761
|
-
0.
|
|
6762
|
-
0.
|
|
6763
|
-
-0.
|
|
6764
|
-
-0.
|
|
6765
|
-
0.
|
|
6766
|
-
0.
|
|
6767
|
-
0.
|
|
6768
|
-
0.
|
|
6769
|
-
-0.
|
|
6770
|
-
-0.
|
|
6771
|
-
-0.
|
|
6772
|
-
0.
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
-0.
|
|
6776
|
-
|
|
6777
|
-
-0.
|
|
6778
|
-
-0.
|
|
6779
|
-
-0.
|
|
6780
|
-
-0.
|
|
6781
|
-
-0.
|
|
6782
|
-
0.
|
|
6783
|
-
-0.
|
|
6784
|
-
0.
|
|
6785
|
-
0.
|
|
6786
|
-
-0.
|
|
6787
|
-
0.
|
|
6788
|
-
-0.
|
|
6789
|
-
0.
|
|
6790
|
-
0.
|
|
6791
|
-
0.
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
-0.
|
|
6795
|
-
-0.
|
|
6796
|
-
0.
|
|
6797
|
-
-0.
|
|
6798
|
-
-0.
|
|
6799
|
-
|
|
6800
|
-
0.
|
|
6801
|
-
-0.
|
|
6802
|
-
|
|
6803
|
-
0.
|
|
6804
|
-
-0.
|
|
6805
|
-
-0.
|
|
6806
|
-
0.
|
|
6807
|
-
-0.
|
|
6808
|
-
0.
|
|
6809
|
-
0.
|
|
6810
|
-
-0.
|
|
6811
|
-
-0.
|
|
6812
|
-
0.
|
|
6813
|
-
-0.
|
|
6814
|
-
|
|
6815
|
-
0.
|
|
6736
|
+
-0.018613,
|
|
6737
|
+
0.060067,
|
|
6738
|
+
0.076554,
|
|
6739
|
+
0.091139,
|
|
6740
|
+
-0.063117,
|
|
6741
|
+
0.002999,
|
|
6742
|
+
0.067232,
|
|
6743
|
+
0.029988,
|
|
6744
|
+
0.023469,
|
|
6745
|
+
0.009471,
|
|
6746
|
+
0.068124,
|
|
6747
|
+
-0.042212,
|
|
6748
|
+
0.033127,
|
|
6749
|
+
0.040537,
|
|
6750
|
+
0.062643,
|
|
6751
|
+
0.028672,
|
|
6752
|
+
0.017383,
|
|
6753
|
+
-0.126003,
|
|
6754
|
+
0.023249,
|
|
6755
|
+
0.039692,
|
|
6756
|
+
-0.080872,
|
|
6757
|
+
0.068036,
|
|
6758
|
+
-0.020448,
|
|
6759
|
+
-0.1032,
|
|
6760
|
+
-0.057613,
|
|
6761
|
+
-0.018752,
|
|
6762
|
+
-0.022018,
|
|
6763
|
+
0.041261,
|
|
6764
|
+
-0.019029,
|
|
6765
|
+
-0.036425,
|
|
6766
|
+
0.012815,
|
|
6767
|
+
0.066957,
|
|
6768
|
+
-0.044481,
|
|
6769
|
+
0.007088,
|
|
6770
|
+
0.004556,
|
|
6771
|
+
0.091268,
|
|
6772
|
+
-0.034935,
|
|
6773
|
+
-0.008851,
|
|
6774
|
+
-0.017086,
|
|
6775
|
+
0.004428,
|
|
6776
|
+
0.067171,
|
|
6777
|
+
0.091273,
|
|
6778
|
+
-0.033939,
|
|
6779
|
+
-0.035174,
|
|
6780
|
+
-0.033943,
|
|
6781
|
+
0.092928,
|
|
6782
|
+
-0.011711,
|
|
6783
|
+
0.036215,
|
|
6784
|
+
-0.047752,
|
|
6785
|
+
-0.03928,
|
|
6786
|
+
-0.033228,
|
|
6787
|
+
0.040336,
|
|
6788
|
+
0.030886,
|
|
6789
|
+
0.008587,
|
|
6790
|
+
-0.050917,
|
|
6791
|
+
0.017539,
|
|
6792
|
+
-0.031221,
|
|
6793
|
+
-0.034651,
|
|
6794
|
+
-0.135003,
|
|
6795
|
+
-0.010527,
|
|
6796
|
+
-0.013776,
|
|
6797
|
+
0.064495,
|
|
6798
|
+
-0.118187,
|
|
6799
|
+
0.043506,
|
|
6800
|
+
0.016505,
|
|
6801
|
+
-0.057416,
|
|
6802
|
+
0.005695,
|
|
6803
|
+
-0.051382,
|
|
6804
|
+
0.014019,
|
|
6805
|
+
0.031513,
|
|
6806
|
+
-0.039971,
|
|
6807
|
+
0.051711,
|
|
6808
|
+
0.033309,
|
|
6809
|
+
-0.005771,
|
|
6810
|
+
-0.034043,
|
|
6811
|
+
-0.007335,
|
|
6812
|
+
-0.060966,
|
|
6813
|
+
-0.008036,
|
|
6814
|
+
0.000716,
|
|
6815
|
+
0.015842,
|
|
6816
|
+
-0.003319,
|
|
6817
|
+
0.022808,
|
|
6818
|
+
0.038986,
|
|
6819
|
+
-0.061263,
|
|
6820
|
+
-0.092411,
|
|
6821
|
+
0.072051,
|
|
6822
|
+
-0.066806,
|
|
6823
|
+
0.018686,
|
|
6824
|
+
0.021136,
|
|
6825
|
+
-0.022717,
|
|
6826
|
+
-0.035412,
|
|
6827
|
+
0.013526,
|
|
6828
|
+
-0.095462,
|
|
6829
|
+
0.008459,
|
|
6830
|
+
0.025815,
|
|
6816
6831
|
0,
|
|
6817
|
-
-0.
|
|
6818
|
-
-0.
|
|
6819
|
-
0.
|
|
6820
|
-
0.
|
|
6821
|
-
0.
|
|
6822
|
-
0.
|
|
6823
|
-
0.
|
|
6824
|
-
0.
|
|
6825
|
-
-0.
|
|
6826
|
-
-0.
|
|
6827
|
-
0.
|
|
6828
|
-
-0.
|
|
6829
|
-
0.
|
|
6830
|
-
0.
|
|
6831
|
-
|
|
6832
|
-
0.
|
|
6833
|
-
-0.
|
|
6834
|
-
0.
|
|
6835
|
-
-0.
|
|
6836
|
-
0.
|
|
6837
|
-
0.
|
|
6838
|
-
0.
|
|
6839
|
-
0.
|
|
6840
|
-
-0.
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
-0.
|
|
6844
|
-
0.
|
|
6845
|
-
0.
|
|
6846
|
-
-0.
|
|
6847
|
-
0.
|
|
6848
|
-
0.
|
|
6849
|
-
-0.
|
|
6850
|
-
-0.
|
|
6851
|
-
0.
|
|
6852
|
-
0.
|
|
6853
|
-
0.
|
|
6854
|
-
|
|
6855
|
-
0.
|
|
6856
|
-
0.
|
|
6857
|
-
-0.
|
|
6858
|
-
0.
|
|
6859
|
-
-0.
|
|
6860
|
-
-0.
|
|
6861
|
-
|
|
6862
|
-
-0.
|
|
6863
|
-
0.
|
|
6864
|
-
-0.
|
|
6865
|
-
0.
|
|
6866
|
-
-0.
|
|
6867
|
-
0.
|
|
6868
|
-
0.
|
|
6869
|
-
-0.
|
|
6870
|
-
0.
|
|
6871
|
-
0.
|
|
6872
|
-
-0.
|
|
6873
|
-
|
|
6874
|
-
0.
|
|
6875
|
-
-0.
|
|
6876
|
-
0.
|
|
6877
|
-
0.
|
|
6878
|
-
-0.
|
|
6879
|
-
-0.
|
|
6880
|
-
|
|
6832
|
+
-0.011153,
|
|
6833
|
+
-0.04058,
|
|
6834
|
+
0.121199,
|
|
6835
|
+
0.058841,
|
|
6836
|
+
0.015953,
|
|
6837
|
+
0.016097,
|
|
6838
|
+
0.078313,
|
|
6839
|
+
0.107461,
|
|
6840
|
+
-0.086684,
|
|
6841
|
+
-0.017774,
|
|
6842
|
+
0.072035,
|
|
6843
|
+
-0.011303,
|
|
6844
|
+
-0.025372,
|
|
6845
|
+
0.01933,
|
|
6846
|
+
0.038669,
|
|
6847
|
+
-0.037395,
|
|
6848
|
+
-0.003818,
|
|
6849
|
+
0.020909,
|
|
6850
|
+
-0.066188,
|
|
6851
|
+
-0.00551,
|
|
6852
|
+
-0.01575,
|
|
6853
|
+
0.038126,
|
|
6854
|
+
0.04159,
|
|
6855
|
+
-0.044173,
|
|
6856
|
+
0.032946,
|
|
6857
|
+
0.001453,
|
|
6858
|
+
-0.03071,
|
|
6859
|
+
0.082091,
|
|
6860
|
+
0.030543,
|
|
6861
|
+
-0.071939,
|
|
6862
|
+
0.103283,
|
|
6863
|
+
0.036915,
|
|
6864
|
+
-0.070866,
|
|
6865
|
+
-0.097545,
|
|
6866
|
+
0.078654,
|
|
6867
|
+
0.094637,
|
|
6868
|
+
-0.013259,
|
|
6869
|
+
0.00627,
|
|
6870
|
+
-0.00367,
|
|
6871
|
+
0.021725,
|
|
6872
|
+
-0.057931,
|
|
6873
|
+
0.004171,
|
|
6874
|
+
-0.00183,
|
|
6875
|
+
-0.001362,
|
|
6876
|
+
0.021022,
|
|
6877
|
+
-0.027248,
|
|
6878
|
+
-0.004775,
|
|
6879
|
+
-0.07134,
|
|
6880
|
+
0.099328,
|
|
6881
|
+
-0.054879,
|
|
6882
|
+
0.068009,
|
|
6883
|
+
-0.044679,
|
|
6884
|
+
-0.009519,
|
|
6885
|
+
0.077423,
|
|
6886
|
+
-0.005144,
|
|
6887
|
+
-0.029991,
|
|
6888
|
+
0.004407,
|
|
6889
|
+
0.062962,
|
|
6890
|
+
-0.040132,
|
|
6891
|
+
0.010847,
|
|
6892
|
+
0.045873,
|
|
6893
|
+
-0.042232,
|
|
6894
|
+
-0.018729,
|
|
6895
|
+
0.018884
|
|
6881
6896
|
]
|
|
6882
6897
|
},
|
|
6883
6898
|
{
|
|
@@ -8,19 +8,33 @@ import { apiGet, isApiConfigured } from "../api/client.js";
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
export function registerDetectRegressions(server) {
|
|
10
10
|
server.registerTool("detect_regressions", {
|
|
11
|
-
description: "Detect behavioral regressions by comparing recent data
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"Use this to catch deployments or changes that degraded user experience.",
|
|
11
|
+
description: "Detect behavioral regressions by comparing recent data against rolling 7-day baselines. " +
|
|
12
|
+
"By default analyzes top 50 pages by traffic. Use sort_by='low_traffic' to check low-traffic " +
|
|
13
|
+
"pages that might otherwise be missed. Use offset/limit to paginate through all pages. " +
|
|
14
|
+
"Returns pages where frustration, confusion, or rage click rate have deviated significantly.",
|
|
16
15
|
inputSchema: z.object({
|
|
17
16
|
window_hours: z
|
|
18
17
|
.number()
|
|
19
18
|
.optional()
|
|
20
19
|
.default(24)
|
|
21
20
|
.describe("How many recent hours to compare against baseline (default 24)"),
|
|
21
|
+
limit: z
|
|
22
|
+
.number()
|
|
23
|
+
.optional()
|
|
24
|
+
.default(50)
|
|
25
|
+
.describe("Number of pages to check per request (default 50, max 100)"),
|
|
26
|
+
offset: z
|
|
27
|
+
.number()
|
|
28
|
+
.optional()
|
|
29
|
+
.default(0)
|
|
30
|
+
.describe("Skip this many pages for pagination (default 0)"),
|
|
31
|
+
sort_by: z
|
|
32
|
+
.enum(["traffic", "low_traffic"])
|
|
33
|
+
.optional()
|
|
34
|
+
.default("traffic")
|
|
35
|
+
.describe("Sort order: 'traffic' (default) or 'low_traffic' to check overlooked pages"),
|
|
22
36
|
}),
|
|
23
|
-
}, async ({ window_hours }) => {
|
|
37
|
+
}, async ({ window_hours, limit, offset, sort_by, }) => {
|
|
24
38
|
if (!isApiConfigured()) {
|
|
25
39
|
return {
|
|
26
40
|
content: [
|
|
@@ -34,6 +48,9 @@ export function registerDetectRegressions(server) {
|
|
|
34
48
|
}
|
|
35
49
|
const { data, error } = await apiGet("/regressions", {
|
|
36
50
|
window_hours: window_hours ?? 24,
|
|
51
|
+
limit: limit ?? 50,
|
|
52
|
+
offset: offset ?? 0,
|
|
53
|
+
sort_by: sort_by ?? "traffic",
|
|
37
54
|
});
|
|
38
55
|
if (error) {
|
|
39
56
|
return {
|
package/dist/tools/diagnostic.js
CHANGED
|
@@ -8,7 +8,10 @@ import { apiGet, apiPost, isApiConfigured } from "../api/client.js";
|
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
export function registerDiagnosticTools(server) {
|
|
10
10
|
server.registerTool("run_full_diagnostic", {
|
|
11
|
-
description: "
|
|
11
|
+
description: "Get a quick site health overview with prioritized issues and problem pages. " +
|
|
12
|
+
"This is a lightweight entry point — it does NOT include regression detection. " +
|
|
13
|
+
"For a complete analysis, call detect_regressions separately after this. " +
|
|
14
|
+
"Returns: health score, top issues, pages needing attention, and investigation order.",
|
|
12
15
|
inputSchema: z.object({
|
|
13
16
|
days: z
|
|
14
17
|
.number()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recapt/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9-beta",
|
|
4
4
|
"description": "MCP exposing recapt behavioral intelligence to AI coding agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"generate-catalog": "tsx scripts/generateCatalog.ts"
|
|
16
16
|
},
|
|
17
17
|
"bin": {
|
|
18
|
-
"mcp": "./dist/cli/index.js",
|
|
19
18
|
"recapt-mcp": "./dist/index.js",
|
|
20
19
|
"recapt": "./dist/cli/index.js"
|
|
21
20
|
},
|
package/dist/cli/skill.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Recapt Skills CLI
|
|
4
|
-
*
|
|
5
|
-
* Installs recapt workflow skills to .agents/recapt/ and manages AGENTS.md references.
|
|
6
|
-
* Works across all AI IDEs that support the AGENTS.md standard.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npx @recapt/mcp skill list
|
|
10
|
-
* npx @recapt/mcp skill install self-healing
|
|
11
|
-
* npx @recapt/mcp skill install --all
|
|
12
|
-
* npx @recapt/mcp skill uninstall self-healing
|
|
13
|
-
*/
|
|
14
|
-
export {};
|
package/dist/cli/skill.js
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Recapt Skills CLI
|
|
4
|
-
*
|
|
5
|
-
* Installs recapt workflow skills to .agents/recapt/ and manages AGENTS.md references.
|
|
6
|
-
* Works across all AI IDEs that support the AGENTS.md standard.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npx @recapt/mcp skill list
|
|
10
|
-
* npx @recapt/mcp skill install self-healing
|
|
11
|
-
* npx @recapt/mcp skill install --all
|
|
12
|
-
* npx @recapt/mcp skill uninstall self-healing
|
|
13
|
-
*/
|
|
14
|
-
import fs from "fs";
|
|
15
|
-
import path from "path";
|
|
16
|
-
import { fileURLToPath } from "url";
|
|
17
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
-
const __dirname = path.dirname(__filename);
|
|
19
|
-
const SKILLS_DIR = path.resolve(__dirname, "../../skills");
|
|
20
|
-
const AGENTS_DIR = ".agents/recapt";
|
|
21
|
-
const AGENTS_MD = "AGENTS.md";
|
|
22
|
-
const MARKER_START = "<!-- recapt:skills -->";
|
|
23
|
-
const MARKER_END = "<!-- /recapt:skills -->";
|
|
24
|
-
function getAvailableSkills() {
|
|
25
|
-
if (!fs.existsSync(SKILLS_DIR)) {
|
|
26
|
-
console.error(`Skills directory not found: ${SKILLS_DIR}`);
|
|
27
|
-
process.exit(1);
|
|
28
|
-
}
|
|
29
|
-
const files = fs.readdirSync(SKILLS_DIR).filter((f) => f.endsWith(".md"));
|
|
30
|
-
return files.map((file) => {
|
|
31
|
-
const content = fs.readFileSync(path.join(SKILLS_DIR, file), "utf-8");
|
|
32
|
-
const firstLine = content.split("\n")[0];
|
|
33
|
-
const description = firstLine.startsWith("# ")
|
|
34
|
-
? firstLine.slice(2).trim()
|
|
35
|
-
: file.replace(".md", "");
|
|
36
|
-
return {
|
|
37
|
-
name: file.replace(".md", ""),
|
|
38
|
-
file,
|
|
39
|
-
description,
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function getInstalledSkills(cwd) {
|
|
44
|
-
const agentsDir = path.join(cwd, AGENTS_DIR);
|
|
45
|
-
if (!fs.existsSync(agentsDir)) {
|
|
46
|
-
return [];
|
|
47
|
-
}
|
|
48
|
-
return fs
|
|
49
|
-
.readdirSync(agentsDir)
|
|
50
|
-
.filter((f) => f.endsWith(".md"))
|
|
51
|
-
.map((f) => f.replace(".md", ""));
|
|
52
|
-
}
|
|
53
|
-
function ensureAgentsDir(cwd) {
|
|
54
|
-
const agentsDir = path.join(cwd, AGENTS_DIR);
|
|
55
|
-
if (!fs.existsSync(agentsDir)) {
|
|
56
|
-
fs.mkdirSync(agentsDir, { recursive: true });
|
|
57
|
-
console.log(`Created ${AGENTS_DIR}/`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function readAgentsMd(cwd) {
|
|
61
|
-
const agentsMdPath = path.join(cwd, AGENTS_MD);
|
|
62
|
-
if (!fs.existsSync(agentsMdPath)) {
|
|
63
|
-
return "";
|
|
64
|
-
}
|
|
65
|
-
return fs.readFileSync(agentsMdPath, "utf-8");
|
|
66
|
-
}
|
|
67
|
-
function writeAgentsMd(cwd, content) {
|
|
68
|
-
const agentsMdPath = path.join(cwd, AGENTS_MD);
|
|
69
|
-
fs.writeFileSync(agentsMdPath, content);
|
|
70
|
-
}
|
|
71
|
-
function getSkillDisplayName(skillName) {
|
|
72
|
-
const skills = getAvailableSkills();
|
|
73
|
-
const skill = skills.find((s) => s.name === skillName);
|
|
74
|
-
return skill?.description ?? skillName;
|
|
75
|
-
}
|
|
76
|
-
function updateAgentsMdReferences(cwd) {
|
|
77
|
-
const installed = getInstalledSkills(cwd);
|
|
78
|
-
let content = readAgentsMd(cwd);
|
|
79
|
-
if (installed.length === 0) {
|
|
80
|
-
if (content.includes(MARKER_START)) {
|
|
81
|
-
const regex = new RegExp(`\\n?${MARKER_START}[\\s\\S]*?${MARKER_END}\\n?`, "g");
|
|
82
|
-
content = content.replace(regex, "").trim();
|
|
83
|
-
if (content) {
|
|
84
|
-
writeAgentsMd(cwd, content + "\n");
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
const agentsMdPath = path.join(cwd, AGENTS_MD);
|
|
88
|
-
if (fs.existsSync(agentsMdPath)) {
|
|
89
|
-
fs.unlinkSync(agentsMdPath);
|
|
90
|
-
console.log(`Removed empty ${AGENTS_MD}`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
const skillLinks = installed
|
|
97
|
-
.map((name) => `- [${getSkillDisplayName(name)}](${AGENTS_DIR}/${name}.md)`)
|
|
98
|
-
.join("\n");
|
|
99
|
-
const newBlock = `${MARKER_START}
|
|
100
|
-
For recapt behavioral intelligence workflows, see:
|
|
101
|
-
${skillLinks}
|
|
102
|
-
${MARKER_END}`;
|
|
103
|
-
if (content.includes(MARKER_START)) {
|
|
104
|
-
const regex = new RegExp(`${MARKER_START}[\\s\\S]*?${MARKER_END}`, "g");
|
|
105
|
-
content = content.replace(regex, newBlock);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
if (content.trim()) {
|
|
109
|
-
content = content.trim() + "\n\n" + newBlock;
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
content = `# Project Agent Instructions\n\n${newBlock}`;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
writeAgentsMd(cwd, content + "\n");
|
|
116
|
-
}
|
|
117
|
-
function installSkill(cwd, skillName) {
|
|
118
|
-
const skills = getAvailableSkills();
|
|
119
|
-
const skill = skills.find((s) => s.name === skillName);
|
|
120
|
-
if (!skill) {
|
|
121
|
-
console.error(`Unknown skill: ${skillName}`);
|
|
122
|
-
console.error(`Available skills: ${skills.map((s) => s.name).join(", ")}`);
|
|
123
|
-
return false;
|
|
124
|
-
}
|
|
125
|
-
ensureAgentsDir(cwd);
|
|
126
|
-
const sourcePath = path.join(SKILLS_DIR, skill.file);
|
|
127
|
-
const destPath = path.join(cwd, AGENTS_DIR, skill.file);
|
|
128
|
-
if (fs.existsSync(destPath)) {
|
|
129
|
-
console.log(`Skill already installed: ${skillName}`);
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
fs.copyFileSync(sourcePath, destPath);
|
|
133
|
-
console.log(`Installed: ${skillName} → ${AGENTS_DIR}/${skill.file}`);
|
|
134
|
-
updateAgentsMdReferences(cwd);
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
function uninstallSkill(cwd, skillName) {
|
|
138
|
-
const skillPath = path.join(cwd, AGENTS_DIR, `${skillName}.md`);
|
|
139
|
-
if (!fs.existsSync(skillPath)) {
|
|
140
|
-
console.error(`Skill not installed: ${skillName}`);
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
fs.unlinkSync(skillPath);
|
|
144
|
-
console.log(`Uninstalled: ${skillName}`);
|
|
145
|
-
updateAgentsMdReferences(cwd);
|
|
146
|
-
const agentsDir = path.join(cwd, AGENTS_DIR);
|
|
147
|
-
const remaining = fs.readdirSync(agentsDir);
|
|
148
|
-
if (remaining.length === 0) {
|
|
149
|
-
fs.rmdirSync(agentsDir);
|
|
150
|
-
const parentDir = path.dirname(agentsDir);
|
|
151
|
-
if (fs.existsSync(parentDir) &&
|
|
152
|
-
fs.readdirSync(parentDir).length === 0) {
|
|
153
|
-
fs.rmdirSync(parentDir);
|
|
154
|
-
}
|
|
155
|
-
console.log(`Removed empty ${AGENTS_DIR}/`);
|
|
156
|
-
}
|
|
157
|
-
return true;
|
|
158
|
-
}
|
|
159
|
-
function listSkills(cwd) {
|
|
160
|
-
const available = getAvailableSkills();
|
|
161
|
-
const installed = new Set(getInstalledSkills(cwd));
|
|
162
|
-
console.log("\nAvailable recapt skills:\n");
|
|
163
|
-
for (const skill of available) {
|
|
164
|
-
const status = installed.has(skill.name) ? "[installed]" : "";
|
|
165
|
-
console.log(` ${skill.name.padEnd(20)} ${skill.description} ${status}`);
|
|
166
|
-
}
|
|
167
|
-
console.log("\nUsage:");
|
|
168
|
-
console.log(" npx @recapt/mcp skill install <name>");
|
|
169
|
-
console.log(" npx @recapt/mcp skill install --all");
|
|
170
|
-
console.log(" npx @recapt/mcp skill uninstall <name>\n");
|
|
171
|
-
}
|
|
172
|
-
function printHelp() {
|
|
173
|
-
console.log(`
|
|
174
|
-
Recapt Skills CLI
|
|
175
|
-
|
|
176
|
-
Installs workflow skills to .agents/recapt/ for use with any AI IDE.
|
|
177
|
-
|
|
178
|
-
Commands:
|
|
179
|
-
list Show available skills
|
|
180
|
-
install <name> Install a skill
|
|
181
|
-
install --all Install all skills
|
|
182
|
-
uninstall <name> Remove a skill
|
|
183
|
-
|
|
184
|
-
Examples:
|
|
185
|
-
npx @recapt/mcp skill list
|
|
186
|
-
npx @recapt/mcp skill install self-healing
|
|
187
|
-
npx @recapt/mcp skill install --all
|
|
188
|
-
npx @recapt/mcp skill uninstall deep-dive
|
|
189
|
-
`);
|
|
190
|
-
}
|
|
191
|
-
function main() {
|
|
192
|
-
const args = process.argv.slice(2);
|
|
193
|
-
const cwd = process.cwd();
|
|
194
|
-
if (args[0] === "skill") {
|
|
195
|
-
args.shift();
|
|
196
|
-
}
|
|
197
|
-
const command = args[0];
|
|
198
|
-
switch (command) {
|
|
199
|
-
case "list":
|
|
200
|
-
listSkills(cwd);
|
|
201
|
-
break;
|
|
202
|
-
case "install": {
|
|
203
|
-
const target = args[1];
|
|
204
|
-
if (!target) {
|
|
205
|
-
console.error("Usage: npx @recapt/mcp skill install <name|--all>");
|
|
206
|
-
process.exit(1);
|
|
207
|
-
}
|
|
208
|
-
if (target === "--all") {
|
|
209
|
-
const skills = getAvailableSkills();
|
|
210
|
-
let success = true;
|
|
211
|
-
for (const skill of skills) {
|
|
212
|
-
if (!installSkill(cwd, skill.name)) {
|
|
213
|
-
success = false;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (success) {
|
|
217
|
-
console.log(`\nAll skills installed. See ${AGENTS_MD} for references.`);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
if (installSkill(cwd, target)) {
|
|
222
|
-
console.log(`\nSkill reference added to ${AGENTS_MD}`);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
case "uninstall": {
|
|
228
|
-
const target = args[1];
|
|
229
|
-
if (!target) {
|
|
230
|
-
console.error("Usage: npx @recapt/mcp skill uninstall <name>");
|
|
231
|
-
process.exit(1);
|
|
232
|
-
}
|
|
233
|
-
uninstallSkill(cwd, target);
|
|
234
|
-
break;
|
|
235
|
-
}
|
|
236
|
-
case "help":
|
|
237
|
-
case "--help":
|
|
238
|
-
case "-h":
|
|
239
|
-
printHelp();
|
|
240
|
-
break;
|
|
241
|
-
default:
|
|
242
|
-
if (command) {
|
|
243
|
-
console.error(`Unknown command: ${command}`);
|
|
244
|
-
}
|
|
245
|
-
printHelp();
|
|
246
|
-
process.exit(command ? 1 : 0);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
main();
|
package/dist/utils/orgContext.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Organization context for the MCP server.
|
|
3
|
-
* Reads RECAPT_ORG_ID from environment and validates it.
|
|
4
|
-
*/
|
|
5
|
-
let cachedOrgId = null;
|
|
6
|
-
export function getOrgId() {
|
|
7
|
-
if (cachedOrgId)
|
|
8
|
-
return cachedOrgId;
|
|
9
|
-
const orgId = process.env.RECAPT_ORG_ID;
|
|
10
|
-
if (!orgId) {
|
|
11
|
-
throw new Error('RECAPT_ORG_ID environment variable is required. ' +
|
|
12
|
-
'Set it to the MongoDB ObjectId of the organization to query.');
|
|
13
|
-
}
|
|
14
|
-
if (!/^[a-f0-9]{24}$/i.test(orgId)) {
|
|
15
|
-
throw new Error(`RECAPT_ORG_ID must be a valid 24-character MongoDB ObjectId. Got: ${orgId}`);
|
|
16
|
-
}
|
|
17
|
-
cachedOrgId = orgId;
|
|
18
|
-
return orgId;
|
|
19
|
-
}
|
|
20
|
-
export function hasOrgId() {
|
|
21
|
-
return !!process.env.RECAPT_ORG_ID;
|
|
22
|
-
}
|