@inspecto-dev/cli 0.2.0-alpha.1 → 0.2.0-alpha.3
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/.turbo/turbo-build.log +20 -19
- package/.turbo/turbo-test.log +4 -4
- package/CHANGELOG.md +22 -0
- package/README.md +5 -5
- package/dist/bin.js +50 -68
- package/dist/{chunk-DBXT75QF.js → chunk-HIL6365F.js} +718 -443
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/package.json +3 -2
- package/src/bin.ts +84 -70
- package/src/commands/doctor.ts +38 -25
- package/src/commands/init.ts +107 -228
- package/src/commands/teardown.ts +13 -23
- package/src/detect/build-tool.ts +169 -21
- package/src/detect/framework.ts +71 -9
- package/src/detect/ide.ts +42 -21
- package/src/detect/package-manager.ts +10 -3
- package/src/detect/provider.ts +151 -0
- package/src/inject/ast-injector.ts +70 -231
- package/src/inject/extension.ts +49 -34
- package/src/inject/gitignore.ts +1 -1
- package/src/inject/strategies/esbuild.ts +35 -0
- package/src/inject/strategies/index.ts +16 -0
- package/src/inject/strategies/rollup.ts +35 -0
- package/src/inject/strategies/rsbuild.ts +29 -0
- package/src/inject/strategies/rspack.ts +34 -0
- package/src/inject/strategies/types.ts +35 -0
- package/src/inject/strategies/vite.ts +30 -0
- package/src/inject/strategies/webpack.ts +36 -0
- package/src/instructions.ts +55 -0
- package/src/prompts.ts +115 -0
- package/src/types.ts +4 -1
- package/tests/ide.test.ts +3 -3
- package/src/detect/ai-tool.ts +0 -127
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
DTS
|
|
18
|
-
DTS
|
|
19
|
-
DTS dist/
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @inspecto-dev/cli@0.2.0-alpha.2 build /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: src/bin.ts, src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/bytedance/Works/hugo.felix/inspecto/packages/cli/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: node18
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m109.00 B[39m
|
|
14
|
+
[32mESM[39m [1mdist/bin.js [22m[32m2.64 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/chunk-HIL6365F.js [22m[32m53.63 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 26ms
|
|
17
|
+
DTS Build start
|
|
18
|
+
DTS ⚡️ Build success in 1180ms
|
|
19
|
+
DTS dist/bin.d.ts 13.00 B
|
|
20
|
+
DTS dist/index.d.ts 1.18 KB
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
> @inspecto/cli@0.
|
|
2
|
+
> @inspecto-dev/cli@0.2.0-alpha.2 test /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
|
|
3
3
|
> vitest run --passWithNoTests
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
RUN v1.6.1 /Users/bytedance/Works/hugo.felix/inspecto/packages/cli
|
|
7
7
|
|
|
8
|
-
✓ tests/framework.test.ts (5 tests) 3ms
|
|
9
8
|
✓ tests/ide.test.ts (6 tests) 3ms
|
|
9
|
+
✓ tests/framework.test.ts (5 tests) 2ms
|
|
10
10
|
|
|
11
11
|
Test Files 2 passed (2)
|
|
12
12
|
Tests 11 passed (11)
|
|
13
|
-
Start at
|
|
14
|
-
Duration
|
|
13
|
+
Start at 19:47:34
|
|
14
|
+
Duration 213ms (transform 48ms, setup 0ms, collect 65ms, tests 5ms, environment 0ms, prepare 121ms)
|
|
15
15
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @inspecto-dev/cli
|
|
2
2
|
|
|
3
|
+
## 0.2.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- release alpha test version
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @inspecto-dev/types@0.2.0-alpha.3
|
|
13
|
+
|
|
14
|
+
## 0.2.0-alpha.2
|
|
15
|
+
|
|
16
|
+
### Minor Changes
|
|
17
|
+
|
|
18
|
+
- release alpha test version
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
- @inspecto-dev/types@0.2.0-alpha.2
|
|
24
|
+
|
|
3
25
|
## 0.2.0-alpha.1
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -25,13 +25,13 @@ The primary command to scaffold Inspecto into a project. It performs a comprehen
|
|
|
25
25
|
**Features:**
|
|
26
26
|
|
|
27
27
|
- **Package Manager Detection:** Auto-detects `npm`, `pnpm`, `yarn`, or `bun`.
|
|
28
|
-
- **Build Tool / Framework Detection:** Detects Vite, Webpack, Rspack, Rsbuild, and
|
|
28
|
+
- **Build Tool / Framework Detection:** Detects Vite, Webpack, Rspack, Rsbuild, and others. Supports legacy versions (e.g., `@rspack/cli < 0.4.0`).
|
|
29
29
|
- **IDE Detection:** Prioritizes environment variables, then falls back to directory structures to accurately detect VS Code, Cursor, Trae, Windsurf, or WebStorm.
|
|
30
30
|
- **AI Tool Detection:** Scans for both CLI-based tools (Claude, Coco, CodeX, Gemini) and IDE Plugins (GitHub Copilot, Claude Code, Gemini, CodeX).
|
|
31
31
|
- **Interactive Prompts:** If multiple build configurations or AI tools are detected, it presents an interactive prompt for you to select your preferred configuration.
|
|
32
|
-
- **AST Injection:** Safely injects the `@inspecto-dev/plugin` into your
|
|
32
|
+
- **AST Injection:** Safely injects the `@inspecto-dev/plugin` into your Vite configuration file (`vite.config.ts`, etc.) using AST transformation, preventing duplicate injections. Manual setup is required for other build tools.
|
|
33
33
|
- **IDE Extension Installation:** Uses a robust 4-level waterfall strategy to install the necessary IDE extension.
|
|
34
|
-
- **Configuration Scaffolding:** Generates the `.inspecto/settings.json` file tailored to your detected or selected AI tools, and updates `.gitignore` to prevent committing local settings.
|
|
34
|
+
- **Configuration Scaffolding:** Generates the `.inspecto/settings.local.json` file tailored to your detected or selected AI tools, and updates `.gitignore` to prevent committing local settings.
|
|
35
35
|
|
|
36
36
|
### `inspecto doctor`
|
|
37
37
|
|
|
@@ -51,7 +51,7 @@ A clean-up command to remove Inspecto from your project.
|
|
|
51
51
|
**Features:**
|
|
52
52
|
|
|
53
53
|
- Uninstalls `@inspecto-dev/plugin` and `@inspecto-dev/cli`.
|
|
54
|
-
-
|
|
54
|
+
- Provides manual instructions to remove the plugin from your build configuration file (AST removal is currently unsupported).
|
|
55
55
|
- Deletes the `.inspecto` directory and its contents.
|
|
56
56
|
- Restores `.gitignore` by removing Inspecto-specific rules.
|
|
57
57
|
|
|
@@ -75,4 +75,4 @@ The CLI intelligently detects AI tools across two modes:
|
|
|
75
75
|
- **CLI Mode:** Checks the system `PATH` for known executables (e.g., `claude`, `coco`).
|
|
76
76
|
- **Plugin Mode:** Checks the IDE's extension directories (e.g., `~/.vscode/extensions`) for known plugin IDs.
|
|
77
77
|
|
|
78
|
-
When a tool supports both modes, the CLI merges the detections and presents a unified option to the user, configuring the `settings.json` accordingly.
|
|
78
|
+
When a tool supports both modes, the CLI merges the detections and presents a unified option to the user, configuring the `settings.local.json` accordingly.
|
package/dist/bin.js
CHANGED
|
@@ -3,81 +3,63 @@ import {
|
|
|
3
3
|
init,
|
|
4
4
|
log,
|
|
5
5
|
teardown
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HIL6365F.js";
|
|
7
7
|
|
|
8
8
|
// src/bin.ts
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`;
|
|
35
|
-
async function main() {
|
|
36
|
-
const args = process.argv.slice(2);
|
|
37
|
-
const command = args[0];
|
|
38
|
-
if (!command || command === "--help" || command === "-h") {
|
|
39
|
-
console.log(HELP);
|
|
40
|
-
process.exit(0);
|
|
9
|
+
import { cac } from "cac";
|
|
10
|
+
import { createRequire } from "module";
|
|
11
|
+
var require2 = createRequire(import.meta.url);
|
|
12
|
+
var { version } = require2("../package.json");
|
|
13
|
+
var cli = cac("inspecto");
|
|
14
|
+
cli.command("init", "Set up Inspecto in your project").option("--shared", "Share .inspecto/settings.json with your team via Git", { default: false }).option("--skip-install", "Skip npm dependency installation", { default: false }).option("--dry-run", "Preview changes without modifying files", { default: false }).option("--provider <provider>", "Set default provider (e.g. copilot, claude-code)").option("--no-extension", "Skip VS Code extension installation", { default: false }).option("--packages <names>", "(Monorepo) Comma-separated list of packages to inject").option("--force", "Force initialization even if environment is unsupported", { default: false }).option("--debug", "Enable debug mode to show full error traces", { default: false }).action(async (options) => {
|
|
15
|
+
try {
|
|
16
|
+
await init({
|
|
17
|
+
shared: options.shared ?? false,
|
|
18
|
+
skipInstall: options.skipInstall ?? false,
|
|
19
|
+
dryRun: options.dryRun ?? false,
|
|
20
|
+
...options.provider && { provider: options.provider },
|
|
21
|
+
// Changed from prefer to provider
|
|
22
|
+
noExtension: options.noExtension ?? false,
|
|
23
|
+
...options.packages && {
|
|
24
|
+
packages: options.packages.split(",").map((s) => s.trim())
|
|
25
|
+
},
|
|
26
|
+
force: options.force ?? false
|
|
27
|
+
});
|
|
28
|
+
} catch (err) {
|
|
29
|
+
log.error(err instanceof Error ? err.message : String(err));
|
|
30
|
+
if (options.debug && err instanceof Error && err.stack) {
|
|
31
|
+
console.error(err.stack);
|
|
32
|
+
}
|
|
33
|
+
process.exit(1);
|
|
41
34
|
}
|
|
35
|
+
});
|
|
36
|
+
cli.command("doctor", "Diagnose your Inspecto installation").option("--debug", "Enable debug mode to show full error traces", { default: false }).action(async (options) => {
|
|
42
37
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
shared: { type: "boolean", default: false },
|
|
49
|
-
"skip-install": { type: "boolean", default: false },
|
|
50
|
-
"dry-run": { type: "boolean", default: false },
|
|
51
|
-
prefer: { type: "string" },
|
|
52
|
-
"no-extension": { type: "boolean", default: false },
|
|
53
|
-
packages: { type: "string" }
|
|
54
|
-
},
|
|
55
|
-
strict: true
|
|
56
|
-
});
|
|
57
|
-
await init({
|
|
58
|
-
shared: values.shared ?? false,
|
|
59
|
-
skipInstall: values["skip-install"] ?? false,
|
|
60
|
-
dryRun: values["dry-run"] ?? false,
|
|
61
|
-
...values.prefer && { prefer: values.prefer },
|
|
62
|
-
noExtension: values["no-extension"] ?? false,
|
|
63
|
-
...values.packages && { packages: values.packages.split(",").map((s) => s.trim()) }
|
|
64
|
-
});
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
case "doctor":
|
|
68
|
-
await doctor();
|
|
69
|
-
break;
|
|
70
|
-
case "teardown":
|
|
71
|
-
await teardown();
|
|
72
|
-
break;
|
|
73
|
-
default:
|
|
74
|
-
log.error(`Unknown command: ${command}`);
|
|
75
|
-
console.log(HELP);
|
|
76
|
-
process.exit(1);
|
|
38
|
+
await doctor();
|
|
39
|
+
} catch (err) {
|
|
40
|
+
log.error(err instanceof Error ? err.message : String(err));
|
|
41
|
+
if (options.debug && err instanceof Error && err.stack) {
|
|
42
|
+
console.error(err.stack);
|
|
77
43
|
}
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
cli.command("teardown", "Remove Inspecto from your project").option("--debug", "Enable debug mode to show full error traces", { default: false }).action(async (options) => {
|
|
48
|
+
try {
|
|
49
|
+
await teardown();
|
|
78
50
|
} catch (err) {
|
|
79
51
|
log.error(err instanceof Error ? err.message : String(err));
|
|
52
|
+
if (options.debug && err instanceof Error && err.stack) {
|
|
53
|
+
console.error(err.stack);
|
|
54
|
+
}
|
|
80
55
|
process.exit(1);
|
|
81
56
|
}
|
|
57
|
+
});
|
|
58
|
+
cli.help();
|
|
59
|
+
cli.version(version);
|
|
60
|
+
try {
|
|
61
|
+
cli.parse();
|
|
62
|
+
} catch (err) {
|
|
63
|
+
log.error(err instanceof Error ? err.message : String(err));
|
|
64
|
+
process.exit(1);
|
|
82
65
|
}
|
|
83
|
-
main();
|