@inspecto-dev/cli 0.3.0 → 0.3.1

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.
@@ -1,19 +1,20 @@
1
-
2
- > @inspecto-dev/cli@0.3.0 build /Users/tangjie/hugo.felix/inspecto/packages/cli
3
- > tsup
4
-
5
- CLI Building entry: src/bin.ts, src/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Using tsup config: /Users/tangjie/hugo.felix/inspecto/packages/cli/tsup.config.ts
9
- CLI Target: node18
10
- CLI Cleaning output folder
11
- ESM Build start
12
- ESM dist/index.js 319.00 B
13
- ESM dist/bin.js 20.37 KB
14
- ESM dist/chunk-IBYH7QZM.js 103.65 KB
15
- ESM ⚡️ Build success in 67ms
16
- DTS Build start
17
- DTS ⚡️ Build success in 4661ms
18
- DTS dist/bin.d.ts 185.00 B
19
- DTS dist/index.d.ts 7.79 KB
1
+
2
+ 
3
+ > @inspecto-dev/cli@0.3.1 build /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
4
+ > tsup
5
+
6
+ CLI Building entry: src/bin.ts, src/index.ts
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.1
9
+ CLI Using tsup config: /Users/bytedance/Works/hugo.felix/inspecto/packages/cli/tsup.config.ts
10
+ CLI Target: node18
11
+ CLI Cleaning output folder
12
+ ESM Build start
13
+ ESM dist/bin.js 20.39 KB
14
+ ESM dist/chunk-PSYZB5GI.js 103.68 KB
15
+ ESM dist/index.js 319.00 B
16
+ ESM ⚡️ Build success in 162ms
17
+ DTS Build start
18
+ DTS ⚡️ Build success in 1954ms
19
+ DTS dist/bin.d.ts 185.00 B
20
+ DTS dist/index.d.ts 7.79 KB
@@ -0,0 +1,92 @@
1
+
2
+ > @inspecto-dev/cli@0.3.0 test /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
3
+ > vitest run --passWithNoTests
4
+
5
+
6
+ RUN v1.6.1 /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
7
+
8
+ ✓ tests/instructions.test.ts (2 tests) 5ms
9
+ ✓ tests/ide.test.ts (6 tests) 3ms
10
+ ✓ tests/detect.test.ts (1 test) 3ms
11
+ ✓ tests/doctor.test.ts (4 tests) 6ms
12
+ ✓ tests/logger.test.ts (5 tests) 9ms
13
+ ✓ tests/onboard.test.ts (5 tests) 5ms
14
+ - Installing devDependencies via: pnpm add -D @inspecto-dev/plugin @inspecto-dev/core
15
+ stdout | tests/apply.test.ts > apply onboarding flow > applies the supported setup path and returns structured mutations and post-install state
16
+ ✔ Installed @inspecto-dev/plugin and @inspecto-dev/core as devDependencies
17
+ ✔ Created .inspecto/settings.local.json
18
+ ✔ Created .inspecto/prompts.local.json
19
+
20
+ ✓ tests/apply.test.ts (9 tests) 16ms
21
+ ✔ Dependencies installed successfully
22
+ - Installing devDependencies via: pnpm add -D @inspecto-dev/plugin @inspecto-dev/core
23
+ ✔ Dependencies installed successfully
24
+ - Installing devDependencies via: pnpm add -D @inspecto-dev/plugin @inspecto-dev/core
25
+ ✔ Dependencies installed successfully
26
+ ✓ tests/framework.test.ts (5 tests) 3ms
27
+ ✓ tests/build-tool.test.ts (2 tests) 59ms
28
+ ✓ tests/workspace-build-tool.test.ts (1 test) 73ms
29
+ ✓ tests/init.test.ts (5 tests) 9ms
30
+ stdout | tests/init.test.ts > init in monorepo roots > routes installation and config generation into the selected app instead of the monorepo root
31
+
32
+ ✦ Inspecto Setup
33
+
34
+ ⚠ Monorepo root detected with multiple candidate apps.
35
+ ℹ Continuing initialization in apps/web
36
+ ✔ Detected package manager: pnpm
37
+ ✔ Detected framework: react
38
+ ✔ Detected: Vite (apps/web/vite.config.ts)
39
+ ✔ Selected IDE: vscode
40
+ ⚠ No supported AI tools detected
41
+ → Inspecto works best with Claude Code, Trae CLI, or GitHub Copilot
42
+
43
+
44
+ ⚡ Ready! Inspecto is set up.
45
+
46
+ ℹ Next:
47
+ → 1. Start or restart your dev server.
48
+ → 2. Open your app in the browser.
49
+ → 3. Hold Alt + Click any element to inspect.
50
+
51
+ stdout | tests/init.test.ts > init in monorepo roots > prints detailed Next.js manual instructions when Next.js is detected
52
+
53
+ ✦ Inspecto Setup
54
+
55
+ ✔ Detected package manager: pnpm
56
+ ✔ Detected framework: react
57
+ ⚠ Detected Next.js — automatic plugin injection is not supported in current version
58
+ → You can still manually configure it by modifying your configuration file
59
+ ✔ Selected IDE: vscode
60
+ ⚠ No supported AI tools detected
61
+ → Inspecto works best with Claude Code, Trae CLI, or GitHub Copilot
62
+
63
+ ⚠ Dry run complete. No files were modified.
64
+
65
+ stdout | tests/init.test.ts > init in monorepo roots > preserves detected preferred mode for an explicit provider override
66
+
67
+ ✦ Inspecto Setup
68
+
69
+ ✔ Detected package manager: pnpm
70
+ ✔ Detected framework: react
71
+ ✔ Detected: Vite (vite.config.ts)
72
+ ✔ Selected IDE: vscode
73
+
74
+
75
+ ⚡ Ready! Inspecto is set up.
76
+
77
+ ℹ Next:
78
+ → 1. Start or restart your dev server.
79
+ → 2. Open your app in the browser.
80
+ → 3. Hold Alt + Click any element to inspect.
81
+
82
+ ✓ tests/ast-injector.test.ts (1 test) 3ms
83
+ ✓ tests/integration-install.test.ts (12 tests) 824ms
84
+ ✓ tests/plan.test.ts (15 tests) 718ms
85
+ ✓ tests/install-wrapper.test.ts (1 test) 1276ms
86
+ ✓ tests/runner-script.test.ts (3 tests) 2378ms
87
+
88
+ Test Files 16 passed (16)
89
+ Tests 77 passed (77)
90
+ Start at 12:27:25
91
+ Duration 3.02s (transform 2.20s, setup 0ms, collect 4.55s, tests 5.39s, environment 3ms, prepare 2.95s)
92
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @inspecto-dev/cli
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: polish onboarding and architecture visualization
8
+ - Updated dependencies
9
+ - @inspecto-dev/types@0.3.1
10
+
3
11
  ## 0.3.0
