codebase-onboarder 0.6.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 +174 -46
- 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 +321 -329
- package/cli/explorer/advanced.js.map +1 -0
- package/cli/explorer/app.d.ts +1 -0
- package/cli/explorer/app.js +384 -313
- 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 +368 -302
- 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 +42 -44
- package/cli/explorer/github.js.map +1 -0
- package/cli/explorer/graphs.d.ts +7 -0
- package/cli/explorer/graphs.js +90 -95
- 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 +143 -144
- package/cli/explorer/session.js.map +1 -0
- package/cli/explorer/views.d.ts +19 -0
- package/cli/explorer/views.js +465 -482
- package/cli/explorer/views.js.map +1 -0
- package/cli/explorer/wrap.d.ts +1 -0
- package/cli/explorer/wrap.js +28 -44
- package/cli/explorer/wrap.js.map +1 -0
- package/cli/main.d.ts +1 -0
- package/cli/main.js +214 -161
- 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 +35 -44
- 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 +152 -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 +37 -38
- 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 -64
- 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 +41 -43
- 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/cli/main.js
CHANGED
|
@@ -1,27 +1,37 @@
|
|
|
1
|
+
import { scanOptionsFromFlags } from './scanOptions.js';
|
|
1
2
|
// argv → command. `bin/onboarder.js` is a one-line trampoline into `main`; all
|
|
2
3
|
// parsing and dispatch lives here so the tests can call it directly.
|
|
3
4
|
//
|
|
4
5
|
// Flags use node's util.parseArgs — still zero dependencies, still strict about
|
|
5
6
|
// unknown flags, which is what a tool that writes a config file should be.
|
|
6
|
-
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { parseArgs } from 'node:util';
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
runSetup, runStart, runStartBackground, runStartup, runLogs, runStatus, runStop, runRestart,
|
|
12
|
-
runConfig, runConfigKey, runConfigReset, runDoctor, runTunnel, runHttps,
|
|
13
|
-
} from './commands.js';
|
|
9
|
+
import { runSetup, runStart, runStartBackground, runStartup, runLogs, runStatus, runStop, runRestart, runConfig, runConfigKey, runConfigReset, runDoctor, runTunnel, runHttps, } from './commands.js';
|
|
14
10
|
import { runExplore } from './explorer/app.js';
|
|
11
|
+
import { openRepoOrClone, closeRemote } from './explorer/session.js';
|
|
12
|
+
import { createReport, formatReport } from './explorer/report.js';
|
|
15
13
|
import { setColorEnabled } from './ui.js';
|
|
16
|
-
|
|
14
|
+
import { runReview } from '../server/review.js';
|
|
15
|
+
import { reviewMarkdown, reviewProfile, SEVERITY_RANK } from '../shared/review/review.js';
|
|
16
|
+
import { expandHome } from '../server/paths.js';
|
|
17
17
|
const PACKAGE = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
18
|
-
|
|
19
18
|
const HELP = `
|
|
20
19
|
🧭 Onboarder — drop a path, get a map.
|
|
21
20
|
|
|
21
|
+
Scan options for report and explore
|
|
22
|
+
--max-files <count> Maximum files to walk (default: 4000)
|
|
23
|
+
--max-file-size <bytes> Maximum UTF-8 file size (default: 204800)
|
|
24
|
+
--read-concurrency <n> Concurrent reads, 1–32 (default: 8)
|
|
25
|
+
|
|
22
26
|
Usage
|
|
23
27
|
onboarder Explore a codebase here, interactively
|
|
24
|
-
onboarder explore [folder|url]
|
|
28
|
+
onboarder explore [folder|url] Choose a source, or open one directly (alias: tui)
|
|
29
|
+
onboarder report [folder|url] One-shot summary for terminals and scripts (--json)
|
|
30
|
+
onboarder review [folder] Review local changes (--json for scripts)
|
|
31
|
+
--base <ref> --head <ref> Compare branches from their merge base
|
|
32
|
+
--staged Review only staged changes
|
|
33
|
+
--profile focused|balanced|thorough
|
|
34
|
+
--fail-on high|medium|low|critical|info Exit 1 for findings at this level or above
|
|
25
35
|
onboarder start Start the web UI in the foreground (Ctrl-C stops it)
|
|
26
36
|
onboarder start background Start detached — keeps running after you close the terminal
|
|
27
37
|
onboarder start startup Run automatically at login [install|remove|status]
|
|
@@ -37,13 +47,16 @@ const HELP = `
|
|
|
37
47
|
|
|
38
48
|
In the explorer
|
|
39
49
|
map tour explain what this is, where to start, and why
|
|
40
|
-
tree find show deps
|
|
50
|
+
tree find show inspect deps browse it, search it, read it, trace it
|
|
41
51
|
graph blast symbols the dependency tree, the blast radius, the outline
|
|
42
52
|
health hubs layers patterns the analysis, in the same words the site uses
|
|
43
53
|
coupling clusters risks the heat grid, the module groups, what is wrong
|
|
44
54
|
log hotspots blame git history, hot files, who wrote a line
|
|
45
|
-
diagram docs
|
|
46
|
-
|
|
55
|
+
diagram atlas docs Mermaid source, diagram index, and prose
|
|
56
|
+
workflows sbom CI jobs and dependency/license inventory
|
|
57
|
+
diff engines deep Changed files, analyzer status, optional deep scan
|
|
58
|
+
ask <question> Optional AI answer grounded in the loaded repo
|
|
59
|
+
pick cd rescan web choose a source, switch repo, reload, open the web UI
|
|
47
60
|
github what GitHub says about this repo — stars, issues, license
|
|
48
61
|
!<command> run a shell command without leaving
|
|
49
62
|
help exit everything, and the way out
|
|
@@ -75,7 +88,9 @@ const HELP = `
|
|
|
75
88
|
Examples
|
|
76
89
|
onboarder # explore the repo you are standing in
|
|
77
90
|
onboarder explore ~/code/my-app # explore somewhere else
|
|
91
|
+
onboarder explore # choose a local folder or paste a Git URL
|
|
78
92
|
onboarder explore https://github.com/expressjs/express # clone one and read it
|
|
93
|
+
onboarder report . --json # analyze once and print machine-readable JSON
|
|
79
94
|
onboarder start background # leave the web UI running, close the terminal
|
|
80
95
|
onboarder logs -f # watch what it is doing
|
|
81
96
|
onboarder start startup install # also start it every time you log in
|
|
@@ -83,48 +98,53 @@ const HELP = `
|
|
|
83
98
|
onboarder setup --non-interactive --mode self-hosted --domain map.example.com --https --start
|
|
84
99
|
onboarder config set tunnel.cloudflare true && onboarder tunnel cloudflare
|
|
85
100
|
`;
|
|
86
|
-
|
|
87
101
|
const OPTIONS = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
102
|
+
help: { type: 'boolean', short: 'h' },
|
|
103
|
+
version: { type: 'boolean', short: 'v' },
|
|
104
|
+
json: { type: 'boolean' },
|
|
105
|
+
yes: { type: 'boolean', short: 'y' },
|
|
106
|
+
'non-interactive': { type: 'boolean' },
|
|
107
|
+
reveal: { type: 'boolean' },
|
|
108
|
+
verbose: { type: 'boolean' },
|
|
109
|
+
start: { type: 'boolean' },
|
|
110
|
+
color: { type: 'boolean' }, // `--no-color` is lifted out by extractNegatedFlags; --color forces it on
|
|
111
|
+
config: { type: 'string' },
|
|
112
|
+
mode: { type: 'string' },
|
|
113
|
+
host: { type: 'string' },
|
|
114
|
+
port: { type: 'string' },
|
|
115
|
+
domain: { type: 'string' },
|
|
116
|
+
https: { type: 'boolean' },
|
|
117
|
+
'access-key': { type: 'string' },
|
|
118
|
+
name: { type: 'string' },
|
|
119
|
+
email: { type: 'string' },
|
|
120
|
+
provider: { type: 'string' },
|
|
121
|
+
'base-url': { type: 'string' },
|
|
122
|
+
model: { type: 'string' },
|
|
123
|
+
cloudflare: { type: 'boolean' },
|
|
124
|
+
tailscale: { type: 'boolean' },
|
|
125
|
+
'auto-open': { type: 'boolean' },
|
|
126
|
+
lines: { type: 'string', short: 'n' },
|
|
127
|
+
follow: { type: 'boolean', short: 'f' },
|
|
128
|
+
timeout: { type: 'string' },
|
|
129
|
+
server: { type: 'boolean' },
|
|
130
|
+
'max-files': { type: 'string' },
|
|
131
|
+
'max-file-size': { type: 'string' },
|
|
132
|
+
'read-concurrency': { type: 'string' },
|
|
133
|
+
base: { type: 'string' },
|
|
134
|
+
head: { type: 'string' },
|
|
135
|
+
staged: { type: 'boolean' },
|
|
136
|
+
profile: { type: 'string' },
|
|
137
|
+
'fail-on': { type: 'string' },
|
|
116
138
|
};
|
|
117
|
-
|
|
118
139
|
// parseArgs speaks kebab-case; the wizard's flags speak camelCase.
|
|
119
140
|
function normalizeFlags(values) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
const out = {};
|
|
142
|
+
for (const [k, v] of Object.entries(values)) {
|
|
143
|
+
const key = k.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
144
|
+
out[key] = v;
|
|
145
|
+
}
|
|
146
|
+
return out;
|
|
126
147
|
}
|
|
127
|
-
|
|
128
148
|
// `parseArgs` cannot express a negated boolean. `--color=false` is rejected
|
|
129
149
|
// outright, `--color false` sets `color: true` and leaves `false` behind as a
|
|
130
150
|
// positional, and `--no-color` is an unknown option — so the documented flag
|
|
@@ -137,126 +157,159 @@ function normalizeFlags(values) {
|
|
|
137
157
|
// of a tool that writes a config file) while making the one negation the CLI
|
|
138
158
|
// documents actually work.
|
|
139
159
|
function extractNegatedFlags(argv) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
160
|
+
const rest = [];
|
|
161
|
+
let noColor = false;
|
|
162
|
+
for (const arg of argv) {
|
|
163
|
+
if (arg === '--no-color')
|
|
164
|
+
noColor = true;
|
|
165
|
+
else
|
|
166
|
+
rest.push(arg);
|
|
167
|
+
}
|
|
168
|
+
return { argv: rest, noColor };
|
|
147
169
|
}
|
|
148
|
-
|
|
149
170
|
export async function main(argv = process.argv.slice(2)) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (flags.version) { console.log(PACKAGE.version); return 0; }
|
|
177
|
-
|
|
178
|
-
const [cmd, sub, ...rest] = positionals;
|
|
179
|
-
try {
|
|
180
|
-
switch (cmd) {
|
|
181
|
-
case 'help':
|
|
171
|
+
const { argv: argsIn, noColor } = extractNegatedFlags(argv);
|
|
172
|
+
let parsed;
|
|
173
|
+
try {
|
|
174
|
+
parsed = parseArgs({ args: argsIn, options: OPTIONS, allowPositionals: true });
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
console.error(' ' + e.message + '\n' + HELP);
|
|
178
|
+
return 2;
|
|
179
|
+
}
|
|
180
|
+
const { values, positionals } = parsed;
|
|
181
|
+
const flags = normalizeFlags(values);
|
|
182
|
+
// Color is decided here, after the flags exist and before anything is
|
|
183
|
+
// painted. An explicit `--no-color` wins over `FORCE_COLOR`: a person who
|
|
184
|
+
// typed the flag meant it, and a stray `FORCE_COLOR` inherited from a CI
|
|
185
|
+
// profile should not override the thing they just asked for.
|
|
186
|
+
if (noColor) {
|
|
187
|
+
flags.color = false;
|
|
188
|
+
setColorEnabled(false);
|
|
189
|
+
}
|
|
190
|
+
else if (flags.color === true) {
|
|
191
|
+
// `--color` was accepted by the parser and then ignored, which is the same
|
|
192
|
+
// lie in the other direction. It is the documented way to keep ANSI in a
|
|
193
|
+
// captured log, so it has to actually turn color on.
|
|
194
|
+
setColorEnabled(true);
|
|
195
|
+
}
|
|
196
|
+
if (flags.help) {
|
|
182
197
|
console.log(HELP);
|
|
183
198
|
return 0;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
199
|
+
}
|
|
200
|
+
if (flags.version) {
|
|
201
|
+
console.log(PACKAGE.version);
|
|
202
|
+
return 0;
|
|
203
|
+
}
|
|
204
|
+
const [cmd, sub, ...rest] = positionals;
|
|
205
|
+
try {
|
|
206
|
+
switch (cmd) {
|
|
207
|
+
case 'help':
|
|
208
|
+
console.log(HELP);
|
|
209
|
+
return 0;
|
|
210
|
+
case undefined:
|
|
211
|
+
// The entry point. On a terminal, bare `onboarder` explores the repo you
|
|
212
|
+
// are standing in — the thing people actually want from this tool, and
|
|
213
|
+
// what the name promises. Everywhere else (a pipe, CI, a script) it
|
|
214
|
+
// still starts the server, because an interactive session with no input
|
|
215
|
+
// source is a hang, and nothing about a background job wants a prompt.
|
|
216
|
+
// `--server` forces the old behavior even on a terminal.
|
|
217
|
+
if (!flags.server && process.stdin.isTTY && process.stdout.isTTY) {
|
|
218
|
+
return codeOf(await runExplore({ flags }));
|
|
219
|
+
}
|
|
220
|
+
return codeOf(await runStart({ flags }));
|
|
221
|
+
case 'explore':
|
|
222
|
+
case 'tui':
|
|
223
|
+
case 'shell':
|
|
224
|
+
return codeOf(await runExplore({ flags, target: sub }));
|
|
225
|
+
case 'report': {
|
|
226
|
+
const repo = await openRepoOrClone(sub || '.', scanOptionsFromFlags(flags));
|
|
227
|
+
try {
|
|
228
|
+
const report = createReport(repo);
|
|
229
|
+
console.log(flags.json ? JSON.stringify(report, null, 2) : formatReport(report));
|
|
230
|
+
return 0;
|
|
231
|
+
}
|
|
232
|
+
finally {
|
|
233
|
+
await closeRemote(repo);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
case 'review': {
|
|
237
|
+
if (flags.staged && flags.head)
|
|
238
|
+
throw new Error('Choose either --staged or --head.');
|
|
239
|
+
if (flags.failOn && !Object.hasOwn(SEVERITY_RANK, flags.failOn))
|
|
240
|
+
throw new Error('Choose a valid --fail-on severity: critical, high, medium, low, or info.');
|
|
241
|
+
const report = await runReview(expandHome(sub || '.'), { base: flags.base || 'HEAD', head: flags.head || '', mode: flags.staged ? 'staged' : flags.head ? 'range' : 'working', profile: flags.profile ? reviewProfile(flags.profile) : undefined });
|
|
242
|
+
console.log(flags.json ? JSON.stringify(report, null, 2) : reviewMarkdown(report));
|
|
243
|
+
return flags.failOn && report.findings.some(f => SEVERITY_RANK[f.severity] >= SEVERITY_RANK[flags.failOn]) || report.checks.some(c => c.id === 'conflicts' && c.status === 'fail') ? 1 : 0;
|
|
244
|
+
}
|
|
245
|
+
case 'web':
|
|
246
|
+
case 'site':
|
|
247
|
+
return codeOf(await runStart({ flags }));
|
|
248
|
+
case 'start':
|
|
249
|
+
// `onboarder start [background|fg|startup [action]]`. The sub-verb is a
|
|
250
|
+
// positional, not a flag, because `onboarder start` has to keep working
|
|
251
|
+
// exactly as it did and `startup install` is a different verb from
|
|
252
|
+
// `start`.
|
|
253
|
+
if (sub === 'background' || sub === 'bg' || sub === 'daemon' || sub === 'detached') {
|
|
254
|
+
return codeOf(await runStartBackground({ flags }));
|
|
255
|
+
}
|
|
256
|
+
if (sub === 'startup' || sub === 'login' || sub === 'autostart') {
|
|
257
|
+
return codeOf(await runStartup(rest[0] || 'status', { flags }));
|
|
258
|
+
}
|
|
259
|
+
if (sub === 'fg' || sub === 'foreground')
|
|
260
|
+
return codeOf(await runStart({ flags }));
|
|
261
|
+
if (sub === 'status')
|
|
262
|
+
return codeOf(await runStatus({ flags }));
|
|
263
|
+
if (sub === 'stop')
|
|
264
|
+
return codeOf(await runStop({ flags }));
|
|
265
|
+
if (sub === 'logs')
|
|
266
|
+
return codeOf(await runLogs({ flags }));
|
|
267
|
+
if (sub) {
|
|
268
|
+
console.error(' Unknown start mode: ' + sub + '\n' + HELP);
|
|
269
|
+
return 2;
|
|
270
|
+
}
|
|
271
|
+
return codeOf(await runStart({ flags }));
|
|
272
|
+
case 'logs':
|
|
273
|
+
case 'log':
|
|
274
|
+
return codeOf(await runLogs({ flags }));
|
|
275
|
+
case 'startup':
|
|
276
|
+
case 'autostart':
|
|
277
|
+
return codeOf(await runStartup(sub || 'status', { flags }));
|
|
278
|
+
case 'status':
|
|
279
|
+
return codeOf(await runStatus({ flags }));
|
|
280
|
+
case 'stop':
|
|
281
|
+
return codeOf(await runStop({ flags }));
|
|
282
|
+
case 'restart':
|
|
283
|
+
return codeOf(await runRestart({ flags }));
|
|
284
|
+
case 'setup':
|
|
285
|
+
case 'onboard':
|
|
286
|
+
case 'init':
|
|
287
|
+
return codeOf(await runSetup({ flags, version: PACKAGE.version }));
|
|
288
|
+
case 'config':
|
|
289
|
+
if (sub === 'key')
|
|
290
|
+
return codeOf(await runConfigKey(rest[0], rest.slice(1), { flags }));
|
|
291
|
+
if (sub === 'reset')
|
|
292
|
+
return codeOf(await runConfigReset({ flags }));
|
|
293
|
+
return codeOf(await runConfig(sub || 'show', rest, { flags }));
|
|
294
|
+
case 'tunnel':
|
|
295
|
+
return codeOf(await runTunnel(sub, { flags }));
|
|
296
|
+
case 'https':
|
|
297
|
+
return codeOf(await runHttps(sub || 'status', { flags }));
|
|
298
|
+
case 'doctor':
|
|
299
|
+
return codeOf(await runDoctor({ flags }));
|
|
300
|
+
default:
|
|
301
|
+
console.error(' Unknown command: ' + cmd + '\n' + HELP);
|
|
302
|
+
return 2;
|
|
220
303
|
}
|
|
221
|
-
return codeOf(await runStart({ flags }));
|
|
222
|
-
case 'logs':
|
|
223
|
-
case 'log':
|
|
224
|
-
return codeOf(await runLogs({ flags }));
|
|
225
|
-
case 'startup':
|
|
226
|
-
case 'autostart':
|
|
227
|
-
return codeOf(await runStartup(sub || 'status', { flags }));
|
|
228
|
-
case 'status':
|
|
229
|
-
return codeOf(await runStatus({ flags }));
|
|
230
|
-
case 'stop':
|
|
231
|
-
return codeOf(await runStop({ flags }));
|
|
232
|
-
case 'restart':
|
|
233
|
-
return codeOf(await runRestart({ flags }));
|
|
234
|
-
case 'setup':
|
|
235
|
-
case 'onboard':
|
|
236
|
-
case 'init':
|
|
237
|
-
return codeOf(await runSetup({ flags, version: PACKAGE.version }));
|
|
238
|
-
case 'config':
|
|
239
|
-
if (sub === 'key') return codeOf(await runConfigKey(rest[0], rest.slice(1), { flags }));
|
|
240
|
-
if (sub === 'reset') return codeOf(await runConfigReset({ flags }));
|
|
241
|
-
return codeOf(await runConfig(sub || 'show', rest, { flags }));
|
|
242
|
-
case 'tunnel':
|
|
243
|
-
return codeOf(await runTunnel(sub, { flags }));
|
|
244
|
-
case 'https':
|
|
245
|
-
return codeOf(await runHttps(sub || 'status', { flags }));
|
|
246
|
-
case 'doctor':
|
|
247
|
-
return codeOf(await runDoctor({ flags }));
|
|
248
|
-
default:
|
|
249
|
-
console.error(' Unknown command: ' + cmd + '\n' + HELP);
|
|
250
|
-
return 2;
|
|
251
304
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
305
|
+
catch (e) {
|
|
306
|
+
console.error(' ' + (e.message || e));
|
|
307
|
+
return 1;
|
|
308
|
+
}
|
|
256
309
|
}
|
|
257
|
-
|
|
258
310
|
// Commands return an exit code or, for `start`, an object carrying the live
|
|
259
311
|
// server. Both collapse to "what code should the process eventually use".
|
|
260
312
|
function codeOf(result) {
|
|
261
|
-
|
|
313
|
+
return typeof result === 'number' ? result : result?.code ?? 0;
|
|
262
314
|
}
|
|
315
|
+
//# sourceMappingURL=main.js.map
|
package/cli/main.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/cli/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,+EAA+E;AAC/E,qEAAqE;AACrE,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAE3E,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAC3F,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,GACxE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBA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AAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACjD,KAAK,OAAO;gBACV,OAAO,MAAM,CAAC,MAAM,QAAQ,CAAC,GAAG,IAAI,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC5D,KAAK,QAAQ;gBACX,OAAO,MAAM,CAAC,MAAM,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC5C;gBACE,OAAO,CAAC,KAAK,CAAC,qBAAqB,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;gBACzD,OAAO,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;QACvC,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,0EAA0E;AAC1E,SAAS,MAAM,CAAC,MAAM;IACpB,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,IAAI,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import { scanOptionsFromFlags } from './scanOptions.js';\n// argv → command. `bin/onboarder.js` is a one-line trampoline into `main`; all\n// parsing and dispatch lives here so the tests can call it directly.\n//\n// Flags use node's util.parseArgs — still zero dependencies, still strict about\n// unknown flags, which is what a tool that writes a config file should be.\n\nimport fs from 'node:fs';\nimport { parseArgs } from 'node:util';\n\nimport {\n runSetup, runStart, runStartBackground, runStartup, runLogs, runStatus, runStop, runRestart,\n runConfig, runConfigKey, runConfigReset, runDoctor, runTunnel, runHttps,\n} from './commands.js';\nimport { runExplore } from './explorer/app.js';\nimport { openRepoOrClone, closeRemote } from './explorer/session.js';\nimport { createReport, formatReport } from './explorer/report.js';\nimport { setColorEnabled } from './ui.js';\nimport { runReview } from '../server/review.js';\nimport { reviewMarkdown, reviewProfile, SEVERITY_RANK } from '../shared/review/review.js';\nimport { expandHome } from '../server/paths.js';\n\nconst PACKAGE = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));\n\nconst HELP = `\n 🧭 Onboarder — drop a path, get a map.\n\n Scan options for report and explore\n --max-files <count> Maximum files to walk (default: 4000)\n --max-file-size <bytes> Maximum UTF-8 file size (default: 204800)\n --read-concurrency <n> Concurrent reads, 1–32 (default: 8)\n\n Usage\n onboarder Explore a codebase here, interactively\n onboarder explore [folder|url] Choose a source, or open one directly (alias: tui)\n onboarder report [folder|url] One-shot summary for terminals and scripts (--json)\n onboarder review [folder] Review local changes (--json for scripts)\n --base <ref> --head <ref> Compare branches from their merge base\n --staged Review only staged changes\n --profile focused|balanced|thorough\n --fail-on high|medium|low|critical|info Exit 1 for findings at this level or above\n onboarder start Start the web UI in the foreground (Ctrl-C stops it)\n onboarder start background Start detached — keeps running after you close the terminal\n onboarder start startup Run automatically at login [install|remove|status]\n onboarder web Alias for \\`onboarder start\\`\n onboarder logs Show recent log lines (-n <count>, -f to follow)\n onboarder status Show whether the web UI is running\n onboarder stop Stop the running web UI\n onboarder restart Stop and start again\n onboarder config [<…>] show | get <key> | set <key> <value> | path | reset | key <rotate|show|set>\n onboarder tunnel <name> cloudflare | tailscale\n onboarder https <action> check | setup | start | stop | status\n onboarder doctor Check the machine and the config\n\n In the explorer\n map tour explain what this is, where to start, and why\n tree find show inspect deps browse it, search it, read it, trace it\n graph blast symbols the dependency tree, the blast radius, the outline\n health hubs layers patterns the analysis, in the same words the site uses\n coupling clusters risks the heat grid, the module groups, what is wrong\n log hotspots blame git history, hot files, who wrote a line\n diagram atlas docs Mermaid source, diagram index, and prose\n workflows sbom CI jobs and dependency/license inventory\n diff engines deep Changed files, analyzer status, optional deep scan\n ask <question> Optional AI answer grounded in the loaded repo\n pick cd rescan web choose a source, switch repo, reload, open the web UI\n github what GitHub says about this repo — stars, issues, license\n !<command> run a shell command without leaving\n help exit everything, and the way out\n Tab completes commands, then file paths\n\n Setup flags (interactive wizard skips what they answer)\n --mode local|self-hosted --host <addr> --port <n> --domain <name>\n --https Set up automatic HTTPS through Caddy\n --access-key generate|<k> --name <n> --email <e>\n --provider none|openai-compatible|ollama|openrouter|custom\n --base-url <url> --model <m> --cloudflare --tailscale\n\n General flags\n --config <file> Use this config file (or ONBOARDER_CONFIG)\n --server With bare \\`onboarder\\`, start the web UI instead of exploring\n --non-interactive Never prompt; flags + defaults are the answers\n -y, --yes Answer yes to confirmations\n --json Machine-readable output\n --reveal config show prints the full access key\n --no-color Plain output (NO_COLOR works too)\n -h, --help This text -v, --version Print the version\n\n Also accepted\n help | --help onboarder help | onboarder --help\n config | config show\n bg | detached alias for start background\n fg | foreground alias for start\n\n Examples\n onboarder # explore the repo you are standing in\n onboarder explore ~/code/my-app # explore somewhere else\n onboarder explore # choose a local folder or paste a Git URL\n onboarder explore https://github.com/expressjs/express # clone one and read it\n onboarder report . --json # analyze once and print machine-readable JSON\n onboarder start background # leave the web UI running, close the terminal\n onboarder logs -f # watch what it is doing\n onboarder start startup install # also start it every time you log in\n onboarder setup --non-interactive --mode local --port 4310\n onboarder setup --non-interactive --mode self-hosted --domain map.example.com --https --start\n onboarder config set tunnel.cloudflare true && onboarder tunnel cloudflare\n`;\n\nconst OPTIONS: NonNullable<import('node:util').ParseArgsConfig['options']> = {\n help: { type: 'boolean', short: 'h' },\n version: { type: 'boolean', short: 'v' },\n json: { type: 'boolean' },\n yes: { type: 'boolean', short: 'y' },\n 'non-interactive': { type: 'boolean' },\n reveal: { type: 'boolean' },\n verbose: { type: 'boolean' },\n start: { type: 'boolean' },\n color: { type: 'boolean' }, // `--no-color` is lifted out by extractNegatedFlags; --color forces it on\n config: { type: 'string' },\n mode: { type: 'string' },\n host: { type: 'string' },\n port: { type: 'string' },\n domain: { type: 'string' },\n https: { type: 'boolean' },\n 'access-key': { type: 'string' },\n name: { type: 'string' },\n email: { type: 'string' },\n provider: { type: 'string' },\n 'base-url': { type: 'string' },\n model: { type: 'string' },\n cloudflare: { type: 'boolean' },\n tailscale: { type: 'boolean' },\n 'auto-open': { type: 'boolean' },\n lines: { type: 'string', short: 'n' },\n follow: { type: 'boolean', short: 'f' },\n timeout: { type: 'string' },\n server: { type: 'boolean' },\n 'max-files': { type: 'string' },\n 'max-file-size': { type: 'string' },\n 'read-concurrency': { type: 'string' },\n base: { type: 'string' },\n head: { type: 'string' },\n staged: { type: 'boolean' },\n profile: { type: 'string' },\n 'fail-on': { type: 'string' },\n};\n\n// parseArgs speaks kebab-case; the wizard's flags speak camelCase.\nfunction normalizeFlags(values) {\n const out: Record<string, any> = {};\n for (const [k, v] of Object.entries(values)) {\n const key = k.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n out[key] = v;\n }\n return out;\n}\n\n// `parseArgs` cannot express a negated boolean. `--color=false` is rejected\n// outright, `--color false` sets `color: true` and leaves `false` behind as a\n// positional, and `--no-color` is an unknown option — so the documented flag\n// had never worked, for any command, and `--no-color status` would try to run a\n// command called `no-color`.\n//\n// There is no parser-level spelling for \"this boolean is false\", so the flag is\n// lifted out of argv before parsing and applied to the parsed flags after. That\n// keeps `parseArgs` strict about genuinely unknown options (which is the point\n// of a tool that writes a config file) while making the one negation the CLI\n// documents actually work.\nfunction extractNegatedFlags(argv) {\n const rest = [];\n let noColor = false;\n for (const arg of argv) {\n if (arg === '--no-color') noColor = true;\n else rest.push(arg);\n }\n return { argv: rest, noColor };\n}\n\nexport async function main(argv = process.argv.slice(2)) {\n const { argv: argsIn, noColor } = extractNegatedFlags(argv);\n let parsed;\n try {\n parsed = parseArgs({ args: argsIn, options: OPTIONS, allowPositionals: true });\n } catch (e) {\n console.error(' ' + e.message + '\\n' + HELP);\n return 2;\n }\n const { values, positionals } = parsed;\n const flags = normalizeFlags(values);\n\n // Color is decided here, after the flags exist and before anything is\n // painted. An explicit `--no-color` wins over `FORCE_COLOR`: a person who\n // typed the flag meant it, and a stray `FORCE_COLOR` inherited from a CI\n // profile should not override the thing they just asked for.\n if (noColor) {\n flags.color = false;\n setColorEnabled(false);\n } else if (flags.color === true) {\n // `--color` was accepted by the parser and then ignored, which is the same\n // lie in the other direction. It is the documented way to keep ANSI in a\n // captured log, so it has to actually turn color on.\n setColorEnabled(true);\n }\n\n if (flags.help) { console.log(HELP); return 0; }\n if (flags.version) { console.log(PACKAGE.version); return 0; }\n\n const [cmd, sub, ...rest] = positionals;\n try {\n switch (cmd) {\n case 'help':\n console.log(HELP);\n return 0;\n case undefined:\n // The entry point. On a terminal, bare `onboarder` explores the repo you\n // are standing in — the thing people actually want from this tool, and\n // what the name promises. Everywhere else (a pipe, CI, a script) it\n // still starts the server, because an interactive session with no input\n // source is a hang, and nothing about a background job wants a prompt.\n // `--server` forces the old behavior even on a terminal.\n if (!flags.server && process.stdin.isTTY && process.stdout.isTTY) {\n return codeOf(await runExplore({ flags }));\n }\n return codeOf(await runStart({ flags }));\n case 'explore':\n case 'tui':\n case 'shell':\n return codeOf(await runExplore({ flags, target: sub }));\n case 'report': {\n const repo = await openRepoOrClone(sub || '.', scanOptionsFromFlags(flags));\n try {\n const report = createReport(repo);\n console.log(flags.json ? JSON.stringify(report, null, 2) : formatReport(report));\n return 0;\n } finally {\n await closeRemote(repo);\n }\n }\n case 'review': {\n if (flags.staged && flags.head) throw new Error('Choose either --staged or --head.');\n if (flags.failOn && !Object.hasOwn(SEVERITY_RANK, flags.failOn)) throw new Error('Choose a valid --fail-on severity: critical, high, medium, low, or info.');\n const report = await runReview(expandHome(sub || '.'), { base: flags.base || 'HEAD', head: flags.head || '', mode: flags.staged ? 'staged' : flags.head ? 'range' : 'working', profile: flags.profile ? reviewProfile(flags.profile) : undefined });\n console.log(flags.json ? JSON.stringify(report, null, 2) : reviewMarkdown(report));\n return flags.failOn && report.findings.some(f => SEVERITY_RANK[f.severity] >= SEVERITY_RANK[flags.failOn]) || report.checks.some(c => c.id === 'conflicts' && c.status === 'fail') ? 1 : 0;\n }\n case 'web':\n case 'site':\n return codeOf(await runStart({ flags }));\n case 'start':\n // `onboarder start [background|fg|startup [action]]`. The sub-verb is a\n // positional, not a flag, because `onboarder start` has to keep working\n // exactly as it did and `startup install` is a different verb from\n // `start`.\n if (sub === 'background' || sub === 'bg' || sub === 'daemon' || sub === 'detached') {\n return codeOf(await runStartBackground({ flags }));\n }\n if (sub === 'startup' || sub === 'login' || sub === 'autostart') {\n return codeOf(await runStartup(rest[0] || 'status', { flags }));\n }\n if (sub === 'fg' || sub === 'foreground') return codeOf(await runStart({ flags }));\n if (sub === 'status') return codeOf(await runStatus({ flags }));\n if (sub === 'stop') return codeOf(await runStop({ flags }));\n if (sub === 'logs') return codeOf(await runLogs({ flags }));\n if (sub) {\n console.error(' Unknown start mode: ' + sub + '\\n' + HELP);\n return 2;\n }\n return codeOf(await runStart({ flags }));\n case 'logs':\n case 'log':\n return codeOf(await runLogs({ flags }));\n case 'startup':\n case 'autostart':\n return codeOf(await runStartup(sub || 'status', { flags }));\n case 'status':\n return codeOf(await runStatus({ flags }));\n case 'stop':\n return codeOf(await runStop({ flags }));\n case 'restart':\n return codeOf(await runRestart({ flags }));\n case 'setup':\n case 'onboard':\n case 'init':\n return codeOf(await runSetup({ flags, version: PACKAGE.version }));\n case 'config':\n if (sub === 'key') return codeOf(await runConfigKey(rest[0], rest.slice(1), { flags }));\n if (sub === 'reset') return codeOf(await runConfigReset({ flags }));\n return codeOf(await runConfig(sub || 'show', rest, { flags }));\n case 'tunnel':\n return codeOf(await runTunnel(sub, { flags }));\n case 'https':\n return codeOf(await runHttps(sub || 'status', { flags }));\n case 'doctor':\n return codeOf(await runDoctor({ flags }));\n default:\n console.error(' Unknown command: ' + cmd + '\\n' + HELP);\n return 2;\n }\n } catch (e) {\n console.error(' ' + (e.message || e));\n return 1;\n }\n}\n\n// Commands return an exit code or, for `start`, an object carrying the live\n// server. Both collapse to \"what code should the process eventually use\".\nfunction codeOf(result) {\n return typeof result === 'number' ? result : result?.code ?? 0;\n}\n"]}
|