codebase-onboarder 0.6.0 → 1.0.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 +284 -53
- package/bin/build-if-source.js +23 -0
- package/bin/onboarder.js +0 -0
- package/cli/agent/command.d.ts +71 -0
- package/cli/agent/command.js +177 -0
- package/cli/agent/command.js.map +1 -0
- package/cli/agent/config.d.ts +31 -0
- package/cli/agent/config.js +98 -0
- package/cli/agent/config.js.map +1 -0
- package/cli/agent/contracts.d.ts +77 -0
- package/cli/agent/contracts.js +2 -0
- package/cli/agent/contracts.js.map +1 -0
- package/cli/agent/files.d.ts +19 -0
- package/cli/agent/files.js +109 -0
- package/cli/agent/files.js.map +1 -0
- package/cli/agent/gitSource.d.ts +18 -0
- package/cli/agent/gitSource.js +69 -0
- package/cli/agent/gitSource.js.map +1 -0
- package/cli/agent/github.d.ts +21 -0
- package/cli/agent/github.js +94 -0
- package/cli/agent/github.js.map +1 -0
- package/cli/agent/mcp.d.ts +15 -0
- package/cli/agent/mcp.js +78 -0
- package/cli/agent/mcp.js.map +1 -0
- package/cli/agent/process.d.ts +18 -0
- package/cli/agent/process.js +118 -0
- package/cli/agent/process.js.map +1 -0
- package/cli/agent/protocol.d.ts +3 -0
- package/cli/agent/protocol.js +26 -0
- package/cli/agent/protocol.js.map +1 -0
- package/cli/agent/runner.d.ts +34 -0
- package/cli/agent/runner.js +152 -0
- package/cli/agent/runner.js.map +1 -0
- package/cli/agent/stdio.d.ts +1 -0
- package/cli/agent/stdio.js +62 -0
- package/cli/agent/stdio.js.map +1 -0
- package/cli/agent/tools.d.ts +7 -0
- package/cli/agent/tools.js +201 -0
- package/cli/agent/tools.js.map +1 -0
- package/cli/chat/app.d.ts +16 -0
- package/cli/chat/app.js +345 -0
- package/cli/chat/app.js.map +1 -0
- package/cli/chat/commands.d.ts +11 -0
- package/cli/chat/commands.js +120 -0
- package/cli/chat/commands.js.map +1 -0
- package/cli/chat/composer.d.ts +75 -0
- package/cli/chat/composer.js +467 -0
- package/cli/chat/composer.js.map +1 -0
- package/cli/chat/controller.d.ts +60 -0
- package/cli/chat/controller.js +393 -0
- package/cli/chat/controller.js.map +1 -0
- package/cli/chat/logo.d.ts +3 -0
- package/cli/chat/logo.js +14 -0
- package/cli/chat/logo.js.map +1 -0
- package/cli/chat/models.d.ts +18 -0
- package/cli/chat/models.js +88 -0
- package/cli/chat/models.js.map +1 -0
- package/cli/chat/profile.d.ts +5 -0
- package/cli/chat/profile.js +98 -0
- package/cli/chat/profile.js.map +1 -0
- package/cli/chat/render.d.ts +40 -0
- package/cli/chat/render.js +259 -0
- package/cli/chat/render.js.map +1 -0
- package/cli/chat/screen.d.ts +26 -0
- package/cli/chat/screen.js +117 -0
- package/cli/chat/screen.js.map +1 -0
- package/cli/chat/source.d.ts +29 -0
- package/cli/chat/source.js +116 -0
- package/cli/chat/source.js.map +1 -0
- package/cli/chat/store.d.ts +43 -0
- package/cli/chat/store.js +94 -0
- package/cli/chat/store.js.map +1 -0
- package/cli/chat/text.d.ts +4 -0
- package/cli/chat/text.js +27 -0
- package/cli/chat/text.js.map +1 -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 +2 -0
- package/cli/explorer/app.js +404 -314
- 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 +373 -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 +251 -164
- 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/docs/HERMES_RESEARCH.md +51 -0
- package/package.json +16 -4
- package/public/app.d.ts +1 -0
- package/public/app.js +1133 -1011
- package/public/app.js.map +1 -0
- package/public/assets/onboarder-mark.svg +11 -0
- package/public/browser.d.ts +71 -0
- package/public/browser.js +2 -0
- package/public/browser.js.map +1 -0
- package/public/index.html +54 -20
- 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 +4 -0
- package/public/js/aiDraft.js +166 -125
- 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 +29 -0
- package/public/js/api.js +198 -166
- 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 +9 -0
- package/public/js/diagramPane.js +138 -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 +197 -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 +115 -0
- package/public/js/llm.js +246 -278
- 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 +29 -28
- 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 +188 -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/hermesChat.d.ts +13 -0
- package/server/hermesChat.js +145 -0
- package/server/hermesChat.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 +6 -0
- package/server/http.js +27 -34
- 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 +167 -180
- 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 +195 -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 +50 -46
- 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/wizard.js
CHANGED
|
@@ -9,199 +9,196 @@
|
|
|
9
9
|
// config the server would refuse. `applyFlags` is the non-interactive twin of
|
|
10
10
|
// the same fold. All three are pure: the tests drive them directly, and the
|
|
11
11
|
// readline renderer in `prompt.js` is a thin shell over them.
|
|
12
|
-
|
|
13
12
|
import os from 'node:os';
|
|
14
|
-
|
|
15
13
|
import { DEFAULT_SETTINGS, generateAccessKey, isLoopbackHost, normalizeSettings } from '../server/config.js';
|
|
16
|
-
|
|
17
14
|
// Provider presets for the AI account step. `none` is the honest default: the
|
|
18
15
|
// app works fully offline, and the browser can still hold its own key.
|
|
19
16
|
export const PROVIDER_PRESETS = {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
none: { label: 'Skip — set it later (the app works offline)', baseUrl: '' },
|
|
18
|
+
'openai-compatible': { label: 'OpenAI or any compatible endpoint', baseUrl: 'https://api.openai.com/v1' },
|
|
19
|
+
ollama: { label: 'Ollama (local models)', baseUrl: 'http://localhost:11434/v1' },
|
|
20
|
+
openrouter: { label: 'OpenRouter', baseUrl: 'https://openrouter.ai/api/v1' },
|
|
21
|
+
custom: { label: 'Custom base URL', baseUrl: '' },
|
|
25
22
|
};
|
|
26
|
-
|
|
27
23
|
export const TUNNEL_CHOICES = [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
{ value: 'none', label: 'No tunnel', hint: 'reach the server directly' },
|
|
25
|
+
{ value: 'cloudflare', label: 'Cloudflare quick tunnel', hint: 'cloudflared — a public https://*.trycloudflare.com name' },
|
|
26
|
+
{ value: 'tailscale', label: 'Tailscale serve', hint: 'your devices only, https://machine.tailnet.ts.net' },
|
|
27
|
+
{ value: 'both', label: 'Both', hint: 'public via Cloudflare, private via tailnet' },
|
|
32
28
|
];
|
|
33
|
-
|
|
34
29
|
export function validPort(value) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
const n = Number(String(value).trim());
|
|
31
|
+
if (!Number.isInteger(n) || n < 1 || n > 65535)
|
|
32
|
+
return 'A whole number from 1 to 65535.';
|
|
33
|
+
return null;
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
export function validDomain(value) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
const domain = String(value || '').trim();
|
|
37
|
+
if (!domain)
|
|
38
|
+
return null; // optional in some flows; required ones check separately
|
|
39
|
+
if (domain.length > 253 || /[\s/@\\]/.test(domain) || domain.startsWith('.') || !domain.includes('.')) {
|
|
40
|
+
return 'A hostname such as map.example.com.';
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
47
43
|
}
|
|
48
|
-
|
|
49
44
|
export function validEmail(value) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
const email = String(value || '').trim();
|
|
46
|
+
if (!email)
|
|
47
|
+
return null; // optional
|
|
48
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email) ? null : 'That does not look like an email address.';
|
|
53
49
|
}
|
|
54
|
-
|
|
55
50
|
function providerOf(account) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
if (!account?.baseUrl)
|
|
52
|
+
return 'none';
|
|
53
|
+
for (const [id, preset] of Object.entries(PROVIDER_PRESETS)) {
|
|
54
|
+
if (id !== 'none' && id !== 'custom' && preset.baseUrl === account.baseUrl)
|
|
55
|
+
return id;
|
|
56
|
+
}
|
|
57
|
+
return 'custom';
|
|
61
58
|
}
|
|
62
|
-
|
|
63
59
|
function tunnelChoiceOf(tunnel) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
60
|
+
if (tunnel?.cloudflare && tunnel?.tailscale)
|
|
61
|
+
return 'both';
|
|
62
|
+
if (tunnel?.cloudflare)
|
|
63
|
+
return 'cloudflare';
|
|
64
|
+
if (tunnel?.tailscale)
|
|
65
|
+
return 'tailscale';
|
|
66
|
+
return 'none';
|
|
68
67
|
}
|
|
69
|
-
|
|
70
68
|
// The ordered question list. Every step's `when` reads the answers collected
|
|
71
69
|
// so far, which is what makes the wizard a tree rather than a script: answer
|
|
72
70
|
// "local" and the whole network/security branch never appears.
|
|
73
71
|
export function buildSteps(current = DEFAULT_SETTINGS) {
|
|
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
|
-
|
|
102
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
72
|
+
const account = current.account || DEFAULT_SETTINGS.account;
|
|
73
|
+
return [
|
|
74
|
+
{
|
|
75
|
+
id: 'name', section: 'Profile', type: 'text',
|
|
76
|
+
question: 'Your name',
|
|
77
|
+
hint: 'shown in the settings drawer; never leaves this machine',
|
|
78
|
+
default: account.name || safeUsername(),
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'email', section: 'Profile', type: 'text',
|
|
82
|
+
question: 'Your email (optional)',
|
|
83
|
+
hint: 'for your own reference only',
|
|
84
|
+
default: account.email || '',
|
|
85
|
+
validate: validEmail,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'mode', section: 'Server', type: 'choice',
|
|
89
|
+
question: 'How will you run Onboarder?',
|
|
90
|
+
choices: [
|
|
91
|
+
{ value: 'local', label: 'Local — localhost only', hint: 'private by construction; nothing on the network can reach it' },
|
|
92
|
+
{ value: 'self-hosted', label: 'Self-hosted — domain, LAN, or tunnel', hint: 'reach it from other devices; every API call needs an access key' },
|
|
93
|
+
],
|
|
94
|
+
default: current.mode,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'host', section: 'Server', type: 'choice',
|
|
98
|
+
question: 'What should the server bind to?',
|
|
99
|
+
choices: [
|
|
100
|
+
{ value: '127.0.0.1', label: 'Loopback only — behind Cloudflare or Tailscale', hint: 'safest remote layout; the tunnel/proxy connects to 127.0.0.1' },
|
|
101
|
+
{ value: '0.0.0.0', label: 'Every interface — direct public/LAN access', hint: 'accessible by server IP; recommended for a cloud VPS' },
|
|
102
|
+
],
|
|
103
|
+
default: (answers) => {
|
|
104
|
+
const currentHost = current.host;
|
|
105
|
+
if (answers.host)
|
|
106
|
+
return answers.host;
|
|
107
|
+
if (current.mode === 'self-hosted' && ['127.0.0.1', 'localhost', '::1', '[::1]'].includes(currentHost))
|
|
108
|
+
return currentHost;
|
|
109
|
+
return '0.0.0.0';
|
|
110
|
+
},
|
|
111
|
+
when: (a) => a.mode === 'self-hosted',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: 'port', section: 'Server', type: 'text',
|
|
115
|
+
question: 'Port',
|
|
116
|
+
default: String(current.port),
|
|
117
|
+
validate: validPort,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: 'domain', section: 'Server', type: 'text',
|
|
121
|
+
question: 'Domain (optional for direct IP or a tunnel)',
|
|
122
|
+
hint: 'e.g. map.example.com — point an A/AAAA record to this VPS to enable trusted HTTPS',
|
|
123
|
+
default: current.domain || '',
|
|
124
|
+
validate: validDomain,
|
|
125
|
+
when: (a) => a.mode === 'self-hosted',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 'https', section: 'HTTPS', type: 'confirm',
|
|
129
|
+
question: 'Set up automatic HTTPS with Caddy?',
|
|
130
|
+
hint: 'Caddy obtains and renews the certificate, proxies 80/443, and sends traffic to this app',
|
|
131
|
+
default: Boolean(current.domain && current.https),
|
|
132
|
+
when: (a) => a.mode === 'self-hosted' && Boolean(a.domain),
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: 'keyChoice', section: 'Security', type: 'choice',
|
|
136
|
+
question: 'Access key — the one credential remote devices must hold',
|
|
137
|
+
choices: [
|
|
138
|
+
{ value: 'generate', label: 'Generate a strong key (recommended)', hint: 'shown once at the end, stored in the config file' },
|
|
139
|
+
...(current.accessKey ? [{ value: 'keep', label: `Keep the existing key (${current.accessKey.slice(0, 6)}…)`, hint: '' }] : []),
|
|
140
|
+
{ value: 'enter', label: 'Enter my own', hint: '' },
|
|
141
|
+
],
|
|
142
|
+
default: current.accessKey ? 'keep' : 'generate',
|
|
143
|
+
when: (a) => a.mode === 'self-hosted',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: 'keyValue', section: 'Security', type: 'text',
|
|
147
|
+
question: 'Your access key',
|
|
148
|
+
hint: 'at least 16 characters; anyone holding it can drive the API',
|
|
149
|
+
validate: (v) => (String(v || '').trim().length >= 16 ? null : 'At least 16 characters.'),
|
|
150
|
+
when: (a) => a.mode === 'self-hosted' && a.keyChoice === 'enter',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'provider', section: 'AI provider (optional)', type: 'choice',
|
|
154
|
+
question: 'Default AI provider for explain/chat features',
|
|
155
|
+
choices: Object.entries(PROVIDER_PRESETS).map(([value, p]) => ({ value, label: p.label, hint: p.baseUrl })),
|
|
156
|
+
default: providerOf(account),
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: 'baseUrl', section: 'AI provider (optional)', type: 'text',
|
|
160
|
+
question: 'Base URL',
|
|
161
|
+
default: (a) => PROVIDER_PRESETS[a.provider]?.baseUrl || account.baseUrl || '',
|
|
162
|
+
validate: (v) => (v && !/^https?:\/\//.test(v) ? 'An http(s) URL, e.g. https://api.openai.com/v1.' : null),
|
|
163
|
+
when: (a) => a.provider && a.provider !== 'none',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: 'model', section: 'AI provider (optional)', type: 'text',
|
|
167
|
+
question: 'Model (optional)',
|
|
168
|
+
hint: 'e.g. gpt-4o-mini, llama3.1',
|
|
169
|
+
default: account.model || '',
|
|
170
|
+
when: (a) => a.provider && a.provider !== 'none',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: 'tunnelChoice', section: 'Remote access', type: 'choice',
|
|
174
|
+
question: 'Expose it through a tunnel?',
|
|
175
|
+
hint: 'the wizard prints the exact command afterwards; missing CLIs get an install hint',
|
|
176
|
+
choices: TUNNEL_CHOICES,
|
|
177
|
+
default: tunnelChoiceOf(current.tunnel),
|
|
178
|
+
when: (a) => a.mode === 'self-hosted',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
id: 'autoOpen', section: 'Finish', type: 'confirm',
|
|
182
|
+
question: 'Open the app in a browser when the server starts?',
|
|
183
|
+
default: current.autoOpen !== false,
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
187
|
function safeUsername() {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
try {
|
|
189
|
+
return os.userInfo().username || '';
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
return '';
|
|
193
|
+
}
|
|
195
194
|
}
|
|
196
|
-
|
|
197
195
|
// Steps for one run, given what is already answered: flags pre-answer questions
|
|
198
196
|
// (a flagged question is never asked), and `when` prunes dead branches. The
|
|
199
197
|
// answers object grows as the run proceeds, so a later step's `when` sees both
|
|
200
198
|
// flag answers and typed answers through the same lens.
|
|
201
199
|
export function pendingSteps(steps, answers = {}) {
|
|
202
|
-
|
|
200
|
+
return steps.filter((s) => !(s.id in answers) && (!s.when || s.when(answers)));
|
|
203
201
|
}
|
|
204
|
-
|
|
205
202
|
// Steps the flags did not answer, in order — and nothing more. Unlike
|
|
206
203
|
// `pendingSteps` this never looks at `when`: conditions read answers that
|
|
207
204
|
// only exist mid-run ("ask about the bind once mode is self-hosted"), so
|
|
@@ -209,147 +206,170 @@ export function pendingSteps(steps, answers = {}) {
|
|
|
209
206
|
// would reopen. The renderer (`prompt.js#runSteps`) evaluates `when` live,
|
|
210
207
|
// one question at a time, which is the only moment it can be answered truly.
|
|
211
208
|
export function unansweredSteps(steps, answers = {}) {
|
|
212
|
-
|
|
209
|
+
return steps.filter((s) => !(s.id in answers));
|
|
213
210
|
}
|
|
214
|
-
|
|
215
211
|
// Defaults may depend on earlier answers (`default` as a function).
|
|
216
212
|
export function defaultOf(step, answers) {
|
|
217
|
-
|
|
213
|
+
return typeof step.default === 'function' ? step.default(answers) : step.default;
|
|
218
214
|
}
|
|
219
|
-
|
|
220
215
|
// Answers → settings. The key rule: this builds a plain object and hands it to
|
|
221
216
|
// normalizeSettings, so an impossible combination (local mode on 0.0.0.0, a
|
|
222
217
|
// LAN bind with no domain) fails with the schema's own sentence here, in the
|
|
223
218
|
// API, and in `config set` — one law, three courts.
|
|
224
219
|
export function answersToSettings(current, answers) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
220
|
+
const selfHosted = answers.mode === 'self-hosted';
|
|
221
|
+
const provider = answers.provider || 'none';
|
|
222
|
+
const account = {
|
|
223
|
+
name: answers.name ?? current.account?.name ?? '',
|
|
224
|
+
email: answers.email ?? current.account?.email ?? '',
|
|
225
|
+
provider: provider === 'none' ? 'openai-compatible' : provider,
|
|
226
|
+
baseUrl: provider === 'none' ? '' : String(answers.baseUrl ?? '').trim().replace(/\/+$/, ''),
|
|
227
|
+
model: provider === 'none' ? '' : String(answers.model ?? '').trim(),
|
|
228
|
+
};
|
|
229
|
+
let accessKey = current.accessKey || '';
|
|
230
|
+
if (selfHosted) {
|
|
231
|
+
if (answers.keyChoice === 'generate' || (!answers.keyChoice && !accessKey))
|
|
232
|
+
accessKey = generateAccessKey();
|
|
233
|
+
else if (answers.keyChoice === 'enter')
|
|
234
|
+
accessKey = String(answers.keyValue || '').trim();
|
|
235
|
+
}
|
|
236
|
+
const choice = answers.tunnelChoice || tunnelChoiceOf(current.tunnel);
|
|
237
|
+
const tunnel = selfHosted
|
|
238
|
+
? { cloudflare: choice === 'cloudflare' || choice === 'both', tailscale: choice === 'tailscale' || choice === 'both' }
|
|
239
|
+
: { ...(current.tunnel || DEFAULT_SETTINGS.tunnel) };
|
|
240
|
+
return normalizeSettings({
|
|
241
|
+
version: current.version,
|
|
242
|
+
mode: selfHosted ? 'self-hosted' : 'local',
|
|
243
|
+
host: selfHosted ? (answers.host || '0.0.0.0') : '127.0.0.1',
|
|
244
|
+
port: Number(answers.port ?? current.port ?? DEFAULT_SETTINGS.port),
|
|
245
|
+
domain: selfHosted ? String(answers.domain ?? current.domain ?? '').trim().toLowerCase() : '',
|
|
246
|
+
https: selfHosted && Boolean(answers.domain) && Boolean(answers.https),
|
|
247
|
+
accessKey,
|
|
248
|
+
autoOpen: answers.autoOpen ?? current.autoOpen ?? false,
|
|
249
|
+
account,
|
|
250
|
+
tunnel,
|
|
251
|
+
});
|
|
255
252
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
253
|
// The non-interactive twin: --flags become the same patch the wizard would
|
|
259
254
|
// have collected. Anything unflagged falls back to the current settings, and
|
|
260
255
|
// the whole result goes through the same normalizeSettings validation, so
|
|
261
256
|
// `onboarder setup --non-interactive --mode self-hosted --port 8080` can never
|
|
262
257
|
// produce a config the interactive wizard would refuse.
|
|
263
258
|
export function applyFlags(current, flags = {}) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
account
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (flags.
|
|
326
|
-
|
|
327
|
-
|
|
259
|
+
const patch = {};
|
|
260
|
+
if (flags.mode !== undefined) {
|
|
261
|
+
if (!['local', 'self-hosted'].includes(flags.mode))
|
|
262
|
+
throw new Error('--mode must be "local" or "self-hosted".');
|
|
263
|
+
patch.mode = flags.mode;
|
|
264
|
+
}
|
|
265
|
+
const mode = patch.mode || current.mode;
|
|
266
|
+
if (flags.host !== undefined)
|
|
267
|
+
patch.host = flags.host;
|
|
268
|
+
if (flags.port !== undefined) {
|
|
269
|
+
const err = validPort(flags.port);
|
|
270
|
+
if (err)
|
|
271
|
+
throw new Error('--port: ' + err);
|
|
272
|
+
patch.port = Number(flags.port);
|
|
273
|
+
}
|
|
274
|
+
if (flags.domain !== undefined) {
|
|
275
|
+
const err = validDomain(flags.domain);
|
|
276
|
+
if (err)
|
|
277
|
+
throw new Error('--domain: ' + err);
|
|
278
|
+
patch.domain = String(flags.domain).trim().toLowerCase();
|
|
279
|
+
}
|
|
280
|
+
if (flags.https !== undefined)
|
|
281
|
+
patch.https = Boolean(flags.https);
|
|
282
|
+
if (flags.accessKey === 'generate')
|
|
283
|
+
patch.accessKey = generateAccessKey();
|
|
284
|
+
else if (flags.accessKey !== undefined) {
|
|
285
|
+
if (String(flags.accessKey).trim().length < 16)
|
|
286
|
+
throw new Error('--access-key must be at least 16 characters, or "generate".');
|
|
287
|
+
patch.accessKey = String(flags.accessKey).trim();
|
|
288
|
+
}
|
|
289
|
+
else if (mode === 'self-hosted' && !current.accessKey) {
|
|
290
|
+
// Self-hosted without a key is a locked door with no handle — generate one
|
|
291
|
+
// rather than write a config that refuses every call.
|
|
292
|
+
patch.accessKey = generateAccessKey();
|
|
293
|
+
}
|
|
294
|
+
if (flags.autoOpen !== undefined)
|
|
295
|
+
patch.autoOpen = Boolean(flags.autoOpen);
|
|
296
|
+
const account = {};
|
|
297
|
+
if (flags.name !== undefined)
|
|
298
|
+
account.name = String(flags.name);
|
|
299
|
+
if (flags.email !== undefined) {
|
|
300
|
+
const err = validEmail(flags.email);
|
|
301
|
+
if (err)
|
|
302
|
+
throw new Error('--email: ' + err);
|
|
303
|
+
account.email = String(flags.email);
|
|
304
|
+
}
|
|
305
|
+
if (flags.provider !== undefined) {
|
|
306
|
+
if (!(flags.provider in PROVIDER_PRESETS))
|
|
307
|
+
throw new Error('--provider must be one of: ' + Object.keys(PROVIDER_PRESETS).join(', '));
|
|
308
|
+
account.provider = flags.provider === 'none' ? 'openai-compatible' : flags.provider;
|
|
309
|
+
account.baseUrl = PROVIDER_PRESETS[flags.provider]?.baseUrl || '';
|
|
310
|
+
if (flags.provider === 'none')
|
|
311
|
+
account.model = '';
|
|
312
|
+
}
|
|
313
|
+
if (flags.baseUrl !== undefined)
|
|
314
|
+
account.baseUrl = String(flags.baseUrl).trim().replace(/\/+$/, '');
|
|
315
|
+
if (flags.model !== undefined)
|
|
316
|
+
account.model = String(flags.model).trim();
|
|
317
|
+
if (Object.keys(account).length)
|
|
318
|
+
patch.account = account;
|
|
319
|
+
const tunnel = {};
|
|
320
|
+
if (flags.cloudflare !== undefined)
|
|
321
|
+
tunnel.cloudflare = Boolean(flags.cloudflare);
|
|
322
|
+
if (flags.tailscale !== undefined)
|
|
323
|
+
tunnel.tailscale = Boolean(flags.tailscale);
|
|
324
|
+
if (Object.keys(tunnel).length)
|
|
325
|
+
patch.tunnel = tunnel;
|
|
326
|
+
const merged = {
|
|
327
|
+
...current, ...patch,
|
|
328
|
+
account: { ...(current.account || DEFAULT_SETTINGS.account), ...account },
|
|
329
|
+
tunnel: { ...(current.tunnel || DEFAULT_SETTINGS.tunnel), ...tunnel },
|
|
330
|
+
};
|
|
331
|
+
// A fresh self-hosted setup is direct-first for cloud/VPS use. Re-running setup
|
|
332
|
+
// preserves an existing deliberate loopback choice for tunnels and Caddy.
|
|
333
|
+
if (flags.mode === 'self-hosted' && flags.host === undefined && current.mode !== 'self-hosted') {
|
|
334
|
+
merged.host = '0.0.0.0';
|
|
335
|
+
}
|
|
336
|
+
if (merged.mode === 'local') {
|
|
337
|
+
if (!['127.0.0.1', 'localhost', '::1', '[::1]'].includes(merged.host))
|
|
338
|
+
merged.host = '127.0.0.1';
|
|
339
|
+
if (flags.domain === undefined)
|
|
340
|
+
merged.domain = '';
|
|
341
|
+
if (flags.https === undefined)
|
|
342
|
+
merged.https = false;
|
|
343
|
+
}
|
|
344
|
+
return { patch, settings: normalizeSettings(merged) };
|
|
328
345
|
}
|
|
329
|
-
|
|
330
346
|
// What the wizard's last screen shows before writing. `reveal` is the one
|
|
331
347
|
// moment the key is printed — rotation through the API has the same rule.
|
|
332
348
|
export function summaryLines(settings, { revealKey = false } = {}) {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
349
|
+
const lines = [
|
|
350
|
+
['Mode', settings.mode],
|
|
351
|
+
['Bind', `${settings.host}:${settings.port}`],
|
|
352
|
+
];
|
|
353
|
+
if (settings.domain)
|
|
354
|
+
lines.push(['Domain', (settings.https ? 'https://' : 'http://') + settings.domain + (settings.https ? '' : ':' + settings.port)]);
|
|
355
|
+
if (settings.mode === 'self-hosted') {
|
|
356
|
+
lines.push(['Access key', revealKey
|
|
357
|
+
? settings.accessKey
|
|
358
|
+
: (settings.accessKey ? settings.accessKey.slice(0, 6) + '… (hidden)' : '(none — the API will refuse every call)')]);
|
|
359
|
+
if (isLoopbackHost(settings.host)) {
|
|
360
|
+
lines.push(['Network', 'loopback only — use a tunnel or bind 0.0.0.0 for direct access']);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
const who = [settings.account.name, settings.account.email].filter(Boolean).join(' · ');
|
|
364
|
+
if (who)
|
|
365
|
+
lines.push(['Profile', who]);
|
|
366
|
+
if (settings.account.baseUrl) {
|
|
367
|
+
lines.push(['AI', `${settings.account.provider} — ${settings.account.baseUrl}${settings.account.model ? ' — ' + settings.account.model : ''}`]);
|
|
344
368
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
lines
|
|
350
|
-
}
|
|
351
|
-
const tunnels = [settings.tunnel.cloudflare && 'cloudflare', settings.tunnel.tailscale && 'tailscale'].filter(Boolean);
|
|
352
|
-
if (tunnels.length) lines.push(['Tunnels', tunnels.join(' + ')]);
|
|
353
|
-
lines.push(['Auto-open', settings.autoOpen ? 'yes' : 'no']);
|
|
354
|
-
return lines;
|
|
369
|
+
const tunnels = [settings.tunnel.cloudflare && 'cloudflare', settings.tunnel.tailscale && 'tailscale'].filter(Boolean);
|
|
370
|
+
if (tunnels.length)
|
|
371
|
+
lines.push(['Tunnels', tunnels.join(' + ')]);
|
|
372
|
+
lines.push(['Auto-open', settings.autoOpen ? 'yes' : 'no']);
|
|
373
|
+
return lines;
|
|
355
374
|
}
|
|
375
|
+
//# sourceMappingURL=wizard.js.map
|