kirograph 0.17.0 → 0.19.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/LICENSE +1 -1
- package/README.md +103 -1822
- package/dist/architecture/layers/dart.js +112 -0
- package/dist/architecture/layers/dart.js.map +7 -0
- package/dist/architecture/layers/index.js +3 -1
- package/dist/architecture/layers/index.js.map +2 -2
- package/dist/bin/banner.js +74 -6
- package/dist/bin/banner.js.map +2 -2
- package/dist/bin/commands/attack-surface.js +157 -0
- package/dist/bin/commands/attack-surface.js.map +7 -0
- package/dist/bin/commands/benchmark.js +206 -0
- package/dist/bin/commands/benchmark.js.map +7 -0
- package/dist/bin/commands/budget.js +70 -0
- package/dist/bin/commands/budget.js.map +7 -0
- package/dist/bin/commands/communities.js +77 -0
- package/dist/bin/commands/communities.js.map +7 -0
- package/dist/bin/commands/dep-confusion.js +119 -0
- package/dist/bin/commands/dep-confusion.js.map +7 -0
- package/dist/bin/commands/export.js +304 -10
- package/dist/bin/commands/export.js.map +2 -2
- package/dist/bin/commands/flows.js +97 -0
- package/dist/bin/commands/flows.js.map +7 -0
- package/dist/bin/commands/help.js +382 -101
- package/dist/bin/commands/help.js.map +2 -2
- package/dist/bin/commands/install.js +90 -8
- package/dist/bin/commands/install.js.map +2 -2
- package/dist/bin/commands/licenses.js +201 -0
- package/dist/bin/commands/licenses.js.map +7 -0
- package/dist/bin/commands/reachability.js +160 -0
- package/dist/bin/commands/reachability.js.map +7 -0
- package/dist/bin/commands/read.js +100 -0
- package/dist/bin/commands/read.js.map +7 -0
- package/dist/bin/commands/refactor.js +116 -0
- package/dist/bin/commands/refactor.js.map +7 -0
- package/dist/bin/commands/remediation.js +133 -0
- package/dist/bin/commands/remediation.js.map +7 -0
- package/dist/bin/commands/sbom.js +76 -0
- package/dist/bin/commands/sbom.js.map +7 -0
- package/dist/bin/commands/security-ci-report.js +267 -0
- package/dist/bin/commands/security-ci-report.js.map +7 -0
- package/dist/bin/commands/security-export.js +1349 -0
- package/dist/bin/commands/security-export.js.map +7 -0
- package/dist/bin/commands/security-flows.js +126 -0
- package/dist/bin/commands/security-flows.js.map +7 -0
- package/dist/bin/commands/security-secrets.js +170 -0
- package/dist/bin/commands/security-secrets.js.map +7 -0
- package/dist/bin/commands/security.js +193 -0
- package/dist/bin/commands/security.js.map +7 -0
- package/dist/bin/commands/staleness.js +144 -0
- package/dist/bin/commands/staleness.js.map +7 -0
- package/dist/bin/commands/status.js +102 -2
- package/dist/bin/commands/status.js.map +2 -2
- package/dist/bin/commands/supply-chain.js +138 -0
- package/dist/bin/commands/supply-chain.js.map +7 -0
- package/dist/bin/commands/uninit.js +109 -60
- package/dist/bin/commands/uninit.js.map +2 -2
- package/dist/bin/commands/vex.js +76 -0
- package/dist/bin/commands/vex.js.map +7 -0
- package/dist/bin/commands/vuln-suppress.js +95 -0
- package/dist/bin/commands/vuln-suppress.js.map +7 -0
- package/dist/bin/commands/vulns.js +382 -0
- package/dist/bin/commands/vulns.js.map +7 -0
- package/dist/bin/installer/auto-detect.js +125 -0
- package/dist/bin/installer/auto-detect.js.map +7 -0
- package/dist/bin/installer/cli-agent.js +28 -5
- package/dist/bin/installer/cli-agent.js.map +2 -2
- package/dist/bin/installer/common.js +47 -0
- package/dist/bin/installer/common.js.map +2 -2
- package/dist/bin/installer/config-prompt.js +12 -1
- package/dist/bin/installer/config-prompt.js.map +2 -2
- package/dist/bin/installer/detect.js +309 -0
- package/dist/bin/installer/detect.js.map +7 -0
- package/dist/bin/installer/index.js +9 -1
- package/dist/bin/installer/index.js.map +2 -2
- package/dist/bin/installer/instructions.js +195 -3
- package/dist/bin/installer/instructions.js.map +2 -2
- package/dist/bin/installer/steering.js +407 -0
- package/dist/bin/installer/steering.js.map +2 -2
- package/dist/bin/installer/targets/aider.js +3 -3
- package/dist/bin/installer/targets/aider.js.map +2 -2
- package/dist/bin/installer/targets/amp.js +3 -3
- package/dist/bin/installer/targets/amp.js.map +2 -2
- package/dist/bin/installer/targets/antigravity.js +35 -6
- package/dist/bin/installer/targets/antigravity.js.map +2 -2
- package/dist/bin/installer/targets/augment.js +3 -3
- package/dist/bin/installer/targets/augment.js.map +2 -2
- package/dist/bin/installer/targets/claude.js +49 -5
- package/dist/bin/installer/targets/claude.js.map +2 -2
- package/dist/bin/installer/targets/cline.js +32 -6
- package/dist/bin/installer/targets/cline.js.map +2 -2
- package/dist/bin/installer/targets/codex.js +64 -12
- package/dist/bin/installer/targets/codex.js.map +2 -2
- package/dist/bin/installer/targets/continue.js +2 -2
- package/dist/bin/installer/targets/continue.js.map +2 -2
- package/dist/bin/installer/targets/copilot-cli.js +101 -0
- package/dist/bin/installer/targets/copilot-cli.js.map +7 -0
- package/dist/bin/installer/targets/copilot.js +31 -5
- package/dist/bin/installer/targets/copilot.js.map +2 -2
- package/dist/bin/installer/targets/cursor.js +4 -4
- package/dist/bin/installer/targets/cursor.js.map +2 -2
- package/dist/bin/installer/targets/devin.js +2 -2
- package/dist/bin/installer/targets/devin.js.map +2 -2
- package/dist/bin/installer/targets/gemini-cli.js +2 -2
- package/dist/bin/installer/targets/gemini-cli.js.map +2 -2
- package/dist/bin/installer/targets/generic.js +2 -14
- package/dist/bin/installer/targets/generic.js.map +2 -2
- package/dist/bin/installer/targets/goose.js +3 -3
- package/dist/bin/installer/targets/goose.js.map +2 -2
- package/dist/bin/installer/targets/index.js +250 -0
- package/dist/bin/installer/targets/index.js.map +2 -2
- package/dist/bin/installer/targets/junie.js +2 -2
- package/dist/bin/installer/targets/junie.js.map +2 -2
- package/dist/bin/installer/targets/kilo.js +2 -2
- package/dist/bin/installer/targets/kilo.js.map +2 -2
- package/dist/bin/installer/targets/kiro.js +3 -3
- package/dist/bin/installer/targets/kiro.js.map +2 -2
- package/dist/bin/installer/targets/opencode.js +2 -2
- package/dist/bin/installer/targets/opencode.js.map +2 -2
- package/dist/bin/installer/targets/openhands.js +3 -3
- package/dist/bin/installer/targets/openhands.js.map +2 -2
- package/dist/bin/installer/targets/qoder.js +91 -0
- package/dist/bin/installer/targets/qoder.js.map +7 -0
- package/dist/bin/installer/targets/qwen.js +96 -0
- package/dist/bin/installer/targets/qwen.js.map +7 -0
- package/dist/bin/installer/targets/replit.js +3 -3
- package/dist/bin/installer/targets/replit.js.map +2 -2
- package/dist/bin/installer/targets/roo.js +2 -2
- package/dist/bin/installer/targets/roo.js.map +2 -2
- package/dist/bin/installer/targets/tabnine.js +3 -3
- package/dist/bin/installer/targets/tabnine.js.map +2 -2
- package/dist/bin/installer/targets/trae.js +5 -5
- package/dist/bin/installer/targets/trae.js.map +2 -2
- package/dist/bin/installer/targets/warp.js +2 -2
- package/dist/bin/installer/targets/warp.js.map +2 -2
- package/dist/bin/installer/targets/windsurf.js +35 -6
- package/dist/bin/installer/targets/windsurf.js.map +2 -2
- package/dist/bin/kirograph.js +72 -6
- package/dist/bin/kirograph.js.map +3 -3
- package/dist/compression/tracker.js +80 -0
- package/dist/compression/tracker.js.map +2 -2
- package/dist/config.js +90 -3
- package/dist/config.js.map +2 -2
- package/dist/core/pipeline.js +36 -2
- package/dist/core/pipeline.js.map +2 -2
- package/dist/db/database.js +56 -5
- package/dist/db/database.js.map +2 -2
- package/dist/db/memory-schema.sql +5 -1
- package/dist/db/schema.sql +3 -1
- package/dist/db/security-schema.sql +72 -0
- package/dist/extraction/extractor.js +81 -0
- package/dist/extraction/extractor.js.map +2 -2
- package/dist/extraction/grammars.js +32 -8
- package/dist/extraction/grammars.js.map +2 -2
- package/dist/extraction/languages.js +43 -1
- package/dist/extraction/languages.js.map +2 -2
- package/dist/extraction/notebook.js +300 -0
- package/dist/extraction/notebook.js.map +7 -0
- package/dist/extraction/wasm/tree-sitter-astro.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-gdscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-julia.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-perl.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-powershell.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-r.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-sql.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-verilog.wasm +0 -0
- package/dist/frameworks/flutter.js +130 -0
- package/dist/frameworks/flutter.js.map +7 -0
- package/dist/frameworks/index.js +7 -1
- package/dist/frameworks/index.js.map +3 -3
- package/dist/graph/communities.js +317 -0
- package/dist/graph/communities.js.map +7 -0
- package/dist/graph/flows.js +138 -0
- package/dist/graph/flows.js.map +7 -0
- package/dist/graph/refactor.js +155 -0
- package/dist/graph/refactor.js.map +7 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +2 -2
- package/dist/mcp/cache.js +172 -0
- package/dist/mcp/cache.js.map +7 -0
- package/dist/mcp/read-modes.js +295 -0
- package/dist/mcp/read-modes.js.map +7 -0
- package/dist/mcp/server.js +2 -1
- package/dist/mcp/server.js.map +2 -2
- package/dist/mcp/tool-names.js +21 -1
- package/dist/mcp/tool-names.js.map +2 -2
- package/dist/mcp/tools.js +1160 -1
- package/dist/mcp/tools.js.map +3 -3
- package/dist/memory/database.js +32 -2
- package/dist/memory/database.js.map +2 -2
- package/dist/memory/types.js.map +1 -1
- package/dist/resolution/bridges/android-rn.js +298 -0
- package/dist/resolution/bridges/android-rn.js.map +7 -0
- package/dist/resolution/bridges/expo-modules.js +155 -0
- package/dist/resolution/bridges/expo-modules.js.map +7 -0
- package/dist/resolution/bridges/flutter-channel.js +385 -0
- package/dist/resolution/bridges/flutter-channel.js.map +7 -0
- package/dist/resolution/bridges/index.js +80 -0
- package/dist/resolution/bridges/index.js.map +7 -0
- package/dist/resolution/bridges/native-events.js +188 -0
- package/dist/resolution/bridges/native-events.js.map +7 -0
- package/dist/resolution/bridges/native-views.js +244 -0
- package/dist/resolution/bridges/native-views.js.map +7 -0
- package/dist/resolution/bridges/react-native.js +161 -0
- package/dist/resolution/bridges/react-native.js.map +7 -0
- package/dist/resolution/bridges/swift-objc.js +227 -0
- package/dist/resolution/bridges/swift-objc.js.map +7 -0
- package/dist/resolution/bridges/turbomodules.js +216 -0
- package/dist/resolution/bridges/turbomodules.js.map +7 -0
- package/dist/resolution/index.js +61 -2
- package/dist/resolution/index.js.map +2 -2
- package/dist/security/attack-surface.js +164 -0
- package/dist/security/attack-surface.js.map +7 -0
- package/dist/security/context-warnings.js +123 -0
- package/dist/security/context-warnings.js.map +7 -0
- package/dist/security/context-warnings.test.js +300 -0
- package/dist/security/context-warnings.test.js.map +7 -0
- package/dist/security/data-flows.js +228 -0
- package/dist/security/data-flows.js.map +7 -0
- package/dist/security/dep-confusion.js +255 -0
- package/dist/security/dep-confusion.js.map +7 -0
- package/dist/security/errors.js +51 -0
- package/dist/security/errors.js.map +7 -0
- package/dist/security/export/fix-suggestions.js +58 -0
- package/dist/security/export/fix-suggestions.js.map +7 -0
- package/dist/security/export/fix-suggestions.test.js +74 -0
- package/dist/security/export/fix-suggestions.test.js.map +7 -0
- package/dist/security/export/sbom.js +230 -0
- package/dist/security/export/sbom.js.map +7 -0
- package/dist/security/export/sbom.test.js +288 -0
- package/dist/security/export/sbom.test.js.map +7 -0
- package/dist/security/export/serialization.js +142 -0
- package/dist/security/export/serialization.js.map +7 -0
- package/dist/security/export/serialization.test.js +310 -0
- package/dist/security/export/serialization.test.js.map +7 -0
- package/dist/security/export/vex.js +220 -0
- package/dist/security/export/vex.js.map +7 -0
- package/dist/security/export/vex.test.js +278 -0
- package/dist/security/export/vex.test.js.map +7 -0
- package/dist/security/index.js +67 -0
- package/dist/security/index.js.map +7 -0
- package/dist/security/integrator-transitives.test.js +359 -0
- package/dist/security/integrator-transitives.test.js.map +7 -0
- package/dist/security/integrator.js +491 -0
- package/dist/security/integrator.js.map +7 -0
- package/dist/security/integrator.test.js +237 -0
- package/dist/security/integrator.test.js.map +7 -0
- package/dist/security/license.js +70 -0
- package/dist/security/license.js.map +7 -0
- package/dist/security/manifest/adapter.js +243 -0
- package/dist/security/manifest/adapter.js.map +7 -0
- package/dist/security/manifest/adapter.test.js +272 -0
- package/dist/security/manifest/adapter.test.js.map +7 -0
- package/dist/security/manifest/parser.js +376 -0
- package/dist/security/manifest/parser.js.map +7 -0
- package/dist/security/manifest/parser.test.js +110 -0
- package/dist/security/manifest/parser.test.js.map +7 -0
- package/dist/security/manifest/plugins/cargo.js +233 -0
- package/dist/security/manifest/plugins/cargo.js.map +7 -0
- package/dist/security/manifest/plugins/cargo.test.js +304 -0
- package/dist/security/manifest/plugins/cargo.test.js.map +7 -0
- package/dist/security/manifest/plugins/composer.js +152 -0
- package/dist/security/manifest/plugins/composer.js.map +7 -0
- package/dist/security/manifest/plugins/go.js +146 -0
- package/dist/security/manifest/plugins/go.js.map +7 -0
- package/dist/security/manifest/plugins/go.test.js +341 -0
- package/dist/security/manifest/plugins/go.test.js.map +7 -0
- package/dist/security/manifest/plugins/gradle.js +159 -0
- package/dist/security/manifest/plugins/gradle.js.map +7 -0
- package/dist/security/manifest/plugins/hex.js +159 -0
- package/dist/security/manifest/plugins/hex.js.map +7 -0
- package/dist/security/manifest/plugins/maven.js +128 -0
- package/dist/security/manifest/plugins/maven.js.map +7 -0
- package/dist/security/manifest/plugins/maven.test.js +389 -0
- package/dist/security/manifest/plugins/maven.test.js.map +7 -0
- package/dist/security/manifest/plugins/npm.js +284 -0
- package/dist/security/manifest/plugins/npm.js.map +7 -0
- package/dist/security/manifest/plugins/npm.test.js +298 -0
- package/dist/security/manifest/plugins/npm.test.js.map +7 -0
- package/dist/security/manifest/plugins/nuget.js +186 -0
- package/dist/security/manifest/plugins/nuget.js.map +7 -0
- package/dist/security/manifest/plugins/pip.js +123 -0
- package/dist/security/manifest/plugins/pip.js.map +7 -0
- package/dist/security/manifest/plugins/pip.test.js +208 -0
- package/dist/security/manifest/plugins/pip.test.js.map +7 -0
- package/dist/security/manifest/plugins/pubspec.js +212 -0
- package/dist/security/manifest/plugins/pubspec.js.map +7 -0
- package/dist/security/manifest/plugins/pyproject.js +261 -0
- package/dist/security/manifest/plugins/pyproject.js.map +7 -0
- package/dist/security/manifest/plugins/rubygems.js +185 -0
- package/dist/security/manifest/plugins/rubygems.js.map +7 -0
- package/dist/security/manifest/plugins/swift.js +200 -0
- package/dist/security/manifest/plugins/swift.js.map +7 -0
- package/dist/security/owasp.js +104 -0
- package/dist/security/owasp.js.map +7 -0
- package/dist/security/pipeline.js +125 -0
- package/dist/security/pipeline.js.map +7 -0
- package/dist/security/reachability.js +276 -0
- package/dist/security/reachability.js.map +7 -0
- package/dist/security/reachability.test.js +394 -0
- package/dist/security/reachability.test.js.map +7 -0
- package/dist/security/remediation.js +126 -0
- package/dist/security/remediation.js.map +7 -0
- package/dist/security/secrets.js +176 -0
- package/dist/security/secrets.js.map +7 -0
- package/dist/security/staleness.js +231 -0
- package/dist/security/staleness.js.map +7 -0
- package/dist/security/supply-chain.js +301 -0
- package/dist/security/supply-chain.js.map +7 -0
- package/dist/security/suppressions.js +106 -0
- package/dist/security/suppressions.js.map +7 -0
- package/dist/security/types.js +17 -0
- package/dist/security/types.js.map +7 -0
- package/dist/security/vuln/client.js +355 -0
- package/dist/security/vuln/client.js.map +7 -0
- package/dist/security/vuln/client.test.js +288 -0
- package/dist/security/vuln/client.test.js.map +7 -0
- package/dist/security/vuln/epss-client.js +95 -0
- package/dist/security/vuln/epss-client.js.map +7 -0
- package/dist/security/vuln/index.js +29 -0
- package/dist/security/vuln/index.js.map +7 -0
- package/dist/security/vuln/osv-adapter.js +321 -0
- package/dist/security/vuln/osv-adapter.js.map +7 -0
- package/dist/security/vuln/osv-adapter.test.js +391 -0
- package/dist/security/vuln/osv-adapter.test.js.map +7 -0
- package/dist/security/vuln/types.js +17 -0
- package/dist/security/vuln/types.js.map +7 -0
- package/dist/types.js.map +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var supply_chain_exports = {};
|
|
30
|
+
__export(supply_chain_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(supply_chain_exports);
|
|
34
|
+
var path = __toESM(require("path"));
|
|
35
|
+
var import_config = require("../../config");
|
|
36
|
+
var import_ui = require("../ui");
|
|
37
|
+
const red = "\x1B[31m";
|
|
38
|
+
const yellow = "\x1B[33m";
|
|
39
|
+
const RISK_ORDER = {
|
|
40
|
+
critical: 4,
|
|
41
|
+
high: 3,
|
|
42
|
+
medium: 2,
|
|
43
|
+
low: 1,
|
|
44
|
+
unknown: 0
|
|
45
|
+
};
|
|
46
|
+
function riskColor(level) {
|
|
47
|
+
switch (level) {
|
|
48
|
+
case "critical":
|
|
49
|
+
return red;
|
|
50
|
+
case "high":
|
|
51
|
+
return yellow;
|
|
52
|
+
case "medium":
|
|
53
|
+
return "\x1B[33m";
|
|
54
|
+
case "low":
|
|
55
|
+
return import_ui.green;
|
|
56
|
+
default:
|
|
57
|
+
return import_ui.dim;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function register(program) {
|
|
61
|
+
program.command("supply-chain [projectPath]").description("Assess supply-chain health: OpenSSF Scorecard, maintainer count, package age, and risk level").option("--threshold <level>", "Show only at or above risk level: critical|high|medium|low (default: low)", "low").option("--refresh", "Re-fetch data from registries and Scorecard API").option("--format <fmt>", "Output format: table | json (default: table)", "table").action(async (projectPath, opts) => {
|
|
62
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
63
|
+
const config = await (0, import_config.loadConfig)(target);
|
|
64
|
+
if (!config.enableSecurity) {
|
|
65
|
+
console.error(`
|
|
66
|
+
${yellow}\u26A0 Security analysis is disabled.${import_ui.reset}`);
|
|
67
|
+
console.error(` ${import_ui.dim}Enable it in .kirograph/config.json:${import_ui.reset} ${import_ui.violet}${import_ui.bold}"enableSecurity": true${import_ui.reset}`);
|
|
68
|
+
console.error(` ${import_ui.dim}Then re-run:${import_ui.reset} ${import_ui.violet}${import_ui.bold}kirograph index${import_ui.reset}
|
|
69
|
+
`);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
const thresholdLevel = opts.threshold;
|
|
73
|
+
if (!["critical", "high", "medium", "low"].includes(thresholdLevel)) {
|
|
74
|
+
console.error(` \u2716 --threshold must be one of: critical | high | medium | low`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
|
|
78
|
+
if (!KiroGraph.isInitialized(target)) {
|
|
79
|
+
console.error(" \u2716 KiroGraph not initialized. Run: kirograph init");
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
const cg = await KiroGraph.open(target);
|
|
83
|
+
const db = cg.getDatabase();
|
|
84
|
+
db.applySecuritySchema();
|
|
85
|
+
const { SupplyChainChecker } = await Promise.resolve().then(() => require("../../security/supply-chain.js"));
|
|
86
|
+
const checker = new SupplyChainChecker(db);
|
|
87
|
+
if (opts.refresh || opts.format !== "json") {
|
|
88
|
+
console.error(` ${import_ui.dim}Fetching supply-chain data from registries...${import_ui.reset}`);
|
|
89
|
+
}
|
|
90
|
+
const { results, errors } = await checker.checkAll();
|
|
91
|
+
if (errors.length > 0) {
|
|
92
|
+
console.error(` ${yellow}\u26A0${import_ui.reset} ${errors.length} error(s) during fetch`);
|
|
93
|
+
}
|
|
94
|
+
const thresholdOrder = RISK_ORDER[thresholdLevel] ?? 0;
|
|
95
|
+
const filtered = results.filter((r) => (RISK_ORDER[r.riskLevel] ?? 0) >= thresholdOrder);
|
|
96
|
+
filtered.sort((a, b) => (RISK_ORDER[b.riskLevel] ?? 0) - (RISK_ORDER[a.riskLevel] ?? 0));
|
|
97
|
+
if (opts.format === "json") {
|
|
98
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
99
|
+
cg.close();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (filtered.length === 0) {
|
|
103
|
+
console.log(`
|
|
104
|
+
${import_ui.dim}No supply-chain risks found at or above threshold: ${thresholdLevel}.${import_ui.reset}`);
|
|
105
|
+
console.log(` ${import_ui.dim}Run with${import_ui.reset} ${import_ui.violet}${import_ui.bold}--refresh${import_ui.reset} ${import_ui.dim}to re-fetch from registries.${import_ui.reset}
|
|
106
|
+
`);
|
|
107
|
+
cg.close();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
console.log(`
|
|
111
|
+
${import_ui.violet}${import_ui.bold}Supply-Chain Health${import_ui.reset}
|
|
112
|
+
`);
|
|
113
|
+
for (const r of filtered) {
|
|
114
|
+
const scoreStr = r.scorecardScore !== null ? r.scorecardScore.toFixed(1) : "n/a";
|
|
115
|
+
const maintStr = r.maintainerCount !== null ? String(r.maintainerCount) : "n/a";
|
|
116
|
+
const daysStr = r.daysSinceLastCommit !== null ? `${r.daysSinceLastCommit}d` : "n/a";
|
|
117
|
+
const color = riskColor(r.riskLevel);
|
|
118
|
+
console.log(` ${import_ui.violet}${import_ui.bold}${r.packageName}${import_ui.reset} ${import_ui.dim}(${r.ecosystem})${import_ui.reset}`);
|
|
119
|
+
console.log(` Scorecard: ${import_ui.dim}${scoreStr}/10${import_ui.reset} Maintainers: ${import_ui.dim}${maintStr}${import_ui.reset} Last activity: ${import_ui.dim}${daysStr}${import_ui.reset}`);
|
|
120
|
+
console.log(` Risk: ${color}${import_ui.bold}${r.riskLevel.toUpperCase()}${import_ui.reset}`);
|
|
121
|
+
if (r.riskReasons.length > 0) {
|
|
122
|
+
for (const reason of r.riskReasons) {
|
|
123
|
+
console.log(` ${import_ui.dim}\u2022${import_ui.reset} ${reason}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
console.log();
|
|
127
|
+
}
|
|
128
|
+
const total = results.length;
|
|
129
|
+
console.log(` ${import_ui.bold}${filtered.length}${import_ui.reset} of ${import_ui.bold}${total}${import_ui.reset} ${import_ui.dim}packages flagged (threshold: ${thresholdLevel})${import_ui.reset}
|
|
130
|
+
`);
|
|
131
|
+
cg.close();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
135
|
+
0 && (module.exports = {
|
|
136
|
+
register
|
|
137
|
+
});
|
|
138
|
+
//# sourceMappingURL=supply-chain.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/supply-chain.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport { loadConfig } from '../../config';\nimport { dim, reset, violet, bold, green } from '../ui';\n\nconst red = '\\x1b[31m';\nconst yellow = '\\x1b[33m';\n\ntype Threshold = 'critical' | 'high' | 'medium' | 'low';\n\nconst RISK_ORDER: Record<string, number> = {\n critical: 4,\n high: 3,\n medium: 2,\n low: 1,\n unknown: 0,\n};\n\nfunction riskColor(level: string): string {\n switch (level) {\n case 'critical': return red;\n case 'high': return yellow;\n case 'medium': return '\\x1b[33m';\n case 'low': return green;\n default: return dim;\n }\n}\n\nexport function register(program: Command): void {\n program\n .command('supply-chain [projectPath]')\n .description('Assess supply-chain health: OpenSSF Scorecard, maintainer count, package age, and risk level')\n .option('--threshold <level>', 'Show only at or above risk level: critical|high|medium|low (default: low)', 'low')\n .option('--refresh', 'Re-fetch data from registries and Scorecard API')\n .option('--format <fmt>', 'Output format: table | json (default: table)', 'table')\n .action(async (projectPath: string | undefined, opts: {\n threshold: string;\n refresh?: boolean;\n format: string;\n }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const config = await loadConfig(target);\n\n if (!config.enableSecurity) {\n console.error(`\\n ${yellow}\u26A0 Security analysis is disabled.${reset}`);\n console.error(` ${dim}Enable it in .kirograph/config.json:${reset} ${violet}${bold}\"enableSecurity\": true${reset}`);\n console.error(` ${dim}Then re-run:${reset} ${violet}${bold}kirograph index${reset}\\n`);\n process.exit(1);\n }\n\n const thresholdLevel = opts.threshold as Threshold;\n if (!['critical', 'high', 'medium', 'low'].includes(thresholdLevel)) {\n console.error(` \u2716 --threshold must be one of: critical | high | medium | low`);\n process.exit(1);\n }\n\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n if (!KiroGraph.isInitialized(target)) {\n console.error(' \u2716 KiroGraph not initialized. Run: kirograph init');\n process.exit(1);\n }\n\n const cg = await KiroGraph.open(target);\n const db = cg.getDatabase();\n db.applySecuritySchema();\n\n const { SupplyChainChecker } = await Promise.resolve().then(() => require('../../security/supply-chain.js'));\n const checker = new SupplyChainChecker(db);\n\n if (opts.refresh || opts.format !== 'json') {\n console.error(` ${dim}Fetching supply-chain data from registries...${reset}`);\n }\n\n const { results, errors } = await checker.checkAll();\n\n if (errors.length > 0) {\n console.error(` ${yellow}\u26A0${reset} ${errors.length} error(s) during fetch`);\n }\n\n // Filter by threshold\n const thresholdOrder = RISK_ORDER[thresholdLevel] ?? 0;\n const filtered = results.filter(r => (RISK_ORDER[r.riskLevel] ?? 0) >= thresholdOrder);\n\n // Sort by risk descending\n filtered.sort((a, b) => (RISK_ORDER[b.riskLevel] ?? 0) - (RISK_ORDER[a.riskLevel] ?? 0));\n\n if (opts.format === 'json') {\n console.log(JSON.stringify(filtered, null, 2));\n cg.close();\n return;\n }\n\n if (filtered.length === 0) {\n console.log(`\\n ${dim}No supply-chain risks found at or above threshold: ${thresholdLevel}.${reset}`);\n console.log(` ${dim}Run with${reset} ${violet}${bold}--refresh${reset} ${dim}to re-fetch from registries.${reset}\\n`);\n cg.close();\n return;\n }\n\n console.log(`\\n ${violet}${bold}Supply-Chain Health${reset}\\n`);\n\n for (const r of filtered) {\n const scoreStr = r.scorecardScore !== null ? r.scorecardScore.toFixed(1) : 'n/a';\n const maintStr = r.maintainerCount !== null ? String(r.maintainerCount) : 'n/a';\n const daysStr = r.daysSinceLastCommit !== null ? `${r.daysSinceLastCommit}d` : 'n/a';\n const color = riskColor(r.riskLevel);\n\n console.log(` ${violet}${bold}${r.packageName}${reset} ${dim}(${r.ecosystem})${reset}`);\n console.log(` Scorecard: ${dim}${scoreStr}/10${reset} Maintainers: ${dim}${maintStr}${reset} Last activity: ${dim}${daysStr}${reset}`);\n console.log(` Risk: ${color}${bold}${r.riskLevel.toUpperCase()}${reset}`);\n\n if (r.riskReasons.length > 0) {\n for (const reason of r.riskReasons) {\n console.log(` ${dim}\u2022${reset} ${reason}`);\n }\n }\n console.log();\n }\n\n const total = results.length;\n console.log(` ${bold}${filtered.length}${reset} of ${bold}${total}${reset} ${dim}packages flagged (threshold: ${thresholdLevel})${reset}\\n`);\n\n cg.close();\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,oBAA2B;AAC3B,gBAAgD;AAEhD,MAAM,MAAS;AACf,MAAM,SAAS;AAIf,MAAM,aAAqC;AAAA,EACzC,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,SAAS;AACX;AAEA,SAAS,UAAU,OAAuB;AACxC,UAAQ,OAAO;AAAA,IACb,KAAK;AAAY,aAAO;AAAA,IACxB,KAAK;AAAY,aAAO;AAAA,IACxB,KAAK;AAAY,aAAO;AAAA,IACxB,KAAK;AAAY,aAAO;AAAA,IACxB;AAAiB,aAAO;AAAA,EAC1B;AACF;AAEO,SAAS,SAAS,SAAwB;AAC/C,UACG,QAAQ,4BAA4B,EACpC,YAAY,8FAA8F,EAC1G,OAAO,uBAAuB,6EAA6E,KAAK,EAChH,OAAO,aAAa,iDAAiD,EACrE,OAAO,kBAAkB,gDAAgD,OAAO,EAChF,OAAO,OAAO,aAAiC,SAI1C;AACJ,UAAM,SAAS,KAAK,QAAQ,eAAe,QAAQ,IAAI,CAAC;AACxD,UAAM,SAAS,UAAM,0BAAW,MAAM;AAEtC,QAAI,CAAC,OAAO,gBAAgB;AAC1B,cAAQ,MAAM;AAAA,IAAO,MAAM,wCAAmC,eAAK,EAAE;AACrE,cAAQ,MAAM,KAAK,aAAG,uCAAuC,eAAK,IAAI,gBAAM,GAAG,cAAI,yBAAyB,eAAK,EAAE;AACnH,cAAQ,MAAM,KAAK,aAAG,eAAe,eAAK,IAAI,gBAAM,GAAG,cAAI,kBAAkB,eAAK;AAAA,CAAI;AACtF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,UAAM,iBAAiB,KAAK;AAC5B,Q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AAA,CAAI;AAE5I,OAAG,MAAM;AAAA,EACX,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -38,6 +38,7 @@ var readline = __toESM(require("readline"));
|
|
|
38
38
|
var import_banner = require("../banner");
|
|
39
39
|
var import_ui = require("../ui");
|
|
40
40
|
var import_prompts = require("../installer/prompts");
|
|
41
|
+
var import_targets = require("../installer/targets");
|
|
41
42
|
const UNINIT_FAREWELLS = [
|
|
42
43
|
"Oh. So it's come to this.",
|
|
43
44
|
"We're sorry to see you go. (Are we? Yes. We are.)",
|
|
@@ -50,15 +51,104 @@ const UNINIT_FAREWELLS = [
|
|
|
50
51
|
"574 embeddings. Gone. Just like that.",
|
|
51
52
|
"See you on the other side of `kirograph install`."
|
|
52
53
|
];
|
|
53
|
-
const
|
|
54
|
+
const ALL_TARGETS = [
|
|
55
|
+
"kiro",
|
|
56
|
+
"claude",
|
|
57
|
+
"codex",
|
|
58
|
+
"cursor",
|
|
59
|
+
"antigravity",
|
|
60
|
+
"opencode",
|
|
61
|
+
"windsurf",
|
|
62
|
+
"cline",
|
|
63
|
+
"copilot",
|
|
64
|
+
"junie",
|
|
65
|
+
"gemini-cli",
|
|
66
|
+
"continue",
|
|
67
|
+
"roo",
|
|
68
|
+
"warp",
|
|
69
|
+
"aider",
|
|
70
|
+
"trae",
|
|
71
|
+
"augment",
|
|
72
|
+
"kilo",
|
|
73
|
+
"amp",
|
|
74
|
+
"devin",
|
|
75
|
+
"replit",
|
|
76
|
+
"goose",
|
|
77
|
+
"openhands",
|
|
78
|
+
"tabnine",
|
|
79
|
+
"mistral-vibe",
|
|
80
|
+
"ibm-bob",
|
|
81
|
+
"crush",
|
|
82
|
+
"droid-factory",
|
|
83
|
+
"forgecode",
|
|
84
|
+
"iflow",
|
|
85
|
+
"qwen",
|
|
86
|
+
"rovo",
|
|
87
|
+
"qoder"
|
|
88
|
+
];
|
|
89
|
+
function isValidTarget(t) {
|
|
90
|
+
return t === "all" || ALL_TARGETS.includes(t);
|
|
91
|
+
}
|
|
92
|
+
function uninitKiro(projectRoot) {
|
|
93
|
+
const kiroHooks = [
|
|
94
|
+
"kirograph-mark-dirty-on-save.kiro.hook",
|
|
95
|
+
"kirograph-mark-dirty-on-create.kiro.hook",
|
|
96
|
+
"kirograph-sync-on-delete.kiro.hook",
|
|
97
|
+
"kirograph-sync-if-dirty.kiro.hook",
|
|
98
|
+
"kirograph-compress-hint.kiro.hook",
|
|
99
|
+
"kirograph-mem-capture.kiro.hook",
|
|
100
|
+
// Legacy .json filenames
|
|
101
|
+
"kirograph-mark-dirty-on-save.json",
|
|
102
|
+
"kirograph-mark-dirty-on-create.json",
|
|
103
|
+
"kirograph-sync-on-delete.json",
|
|
104
|
+
"kirograph-sync-if-dirty.json",
|
|
105
|
+
"kirograph-sync-on-save.json",
|
|
106
|
+
"kirograph-sync-on-create.json",
|
|
107
|
+
"kirograph-compress-hint.json",
|
|
108
|
+
"kirograph-mem-capture.json"
|
|
109
|
+
];
|
|
110
|
+
const hooksDir = path.join(projectRoot, ".kiro", "hooks");
|
|
111
|
+
let removedHooks = 0;
|
|
112
|
+
for (const hook of kiroHooks) {
|
|
113
|
+
const p = path.join(hooksDir, hook);
|
|
114
|
+
if (fs.existsSync(p)) {
|
|
115
|
+
fs.unlinkSync(p);
|
|
116
|
+
removedHooks++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (removedHooks > 0) console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed ${removedHooks} hook(s) from .kiro/hooks/`);
|
|
120
|
+
const steeringDir = path.join(projectRoot, ".kiro", "steering");
|
|
121
|
+
let removedSteering = 0;
|
|
122
|
+
if (fs.existsSync(steeringDir)) {
|
|
123
|
+
for (const entry of fs.readdirSync(steeringDir)) {
|
|
124
|
+
if (entry.startsWith("kirograph") && entry.endsWith(".md")) {
|
|
125
|
+
fs.unlinkSync(path.join(steeringDir, entry));
|
|
126
|
+
removedSteering++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (removedSteering > 0) {
|
|
131
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed ${removedSteering} steering file(s) from .kiro/steering/`);
|
|
132
|
+
}
|
|
133
|
+
const agentPath = path.join(projectRoot, ".kiro", "agents", "kirograph.json");
|
|
134
|
+
if (fs.existsSync(agentPath)) {
|
|
135
|
+
fs.unlinkSync(agentPath);
|
|
136
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kiro/agents/kirograph.json`);
|
|
137
|
+
}
|
|
138
|
+
const { removeMcpServersConfig } = require("../installer/common");
|
|
139
|
+
const mcpPath = path.join(projectRoot, ".kiro", "settings", "mcp.json");
|
|
140
|
+
if (removeMcpServersConfig(mcpPath)) {
|
|
141
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed kirograph from .kiro/settings/mcp.json`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
54
144
|
async function runUninit(projectPath, opts) {
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
if (!
|
|
58
|
-
console.error(`Unknown uninit target: ${opts.target}. Choose from:
|
|
145
|
+
const projectRoot = path.resolve(projectPath ?? process.cwd());
|
|
146
|
+
const targetName = (opts.target ?? "kiro").toLowerCase();
|
|
147
|
+
if (!isValidTarget(targetName)) {
|
|
148
|
+
console.error(`Unknown uninit target: ${opts.target}. Choose from: ${ALL_TARGETS.join(", ")}, all`);
|
|
59
149
|
process.exit(1);
|
|
60
150
|
}
|
|
61
|
-
const dir = path.join(
|
|
151
|
+
const dir = path.join(projectRoot, ".kirograph");
|
|
62
152
|
if (!fs.existsSync(dir)) {
|
|
63
153
|
console.log("Not initialized.");
|
|
64
154
|
return;
|
|
@@ -70,10 +160,10 @@ async function runUninit(projectPath, opts) {
|
|
|
70
160
|
const farewell = UNINIT_FAREWELLS[Math.floor(Math.random() * UNINIT_FAREWELLS.length)];
|
|
71
161
|
console.log(` ${import_ui.violet}${import_ui.bold}${farewell}${import_ui.reset}`);
|
|
72
162
|
console.log(`
|
|
73
|
-
${import_ui.dim}This can remove ${
|
|
163
|
+
${import_ui.dim}This can remove ${targetName} integration files and, separately, the shared .kirograph/ data.${import_ui.reset}`);
|
|
74
164
|
console.log(` ${import_ui.dim}Your source code is untouched.${import_ui.reset}`);
|
|
75
165
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
76
|
-
removeIntegration = await (0, import_prompts.askToggle)(rl, `Remove ${
|
|
166
|
+
removeIntegration = await (0, import_prompts.askToggle)(rl, `Remove ${targetName} integration files?`, "Removes hooks, MCP config, rules, and agent instructions for this target.", false);
|
|
77
167
|
removeGraph = await (0, import_prompts.askToggle)(rl, "Remove shared .kirograph/ data too?", "Deletes the graph database, snapshots, and all indexed data. Cannot be undone.", false);
|
|
78
168
|
rl.close();
|
|
79
169
|
if (!removeIntegration && !removeGraph) {
|
|
@@ -88,65 +178,24 @@ async function runUninit(projectPath, opts) {
|
|
|
88
178
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
89
179
|
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kirograph/`);
|
|
90
180
|
}
|
|
91
|
-
if (removeIntegration
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// Legacy .json filenames
|
|
100
|
-
"kirograph-mark-dirty-on-save.json",
|
|
101
|
-
"kirograph-mark-dirty-on-create.json",
|
|
102
|
-
"kirograph-sync-on-delete.json",
|
|
103
|
-
"kirograph-sync-if-dirty.json",
|
|
104
|
-
"kirograph-sync-on-save.json",
|
|
105
|
-
"kirograph-sync-on-create.json",
|
|
106
|
-
"kirograph-compress-hint.json",
|
|
107
|
-
"kirograph-mem-capture.json"
|
|
108
|
-
];
|
|
109
|
-
const hooksDir = path.join(target, ".kiro", "hooks");
|
|
110
|
-
let removedHooks = 0;
|
|
111
|
-
for (const hook of kiroHooks) {
|
|
112
|
-
const p = path.join(hooksDir, hook);
|
|
113
|
-
if (fs.existsSync(p)) {
|
|
114
|
-
fs.unlinkSync(p);
|
|
115
|
-
removedHooks++;
|
|
181
|
+
if (removeIntegration) {
|
|
182
|
+
const targets = targetName === "all" ? [...ALL_TARGETS] : [targetName];
|
|
183
|
+
for (const t of targets) {
|
|
184
|
+
if (t === "kiro") {
|
|
185
|
+
uninitKiro(projectRoot);
|
|
186
|
+
} else {
|
|
187
|
+
const installer = (0, import_targets.getTargetInstaller)(t);
|
|
188
|
+
installer.uninit?.(projectRoot);
|
|
116
189
|
}
|
|
117
190
|
}
|
|
118
|
-
if (removedHooks > 0) console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed ${removedHooks} hook(s) from .kiro/hooks/`);
|
|
119
|
-
const steeringPath = path.join(target, ".kiro", "steering", "kirograph.md");
|
|
120
|
-
if (fs.existsSync(steeringPath)) {
|
|
121
|
-
fs.unlinkSync(steeringPath);
|
|
122
|
-
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kiro/steering/kirograph.md`);
|
|
123
|
-
}
|
|
124
|
-
const agentPath = path.join(target, ".kiro", "agents", "kirograph.json");
|
|
125
|
-
if (fs.existsSync(agentPath)) {
|
|
126
|
-
fs.unlinkSync(agentPath);
|
|
127
|
-
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed .kiro/agents/kirograph.json`);
|
|
128
|
-
}
|
|
129
|
-
const { removeMcpServersConfig } = await Promise.resolve().then(() => require("../installer/common.js"));
|
|
130
|
-
const mcpPath = path.join(target, ".kiro", "settings", "mcp.json");
|
|
131
|
-
if (removeMcpServersConfig(mcpPath)) {
|
|
132
|
-
console.log(` ${import_ui.green}\u2713${import_ui.reset} Removed kirograph from .kiro/settings/mcp.json`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (removeIntegration && (integration === "claude" || integration === "all")) {
|
|
136
|
-
const { uninitClaude } = await Promise.resolve().then(() => require("../installer/targets/claude.js"));
|
|
137
|
-
uninitClaude(target);
|
|
138
|
-
}
|
|
139
|
-
if (removeIntegration && (integration === "codex" || integration === "all")) {
|
|
140
|
-
const { uninitCodex } = await Promise.resolve().then(() => require("../installer/targets/codex.js"));
|
|
141
|
-
uninitCodex(target);
|
|
142
191
|
}
|
|
143
192
|
console.log(`
|
|
144
|
-
${import_ui.dim}Done. Run ${import_ui.violet}kirograph install --target ${
|
|
193
|
+
${import_ui.dim}Done. Run ${import_ui.violet}kirograph install --target ${targetName === "all" ? "kiro" : targetName}${import_ui.reset}${import_ui.dim} to come back anytime.${import_ui.reset}
|
|
145
194
|
`);
|
|
146
195
|
}
|
|
147
196
|
function register(program) {
|
|
148
|
-
program.command("uninit [projectPath]").description("Remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>",
|
|
149
|
-
program.command("uninstall [projectPath]").description("Alias for uninit. Remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>",
|
|
197
|
+
program.command("uninit [projectPath]").description("Remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>", `Integration target to clean up (or "all"): ${ALL_TARGETS.slice(0, 6).join(", ")}, ...`, "kiro").action(runUninit);
|
|
198
|
+
program.command("uninstall [projectPath]").description("Alias for uninit. Remove KiroGraph from a project").option("--force", "Skip confirmation").option("--target <target>", `Integration target to clean up (or "all"): ${ALL_TARGETS.slice(0, 6).join(", ")}, ...`, "kiro").action(runUninit);
|
|
150
199
|
}
|
|
151
200
|
// Annotate the CommonJS export names for ESM import in node:
|
|
152
201
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/bin/commands/uninit.ts"],
|
|
4
|
-
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport * as readline from 'readline';\nimport { printBanner } from '../banner';\nimport { dim, reset, violet, bold, green } from '../ui';\nimport { askToggle } from '../installer/prompts';\n\nexport const UNINIT_FAREWELLS = [\n \"Oh. So it's come to this.\",\n \"We're sorry to see you go. (Are we? Yes. We are.)\",\n \"Deleting months of carefully indexed knowledge. Bold move.\",\n \"Fine. We'll just sit here in the dark.\",\n \"You can always come back. We won't mention this.\",\n \"The graph remembers everything. Except, soon, anything.\",\n \"Somewhere a tree-sitter is crying.\",\n \"Uninstalling... and pretending it doesn't hurt.\",\n \"574 embeddings. Gone. Just like that.\",\n \"See you on the other side of `kirograph install`.\",\n];\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,SAAoB;AACpB,eAA0B;AAC1B,oBAA4B;AAC5B,gBAAgD;AAChD,qBAA0B;
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport * as readline from 'readline';\nimport { printBanner } from '../banner';\nimport { dim, reset, violet, bold, green } from '../ui';\nimport { askToggle } from '../installer/prompts';\nimport type { InstallTarget } from '../installer/common';\nimport { getTargetInstaller } from '../installer/targets';\n\nexport const UNINIT_FAREWELLS = [\n \"Oh. So it's come to this.\",\n \"We're sorry to see you go. (Are we? Yes. We are.)\",\n \"Deleting months of carefully indexed knowledge. Bold move.\",\n \"Fine. We'll just sit here in the dark.\",\n \"You can always come back. We won't mention this.\",\n \"The graph remembers everything. Except, soon, anything.\",\n \"Somewhere a tree-sitter is crying.\",\n \"Uninstalling... and pretending it doesn't hurt.\",\n \"574 embeddings. Gone. Just like that.\",\n \"See you on the other side of `kirograph install`.\",\n];\n\nconst ALL_TARGETS: InstallTarget[] = [\n 'kiro', 'claude', 'codex', 'cursor', 'antigravity', 'opencode',\n 'windsurf', 'cline', 'copilot', 'junie', 'gemini-cli',\n 'continue', 'roo', 'warp', 'aider', 'trae',\n 'augment', 'kilo', 'amp', 'devin', 'replit', 'goose', 'openhands', 'tabnine',\n 'mistral-vibe', 'ibm-bob', 'crush', 'droid-factory', 'forgecode', 'iflow', 'qwen', 'rovo', 'qoder',\n];\n\nfunction isValidTarget(t: string): t is InstallTarget | 'all' {\n return t === 'all' || ALL_TARGETS.includes(t as InstallTarget);\n}\n\nfunction uninitKiro(projectRoot: string): void {\n // Remove .kiro hooks created by kirograph\n const kiroHooks = [\n 'kirograph-mark-dirty-on-save.kiro.hook',\n 'kirograph-mark-dirty-on-create.kiro.hook',\n 'kirograph-sync-on-delete.kiro.hook',\n 'kirograph-sync-if-dirty.kiro.hook',\n 'kirograph-compress-hint.kiro.hook',\n 'kirograph-mem-capture.kiro.hook',\n // Legacy .json filenames\n 'kirograph-mark-dirty-on-save.json',\n 'kirograph-mark-dirty-on-create.json',\n 'kirograph-sync-on-delete.json',\n 'kirograph-sync-if-dirty.json',\n 'kirograph-sync-on-save.json',\n 'kirograph-sync-on-create.json',\n 'kirograph-compress-hint.json',\n 'kirograph-mem-capture.json',\n ];\n const hooksDir = path.join(projectRoot, '.kiro', 'hooks');\n let removedHooks = 0;\n for (const hook of kiroHooks) {\n const p = path.join(hooksDir, hook);\n if (fs.existsSync(p)) { fs.unlinkSync(p); removedHooks++; }\n }\n if (removedHooks > 0) console.log(` ${green}\u2713${reset} Removed ${removedHooks} hook(s) from .kiro/hooks/`);\n\n // Remove .kiro/steering/kirograph*.md (main + all workflow files)\n const steeringDir = path.join(projectRoot, '.kiro', 'steering');\n let removedSteering = 0;\n if (fs.existsSync(steeringDir)) {\n for (const entry of fs.readdirSync(steeringDir)) {\n if (entry.startsWith('kirograph') && entry.endsWith('.md')) {\n fs.unlinkSync(path.join(steeringDir, entry));\n removedSteering++;\n }\n }\n }\n if (removedSteering > 0) {\n console.log(` ${green}\u2713${reset} Removed ${removedSteering} steering file(s) from .kiro/steering/`);\n }\n\n // Remove .kiro/agents/kirograph.json\n const agentPath = path.join(projectRoot, '.kiro', 'agents', 'kirograph.json');\n if (fs.existsSync(agentPath)) {\n fs.unlinkSync(agentPath);\n console.log(` ${green}\u2713${reset} Removed .kiro/agents/kirograph.json`);\n }\n\n // Remove kirograph server from .kiro/settings/mcp.json\n const { removeMcpServersConfig } = require('../installer/common');\n const mcpPath = path.join(projectRoot, '.kiro', 'settings', 'mcp.json');\n if (removeMcpServersConfig(mcpPath)) {\n console.log(` ${green}\u2713${reset} Removed kirograph from .kiro/settings/mcp.json`);\n }\n}\n\nasync function runUninit(projectPath: string | undefined, opts: { force?: boolean; target?: string }): Promise<void> {\n const projectRoot = path.resolve(projectPath ?? process.cwd());\n const targetName = (opts.target ?? 'kiro').toLowerCase();\n\n if (!isValidTarget(targetName)) {\n console.error(`Unknown uninit target: ${opts.target}. Choose from: ${ALL_TARGETS.join(', ')}, all`);\n process.exit(1);\n }\n\n const dir = path.join(projectRoot, '.kirograph');\n if (!fs.existsSync(dir)) { console.log('Not initialized.'); return; }\n\n let removeIntegration = true;\n let removeGraph = opts.force === true;\n\n if (!opts.force) {\n printBanner();\n const farewell = UNINIT_FAREWELLS[Math.floor(Math.random() * UNINIT_FAREWELLS.length)]!;\n console.log(` ${violet}${bold}${farewell}${reset}`);\n console.log(`\\n ${dim}This can remove ${targetName} integration files and, separately, the shared .kirograph/ data.${reset}`);\n console.log(` ${dim}Your source code is untouched.${reset}`);\n\n const rl = readline.createInterface({ input: process.stdin, output: process.stdout });\n\n removeIntegration = await askToggle(rl, `Remove ${targetName} integration files?`, 'Removes hooks, MCP config, rules, and agent instructions for this target.', false);\n removeGraph = await askToggle(rl, 'Remove shared .kirograph/ data too?', 'Deletes the graph database, snapshots, and all indexed data. Cannot be undone.', false);\n\n rl.close();\n\n if (!removeIntegration && !removeGraph) {\n console.log(`\\n ${dim}Cancelled. Nothing removed.${reset}\\n`);\n return;\n }\n console.log();\n }\n\n if (removeGraph) {\n fs.rmSync(dir, { recursive: true, force: true });\n console.log(` ${green}\u2713${reset} Removed .kirograph/`);\n }\n\n if (removeIntegration) {\n const targets: InstallTarget[] = targetName === 'all' ? [...ALL_TARGETS] : [targetName as InstallTarget];\n\n for (const t of targets) {\n if (t === 'kiro') {\n uninitKiro(projectRoot);\n } else {\n const installer = getTargetInstaller(t);\n installer.uninit?.(projectRoot);\n }\n }\n }\n\n console.log(`\\n ${dim}Done. Run ${violet}kirograph install --target ${targetName === 'all' ? 'kiro' : targetName}${reset}${dim} to come back anytime.${reset}\\n`);\n}\n\nexport function register(program: Command): void {\n program\n .command('uninit [projectPath]')\n .description('Remove KiroGraph from a project')\n .option('--force', 'Skip confirmation')\n .option('--target <target>', `Integration target to clean up (or \"all\"): ${ALL_TARGETS.slice(0, 6).join(', ')}, ...`, 'kiro')\n .action(runUninit);\n\n program\n .command('uninstall [projectPath]')\n .description('Alias for uninit. Remove KiroGraph from a project')\n .option('--force', 'Skip confirmation')\n .option('--target <target>', `Integration target to clean up (or \"all\"): ${ALL_TARGETS.slice(0, 6).join(', ')}, ...`, 'kiro')\n .action(runUninit);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,WAAsB;AACtB,SAAoB;AACpB,eAA0B;AAC1B,oBAA4B;AAC5B,gBAAgD;AAChD,qBAA0B;AAE1B,qBAAmC;AAE5B,MAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,cAA+B;AAAA,EACnC;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAS;AAAA,EAAU;AAAA,EAAe;AAAA,EACpD;AAAA,EAAY;AAAA,EAAS;AAAA,EAAW;AAAA,EAAS;AAAA,EACzC;AAAA,EAAY;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAS;AAAA,EACpC;AAAA,EAAW;AAAA,EAAQ;AAAA,EAAO;AAAA,EAAS;AAAA,EAAU;AAAA,EAAS;AAAA,EAAa;AAAA,EACnE;AAAA,EAAgB;AAAA,EAAW;AAAA,EAAS;AAAA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defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var vex_exports = {};
|
|
30
|
+
__export(vex_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(vex_exports);
|
|
34
|
+
var fs = __toESM(require("fs"));
|
|
35
|
+
var path = __toESM(require("path"));
|
|
36
|
+
var import_config = require("../../config");
|
|
37
|
+
var import_ui = require("../ui");
|
|
38
|
+
function register(program) {
|
|
39
|
+
program.command("vex [projectPath]").description("Export CycloneDX 1.5 VEX (Vulnerability Exploitability eXchange)").option("--output <file>", "Write VEX to file instead of stdout").action(async (projectPath, opts) => {
|
|
40
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
41
|
+
const config = await (0, import_config.loadConfig)(target);
|
|
42
|
+
if (!config.enableSecurity) {
|
|
43
|
+
console.error(`
|
|
44
|
+
${"\x1B[33m"}\u26A0 Security analysis is disabled.${import_ui.reset}`);
|
|
45
|
+
console.error(` ${import_ui.dim}Enable it in .kirograph/config.json:${import_ui.reset} ${import_ui.violet}${import_ui.bold}"enableSecurity": true${import_ui.reset}`);
|
|
46
|
+
console.error(` ${import_ui.dim}Then re-run:${import_ui.reset} ${import_ui.violet}${import_ui.bold}kirograph index${import_ui.reset}
|
|
47
|
+
`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
const KiroGraph = (await Promise.resolve().then(() => require("../../index.js"))).default;
|
|
51
|
+
if (!KiroGraph.isInitialized(target)) {
|
|
52
|
+
console.error(" \u2716 KiroGraph not initialized. Run: kirograph init");
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
const cg = await KiroGraph.open(target);
|
|
56
|
+
const db = cg.getDatabase();
|
|
57
|
+
db.applySecuritySchema();
|
|
58
|
+
const { VEXExporter } = await Promise.resolve().then(() => require("../../security/export/vex.js"));
|
|
59
|
+
const exporter = new VEXExporter(db, target);
|
|
60
|
+
const json = exporter.exportJSON();
|
|
61
|
+
if (opts.output) {
|
|
62
|
+
const outPath = path.resolve(opts.output);
|
|
63
|
+
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
|
64
|
+
fs.writeFileSync(outPath, json, "utf-8");
|
|
65
|
+
console.error(` ${import_ui.green}\u2713${import_ui.reset} VEX written to ${import_ui.violet}${import_ui.bold}${outPath}${import_ui.reset}`);
|
|
66
|
+
} else {
|
|
67
|
+
process.stdout.write(json + "\n");
|
|
68
|
+
}
|
|
69
|
+
cg.close();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
register
|
|
75
|
+
});
|
|
76
|
+
//# sourceMappingURL=vex.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/bin/commands/vex.ts"],
|
|
4
|
+
"sourcesContent": ["import { Command } from 'commander';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { loadConfig } from '../../config';\nimport { dim, reset, violet, bold, green } from '../ui';\n\nexport function register(program: Command): void {\n program\n .command('vex [projectPath]')\n .description('Export CycloneDX 1.5 VEX (Vulnerability Exploitability eXchange)')\n .option('--output <file>', 'Write VEX to file instead of stdout')\n .action(async (projectPath: string | undefined, opts: { output?: string }) => {\n const target = path.resolve(projectPath ?? process.cwd());\n const config = await loadConfig(target);\n\n if (!config.enableSecurity) {\n console.error(`\\n ${'\\x1b[33m'}\u26A0 Security analysis is disabled.${reset}`);\n console.error(` ${dim}Enable it in .kirograph/config.json:${reset} ${violet}${bold}\"enableSecurity\": true${reset}`);\n console.error(` ${dim}Then re-run:${reset} ${violet}${bold}kirograph index${reset}\\n`);\n process.exit(1);\n }\n\n const KiroGraph = (await Promise.resolve().then(() => require('../../index.js'))).default;\n if (!KiroGraph.isInitialized(target)) {\n console.error(' \u2716 KiroGraph not initialized. Run: kirograph init');\n process.exit(1);\n }\n\n const cg = await KiroGraph.open(target);\n const db = cg.getDatabase();\n db.applySecuritySchema();\n\n const { VEXExporter } = await Promise.resolve().then(() => require('../../security/export/vex.js'));\n const exporter = new VEXExporter(db, target);\n const json = exporter.exportJSON();\n\n if (opts.output) {\n const outPath = path.resolve(opts.output);\n fs.mkdirSync(path.dirname(outPath), { recursive: true });\n fs.writeFileSync(outPath, json, 'utf-8');\n console.error(` ${green}\u2713${reset} VEX written to ${violet}${bold}${outPath}${reset}`);\n }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,KAAK,QAAQ,KAAK,MAAM;AACxC,SAAG,UAAU,KAAK,QAAQ,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;AACvD,SAAG,cAAc,SAAS,MAAM,OAAO;AACvC,cAAQ,MAAM,KAAK,eAAK,SAAI,eAAK,mBAAmB,gBAAM,GAAG,cAAI,GAAG,OAAO,GAAG,eAAK,EAAE;AAAA,IACvF,OAAO;AACL,cAAQ,OAAO,MAAM,OAAO,IAAI;AAAA,IAClC;AAEA,OAAG,MAAM;AAAA,EACX,CAAC;AACL;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var vuln_suppress_exports = {};
|
|
30
|
+
__export(vuln_suppress_exports, {
|
|
31
|
+
register: () => register
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(vuln_suppress_exports);
|
|
34
|
+
var path = __toESM(require("path"));
|
|
35
|
+
var import_ui = require("../ui");
|
|
36
|
+
var import_suppressions = require("../../security/suppressions");
|
|
37
|
+
function register(program) {
|
|
38
|
+
const vulnCmd = program.command("vuln").description("CVE suppression management");
|
|
39
|
+
vulnCmd.command("suppress <cveId> [projectPath]").description("Mark a CVE as suppressed (false positive or accepted risk)").option("--reason <text>", "Reason for suppression").option("--expires <date>", "Expiry date in ISO format (e.g. 2026-12-31)").action(async (cveId, projectPath, opts) => {
|
|
40
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
41
|
+
const manager = new import_suppressions.SuppressionManager(target);
|
|
42
|
+
manager.add(cveId, opts.reason, opts.expires);
|
|
43
|
+
const reasonNote = opts.reason ? ` ${import_ui.dim}(${opts.reason})${import_ui.reset}` : "";
|
|
44
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} ${import_ui.violet}${import_ui.bold}${cveId}${import_ui.reset} suppressed${reasonNote}`);
|
|
45
|
+
});
|
|
46
|
+
vulnCmd.command("unsuppress <cveId> [projectPath]").description("Remove a CVE suppression").action(async (cveId, projectPath) => {
|
|
47
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
48
|
+
const manager = new import_suppressions.SuppressionManager(target);
|
|
49
|
+
const removed = manager.remove(cveId);
|
|
50
|
+
if (!removed) {
|
|
51
|
+
console.error(` \u2716 No suppression found for ${import_ui.violet}${import_ui.bold}${cveId}${import_ui.reset}`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
console.log(` ${import_ui.green}\u2713${import_ui.reset} ${import_ui.violet}${import_ui.bold}${cveId}${import_ui.reset} unsuppressed`);
|
|
55
|
+
});
|
|
56
|
+
vulnCmd.command("suppressions [projectPath]").description("List all active CVE suppressions").option("--format <fmt>", "Output format: table | json", "table").action(async (projectPath, opts) => {
|
|
57
|
+
const target = path.resolve(projectPath ?? process.cwd());
|
|
58
|
+
const manager = new import_suppressions.SuppressionManager(target);
|
|
59
|
+
const suppressions = manager.getActive();
|
|
60
|
+
if (opts.format === "json") {
|
|
61
|
+
console.log(JSON.stringify(suppressions, null, 2));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (suppressions.length === 0) {
|
|
65
|
+
console.log(`
|
|
66
|
+
${import_ui.dim}No active suppressions.${import_ui.reset}
|
|
67
|
+
`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const CVE_W = Math.max(6, ...suppressions.map((s) => s.cveId.length));
|
|
71
|
+
const DATE_W = 12;
|
|
72
|
+
const EXP_W = 12;
|
|
73
|
+
const header = ` ${import_ui.bold}${"CVE ID".padEnd(CVE_W)}${import_ui.reset} ${import_ui.bold}${"Suppressed At".padEnd(DATE_W)}${import_ui.reset} ${import_ui.bold}${"Expires".padEnd(EXP_W)}${import_ui.reset} ${import_ui.bold}Reason${import_ui.reset}`;
|
|
74
|
+
const separator = ` ${"\u2500".repeat(CVE_W)} ${"\u2500".repeat(DATE_W)} ${"\u2500".repeat(EXP_W)} ${"\u2500".repeat(20)}`;
|
|
75
|
+
console.log(`
|
|
76
|
+
${import_ui.bold}Active Suppressions${import_ui.reset} (${suppressions.length})
|
|
77
|
+
`);
|
|
78
|
+
console.log(header);
|
|
79
|
+
console.log(separator);
|
|
80
|
+
for (const s of suppressions) {
|
|
81
|
+
const suppressedDate = s.suppressedAt.slice(0, 10);
|
|
82
|
+
const expiresStr = s.expiresAt ? s.expiresAt.slice(0, 10) : import_ui.dim + "\u2014" + import_ui.reset;
|
|
83
|
+
const reasonStr = s.reason ? `${import_ui.dim}${s.reason}${import_ui.reset}` : `${import_ui.dim}\u2014${import_ui.reset}`;
|
|
84
|
+
console.log(
|
|
85
|
+
` ${import_ui.violet}${s.cveId.padEnd(CVE_W)}${import_ui.reset} ${suppressedDate.padEnd(DATE_W)} ${expiresStr.padEnd(EXP_W + (s.expiresAt ? 0 : (import_ui.dim + import_ui.reset).length))} ${reasonStr}`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
console.log();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
register
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=vuln-suppress.js.map
|