4
12
 
5
13
  ### Minor Changes
package/dist/bin.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  reportCommandError,
11
11
  teardown,
12
12
  writeFile
13
- } from "./chunk-IBYH7QZM.js";
13
+ } from "./chunk-PSYZB5GI.js";
14
14
 
15
15
  // src/bin.ts
16
16
  import { cac } from "cac";
@@ -352,7 +352,9 @@ async function downloadAsset(source) {
352
352
  response = await fetch(source);
353
353
  } catch (error) {
354
354
  const reason = error instanceof Error ? error.message : String(error);
355
- throw new Error(`Failed to download ${source}: ${reason}`);
355
+ throw new Error(`Failed to download ${source}: ${reason}`, {
356
+ cause: error
357
+ });
356
358
  }
357
359
  if (!response.ok) {
358
360
  throw new Error(`Failed to download ${source}: ${response.status} ${response.statusText}`);
@@ -2373,7 +2373,9 @@ function matchesAnyPackage(detection, packages) {
2373
2373
  }
2374
2374
  async function detectFrameworkSupportByPackage(repoRoot, buildTools) {
2375
2375
  const packagePaths = Array.from(
2376
- new Set(buildTools.map((buildTool) => buildTool.packagePath).filter((value) => !!value))
2376
+ new Set(
2377
+ buildTools.map((buildTool) => buildTool.packagePath).filter((value) => !!value)
2378
+ )
2377
2379
  );
2378
2380
  const supportByPackage = {};
2379
2381
  await Promise.all(
@@ -2800,7 +2802,8 @@ function buildConfirmation(plan2, summary, session, options) {
2800
2802
  const reasons = [];
2801
2803
  if (session.targetWasHeuristic) reasons.push("a monorepo target was preselected");
2802
2804
  if (summary.manualFollowUp.length > 0) reasons.push("manual follow-up will remain after setup");
2803
- if (options.noExtension || options.skipInstall) reasons.push("non-core setup steps are being skipped");
2805
+ if (options.noExtension || options.skipInstall)
2806
+ reasons.push("non-core setup steps are being skipped");
2804
2807
  if (session.supportedIdeCount > 1 || session.supportedProviderCount > 1) {
2805
2808
  reasons.push("multiple IDE or provider choices are still relevant");
2806
2809
  }
@@ -2837,7 +2840,9 @@ function buildPreApplyResult(status, session) {
2837
2840
  function buildExecutionResult(session, applyResult) {
2838
2841
  return {
2839
2842
  changedFiles: Array.from(
2840
- new Set(applyResult.mutations.map((item) => item.path).filter((value) => !!value))
2843
+ new Set(
2844
+ applyResult.mutations.map((item) => item.path).filter((value) => !!value)
2845
+ )
2841
2846
  ),
2842
2847
  installedDependencies: applyResult.mutations.map((item) => item.name).filter((value) => !!value),
2843
2848
  selectedProviderDefault: session.providerDefault,
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  reportCommandError,
10
10
  teardown,
11
11
  writeCommandOutput
12
- } from "./chunk-IBYH7QZM.js";
12
+ } from "./chunk-PSYZB5GI.js";
13
13
  export {
14
14
  apply,
15
15
  collectDoctorResult,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inspecto-dev/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "CLI tools for Inspecto onboarding and lifecycle management",
5
5
  "keywords": [
6
6
  "inspecto",
@@ -20,7 +20,7 @@
20
20
  "ora": "^9.3.0",
21
21
  "picocolors": "^1.0.0",
22
22
  "prompts": "^2.4.2",
23
- "@inspecto-dev/types": "0.3.0"
23
+ "@inspecto-dev/types": "0.3.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^20.0.0",
@@ -368,7 +368,11 @@ async function detectFrameworkSupportByPackage(
368
368
  buildTools: BuildToolDetection[],
369
369
  ): Promise<Record<string, string[]>> {
370
370
  const packagePaths = Array.from(
371
- new Set(buildTools.map(buildTool => buildTool.packagePath).filter((value): value is string => !!value)),
371
+ new Set(
372
+ buildTools
373
+ .map(buildTool => buildTool.packagePath)
374
+ .filter((value): value is string => !!value),
375
+ ),
372
376
  )
373
377
  const supportByPackage: Record<string, string[]> = {}
374
378
 
@@ -441,7 +441,9 @@ async function downloadAsset(source: string): Promise<string> {
441
441
  response = await fetch(source)
442
442
  } catch (error) {
443
443
  const reason = error instanceof Error ? error.message : String(error)
444
- throw new Error(`Failed to download ${source}: ${reason}`)
444
+ throw new Error(`Failed to download ${source}: ${reason}`, {
445
+ cause: error,
446
+ })
445
447
  }
446
448
 
447
449
  if (!response.ok) {
@@ -1,4 +1,8 @@
1
- import { resolveOnboardingSession, applyResolvedOnboardingSession, buildDeferredOnboardResult } from '../onboarding/session.js'
1
+ import {
2
+ resolveOnboardingSession,
3
+ applyResolvedOnboardingSession,
4
+ buildDeferredOnboardResult,
5
+ } from '../onboarding/session.js'
2
6
  import { log } from '../utils/logger.js'
3
7
  import { writeCommandOutput } from '../utils/output.js'
4
8
  import type { OnboardCommandResult } from '../types.js'
@@ -197,7 +197,8 @@ function buildConfirmation(
197
197
  const reasons: string[] = []
198
198
  if (session.targetWasHeuristic) reasons.push('a monorepo target was preselected')
199
199
  if (summary.manualFollowUp.length > 0) reasons.push('manual follow-up will remain after setup')
200
- if (options.noExtension || options.skipInstall) reasons.push('non-core setup steps are being skipped')
200
+ if (options.noExtension || options.skipInstall)
201
+ reasons.push('non-core setup steps are being skipped')
201
202
  if (session.supportedIdeCount > 1 || session.supportedProviderCount > 1) {
202
203
  reasons.push('multiple IDE or provider choices are still relevant')
203
204
  }
@@ -219,7 +220,9 @@ function buildPreApplyResult(
219
220
  session: ResolvedOnboardingSession,
220
221
  ): OnboardCommandResult {
221
222
  const diagnostics: OnboardingDiagnostics | undefined =
222
- session.summary.risks.length > 0 || session.summary.manualFollowUp.length > 0 || session.plan.blockers.length > 0
223
+ session.summary.risks.length > 0 ||
224
+ session.summary.manualFollowUp.length > 0 ||
225
+ session.plan.blockers.length > 0
223
226
  ? {
224
227
  warnings: session.summary.risks,
225
228
  errors: session.plan.blockers.map(item => item.message),
@@ -248,7 +251,9 @@ function buildExecutionResult(
248
251
  ): OnboardingExecutionResult {
249
252
  return {
250
253
  changedFiles: Array.from(
251
- new Set(applyResult.mutations.map(item => item.path).filter((value): value is string => !!value)),
254
+ new Set(
255
+ applyResult.mutations.map(item => item.path).filter((value): value is string => !!value),
256
+ ),
252
257
  ),
253
258
  installedDependencies: applyResult.mutations
254
259
  .map(item => item.name)
@@ -276,7 +281,11 @@ function buildExecutionDiagnostics(
276
281
  warnings.push('IDE extension installation still needs manual completion.')
277
282
  }
278
283
 
279
- if (warnings.length === 0 && errors.length === 0 && applyResult.postInstall.nextSteps.length === 0) {
284
+ if (
285
+ warnings.length === 0 &&
286
+ errors.length === 0 &&
287
+ applyResult.postInstall.nextSteps.length === 0
288
+ ) {
280
289
  return undefined
281
290
  }
282
291
 
@@ -121,7 +121,12 @@ describe('apply onboarding flow', () => {
121
121
  'pnpm add -D @inspecto-dev/plugin @inspecto-dev/core',
122
122
  '/repo',
123
123
  )
124
- expect(astInjectorUtils.injectPlugin).toHaveBeenCalledWith('/repo', supportedBuild, false, false)
124
+ expect(astInjectorUtils.injectPlugin).toHaveBeenCalledWith(
125
+ '/repo',
126
+ supportedBuild,
127
+ false,
128
+ false,
129
+ )
125
130
  expect(fsUtils.writeJSON).toHaveBeenCalledWith('/repo/.inspecto/settings.local.json', {
126
131
  ide: 'vscode',
127
132
  'provider.default': 'codex.extension',
@@ -54,10 +54,7 @@ describe('assistant integration bootstrap wrapper', () => {
54
54
  )
55
55
  await fs.chmod(path.join(fakeBin, 'curl'), 0o755)
56
56
 
57
- const scriptPath = path.resolve(
58
- __dirname,
59
- '../../../assistant-integrations/scripts/install.sh',
60
- )
57
+ const scriptPath = path.resolve(__dirname, '../../../assistant-integrations/scripts/install.sh')
61
58
 
62
59
  await execFileAsync('bash', [scriptPath, 'copilot', '--force'], {
63
60
  cwd: tempRoot,
@@ -347,6 +347,10 @@ describe('onboard command', () => {
347
347
  const result = await onboard({ json: false })
348
348
 
349
349
  expect(result.status).toBe('success')
350
- expect(consoleSpy.mock.calls.some(call => String(call[0]).includes('Start the local dev server with `pnpm dev`'))).toBe(true)
350
+ expect(
351
+ consoleSpy.mock.calls.some(call =>
352
+ String(call[0]).includes('Start the local dev server with `pnpm dev`'),
353
+ ),
354
+ ).toBe(true)
351
355
  })
352
356
  })
@@ -0,0 +1,72 @@
1
+ import fs from 'node:fs/promises'
2
+ import os from 'node:os'
3
+ import path from 'node:path'
4
+ import { spawnSync } from 'node:child_process'
5
+ import { afterEach, describe, expect, it } from 'vitest'
6
+
7
+ const TEMP_DIRS: string[] = []
8
+
9
+ async function makeTempDir(): Promise<string> {
10
+ const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'inspecto-runner-test-'))
11
+ TEMP_DIRS.push(dir)
12
+ return dir
13
+ }
14
+
15
+ async function writeExecutable(filePath: string, content: string): Promise<void> {
16
+ await fs.mkdir(path.dirname(filePath), { recursive: true })
17
+ await fs.writeFile(filePath, content, 'utf8')
18
+ await fs.chmod(filePath, 0o755)
19
+ }
20
+
21
+ function runRunner(scriptPath: string, cwd: string, pathEnv: string): string {
22
+ const result = spawnSync(scriptPath, ['onboard', '--json'], {
23
+ cwd,
24
+ env: {
25
+ ...process.env,
26
+ PATH: pathEnv,
27
+ },
28
+ encoding: 'utf8',
29
+ })
30
+
31
+ expect(result.status).toBe(0)
32
+ return (result.stdout + result.stderr).trim()
33
+ }
34
+
35
+ describe('skill runner scripts', () => {
36
+ afterEach(async () => {
37
+ await Promise.all(TEMP_DIRS.splice(0).map(dir => fs.rm(dir, { recursive: true, force: true })))
38
+ })
39
+
40
+ it.each([
41
+ 'skills/inspecto-onboarding-codex/scripts/run-inspecto.sh',
42
+ 'skills/inspecto-onboarding-claude-code/scripts/run-inspecto.sh',
43
+ 'skills/inspecto-onboarding-core/scripts/run-inspecto.sh',
44
+ ])(
45
+ 'prefers an installed inspecto executable before package-manager download paths: %s',
46
+ async scriptRelativePath => {
47
+ const workspaceRoot = path.resolve(__dirname, '../../..')
48
+ const scriptPath = path.join(workspaceRoot, scriptRelativePath)
49
+ const tempDir = await makeTempDir()
50
+ const fakeBin = path.join(tempDir, 'bin')
51
+
52
+ await writeExecutable(
53
+ path.join(fakeBin, 'inspecto'),
54
+ `#!/usr/bin/env bash
55
+ echo "installed-inspecto:$*"
56
+ `,
57
+ )
58
+
59
+ await writeExecutable(
60
+ path.join(fakeBin, 'pnpm'),
61
+ `#!/usr/bin/env bash
62
+ echo "pnpm-should-not-run:$*" >&2
63
+ exit 99
64
+ `,
65
+ )
66
+
67
+ const output = runRunner(scriptPath, tempDir, `${fakeBin}:${process.env.PATH ?? ''}`)
68
+ expect(output).toContain('installed-inspecto:onboard --json')
69
+ expect(output).not.toContain('pnpm-should-not-run')
70
+ },
71
+ )
72
+ })