@inspecto-dev/cli 0.3.7 → 0.3.9

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/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+
1
3
  /** Package manager detection result */
2
4
  type PackageManager = 'bun' | 'pnpm' | 'yarn' | 'npm';
3
5
  /** Supported build tools (v1) */
@@ -111,6 +113,12 @@ interface OnboardingVerification {
111
113
  devCommand?: string;
112
114
  message: string;
113
115
  }
116
+ interface OnboardingDailyUsageHandoff {
117
+ mode: 'agent';
118
+ skill: string;
119
+ prompt: string;
120
+ requiresMcp: boolean;
121
+ }
114
122
  interface OnboardingAssistantHandoff {
115
123
  framework?: string;
116
124
  metaFramework?: string;
@@ -119,6 +127,7 @@ interface OnboardingAssistantHandoff {
119
127
  pendingSteps?: string[];
120
128
  assistantPrompt?: string;
121
129
  patches?: OnboardingPatchPlan[];
130
+ dailyUsage?: OnboardingDailyUsageHandoff;
122
131
  }
123
132
  interface ResolvedOnboardingSession {
124
133
  status: OnboardStatus;
@@ -141,6 +150,7 @@ interface ResolvedOnboardingSession {
141
150
  pendingSteps?: string[];
142
151
  assistantPrompt?: string;
143
152
  patches?: OnboardingPatchPlan[];
153
+ dailyUsage?: OnboardingDailyUsageHandoff;
144
154
  handoff?: OnboardingAssistantHandoff;
145
155
  }
146
156
  interface OnboardCommandResult {
@@ -159,6 +169,7 @@ interface OnboardCommandResult {
159
169
  pendingSteps?: string[];
160
170
  assistantPrompt?: string;
161
171
  patches?: OnboardingPatchPlan[];
172
+ dailyUsage?: OnboardingDailyUsageHandoff;
162
173
  handoff?: OnboardingAssistantHandoff;
163
174
  }
164
175
  /** Machine-readable detection output for skill-first onboarding */
@@ -383,6 +394,44 @@ interface IntegrationDoctorResult {
383
394
  }
384
395
  declare function integrationDoctor(assistant: string, options?: IntegrationDoctorOptions): Promise<IntegrationDoctorResult>;
385
396
 
397
+ interface McpCommandOptions {
398
+ serverUrl?: string;
399
+ version?: string;
400
+ }
401
+ interface InspectoMcpRuntime {
402
+ getSession(args: {
403
+ sessionId: string;
404
+ }): Promise<Record<string, unknown>>;
405
+ claimNext(args?: {
406
+ timeoutMs?: number;
407
+ }): Promise<{
408
+ success: boolean;
409
+ timedOut: boolean;
410
+ matchedExisting: boolean;
411
+ session?: Record<string, unknown>;
412
+ event?: string;
413
+ }>;
414
+ reply(args: {
415
+ sessionId: string;
416
+ text: string;
417
+ }): Promise<Record<string, unknown>>;
418
+ resolve(args: {
419
+ sessionId: string;
420
+ message?: string;
421
+ }): Promise<Record<string, unknown>>;
422
+ dismiss(args: {
423
+ sessionId: string;
424
+ message?: string;
425
+ }): Promise<Record<string, unknown>>;
426
+ }
427
+ declare function startMcpServer(options?: McpCommandOptions): Promise<void>;
428
+ declare function createInspectoMcpServer(options: {
429
+ baseUrl: string;
430
+ version?: string;
431
+ }): McpServer;
432
+ declare function createInspectoMcpRuntime(baseUrl: string): InspectoMcpRuntime;
433
+ declare function resolveInspectoServerBaseUrl(cwd: string): string | null;
434
+
386
435
  interface OnboardCommandOptions {
387
436
  json?: boolean;
388
437
  target?: string;
@@ -405,6 +454,6 @@ interface ReportCommandErrorOptions {
405
454
  declare function writeCommandOutput<T>(result: T, json: boolean, renderText: (value: T) => void): T;
406
455
  declare function reportCommandError(error: unknown, options?: ReportCommandErrorOptions): void;
407
456
 
408
- type Framework = 'react' | 'vue';
457
+ type Framework = 'react' | 'vue' | 'svelte' | 'solid' | 'astro';
409
458
 
410
- export { type BuildTool, type DoctorDiagnostic, type DoctorResult, type Framework, type InitOptions, type InstallLock, type OnboardCommandResult, type OnboardStatus, type PackageManager, type ResolvedOnboardingSession, apply, collectDoctorResult, detect, devLink, devStatus, devUnlink, doctor, init, integrationDoctor, onboard, plan, reportCommandError, teardown, writeCommandOutput };
459
+ export { type BuildTool, type DoctorDiagnostic, type DoctorResult, type Framework, type InitOptions, type InstallLock, type OnboardCommandResult, type OnboardStatus, type PackageManager, type ResolvedOnboardingSession, apply, collectDoctorResult, createInspectoMcpRuntime, createInspectoMcpServer, detect, devLink, devStatus, devUnlink, doctor, init, integrationDoctor, onboard, plan, reportCommandError, resolveInspectoServerBaseUrl, startMcpServer, teardown, writeCommandOutput };
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import {
2
2
  apply,
3
3
  collectDoctorResult,
4
+ createInspectoMcpRuntime,
5
+ createInspectoMcpServer,
4
6
  detect,
5
7
  devLink,
6
8
  devStatus,
@@ -11,12 +13,16 @@ import {
11
13
  onboard,
12
14
  plan,
13
15
  reportCommandError,
16
+ resolveInspectoServerBaseUrl,
17
+ startMcpServer,
14
18
  teardown,
15
19
  writeCommandOutput
16
- } from "./chunk-LLQA5L7E.js";
20
+ } from "./chunk-T46P6RD7.js";
17
21
  export {
18
22
  apply,
19
23
  collectDoctorResult,
24
+ createInspectoMcpRuntime,
25
+ createInspectoMcpServer,
20
26
  detect,
21
27
  devLink,
22
28
  devStatus,
@@ -27,6 +33,8 @@ export {
27
33
  onboard,
28
34
  plan,
29
35
  reportCommandError,
36
+ resolveInspectoServerBaseUrl,
37
+ startMcpServer,
30
38
  teardown,
31
39
  writeCommandOutput
32
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inspecto-dev/cli",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "CLI tools for Inspecto onboarding and lifecycle management",
5
5
  "keywords": [
6
6
  "inspecto",
@@ -15,12 +15,14 @@
15
15
  "inspecto": "./bin/inspecto.js"
16
16
  },
17
17
  "dependencies": {
18
+ "@modelcontextprotocol/sdk": "^1.29.0",
18
19
  "cac": "^6.7.14",
19
20
  "magicast": "^0.5.2",
20
- "ora": "^9.3.0",
21
+ "ora": "^9.4.0",
21
22
  "picocolors": "^1.0.0",
22
23
  "prompts": "^2.4.2",
23
- "@inspecto-dev/types": "0.3.7"
24
+ "zod": "^4.1.12",
25
+ "@inspecto-dev/types": "0.3.9"
24
26
  },
25
27
  "devDependencies": {
26
28
  "@types/node": "^20.19.39",
package/src/bin.ts CHANGED
@@ -11,6 +11,7 @@ import { detect } from './commands/detect.js'
11
11
  import { devLink, devStatus, devUnlink } from './commands/dev-config.js'
12
12
  import { init } from './commands/init.js'
13
13
  import { doctor } from './commands/doctor.js'
14
+ import { startMcpServer } from './commands/mcp.js'
14
15
  import { onboard } from './commands/onboard.js'
15
16
  import { plan } from './commands/plan.js'
16
17
  import { teardown } from './commands/teardown.js'
@@ -75,6 +76,10 @@ interface DevCommandOptions extends JsonCommandOptions {
75
76
  repo?: string
76
77
  }
77
78
 
79
+ interface McpCommandOptions extends GlobalOptions {
80
+ serverUrl?: string
81
+ }
82
+
78
83
  const integrationScopes = ['project', 'user'] as const
79
84
  const integrationModes = ['skills', 'instructions', 'agents', 'rules'] as const
80
85
 
@@ -128,6 +133,21 @@ export function createCli(_argv: readonly string[] = process.argv): CAC {
128
133
  }
129
134
  })
130
135
 
136
+ cli
137
+ .command('mcp', 'Run Inspecto as a minimal stdio MCP server for agents')
138
+ .option('--server-url <url>', 'Use an explicit Inspecto dev server base URL')
139
+ .option('--debug', 'Enable debug mode to show full error traces', { default: false })
140
+ .action(async (options: McpCommandOptions) => {
141
+ try {
142
+ await startMcpServer({
143
+ ...(options.serverUrl ? { serverUrl: options.serverUrl } : {}),
144
+ version,
145
+ })
146
+ } catch (error) {
147
+ exitWithError(error, options)
148
+ }
149
+ })
150
+
131
151
  cli
132
152
  .command('init', 'Set up Inspecto in your project')
133
153
  .option('--shared', 'Share .inspecto/settings.json with your team via Git', { default: false })
@@ -202,11 +202,15 @@ export async function init(options: InitOptions): Promise<void> {
202
202
  }
203
203
 
204
204
  // IDE detection
205
- let selectedIDE: { ide: string; supported: boolean } | null = null
205
+ let selectedIDE: { ide: string; supported: boolean } | null
206
206
 
207
207
  if (ideProbe.detected.length === 0) {
208
- log.error('No IDE detected in current project')
209
- log.hint('Please open this project in a supported IDE (like VS Code)')
208
+ if (process.stdin.isTTY) {
209
+ log.warn('No IDE detected in current project')
210
+ selectedIDE = await promptIDEChoice([])
211
+ } else {
212
+ selectedIDE = { ide: 'none', supported: true }
213
+ }
210
214
  } else if (ideProbe.detected.length === 1) {
211
215
  selectedIDE = ideProbe.detected[0]!
212
216
  } else {
@@ -156,7 +156,9 @@ export async function runIntegrationAutomation(
156
156
  previewParams.set('overrides', JSON.stringify({ type: dispatchMode.mode }))
157
157
  }
158
158
 
159
- const uriScheme = resolvedHostIde.ide ? (IDE_TO_URI_SCHEME[resolvedHostIde.ide] ?? resolvedHostIde.ide) : 'vscode'
159
+ const uriScheme = resolvedHostIde.ide
160
+ ? (IDE_TO_URI_SCHEME[resolvedHostIde.ide] ?? resolvedHostIde.ide)
161
+ : 'vscode'
160
162
  const launchUri = `${uriScheme}://inspecto.inspecto/send?${previewParams.toString()}`
161
163
  details.inspectoExtension = {
162
164
  source: options.inspectoVsix ? 'local_vsix' : 'marketplace',
@@ -425,7 +427,7 @@ export async function runIntegrationAutomation(
425
427
  }
426
428
  }
427
429
 
428
- function shouldAutoSend(assistant: string, ide: SupportedHostIde): boolean {
430
+ function shouldAutoSend(assistant: string, _ide: SupportedHostIde): boolean {
429
431
  if (assistant === 'copilot') return true
430
432
  if (assistant === 'codex') return true
431
433
  return false
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path'
2
2
  import { exists, readJSON } from '../utils/fs.js'
3
3
  import {
4
- HOST_IDE_IDS,
5
4
  getHostIdeArtifactPath,
6
5
  isSupportedHostIde,
7
6
  type SupportedHostIde,
@@ -138,7 +137,8 @@ function detectEnvHostIdes(): SupportedHostIde[] {
138
137
  if (
139
138
  process.env.__CFBundleIdentifier === 'ai.codebuddy.mac.cn' ||
140
139
  process.env.COCO_IDE_PLUGIN_TYPE === 'CodeBuddyCN' ||
141
- (process.env.npm_config_user_agent && process.env.npm_config_user_agent.includes('codebuddy-cn'))
140
+ (process.env.npm_config_user_agent &&
141
+ process.env.npm_config_user_agent.includes('codebuddy-cn'))
142
142
  ) {
143
143
  detected.add('codebuddy-cn')
144
144
  } else if (
@@ -157,7 +157,14 @@ function detectEnvHostIdes(): SupportedHostIde[] {
157
157
  }
158
158
 
159
159
  async function detectArtifactHostIdes(cwd: string): Promise<SupportedHostIde[]> {
160
- const artifactOrder: SupportedHostIde[] = ['cursor', 'trae', 'trae-cn', 'codebuddy', 'codebuddy-cn', 'vscode']
160
+ const artifactOrder: SupportedHostIde[] = [
161
+ 'cursor',
162
+ 'trae',
163
+ 'trae-cn',
164
+ 'codebuddy',
165
+ 'codebuddy-cn',
166
+ 'vscode',
167
+ ]
161
168
  const candidates = artifactOrder.map(ide => ({
162
169
  ide,
163
170
  target: getHostIdeArtifactPath(ide, cwd),
@@ -19,7 +19,15 @@ import {
19
19
  const REPO_RAW_BASE = 'https://raw.githubusercontent.com/inspecto-dev/inspecto/main'
20
20
  const TOTAL_STEPS = 6
21
21
 
22
- type AssistantId = 'codex' | 'claude-code' | 'copilot' | 'cursor' | 'gemini' | 'trae' | 'coco' | 'codebuddy'
22
+ type AssistantId =
23
+ | 'codex'
24
+ | 'claude-code'
25
+ | 'copilot'
26
+ | 'cursor'
27
+ | 'gemini'
28
+ | 'trae'
29
+ | 'coco'
30
+ | 'codebuddy'
23
31
  type ClaudeScope = 'project' | 'user'
24
32
  type CopilotMode = 'skills' | 'instructions' | 'agents'
25
33
  type CursorMode = 'skills' | 'rules' | 'agents'
@@ -67,6 +75,7 @@ interface InstallPlan {
67
75
  interface InspectoSettingsShape {
68
76
  ide?: string
69
77
  'provider.default'?: string
78
+ 'annotate.deliveryMode'?: 'ide' | 'agent' | 'both'
70
79
  [key: string]: unknown
71
80
  }
72
81
 
@@ -368,21 +377,31 @@ async function persistProjectOnboardingDefaults(
368
377
  resolvedHostIde.ide && resolvedHostIde.confidence !== 'low'
369
378
  ? await resolveProviderDefaultForAssistant(assistant, resolvedHostIde.ide)
370
379
  : undefined
380
+ const annotateDeliveryMode = resolveAnnotateDefaultDeliveryForAssistant(assistant)
371
381
  const mergedSettings =
372
382
  existingSettings && typeof existingSettings === 'object'
373
383
  ? {
374
384
  ...existingSettings,
375
385
  ide: options.ide,
376
386
  ...(providerDefault ? { 'provider.default': providerDefault } : {}),
387
+ 'annotate.deliveryMode': annotateDeliveryMode,
377
388
  }
378
389
  : {
379
390
  ide: options.ide,
380
391
  ...(providerDefault ? { 'provider.default': providerDefault } : {}),
392
+ 'annotate.deliveryMode': annotateDeliveryMode,
381
393
  }
382
394
 
383
395
  await writeJSON(settingsPath, mergedSettings)
384
396
  }
385
397
 
398
+ function resolveAnnotateDefaultDeliveryForAssistant(
399
+ assistant: AssistantId,
400
+ ): 'ide' | 'agent' | 'both' {
401
+ void assistant
402
+ return 'both'
403
+ }
404
+
386
405
  function shouldSkipAutomationForInstall(options: InstallIntegrationOptions): boolean {
387
406
  return options.scope === 'user' && !options.preview
388
407
  }
@@ -509,8 +528,10 @@ function resolveInstallPlan(assistant: string, options: InstallIntegrationOption
509
528
  executable: true,
510
529
  },
511
530
  ],
512
- successMessage: 'Installed CodeBuddy skill to .codebuddy/skills/inspecto-onboarding/SKILL.md',
513
- nextStep: 'Open a new CodeBuddy chat and verify the inspecto-onboarding skill is available.',
531
+ successMessage:
532
+ 'Installed CodeBuddy skill to .codebuddy/skills/inspecto-onboarding/SKILL.md',
533
+ nextStep:
534
+ 'Open a new CodeBuddy chat and verify the inspecto-onboarding skill is available.',
514
535
  }
515
536
  default:
516
537
  throw new Error(`Unknown assistant: ${assistant}`)
@@ -566,6 +587,10 @@ function resolveCodexPlan(options: InstallIntegrationOptions): InstallPlan {
566
587
  scope === 'user'
567
588
  ? path.join(homedir(), '.agents/skills/inspecto-onboarding-codex')
568
589
  : '.agents/skills/inspecto-onboarding-codex'
590
+ const agentDir =
591
+ scope === 'user'
592
+ ? path.join(homedir(), '.agents/skills/inspecto-agent-codex')
593
+ : '.agents/skills/inspecto-agent-codex'
569
594
 
570
595
  return {
571
596
  assets: [
@@ -585,9 +610,19 @@ function resolveCodexPlan(options: InstallIntegrationOptions): InstallPlan {
585
610
  executable: true,
586
611
  localSource: 'skills/inspecto-onboarding-codex/scripts/run-inspecto.sh',
587
612
  },
613
+ {
614
+ source: `${REPO_RAW_BASE}/skills/inspecto-agent-codex/SKILL.md`,
615
+ target: path.join(agentDir, 'SKILL.md'),
616
+ localSource: 'skills/inspecto-agent-codex/SKILL.md',
617
+ },
618
+ {
619
+ source: `${REPO_RAW_BASE}/skills/inspecto-agent-codex/agents/openai.yaml`,
620
+ target: path.join(agentDir, 'agents/openai.yaml'),
621
+ localSource: 'skills/inspecto-agent-codex/agents/openai.yaml',
622
+ },
588
623
  ],
589
- successMessage: `Installed Codex skill to ${baseDir}`,
590
- nextStep: 'Restart Codex or start a new Codex session to load the skill.',
624
+ successMessage: `Installed Codex skills to ${baseDir} and ${agentDir}`,
625
+ nextStep: 'Restart Codex or start a new Codex session to load the new skills.',
591
626
  }
592
627
  }
593
628