codebase-onboarder 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +196 -47
- package/bin/build-if-source.js +23 -0
- package/cli/commands.d.ts +26 -0
- package/cli/commands.js +836 -811
- package/cli/commands.js.map +1 -0
- package/cli/explorer/advanced.d.ts +14 -0
- package/cli/explorer/advanced.js +449 -0
- package/cli/explorer/advanced.js.map +1 -0
- package/cli/explorer/app.d.ts +1 -0
- package/cli/explorer/app.js +396 -229
- package/cli/explorer/app.js.map +1 -0
- package/cli/explorer/assistant.d.ts +9 -0
- package/cli/explorer/assistant.js +58 -0
- package/cli/explorer/assistant.js.map +1 -0
- package/cli/explorer/commands.d.ts +17 -0
- package/cli/explorer/commands.js +400 -162
- package/cli/explorer/commands.js.map +1 -0
- package/cli/explorer/featureViews.d.ts +124 -0
- package/cli/explorer/featureViews.js +179 -0
- package/cli/explorer/featureViews.js.map +1 -0
- package/cli/explorer/github.d.ts +21 -0
- package/cli/explorer/github.js +73 -0
- package/cli/explorer/github.js.map +1 -0
- package/cli/explorer/graphs.d.ts +7 -0
- package/cli/explorer/graphs.js +173 -0
- package/cli/explorer/graphs.js.map +1 -0
- package/cli/explorer/picker.d.ts +22 -0
- package/cli/explorer/picker.js +150 -0
- package/cli/explorer/picker.js.map +1 -0
- package/cli/explorer/report.d.ts +85 -0
- package/cli/explorer/report.js +60 -0
- package/cli/explorer/report.js.map +1 -0
- package/cli/explorer/session.d.ts +449 -0
- package/cli/explorer/session.js +184 -95
- package/cli/explorer/session.js.map +1 -0
- package/cli/explorer/views.d.ts +19 -0
- package/cli/explorer/views.js +496 -412
- package/cli/explorer/views.js.map +1 -0
- package/cli/explorer/wrap.d.ts +1 -0
- package/cli/explorer/wrap.js +33 -0
- package/cli/explorer/wrap.js.map +1 -0
- package/cli/main.d.ts +1 -0
- package/cli/main.js +235 -138
- package/cli/main.js.map +1 -0
- package/cli/prompt.d.ts +5 -0
- package/cli/prompt.js +84 -80
- package/cli/prompt.js.map +1 -0
- package/cli/scanOptions.d.ts +2 -0
- package/cli/scanOptions.js +11 -0
- package/cli/scanOptions.js.map +1 -0
- package/cli/ui.d.ts +33 -0
- package/cli/ui.js +55 -35
- package/cli/ui.js.map +1 -0
- package/cli/wizard.d.ts +187 -0
- package/cli/wizard.js +304 -284
- package/cli/wizard.js.map +1 -0
- package/package.json +15 -4
- package/public/app.d.ts +1 -0
- package/public/app.js +1057 -1009
- package/public/app.js.map +1 -0
- package/public/browser.d.ts +68 -0
- package/public/browser.js +2 -0
- package/public/browser.js.map +1 -0
- package/public/index.html +30 -13
- package/public/js/about.d.ts +6 -0
- package/public/js/about.js +165 -172
- package/public/js/about.js.map +1 -0
- package/public/js/aiDraft.d.ts +3 -0
- package/public/js/aiDraft.js +116 -124
- package/public/js/aiDraft.js.map +1 -0
- package/public/js/analysisPanel.d.ts +7 -0
- package/public/js/analysisPanel.js +166 -166
- package/public/js/analysisPanel.js.map +1 -0
- package/public/js/analysisReport.d.ts +38 -0
- package/public/js/analysisReport.js +105 -110
- package/public/js/analysisReport.js.map +1 -0
- package/public/js/api.d.ts +26 -0
- package/public/js/api.js +176 -167
- package/public/js/api.js.map +1 -0
- package/public/js/atlas.d.ts +6 -0
- package/public/js/atlas.js +50 -58
- package/public/js/atlas.js.map +1 -0
- package/public/js/blameView.d.ts +2 -0
- package/public/js/blameView.js +36 -37
- package/public/js/blameView.js.map +1 -0
- package/public/js/codeTab.d.ts +3 -0
- package/public/js/codeTab.js +175 -180
- package/public/js/codeTab.js.map +1 -0
- package/public/js/codeViewer.d.ts +5 -0
- package/public/js/codeViewer.js +162 -150
- package/public/js/codeViewer.js.map +1 -0
- package/public/js/components/FileChip.d.ts +9 -0
- package/public/js/components/FileChip.js +45 -49
- package/public/js/components/FileChip.js.map +1 -0
- package/public/js/components/MetricSparkline.d.ts +7 -0
- package/public/js/components/MetricSparkline.js +35 -44
- package/public/js/components/MetricSparkline.js.map +1 -0
- package/public/js/components/RiskBadge.d.ts +9 -0
- package/public/js/components/RiskBadge.js +55 -63
- package/public/js/components/RiskBadge.js.map +1 -0
- package/public/js/deepAnalysisView.d.ts +99 -0
- package/public/js/deepAnalysisView.js +282 -302
- package/public/js/deepAnalysisView.js.map +1 -0
- package/public/js/diagramPane.d.ts +8 -0
- package/public/js/diagramPane.js +133 -135
- package/public/js/diagramPane.js.map +1 -0
- package/public/js/diffView.d.ts +6 -0
- package/public/js/diffView.js +222 -209
- package/public/js/diffView.js.map +1 -0
- package/public/js/docsView.d.ts +2 -0
- package/public/js/docsView.js +441 -442
- package/public/js/docsView.js.map +1 -0
- package/public/js/dom.d.ts +189 -0
- package/public/js/dom.js +5 -0
- package/public/js/dom.js.map +1 -0
- package/public/js/fileSourceBrowser.d.ts +5 -0
- package/public/js/fileSourceBrowser.js +33 -41
- package/public/js/fileSourceBrowser.js.map +1 -0
- package/public/js/flameGraph.d.ts +5 -0
- package/public/js/flameGraph.js +62 -72
- package/public/js/flameGraph.js.map +1 -0
- package/public/js/forceGraph.d.ts +10 -0
- package/public/js/forceGraph.js +581 -556
- package/public/js/forceGraph.js.map +1 -0
- package/public/js/heatmap.d.ts +4 -0
- package/public/js/heatmap.js +142 -164
- package/public/js/heatmap.js.map +1 -0
- package/public/js/highlight.d.ts +2 -0
- package/public/js/highlight.js +116 -107
- package/public/js/highlight.js.map +1 -0
- package/public/js/html.d.ts +2 -0
- package/public/js/html.js +14 -44
- package/public/js/html.js.map +1 -0
- package/public/js/insightsView.d.ts +5 -0
- package/public/js/insightsView.js +93 -111
- package/public/js/insightsView.js.map +1 -0
- package/public/js/inspector.d.ts +37 -0
- package/public/js/inspector.js +416 -445
- package/public/js/inspector.js.map +1 -0
- package/public/js/llm.d.ts +113 -0
- package/public/js/llm.js +233 -272
- package/public/js/llm.js.map +1 -0
- package/public/js/mapView.d.ts +3 -0
- package/public/js/mapView.js +121 -120
- package/public/js/mapView.js.map +1 -0
- package/public/js/markdown.d.ts +3 -0
- package/public/js/markdown.js +84 -91
- package/public/js/markdown.js.map +1 -0
- package/public/js/mindmap.d.ts +32 -0
- package/public/js/mindmap.js +244 -259
- package/public/js/mindmap.js.map +1 -0
- package/public/js/mobilePanels.d.ts +5 -0
- package/public/js/mobilePanels.js +50 -0
- package/public/js/mobilePanels.js.map +1 -0
- package/public/js/repoFiles.d.ts +12 -0
- package/public/js/repoFiles.js +28 -27
- package/public/js/repoFiles.js.map +1 -0
- package/public/js/reviewView.d.ts +28 -0
- package/public/js/reviewView.js +256 -0
- package/public/js/reviewView.js.map +1 -0
- package/public/js/sbomView.d.ts +3 -0
- package/public/js/sbomView.js +59 -67
- package/public/js/sbomView.js.map +1 -0
- package/public/js/scanCache.d.ts +16 -0
- package/public/js/scanCache.js +67 -65
- package/public/js/scanCache.js.map +1 -0
- package/public/js/search.d.ts +7 -0
- package/public/js/search.js +868 -800
- package/public/js/search.js.map +1 -0
- package/public/js/searchLocal.d.ts +42 -0
- package/public/js/searchLocal.js +87 -0
- package/public/js/searchLocal.js.map +1 -0
- package/public/js/serverSettings.d.ts +5 -0
- package/public/js/serverSettings.js +153 -164
- package/public/js/serverSettings.js.map +1 -0
- package/public/js/state.d.ts +798 -0
- package/public/js/state.js +114 -122
- package/public/js/state.js.map +1 -0
- package/public/js/tour.d.ts +6 -0
- package/public/js/tour.js +5 -7
- package/public/js/tour.js.map +1 -0
- package/public/js/transitions.d.ts +2 -0
- package/public/js/transitions.js +9 -10
- package/public/js/transitions.js.map +1 -0
- package/public/js/tree.d.ts +12 -0
- package/public/js/tree.js +157 -154
- package/public/js/tree.js.map +1 -0
- package/public/js/workflowsView.d.ts +3 -0
- package/public/js/workflowsView.js +15 -22
- package/public/js/workflowsView.js.map +1 -0
- package/public/search.css +495 -0
- package/public/styles.css +163 -346
- package/public/workbench.css +166 -0
- package/server/apiAuth.d.ts +3 -0
- package/server/apiAuth.js +18 -20
- package/server/apiAuth.js.map +1 -0
- package/server/apiDiff.d.ts +2 -0
- package/server/apiDiff.js +20 -18
- package/server/apiDiff.js.map +1 -0
- package/server/apiDocs.d.ts +2 -0
- package/server/apiDocs.js +38 -40
- package/server/apiDocs.js.map +1 -0
- package/server/apiFile.d.ts +1 -0
- package/server/apiFile.js +14 -17
- package/server/apiFile.js.map +1 -0
- package/server/apiGitBlame.d.ts +2 -0
- package/server/apiGitBlame.js +50 -51
- package/server/apiGitBlame.js.map +1 -0
- package/server/apiMcp.d.ts +4 -0
- package/server/apiMcp.js +64 -66
- package/server/apiMcp.js.map +1 -0
- package/server/apiReview.d.ts +2 -0
- package/server/apiReview.js +45 -0
- package/server/apiReview.js.map +1 -0
- package/server/apiScan.d.ts +5 -0
- package/server/apiScan.js +90 -71
- package/server/apiScan.js.map +1 -0
- package/server/apiSearch.d.ts +33 -0
- package/server/apiSearch.js +184 -200
- package/server/apiSearch.js.map +1 -0
- package/server/apiSettings.d.ts +4 -0
- package/server/apiSettings.js +84 -85
- package/server/apiSettings.js.map +1 -0
- package/server/apiTools.d.ts +3 -0
- package/server/apiTools.js +55 -56
- package/server/apiTools.js.map +1 -0
- package/server/auth.d.ts +5 -0
- package/server/auth.js +54 -51
- package/server/auth.js.map +1 -0
- package/server/config.d.ts +42 -0
- package/server/config.js +189 -194
- package/server/config.js.map +1 -0
- package/server/daemon.d.ts +12 -0
- package/server/daemon.js +124 -114
- package/server/daemon.js.map +1 -0
- package/server/fileSourceNode.d.ts +2 -0
- package/server/fileSourceNode.js +34 -36
- package/server/fileSourceNode.js.map +1 -0
- package/server/gitClone.d.ts +9 -0
- package/server/gitClone.js +59 -61
- package/server/gitClone.js.map +1 -0
- package/server/gitDiff.d.ts +36 -0
- package/server/gitDiff.js +271 -169
- package/server/gitDiff.js.map +1 -0
- package/server/gitHistory.d.ts +12 -0
- package/server/gitHistory.js +80 -80
- package/server/gitHistory.js.map +1 -0
- package/server/gitRemote.d.ts +12 -0
- package/server/gitRemote.js +60 -0
- package/server/gitRemote.js.map +1 -0
- package/server/htmlText.d.ts +4 -0
- package/server/htmlText.js +16 -23
- package/server/htmlText.js.map +1 -0
- package/server/http.d.ts +5 -0
- package/server/http.js +27 -30
- package/server/http.js.map +1 -0
- package/server/httpGuards.d.ts +2 -0
- package/server/httpGuards.js +47 -43
- package/server/httpGuards.js.map +1 -0
- package/server/https.d.ts +34 -0
- package/server/https.js +121 -111
- package/server/https.js.map +1 -0
- package/server/index.d.ts +40 -0
- package/server/index.js +139 -147
- package/server/index.js.map +1 -0
- package/server/layout.d.ts +26 -0
- package/server/layout.js +59 -37
- package/server/layout.js.map +1 -0
- package/server/llmProxy.d.ts +3 -0
- package/server/llmProxy.js +137 -135
- package/server/llmProxy.js.map +1 -0
- package/server/logger.d.ts +38 -0
- package/server/logger.js +198 -211
- package/server/logger.js.map +1 -0
- package/server/mcp/analysis.d.ts +29 -0
- package/server/mcp/analysis.js +99 -120
- package/server/mcp/analysis.js.map +1 -0
- package/server/mcp/http.d.ts +9 -0
- package/server/mcp/http.js +128 -137
- package/server/mcp/http.js.map +1 -0
- package/server/mcp/runner.d.ts +68 -0
- package/server/mcp/runner.js +208 -218
- package/server/mcp/runner.js.map +1 -0
- package/server/mcp/server.d.ts +29 -0
- package/server/mcp/server.js +166 -179
- package/server/mcp/server.js.map +1 -0
- package/server/mcp/standalone.d.ts +1 -0
- package/server/mcp/standalone.js +8 -10
- package/server/mcp/standalone.js.map +1 -0
- package/server/mcp/tools.d.ts +2020 -0
- package/server/mcp/tools.js +523 -574
- package/server/mcp/tools.js.map +1 -0
- package/server/paths.d.ts +3 -0
- package/server/paths.js +17 -15
- package/server/paths.js.map +1 -0
- package/server/pidfile.d.ts +9 -0
- package/server/pidfile.js +43 -45
- package/server/pidfile.js.map +1 -0
- package/server/review.d.ts +5 -0
- package/server/review.js +35 -0
- package/server/review.js.map +1 -0
- package/server/router.d.ts +33 -0
- package/server/router.js +191 -197
- package/server/router.js.map +1 -0
- package/server/scanRequest.d.ts +3 -0
- package/server/scanRequest.js +36 -0
- package/server/scanRequest.js.map +1 -0
- package/server/searchIndex.d.ts +17 -0
- package/server/searchIndex.js +83 -80
- package/server/searchIndex.js.map +1 -0
- package/server/sessions.d.ts +14 -0
- package/server/sessions.js +62 -70
- package/server/sessions.js.map +1 -0
- package/server/startup.d.ts +118 -0
- package/server/startup.js +143 -148
- package/server/startup.js.map +1 -0
- package/server/static.d.ts +6 -0
- package/server/static.js +28 -31
- package/server/static.js.map +1 -0
- package/server/tools/install.d.ts +4 -0
- package/server/tools/install.js +176 -185
- package/server/tools/install.js.map +1 -0
- package/server/tools/parse.d.ts +8 -0
- package/server/tools/parse.js +112 -114
- package/server/tools/parse.js.map +1 -0
- package/server/tools/platform.d.ts +9 -0
- package/server/tools/platform.js +49 -47
- package/server/tools/platform.js.map +1 -0
- package/server/tools/registry.d.ts +137 -0
- package/server/tools/registry.js +173 -172
- package/server/tools/registry.js.map +1 -0
- package/server/tools/scan.d.ts +34 -0
- package/server/tools/scan.js +89 -98
- package/server/tools/scan.js.map +1 -0
- package/server/tools.d.ts +34 -0
- package/server/tools.js +94 -107
- package/server/tools.js.map +1 -0
- package/server/tunnel.d.ts +29 -0
- package/server/tunnel.js +61 -66
- package/server/tunnel.js.map +1 -0
- package/shared/analyzer/docs.d.ts +16 -0
- package/shared/analyzer/docs.js +99 -93
- package/shared/analyzer/docs.js.map +1 -0
- package/shared/analyzer/explainLocal.d.ts +4 -0
- package/shared/analyzer/explainLocal.js +122 -142
- package/shared/analyzer/explainLocal.js.map +1 -0
- package/shared/analyzer/github.d.ts +37 -0
- package/shared/analyzer/github.js +79 -0
- package/shared/analyzer/github.js.map +1 -0
- package/shared/analyzer/graph.d.ts +41 -0
- package/shared/analyzer/graph.js +393 -400
- package/shared/analyzer/graph.js.map +1 -0
- package/shared/analyzer/health.d.ts +33 -0
- package/shared/analyzer/health.js +197 -193
- package/shared/analyzer/health.js.map +1 -0
- package/shared/analyzer/history.d.ts +29 -0
- package/shared/analyzer/history.js +110 -111
- package/shared/analyzer/history.js.map +1 -0
- package/shared/analyzer/jsonConfig.d.ts +2 -0
- package/shared/analyzer/jsonConfig.js +61 -0
- package/shared/analyzer/jsonConfig.js.map +1 -0
- package/shared/analyzer/languages/csharp.d.ts +26 -0
- package/shared/analyzer/languages/csharp.js +83 -88
- package/shared/analyzer/languages/csharp.js.map +1 -0
- package/shared/analyzer/languages/generic.d.ts +23 -0
- package/shared/analyzer/languages/generic.js +94 -105
- package/shared/analyzer/languages/generic.js.map +1 -0
- package/shared/analyzer/languages/go.d.ts +24 -0
- package/shared/analyzer/languages/go.js +45 -54
- package/shared/analyzer/languages/go.js.map +1 -0
- package/shared/analyzer/languages/index.d.ts +6 -0
- package/shared/analyzer/languages/index.js +19 -20
- package/shared/analyzer/languages/index.js.map +1 -0
- package/shared/analyzer/languages/java.d.ts +20 -0
- package/shared/analyzer/languages/java.js +73 -78
- package/shared/analyzer/languages/java.js.map +1 -0
- package/shared/analyzer/languages/javascript.d.ts +12 -0
- package/shared/analyzer/languages/javascript.js +258 -209
- package/shared/analyzer/languages/javascript.js.map +1 -0
- package/shared/analyzer/languages/python.d.ts +23 -0
- package/shared/analyzer/languages/python.js +92 -100
- package/shared/analyzer/languages/python.js.map +1 -0
- package/shared/analyzer/languages/rust.d.ts +17 -0
- package/shared/analyzer/languages/rust.js +96 -98
- package/shared/analyzer/languages/rust.js.map +1 -0
- package/shared/analyzer/languages/typescript.d.ts +11 -0
- package/shared/analyzer/languages/typescript.js +117 -116
- package/shared/analyzer/languages/typescript.js.map +1 -0
- package/shared/analyzer/licenses.d.ts +18 -0
- package/shared/analyzer/licenses.js +130 -133
- package/shared/analyzer/licenses.js.map +1 -0
- package/shared/analyzer/metrics.d.ts +20 -0
- package/shared/analyzer/metrics.js +112 -104
- package/shared/analyzer/metrics.js.map +1 -0
- package/shared/analyzer/pathUtil.d.ts +10 -0
- package/shared/analyzer/pathUtil.js +29 -35
- package/shared/analyzer/pathUtil.js.map +1 -0
- package/shared/analyzer/patterns.d.ts +11 -0
- package/shared/analyzer/patterns.js +231 -253
- package/shared/analyzer/patterns.js.map +1 -0
- package/shared/analyzer/scan.d.ts +62 -0
- package/shared/analyzer/scan.js +451 -442
- package/shared/analyzer/scan.js.map +1 -0
- package/shared/analyzer/scanControl.d.ts +11 -0
- package/shared/analyzer/scanControl.js +62 -0
- package/shared/analyzer/scanControl.js.map +1 -0
- package/shared/analyzer/security.d.ts +18 -0
- package/shared/analyzer/security.js +159 -159
- package/shared/analyzer/security.js.map +1 -0
- package/shared/analyzer/services.d.ts +5 -0
- package/shared/analyzer/services.js +141 -138
- package/shared/analyzer/services.js.map +1 -0
- package/shared/analyzer/stack.d.ts +6 -0
- package/shared/analyzer/stack.js +134 -141
- package/shared/analyzer/stack.js.map +1 -0
- package/shared/analyzer/tour.d.ts +2 -0
- package/shared/analyzer/tour.js +45 -53
- package/shared/analyzer/tour.js.map +1 -0
- package/shared/analyzer/util.d.ts +8 -0
- package/shared/analyzer/util.js +130 -76
- package/shared/analyzer/util.js.map +1 -0
- package/shared/analyzer/workflows.d.ts +8 -0
- package/shared/analyzer/workflows.js +139 -134
- package/shared/analyzer/workflows.js.map +1 -0
- package/shared/contracts.d.ts +250 -0
- package/shared/contracts.js +2 -0
- package/shared/contracts.js.map +1 -0
- package/shared/diagram/aiFacts.d.ts +35 -0
- package/shared/diagram/aiFacts.js +102 -105
- package/shared/diagram/aiFacts.js.map +1 -0
- package/shared/diagram/aiMermaid.d.ts +5 -0
- package/shared/diagram/aiMermaid.js +46 -45
- package/shared/diagram/aiMermaid.js.map +1 -0
- package/shared/diagram/atlas.d.ts +16 -0
- package/shared/diagram/atlas.js +51 -60
- package/shared/diagram/atlas.js.map +1 -0
- package/shared/diagram/mermaid.d.ts +43 -0
- package/shared/diagram/mermaid.js +348 -370
- package/shared/diagram/mermaid.js.map +1 -0
- package/shared/review/contracts.d.ts +95 -0
- package/shared/review/contracts.js +2 -0
- package/shared/review/contracts.js.map +1 -0
- package/shared/review/review.d.ts +10 -0
- package/shared/review/review.js +184 -0
- package/shared/review/review.js.map +1 -0
- package/shared/search/query.d.ts +32 -0
- package/shared/search/query.js +395 -388
- package/shared/search/query.js.map +1 -0
package/server/tools/registry.js
CHANGED
|
@@ -4,209 +4,210 @@
|
|
|
4
4
|
// every entry is well-formed, and the UI renders it as the "available tools"
|
|
5
5
|
// list. A new analyzer is a new entry here and a new parser in `parse.js`;
|
|
6
6
|
// nothing else should have to know about it.
|
|
7
|
-
|
|
8
7
|
import os from 'node:os';
|
|
9
8
|
import path from 'node:path';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
parseDepcheck, parseGitleaks, parseKnip, parseSemgrep, parseVulture,
|
|
13
|
-
} from './parse.js';
|
|
14
|
-
|
|
9
|
+
import { parseDepcheck, parseGitleaks, parseKnip, parseSemgrep, parseVulture, } from './parse.js';
|
|
15
10
|
// `rel` turns a tool's absolute path into the repo-relative path the whole app
|
|
16
11
|
// uses. Tools report paths rooted wherever they ran from.
|
|
17
12
|
const makeRel = (root) => (p) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
const s = String(p || '');
|
|
14
|
+
const win = s.startsWith(root + '\\') ? s.slice(root.length + 1) : null;
|
|
15
|
+
if (win)
|
|
16
|
+
return win.replace(/\\/g, '/');
|
|
17
|
+
return s.startsWith(root + '/') ? s.slice(root.length + 1) : s.replace(/^[/\\]+/, '');
|
|
22
18
|
};
|
|
23
|
-
|
|
24
19
|
// Gitleaks writes its JSON to a *file* (`--report-path`); the old code pointed
|
|
25
20
|
// that at `/dev/stdout`, a path Windows does not have. Every run gets a real
|
|
26
21
|
// temp file instead, which `scan.js` reads and removes afterwards.
|
|
27
22
|
function defaultReportPath() {
|
|
28
|
-
|
|
23
|
+
return path.join(os.tmpdir(), `onboarder-gitleaks-${process.pid}.json`);
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
// The options schema is data for two consumers. The GUI renders it as a small
|
|
32
26
|
// per-engine form (select, checkbox, number) so a person can use what each
|
|
33
27
|
// tool actually offers without a terminal; the server's `sanitizeOptions`
|
|
34
28
|
// walks the same list and drops anything else, so an option the registry does
|
|
35
29
|
// not declare can never reach a command line.
|
|
36
|
-
|
|
37
30
|
export const TOOL_DEFS = [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
31
|
+
{
|
|
32
|
+
id: 'semgrep',
|
|
33
|
+
label: 'Semgrep',
|
|
34
|
+
kind: 'security',
|
|
35
|
+
purpose: 'Deep static analysis — injection, crypto, auth — across 30+ languages.',
|
|
36
|
+
commands: [
|
|
37
|
+
{ kind: 'direct', bin: 'semgrep' },
|
|
38
|
+
{ kind: 'direct', bin: 'opengrep' }, // the OSS fork, drop-in compatible
|
|
39
|
+
{ kind: 'uvx', pkg: 'semgrep', bin: 'semgrep' },
|
|
40
|
+
],
|
|
41
|
+
install: ['Install with: pip install semgrep (or: brew install semgrep, or uv tool install semgrep).'],
|
|
42
|
+
options: [
|
|
43
|
+
{
|
|
44
|
+
key: 'config', label: 'Rule set', type: 'enum',
|
|
45
|
+
values: ['p/default', 'p/security-audit', 'p/secrets', 'p/ci', 'auto'],
|
|
46
|
+
default: 'p/default',
|
|
47
|
+
hint: '“auto” downloads the recommended set — it needs network access.',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'severity', label: 'Minimum severity', type: 'enum',
|
|
51
|
+
values: ['all', 'WARNING', 'ERROR'],
|
|
52
|
+
default: 'all',
|
|
53
|
+
hint: 'ERROR only keeps the findings Semgrep itself calls errors.',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
// `--config auto` needs network; the offline path is `--config p/default`.
|
|
57
|
+
// We run offline by default: self-host means the box may not be online.
|
|
58
|
+
argv: (root, options = {}) => {
|
|
59
|
+
const args = ['scan', '--json', '--quiet', '--no-git-ignore', '--timeout', '60',
|
|
60
|
+
'--config', options.config || 'p/default'];
|
|
61
|
+
if (options.severity === 'WARNING')
|
|
62
|
+
args.push('--severity', 'WARNING', '--severity', 'ERROR');
|
|
63
|
+
if (options.severity === 'ERROR')
|
|
64
|
+
args.push('--severity', 'ERROR');
|
|
65
|
+
args.push(root);
|
|
66
|
+
return args;
|
|
67
|
+
},
|
|
68
|
+
parse: (text, root) => parseSemgrep(JSON.parse(text), makeRel(root)),
|
|
72
69
|
},
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
70
|
+
{
|
|
71
|
+
id: 'gitleaks',
|
|
72
|
+
label: 'Gitleaks',
|
|
73
|
+
kind: 'security',
|
|
74
|
+
purpose: 'Secrets — committed keys, tokens, private keys.',
|
|
75
|
+
commands: [{ kind: 'direct', bin: 'gitleaks' }],
|
|
76
|
+
install: ['Install with: brew install gitleaks (or download the binary from its GitHub releases).'],
|
|
77
|
+
options: [
|
|
78
|
+
{
|
|
79
|
+
key: 'history', label: 'Scan git history too', type: 'boolean',
|
|
80
|
+
default: false,
|
|
81
|
+
hint: 'Slower, but finds secrets that were committed and later deleted.',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
key: 'redact', label: 'Redact secrets in output', type: 'boolean',
|
|
85
|
+
default: true,
|
|
86
|
+
hint: 'The parser never relays a secret either way; this hides it in the raw report too.',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
usesReportFile: true,
|
|
90
|
+
argv: (root, options = {}, ctx = {}) => {
|
|
91
|
+
const args = ['detect', '--source', root,
|
|
92
|
+
'--report-format', 'json', '--report-path', ctx.reportPath || defaultReportPath(),
|
|
93
|
+
'--exit-code', '0'];
|
|
94
|
+
if (!options.history)
|
|
95
|
+
args.push('--no-git');
|
|
96
|
+
if (options.redact !== false)
|
|
97
|
+
args.push('--redact');
|
|
98
|
+
return args;
|
|
99
|
+
},
|
|
100
|
+
parse: (text, root) => parseGitleaks(JSON.parse(text), makeRel(root)),
|
|
102
101
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
102
|
+
{
|
|
103
|
+
id: 'knip',
|
|
104
|
+
label: 'Knip',
|
|
105
|
+
kind: 'dead-code',
|
|
106
|
+
purpose: 'Dead code for JS/TS — unused files, exports and dependencies.',
|
|
107
|
+
commands: [
|
|
108
|
+
{ kind: 'direct', bin: 'knip' },
|
|
109
|
+
{ kind: 'npx', pkg: 'knip' },
|
|
110
|
+
],
|
|
111
|
+
install: ['Install with: npm install -g knip (or run it through npx, which this will do for you).'],
|
|
112
|
+
options: [
|
|
113
|
+
{
|
|
114
|
+
key: 'include', label: 'Issue types', type: 'multi',
|
|
115
|
+
values: ['files', 'dependencies', 'exports', 'types', 'duplicates'],
|
|
116
|
+
default: [],
|
|
117
|
+
hint: 'Nothing checked means Knip reports every kind it knows.',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
argv: (root, options = {}) => {
|
|
121
|
+
const args = ['--reporter', 'json', '--directory', root, '--no-progress'];
|
|
122
|
+
const include = Array.isArray(options.include) ? options.include.filter(Boolean) : [];
|
|
123
|
+
if (include.length)
|
|
124
|
+
args.push('--include', include.join(','));
|
|
125
|
+
return args;
|
|
126
|
+
},
|
|
127
|
+
parse: (text, root) => parseKnip(JSON.parse(text), makeRel(root)),
|
|
128
128
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
129
|
+
{
|
|
130
|
+
id: 'vulture',
|
|
131
|
+
label: 'Vulture',
|
|
132
|
+
kind: 'dead-code',
|
|
133
|
+
purpose: 'Dead code for Python — unused functions, classes, variables.',
|
|
134
|
+
commands: [
|
|
135
|
+
{ kind: 'direct', bin: 'vulture' },
|
|
136
|
+
{ kind: 'uvx', pkg: 'vulture', bin: 'vulture' },
|
|
137
|
+
],
|
|
138
|
+
install: ['Install with: pip install vulture (or run it through uvx, which this will do for you).'],
|
|
139
|
+
options: [
|
|
140
|
+
{
|
|
141
|
+
key: 'minConfidence', label: 'Minimum confidence (%)', type: 'number',
|
|
142
|
+
min: 1, max: 100, default: 60,
|
|
143
|
+
hint: 'Lower finds more, and guesses more. 60 is Vulture’s own default.',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
argv: (root, options = {}) => {
|
|
147
|
+
const n = Number(options.minConfidence);
|
|
148
|
+
const confidence = Number.isFinite(n) ? Math.min(100, Math.max(1, Math.round(n))) : 60;
|
|
149
|
+
return [root, '--min-confidence', String(confidence)];
|
|
150
|
+
},
|
|
151
|
+
parse: (text, root) => parseVulture(text, makeRel(root)),
|
|
152
|
+
textOutput: true,
|
|
152
153
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
154
|
+
{
|
|
155
|
+
id: 'depcheck',
|
|
156
|
+
label: 'Depcheck',
|
|
157
|
+
kind: 'dead-code',
|
|
158
|
+
purpose: 'Unused npm dependencies (a narrower, faster slice of Knip).',
|
|
159
|
+
commands: [
|
|
160
|
+
{ kind: 'direct', bin: 'depcheck' },
|
|
161
|
+
{ kind: 'npx', pkg: 'depcheck' },
|
|
162
|
+
],
|
|
163
|
+
install: ['Install with: npm install -g depcheck (or run it through npx).'],
|
|
164
|
+
options: [
|
|
165
|
+
{
|
|
166
|
+
key: 'skipMissing', label: 'Skip “missing from package.json” reports', type: 'boolean',
|
|
167
|
+
default: false,
|
|
168
|
+
hint: 'Useful when imports are resolved by a bundler depcheck cannot see.',
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
argv: (root, options = {}) => {
|
|
172
|
+
const args = ['--json'];
|
|
173
|
+
if (options.skipMissing)
|
|
174
|
+
args.push('--skip-missing=true');
|
|
175
|
+
return args;
|
|
176
|
+
},
|
|
177
|
+
cwd: true, // depcheck reads the package.json in its working directory
|
|
178
|
+
parse: (text) => parseDepcheck(JSON.parse(text)),
|
|
177
179
|
},
|
|
178
|
-
cwd: true, // depcheck reads the package.json in its working directory
|
|
179
|
-
parse: (text) => parseDepcheck(JSON.parse(text)),
|
|
180
|
-
},
|
|
181
180
|
];
|
|
182
|
-
|
|
183
181
|
// Turn a raw `options` object from a request body into one the registry
|
|
184
182
|
// trusts: only declared keys, values coerced to the declared type, enum and
|
|
185
183
|
// multi values restricted to the declared lists. Anything else falls back to
|
|
186
184
|
// the default — the GUI sends well-formed values, and anything else is noise.
|
|
187
185
|
export function sanitizeOptions(def, raw) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
186
|
+
const clean = {};
|
|
187
|
+
const input = raw && typeof raw === 'object' ? raw : {};
|
|
188
|
+
for (const opt of def.options || []) {
|
|
189
|
+
const value = input[opt.key];
|
|
190
|
+
if (opt.type === 'boolean') {
|
|
191
|
+
clean[opt.key] = value === undefined ? opt.default : Boolean(value);
|
|
192
|
+
}
|
|
193
|
+
else if (opt.type === 'enum') {
|
|
194
|
+
clean[opt.key] = opt.values.includes(value) ? value : opt.default;
|
|
195
|
+
}
|
|
196
|
+
else if (opt.type === 'multi') {
|
|
197
|
+
clean[opt.key] = Array.isArray(value) ? value.filter((v) => opt.values.includes(v)) : [...opt.default];
|
|
198
|
+
}
|
|
199
|
+
else if (opt.type === 'number') {
|
|
200
|
+
const n = Number(value);
|
|
201
|
+
clean[opt.key] = Number.isFinite(n)
|
|
202
|
+
? Math.min(opt.max, Math.max(opt.min, Math.round(n)))
|
|
203
|
+
: opt.default;
|
|
204
|
+
}
|
|
203
205
|
}
|
|
204
|
-
|
|
205
|
-
return clean;
|
|
206
|
+
return clean;
|
|
206
207
|
}
|
|
207
|
-
|
|
208
208
|
// The schema with every default filled in — what the GUI renders before the
|
|
209
209
|
// person touches anything.
|
|
210
210
|
export function defaultOptions(def) {
|
|
211
|
-
|
|
211
|
+
return sanitizeOptions(def, {});
|
|
212
212
|
}
|
|
213
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/server/tools/registry.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,6CAA6C;AAE7C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GACpE,MAAM,YAAY,CAAC;AAEpB,+EAA+E;AAC/E,0DAA0D;AAC1D,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;IAC9B,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1B,MAAM,GAAG,GAAG,CAAC,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,IAAI,GAAG;QAAE,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACxC,OAAO,CAAC,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AACxF,CAAC,CAAC;AAEF,+EAA+E;AAC/E,6EAA6E;AAC7E,mEAAmE;AACnE,SAAS,iBAAiB;IACxB,OAAO,IAAI,CA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KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACjC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrD,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,4EAA4E;AAC5E,2BAA2B;AAC3B,MAAM,UAAU,cAAc,CAAC,GAAG;IAChC,OAAO,eAAe,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC","sourcesContent":["// The registry: what each engine is for, where to find it, and how to run it.\n//\n// This is data, deliberately — the engine in `tools.js` walks it and asserts\n// every entry is well-formed, and the UI renders it as the \"available tools\"\n// list. A new analyzer is a new entry here and a new parser in `parse.js`;\n// nothing else should have to know about it.\n\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport {\n parseDepcheck, parseGitleaks, parseKnip, parseSemgrep, parseVulture,\n} from './parse.js';\n\n// `rel` turns a tool's absolute path into the repo-relative path the whole app\n// uses. Tools report paths rooted wherever they ran from.\nconst makeRel = (root) => (p) => {\n const s = String(p || '');\n const win = s.startsWith(root + '\\\\') ? s.slice(root.length + 1) : null;\n if (win) return win.replace(/\\\\/g, '/');\n return s.startsWith(root + '/') ? s.slice(root.length + 1) : s.replace(/^[/\\\\]+/, '');\n};\n\n// Gitleaks writes its JSON to a *file* (`--report-path`); the old code pointed\n// that at `/dev/stdout`, a path Windows does not have. Every run gets a real\n// temp file instead, which `scan.js` reads and removes afterwards.\nfunction defaultReportPath() {\n return path.join(os.tmpdir(), `onboarder-gitleaks-${process.pid}.json`);\n}\n\n// The options schema is data for two consumers. The GUI renders it as a small\n// per-engine form (select, checkbox, number) so a person can use what each\n// tool actually offers without a terminal; the server's `sanitizeOptions`\n// walks the same list and drops anything else, so an option the registry does\n// not declare can never reach a command line.\n\nexport const TOOL_DEFS = [\n {\n id: 'semgrep',\n label: 'Semgrep',\n kind: 'security',\n purpose: 'Deep static analysis — injection, crypto, auth — across 30+ languages.',\n commands: [\n { kind: 'direct', bin: 'semgrep' },\n { kind: 'direct', bin: 'opengrep' }, // the OSS fork, drop-in compatible\n { kind: 'uvx', pkg: 'semgrep', bin: 'semgrep' },\n ],\n install: ['Install with: pip install semgrep (or: brew install semgrep, or uv tool install semgrep).'],\n options: [\n {\n key: 'config', label: 'Rule set', type: 'enum',\n values: ['p/default', 'p/security-audit', 'p/secrets', 'p/ci', 'auto'],\n default: 'p/default',\n hint: '“auto” downloads the recommended set — it needs network access.',\n },\n {\n key: 'severity', label: 'Minimum severity', type: 'enum',\n values: ['all', 'WARNING', 'ERROR'],\n default: 'all',\n hint: 'ERROR only keeps the findings Semgrep itself calls errors.',\n },\n ],\n // `--config auto` needs network; the offline path is `--config p/default`.\n // We run offline by default: self-host means the box may not be online.\n argv: (root, options: Record<string, any> = {}) => {\n const args = ['scan', '--json', '--quiet', '--no-git-ignore', '--timeout', '60',\n '--config', options.config || 'p/default'];\n if (options.severity === 'WARNING') args.push('--severity', 'WARNING', '--severity', 'ERROR');\n if (options.severity === 'ERROR') args.push('--severity', 'ERROR');\n args.push(root);\n return args;\n },\n parse: (text, root) => parseSemgrep(JSON.parse(text), makeRel(root)),\n },\n {\n id: 'gitleaks',\n label: 'Gitleaks',\n kind: 'security',\n purpose: 'Secrets — committed keys, tokens, private keys.',\n commands: [{ kind: 'direct', bin: 'gitleaks' }],\n install: ['Install with: brew install gitleaks (or download the binary from its GitHub releases).'],\n options: [\n {\n key: 'history', label: 'Scan git history too', type: 'boolean',\n default: false,\n hint: 'Slower, but finds secrets that were committed and later deleted.',\n },\n {\n key: 'redact', label: 'Redact secrets in output', type: 'boolean',\n default: true,\n hint: 'The parser never relays a secret either way; this hides it in the raw report too.',\n },\n ],\n usesReportFile: true,\n argv: (root, options: Record<string, any> = {}, ctx: Record<string, any> = {}) => {\n const args = ['detect', '--source', root,\n '--report-format', 'json', '--report-path', ctx.reportPath || defaultReportPath(),\n '--exit-code', '0'];\n if (!options.history) args.push('--no-git');\n if (options.redact !== false) args.push('--redact');\n return args;\n },\n parse: (text, root) => parseGitleaks(JSON.parse(text), makeRel(root)),\n },\n {\n id: 'knip',\n label: 'Knip',\n kind: 'dead-code',\n purpose: 'Dead code for JS/TS — unused files, exports and dependencies.',\n commands: [\n { kind: 'direct', bin: 'knip' },\n { kind: 'npx', pkg: 'knip' },\n ],\n install: ['Install with: npm install -g knip (or run it through npx, which this will do for you).'],\n options: [\n {\n key: 'include', label: 'Issue types', type: 'multi',\n values: ['files', 'dependencies', 'exports', 'types', 'duplicates'],\n default: [],\n hint: 'Nothing checked means Knip reports every kind it knows.',\n },\n ],\n argv: (root, options: Record<string, any> = {}) => {\n const args = ['--reporter', 'json', '--directory', root, '--no-progress'];\n const include = Array.isArray(options.include) ? options.include.filter(Boolean) : [];\n if (include.length) args.push('--include', include.join(','));\n return args;\n },\n parse: (text, root) => parseKnip(JSON.parse(text), makeRel(root)),\n },\n {\n id: 'vulture',\n label: 'Vulture',\n kind: 'dead-code',\n purpose: 'Dead code for Python — unused functions, classes, variables.',\n commands: [\n { kind: 'direct', bin: 'vulture' },\n { kind: 'uvx', pkg: 'vulture', bin: 'vulture' },\n ],\n install: ['Install with: pip install vulture (or run it through uvx, which this will do for you).'],\n options: [\n {\n key: 'minConfidence', label: 'Minimum confidence (%)', type: 'number',\n min: 1, max: 100, default: 60,\n hint: 'Lower finds more, and guesses more. 60 is Vulture’s own default.',\n },\n ],\n argv: (root, options: Record<string, any> = {}) => {\n const n = Number(options.minConfidence);\n const confidence = Number.isFinite(n) ? Math.min(100, Math.max(1, Math.round(n))) : 60;\n return [root, '--min-confidence', String(confidence)];\n },\n parse: (text, root) => parseVulture(text, makeRel(root)),\n textOutput: true,\n },\n {\n id: 'depcheck',\n label: 'Depcheck',\n kind: 'dead-code',\n purpose: 'Unused npm dependencies (a narrower, faster slice of Knip).',\n commands: [\n { kind: 'direct', bin: 'depcheck' },\n { kind: 'npx', pkg: 'depcheck' },\n ],\n install: ['Install with: npm install -g depcheck (or run it through npx).'],\n options: [\n {\n key: 'skipMissing', label: 'Skip “missing from package.json” reports', type: 'boolean',\n default: false,\n hint: 'Useful when imports are resolved by a bundler depcheck cannot see.',\n },\n ],\n argv: (root, options: Record<string, any> = {}) => {\n const args = ['--json'];\n if (options.skipMissing) args.push('--skip-missing=true');\n return args;\n },\n cwd: true, // depcheck reads the package.json in its working directory\n parse: (text) => parseDepcheck(JSON.parse(text)),\n },\n];\n\n// Turn a raw `options` object from a request body into one the registry\n// trusts: only declared keys, values coerced to the declared type, enum and\n// multi values restricted to the declared lists. Anything else falls back to\n// the default — the GUI sends well-formed values, and anything else is noise.\nexport function sanitizeOptions(def, raw) {\n const clean: Record<string, any> = {};\n const input = raw && typeof raw === 'object' ? raw : {};\n for (const opt of def.options || []) {\n const value = input[opt.key];\n if (opt.type === 'boolean') {\n clean[opt.key] = value === undefined ? opt.default : Boolean(value);\n } else if (opt.type === 'enum') {\n clean[opt.key] = opt.values.includes(value) ? value : opt.default;\n } else if (opt.type === 'multi') {\n clean[opt.key] = Array.isArray(value) ? value.filter((v) => opt.values.includes(v)) : [...opt.default];\n } else if (opt.type === 'number') {\n const n = Number(value);\n clean[opt.key] = Number.isFinite(n)\n ? Math.min(opt.max, Math.max(opt.min, Math.round(n)))\n : opt.default;\n }\n }\n return clean;\n}\n\n// The schema with every default filled in — what the GUI renders before the\n// person touches anything.\nexport function defaultOptions(def) {\n return sanitizeOptions(def, {});\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare function toolsStatus(): Record<string, any>;
|
|
2
|
+
export declare function runExternalAnalysis(root: any, options?: Record<string, any>): Promise<{
|
|
3
|
+
ms: number;
|
|
4
|
+
passes: ({
|
|
5
|
+
id: any;
|
|
6
|
+
label: any;
|
|
7
|
+
ok: boolean;
|
|
8
|
+
available: boolean;
|
|
9
|
+
findings: any[];
|
|
10
|
+
reason: any;
|
|
11
|
+
source: string;
|
|
12
|
+
tool: any;
|
|
13
|
+
} | {
|
|
14
|
+
id: any;
|
|
15
|
+
label: any;
|
|
16
|
+
kind: any;
|
|
17
|
+
ok: boolean;
|
|
18
|
+
available: boolean;
|
|
19
|
+
findings: any;
|
|
20
|
+
source: string;
|
|
21
|
+
tool: any;
|
|
22
|
+
how: any;
|
|
23
|
+
ms: number;
|
|
24
|
+
})[];
|
|
25
|
+
findings: any[];
|
|
26
|
+
ranCount: number;
|
|
27
|
+
totalTools: number;
|
|
28
|
+
unavailable: {
|
|
29
|
+
id: any;
|
|
30
|
+
label: any;
|
|
31
|
+
reason: any;
|
|
32
|
+
}[];
|
|
33
|
+
source: string;
|
|
34
|
+
}>;
|