@spekoai/mcp 1.0.6 → 1.0.7
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/init.d.ts.map +1 -1
- package/dist/init.js +65 -19
- package/package.json +1 -1
package/dist/init.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAQA,OAAO,EAAgD,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEhG,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AACzC,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAC3C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AAC3C,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAI5E,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF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AmB,EAAE,QAAQ,GAAG,MAAM,CAAC,GAAG,OAAO,CAE3F;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,GAClB,gBAAgB,CAgBlB;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,GAClB,gBAAgB,CA+BlB;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,GAClB,gBAAgB,CAiClB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,mBAAmB,EAAE,KAAK,EAAE,SAAS,GAAG,eAAe,EAAE,CA0D/F;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,mBAAmB,EAC5B,KAAK,EAAE,SAAS,eAAe,EAAE,GAChC,MAAM,CAqBR;AAED,wBAAsB,cAAc,CAClC,IAAI,GAAE,SAAS,MAAM,EAA0B,EAC/C,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,IAAI,CAAC,CA8Ef"}
|
package/dist/init.js
CHANGED
|
@@ -14,7 +14,7 @@ const TOOL_SPECS = [
|
|
|
14
14
|
{ tool: 'cursor', label: 'Cursor' },
|
|
15
15
|
{ tool: 'other', label: 'Other clients' },
|
|
16
16
|
];
|
|
17
|
-
export const DEFAULT_SELECTED_TOOLS = ['claude'
|
|
17
|
+
export const DEFAULT_SELECTED_TOOLS = ['claude'];
|
|
18
18
|
export const DEFAULT_SCOPE = 'project';
|
|
19
19
|
const TOOL_LABELS = new Map(TOOL_SPECS.map((spec) => [spec.tool, spec.label]));
|
|
20
20
|
export const INIT_HELP_TEXT = `Usage: spekoai-mcp init [options]
|
|
@@ -251,20 +251,14 @@ export function renderPlanSummary(options, steps) {
|
|
|
251
251
|
'Planned changes:',
|
|
252
252
|
...steps.map((step) => {
|
|
253
253
|
if (step.kind === 'command') {
|
|
254
|
-
return `- ${step.label}: run ${formatCommand(step.command)}`;
|
|
254
|
+
return `- ${step.label}: run command: ${formatCommand(step.command)}`;
|
|
255
255
|
}
|
|
256
256
|
if (step.kind === 'file') {
|
|
257
|
-
return `- ${step.label}: update ${step.path}`;
|
|
257
|
+
return `- ${step.label}: update file: ${step.path}`;
|
|
258
258
|
}
|
|
259
259
|
return `- ${step.label}: print manual Streamable HTTP settings`;
|
|
260
260
|
}),
|
|
261
261
|
];
|
|
262
|
-
const postInstall = steps
|
|
263
|
-
.map((step) => step.postInstall)
|
|
264
|
-
.filter((value) => Boolean(value));
|
|
265
|
-
if (postInstall.length > 0) {
|
|
266
|
-
lines.push('', 'After configuring:', ...postInstall.map((step) => `- ${step}`));
|
|
267
|
-
}
|
|
268
262
|
return lines.join('\n');
|
|
269
263
|
}
|
|
270
264
|
export async function runInitCommand(argv = process.argv.slice(2), deps = {}) {
|
|
@@ -307,14 +301,32 @@ export async function runInitCommand(argv = process.argv.slice(2), deps = {}) {
|
|
|
307
301
|
runCommand: deps.runCommand ?? runExternalCommand,
|
|
308
302
|
});
|
|
309
303
|
const resultText = renderAppliedSteps(applied);
|
|
304
|
+
const manualText = renderManualSnippets(steps.filter((step) => step.kind === 'manual'));
|
|
305
|
+
const failedManualText = renderFailedManualSnippets(applied);
|
|
306
|
+
const postInstallText = renderPostInstallSteps(applied);
|
|
310
307
|
if (interactive) {
|
|
311
|
-
|
|
308
|
+
const hasFailures = applied.some((step) => !step.ok);
|
|
309
|
+
if (hasFailures) {
|
|
310
|
+
log.warn(resultText);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
log.success(resultText);
|
|
314
|
+
}
|
|
315
|
+
stdout.write(manualText);
|
|
316
|
+
stdout.write(failedManualText);
|
|
317
|
+
if (postInstallText) {
|
|
318
|
+
log.step(postInstallText);
|
|
319
|
+
}
|
|
320
|
+
outro(hasFailures ? 'Finished with issues' : 'Done');
|
|
312
321
|
}
|
|
313
322
|
else {
|
|
314
323
|
stdout.write(`${resultText}\n`);
|
|
324
|
+
stdout.write(manualText);
|
|
325
|
+
stdout.write(failedManualText);
|
|
326
|
+
if (postInstallText) {
|
|
327
|
+
stdout.write(`\n${postInstallText}\n`);
|
|
328
|
+
}
|
|
315
329
|
}
|
|
316
|
-
stdout.write(`${renderManualSnippets(steps.filter((step) => step.kind === 'manual'))}\n`);
|
|
317
|
-
stdout.write(`${renderFailedManualSnippets(applied)}\n`);
|
|
318
330
|
printApiKeyReminder(options, env, stdout);
|
|
319
331
|
const failures = applied.filter((step) => !step.ok);
|
|
320
332
|
if (failures.length > 0) {
|
|
@@ -391,16 +403,24 @@ async function applyInitPlan(steps, deps) {
|
|
|
391
403
|
const timestamp = deps.timestamp();
|
|
392
404
|
for (const step of steps) {
|
|
393
405
|
if (step.kind === 'manual') {
|
|
394
|
-
applied.push({
|
|
406
|
+
applied.push({
|
|
407
|
+
label: step.label,
|
|
408
|
+
ok: true,
|
|
409
|
+
message: 'Manual instructions printed.',
|
|
410
|
+
postInstall: step.postInstall,
|
|
411
|
+
});
|
|
395
412
|
continue;
|
|
396
413
|
}
|
|
397
414
|
if (step.kind === 'command') {
|
|
398
415
|
const result = deps.runCommand(step.command);
|
|
416
|
+
const alreadyConfigured = !result.ok && isAlreadyConfiguredMessage(result.message);
|
|
417
|
+
const ok = result.ok || alreadyConfigured;
|
|
399
418
|
applied.push({
|
|
400
419
|
label: step.label,
|
|
401
|
-
ok
|
|
402
|
-
message: result.message,
|
|
403
|
-
manualSnippet:
|
|
420
|
+
ok,
|
|
421
|
+
message: alreadyConfigured ? `Already configured: ${result.message}` : result.message,
|
|
422
|
+
manualSnippet: ok ? undefined : step.manualSnippet,
|
|
423
|
+
postInstall: ok ? step.postInstall : undefined,
|
|
404
424
|
});
|
|
405
425
|
continue;
|
|
406
426
|
}
|
|
@@ -416,7 +436,12 @@ async function applyInitPlan(steps, deps) {
|
|
|
416
436
|
continue;
|
|
417
437
|
}
|
|
418
438
|
if (existing === next.content) {
|
|
419
|
-
applied.push({
|
|
439
|
+
applied.push({
|
|
440
|
+
label: step.label,
|
|
441
|
+
ok: true,
|
|
442
|
+
message: `Already up to date: ${step.path}`,
|
|
443
|
+
postInstall: step.postInstall,
|
|
444
|
+
});
|
|
420
445
|
continue;
|
|
421
446
|
}
|
|
422
447
|
mkdirSync(dirname(step.path), { recursive: true });
|
|
@@ -425,7 +450,12 @@ async function applyInitPlan(steps, deps) {
|
|
|
425
450
|
await copyFile(step.path, backupPath);
|
|
426
451
|
}
|
|
427
452
|
writeFileSync(step.path, next.content);
|
|
428
|
-
applied.push({
|
|
453
|
+
applied.push({
|
|
454
|
+
label: step.label,
|
|
455
|
+
ok: true,
|
|
456
|
+
message: `Updated ${step.path}`,
|
|
457
|
+
postInstall: step.postInstall,
|
|
458
|
+
});
|
|
429
459
|
}
|
|
430
460
|
return applied;
|
|
431
461
|
}
|
|
@@ -562,6 +592,15 @@ function renderFailedManualSnippets(steps) {
|
|
|
562
592
|
.map((step) => `${step.label}:\n${step.manualSnippet}`);
|
|
563
593
|
return snippets.length > 0 ? `\nManual fallback:\n\n${snippets.join('\n\n')}\n` : '';
|
|
564
594
|
}
|
|
595
|
+
function renderPostInstallSteps(steps) {
|
|
596
|
+
const postInstall = Array.from(new Set(steps
|
|
597
|
+
.filter((step) => step.ok)
|
|
598
|
+
.map((step) => step.postInstall)
|
|
599
|
+
.filter((value) => Boolean(value))));
|
|
600
|
+
return postInstall.length > 0
|
|
601
|
+
? `After configuring:\n${postInstall.map((step) => `- ${step}`).join('\n')}`
|
|
602
|
+
: '';
|
|
603
|
+
}
|
|
565
604
|
function printApiKeyReminder(options, env, stdout) {
|
|
566
605
|
if (!isApiKeyAuth(options) || env.SPEKO_API_KEY?.trim()) {
|
|
567
606
|
return;
|
|
@@ -586,13 +625,20 @@ function runExternalCommand(command) {
|
|
|
586
625
|
return { ok: false, message: result.error.message };
|
|
587
626
|
}
|
|
588
627
|
if (result.status !== 0) {
|
|
628
|
+
const message = result.stderr.trim() || result.stdout.trim() || `Exited with ${result.status}`;
|
|
629
|
+
if (isAlreadyConfiguredMessage(message)) {
|
|
630
|
+
return { ok: true, message: `Already configured: ${message}` };
|
|
631
|
+
}
|
|
589
632
|
return {
|
|
590
633
|
ok: false,
|
|
591
|
-
message
|
|
634
|
+
message,
|
|
592
635
|
};
|
|
593
636
|
}
|
|
594
637
|
return { ok: true, message: `Ran ${formatCommand(command)}` };
|
|
595
638
|
}
|
|
639
|
+
function isAlreadyConfiguredMessage(message) {
|
|
640
|
+
return /\balready (?:configured|exists|up to date)\b/i.test(message);
|
|
641
|
+
}
|
|
596
642
|
function formatCommand(command) {
|
|
597
643
|
return command.map(shellQuote).join(' ');
|
|
598
644
|
}
|