pkgwise 0.1.0-alpha.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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +17 -0
- package/dist/bin/pkgwise.d.ts +3 -0
- package/dist/bin/pkgwise.d.ts.map +1 -0
- package/dist/bin/pkgwise.js +16 -0
- package/dist/bin/pkgwise.js.map +1 -0
- package/dist/commands/CommandContext.d.ts +9 -0
- package/dist/commands/CommandContext.d.ts.map +1 -0
- package/dist/commands/CommandContext.js +2 -0
- package/dist/commands/CommandContext.js.map +1 -0
- package/dist/commands/createCacheCommand.d.ts +4 -0
- package/dist/commands/createCacheCommand.d.ts.map +1 -0
- package/dist/commands/createCacheCommand.js +58 -0
- package/dist/commands/createCacheCommand.js.map +1 -0
- package/dist/commands/createCompareCommand.d.ts +4 -0
- package/dist/commands/createCompareCommand.d.ts.map +1 -0
- package/dist/commands/createCompareCommand.js +38 -0
- package/dist/commands/createCompareCommand.js.map +1 -0
- package/dist/commands/createDoctorCommand.d.ts +4 -0
- package/dist/commands/createDoctorCommand.d.ts.map +1 -0
- package/dist/commands/createDoctorCommand.js +26 -0
- package/dist/commands/createDoctorCommand.js.map +1 -0
- package/dist/commands/createExplainCommand.d.ts +4 -0
- package/dist/commands/createExplainCommand.d.ts.map +1 -0
- package/dist/commands/createExplainCommand.js +27 -0
- package/dist/commands/createExplainCommand.js.map +1 -0
- package/dist/commands/createInspectCommand.d.ts +4 -0
- package/dist/commands/createInspectCommand.d.ts.map +1 -0
- package/dist/commands/createInspectCommand.js +39 -0
- package/dist/commands/createInspectCommand.js.map +1 -0
- package/dist/commands/createScanCommand.d.ts +4 -0
- package/dist/commands/createScanCommand.d.ts.map +1 -0
- package/dist/commands/createScanCommand.js +65 -0
- package/dist/commands/createScanCommand.js.map +1 -0
- package/dist/createCli.d.ts +12 -0
- package/dist/createCli.d.ts.map +1 -0
- package/dist/createCli.js +41 -0
- package/dist/createCli.js.map +1 -0
- package/dist/exit/mapErrorToExitCode.d.ts +2 -0
- package/dist/exit/mapErrorToExitCode.d.ts.map +1 -0
- package/dist/exit/mapErrorToExitCode.js +31 -0
- package/dist/exit/mapErrorToExitCode.js.map +1 -0
- package/dist/exit/mapPolicyToExitCode.d.ts +3 -0
- package/dist/exit/mapPolicyToExitCode.d.ts.map +1 -0
- package/dist/exit/mapPolicyToExitCode.js +4 -0
- package/dist/exit/mapPolicyToExitCode.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/io/CliIo.d.ts +10 -0
- package/dist/io/CliIo.d.ts.map +1 -0
- package/dist/io/CliIo.js +5 -0
- package/dist/io/CliIo.js.map +1 -0
- package/dist/options/GlobalOptions.d.ts +19 -0
- package/dist/options/GlobalOptions.d.ts.map +1 -0
- package/dist/options/GlobalOptions.js +2 -0
- package/dist/options/GlobalOptions.js.map +1 -0
- package/dist/options/createGlobalOptions.d.ts +3 -0
- package/dist/options/createGlobalOptions.d.ts.map +1 -0
- package/dist/options/createGlobalOptions.js +23 -0
- package/dist/options/createGlobalOptions.js.map +1 -0
- package/dist/options/parseConcurrency.d.ts +2 -0
- package/dist/options/parseConcurrency.d.ts.map +1 -0
- package/dist/options/parseConcurrency.js +12 -0
- package/dist/options/parseConcurrency.js.map +1 -0
- package/dist/options/parseDuration.d.ts +2 -0
- package/dist/options/parseDuration.d.ts.map +1 -0
- package/dist/options/parseDuration.js +17 -0
- package/dist/options/parseDuration.js.map +1 -0
- package/dist/options/parseFindingFilters.d.ts +5 -0
- package/dist/options/parseFindingFilters.d.ts.map +1 -0
- package/dist/options/parseFindingFilters.js +29 -0
- package/dist/options/parseFindingFilters.js.map +1 -0
- package/dist/options/parseOutputFormat.d.ts +3 -0
- package/dist/options/parseOutputFormat.d.ts.map +1 -0
- package/dist/options/parseOutputFormat.js +9 -0
- package/dist/options/parseOutputFormat.js.map +1 -0
- package/dist/options/readGlobalOptions.d.ts +4 -0
- package/dist/options/readGlobalOptions.d.ts.map +1 -0
- package/dist/options/readGlobalOptions.js +9 -0
- package/dist/options/readGlobalOptions.js.map +1 -0
- package/dist/output/renderAnalysisReport.d.ts +8 -0
- package/dist/output/renderAnalysisReport.d.ts.map +1 -0
- package/dist/output/renderAnalysisReport.js +47 -0
- package/dist/output/renderAnalysisReport.js.map +1 -0
- package/dist/output/renderCliError.d.ts +12 -0
- package/dist/output/renderCliError.d.ts.map +1 -0
- package/dist/output/renderCliError.js +22 -0
- package/dist/output/renderCliError.js.map +1 -0
- package/dist/output/renderDoctorReport.d.ts +3 -0
- package/dist/output/renderDoctorReport.d.ts.map +1 -0
- package/dist/output/renderDoctorReport.js +13 -0
- package/dist/output/renderDoctorReport.js.map +1 -0
- package/dist/output/renderFindingExplanation.d.ts +3 -0
- package/dist/output/renderFindingExplanation.d.ts.map +1 -0
- package/dist/output/renderFindingExplanation.js +39 -0
- package/dist/output/renderFindingExplanation.js.map +1 -0
- package/dist/output/renderMarkdownReport.d.ts +4 -0
- package/dist/output/renderMarkdownReport.d.ts.map +1 -0
- package/dist/output/renderMarkdownReport.js +113 -0
- package/dist/output/renderMarkdownReport.js.map +1 -0
- package/dist/output/renderPackageComparison.d.ts +3 -0
- package/dist/output/renderPackageComparison.d.ts.map +1 -0
- package/dist/output/renderPackageComparison.js +41 -0
- package/dist/output/renderPackageComparison.js.map +1 -0
- package/dist/output/renderPackageInspection.d.ts +3 -0
- package/dist/output/renderPackageInspection.d.ts.map +1 -0
- package/dist/output/renderPackageInspection.js +58 -0
- package/dist/output/renderPackageInspection.js.map +1 -0
- package/dist/output/renderSarifReport.d.ts +3 -0
- package/dist/output/renderSarifReport.d.ts.map +1 -0
- package/dist/output/renderSarifReport.js +145 -0
- package/dist/output/renderSarifReport.js.map +1 -0
- package/dist/output/renderStructuredResult.d.ts +3 -0
- package/dist/output/renderStructuredResult.d.ts.map +1 -0
- package/dist/output/renderStructuredResult.js +20 -0
- package/dist/output/renderStructuredResult.js.map +1 -0
- package/dist/output/writeTextOutput.d.ts +3 -0
- package/dist/output/writeTextOutput.d.ts.map +1 -0
- package/dist/output/writeTextOutput.js +22 -0
- package/dist/output/writeTextOutput.js.map +1 -0
- package/dist/runCli.d.ts +11 -0
- package/dist/runCli.d.ts.map +1 -0
- package/dist/runCli.js +60 -0
- package/dist/runCli.js.map +1 -0
- package/package.json +57 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LovlyDev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# PkgWise
|
|
2
|
+
|
|
3
|
+
Explainable, local-first dependency analysis for JavaScript and TypeScript projects.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx pkgwise scan .
|
|
7
|
+
npx pkgwise --concurrency 4 scan . --remote
|
|
8
|
+
npx pkgwise inspect lodash@4.17.20 --remote
|
|
9
|
+
npx pkgwise --offline scan . --remote
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
PkgWise parses project metadata and supported lockfiles without executing dependency code. Remote
|
|
13
|
+
inspection uses the public npm Registry and OSV API. `scan --remote` queries OSV for every unique exact
|
|
14
|
+
package coordinate in the lockfile. Both paths support an owned checksum-validated cache and can be
|
|
15
|
+
run without network access after data has been cached.
|
|
16
|
+
|
|
17
|
+
Node.js 22 or newer is required. This package is an alpha: report and API contracts may still evolve.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkgwise.d.ts","sourceRoot":"","sources":["../../src/bin/pkgwise.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runCli } from '../runCli.js';
|
|
3
|
+
const controller = new AbortController();
|
|
4
|
+
let interruptionCount = 0;
|
|
5
|
+
process.on('SIGINT', () => {
|
|
6
|
+
interruptionCount += 1;
|
|
7
|
+
if (interruptionCount === 1) {
|
|
8
|
+
controller.abort();
|
|
9
|
+
process.exitCode = 130;
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
process.exit(130);
|
|
13
|
+
});
|
|
14
|
+
const exitCode = await runCli(process.argv.slice(2), { signal: controller.signal });
|
|
15
|
+
process.exitCode = controller.signal.aborted ? 130 : exitCode;
|
|
16
|
+
//# sourceMappingURL=pkgwise.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkgwise.js","sourceRoot":"","sources":["../../src/bin/pkgwise.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;IACxB,iBAAiB,IAAI,CAAC,CAAC;IACvB,IAAI,iBAAiB,KAAK,CAAC,EAAE,CAAC;QAC5B,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC;QACvB,OAAO;IACT,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC;AAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;AACpF,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PkgWiseClient } from '@lovlydev/pkgwise-core';
|
|
2
|
+
import type { CliIo } from '../io/CliIo.js';
|
|
3
|
+
export interface CommandContext {
|
|
4
|
+
readonly client: PkgWiseClient;
|
|
5
|
+
readonly io: CliIo;
|
|
6
|
+
readonly signal: AbortSignal;
|
|
7
|
+
setExitCode(code: number): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=CommandContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandContext.d.ts","sourceRoot":"","sources":["../../src/commands/CommandContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandContext.js","sourceRoot":"","sources":["../../src/commands/CommandContext.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCacheCommand.d.ts","sourceRoot":"","sources":["../../src/commands/createCacheCommand.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAmDnE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PkgWiseError, } from '@lovlydev/pkgwise-core';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { readGlobalOptions } from '../options/readGlobalOptions.js';
|
|
4
|
+
import { renderStructuredResult } from '../output/renderStructuredResult.js';
|
|
5
|
+
import { writeTextOutput } from '../output/writeTextOutput.js';
|
|
6
|
+
export function createCacheCommand(context) {
|
|
7
|
+
const command = new Command('cache').description('inspect or clear the PkgWise cache');
|
|
8
|
+
command
|
|
9
|
+
.command('status')
|
|
10
|
+
.description('show cache location and usage')
|
|
11
|
+
.action(async (_local, child) => {
|
|
12
|
+
const global = readGlobalOptions(child);
|
|
13
|
+
const report = await context.client.getCacheStatus({
|
|
14
|
+
signal: context.signal,
|
|
15
|
+
...(global.cacheDir === undefined ? {} : { cacheDirectory: global.cacheDir }),
|
|
16
|
+
});
|
|
17
|
+
await writeTextOutput(global.format === 'terminal'
|
|
18
|
+
? renderCacheStatus(report)
|
|
19
|
+
: renderStructuredResult(report, global.format), global.output, context.io);
|
|
20
|
+
});
|
|
21
|
+
command
|
|
22
|
+
.command('clear')
|
|
23
|
+
.description('clear the owned PkgWise cache namespace')
|
|
24
|
+
.option('--provider <id>', 'clear only entries for a provider')
|
|
25
|
+
.option('--yes', 'confirm non-interactively', false)
|
|
26
|
+
.action(async (local, child) => {
|
|
27
|
+
if (!local.yes) {
|
|
28
|
+
throw new PkgWiseError({
|
|
29
|
+
code: 'PW_CLI_INVALID_ARGUMENT',
|
|
30
|
+
userMessage: 'Cache clearing requires --yes because the CLI does not prompt interactively.',
|
|
31
|
+
recoverable: false,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const global = readGlobalOptions(child);
|
|
35
|
+
const result = await context.client.clearCache({
|
|
36
|
+
signal: context.signal,
|
|
37
|
+
...(global.cacheDir === undefined ? {} : { cacheDirectory: global.cacheDir }),
|
|
38
|
+
...(local.provider === undefined ? {} : { provider: local.provider }),
|
|
39
|
+
});
|
|
40
|
+
await writeTextOutput(global.format === 'terminal'
|
|
41
|
+
? renderCacheClear(result)
|
|
42
|
+
: renderStructuredResult(result, global.format), global.output, context.io);
|
|
43
|
+
});
|
|
44
|
+
return command;
|
|
45
|
+
}
|
|
46
|
+
function renderCacheStatus(report) {
|
|
47
|
+
return `${[
|
|
48
|
+
`PkgWise cache · ${report.exists ? (report.owned ? 'owned' : 'unowned') : 'empty'}`,
|
|
49
|
+
'',
|
|
50
|
+
`Path: ${report.path}`,
|
|
51
|
+
`Entries: ${report.entryCount} · ${report.totalBytes} bytes`,
|
|
52
|
+
`Expired: ${report.expiredEntryCount} · corrupt: ${report.corruptEntryCount}`,
|
|
53
|
+
].join('\n')}\n`;
|
|
54
|
+
}
|
|
55
|
+
function renderCacheClear(result) {
|
|
56
|
+
return `PkgWise cache cleared${result.provider === undefined ? '' : ` for ${result.provider}`}: ${result.removedEntries} entries · ${result.removedBytes} bytes\n`;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=createCacheCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCacheCommand.js","sourceRoot":"","sources":["../../src/commands/createCacheCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,GAGb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,MAAM,UAAU,kBAAkB,CAAC,OAAuB;IACxD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,oCAAoC,CAAC,CAAC;IAEvF,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,+BAA+B,CAAC;SAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;YACjD,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,GAAG,CAAC,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;SAC9E,CAAC,CAAC;QACH,MAAM,eAAe,CACnB,MAAM,CAAC,MAAM,KAAK,UAAU;YAC1B,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC;YAC3B,CAAC,CAAC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,EACjD,MAAM,CAAC,MAAM,EACb,OAAO,CAAC,EAAE,CACX,CAAC;IACJ,CAAC,CAA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;QACR,mBAAmB,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE;QACnF,EAAE;QACF,SAAS,MAAM,CAAC,IAAI,EAAE;QACtB,YAAY,MAAM,CAAC,UAAU,MAAM,MAAM,CAAC,UAAU,QAAQ;QAC5D,YAAY,MAAM,CAAC,iBAAiB,eAAe,MAAM,CAAC,iBAAiB,EAAE;KAC9E,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAwB;IAChD,OAAO,wBAAwB,MAAM,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,MAAM,CAAC,QAAQ,EAAE,KAAK,MAAM,CAAC,cAAc,cAAc,MAAM,CAAC,YAAY,UAAU,CAAC;AACrK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCompareCommand.d.ts","sourceRoot":"","sources":["../../src/commands/createCompareCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAyCrE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { readGlobalOptions } from '../options/readGlobalOptions.js';
|
|
3
|
+
import { renderStructuredResult } from '../output/renderStructuredResult.js';
|
|
4
|
+
import { renderPackageComparison } from '../output/renderPackageComparison.js';
|
|
5
|
+
import { writeTextOutput } from '../output/writeTextOutput.js';
|
|
6
|
+
export function createCompareCommand(context) {
|
|
7
|
+
return new Command('compare')
|
|
8
|
+
.description('compare two package candidates with a shared evidence context')
|
|
9
|
+
.argument('<package-a>', 'first package spec')
|
|
10
|
+
.argument('<package-b>', 'second package spec')
|
|
11
|
+
.option('--project <path>', 'project used for compatibility context')
|
|
12
|
+
.option('--target-node <version>', 'target Node.js version')
|
|
13
|
+
.option('--metric <name>', 'include a metric (repeatable)', collect, [])
|
|
14
|
+
.option('--no-recommendation', 'omit the contextual recommendation')
|
|
15
|
+
.action(async (packageA, packageB, local, command) => {
|
|
16
|
+
const global = readGlobalOptions(command);
|
|
17
|
+
const result = await context.client.comparePackages({
|
|
18
|
+
packageA,
|
|
19
|
+
packageB,
|
|
20
|
+
signal: context.signal,
|
|
21
|
+
...(global.config === undefined ? {} : { configFile: global.config }),
|
|
22
|
+
...(local.project === undefined && global.root === undefined
|
|
23
|
+
? {}
|
|
24
|
+
: { projectRoot: local.project ?? global.root }),
|
|
25
|
+
...(local.targetNode === undefined ? {} : { targetNode: local.targetNode }),
|
|
26
|
+
...(local.metric.length === 0 ? {} : { metrics: local.metric }),
|
|
27
|
+
includeRecommendation: local.recommendation,
|
|
28
|
+
});
|
|
29
|
+
const content = global.format === 'terminal'
|
|
30
|
+
? renderPackageComparison(result)
|
|
31
|
+
: renderStructuredResult(result, global.format);
|
|
32
|
+
await writeTextOutput(content, global.output, context.io);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function collect(value, values) {
|
|
36
|
+
return [...values, value];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=createCompareCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCompareCommand.js","sourceRoot":"","sources":["../../src/commands/createCompareCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAA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AC3E,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/D,qBAAqB,EAAE,KAAK,CAAC,cAAc;SAC5C,CAAC,CAAC;QACH,MAAM,OAAO,GACX,MAAM,CAAC,MAAM,KAAK,UAAU;YAC1B,CAAC,CAAC,uBAAuB,CAAC,MAAM,CAAC;YACjC,CAAC,CAAC,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QACpD,MAAM,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5D,CAAC,CACF,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,KAAa,EAAE,MAAgB;IAC9C,OAAO,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDoctorCommand.d.ts","sourceRoot":"","sources":["../../src/commands/createDoctorCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAoBpE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { readGlobalOptions } from '../options/readGlobalOptions.js';
|
|
3
|
+
import { renderDoctorReport } from '../output/renderDoctorReport.js';
|
|
4
|
+
import { renderStructuredResult } from '../output/renderStructuredResult.js';
|
|
5
|
+
import { writeTextOutput } from '../output/writeTextOutput.js';
|
|
6
|
+
export function createDoctorCommand(context) {
|
|
7
|
+
return new Command('doctor')
|
|
8
|
+
.description('run read-only environment and project diagnostics')
|
|
9
|
+
.action(async (_local, command) => {
|
|
10
|
+
const global = readGlobalOptions(command);
|
|
11
|
+
const report = await context.client.diagnose({
|
|
12
|
+
signal: context.signal,
|
|
13
|
+
offline: global.offline,
|
|
14
|
+
...(global.config === undefined ? {} : { configFile: global.config }),
|
|
15
|
+
cache: global.cache,
|
|
16
|
+
...(global.cacheDir === undefined ? {} : { cacheDirectory: global.cacheDir }),
|
|
17
|
+
...(global.root === undefined ? {} : { root: global.root }),
|
|
18
|
+
});
|
|
19
|
+
const content = global.format === 'terminal'
|
|
20
|
+
? renderDoctorReport(report)
|
|
21
|
+
: renderStructuredResult(report, global.format);
|
|
22
|
+
await writeTextOutput(content, global.output, context.io);
|
|
23
|
+
context.setExitCode(report.status === 'degraded' ? 3 : 0);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=createDoctorCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createDoctorCommand.js","sourceRoot":"","sources":["../../src/commands/createDoctorCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACzD,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,mDAAmD,CAAC;SAChE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAChC,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;YAC3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Ac,GAAG,OAAO,CAqBrE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { readGlobalOptions } from '../options/readGlobalOptions.js';
|
|
3
|
+
import { renderStructuredResult } from '../output/renderStructuredResult.js';
|
|
4
|
+
import { renderFindingExplanation } from '../output/renderFindingExplanation.js';
|
|
5
|
+
import { writeTextOutput } from '../output/writeTextOutput.js';
|
|
6
|
+
export function createExplainCommand(context) {
|
|
7
|
+
return new Command('explain')
|
|
8
|
+
.description('explain a finding by fingerprint, rule, or package')
|
|
9
|
+
.argument('<selector>', 'finding fingerprint, rule ID, or package name')
|
|
10
|
+
.option('--project <path>', 'project to analyze')
|
|
11
|
+
.action(async (selector, local, command) => {
|
|
12
|
+
const global = readGlobalOptions(command);
|
|
13
|
+
const result = await context.client.explainFinding({
|
|
14
|
+
selector,
|
|
15
|
+
signal: context.signal,
|
|
16
|
+
...(global.config === undefined ? {} : { configFile: global.config }),
|
|
17
|
+
...(local.project === undefined && global.root === undefined
|
|
18
|
+
? {}
|
|
19
|
+
: { projectRoot: local.project ?? global.root }),
|
|
20
|
+
});
|
|
21
|
+
const content = global.format === 'terminal'
|
|
22
|
+
? renderFindingExplanation(result)
|
|
23
|
+
: renderStructuredResult(result, global.format);
|
|
24
|
+
await writeTextOutput(content, global.output, context.io);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=createExplainCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createExplainCommand.js","sourceRoot":"","sources":["../../src/commands/createExplainCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO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ources":["../../src/commands/createInspectCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAuCrE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { readGlobalOptions } from '../options/readGlobalOptions.js';
|
|
3
|
+
import { renderStructuredResult } from '../output/renderStructuredResult.js';
|
|
4
|
+
import { renderPackageInspection } from '../output/renderPackageInspection.js';
|
|
5
|
+
import { writeTextOutput } from '../output/writeTextOutput.js';
|
|
6
|
+
export function createInspectCommand(context) {
|
|
7
|
+
return new Command('inspect')
|
|
8
|
+
.description('inspect an installed or remote package')
|
|
9
|
+
.argument('<package>', 'package name or exact package spec')
|
|
10
|
+
.option('--all-versions', 'inspect every installed version', false)
|
|
11
|
+
.option('--remote', 'allow remote-only inspection', false)
|
|
12
|
+
.option('--project <path>', 'project used for graph context')
|
|
13
|
+
.option('--paths', 'include dependency paths')
|
|
14
|
+
.option('--no-paths', 'exclude dependency paths')
|
|
15
|
+
.action(async (packageSpec, local, command) => {
|
|
16
|
+
const global = readGlobalOptions(command);
|
|
17
|
+
const result = await context.client.inspectPackage({
|
|
18
|
+
packageSpec,
|
|
19
|
+
signal: context.signal,
|
|
20
|
+
...(global.config === undefined ? {} : { configFile: global.config }),
|
|
21
|
+
offline: global.offline,
|
|
22
|
+
refresh: global.refresh,
|
|
23
|
+
cache: global.cache,
|
|
24
|
+
...(global.cacheDir === undefined ? {} : { cacheDirectory: global.cacheDir }),
|
|
25
|
+
timeoutMs: global.timeout,
|
|
26
|
+
allVersions: local.allVersions,
|
|
27
|
+
remote: local.remote,
|
|
28
|
+
...(local.paths === undefined ? {} : { includePaths: local.paths }),
|
|
29
|
+
...(local.project === undefined && global.root === undefined
|
|
30
|
+
? {}
|
|
31
|
+
: { projectRoot: local.project ?? global.root }),
|
|
32
|
+
});
|
|
33
|
+
const content = global.format === 'terminal'
|
|
34
|
+
? renderPackageInspection(result)
|
|
35
|
+
: renderStructuredResult(result, global.format);
|
|
36
|
+
await writeTextOutput(content, global.output, context.io);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=createInspectCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInspectCommand.js","sourceRoot":"","sources":["../../src/commands/createInspectCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,MAAM,UAAU,oBAAoB,CAAC,OAAuB;IAC1D,OAAO,IAAI,OAAO,CAAC,SAAS,CAAC;SAC1B,WAAW,CAAC,wCAAwC,CAAC;SACrD,QAAQ,CAAC,WAAW,EAAE,oCAAoC,CAAC;SAC3D,MAAM,CAAC,gBAAgB,EAAE,iCAAiC,EAAE,KAAK,CAAC;SAClE,MAAM,CAAC,UAAU,EAAE,8BAA8B,EAAE,KAAK,CAAC;SACzD,MAAM,CAAC,kBAAkB,EAAE,gCAAgC,CAAC;SAC5D,MAAM,CAAC,SAAS,EAAE,0BAA0B,CAAC;SAC7C,MAAM,CAAC,YAAY,EAAE,0BAA0B,CAAC;SAChD,MAAM,CACL,KAAK,EACH,WAAmB,EACnB,KAAmF,EACnF,OAAO,EACP,EAAE;QACF,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC;Y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
|
+
{"version":3,"file":"createScanCommand.d.ts","sourceRoot":"","sources":["../../src/commands/createScanCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAa5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAiFlE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Command, Option } from 'commander';
|
|
2
|
+
import { mapPolicyToExitCode } from '../exit/mapPolicyToExitCode.js';
|
|
3
|
+
import { readGlobalOptions } from '../options/readGlobalOptions.js';
|
|
4
|
+
import { parseFindingPriority, parseFindingSeverity, parseMaximumFindings, } from '../options/parseFindingFilters.js';
|
|
5
|
+
import { renderAnalysisReport } from '../output/renderAnalysisReport.js';
|
|
6
|
+
import { renderMarkdownReport } from '../output/renderMarkdownReport.js';
|
|
7
|
+
import { renderSarifReport } from '../output/renderSarifReport.js';
|
|
8
|
+
import { renderStructuredResult } from '../output/renderStructuredResult.js';
|
|
9
|
+
import { writeTextOutput } from '../output/writeTextOutput.js';
|
|
10
|
+
export function createScanCommand(context) {
|
|
11
|
+
return new Command('scan')
|
|
12
|
+
.description('analyze a project dependency graph')
|
|
13
|
+
.argument('[path]', 'project path', '.')
|
|
14
|
+
.option('--workspace <name>', 'include a workspace (repeatable)', collect, [])
|
|
15
|
+
.addOption(new Option('--include-dev', 'include development dependencies').conflicts('production'))
|
|
16
|
+
.addOption(new Option('--production', 'analyze production dependencies only').conflicts('includeDev'))
|
|
17
|
+
.addOption(new Option('--severity <level>', 'minimum displayed severity').argParser(parseFindingSeverity))
|
|
18
|
+
.option('--rule <id>', 'run only a rule (repeatable)', collect, [])
|
|
19
|
+
.option('--remote', 'query OSV for every exact lockfile package coordinate', false)
|
|
20
|
+
.option('--include <group>', 'include a finding group (repeatable)', (value, values) => [...values, parseFindingPriority(value)], [])
|
|
21
|
+
.addOption(new Option('--max-findings <count>', 'limit terminal findings').argParser(parseMaximumFindings))
|
|
22
|
+
.action(async (path, local, command) => {
|
|
23
|
+
const global = readGlobalOptions(command);
|
|
24
|
+
const input = {
|
|
25
|
+
root: global.root ?? path,
|
|
26
|
+
signal: context.signal,
|
|
27
|
+
...(global.config === undefined ? {} : { configFile: global.config }),
|
|
28
|
+
...(local.workspace.length === 0 ? {} : { workspaces: local.workspace }),
|
|
29
|
+
...(local.production === true
|
|
30
|
+
? { includeDev: false }
|
|
31
|
+
: local.includeDev === true
|
|
32
|
+
? { includeDev: true }
|
|
33
|
+
: {}),
|
|
34
|
+
...(local.rule.length === 0 ? {} : { rules: local.rule }),
|
|
35
|
+
remote: local.remote,
|
|
36
|
+
offline: global.offline,
|
|
37
|
+
refresh: global.refresh,
|
|
38
|
+
cache: global.cache,
|
|
39
|
+
...(global.cacheDir === undefined ? {} : { cacheDirectory: global.cacheDir }),
|
|
40
|
+
timeoutMs: global.timeout,
|
|
41
|
+
concurrency: global.concurrency,
|
|
42
|
+
};
|
|
43
|
+
const report = await context.client.analyzeProject(input);
|
|
44
|
+
const content = (() => {
|
|
45
|
+
if (global.format === 'terminal') {
|
|
46
|
+
return renderAnalysisReport(report, {
|
|
47
|
+
...(local.severity === undefined ? {} : { minimumSeverity: local.severity }),
|
|
48
|
+
includePriorities: local.include,
|
|
49
|
+
...(local.maxFindings === undefined ? {} : { maximumFindings: local.maxFindings }),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (global.format === 'markdown')
|
|
53
|
+
return renderMarkdownReport(report);
|
|
54
|
+
if (global.format === 'sarif')
|
|
55
|
+
return renderSarifReport(report);
|
|
56
|
+
return renderStructuredResult(report, global.format);
|
|
57
|
+
})();
|
|
58
|
+
await writeTextOutput(content, global.output, context.io);
|
|
59
|
+
context.setExitCode(mapPolicyToExitCode(report.policy));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function collect(value, values) {
|
|
63
|
+
return [...values, value];
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=createScanCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createScanCommand.js","sourceRoot":"","sources":["../../src/commands/createScanCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,MAAM,UAAU,iBAAiB,CAAC,OAAuB;IACvD,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;SACvB,WAAW,CAAC,oCAAoC,CAAC;SACjD,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC;SACvC,MAAM,CAAC,oBAAoB,EAAE,kCAAkC,EAAE,OAAO,EAAE,EAAE,CAAC;SAC7E,SAAS,CACR,IAAI,MAAM,CAAC,eAAe,EAAE,kCAAkC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CACxF;SACA,SAAS,CACR,IAAI,MAAM,CAAC,cAAc,EAAE,sCAAsC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAC3F;SACA,SAAS,CACR,IAAI,MAAM,CAAC,oBAAoB,EAAE,4BAA4B,CAAC,CAAC,SAAS,CACtE,oBAAoB,CACrB,CACF;SACA,MAAM,CAAC,aAAa,E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,EAAE,CAAC;QACL,MAAM,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAC1D,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1D,CAAC,CACF,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,KAAa,EAAE,MAAgB;IAC9C,OAAO,CAAC,GAAG,MAAM,EAAE,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PkgWiseClient } from '@lovlydev/pkgwise-core';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import type { CliIo } from './io/CliIo.js';
|
|
4
|
+
export interface CreateCliOptions {
|
|
5
|
+
readonly client: PkgWiseClient;
|
|
6
|
+
readonly io: CliIo;
|
|
7
|
+
readonly signal: AbortSignal;
|
|
8
|
+
readonly version: string;
|
|
9
|
+
setExitCode(code: number): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function createCli(options: CreateCliOptions): Command;
|
|
12
|
+
//# sourceMappingURL=createCli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCli.d.ts","sourceRoot":"","sources":["../src/createCli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CA2B5D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createCacheCommand } from './commands/createCacheCommand.js';
|
|
3
|
+
import { createCompareCommand } from './commands/createCompareCommand.js';
|
|
4
|
+
import { createDoctorCommand } from './commands/createDoctorCommand.js';
|
|
5
|
+
import { createExplainCommand } from './commands/createExplainCommand.js';
|
|
6
|
+
import { createInspectCommand } from './commands/createInspectCommand.js';
|
|
7
|
+
import { createScanCommand } from './commands/createScanCommand.js';
|
|
8
|
+
import { createGlobalOptions } from './options/createGlobalOptions.js';
|
|
9
|
+
export function createCli(options) {
|
|
10
|
+
const context = {
|
|
11
|
+
client: options.client,
|
|
12
|
+
io: options.io,
|
|
13
|
+
signal: options.signal,
|
|
14
|
+
setExitCode: options.setExitCode,
|
|
15
|
+
};
|
|
16
|
+
const program = createGlobalOptions(new Command()
|
|
17
|
+
.name('pkgwise')
|
|
18
|
+
.description('Explainable dependency analysis for JavaScript and TypeScript projects')
|
|
19
|
+
.version(options.version)
|
|
20
|
+
.showSuggestionAfterError()
|
|
21
|
+
.showHelpAfterError('(run pkgwise --help for usage)'));
|
|
22
|
+
program.addCommand(createScanCommand(context));
|
|
23
|
+
program.addCommand(createInspectCommand(context));
|
|
24
|
+
program.addCommand(createCompareCommand(context));
|
|
25
|
+
program.addCommand(createExplainCommand(context));
|
|
26
|
+
program.addCommand(createDoctorCommand(context));
|
|
27
|
+
program.addCommand(createCacheCommand(context));
|
|
28
|
+
configureCommandTree(program, options.io);
|
|
29
|
+
return program;
|
|
30
|
+
}
|
|
31
|
+
function configureCommandTree(command, io) {
|
|
32
|
+
command.configureOutput({
|
|
33
|
+
writeOut: (text) => io.stdout.write(text),
|
|
34
|
+
writeErr: (text) => io.stderr.write(text),
|
|
35
|
+
});
|
|
36
|
+
command.exitOverride();
|
|
37
|
+
for (const child of command.commands) {
|
|
38
|
+
configureCommandTree(child, io);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=createCli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCli.js","sourceRoot":"","sources":["../src/createCli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAUvE,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,MAAM,OAAO,GAAmB;QAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC;IAEF,MAAM,OAAO,GAAG,mBAAmB,CACjC,IAAI,OAAO,EAAE;SACV,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,wEAAwE,CAAC;SACrF,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;SACxB,wBAAwB,EAAE;SAC1B,kBAAkB,CAAC,gCAAgC,CAAC,CACxD,CAAC;IAEF,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,UAAU,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;IACjD,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC;IAEhD,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IAE1C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAgB,EAAE,EAAS;IACvD,OAAO,CAAC,eAAe,CAAC;QACtB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QACzC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;KAC1C,CAAC,CAAC;IACH,OAAO,CAAC,YAAY,EAAE,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapErrorToExitCode.d.ts","sourceRoot":"","sources":["../../src/exit/mapErrorToExitCode.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA6BzD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PkgWiseError } from '@lovlydev/pkgwise-core';
|
|
2
|
+
export function mapErrorToExitCode(error) {
|
|
3
|
+
if (!(error instanceof PkgWiseError)) {
|
|
4
|
+
return 5;
|
|
5
|
+
}
|
|
6
|
+
switch (error.code) {
|
|
7
|
+
case 'PW_CLI_INVALID_ARGUMENT':
|
|
8
|
+
case 'PW_CONFIG_INVALID':
|
|
9
|
+
case 'PW_CACHE_UNSAFE':
|
|
10
|
+
case 'PW_FINDING_NOT_FOUND':
|
|
11
|
+
case 'PW_FINDING_SELECTOR_AMBIGUOUS':
|
|
12
|
+
case 'PW_PACKAGE_NOT_FOUND':
|
|
13
|
+
case 'PW_PACKAGE_SELECTOR_AMBIGUOUS':
|
|
14
|
+
case 'PW_PACKAGE_SPEC_INVALID':
|
|
15
|
+
return 2;
|
|
16
|
+
case 'PW_PROJECT_NOT_FOUND':
|
|
17
|
+
case 'PW_PROJECT_AMBIGUOUS_MANAGER':
|
|
18
|
+
case 'PW_MANIFEST_PARSE_FAILED':
|
|
19
|
+
case 'PW_LOCKFILE_PARSE_FAILED':
|
|
20
|
+
case 'PW_LOCKFILE_VERSION_UNSUPPORTED':
|
|
21
|
+
return 3;
|
|
22
|
+
case 'PW_CANCELLED':
|
|
23
|
+
return 130;
|
|
24
|
+
case 'PW_PROVIDER_UNAVAILABLE':
|
|
25
|
+
return 4;
|
|
26
|
+
case 'PW_FEATURE_NOT_IMPLEMENTED':
|
|
27
|
+
case 'PW_INTERNAL_ERROR':
|
|
28
|
+
return 5;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=mapErrorToExitCode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapErrorToExitCode.js","sourceRoot":"","sources":["../../src/exit/mapErrorToExitCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,IAAI,CAAC,CAAC,KAAK,YAAY,YAAY,CAAC,EAAE,CAAC;QACrC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,yBAAyB,CAAC;QAC/B,KAAK,mBAAmB,CAAC;QACzB,KAAK,iBAAiB,CAAC;QACvB,KAAK,sBAAsB,CAAC;QAC5B,KAAK,+BAA+B,CAAC;QACrC,KAAK,sBAAsB,CAAC;QAC5B,KAAK,+BAA+B,CAAC;QACrC,KAAK,yBAAyB;YAC5B,OAAO,CAAC,CAAC;QACX,KAAK,sBAAsB,CAAC;QAC5B,KAAK,8BAA8B,CAAC;QACpC,KAAK,0BAA0B,CAAC;QAChC,KAAK,0BAA0B,CAAC;QAChC,KAAK,iCAAiC;YACpC,OAAO,CAAC,CAAC;QACX,KAAK,cAAc;YACjB,OAAO,GAAG,CAAC;QACb,KAAK,yBAAyB;YAC5B,OAAO,CAAC,CAAC;QACX,KAAK,4BAA4B,CAAC;QAClC,KAAK,mBAAmB;YACtB,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapPolicyToExitCode.d.ts","sourceRoot":"","sources":["../../src/exit/mapPolicyToExitCode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAEzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapPolicyToExitCode.js","sourceRoot":"","sources":["../../src/exit/mapPolicyToExitCode.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CAAC,MAA6B;IAC/D,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC"}
|