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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cli/chat/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,CAAC,MAAM,EAAE,WAAW,EAAE,4BAA4B,CAAC;IACnD,CAAC,KAAK,EAAE,YAAY,EAAE,2BAA2B,CAAC;IAClD,CAAC,QAAQ,EAAE,oBAAoB,EAAE,qCAAqC,CAAC;IACvE,CAAC,QAAQ,EAAE,uBAAuB,EAAE,sCAAsC,CAAC;IAC3E,CAAC,WAAW,EAAE,QAAQ,EAAE,2CAA2C,C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this repository'],\n ['review', '[PR number] [task]', 'Review local changes or a GitHub PR'],\n ['triage', '[issue number] [task]', 'Investigate issues and suggest fixes'],\n ['implement', '<task>', 'Make changes in an isolated Git workspace'],\n ['pr', '<task>', 'Prepare a draft PR; publish when GitHub writes are enabled'],\n ['github', '<task>', 'Work with GitHub issues, reviews, labels, and CI'],\n ['mode', '[ask|review|triage|implement|pr|github]', 'Choose the workflow for following messages'],\n ['permissions', '[checks|github] [on|off]', 'Control test execution and GitHub writes'],\n ['model', '[name] [provider]', 'Open the provider/model picker; configure opens full Hermes setup'],\n ['limits', '[seconds] [turns]', 'Set the run timeout and tool-turn budget'],\n ['repo', '[folder|GitHub URL]', 'Show or switch the repository; clone GitHub URLs'],\n ['clone', '<GitHub URL>', 'Clone a repository into a saved local checkout'],\n ['pull', '', 'Update the saved checkout without overwriting local changes'],\n ['new', '', 'Start a fresh conversation'],\n ['history', '', 'List saved conversations for this repository'],\n ['resume', '<conversation ID>', 'Continue a saved conversation'],\n ['status', '', 'Show model, permissions, workspace, and last run'],\n ['paste', '', 'Enter a multiline message; finish with /send or /discard'],\n ['cancel', '', 'Stop the active task (Ctrl-C also works)'],\n ['map', '', 'Repository overview, available offline'],\n ['tree', '[folder] [depth]', 'Browse repository files'],\n ['find', '<query>', 'Search files, symbols, and contents'],\n ['show', '<file> [from] [count]', 'Read a file'],\n ['diff', '[base] [head] [file]', 'Inspect changes in the current workspace'],\n ['health', '', 'Inspect repository health'],\n ['rescan', '', 'Refresh the cached repository analysis'],\n ['tour', '', 'Find the best reading order for this codebase'],\n ['explain', '[file|folder]', 'Explain a module using local analysis'],\n ['deps', '<file>', 'Trace imports and reverse dependencies'],\n ['inspect', '<file>', 'Inspect role, complexity, exports, and findings'],\n ['graph', '<file> [depth]', 'Explore the dependency graph'],\n ['blast', '<file>', 'Show the impact of changing a file'],\n ['symbols', '<file>', 'List functions, classes, and exports'],\n ['hubs', '', 'Find the most depended-on modules'],\n ['layers', '', 'Inspect architecture layers'],\n ['patterns', '', 'Discover architecture patterns'],\n ['stats', '', 'Inspect language and complexity statistics'],\n ['security', '', 'Show local security findings'],\n ['stack', '', 'Inspect frameworks and dependencies'],\n ['entry', '', 'Locate application entry points'],\n ['externals', '', 'Inspect external dependencies and drift'],\n ['coupling', '', 'Explore traffic between folders'],\n ['clusters', '', 'Find groups of related modules'],\n ['risks', '', 'Inspect code and architecture risks'],\n ['log', '[count]', 'Read recent Git commits'],\n ['hotspots', '[count]', 'Find frequently changed complex files'],\n ['blame', '<file>', 'Read line authorship'],\n ['diagram', '[file|folder]', 'Generate Mermaid diagram source'],\n ['layers-diagram', '', 'Generate an architecture layer diagram'],\n ['atlas', '', 'Browse available diagrams'],\n ['docs', '[file|folder] [--write]', 'Read or explicitly generate repository documentation'],\n ['workflows', '', 'Inspect GitHub Actions workflows'],\n ['sbom', '[package]', 'Inspect dependencies and licenses'],\n ['engines', '', 'Show available optional analyzers'],\n ['deep', '<engine|all>', 'Run an optional analyzer when checks are enabled'],\n ['web', '', 'Open the repository in the web interface'],\n ['about', '', 'Show repository and application information'],\n ['tools', '', 'List the actual tools available to Hermes'],\n ['skills', '', 'Discover the six built-in agent workflows'],\n ['runs', '', 'List saved agent runs'],\n ['run', '<run ID>', 'Read a saved result from this repository'],\n ['export', '', 'Save this conversation as Markdown'],\n ['send', '', 'Submit the message composed with /paste'],\n ['discard', '', 'Discard the message composed with /paste'],\n ['doctor', '', 'Check the Hermes runtime and profile'],\n ['setup', '', 'Prepare the dedicated Hermes profile'],\n ['clear', '', 'Clear the screen; keep the conversation'],\n ['exit', '', 'Save and exit (Ctrl-D also works)'],\n] as const;\nexport type ChatCommand = typeof CHAT_COMMANDS[number][0];\nexport const BROWSE_COMMANDS = ['map', 'tree', 'find', 'show', 'diff', 'health', 'rescan', 'tour', 'explain', 'deps', 'inspect', 'graph', 'blast', 'symbols', 'hubs', 'layers', 'patterns', 'stats', 'security', 'stack', 'entry', 'externals', 'coupling', 'clusters', 'risks', 'log', 'hotspots', 'blame', 'diagram', 'layers-diagram', 'atlas', 'docs', 'workflows', 'sbom', 'engines', 'deep', 'web', 'about'] as const;\n\nexport function suggestCommands(line: string): typeof CHAT_COMMANDS[number][] {\n if (!/^\\/[\\w-]*$/.test(line)) return [];\n const query = line.slice(1).toLowerCase();\n return CHAT_COMMANDS.filter(([name, , summary]) => name.startsWith(query) || query.length > 1 && summary.toLowerCase().includes(query))\n .sort((a, b) => Number(b[0].startsWith(query)) - Number(a[0].startsWith(query)));\n}\n\nexport function slashInput(line: string): { name: string; args: string[]; body: string } | null {\n const match = /^\\/([\\w-]*)(?:\\s+([\\s\\S]*))?$/.exec(line.trim());\n if (!match) return null;\n const body = match[2] || '';\n // Quotes are useful for file paths. Workflow tasks retain the original body.\n const args = [...body.matchAll(/\"([^\"]*)\"|'([^']*)'|(\\S+)/g)].map(m => m[1] ?? m[2] ?? m[3]!);\n return { name: match[1]!, args, body };\n}\nexport function chatHelp(topic = ''): string {\n const commands = topic ? CHAT_COMMANDS.filter(c => c[0] === topic.replace(/^\\//, '')) : CHAT_COMMANDS;\n if (!commands.length) return `Unknown command /${topic}. Use /help.`;\n return ['Slash commands', '', ...commands.map(([name, args, detail]) => ` /${name}${args ? ' ' + args : ''}\\n ${detail}`), '',\n 'Type / for live suggestions. ↑/↓ select; Tab or Enter fills the command. Esc dismisses.',\n 'Alt-Enter adds a line. Bracketed paste preserves multiline text. Ctrl-C cancels a task.',\n '/review 42 /triage 12 /implement Fix the failing test',\n '/permissions checks on /permissions github on',\n 'Paste a GitHub URL to clone and open it, then type your question.',\n 'Follow-ups reuse the Hermes session. Mode, target, model, or permission changes start a new session.',\n 'Use /paste for multiline text. /new resets context; /clear only clears the screen.'].join('\\n');\n}\nexport function completeChat(line: string, files: string[] = []): [string[], string] {\n if (!line.startsWith('/')) return [[], line];\n if (!line.includes(' ')) return [CHAT_COMMANDS.map(c => '/' + c[0]).filter(c => c.startsWith(line)), line];\n const [command, ...args] = line.split(/\\s+/), fragment = args.at(-1) || '';\n let candidates: readonly string[] = [];\n if (command === '/mode') candidates = AGENT_MODES;\n if (command === '/permissions') candidates = args.length === 1 ? ['checks', 'github'] : ['on', 'off'];\n if (command === '/model' && args.length === 1) candidates = ['configure', 'default'];\n if (['/show', '/tree', '/repo', '/deps', '/inspect', '/graph', '/blast', '/symbols', '/explain', '/blame', '/docs', '/diagram'].includes(command!)) candidates = files;\n return [candidates.filter(c => c.startsWith(fragment)).slice(0, 100), fragment];\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import readline from 'node:readline';
|
|
2
|
+
import { type ChatTheme } from './render.js';
|
|
3
|
+
export interface ComposerOptions {
|
|
4
|
+
input: NodeJS.ReadStream;
|
|
5
|
+
output: NodeJS.WriteStream;
|
|
6
|
+
theme?: ChatTheme;
|
|
7
|
+
state: () => {
|
|
8
|
+
mode: string;
|
|
9
|
+
status: string;
|
|
10
|
+
busy: boolean;
|
|
11
|
+
pasting: boolean;
|
|
12
|
+
files: string[];
|
|
13
|
+
};
|
|
14
|
+
submit: (message: string) => void;
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
exit: () => void;
|
|
17
|
+
fullscreen?: boolean;
|
|
18
|
+
welcome?: (columns: number, rows: number) => string;
|
|
19
|
+
header?: () => string;
|
|
20
|
+
}
|
|
21
|
+
export interface PickerChoice {
|
|
22
|
+
value: string;
|
|
23
|
+
label: string;
|
|
24
|
+
detail?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface PickerOptions {
|
|
27
|
+
title: string;
|
|
28
|
+
hint?: string;
|
|
29
|
+
choices: PickerChoice[];
|
|
30
|
+
selected?: string;
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
}
|
|
33
|
+
/** Raw-input composer with a full-screen viewport or an inline terminal footer. */
|
|
34
|
+
export declare class TerminalComposer {
|
|
35
|
+
private options;
|
|
36
|
+
value: string;
|
|
37
|
+
private cursor;
|
|
38
|
+
private selected;
|
|
39
|
+
private dismissed;
|
|
40
|
+
private history;
|
|
41
|
+
private historyIndex;
|
|
42
|
+
private draft;
|
|
43
|
+
private paste;
|
|
44
|
+
private pasteCR;
|
|
45
|
+
private suspended;
|
|
46
|
+
private attached;
|
|
47
|
+
private drawnRows;
|
|
48
|
+
private cursorRow;
|
|
49
|
+
private timer;
|
|
50
|
+
private rawBefore;
|
|
51
|
+
private theme;
|
|
52
|
+
private screen;
|
|
53
|
+
private viewHeight;
|
|
54
|
+
private picker;
|
|
55
|
+
private onKey;
|
|
56
|
+
private onResize;
|
|
57
|
+
constructor(options: ComposerOptions);
|
|
58
|
+
get choosing(): boolean;
|
|
59
|
+
start(): void;
|
|
60
|
+
suspend(): void;
|
|
61
|
+
close(): void;
|
|
62
|
+
refresh(): void;
|
|
63
|
+
print(text: string): void;
|
|
64
|
+
clear(): void;
|
|
65
|
+
choose(options: PickerOptions): Promise<string | null>;
|
|
66
|
+
private pickerChoices;
|
|
67
|
+
private pickerKey;
|
|
68
|
+
private erase;
|
|
69
|
+
private replace;
|
|
70
|
+
private insert;
|
|
71
|
+
private suggestions;
|
|
72
|
+
key(text: string, key?: readline.Key): void;
|
|
73
|
+
private deleteNext;
|
|
74
|
+
private render;
|
|
75
|
+
}
|
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import readline from 'node:readline';
|
|
2
|
+
import { terminalText } from '../agent/process.js';
|
|
3
|
+
import { completeChat, suggestCommands } from './commands.js';
|
|
4
|
+
import { cells, clusterCells, clip, graphemes } from './text.js';
|
|
5
|
+
import { plainTheme } from './render.js';
|
|
6
|
+
import { TerminalScreen, wrapScreenLine } from './screen.js';
|
|
7
|
+
/** Raw-input composer with a full-screen viewport or an inline terminal footer. */
|
|
8
|
+
export class TerminalComposer {
|
|
9
|
+
options;
|
|
10
|
+
value = '';
|
|
11
|
+
cursor = 0;
|
|
12
|
+
selected = 0;
|
|
13
|
+
dismissed = false;
|
|
14
|
+
history = [];
|
|
15
|
+
historyIndex = -1;
|
|
16
|
+
draft = '';
|
|
17
|
+
paste = false;
|
|
18
|
+
pasteCR = false;
|
|
19
|
+
suspended = true;
|
|
20
|
+
attached = false;
|
|
21
|
+
drawnRows = 0;
|
|
22
|
+
cursorRow = 0;
|
|
23
|
+
timer = null;
|
|
24
|
+
rawBefore = false;
|
|
25
|
+
theme;
|
|
26
|
+
screen;
|
|
27
|
+
viewHeight = 1;
|
|
28
|
+
picker = null;
|
|
29
|
+
onKey = (text, key = {}) => this.key(text, key);
|
|
30
|
+
onResize = () => this.refresh();
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.options = options;
|
|
33
|
+
this.theme = options.theme || plainTheme;
|
|
34
|
+
this.screen = options.fullscreen ? new TerminalScreen(options.output) : null;
|
|
35
|
+
}
|
|
36
|
+
get choosing() { return this.picker !== null; }
|
|
37
|
+
start() {
|
|
38
|
+
if (this.attached)
|
|
39
|
+
return;
|
|
40
|
+
this.attached = true;
|
|
41
|
+
this.suspended = false;
|
|
42
|
+
this.rawBefore = !!this.options.input.isRaw;
|
|
43
|
+
readline.emitKeypressEvents(this.options.input);
|
|
44
|
+
this.options.input.setRawMode?.(true);
|
|
45
|
+
this.options.input.resume();
|
|
46
|
+
this.options.input.on('keypress', this.onKey);
|
|
47
|
+
this.options.input.on('end', this.options.exit);
|
|
48
|
+
this.options.output.on('resize', this.onResize);
|
|
49
|
+
this.screen?.enter();
|
|
50
|
+
this.options.output.write('\x1b[?2004h');
|
|
51
|
+
this.render();
|
|
52
|
+
}
|
|
53
|
+
suspend() {
|
|
54
|
+
this.picker?.finish(null);
|
|
55
|
+
this.erase();
|
|
56
|
+
this.suspended = true;
|
|
57
|
+
if (this.timer) {
|
|
58
|
+
clearTimeout(this.timer);
|
|
59
|
+
this.timer = null;
|
|
60
|
+
}
|
|
61
|
+
if (!this.attached)
|
|
62
|
+
return;
|
|
63
|
+
this.options.input.off('keypress', this.onKey);
|
|
64
|
+
this.options.input.off('end', this.options.exit);
|
|
65
|
+
this.options.output.off('resize', this.onResize);
|
|
66
|
+
this.options.output.write('\x1b[?2004l');
|
|
67
|
+
this.screen?.leave();
|
|
68
|
+
this.options.input.setRawMode?.(this.rawBefore);
|
|
69
|
+
// The keypress decoder remains attached to this stream. Pause the parent's
|
|
70
|
+
// reads so the inherited wizard TTY receives every keystroke exclusively.
|
|
71
|
+
this.options.input.pause();
|
|
72
|
+
this.attached = false;
|
|
73
|
+
}
|
|
74
|
+
close() { if (this.screen && !this.suspended)
|
|
75
|
+
this.render(); this.suspend(); this.options.input.pause(); }
|
|
76
|
+
refresh() {
|
|
77
|
+
if (this.suspended || this.timer)
|
|
78
|
+
return;
|
|
79
|
+
this.timer = setTimeout(() => { this.timer = null; this.render(); }, 24);
|
|
80
|
+
this.timer.unref();
|
|
81
|
+
}
|
|
82
|
+
print(text) {
|
|
83
|
+
if (this.screen) {
|
|
84
|
+
this.screen.append(text);
|
|
85
|
+
this.refresh();
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (this.suspended) {
|
|
89
|
+
this.options.output.write(text + '\n');
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.erase();
|
|
93
|
+
this.options.output.write(text + '\n');
|
|
94
|
+
this.refresh();
|
|
95
|
+
}
|
|
96
|
+
clear() { if (this.screen) {
|
|
97
|
+
this.screen.clear();
|
|
98
|
+
this.refresh();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
this.erase();
|
|
102
|
+
this.options.output.write('\x1b[2J\x1b[H');
|
|
103
|
+
} }
|
|
104
|
+
choose(options) {
|
|
105
|
+
this.picker?.finish(null);
|
|
106
|
+
if (this.suspended || options.signal?.aborted)
|
|
107
|
+
return Promise.resolve(null);
|
|
108
|
+
return new Promise(resolve => {
|
|
109
|
+
const abort = () => finish(null);
|
|
110
|
+
const finish = (value) => {
|
|
111
|
+
options.signal?.removeEventListener('abort', abort);
|
|
112
|
+
if (this.picker?.finish !== finish)
|
|
113
|
+
return;
|
|
114
|
+
this.picker = null;
|
|
115
|
+
this.paste = false;
|
|
116
|
+
this.refresh();
|
|
117
|
+
resolve(value);
|
|
118
|
+
};
|
|
119
|
+
this.picker = { ...options, query: '', index: Math.max(0, options.choices.findIndex(c => c.value === options.selected)), finish };
|
|
120
|
+
options.signal?.addEventListener('abort', abort, { once: true });
|
|
121
|
+
if (options.signal?.aborted)
|
|
122
|
+
finish(null);
|
|
123
|
+
else
|
|
124
|
+
this.refresh();
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
pickerChoices() {
|
|
128
|
+
const query = this.picker?.query.toLowerCase() || '';
|
|
129
|
+
return this.picker?.choices.filter(c => !query || (c.label + ' ' + (c.detail || '')).toLowerCase().includes(query)) || [];
|
|
130
|
+
}
|
|
131
|
+
pickerKey(text, key) {
|
|
132
|
+
const picker = this.picker;
|
|
133
|
+
if (key.name === 'paste-start') {
|
|
134
|
+
this.paste = true;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (key.name === 'paste-end') {
|
|
138
|
+
this.paste = false;
|
|
139
|
+
this.refresh();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (this.paste) {
|
|
143
|
+
if (text && !key.ctrl && !key.meta)
|
|
144
|
+
picker.query = (picker.query + terminalText(text).replace(/[\r\n\t]/g, ' ')).slice(0, 512);
|
|
145
|
+
picker.index = 0;
|
|
146
|
+
this.refresh();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
if (key.name === 'escape' || (key.ctrl && key.name === 'c')) {
|
|
150
|
+
picker.finish(null);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (key.ctrl && key.name === 'd') {
|
|
154
|
+
picker.finish(null);
|
|
155
|
+
this.options.exit();
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const choices = this.pickerChoices();
|
|
159
|
+
if (key.name === 'return' || key.name === 'enter') {
|
|
160
|
+
if (choices.length)
|
|
161
|
+
picker.finish(choices[picker.index % choices.length].value);
|
|
162
|
+
}
|
|
163
|
+
else if (['up', 'down', 'tab', 'pageup', 'pagedown'].includes(key.name || '')) {
|
|
164
|
+
const step = key.name === 'pageup' ? -6 : key.name === 'pagedown' ? 6 : key.name === 'up' || key.shift ? -1 : 1;
|
|
165
|
+
picker.index = choices.length ? (picker.index + step + choices.length * 6) % choices.length : 0;
|
|
166
|
+
}
|
|
167
|
+
else if (key.ctrl && key.name === 'u') {
|
|
168
|
+
picker.query = '';
|
|
169
|
+
picker.index = 0;
|
|
170
|
+
}
|
|
171
|
+
else if (key.name === 'backspace') {
|
|
172
|
+
picker.query = graphemes(picker.query).slice(0, -1).join('');
|
|
173
|
+
picker.index = 0;
|
|
174
|
+
}
|
|
175
|
+
else if (text && !key.ctrl && !key.meta && !/^[\x00-\x1f\x7f]/.test(text)) {
|
|
176
|
+
picker.query = (picker.query + terminalText(text)).slice(0, 512);
|
|
177
|
+
picker.index = 0;
|
|
178
|
+
}
|
|
179
|
+
this.refresh();
|
|
180
|
+
}
|
|
181
|
+
erase() {
|
|
182
|
+
if (this.screen)
|
|
183
|
+
return;
|
|
184
|
+
if (!this.drawnRows)
|
|
185
|
+
return;
|
|
186
|
+
if (this.cursorRow)
|
|
187
|
+
readline.moveCursor(this.options.output, 0, -this.cursorRow);
|
|
188
|
+
readline.cursorTo(this.options.output, 0);
|
|
189
|
+
readline.clearScreenDown(this.options.output);
|
|
190
|
+
this.drawnRows = 0;
|
|
191
|
+
this.cursorRow = 0;
|
|
192
|
+
}
|
|
193
|
+
replace(text) { this.value = text; this.cursor = text.length; this.selected = 0; this.dismissed = false; }
|
|
194
|
+
insert(text) {
|
|
195
|
+
const clean = terminalText(text).replace(/\r\n?/g, '\n').replace(/\t/g, ' ');
|
|
196
|
+
if (this.value.length + clean.length > 16000)
|
|
197
|
+
return;
|
|
198
|
+
this.value = this.value.slice(0, this.cursor) + clean + this.value.slice(this.cursor);
|
|
199
|
+
this.cursor += clean.length;
|
|
200
|
+
this.selected = 0;
|
|
201
|
+
this.dismissed = false;
|
|
202
|
+
this.historyIndex = -1;
|
|
203
|
+
}
|
|
204
|
+
suggestions() { return this.options.state().pasting || this.dismissed || this.cursor !== this.value.length ? [] : suggestCommands(this.value); }
|
|
205
|
+
key(text, key = {}) {
|
|
206
|
+
if (this.suspended)
|
|
207
|
+
return;
|
|
208
|
+
if (this.picker) {
|
|
209
|
+
this.pickerKey(text, key);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (this.screen && (key.name === 'pageup' || key.name === 'pagedown')) {
|
|
213
|
+
this.screen.scroll(key.name === 'pageup' ? 1 : -1, Math.max(1, (this.options.output.columns || 80) - 1), this.viewHeight);
|
|
214
|
+
this.refresh();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (key.name === 'paste-start') {
|
|
218
|
+
this.paste = true;
|
|
219
|
+
this.pasteCR = false;
|
|
220
|
+
this.dismissed = true;
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
if (key.name === 'paste-end') {
|
|
224
|
+
this.paste = false;
|
|
225
|
+
this.refresh();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (this.paste) {
|
|
229
|
+
if (key.name === 'return') {
|
|
230
|
+
this.insert('\n');
|
|
231
|
+
this.pasteCR = true;
|
|
232
|
+
}
|
|
233
|
+
else if (key.name === 'enter') {
|
|
234
|
+
if (!this.pasteCR)
|
|
235
|
+
this.insert('\n');
|
|
236
|
+
this.pasteCR = false;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
this.pasteCR = false;
|
|
240
|
+
if (text && !key.ctrl && !key.meta)
|
|
241
|
+
this.insert(text);
|
|
242
|
+
}
|
|
243
|
+
this.refresh();
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const suggestions = this.suggestions();
|
|
247
|
+
if (key.ctrl) {
|
|
248
|
+
if (key.name === 'c') {
|
|
249
|
+
this.replace('');
|
|
250
|
+
this.options.cancel();
|
|
251
|
+
}
|
|
252
|
+
else if (key.name === 'd') {
|
|
253
|
+
if (!this.value)
|
|
254
|
+
this.options.exit();
|
|
255
|
+
else
|
|
256
|
+
this.deleteNext();
|
|
257
|
+
}
|
|
258
|
+
else if (key.name === 'a')
|
|
259
|
+
this.cursor = 0;
|
|
260
|
+
else if (key.name === 'e')
|
|
261
|
+
this.cursor = this.value.length;
|
|
262
|
+
else if (key.name === 'u') {
|
|
263
|
+
this.value = this.value.slice(this.cursor);
|
|
264
|
+
this.cursor = 0;
|
|
265
|
+
}
|
|
266
|
+
else if (key.name === 'k')
|
|
267
|
+
this.value = this.value.slice(0, this.cursor);
|
|
268
|
+
else if (key.name === 'w') {
|
|
269
|
+
const left = this.value.slice(0, this.cursor).replace(/\s*\S+\s*$/, '');
|
|
270
|
+
this.value = left + this.value.slice(this.cursor);
|
|
271
|
+
this.cursor = left.length;
|
|
272
|
+
}
|
|
273
|
+
this.refresh();
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
if (key.name === 'escape') {
|
|
277
|
+
this.dismissed = true;
|
|
278
|
+
this.refresh();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if ((key.name === 'up' || key.name === 'down') && suggestions.length) {
|
|
282
|
+
this.selected = (this.selected + (key.name === 'up' ? -1 : 1) + suggestions.length) % suggestions.length;
|
|
283
|
+
}
|
|
284
|
+
else if (key.name === 'tab' || ((key.name === 'return' || key.name === 'enter') && suggestions.length &&
|
|
285
|
+
this.value !== '/' + suggestions[this.selected % suggestions.length][0] && !key.meta && !key.shift)) {
|
|
286
|
+
if (suggestions.length) {
|
|
287
|
+
const name = suggestions[this.selected % suggestions.length][0];
|
|
288
|
+
this.replace('/' + name + (name === 'model' ? '' : ' '));
|
|
289
|
+
this.dismissed = true;
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
const [hits, fragment] = completeChat(this.value, this.options.state().files);
|
|
293
|
+
if (hits.length)
|
|
294
|
+
this.replace(this.value.slice(0, this.value.length - fragment.length) + hits[0]);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else if (key.name === 'return' || key.name === 'enter') {
|
|
298
|
+
if (key.meta || key.shift)
|
|
299
|
+
this.insert('\n');
|
|
300
|
+
else {
|
|
301
|
+
const message = this.value;
|
|
302
|
+
if (message.trim()) {
|
|
303
|
+
this.history = [message, ...this.history.filter(h => h !== message)].slice(0, 200);
|
|
304
|
+
}
|
|
305
|
+
this.replace('');
|
|
306
|
+
this.historyIndex = -1;
|
|
307
|
+
if (this.screen)
|
|
308
|
+
this.screen.append(this.theme.muted('you') + ' › ' + terminalText(message));
|
|
309
|
+
else {
|
|
310
|
+
this.erase();
|
|
311
|
+
this.options.output.write(this.theme.muted('you') + ' › ' + terminalText(message) + '\n');
|
|
312
|
+
}
|
|
313
|
+
this.options.submit(message);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
else if (key.name === 'up' || key.name === 'down') {
|
|
317
|
+
if (this.historyIndex === -1)
|
|
318
|
+
this.draft = this.value;
|
|
319
|
+
this.historyIndex = Math.max(-1, Math.min(this.history.length - 1, this.historyIndex + (key.name === 'up' ? 1 : -1)));
|
|
320
|
+
const index = this.historyIndex;
|
|
321
|
+
this.replace(index < 0 ? this.draft : this.history[index]);
|
|
322
|
+
this.historyIndex = index;
|
|
323
|
+
this.dismissed = true;
|
|
324
|
+
}
|
|
325
|
+
else if (key.name === 'left')
|
|
326
|
+
this.cursor -= graphemes(this.value.slice(0, this.cursor)).at(-1)?.length || 0;
|
|
327
|
+
else if (key.name === 'right')
|
|
328
|
+
this.cursor += graphemes(this.value.slice(this.cursor))[0]?.length || 0;
|
|
329
|
+
else if (key.name === 'home')
|
|
330
|
+
this.cursor = 0;
|
|
331
|
+
else if (key.name === 'end')
|
|
332
|
+
this.cursor = this.value.length;
|
|
333
|
+
else if (key.name === 'backspace') {
|
|
334
|
+
const count = graphemes(this.value.slice(0, this.cursor)).at(-1)?.length || 0;
|
|
335
|
+
this.value = this.value.slice(0, this.cursor - count) + this.value.slice(this.cursor);
|
|
336
|
+
this.cursor -= count;
|
|
337
|
+
this.selected = 0;
|
|
338
|
+
this.dismissed = false;
|
|
339
|
+
}
|
|
340
|
+
else if (key.name === 'delete')
|
|
341
|
+
this.deleteNext();
|
|
342
|
+
else if (text && !key.meta && !/^[\x00-\x1f\x7f]/.test(text))
|
|
343
|
+
this.insert(text);
|
|
344
|
+
this.refresh();
|
|
345
|
+
}
|
|
346
|
+
deleteNext() { const count = graphemes(this.value.slice(this.cursor))[0]?.length || 0; this.value = this.value.slice(0, this.cursor) + this.value.slice(this.cursor + count); }
|
|
347
|
+
render() {
|
|
348
|
+
if (this.suspended)
|
|
349
|
+
return;
|
|
350
|
+
this.erase();
|
|
351
|
+
const columns = Math.max(2, this.options.output.columns || Number(process.env.COLUMNS) || 80), room = columns - 1;
|
|
352
|
+
const state = this.options.state(), prefix = this.picker ? 'filter › ' : state.pasting ? 'paste › ' : state.mode + ' › ';
|
|
353
|
+
const value = this.picker ? this.picker.query : this.value, cursor = this.picker ? value.length : this.cursor;
|
|
354
|
+
const lead = clip(prefix, Math.max(1, room - 1), false);
|
|
355
|
+
const lines = [''];
|
|
356
|
+
let row = 0, col = 0, cursorRow = 0, cursorCol = 0, offset = -lead.length;
|
|
357
|
+
for (const g of graphemes(lead + value)) {
|
|
358
|
+
if (offset === cursor) {
|
|
359
|
+
cursorRow = row;
|
|
360
|
+
cursorCol = col;
|
|
361
|
+
}
|
|
362
|
+
if (g === '\n') {
|
|
363
|
+
lines.push('');
|
|
364
|
+
row++;
|
|
365
|
+
col = 0;
|
|
366
|
+
}
|
|
367
|
+
else {
|
|
368
|
+
const actualSize = clusterCells(g), size = Math.min(room, actualSize);
|
|
369
|
+
if (col + size > room) {
|
|
370
|
+
lines.push('');
|
|
371
|
+
row++;
|
|
372
|
+
col = 0;
|
|
373
|
+
if (offset === cursor) {
|
|
374
|
+
cursorRow = row;
|
|
375
|
+
cursorCol = 0;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
lines[row] += actualSize > room ? '?' : g;
|
|
379
|
+
col += size;
|
|
380
|
+
}
|
|
381
|
+
offset += g.length;
|
|
382
|
+
}
|
|
383
|
+
if (cursor === value.length) {
|
|
384
|
+
cursorRow = row;
|
|
385
|
+
cursorCol = col;
|
|
386
|
+
}
|
|
387
|
+
const maxInput = Math.max(1, Math.min(8, (this.options.output.rows || 24) - (this.screen ? 12 : 7)));
|
|
388
|
+
const start = Math.max(0, cursorRow - maxInput + 1);
|
|
389
|
+
const inputLines = lines.slice(start, start + maxInput);
|
|
390
|
+
cursorRow -= start;
|
|
391
|
+
if (start === 0)
|
|
392
|
+
inputLines[0] = this.theme.accent(lead) + inputLines[0].slice(lead.length);
|
|
393
|
+
if (!value)
|
|
394
|
+
inputLines[0] += this.theme.muted(clip(this.picker ? 'Type to search · arrows to choose' : 'Ask about the repo, or type / for commands…', Math.max(0, room - cells(lead))));
|
|
395
|
+
const rows = [(this.theme.status || this.theme.muted)(clip(state.status, room)), this.theme.accent('─'.repeat(room)), ...inputLines,
|
|
396
|
+
this.theme.accent('─'.repeat(room))];
|
|
397
|
+
cursorRow += 2;
|
|
398
|
+
const suggestions = this.picker ? [] : this.suggestions();
|
|
399
|
+
if (this.picker) {
|
|
400
|
+
const picker = this.picker, choices = this.pickerChoices();
|
|
401
|
+
const count = Math.max(1, Math.min(8, (this.options.output.rows || 24) - rows.length - (this.screen ? 6 : 4)));
|
|
402
|
+
const begin = Math.max(0, picker.index - count + 1);
|
|
403
|
+
const inner = Math.max(0, room - 4);
|
|
404
|
+
const box = (text) => { const shown = clip(text, inner); return room >= 6 ? '│ ' + shown + ' '.repeat(inner - cells(shown)) + ' │' : clip(text, room); };
|
|
405
|
+
const heading = clip(' ' + picker.title + ' ', Math.max(0, room - 4));
|
|
406
|
+
rows.push(this.theme.accent(room >= 6 ? '╭─' + heading + '─'.repeat(room - 3 - cells(heading)) + '╮' : clip(picker.title, room)));
|
|
407
|
+
if (picker.hint)
|
|
408
|
+
rows.push(this.theme.muted(box(picker.hint)));
|
|
409
|
+
if (!choices.length)
|
|
410
|
+
rows.push(this.theme.muted(box('No matches · clear the filter with Ctrl-U')));
|
|
411
|
+
choices.slice(begin, begin + count).forEach((choice, i) => {
|
|
412
|
+
const chosen = begin + i === picker.index;
|
|
413
|
+
const text = `${chosen ? '❯' : ' '} ${choice.label}${choice.detail ? ' · ' + choice.detail : ''}`;
|
|
414
|
+
rows.push((chosen ? this.theme.accent : this.theme.muted)(box(text)));
|
|
415
|
+
});
|
|
416
|
+
const hint = clip(` ↑/↓ select · Enter choose · Esc cancel · ${choices.length ? picker.index + 1 : 0}/${choices.length} `, Math.max(0, room - 4));
|
|
417
|
+
rows.push(this.theme.accent(room >= 6 ? '╰─' + hint + '─'.repeat(room - 3 - cells(hint)) + '╯' : clip(hint, room)));
|
|
418
|
+
}
|
|
419
|
+
else if (suggestions.length) {
|
|
420
|
+
const count = Math.max(1, Math.min(6, (this.options.output.rows || 24) - rows.length - (this.screen ? 4 : 2)));
|
|
421
|
+
const begin = Math.max(0, this.selected - count + 1), visible = suggestions.slice(begin, begin + count);
|
|
422
|
+
visible.forEach(([name, usage, summary], index) => {
|
|
423
|
+
const chosen = begin + index === this.selected;
|
|
424
|
+
const label = `${chosen ? '›' : ' '} /${name}${usage ? ' ' + usage : ''}`;
|
|
425
|
+
const shown = clip(label, Math.min(36, Math.floor(room * 0.5)));
|
|
426
|
+
const detail = room > 45 ? ' ' + clip(summary, room - cells(shown) - 2) : '';
|
|
427
|
+
rows.push((chosen ? this.theme.accent : this.theme.muted)(shown + detail));
|
|
428
|
+
});
|
|
429
|
+
rows.push(this.theme.muted(clip(`↑/↓ select · Tab/Enter insert · Esc close · ${this.selected + 1}/${suggestions.length}`, room)));
|
|
430
|
+
}
|
|
431
|
+
else
|
|
432
|
+
rows.push(this.theme.muted(clip(state.busy ? 'Working · /cancel or Ctrl-C to stop' : state.pasting ? '/send submit · /discard cancel' : this.screen ? 'Type / for commands · PgUp/PgDn scroll · Alt-Enter newline · Ctrl-D exit' : 'Type / for commands · Alt-Enter newline · Ctrl-D exit', room)));
|
|
433
|
+
if (this.screen) {
|
|
434
|
+
const height = Math.max(1, this.options.output.rows || 24);
|
|
435
|
+
if (height < 3) {
|
|
436
|
+
const tiny = [inputLines[Math.max(0, cursorRow - 2)] || inputLines[0], this.theme.muted(clip(state.status, room))].slice(0, height);
|
|
437
|
+
this.viewHeight = 1;
|
|
438
|
+
this.screen.draw(tiny, columns, 0, cursorCol);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
let footer = rows, footerCursorRow = cursorRow;
|
|
442
|
+
// Tiny windows keep the active input visible; menus simplify to one choice.
|
|
443
|
+
if (footer.length > height - 2) {
|
|
444
|
+
const choices = this.picker ? this.pickerChoices() : [];
|
|
445
|
+
const hint = this.picker ? choices[this.picker.index]?.label || 'No matches' : suggestions[this.selected]?.[0] ? '/' + suggestions[this.selected][0] : 'Enter send · Esc cancel';
|
|
446
|
+
footer = [inputLines[Math.max(0, cursorRow - 2)] || inputLines[0], this.theme.muted(clip(hint, room))].slice(0, Math.max(1, height - 2));
|
|
447
|
+
footerCursorRow = 0;
|
|
448
|
+
}
|
|
449
|
+
this.viewHeight = height - footer.length - 1;
|
|
450
|
+
const welcome = this.options.welcome?.(columns, this.viewHeight) || '';
|
|
451
|
+
const content = this.screen.view(room, this.viewHeight, welcome);
|
|
452
|
+
const header = (this.options.header?.() || 'ONBOARDER') + (this.screen.scrolled ? ' · history · PgDn to return' : '');
|
|
453
|
+
const frame = [wrapScreenLine(header, room)[0], ...content,
|
|
454
|
+
...Array(Math.max(0, this.viewHeight - content.length)).fill(''), ...footer];
|
|
455
|
+
this.screen.draw(frame, columns, height - footer.length + footerCursorRow, cursorCol);
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
this.options.output.write(rows.join('\n'));
|
|
459
|
+
const up = rows.length - 1 - cursorRow;
|
|
460
|
+
if (up)
|
|
461
|
+
readline.moveCursor(this.options.output, 0, -up);
|
|
462
|
+
readline.cursorTo(this.options.output, cursorCol);
|
|
463
|
+
this.drawnRows = rows.length;
|
|
464
|
+
this.cursorRow = cursorRow;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
//# sourceMappingURL=composer.js.map
|