optiprune 2.4.0 → 2.6.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![OptiPrune analyzer animation](https://raw.githubusercontent.com/optiprune/core/main/animation.svg)
2
2
 
3
- [![CLI npm version](https://img.shields.io/npm/v/%40optiprune%2Fcli?label=%40optiprune%2Fcli)](https://www.npmjs.com/package/@optiprune/cli)[![Core npm version](https://img.shields.io/npm/v/%40optiprune%2Fcore?label=%40optiprune%2Fcore)](https://www.npmjs.com/package/@optiprune/core)[![CLI package](https://img.shields.io/github/package-json/v/optiprune/cli?label=CLI%20package)](https://github.com/optiprune/cli)[![Core tests](https://img.shields.io/github/actions/workflow/status/optiprune/core/tests.yml?branch=main&label=core%20tests)](https://github.com/optiprune/core/actions/workflows/tests.yml)[![License](https://img.shields.io/github/license/optiprune/cli)](./LICENSE)[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D21-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
3
+ [![CLI npm version](https://img.shields.io/npm/v/%40optiprune%2Fcli?label=%40optiprune%2Fcli)](https://www.npmjs.com/package/@optiprune/cli)[![Core npm version](https://img.shields.io/npm/v/%40optiprune%2Fcore?label=%40optiprune%2Fcore)](https://www.npmjs.com/package/@optiprune/core)[![CLI package](https://img.shields.io/github/package-json/v/optiprune/cli?label=CLI%20package)](https://github.com/optiprune/cli)[![Core tests](https://img.shields.io/github/actions/workflow/status/optiprune/core/tests-push.yml?branch=main&label=core%20tests)](https://github.com/optiprune/core/actions/workflows/tests-push.yml)[![License](https://img.shields.io/github/license/optiprune/cli)](./LICENSE)[![Node.js](https://img.shields.io/badge/Node.js-%3E%3D20-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
4
4
 
5
5
  # OptiPrune
6
6
 
@@ -85,19 +85,18 @@ npx @optiprune/cli analyze --sarif > optiprune.sarif
85
85
  | `--fail-on <confidence>` | Exit non-zero when findings meet the selected confidence level: `high`, `medium`, `low`, or `none`. | `high` |
86
86
  | `--json` | Print the structured analysis report as JSON. | Disabled |
87
87
  | `--sarif` | Print SARIF output. | Disabled |
88
- | `--skip-3` | Skip the SMT constraint-analysis layer. | Disabled |
89
- | `--skip-4` | Skip the concolic execution-proof layer. | Disabled |
88
+ | `--skip <layers...>` | Skip analysis layers `3`, `4`, or `smt`; `smt` also skips layer `3`. | Disabled |
90
89
  | `-v, --verbose` | Print verbose output and internal graph state; with `--json`, include structured `debug` diagnostics in the report. | Disabled |
91
90
  | `--fix <rules...>` | Select fix targets: `files`, `exports`, `dependencies`, `devDependencies`, `conditions`, or `json`. | None |
92
91
  | `--fix-json` | Safely repair recoverable `package.json` JSON errors; shorthand for `--fix json`. | Disabled |
93
- | `--node-llama-cpp` | Force-enable the dedicated node-llama-cpp semantic analysis plugin. | Disabled |
92
+ | `--plugins <names...>` | Force-enable one or more built-in plugins, such as `--plugins astro vite vitest`. Names may omit the `-plugin` suffix; unknown names produce `Did you mean ...?` when a familiar match exists, otherwise `No Plugin found with the name ...`. | Disabled |
94
93
  | `--confidence <level>` | Minimum fix confidence: `high`, `medium+`, `low+`, or `all`. | `high` |
95
94
  | `--force` | Allow a selected fix when the source edit is otherwise considered unsafe. | Disabled |
96
95
  | `--dry-run` | Log planned fixes without changing files. | Disabled |
97
96
  | `--cache-from <path>` | Import a JSON cache before analysis. | None |
98
97
  | `--cache-to <path>` | Export the resulting cache after analysis. | None |
99
98
 
100
- `--confidence`, `--force`, and `--dry-run` require `--fix` or `--fix-json`. Unknown fix targets are rejected before analysis begins.
99
+ `--confidence`, `--force`, and `--dry-run` require `--fix` or `--fix-json`. Unknown fix targets are rejected before analysis begins. `--plugins` is repeatable in one invocation and force-enables the named built-in plugins without changing other plugin settings from project configuration.
101
100
 
102
101
  ## Fixes
103
102
 
@@ -214,4 +213,4 @@ The Core repository uses Vitest for its test suite. The workflow badges above re
214
213
  | CLI package | [npmjs.com/package/@optiprune/cli](https://www.npmjs.com/package/@optiprune/cli) |
215
214
  | Core package | [npmjs.com/package/@optiprune/core](https://www.npmjs.com/package/@optiprune/core) |
216
215
  | Documentation site | [opti.drml.int.yt](https://opti.drml.int.yt/) |
217
- | License | [MIT](./LICENSE) |
216
+ | License | [MIT](./LICENSE) |
package/config.md CHANGED
@@ -123,17 +123,19 @@ Configures the automatic removal of dead code. Can be a boolean or an object for
123
123
 
124
124
  **5. Plugin Overrides (plugins)**
125
125
 
126
- Enable or disable an installed source-aware plugin explicitly. For the dedicated node-llama-cpp semantic analysis plugin, use:
126
+ Enable or disable an installed source-aware plugin explicitly. Use the canonical plugin name, including the `-plugin` suffix:
127
127
 
128
128
  ```json
129
129
  {
130
130
  "plugins": {
131
- "node-llama-cpp-plugin": true
131
+ "astro-plugin": true,
132
+ "vite-plugin": true,
133
+ "vitest-plugin": true
132
134
  }
133
135
  }
134
136
  ```
135
137
 
136
- The CLI equivalent is `--node-llama-cpp`.
138
+ The CLI equivalent is repeatable and accepts short names without the suffix: `--plugins astro vite vitest`. Each requested plugin is force-enabled. An unknown name produces `Did you mean ...?` when a familiar match exists; otherwise the CLI reports `No Plugin found with the name ...`.
137
139
 
138
140
  **6. Rule Overrides (rules)**Fine-tune or disable specific inspection rules:
139
141
 
package/dist/cli.js CHANGED
@@ -2,10 +2,9 @@
2
2
  import path from "pathe";
3
3
  import fs from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
5
- import { Command } from "commander";
6
- const program = new Command();
5
+ import { parseArgs } from "node:util";
6
+ import { assertPluginsExist } from "./plugin-resolution.js";
7
7
  const FIX_TARGETS = new Set(["files", "exports", "dependencies", "devDependencies", "conditions", "json"]);
8
- // Test and fixture patterns defined directly in the CLI
9
8
  const TEST_IGNORE_PATTERNS = [
10
9
  "**/test/**",
11
10
  "**/tests/**",
@@ -20,8 +19,6 @@ const TEST_IGNORE_PATTERNS = [
20
19
  "**/*.spec.tsx",
21
20
  "**/*.spec.jsx",
22
21
  ];
23
- // Using @ts-ignore for core imports as CI environments sometimes struggle
24
- // with subpath exports resolution in strict NodeNext mode.
25
22
  // @ts-ignore
26
23
  import { analyze, shouldFail, exportCache, importCache, loadConfig, mergeConfig, DEFAULT_CONFIG } from "@optiprune/core";
27
24
  // @ts-ignore
@@ -31,7 +28,6 @@ const bold = (s) => `\x1b[1m${s}\x1b[0m`;
31
28
  const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
32
29
  const red = (s) => `\x1b[31m${s}\x1b[0m`;
33
30
  const dim = (s) => `\x1b[2m${s}\x1b[0m`;
34
- // Helper to find the CLI package version
35
31
  function getCliVersion() {
36
32
  try {
37
33
  const currentDir = path.dirname(fileURLToPath(import.meta.url));
@@ -49,7 +45,6 @@ function getCliVersion() {
49
45
  catch (e) { }
50
46
  return "unknown";
51
47
  }
52
- // Helper to find the core version safely
53
48
  function getCoreVersion(rootDir) {
54
49
  try {
55
50
  const localCore = path.join(rootDir, "node_modules/@optiprune/core/package.json");
@@ -71,189 +66,325 @@ function getCoreVersion(rootDir) {
71
66
  catch (e) { }
72
67
  return "1.12.1";
73
68
  }
74
- const cliVersion = getCliVersion();
75
- const coreVersion = getCoreVersion(process.cwd());
76
- program
77
- .name("optiprune")
78
- .description("Finds dead code in TypeScript/JavaScript projects.")
79
- .version(`CLI: ${cliVersion}, Core: ${coreVersion}`, "-V, --version", "output the version number");
80
- program
81
- .command("analyze", { isDefault: true })
82
- .description("Perform full analysis of the project")
83
- .option("-r, --rootDir <path>", "Root directory of the project", process.cwd())
84
- .option("-e, --entry <patterns...>", "Entry point patterns (glob or file paths)", undefined)
85
- .option("-x, --extensions <exts...>", "File extensions to analyze", [".ts", ".tsx", ".js", ".jsx", ".vue"])
86
- .option("-i, --ignore <patterns...>", "Ignore patterns (glob)", undefined)
87
- .option("--no-report-unused-exports", "Do not report unused exports")
88
- .option("--no-conventional-entries", "Do not include conventional entry points (e.g., src/index.ts)")
89
- .option("--include-entry-exports", "Report unused exports declared directly in entry files")
90
- .option("--include-entry-members", "Report unused members declared in objects exported directly from entry files")
91
- .option("--cycles", "Print detected dependency cycles")
92
- .option("--ignore-tests", "Ignore test files such as test.ts, *.test.ts, fixtures, and __tests__ files")
93
- .option("--ignore-unknown-import", "Ignore dynamic and unknown import patterns for reachability")
94
- .option("--fail-on <confidence>", "Fail on findings with confidence level (high, medium, low, none)", "high")
95
- .option("--json", "Output results as JSON")
96
- .option("--sarif", "Output results in SARIF format")
97
- .option("--skip <layers...>", "Skip analysis layers (3, 4, or smt)")
98
- .option("-v, --verbose", "Show verbose output and internal graph state; with --json includes structured debug diagnostics")
99
- .option("--fix <rules...>", "Fix selected targets: files, exports, dependencies, devDependencies, conditions, json")
100
- .option("--fix-json", "Safely repair recoverable package.json JSON errors (equivalent to --fix json)")
101
- .option("--node-llama-cpp", "Force-enable the dedicated node-llama-cpp semantic analysis plugin")
102
- .option("--confidence <level>", "Minimum confidence to fix (high, medium+, low+, all)", "high")
103
- .option("--force", "Allow fixes when the source edit is otherwise considered unsafe")
104
- .option("--dry-run", "Log what would be fixed without changing files")
105
- .option("--cache-from <path>", "Path to a JSON file to import cache from before analysis")
106
- .option("--cache-to <path>", "Path to export the resulting cache to after analysis")
107
- .action(async (options, command) => {
108
- try {
109
- const isCliOverride = (name) => command.getOptionValueSource(name) === "cli";
110
- const targetRootDir = path.resolve(options.rootDir ?? process.cwd());
111
- // 1. Read project config via core's loadConfig
112
- const fileConfig = typeof loadConfig === "function" ? await loadConfig(targetRootDir) : {};
113
- // 2. Resolve fix configurations
114
- let fixOption = undefined;
115
- const hasExplicitFix = isCliOverride("fix");
116
- const hasJsonFix = isCliOverride("fixJson") && !!options.fixJson;
117
- const hasFixFlags = hasExplicitFix || hasJsonFix || isCliOverride("confidence") || isCliOverride("force") || isCliOverride("dryRun");
118
- if (hasFixFlags) {
119
- if (!hasExplicitFix && !hasJsonFix) {
120
- throw new Error("--confidence, --force, and --dry-run require --fix <target...> or --fix-json");
121
- }
122
- const requestedTargets = [
123
- ...(hasExplicitFix ? options.fix : []),
124
- ...(hasJsonFix ? ["json"] : []),
125
- ];
126
- const invalidTargets = requestedTargets.filter((target) => !FIX_TARGETS.has(target));
127
- if (invalidTargets.length > 0) {
128
- throw new Error(`Unknown --fix target(s): ${invalidTargets.join(", ")}. Choose files, exports, dependencies, devDependencies, conditions, or json.`);
129
- }
130
- fixOption = {
131
- confidence: options.confidence,
132
- rules: [...new Set(requestedTargets)],
133
- force: !!options.force,
134
- dryRun: !!options.dryRun,
135
- };
136
- }
137
- // 3. Determine if test ignoring is active (CLI flag OR config file setting)
138
- const shouldIgnoreTests = isCliOverride("ignoreTests")
139
- ? !!options.ignoreTests
140
- : !!fileConfig.ignoreTests;
141
- // 4. Resolve ignore patterns directly in the CLI
142
- let mergedIgnore = undefined;
143
- const cliIgnore = isCliOverride("ignore") ? options.ignore : undefined;
144
- const baseIgnore = cliIgnore ?? (Array.isArray(fileConfig.ignore) ? fileConfig.ignore : []);
145
- if (shouldIgnoreTests || baseIgnore.length > 0) {
146
- const testGlobs = shouldIgnoreTests ? TEST_IGNORE_PATTERNS : [];
147
- mergedIgnore = Array.from(new Set([...testGlobs, ...baseIgnore]));
69
+ function printHelp() {
70
+ console.log(`
71
+ Usage: optiprune [command] [options]
72
+
73
+ Finds dead code in TypeScript/JavaScript projects.
74
+
75
+ Commands:
76
+ analyze [options] Perform full analysis of the project (default)
77
+ export-cache <targetPath> Export current analysis cache to a JSON file
78
+ import-cache <sourcePath> Import cache JSON file into local directory
79
+
80
+ Options:
81
+ -V, --version Output the version number
82
+ -h, --help Display this help text
83
+
84
+ Analyze Options:
85
+ -r, --rootDir <path> Root directory of project (default: cwd)
86
+ -e, --entry <patterns...> Entry point patterns
87
+ -x, --extensions <exts...> Extensions to analyze (default: .ts .tsx .js .jsx .vue)
88
+ -i, --ignore <patterns...> Ignore patterns (glob)
89
+ --no-report-unused-exports Do not report unused exports
90
+ --no-conventional-entries Do not include conventional entry points
91
+ --include-entry-exports Report unused exports in entry files
92
+ --include-entry-members Report unused members in entry files
93
+ --cycles Print detected dependency cycles
94
+ --ignore-tests Ignore test files and fixtures
95
+ --ignore-unknown-import Ignore dynamic/unknown import reachability
96
+ --fail-on <confidence> Fail confidence: high, medium, low, none (default: high)
97
+ --json Output results as JSON
98
+ --sarif Output results in SARIF format
99
+ --skip <layers...> Skip analysis layers: 3, 4, smt
100
+ -v, --verbose Show verbose output and internal graph state
101
+ --fix <rules...> Fix targets: files, exports, dependencies, etc.
102
+ --fix-json Safely repair recoverable package.json JSON errors
103
+ --plugins <names...> Force-enable plugins by name (e.g. astro vite vitest)
104
+ --confidence <level> Min fix confidence: high, medium+, low+, all (default: high)
105
+ --force Allow unsafe fixes
106
+ --dry-run Log fixes without writing files
107
+ --cache-from <path> Import cache JSON prior to analysis
108
+ --cache-to <path> Export resulting cache to JSON after analysis
109
+ `);
110
+ }
111
+ /** Preprocesses arguments so variadic flags work like Commander (e.g., `--extensions .ts .tsx`) */
112
+ function normalizeVariadicFlags(args, variadicNames) {
113
+ const result = [];
114
+ const variadicSet = new Set(variadicNames);
115
+ let currentFlag = null;
116
+ for (let i = 0; i < args.length; i++) {
117
+ const arg = args[i];
118
+ if (arg.startsWith("-")) {
119
+ const flagName = arg.split("=")[0].replace(/^-+/, "");
120
+ currentFlag = variadicSet.has(flagName) ? arg.split("=")[0] : null;
121
+ result.push(arg);
148
122
  }
149
- // 5. Build CLI overrides
150
- const skipValues = isCliOverride("skip") ? options.skip : [];
151
- const invalidSkipValues = skipValues.filter((value) => !["3", "4", "smt"].includes(value.toLowerCase()));
152
- if (invalidSkipValues.length > 0) {
153
- throw new Error(`Unknown --skip value(s): ${invalidSkipValues.join(", ")}. Choose 3, 4, or smt.`);
123
+ else if (currentFlag && !arg.startsWith("-")) {
124
+ result.push(currentFlag, arg);
154
125
  }
155
- const skipLayers = {
156
- ...(fileConfig.layers ?? {}),
157
- ...(skipValues.some((value) => value === "3") && { skip3: true }),
158
- ...(skipValues.some((value) => value === "4") && { skip4: true }),
159
- ...(skipValues.some((value) => value.toLowerCase() === "smt") && { skipSmt: true, skip3: true }),
160
- };
161
- const cliOverrides = {
162
- ...(isCliOverride("rootDir") && { rootDir: targetRootDir }),
163
- ...(isCliOverride("entry") && { entry: options.entry }),
164
- ...(isCliOverride("extensions") && { extensions: options.extensions }),
165
- ...(mergedIgnore !== undefined && { ignore: mergedIgnore }),
166
- ...(shouldIgnoreTests && { ignoreTests: true }),
167
- ...(isCliOverride("reportUnusedExports") && {
168
- reportUnusedExports: options.reportUnusedExports,
169
- }),
170
- ...(isCliOverride("conventionalEntries") && {
171
- includeConventionalEntries: options.conventionalEntries,
172
- }),
173
- ...(isCliOverride("includeEntryExports") && { includeEntryExports: options.includeEntryExports }),
174
- ...(isCliOverride("includeEntryMembers") && { includeEntryMembers: options.includeEntryMembers }),
175
- ...(isCliOverride("cycles") && { cycles: options.cycles }),
176
- ...(isCliOverride("ignoreUnknownImport") && { ignoreUnknownImport: options.ignoreUnknownImport }),
177
- ...(isCliOverride("failOn") && { failOn: options.failOn }),
178
- ...(isCliOverride("json") && { json: options.json }),
179
- ...(isCliOverride("skip") && { layers: skipLayers }),
180
- ...(isCliOverride("verbose") && { verbose: options.verbose }),
181
- ...(isCliOverride("nodeLlamaCpp") && { plugins: { ...(fileConfig.plugins ?? {}), "node-llama-cpp-plugin": !!options.nodeLlamaCpp } }),
182
- ...(fixOption !== undefined && { fix: fixOption }),
183
- ...(isCliOverride("cacheFrom") && { cacheFrom: options.cacheFrom }),
184
- ...(isCliOverride("cacheTo") && { cacheTo: options.cacheTo }),
185
- };
186
- // 6. Merge DEFAULT_CONFIG -> fileConfig -> cliOverrides
187
- const baseConfig = {
188
- ...DEFAULT_CONFIG,
189
- rootDir: targetRootDir,
190
- entry: [...DEFAULT_CONFIG.entry],
191
- extensions: [...DEFAULT_CONFIG.extensions],
192
- ignore: [...DEFAULT_CONFIG.ignore],
193
- ignoreDependencies: [...DEFAULT_CONFIG.ignoreDependencies],
194
- packageIgnoreDependencies: new Map(DEFAULT_CONFIG.packageIgnoreDependencies),
195
- externalContracts: [...DEFAULT_CONFIG.externalContracts],
196
- pathAliases: new Map(DEFAULT_CONFIG.pathAliases),
197
- packageImports: new Map(DEFAULT_CONFIG.packageImports),
198
- layers: { ...DEFAULT_CONFIG.layers },
199
- rules: { ...DEFAULT_CONFIG.rules },
200
- plugins: { ...DEFAULT_CONFIG.plugins },
201
- workspaceGlobs: [...DEFAULT_CONFIG.workspaceGlobs],
202
- projectPatterns: [...DEFAULT_CONFIG.projectPatterns],
203
- unreachableFileIgnorePatterns: [...DEFAULT_CONFIG.unreachableFileIgnorePatterns],
204
- protectedExportPatterns: [...DEFAULT_CONFIG.protectedExportPatterns],
205
- frameworks: [...DEFAULT_CONFIG.frameworks],
206
- };
207
- const resolvedWithFile = mergeConfig(baseConfig, fileConfig);
208
- const finalConfig = mergeConfig(resolvedWithFile, cliOverrides);
209
- const report = await analyze(finalConfig);
210
- if (options.sarif) {
211
- console.log(formatSarif(report));
126
+ else {
127
+ currentFlag = null;
128
+ result.push(arg);
212
129
  }
213
- else if (finalConfig.json || options.json) {
214
- console.log(JSON.stringify(report, (k, v) => typeof v === 'bigint' ? v.toString() : v, 2));
130
+ }
131
+ return result;
132
+ }
133
+ async function runAnalyze(args) {
134
+ const normalizedArgs = normalizeVariadicFlags(args, ["entry", "e", "extensions", "x", "ignore", "i", "skip", "fix", "plugins"]);
135
+ const optionsConfig = {
136
+ help: { type: "boolean", short: "h" },
137
+ rootDir: { type: "string", short: "r" },
138
+ entry: { type: "string", short: "e", multiple: true },
139
+ extensions: { type: "string", short: "x", multiple: true },
140
+ ignore: { type: "string", short: "i", multiple: true },
141
+ "report-unused-exports": { type: "boolean", default: true },
142
+ "no-report-unused-exports": { type: "boolean" },
143
+ "conventional-entries": { type: "boolean", default: true },
144
+ "no-conventional-entries": { type: "boolean" },
145
+ "include-entry-exports": { type: "boolean" },
146
+ "include-entry-members": { type: "boolean" },
147
+ cycles: { type: "boolean" },
148
+ "ignore-tests": { type: "boolean" },
149
+ "ignore-unknown-import": { type: "boolean" },
150
+ "fail-on": { type: "string", default: "high" },
151
+ json: { type: "boolean" },
152
+ sarif: { type: "boolean" },
153
+ skip: { type: "string", multiple: true },
154
+ verbose: { type: "boolean", short: "v" },
155
+ fix: { type: "string", multiple: true },
156
+ "fix-json": { type: "boolean" },
157
+ plugins: { type: "string", multiple: true },
158
+ confidence: { type: "string", default: "high" },
159
+ force: { type: "boolean" },
160
+ "dry-run": { type: "boolean" },
161
+ "cache-from": { type: "string" },
162
+ "cache-to": { type: "string" },
163
+ };
164
+ const { values } = parseArgs({
165
+ args: normalizedArgs,
166
+ options: optionsConfig,
167
+ strict: true,
168
+ allowPositionals: false,
169
+ });
170
+ if (values.help) {
171
+ printHelp();
172
+ return;
173
+ }
174
+ // Checks both long form (--rootDir) and short alias (-r)
175
+ const isCliOverride = (longFlag, shortFlag) => {
176
+ return args.some((arg) => {
177
+ const base = arg.split("=")[0];
178
+ return (base === `--${longFlag}` ||
179
+ base === `--no-${longFlag}` ||
180
+ (shortFlag ? base === `-${shortFlag}` : false));
181
+ });
182
+ };
183
+ const targetRootDir = path.resolve(values.rootDir ?? process.cwd());
184
+ // 1. Read project config via core's loadConfig
185
+ const fileConfig = typeof loadConfig === "function" ? await loadConfig(targetRootDir) : {};
186
+ // 2. Resolve fix configurations
187
+ let fixOption = undefined;
188
+ const hasExplicitFix = isCliOverride("fix");
189
+ const hasJsonFix = isCliOverride("fix-json") && Boolean(values["fix-json"]);
190
+ const hasFixFlags = hasExplicitFix || hasJsonFix || isCliOverride("confidence") || isCliOverride("force") || isCliOverride("dry-run");
191
+ if (hasFixFlags) {
192
+ if (!hasExplicitFix && !hasJsonFix) {
193
+ throw new Error("--confidence, --force, and --dry-run require --fix <target...> or --fix-json");
215
194
  }
216
- else {
217
- const terminal = formatTerminal(report, { showCycles: !!finalConfig.cycles });
218
- console.log(terminal);
195
+ const requestedTargets = [
196
+ ...(hasExplicitFix && Array.isArray(values.fix) ? values.fix : []),
197
+ ...(hasJsonFix ? ["json"] : []),
198
+ ];
199
+ const invalidTargets = requestedTargets.filter((target) => !FIX_TARGETS.has(target));
200
+ if (invalidTargets.length > 0) {
201
+ throw new Error(`Unknown --fix target(s): ${invalidTargets.join(", ")}. Choose files, exports, dependencies, devDependencies, conditions, or json.`);
219
202
  }
220
- if (shouldFail(report, (finalConfig.failOn ?? options.failOn)))
221
- process.exit(1);
203
+ fixOption = {
204
+ confidence: values.confidence ?? "high",
205
+ rules: [...new Set(requestedTargets)],
206
+ force: Boolean(values.force),
207
+ dryRun: Boolean(values["dry-run"]),
208
+ };
222
209
  }
223
- catch (error) {
224
- console.error("An unexpected error occurred during analysis:", error);
225
- process.exit(1);
210
+ // 3. Determine if test ignoring is active
211
+ const shouldIgnoreTests = isCliOverride("ignore-tests")
212
+ ? Boolean(values["ignore-tests"])
213
+ : Boolean(fileConfig.ignoreTests);
214
+ // 4. Resolve ignore patterns
215
+ let mergedIgnore = undefined;
216
+ const cliIgnore = isCliOverride("ignore", "i") ? values.ignore : undefined;
217
+ const baseIgnore = cliIgnore ?? (Array.isArray(fileConfig.ignore) ? fileConfig.ignore : []);
218
+ if (shouldIgnoreTests || baseIgnore.length > 0) {
219
+ const testGlobs = shouldIgnoreTests ? TEST_IGNORE_PATTERNS : [];
220
+ mergedIgnore = Array.from(new Set([...testGlobs, ...baseIgnore]));
226
221
  }
227
- });
228
- program
229
- .command("export-cache <targetPath>")
230
- .description("Export the current analysis cache to a JSON file")
231
- .option("-r, --rootDir <path>", "Root directory of the project", process.cwd())
232
- .action(async (targetPath, options) => {
233
- try {
234
- const rootDir = options.rootDir ?? process.cwd();
235
- await exportCache(rootDir, targetPath);
236
- console.log(`${yellow("✔")} Cache exported to ${bold(targetPath)}`);
222
+ // 5. Resolve explicitly requested plugins
223
+ const requestedPlugins = isCliOverride("plugins") ? (values.plugins ?? []) : [];
224
+ const resolvedPlugins = requestedPlugins.length > 0 ? assertPluginsExist(requestedPlugins) : [];
225
+ // 6. Build CLI overrides
226
+ const skipValues = isCliOverride("skip") ? (values.skip ?? []) : [];
227
+ const invalidSkipValues = skipValues.filter((value) => !["3", "4", "smt"].includes(value.toLowerCase()));
228
+ if (invalidSkipValues.length > 0) {
229
+ throw new Error(`Unknown --skip value(s): ${invalidSkipValues.join(", ")}. Choose 3, 4, or smt.`);
237
230
  }
238
- catch (error) {
239
- console.error("Failed to export cache:", error);
231
+ const skipLayers = {
232
+ ...(fileConfig.layers ?? {}),
233
+ ...(skipValues.some((value) => value === "3") && { skip3: true }),
234
+ ...(skipValues.some((value) => value === "4") && { skip4: true }),
235
+ ...(skipValues.some((value) => value.toLowerCase() === "smt") && { skipSmt: true, skip3: true }),
236
+ };
237
+ const reportUnusedExports = values["no-report-unused-exports"] ? false : Boolean(values["report-unused-exports"]);
238
+ const conventionalEntries = values["no-conventional-entries"] ? false : Boolean(values["conventional-entries"]);
239
+ const cliOverrides = {
240
+ ...(isCliOverride("rootDir", "r") && { rootDir: targetRootDir }),
241
+ ...(isCliOverride("entry", "e") && values.entry && { entry: values.entry }),
242
+ ...(isCliOverride("extensions", "x")
243
+ ? values.extensions ? { extensions: values.extensions } : {}
244
+ : { extensions: [".ts", ".tsx", ".js", ".jsx", ".vue"] }),
245
+ ...(mergedIgnore !== undefined && { ignore: mergedIgnore }),
246
+ ...(shouldIgnoreTests && { ignoreTests: true }),
247
+ ...(isCliOverride("report-unused-exports") && { reportUnusedExports }),
248
+ ...(isCliOverride("conventional-entries") && { includeConventionalEntries: conventionalEntries }),
249
+ ...(isCliOverride("include-entry-exports") && { includeEntryExports: Boolean(values["include-entry-exports"]) }),
250
+ ...(isCliOverride("include-entry-members") && { includeEntryMembers: Boolean(values["include-entry-members"]) }),
251
+ ...(isCliOverride("cycles") && { cycles: Boolean(values.cycles) }),
252
+ ...(isCliOverride("ignore-unknown-import") && { ignoreUnknownImport: Boolean(values["ignore-unknown-import"]) }),
253
+ ...(isCliOverride("fail-on") && values["fail-on"] && { failOn: values["fail-on"] }),
254
+ ...(isCliOverride("json") && { json: Boolean(values.json) }),
255
+ ...(isCliOverride("skip") && { layers: skipLayers }),
256
+ ...(isCliOverride("verbose", "v") && { verbose: Boolean(values.verbose) }),
257
+ ...(isCliOverride("plugins") && {
258
+ plugins: {
259
+ ...(fileConfig.plugins ?? {}),
260
+ ...Object.fromEntries(resolvedPlugins.map((plugin) => [plugin, true])),
261
+ },
262
+ }),
263
+ ...(fixOption !== undefined && { fix: fixOption }),
264
+ ...(isCliOverride("cache-from") && values["cache-from"] && { cacheFrom: values["cache-from"] }),
265
+ ...(isCliOverride("cache-to") && values["cache-to"] && { cacheTo: values["cache-to"] }),
266
+ };
267
+ // 7. Merge DEFAULT_CONFIG -> fileConfig -> cliOverrides
268
+ const baseConfig = {
269
+ ...DEFAULT_CONFIG,
270
+ rootDir: targetRootDir,
271
+ entry: [...DEFAULT_CONFIG.entry],
272
+ extensions: [...DEFAULT_CONFIG.extensions],
273
+ ignore: [...DEFAULT_CONFIG.ignore],
274
+ ignoreDependencies: [...DEFAULT_CONFIG.ignoreDependencies],
275
+ packageIgnoreDependencies: new Map(DEFAULT_CONFIG.packageIgnoreDependencies),
276
+ externalContracts: [...DEFAULT_CONFIG.externalContracts],
277
+ pathAliases: new Map(DEFAULT_CONFIG.pathAliases),
278
+ packageImports: new Map(DEFAULT_CONFIG.packageImports),
279
+ layers: { ...DEFAULT_CONFIG.layers },
280
+ rules: { ...DEFAULT_CONFIG.rules },
281
+ plugins: { ...DEFAULT_CONFIG.plugins },
282
+ workspaceGlobs: [...DEFAULT_CONFIG.workspaceGlobs],
283
+ projectPatterns: [...DEFAULT_CONFIG.projectPatterns],
284
+ unreachableFileIgnorePatterns: [...DEFAULT_CONFIG.unreachableFileIgnorePatterns],
285
+ protectedExportPatterns: [...DEFAULT_CONFIG.protectedExportPatterns],
286
+ frameworks: [...DEFAULT_CONFIG.frameworks],
287
+ };
288
+ const resolvedWithFile = mergeConfig(baseConfig, fileConfig);
289
+ const finalConfig = mergeConfig(resolvedWithFile, cliOverrides);
290
+ const report = await analyze(finalConfig);
291
+ if (values.sarif) {
292
+ console.log(formatSarif(report));
293
+ }
294
+ else if (finalConfig.json || values.json) {
295
+ console.log(JSON.stringify(report, (k, v) => typeof v === "bigint" ? v.toString() : v, 2));
296
+ }
297
+ else {
298
+ const terminal = formatTerminal(report, { showCycles: Boolean(finalConfig.cycles) });
299
+ console.log(terminal);
300
+ }
301
+ const failTarget = (finalConfig.failOn ?? values["fail-on"] ?? "high");
302
+ if (shouldFail(report, failTarget)) {
240
303
  process.exit(1);
241
304
  }
242
- });
243
- program
244
- .command("import-cache <sourcePath>")
245
- .description("Import an external cache JSON file into the local directory")
246
- .option("-r, --rootDir <path>", "Root directory of the project", process.cwd())
247
- .action(async (sourcePath, options) => {
305
+ }
306
+ async function runExportCache(args) {
307
+ const { values, positionals } = parseArgs({
308
+ args,
309
+ options: {
310
+ rootDir: { type: "string", short: "r" },
311
+ help: { type: "boolean", short: "h" },
312
+ },
313
+ allowPositionals: true,
314
+ });
315
+ const targetPath = positionals[0];
316
+ if (values.help || !targetPath) {
317
+ console.log("Usage: optiprune export-cache <targetPath> [-r, --rootDir <path>]");
318
+ if (!targetPath && !values.help)
319
+ process.exit(1);
320
+ return;
321
+ }
322
+ const rootDir = values.rootDir ?? process.cwd();
323
+ await exportCache(rootDir, targetPath);
324
+ console.log(`${yellow("✔")} Cache exported to ${bold(targetPath)}`);
325
+ }
326
+ async function runImportCache(args) {
327
+ const { values, positionals } = parseArgs({
328
+ args,
329
+ options: {
330
+ rootDir: { type: "string", short: "r" },
331
+ help: { type: "boolean", short: "h" },
332
+ },
333
+ allowPositionals: true,
334
+ });
335
+ const sourcePath = positionals[0];
336
+ if (values.help || !sourcePath) {
337
+ console.log("Usage: optiprune import-cache <sourcePath> [-r, --rootDir <path>]");
338
+ if (!sourcePath && !values.help)
339
+ process.exit(1);
340
+ return;
341
+ }
342
+ const rootDir = values.rootDir ?? process.cwd();
343
+ await importCache(rootDir, sourcePath);
344
+ console.log(`${yellow("✔")} Cache imported from ${bold(sourcePath)}`);
345
+ }
346
+ async function main() {
347
+ const rawArgs = process.argv.slice(2);
348
+ if (rawArgs.includes("-V") || rawArgs.includes("--version")) {
349
+ const cliVersion = getCliVersion();
350
+ const coreVersion = getCoreVersion(process.cwd());
351
+ console.log(`CLI: ${cliVersion}, Core: ${coreVersion}`);
352
+ return;
353
+ }
354
+ if (rawArgs.includes("-h") || rawArgs.includes("--help")) {
355
+ printHelp();
356
+ return;
357
+ }
358
+ const firstArg = rawArgs[0];
359
+ const subcommands = new Set(["analyze", "export-cache", "import-cache"]);
360
+ let command = "analyze";
361
+ let commandArgs = rawArgs;
362
+ if (firstArg !== undefined && subcommands.has(firstArg)) {
363
+ command = firstArg;
364
+ commandArgs = rawArgs.slice(1);
365
+ }
248
366
  try {
249
- const rootDir = options.rootDir ?? process.cwd();
250
- await importCache(rootDir, sourcePath);
251
- console.log(`${yellow("✔")} Cache imported from ${bold(sourcePath)}`);
367
+ switch (command) {
368
+ case "analyze":
369
+ await runAnalyze(commandArgs);
370
+ break;
371
+ case "export-cache":
372
+ await runExportCache(commandArgs);
373
+ break;
374
+ case "import-cache":
375
+ await runImportCache(commandArgs);
376
+ break;
377
+ }
252
378
  }
253
379
  catch (error) {
254
- console.error("Failed to import cache:", error);
380
+ if (command === "analyze") {
381
+ console.error("An unexpected error occurred during analysis:", error);
382
+ }
383
+ else {
384
+ console.error(error?.message ?? error);
385
+ }
255
386
  process.exit(1);
256
387
  }
257
- });
258
- program.parse(process.argv);
388
+ }
389
+ main();
259
390
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC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B,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface PluginResolution {
2
+ requested: string;
3
+ canonical?: string;
4
+ suggestion?: string;
5
+ }
6
+ /** Discover the plugin modules shipped by the installed Core package. */
7
+ export declare function discoverPluginNames(): string[];
8
+ export declare function resolvePlugins(requested: string[], available?: string[]): PluginResolution[];
9
+ export declare function assertPluginsExist(requested: string[], available?: string[]): string[];
@@ -0,0 +1,75 @@
1
+ import fs from "node:fs";
2
+ import path from "pathe";
3
+ import { createRequire } from "node:module";
4
+ function normalize(value) {
5
+ return value.trim().toLowerCase().replace(/\\/g, "/").replace(/-plugin$/, "");
6
+ }
7
+ function distance(left, right) {
8
+ const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
9
+ for (let row = 1; row <= left.length; row += 1) {
10
+ let diagonal = previous[0] ?? 0;
11
+ previous[0] = row;
12
+ for (let column = 1; column <= right.length; column += 1) {
13
+ const above = previous[column] ?? column;
14
+ const leftValue = left[row - 1] ?? "";
15
+ const rightValue = right[column - 1] ?? "";
16
+ const aboveValue = previous[column] ?? column;
17
+ const leftValueDistance = previous[column - 1] ?? column - 1;
18
+ previous[column] = leftValue === rightValue
19
+ ? diagonal
20
+ : Math.min(diagonal + 1, aboveValue + 1, leftValueDistance + 1);
21
+ diagonal = above;
22
+ }
23
+ }
24
+ return previous[right.length] ?? right.length;
25
+ }
26
+ /** Discover the plugin modules shipped by the installed Core package. */
27
+ export function discoverPluginNames() {
28
+ try {
29
+ const require = createRequire(import.meta.url);
30
+ const corePackage = require.resolve("@optiprune/core/package.json");
31
+ const pluginDir = path.join(path.dirname(corePackage), "dist", "plugins");
32
+ return fs.readdirSync(pluginDir)
33
+ .filter((file) => /(?:-plugin|plugin)\.(?:c?m?js|ts)$/.test(file) && file !== "object-member-plugin.js")
34
+ .map((file) => file.replace(/\.(?:c?m?js|ts)$/, ""))
35
+ .sort();
36
+ }
37
+ catch {
38
+ return [];
39
+ }
40
+ }
41
+ export function resolvePlugins(requested, available = discoverPluginNames()) {
42
+ const byNormalized = new Map(available.map((name) => [normalize(name), name]));
43
+ return requested.map((value) => {
44
+ const key = normalize(value);
45
+ const canonical = byNormalized.get(key);
46
+ if (canonical)
47
+ return { requested: value, canonical };
48
+ let suggestion;
49
+ let bestScore = Number.POSITIVE_INFINITY;
50
+ for (const candidate of available) {
51
+ const candidateKey = normalize(candidate);
52
+ const score = distance(key, candidateKey);
53
+ const threshold = Math.max(2, Math.floor(Math.max(key.length, candidateKey.length) * 0.4));
54
+ if (score <= threshold && score < bestScore) {
55
+ suggestion = candidate;
56
+ bestScore = score;
57
+ }
58
+ }
59
+ return suggestion
60
+ ? { requested: value, suggestion }
61
+ : { requested: value };
62
+ });
63
+ }
64
+ export function assertPluginsExist(requested, available = discoverPluginNames()) {
65
+ const resolutions = resolvePlugins(requested, available);
66
+ const invalid = resolutions.find((resolution) => !resolution.canonical);
67
+ if (invalid) {
68
+ if (invalid.suggestion) {
69
+ throw new Error(`Plugin not found with the name "${invalid.requested}". Did you mean "${invalid.suggestion}"?`);
70
+ }
71
+ throw new Error(`No Plugin found with the name "${invalid.requested}"`);
72
+ }
73
+ return resolutions.map((resolution) => resolution.canonical);
74
+ }
75
+ //# sourceMappingURL=plugin-resolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-resolution.js","sourceRoot":"","sources":["../src/plugin-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,OAAO,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQ5C,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EA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GAAG,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,SAAmB,CAAC,CAAC;AACzE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optiprune",
3
- "version": "2.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "CLI for resilient static dead-code analyzer for TypeScript and JavaScript workspaces.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -69,12 +69,11 @@
69
69
  "./package.json": "./package.json"
70
70
  },
71
71
  "dependencies": {
72
- "@optiprune/core": "^1.13.0",
73
- "commander": "^15.0.0",
72
+ "@optiprune/core": "^1.16.0",
74
73
  "pathe": "2.0.3"
75
74
  },
76
75
  "devDependencies": {
77
- "@types/node": "^22.20.1",
76
+ "@types/node": "^20.0.01",
78
77
  "typescript": "^5.8.3"
79
78
  },
80
79
  "optionalDependencies": {