codebase-onboarder 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +196 -47
- package/bin/build-if-source.js +23 -0
- package/cli/commands.d.ts +26 -0
- package/cli/commands.js +836 -811
- package/cli/commands.js.map +1 -0
- package/cli/explorer/advanced.d.ts +14 -0
- package/cli/explorer/advanced.js +449 -0
- package/cli/explorer/advanced.js.map +1 -0
- package/cli/explorer/app.d.ts +1 -0
- package/cli/explorer/app.js +396 -229
- package/cli/explorer/app.js.map +1 -0
- package/cli/explorer/assistant.d.ts +9 -0
- package/cli/explorer/assistant.js +58 -0
- package/cli/explorer/assistant.js.map +1 -0
- package/cli/explorer/commands.d.ts +17 -0
- package/cli/explorer/commands.js +400 -162
- package/cli/explorer/commands.js.map +1 -0
- package/cli/explorer/featureViews.d.ts +124 -0
- package/cli/explorer/featureViews.js +179 -0
- package/cli/explorer/featureViews.js.map +1 -0
- package/cli/explorer/github.d.ts +21 -0
- package/cli/explorer/github.js +73 -0
- package/cli/explorer/github.js.map +1 -0
- package/cli/explorer/graphs.d.ts +7 -0
- package/cli/explorer/graphs.js +173 -0
- package/cli/explorer/graphs.js.map +1 -0
- package/cli/explorer/picker.d.ts +22 -0
- package/cli/explorer/picker.js +150 -0
- package/cli/explorer/picker.js.map +1 -0
- package/cli/explorer/report.d.ts +85 -0
- package/cli/explorer/report.js +60 -0
- package/cli/explorer/report.js.map +1 -0
- package/cli/explorer/session.d.ts +449 -0
- package/cli/explorer/session.js +184 -95
- package/cli/explorer/session.js.map +1 -0
- package/cli/explorer/views.d.ts +19 -0
- package/cli/explorer/views.js +496 -412
- package/cli/explorer/views.js.map +1 -0
- package/cli/explorer/wrap.d.ts +1 -0
- package/cli/explorer/wrap.js +33 -0
- package/cli/explorer/wrap.js.map +1 -0
- package/cli/main.d.ts +1 -0
- package/cli/main.js +235 -138
- package/cli/main.js.map +1 -0
- package/cli/prompt.d.ts +5 -0
- package/cli/prompt.js +84 -80
- package/cli/prompt.js.map +1 -0
- package/cli/scanOptions.d.ts +2 -0
- package/cli/scanOptions.js +11 -0
- package/cli/scanOptions.js.map +1 -0
- package/cli/ui.d.ts +33 -0
- package/cli/ui.js +55 -35
- package/cli/ui.js.map +1 -0
- package/cli/wizard.d.ts +187 -0
- package/cli/wizard.js +304 -284
- package/cli/wizard.js.map +1 -0
- package/package.json +15 -4
- package/public/app.d.ts +1 -0
- package/public/app.js +1057 -1009
- package/public/app.js.map +1 -0
- package/public/browser.d.ts +68 -0
- package/public/browser.js +2 -0
- package/public/browser.js.map +1 -0
- package/public/index.html +30 -13
- package/public/js/about.d.ts +6 -0
- package/public/js/about.js +165 -172
- package/public/js/about.js.map +1 -0
- package/public/js/aiDraft.d.ts +3 -0
- package/public/js/aiDraft.js +116 -124
- package/public/js/aiDraft.js.map +1 -0
- package/public/js/analysisPanel.d.ts +7 -0
- package/public/js/analysisPanel.js +166 -166
- package/public/js/analysisPanel.js.map +1 -0
- package/public/js/analysisReport.d.ts +38 -0
- package/public/js/analysisReport.js +105 -110
- package/public/js/analysisReport.js.map +1 -0
- package/public/js/api.d.ts +26 -0
- package/public/js/api.js +176 -167
- package/public/js/api.js.map +1 -0
- package/public/js/atlas.d.ts +6 -0
- package/public/js/atlas.js +50 -58
- package/public/js/atlas.js.map +1 -0
- package/public/js/blameView.d.ts +2 -0
- package/public/js/blameView.js +36 -37
- package/public/js/blameView.js.map +1 -0
- package/public/js/codeTab.d.ts +3 -0
- package/public/js/codeTab.js +175 -180
- package/public/js/codeTab.js.map +1 -0
- package/public/js/codeViewer.d.ts +5 -0
- package/public/js/codeViewer.js +162 -150
- package/public/js/codeViewer.js.map +1 -0
- package/public/js/components/FileChip.d.ts +9 -0
- package/public/js/components/FileChip.js +45 -49
- package/public/js/components/FileChip.js.map +1 -0
- package/public/js/components/MetricSparkline.d.ts +7 -0
- package/public/js/components/MetricSparkline.js +35 -44
- package/public/js/components/MetricSparkline.js.map +1 -0
- package/public/js/components/RiskBadge.d.ts +9 -0
- package/public/js/components/RiskBadge.js +55 -63
- package/public/js/components/RiskBadge.js.map +1 -0
- package/public/js/deepAnalysisView.d.ts +99 -0
- package/public/js/deepAnalysisView.js +282 -302
- package/public/js/deepAnalysisView.js.map +1 -0
- package/public/js/diagramPane.d.ts +8 -0
- package/public/js/diagramPane.js +133 -135
- package/public/js/diagramPane.js.map +1 -0
- package/public/js/diffView.d.ts +6 -0
- package/public/js/diffView.js +222 -209
- package/public/js/diffView.js.map +1 -0
- package/public/js/docsView.d.ts +2 -0
- package/public/js/docsView.js +441 -442
- package/public/js/docsView.js.map +1 -0
- package/public/js/dom.d.ts +189 -0
- package/public/js/dom.js +5 -0
- package/public/js/dom.js.map +1 -0
- package/public/js/fileSourceBrowser.d.ts +5 -0
- package/public/js/fileSourceBrowser.js +33 -41
- package/public/js/fileSourceBrowser.js.map +1 -0
- package/public/js/flameGraph.d.ts +5 -0
- package/public/js/flameGraph.js +62 -72
- package/public/js/flameGraph.js.map +1 -0
- package/public/js/forceGraph.d.ts +10 -0
- package/public/js/forceGraph.js +581 -556
- package/public/js/forceGraph.js.map +1 -0
- package/public/js/heatmap.d.ts +4 -0
- package/public/js/heatmap.js +142 -164
- package/public/js/heatmap.js.map +1 -0
- package/public/js/highlight.d.ts +2 -0
- package/public/js/highlight.js +116 -107
- package/public/js/highlight.js.map +1 -0
- package/public/js/html.d.ts +2 -0
- package/public/js/html.js +14 -44
- package/public/js/html.js.map +1 -0
- package/public/js/insightsView.d.ts +5 -0
- package/public/js/insightsView.js +93 -111
- package/public/js/insightsView.js.map +1 -0
- package/public/js/inspector.d.ts +37 -0
- package/public/js/inspector.js +416 -445
- package/public/js/inspector.js.map +1 -0
- package/public/js/llm.d.ts +113 -0
- package/public/js/llm.js +233 -272
- package/public/js/llm.js.map +1 -0
- package/public/js/mapView.d.ts +3 -0
- package/public/js/mapView.js +121 -120
- package/public/js/mapView.js.map +1 -0
- package/public/js/markdown.d.ts +3 -0
- package/public/js/markdown.js +84 -91
- package/public/js/markdown.js.map +1 -0
- package/public/js/mindmap.d.ts +32 -0
- package/public/js/mindmap.js +244 -259
- package/public/js/mindmap.js.map +1 -0
- package/public/js/mobilePanels.d.ts +5 -0
- package/public/js/mobilePanels.js +50 -0
- package/public/js/mobilePanels.js.map +1 -0
- package/public/js/repoFiles.d.ts +12 -0
- package/public/js/repoFiles.js +28 -27
- package/public/js/repoFiles.js.map +1 -0
- package/public/js/reviewView.d.ts +28 -0
- package/public/js/reviewView.js +256 -0
- package/public/js/reviewView.js.map +1 -0
- package/public/js/sbomView.d.ts +3 -0
- package/public/js/sbomView.js +59 -67
- package/public/js/sbomView.js.map +1 -0
- package/public/js/scanCache.d.ts +16 -0
- package/public/js/scanCache.js +67 -65
- package/public/js/scanCache.js.map +1 -0
- package/public/js/search.d.ts +7 -0
- package/public/js/search.js +868 -800
- package/public/js/search.js.map +1 -0
- package/public/js/searchLocal.d.ts +42 -0
- package/public/js/searchLocal.js +87 -0
- package/public/js/searchLocal.js.map +1 -0
- package/public/js/serverSettings.d.ts +5 -0
- package/public/js/serverSettings.js +153 -164
- package/public/js/serverSettings.js.map +1 -0
- package/public/js/state.d.ts +798 -0
- package/public/js/state.js +114 -122
- package/public/js/state.js.map +1 -0
- package/public/js/tour.d.ts +6 -0
- package/public/js/tour.js +5 -7
- package/public/js/tour.js.map +1 -0
- package/public/js/transitions.d.ts +2 -0
- package/public/js/transitions.js +9 -10
- package/public/js/transitions.js.map +1 -0
- package/public/js/tree.d.ts +12 -0
- package/public/js/tree.js +157 -154
- package/public/js/tree.js.map +1 -0
- package/public/js/workflowsView.d.ts +3 -0
- package/public/js/workflowsView.js +15 -22
- package/public/js/workflowsView.js.map +1 -0
- package/public/search.css +495 -0
- package/public/styles.css +163 -346
- package/public/workbench.css +166 -0
- package/server/apiAuth.d.ts +3 -0
- package/server/apiAuth.js +18 -20
- package/server/apiAuth.js.map +1 -0
- package/server/apiDiff.d.ts +2 -0
- package/server/apiDiff.js +20 -18
- package/server/apiDiff.js.map +1 -0
- package/server/apiDocs.d.ts +2 -0
- package/server/apiDocs.js +38 -40
- package/server/apiDocs.js.map +1 -0
- package/server/apiFile.d.ts +1 -0
- package/server/apiFile.js +14 -17
- package/server/apiFile.js.map +1 -0
- package/server/apiGitBlame.d.ts +2 -0
- package/server/apiGitBlame.js +50 -51
- package/server/apiGitBlame.js.map +1 -0
- package/server/apiMcp.d.ts +4 -0
- package/server/apiMcp.js +64 -66
- package/server/apiMcp.js.map +1 -0
- package/server/apiReview.d.ts +2 -0
- package/server/apiReview.js +45 -0
- package/server/apiReview.js.map +1 -0
- package/server/apiScan.d.ts +5 -0
- package/server/apiScan.js +90 -71
- package/server/apiScan.js.map +1 -0
- package/server/apiSearch.d.ts +33 -0
- package/server/apiSearch.js +184 -200
- package/server/apiSearch.js.map +1 -0
- package/server/apiSettings.d.ts +4 -0
- package/server/apiSettings.js +84 -85
- package/server/apiSettings.js.map +1 -0
- package/server/apiTools.d.ts +3 -0
- package/server/apiTools.js +55 -56
- package/server/apiTools.js.map +1 -0
- package/server/auth.d.ts +5 -0
- package/server/auth.js +54 -51
- package/server/auth.js.map +1 -0
- package/server/config.d.ts +42 -0
- package/server/config.js +189 -194
- package/server/config.js.map +1 -0
- package/server/daemon.d.ts +12 -0
- package/server/daemon.js +124 -114
- package/server/daemon.js.map +1 -0
- package/server/fileSourceNode.d.ts +2 -0
- package/server/fileSourceNode.js +34 -36
- package/server/fileSourceNode.js.map +1 -0
- package/server/gitClone.d.ts +9 -0
- package/server/gitClone.js +59 -61
- package/server/gitClone.js.map +1 -0
- package/server/gitDiff.d.ts +36 -0
- package/server/gitDiff.js +271 -169
- package/server/gitDiff.js.map +1 -0
- package/server/gitHistory.d.ts +12 -0
- package/server/gitHistory.js +80 -80
- package/server/gitHistory.js.map +1 -0
- package/server/gitRemote.d.ts +12 -0
- package/server/gitRemote.js +60 -0
- package/server/gitRemote.js.map +1 -0
- package/server/htmlText.d.ts +4 -0
- package/server/htmlText.js +16 -23
- package/server/htmlText.js.map +1 -0
- package/server/http.d.ts +5 -0
- package/server/http.js +27 -30
- package/server/http.js.map +1 -0
- package/server/httpGuards.d.ts +2 -0
- package/server/httpGuards.js +47 -43
- package/server/httpGuards.js.map +1 -0
- package/server/https.d.ts +34 -0
- package/server/https.js +121 -111
- package/server/https.js.map +1 -0
- package/server/index.d.ts +40 -0
- package/server/index.js +139 -147
- package/server/index.js.map +1 -0
- package/server/layout.d.ts +26 -0
- package/server/layout.js +59 -37
- package/server/layout.js.map +1 -0
- package/server/llmProxy.d.ts +3 -0
- package/server/llmProxy.js +137 -135
- package/server/llmProxy.js.map +1 -0
- package/server/logger.d.ts +38 -0
- package/server/logger.js +198 -211
- package/server/logger.js.map +1 -0
- package/server/mcp/analysis.d.ts +29 -0
- package/server/mcp/analysis.js +99 -120
- package/server/mcp/analysis.js.map +1 -0
- package/server/mcp/http.d.ts +9 -0
- package/server/mcp/http.js +128 -137
- package/server/mcp/http.js.map +1 -0
- package/server/mcp/runner.d.ts +68 -0
- package/server/mcp/runner.js +208 -218
- package/server/mcp/runner.js.map +1 -0
- package/server/mcp/server.d.ts +29 -0
- package/server/mcp/server.js +166 -179
- package/server/mcp/server.js.map +1 -0
- package/server/mcp/standalone.d.ts +1 -0
- package/server/mcp/standalone.js +8 -10
- package/server/mcp/standalone.js.map +1 -0
- package/server/mcp/tools.d.ts +2020 -0
- package/server/mcp/tools.js +523 -574
- package/server/mcp/tools.js.map +1 -0
- package/server/paths.d.ts +3 -0
- package/server/paths.js +17 -15
- package/server/paths.js.map +1 -0
- package/server/pidfile.d.ts +9 -0
- package/server/pidfile.js +43 -45
- package/server/pidfile.js.map +1 -0
- package/server/review.d.ts +5 -0
- package/server/review.js +35 -0
- package/server/review.js.map +1 -0
- package/server/router.d.ts +33 -0
- package/server/router.js +191 -197
- package/server/router.js.map +1 -0
- package/server/scanRequest.d.ts +3 -0
- package/server/scanRequest.js +36 -0
- package/server/scanRequest.js.map +1 -0
- package/server/searchIndex.d.ts +17 -0
- package/server/searchIndex.js +83 -80
- package/server/searchIndex.js.map +1 -0
- package/server/sessions.d.ts +14 -0
- package/server/sessions.js +62 -70
- package/server/sessions.js.map +1 -0
- package/server/startup.d.ts +118 -0
- package/server/startup.js +143 -148
- package/server/startup.js.map +1 -0
- package/server/static.d.ts +6 -0
- package/server/static.js +28 -31
- package/server/static.js.map +1 -0
- package/server/tools/install.d.ts +4 -0
- package/server/tools/install.js +176 -185
- package/server/tools/install.js.map +1 -0
- package/server/tools/parse.d.ts +8 -0
- package/server/tools/parse.js +112 -114
- package/server/tools/parse.js.map +1 -0
- package/server/tools/platform.d.ts +9 -0
- package/server/tools/platform.js +49 -47
- package/server/tools/platform.js.map +1 -0
- package/server/tools/registry.d.ts +137 -0
- package/server/tools/registry.js +173 -172
- package/server/tools/registry.js.map +1 -0
- package/server/tools/scan.d.ts +34 -0
- package/server/tools/scan.js +89 -98
- package/server/tools/scan.js.map +1 -0
- package/server/tools.d.ts +34 -0
- package/server/tools.js +94 -107
- package/server/tools.js.map +1 -0
- package/server/tunnel.d.ts +29 -0
- package/server/tunnel.js +61 -66
- package/server/tunnel.js.map +1 -0
- package/shared/analyzer/docs.d.ts +16 -0
- package/shared/analyzer/docs.js +99 -93
- package/shared/analyzer/docs.js.map +1 -0
- package/shared/analyzer/explainLocal.d.ts +4 -0
- package/shared/analyzer/explainLocal.js +122 -142
- package/shared/analyzer/explainLocal.js.map +1 -0
- package/shared/analyzer/github.d.ts +37 -0
- package/shared/analyzer/github.js +79 -0
- package/shared/analyzer/github.js.map +1 -0
- package/shared/analyzer/graph.d.ts +41 -0
- package/shared/analyzer/graph.js +393 -400
- package/shared/analyzer/graph.js.map +1 -0
- package/shared/analyzer/health.d.ts +33 -0
- package/shared/analyzer/health.js +197 -193
- package/shared/analyzer/health.js.map +1 -0
- package/shared/analyzer/history.d.ts +29 -0
- package/shared/analyzer/history.js +110 -111
- package/shared/analyzer/history.js.map +1 -0
- package/shared/analyzer/jsonConfig.d.ts +2 -0
- package/shared/analyzer/jsonConfig.js +61 -0
- package/shared/analyzer/jsonConfig.js.map +1 -0
- package/shared/analyzer/languages/csharp.d.ts +26 -0
- package/shared/analyzer/languages/csharp.js +83 -88
- package/shared/analyzer/languages/csharp.js.map +1 -0
- package/shared/analyzer/languages/generic.d.ts +23 -0
- package/shared/analyzer/languages/generic.js +94 -105
- package/shared/analyzer/languages/generic.js.map +1 -0
- package/shared/analyzer/languages/go.d.ts +24 -0
- package/shared/analyzer/languages/go.js +45 -54
- package/shared/analyzer/languages/go.js.map +1 -0
- package/shared/analyzer/languages/index.d.ts +6 -0
- package/shared/analyzer/languages/index.js +19 -20
- package/shared/analyzer/languages/index.js.map +1 -0
- package/shared/analyzer/languages/java.d.ts +20 -0
- package/shared/analyzer/languages/java.js +73 -78
- package/shared/analyzer/languages/java.js.map +1 -0
- package/shared/analyzer/languages/javascript.d.ts +12 -0
- package/shared/analyzer/languages/javascript.js +258 -209
- package/shared/analyzer/languages/javascript.js.map +1 -0
- package/shared/analyzer/languages/python.d.ts +23 -0
- package/shared/analyzer/languages/python.js +92 -100
- package/shared/analyzer/languages/python.js.map +1 -0
- package/shared/analyzer/languages/rust.d.ts +17 -0
- package/shared/analyzer/languages/rust.js +96 -98
- package/shared/analyzer/languages/rust.js.map +1 -0
- package/shared/analyzer/languages/typescript.d.ts +11 -0
- package/shared/analyzer/languages/typescript.js +117 -116
- package/shared/analyzer/languages/typescript.js.map +1 -0
- package/shared/analyzer/licenses.d.ts +18 -0
- package/shared/analyzer/licenses.js +130 -133
- package/shared/analyzer/licenses.js.map +1 -0
- package/shared/analyzer/metrics.d.ts +20 -0
- package/shared/analyzer/metrics.js +112 -104
- package/shared/analyzer/metrics.js.map +1 -0
- package/shared/analyzer/pathUtil.d.ts +10 -0
- package/shared/analyzer/pathUtil.js +29 -35
- package/shared/analyzer/pathUtil.js.map +1 -0
- package/shared/analyzer/patterns.d.ts +11 -0
- package/shared/analyzer/patterns.js +231 -253
- package/shared/analyzer/patterns.js.map +1 -0
- package/shared/analyzer/scan.d.ts +62 -0
- package/shared/analyzer/scan.js +451 -442
- package/shared/analyzer/scan.js.map +1 -0
- package/shared/analyzer/scanControl.d.ts +11 -0
- package/shared/analyzer/scanControl.js +62 -0
- package/shared/analyzer/scanControl.js.map +1 -0
- package/shared/analyzer/security.d.ts +18 -0
- package/shared/analyzer/security.js +159 -159
- package/shared/analyzer/security.js.map +1 -0
- package/shared/analyzer/services.d.ts +5 -0
- package/shared/analyzer/services.js +141 -138
- package/shared/analyzer/services.js.map +1 -0
- package/shared/analyzer/stack.d.ts +6 -0
- package/shared/analyzer/stack.js +134 -141
- package/shared/analyzer/stack.js.map +1 -0
- package/shared/analyzer/tour.d.ts +2 -0
- package/shared/analyzer/tour.js +45 -53
- package/shared/analyzer/tour.js.map +1 -0
- package/shared/analyzer/util.d.ts +8 -0
- package/shared/analyzer/util.js +130 -76
- package/shared/analyzer/util.js.map +1 -0
- package/shared/analyzer/workflows.d.ts +8 -0
- package/shared/analyzer/workflows.js +139 -134
- package/shared/analyzer/workflows.js.map +1 -0
- package/shared/contracts.d.ts +250 -0
- package/shared/contracts.js +2 -0
- package/shared/contracts.js.map +1 -0
- package/shared/diagram/aiFacts.d.ts +35 -0
- package/shared/diagram/aiFacts.js +102 -105
- package/shared/diagram/aiFacts.js.map +1 -0
- package/shared/diagram/aiMermaid.d.ts +5 -0
- package/shared/diagram/aiMermaid.js +46 -45
- package/shared/diagram/aiMermaid.js.map +1 -0
- package/shared/diagram/atlas.d.ts +16 -0
- package/shared/diagram/atlas.js +51 -60
- package/shared/diagram/atlas.js.map +1 -0
- package/shared/diagram/mermaid.d.ts +43 -0
- package/shared/diagram/mermaid.js +348 -370
- package/shared/diagram/mermaid.js.map +1 -0
- package/shared/review/contracts.d.ts +95 -0
- package/shared/review/contracts.js +2 -0
- package/shared/review/contracts.js.map +1 -0
- package/shared/review/review.d.ts +10 -0
- package/shared/review/review.js +184 -0
- package/shared/review/review.js.map +1 -0
- package/shared/search/query.d.ts +32 -0
- package/shared/search/query.js +395 -388
- package/shared/search/query.js.map +1 -0
package/server/logger.js
CHANGED
|
@@ -9,26 +9,20 @@
|
|
|
9
9
|
// A `time` field (local HH:MM:SS.mmm) rides along with the ISO `ts` on purpose:
|
|
10
10
|
// tailing a file gives you the string, not a Date, and a reader wants their own
|
|
11
11
|
// clock, not UTC.
|
|
12
|
-
|
|
13
12
|
const levels = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
14
|
-
|
|
15
13
|
// Worst first — the order any summary or sort should use.
|
|
16
14
|
export const SEVERITY = { error: 0, warn: 1, info: 2, debug: 3 };
|
|
17
|
-
|
|
18
15
|
const CODES = { red: 31, green: 32, yellow: 33, cyan: 36, gray: 90 };
|
|
19
16
|
const LEVEL_COLOR = { debug: 'gray', info: 'cyan', warn: 'yellow', error: 'red' };
|
|
20
|
-
|
|
21
17
|
// The server sits *under* the CLI, so it cannot import `cli/ui.js` without
|
|
22
18
|
// inverting the dependency. These three lines of ANSI are the whole price.
|
|
23
19
|
function paint(text, color, enabled) {
|
|
24
|
-
|
|
20
|
+
return enabled && color ? `\x1b[${CODES[color]}m${text}\x1b[0m` : String(text);
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
// Fields that are part of the envelope or already rendered into the message.
|
|
28
23
|
// `summary` is here so the suppressed-noise footer does not print itself as
|
|
29
24
|
// `summary=true` — it is a rendering flag, not data.
|
|
30
25
|
const ENVELOPE = new Set(['ts', 'time', 'level', 'msg', 'method', 'path', 'status', 'ms', 'line', 'scope', 'summary']);
|
|
31
|
-
|
|
32
26
|
// Request classification — the difference between a person doing something and
|
|
33
27
|
// a browser fetching a file.
|
|
34
28
|
//
|
|
@@ -43,69 +37,72 @@ const ENVELOPE = new Set(['ts', 'time', 'level', 'msg', 'method', 'path', 'statu
|
|
|
43
37
|
// because "nothing happened" and "90 files were served" are different facts and
|
|
44
38
|
// only one of them is interesting most of the time.
|
|
45
39
|
export function classifyPath(pathname = '') {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
40
|
+
const path = String(pathname).split('?')[0];
|
|
41
|
+
if (path === '/api/health')
|
|
42
|
+
return 'poll'; // uptime checks
|
|
43
|
+
if (path.startsWith('/api/'))
|
|
44
|
+
return 'action';
|
|
45
|
+
return 'noise';
|
|
50
46
|
}
|
|
51
|
-
|
|
52
47
|
export function classifyRequest(req = {}) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
const kind = classifyPath(req.path);
|
|
49
|
+
// A failure is always an action, whatever it was: a 404 on a missing asset is
|
|
50
|
+
// a broken build, and a 500 is a bug. Neither is noise to be summarized away.
|
|
51
|
+
if (Number(req.status) >= 400)
|
|
52
|
+
return 'action';
|
|
53
|
+
if (req.method && req.method !== 'GET' && req.method !== 'HEAD')
|
|
54
|
+
return 'action';
|
|
55
|
+
return kind;
|
|
59
56
|
}
|
|
60
|
-
|
|
61
57
|
// One line, no styling: what a log file holds and what a test asserts on.
|
|
62
58
|
export function formatMessage(entry) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
59
|
+
if (entry.line)
|
|
60
|
+
return `${entry.msg ?? ''} ${entry.line}`.trim();
|
|
61
|
+
if (entry.method) {
|
|
62
|
+
const status = entry.status === undefined ? '' : ` ${entry.status}`;
|
|
63
|
+
const took = entry.ms === undefined ? '' : ` (${entry.ms}ms)`;
|
|
64
|
+
return `${entry.method} ${entry.path}${status}${took}`;
|
|
65
|
+
}
|
|
66
|
+
const extra = Object.entries(entry)
|
|
67
|
+
.filter(([key, value]) => !ENVELOPE.has(key) && value !== undefined && value !== null)
|
|
68
|
+
.map(([key, value]) => `${key}=${typeof value === 'string' ? value : JSON.stringify(value)}`);
|
|
69
|
+
return [entry.msg ?? '', ...extra].filter(Boolean).join(' ');
|
|
73
70
|
}
|
|
74
|
-
|
|
75
71
|
// Every log line is `time LEVEL message`, with the level in a fixed 5-wide
|
|
76
72
|
// column so the messages of an `INFO` and a `ERROR` line start at the same
|
|
77
73
|
// offset. That alignment is the entire point: a wall of request logs is only
|
|
78
74
|
// scannable if the eye can find the message column without reading.
|
|
79
75
|
const LEVEL_WIDTH = 5;
|
|
80
76
|
const GUTTER = ' ';
|
|
81
|
-
|
|
82
77
|
// The part of a path that identifies it: the filename with its extension. When
|
|
83
78
|
// a line has to be cut, this is what must survive — `…typescript.js` is useful,
|
|
84
79
|
// `…script` is not. A path with no filename (`/` or `/a/`) falls back to its tail.
|
|
85
80
|
export function identifyingTail(text) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
const value = String(text);
|
|
82
|
+
const name = value.slice(value.lastIndexOf('/') + 1);
|
|
83
|
+
return name.length >= 4 ? name : value.slice(-8);
|
|
89
84
|
}
|
|
90
|
-
|
|
91
85
|
// How the message area adapts to the terminal. Wide terminals get the whole
|
|
92
86
|
// path; narrow ones get the part that identifies it, elided in the middle — the
|
|
93
87
|
// tail of a path is the informative half, so it survives and the boring prefix
|
|
94
88
|
// is what gets dropped.
|
|
95
89
|
export function fitPath(text, max) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
90
|
+
const value = String(text);
|
|
91
|
+
if (max <= 0)
|
|
92
|
+
return '';
|
|
93
|
+
if (value.length <= max)
|
|
94
|
+
return value;
|
|
95
|
+
if (max === 1)
|
|
96
|
+
return '…';
|
|
97
|
+
// An ellipsis stands in for the dropped prefix, so do not also add a leading
|
|
98
|
+
// slash: `/…/file.js` reads as a path, `//file.js` reads as a typo. The kept
|
|
99
|
+
// tail is the filename, so a long path loses its directories rather than
|
|
100
|
+
// losing its extension — `…typescript.js` is useful, `…typescript` is not.
|
|
101
|
+
const tail = identifyingTail(value);
|
|
102
|
+
if (tail.length + 1 <= max)
|
|
103
|
+
return '…' + tail;
|
|
104
|
+
return '…' + value.slice(-(max - 1));
|
|
107
105
|
}
|
|
108
|
-
|
|
109
106
|
// How much room the message gets, and whether the level column is affordable.
|
|
110
107
|
//
|
|
111
108
|
// The fixed prefix is the time, two gutters, and the level column. On a narrow
|
|
@@ -121,27 +118,23 @@ export function fitPath(text, max) {
|
|
|
121
118
|
export const LEVEL_MIN_COLUMNS = 52;
|
|
122
119
|
export const SHORT_TIME_COLUMNS = 24;
|
|
123
120
|
export const NO_TIME_COLUMNS = 12;
|
|
124
|
-
|
|
125
121
|
export function showLevel(columns) {
|
|
126
|
-
|
|
122
|
+
return (columns || 80) >= LEVEL_MIN_COLUMNS;
|
|
127
123
|
}
|
|
128
|
-
|
|
129
124
|
export function showFullTime(columns) {
|
|
130
|
-
|
|
125
|
+
return (columns || 80) >= SHORT_TIME_COLUMNS;
|
|
131
126
|
}
|
|
132
|
-
|
|
133
127
|
export function showTime(columns) {
|
|
134
|
-
|
|
128
|
+
return (columns || 80) >= NO_TIME_COLUMNS;
|
|
135
129
|
}
|
|
136
|
-
|
|
137
130
|
// The time as it will actually be printed, so callers do not re-derive the same
|
|
138
131
|
// decision and get it subtly wrong.
|
|
139
132
|
export function timeColumn(entry, columns) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
133
|
+
if (!showTime(columns))
|
|
134
|
+
return '';
|
|
135
|
+
const raw = String(entry.time || String(entry.ts || '').slice(11, 19));
|
|
136
|
+
return showFullTime(columns) ? raw : raw.slice(0, 5);
|
|
143
137
|
}
|
|
144
|
-
|
|
145
138
|
// Everything before the message: time + gutter + optional level + gutter.
|
|
146
139
|
//
|
|
147
140
|
// Deliberately computed from the *width* alone, not from an entry: an earlier
|
|
@@ -150,26 +143,24 @@ export function timeColumn(entry, columns) {
|
|
|
150
143
|
// long and overflowed. The prefix is a property of the terminal, not of the log
|
|
151
144
|
// line, so it is computed from the terminal.
|
|
152
145
|
export function prefixWidth(columns) {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
146
|
+
if (!showTime(columns))
|
|
147
|
+
return 0;
|
|
148
|
+
const time = showFullTime(columns) ? 12 : 5;
|
|
149
|
+
return time + GUTTER.length + (showLevel(columns) ? LEVEL_WIDTH + GUTTER.length : 0);
|
|
156
150
|
}
|
|
157
|
-
|
|
158
151
|
export function messageWidth(columns) {
|
|
159
|
-
|
|
160
|
-
|
|
152
|
+
const total = columns || 80;
|
|
153
|
+
return Math.max(0, total - prefixWidth(total));
|
|
161
154
|
}
|
|
162
|
-
|
|
163
155
|
export function formatEntry(entry, { columns } = {}) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
156
|
+
const time = timeColumn(entry, columns);
|
|
157
|
+
const level = showLevel(columns) ? entryLevel(entry) + GUTTER : '';
|
|
158
|
+
const head = time ? time + GUTTER + level : '';
|
|
159
|
+
// The message was already fitted to `messageWidth` and the head is exactly
|
|
160
|
+
// `prefixWidth`, so the line is exactly the terminal width by construction —
|
|
161
|
+
// no trailing clamp, and therefore no risk of cutting a word in half.
|
|
162
|
+
return head + fitMessage(entry, columns);
|
|
171
163
|
}
|
|
172
|
-
|
|
173
164
|
// One line, fitted to the terminal.
|
|
174
165
|
//
|
|
175
166
|
// What gets sacrificed as space runs out, in order: the timing, then the HTTP
|
|
@@ -178,166 +169,162 @@ export function formatEntry(entry, { columns } = {}) {
|
|
|
178
169
|
// request. A 40-column terminal gets `…zer/languages/typescript.js` (the
|
|
179
170
|
// extension intact); an 80-column one gets the whole sentence.
|
|
180
171
|
function fitMessage(entry, columns) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
172
|
+
const text = formatMessage(entry);
|
|
173
|
+
const room = messageWidth(columns);
|
|
174
|
+
if (text.length <= room)
|
|
175
|
+
return text;
|
|
176
|
+
if (!entry.method || !entry.path)
|
|
177
|
+
return fitPath(text, room);
|
|
178
|
+
const status = entry.status === undefined ? '' : ` ${entry.status}`;
|
|
179
|
+
const method = `${entry.method} `;
|
|
180
|
+
// Drop the status before the method, and the method before any of the path.
|
|
181
|
+
const withStatus = method + fitPath(entry.path, room - method.length - status.length) + status;
|
|
182
|
+
if (withStatus.length <= room)
|
|
183
|
+
return withStatus;
|
|
184
|
+
const withoutStatus = method + fitPath(entry.path, room - method.length);
|
|
185
|
+
if (withoutStatus.length <= room)
|
|
186
|
+
return withoutStatus;
|
|
187
|
+
// Last resort: the path alone, at exactly the room available. `fitPath` is
|
|
188
|
+
// given the exact width, so this is always exactly `room` — never over, which
|
|
189
|
+
// is what would make the caller's clamp cut the *front* of the line and leave
|
|
190
|
+
// an unreadable tail like `pt.js 200`.
|
|
191
|
+
return fitPath(entry.path, room);
|
|
198
192
|
}
|
|
199
|
-
|
|
200
193
|
// A summary of suppressed noise renders as a footnote, not an event: dim, and
|
|
201
194
|
// with no level column, so the eye skips it while scanning for real lines. It
|
|
202
195
|
// occupies the same time gutter so it still lines up in the scrollback.
|
|
203
196
|
export function renderEntry(entry, { color = false, columns } = {}) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
197
|
+
const message = fitMessage(entry, columns);
|
|
198
|
+
const limit = Math.max(8, columns || 80);
|
|
199
|
+
if (entry.summary) {
|
|
200
|
+
const pad = showLevel(columns) ? ' '.repeat(LEVEL_WIDTH) + GUTTER : '';
|
|
201
|
+
return paint(timeColumn(entry, columns), 'gray', color)
|
|
202
|
+
+ GUTTER + paint(GUTTER + pad + message, 'gray', color);
|
|
203
|
+
}
|
|
204
|
+
const painted = paint(timeColumn(entry, columns), 'gray', color) + GUTTER
|
|
205
|
+
+ (showLevel(columns) ? paint(entryLevel(entry), LEVEL_COLOR[entry.level] || 'gray', color) + GUTTER : '')
|
|
206
|
+
+ message;
|
|
207
|
+
// Clamp on *visible* width: the ANSI codes cost nothing on screen, so slicing
|
|
208
|
+
// the painted string by character count would cut a real character and leave
|
|
209
|
+
// the escape sequence unterminated.
|
|
210
|
+
return visibleWidth(painted) <= limit ? painted : trimVisible(painted, limit);
|
|
218
211
|
}
|
|
219
|
-
|
|
220
212
|
// Visible width, ANSI excluded.
|
|
221
213
|
function visibleWidth(text) {
|
|
222
|
-
|
|
214
|
+
return String(text).replace(/\x1b\[[0-9;]*m/g, '').length;
|
|
223
215
|
}
|
|
224
|
-
|
|
225
216
|
// Cut a painted string to `max` visible columns, passing escape sequences through
|
|
226
217
|
// and never splitting one, then resetting so the terminal is left clean.
|
|
227
218
|
function trimVisible(text, max) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
219
|
+
const pattern = /\x1b\[[0-9;]*m/g;
|
|
220
|
+
let out = '';
|
|
221
|
+
let seen = 0;
|
|
222
|
+
let last = 0;
|
|
223
|
+
let match;
|
|
224
|
+
while ((match = pattern.exec(text)) !== null) {
|
|
225
|
+
const chunk = text.slice(last, match.index);
|
|
226
|
+
if (seen + chunk.length >= max)
|
|
227
|
+
return out + chunk.slice(0, Math.max(0, max - seen)) + '\x1b[0m';
|
|
228
|
+
out += chunk + match[0];
|
|
229
|
+
seen += chunk.length;
|
|
230
|
+
last = pattern.lastIndex;
|
|
231
|
+
}
|
|
232
|
+
const rest = text.slice(last);
|
|
233
|
+
return out + (seen + rest.length > max ? rest.slice(0, max - seen) : rest);
|
|
242
234
|
}
|
|
243
|
-
|
|
244
235
|
function entryLevel(entry) {
|
|
245
|
-
|
|
236
|
+
return String(entry.level || 'info').toUpperCase().padEnd(LEVEL_WIDTH);
|
|
246
237
|
}
|
|
247
|
-
|
|
248
238
|
// A human summary of suppressed noise, so silence is never ambiguous. "Nothing
|
|
249
239
|
// happened" and "94 files were served" are different facts; printing the second
|
|
250
240
|
// as one line every so often keeps the first honest.
|
|
251
241
|
export function noiseSummary(count, ms = 0) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
242
|
+
const files = `${count} static file${count === 1 ? '' : 's'}`;
|
|
243
|
+
const took = ms >= 1000 ? ` in ${(ms / 1000).toFixed(1)}s` : ms ? ` in ${ms}ms` : '';
|
|
244
|
+
return `served ${files}${took}`;
|
|
255
245
|
}
|
|
256
|
-
|
|
257
246
|
export function logEntry(level, msg, extra = {}) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
247
|
+
const now = new Date();
|
|
248
|
+
return {
|
|
249
|
+
ts: now.toISOString(),
|
|
250
|
+
// Built from the local parts, not `toTimeString()`: that carries a timezone
|
|
251
|
+
// abbreviation whose width changes (`GMT` vs ` PDT`), which is exactly what
|
|
252
|
+
// makes a log column ragged. Always 12 characters, always the reader's clock.
|
|
253
|
+
time: [now.getHours(), now.getMinutes(), now.getSeconds()]
|
|
254
|
+
.map((part) => String(part).padStart(2, '0'))
|
|
255
|
+
.join(':') + '.' + String(now.getMilliseconds()).padStart(3, '0'),
|
|
256
|
+
level,
|
|
257
|
+
msg,
|
|
258
|
+
...extra,
|
|
259
|
+
};
|
|
271
260
|
}
|
|
272
|
-
|
|
273
261
|
export function createLogger(level = process.env.LOG_LEVEL || 'info', options = {}) {
|
|
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
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
262
|
+
const minLevel = levels[level] ?? levels.info;
|
|
263
|
+
// `pretty` is the default for a terminal *and* for a log file (aligned text is
|
|
264
|
+
// what a person reads at 2am); `ONBOARDER_LOG=json` is the machine escape
|
|
265
|
+
// hatch, and so is a non-TTY consumer that parses stdout.
|
|
266
|
+
const format = options.format || process.env.ONBOARDER_LOG || 'pretty';
|
|
267
|
+
const color = options.color ?? (Boolean(process.stdout.isTTY) && !process.env.NO_COLOR);
|
|
268
|
+
const out = options.stdout || process.stdout;
|
|
269
|
+
const err = options.stderr || process.stderr;
|
|
270
|
+
// The noise policy. `info` (the default) drops successful static assets and
|
|
271
|
+
// uptime polls; `debug` shows every request, which is what you want when you
|
|
272
|
+
// are debugging the server rather than watching it. ONBOARDER_LOG_VERBOSE=1 is
|
|
273
|
+
// the same escape hatch without changing the level.
|
|
274
|
+
const quiet = options.quiet ?? (minLevel > levels.debug && process.env.ONBOARDER_LOG_VERBOSE !== '1');
|
|
275
|
+
// Read the terminal width per write, not once at construction: a log line
|
|
276
|
+
// printed after the user resized their window should use the new width.
|
|
277
|
+
const columns = options.columns ?? (() => out.columns || undefined);
|
|
278
|
+
// Suppressed-asset accounting. Assets are counted, not printed, and the tally
|
|
279
|
+
// is flushed as ONE dim summary line once it reaches `flushAt` — so a page
|
|
280
|
+
// load that serves 94 files produces one line, and a terminal that is idle
|
|
281
|
+
// still admits the server is busy rather than looking dead.
|
|
282
|
+
const flushAt = options.flushAt ?? 40;
|
|
283
|
+
let suppressed = 0;
|
|
284
|
+
let since = Date.now();
|
|
285
|
+
function flush(force = false) {
|
|
286
|
+
if (!suppressed)
|
|
287
|
+
return;
|
|
288
|
+
if (!force && suppressed < flushAt)
|
|
289
|
+
return;
|
|
290
|
+
write(logEntry('info', noiseSummary(suppressed, Date.now() - since), { summary: true }));
|
|
291
|
+
suppressed = 0;
|
|
292
|
+
since = Date.now();
|
|
293
|
+
}
|
|
294
|
+
function write(entry) {
|
|
295
|
+
if (format === 'json') {
|
|
296
|
+
const line = JSON.stringify(entry) + '\n';
|
|
297
|
+
(entry.level === 'warn' || entry.level === 'error' ? err : out).write(line);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
(entry.level === 'warn' || entry.level === 'error' ? err : out).write(renderEntry(entry, { color, columns: columns() }) + '\n');
|
|
301
|
+
}
|
|
302
|
+
function log(lvl, msg, extra = {}) {
|
|
303
|
+
if (levels[lvl] < minLevel)
|
|
304
|
+
return;
|
|
305
|
+
write(logEntry(lvl, msg, extra));
|
|
313
306
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
flush();
|
|
337
|
-
log(Number(req.status) >= 500 ? 'error' : 'info', 'http', req);
|
|
338
|
-
},
|
|
339
|
-
// Let a shutdown path (or a test) get the tally out before the process dies.
|
|
340
|
-
flush: () => flush(true),
|
|
341
|
-
suppressed: () => suppressed,
|
|
342
|
-
};
|
|
307
|
+
return {
|
|
308
|
+
debug: (msg, extra) => log('debug', msg, extra),
|
|
309
|
+
info: (msg, extra) => log('info', msg, extra),
|
|
310
|
+
warn: (msg, extra) => log('warn', msg, extra),
|
|
311
|
+
error: (msg, extra) => log('error', msg, extra),
|
|
312
|
+
// The one place the noise policy lives. A successful GET of a static file is
|
|
313
|
+
// counted, not printed; a scan, a login, or any failure is printed.
|
|
314
|
+
http: (req) => {
|
|
315
|
+
if (quiet && classifyRequest(req) === 'noise') {
|
|
316
|
+
suppressed += 1;
|
|
317
|
+
flush();
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
if (quiet && classifyPath(req.path) === 'poll')
|
|
321
|
+
return;
|
|
322
|
+
flush();
|
|
323
|
+
log(Number(req.status) >= 500 ? 'error' : 'info', 'http', req);
|
|
324
|
+
},
|
|
325
|
+
// Let a shutdown path (or a test) get the tally out before the process dies.
|
|
326
|
+
flush: () => flush(true),
|
|
327
|
+
suppressed: () => suppressed,
|
|
328
|
+
};
|
|
343
329
|
}
|
|
330
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/server/logger.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,gFAAgF;AAChF,6EAA6E;AAC7E,kBAAkB;AAClB,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,kBAAkB;AAElB,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAExD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,C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C,IAAI,CAAC;QACxB,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU;KAC7B,CAAC;AACJ,CAAC","sourcesContent":["// Every line Onboarder writes, in two faces.\n//\n// The entry itself is data — `{ ts, time, level, msg, ...fields }` — and the\n// renderer decides how it looks. JSON goes to pipes, log files and anything\n// parsing us; the aligned human line goes to a terminal. Picking the face once,\n// here, is what keeps a log file readable *and* machine-parseable instead of\n// half one thing.\n//\n// A `time` field (local HH:MM:SS.mmm) rides along with the ISO `ts` on purpose:\n// tailing a file gives you the string, not a Date, and a reader wants their own\n// clock, not UTC.\n\nconst levels = { debug: 0, info: 1, warn: 2, error: 3 };\n\n// Worst first — the order any summary or sort should use.\nexport const SEVERITY = { error: 0, warn: 1, info: 2, debug: 3 };\n\nconst CODES = { red: 31, green: 32, yellow: 33, cyan: 36, gray: 90 };\nconst LEVEL_COLOR = { debug: 'gray', info: 'cyan', warn: 'yellow', error: 'red' };\n\n// The server sits *under* the CLI, so it cannot import `cli/ui.js` without\n// inverting the dependency. These three lines of ANSI are the whole price.\nfunction paint(text, color, enabled) {\n return enabled && color ? `\\x1b[${CODES[color]}m${text}\\x1b[0m` : String(text);\n}\n\n// Fields that are part of the envelope or already rendered into the message.\n// `summary` is here so the suppressed-noise footer does not print itself as\n// `summary=true` — it is a rendering flag, not data.\nconst ENVELOPE = new Set(['ts', 'time', 'level', 'msg', 'method', 'path', 'status', 'ms', 'line', 'scope', 'summary']);\n\n// Request classification — the difference between a person doing something and\n// a browser fetching a file.\n//\n// This is the single most important thing about Onboarder's logs. A page load\n// pulls ~90 ES modules, a stylesheet, and two vendored libraries: 90 log lines\n// describing zero user actions, repeated on every reload and on every auth\n// check. The MCP status poll adds one more line every nine seconds, forever. Log\n// all of it and the real events — a scan, a login, a 500 — are buried.\n//\n// So: a request is an **action** if it is an API call, and **noise** if it is a\n// static asset. Noise is not thrown away, it is *counted* (see `NoiseCounter`),\n// because \"nothing happened\" and \"90 files were served\" are different facts and\n// only one of them is interesting most of the time.\nexport function classifyPath(pathname = '') {\n const path = String(pathname).split('?')[0];\n if (path === '/api/health') return 'poll'; // uptime checks\n if (path.startsWith('/api/')) return 'action';\n return 'noise';\n}\n\nexport function classifyRequest(req: Record<string, any> = {}) {\n const kind = classifyPath(req.path);\n // A failure is always an action, whatever it was: a 404 on a missing asset is\n // a broken build, and a 500 is a bug. Neither is noise to be summarized away.\n if (Number(req.status) >= 400) return 'action';\n if (req.method && req.method !== 'GET' && req.method !== 'HEAD') return 'action';\n return kind;\n}\n\n// One line, no styling: what a log file holds and what a test asserts on.\nexport function formatMessage(entry) {\n if (entry.line) return `${entry.msg ?? ''} ${entry.line}`.trim();\n if (entry.method) {\n const status = entry.status === undefined ? '' : ` ${entry.status}`;\n const took = entry.ms === undefined ? '' : ` (${entry.ms}ms)`;\n return `${entry.method} ${entry.path}${status}${took}`;\n }\n const extra = Object.entries(entry)\n .filter(([key, value]) => !ENVELOPE.has(key) && value !== undefined && value !== null)\n .map(([key, value]) => `${key}=${typeof value === 'string' ? value : JSON.stringify(value)}`);\n return [entry.msg ?? '', ...extra].filter(Boolean).join(' ');\n}\n\n// Every log line is `time LEVEL message`, with the level in a fixed 5-wide\n// column so the messages of an `INFO` and a `ERROR` line start at the same\n// offset. That alignment is the entire point: a wall of request logs is only\n// scannable if the eye can find the message column without reading.\nconst LEVEL_WIDTH = 5;\nconst GUTTER = ' ';\n\n// The part of a path that identifies it: the filename with its extension. When\n// a line has to be cut, this is what must survive — `…typescript.js` is useful,\n// `…script` is not. A path with no filename (`/` or `/a/`) falls back to its tail.\nexport function identifyingTail(text) {\n const value = String(text);\n const name = value.slice(value.lastIndexOf('/') + 1);\n return name.length >= 4 ? name : value.slice(-8);\n}\n\n// How the message area adapts to the terminal. Wide terminals get the whole\n// path; narrow ones get the part that identifies it, elided in the middle — the\n// tail of a path is the informative half, so it survives and the boring prefix\n// is what gets dropped.\nexport function fitPath(text, max) {\n const value = String(text);\n if (max <= 0) return '';\n if (value.length <= max) return value;\n if (max === 1) return '…';\n // An ellipsis stands in for the dropped prefix, so do not also add a leading\n // slash: `/…/file.js` reads as a path, `//file.js` reads as a typo. The kept\n // tail is the filename, so a long path loses its directories rather than\n // losing its extension — `…typescript.js` is useful, `…typescript` is not.\n const tail = identifyingTail(value);\n if (tail.length + 1 <= max) return '…' + tail;\n return '…' + value.slice(-(max - 1));\n}\n\n// How much room the message gets, and whether the level column is affordable.\n//\n// The fixed prefix is the time, two gutters, and the level column. On a narrow\n// terminal that fixed cost eats the whole line, so two things give way: below 52\n// columns the level column is dropped, and below 24 the timestamp reduces to\n// HH:MM. Below 12 there is no room for any prefix at all, so both are dropped.\n//\n// Crucially the prefix never exceeds the terminal. An earlier version floored\n// `messageWidth` at 12, which meant a 20-column line asked for 20 columns of\n// message, overflowed, and got clamped from the front — producing `pt.js 200`,\n// the tail of a line with its head cut off. The prefix is the part that must\n// yield, not the message.\nexport const LEVEL_MIN_COLUMNS = 52;\nexport const SHORT_TIME_COLUMNS = 24;\nexport const NO_TIME_COLUMNS = 12;\n\nexport function showLevel(columns) {\n return (columns || 80) >= LEVEL_MIN_COLUMNS;\n}\n\nexport function showFullTime(columns) {\n return (columns || 80) >= SHORT_TIME_COLUMNS;\n}\n\nexport function showTime(columns) {\n return (columns || 80) >= NO_TIME_COLUMNS;\n}\n\n// The time as it will actually be printed, so callers do not re-derive the same\n// decision and get it subtly wrong.\nexport function timeColumn(entry, columns) {\n if (!showTime(columns)) return '';\n const raw = String(entry.time || String(entry.ts || '').slice(11, 19));\n return showFullTime(columns) ? raw : raw.slice(0, 5);\n}\n\n// Everything before the message: time + gutter + optional level + gutter.\n//\n// Deliberately computed from the *width* alone, not from an entry: an earlier\n// version asked `timeColumn({}, columns)`, which has no timestamp and so\n// reported a zero-width prefix — and then every line was built 19 columns too\n// long and overflowed. The prefix is a property of the terminal, not of the log\n// line, so it is computed from the terminal.\nexport function prefixWidth(columns) {\n if (!showTime(columns)) return 0;\n const time = showFullTime(columns) ? 12 : 5;\n return time + GUTTER.length + (showLevel(columns) ? LEVEL_WIDTH + GUTTER.length : 0);\n}\n\nexport function messageWidth(columns) {\n const total = columns || 80;\n return Math.max(0, total - prefixWidth(total));\n}\n\nexport function formatEntry(entry, { columns }: Record<string, any> = {}) {\n const time = timeColumn(entry, columns);\n const level = showLevel(columns) ? entryLevel(entry) + GUTTER : '';\n const head = time ? time + GUTTER + level : '';\n // The message was already fitted to `messageWidth` and the head is exactly\n // `prefixWidth`, so the line is exactly the terminal width by construction —\n // no trailing clamp, and therefore no risk of cutting a word in half.\n return head + fitMessage(entry, columns);\n}\n\n// One line, fitted to the terminal.\n//\n// What gets sacrificed as space runs out, in order: the timing, then the HTTP\n// status, then the level column, then the *method* — and the path's tail is\n// protected, because the filename is the one thing that still identifies the\n// request. A 40-column terminal gets `…zer/languages/typescript.js` (the\n// extension intact); an 80-column one gets the whole sentence.\nfunction fitMessage(entry, columns) {\n const text = formatMessage(entry);\n const room = messageWidth(columns);\n if (text.length <= room) return text;\n if (!entry.method || !entry.path) return fitPath(text, room);\n\n const status = entry.status === undefined ? '' : ` ${entry.status}`;\n const method = `${entry.method} `;\n // Drop the status before the method, and the method before any of the path.\n const withStatus = method + fitPath(entry.path, room - method.length - status.length) + status;\n if (withStatus.length <= room) return withStatus;\n const withoutStatus = method + fitPath(entry.path, room - method.length);\n if (withoutStatus.length <= room) return withoutStatus;\n // Last resort: the path alone, at exactly the room available. `fitPath` is\n // given the exact width, so this is always exactly `room` — never over, which\n // is what would make the caller's clamp cut the *front* of the line and leave\n // an unreadable tail like `pt.js 200`.\n return fitPath(entry.path, room);\n}\n\n// A summary of suppressed noise renders as a footnote, not an event: dim, and\n// with no level column, so the eye skips it while scanning for real lines. It\n// occupies the same time gutter so it still lines up in the scrollback.\nexport function renderEntry(entry, { color = false, columns }: Record<string, any> = {}) {\n const message = fitMessage(entry, columns);\n const limit = Math.max(8, columns || 80);\n if (entry.summary) {\n const pad = showLevel(columns) ? ' '.repeat(LEVEL_WIDTH) + GUTTER : '';\n return paint(timeColumn(entry, columns), 'gray', color)\n + GUTTER + paint(GUTTER + pad + message, 'gray', color);\n }\n const painted = paint(timeColumn(entry, columns), 'gray', color) + GUTTER\n + (showLevel(columns) ? paint(entryLevel(entry), LEVEL_COLOR[entry.level] || 'gray', color) + GUTTER : '')\n + message;\n // Clamp on *visible* width: the ANSI codes cost nothing on screen, so slicing\n // the painted string by character count would cut a real character and leave\n // the escape sequence unterminated.\n return visibleWidth(painted) <= limit ? painted : trimVisible(painted, limit);\n}\n\n// Visible width, ANSI excluded.\nfunction visibleWidth(text) {\n return String(text).replace(/\\x1b\\[[0-9;]*m/g, '').length;\n}\n\n// Cut a painted string to `max` visible columns, passing escape sequences through\n// and never splitting one, then resetting so the terminal is left clean.\nfunction trimVisible(text, max) {\n const pattern = /\\x1b\\[[0-9;]*m/g;\n let out = '';\n let seen = 0;\n let last = 0;\n let match;\n while ((match = pattern.exec(text)) !== null) {\n const chunk = text.slice(last, match.index);\n if (seen + chunk.length >= max) return out + chunk.slice(0, Math.max(0, max - seen)) + '\\x1b[0m';\n out += chunk + match[0];\n seen += chunk.length;\n last = pattern.lastIndex;\n }\n const rest = text.slice(last);\n return out + (seen + rest.length > max ? rest.slice(0, max - seen) : rest);\n}\n\nfunction entryLevel(entry) {\n return String(entry.level || 'info').toUpperCase().padEnd(LEVEL_WIDTH);\n}\n\n// A human summary of suppressed noise, so silence is never ambiguous. \"Nothing\n// happened\" and \"94 files were served\" are different facts; printing the second\n// as one line every so often keeps the first honest.\nexport function noiseSummary(count, ms = 0) {\n const files = `${count} static file${count === 1 ? '' : 's'}`;\n const took = ms >= 1000 ? ` in ${(ms / 1000).toFixed(1)}s` : ms ? ` in ${ms}ms` : '';\n return `served ${files}${took}`;\n}\n\nexport function logEntry(level, msg, extra: Record<string, any> = {}) {\n const now = new Date();\n return {\n ts: now.toISOString(),\n // Built from the local parts, not `toTimeString()`: that carries a timezone\n // abbreviation whose width changes (`GMT` vs ` PDT`), which is exactly what\n // makes a log column ragged. Always 12 characters, always the reader's clock.\n time: [now.getHours(), now.getMinutes(), now.getSeconds()]\n .map((part) => String(part).padStart(2, '0'))\n .join(':') + '.' + String(now.getMilliseconds()).padStart(3, '0'),\n level,\n msg,\n ...extra,\n };\n}\n\nexport function createLogger(level = process.env.LOG_LEVEL || 'info', options: Record<string, any> = {}) {\n const minLevel = levels[level] ?? levels.info;\n // `pretty` is the default for a terminal *and* for a log file (aligned text is\n // what a person reads at 2am); `ONBOARDER_LOG=json` is the machine escape\n // hatch, and so is a non-TTY consumer that parses stdout.\n const format = options.format || process.env.ONBOARDER_LOG || 'pretty';\n const color = options.color ?? (Boolean(process.stdout.isTTY) && !process.env.NO_COLOR);\n const out = options.stdout || process.stdout;\n const err = options.stderr || process.stderr;\n\n // The noise policy. `info` (the default) drops successful static assets and\n // uptime polls; `debug` shows every request, which is what you want when you\n // are debugging the server rather than watching it. ONBOARDER_LOG_VERBOSE=1 is\n // the same escape hatch without changing the level.\n const quiet = options.quiet ?? (minLevel > levels.debug && process.env.ONBOARDER_LOG_VERBOSE !== '1');\n // Read the terminal width per write, not once at construction: a log line\n // printed after the user resized their window should use the new width.\n const columns = options.columns ?? (() => out.columns || undefined);\n\n // Suppressed-asset accounting. Assets are counted, not printed, and the tally\n // is flushed as ONE dim summary line once it reaches `flushAt` — so a page\n // load that serves 94 files produces one line, and a terminal that is idle\n // still admits the server is busy rather than looking dead.\n const flushAt = options.flushAt ?? 40;\n let suppressed = 0;\n let since = Date.now();\n\n function flush(force = false) {\n if (!suppressed) return;\n if (!force && suppressed < flushAt) return;\n write(logEntry('info', noiseSummary(suppressed, Date.now() - since), { summary: true }));\n suppressed = 0;\n since = Date.now();\n }\n\n function write(entry) {\n if (format === 'json') {\n const line = JSON.stringify(entry) + '\\n';\n (entry.level === 'warn' || entry.level === 'error' ? err : out).write(line);\n return;\n }\n (entry.level === 'warn' || entry.level === 'error' ? err : out).write(renderEntry(entry, { color, columns: columns() }) + '\\n');\n }\n\n function log(lvl, msg, extra: Record<string, any> = {}) {\n if (levels[lvl] < minLevel) return;\n write(logEntry(lvl, msg, extra));\n }\n\n return {\n debug: (msg, extra) => log('debug', msg, extra),\n info: (msg, extra) => log('info', msg, extra),\n warn: (msg, extra) => log('warn', msg, extra),\n error: (msg, extra) => log('error', msg, extra),\n // The one place the noise policy lives. A successful GET of a static file is\n // counted, not printed; a scan, a login, or any failure is printed.\n http: (req) => {\n if (quiet && classifyRequest(req) === 'noise') {\n suppressed += 1;\n flush();\n return;\n }\n if (quiet && classifyPath(req.path) === 'poll') return;\n flush();\n log(Number(req.status) >= 500 ? 'error' : 'info', 'http', req);\n },\n // Let a shutdown path (or a test) get the tally out before the process dies.\n flush: () => flush(true),\n suppressed: () => suppressed,\n };\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { scanIndex } from '../../shared/analyzer/graph.js';
|
|
2
|
+
import { explainFile, explainFolder } from '../../shared/analyzer/explainLocal.js';
|
|
3
|
+
import { docFileRow, fileFactsLine, fileStaticDoc, folderStaticDoc } from '../../shared/analyzer/docs.js';
|
|
4
|
+
import { baseName, dirOf } from '../../shared/analyzer/pathUtil.js';
|
|
5
|
+
import { searchDocuments } from '../apiSearch.js';
|
|
6
|
+
export declare function cachedAnalysis(root: any): any;
|
|
7
|
+
export declare function cachedRoots(): any[];
|
|
8
|
+
export declare function clearAnalysisCache(): void;
|
|
9
|
+
export declare class ToolError extends Error {
|
|
10
|
+
name: string;
|
|
11
|
+
constructor(message: any);
|
|
12
|
+
}
|
|
13
|
+
export declare function analyzeRepository(rootInput: any, { force }?: Record<string, any>): Promise<any>;
|
|
14
|
+
export declare function filesUnder(analysis: any, folder: any): any;
|
|
15
|
+
export declare function parsedFilesUnder(analysis: any, folder: any): any;
|
|
16
|
+
export declare function resolveIn(analysis: any, relPath: any): {
|
|
17
|
+
abs: string;
|
|
18
|
+
rel: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function fileIn(analysis: any, relPath: any): {
|
|
21
|
+
abs: string;
|
|
22
|
+
rel: string;
|
|
23
|
+
file: any;
|
|
24
|
+
};
|
|
25
|
+
export declare function readFileText(analysis: any, relPath: any): Promise<{
|
|
26
|
+
path: string;
|
|
27
|
+
text: string;
|
|
28
|
+
}>;
|
|
29
|
+
export { scanIndex, dirOf, baseName, explainFile, explainFolder, docFileRow, fileFactsLine, fileStaticDoc, folderStaticDoc, searchDocuments, };
|