codebase-onboarder 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -46
- package/bin/build-if-source.js +23 -0
- package/cli/commands.d.ts +26 -0
- package/cli/commands.js +836 -811
- package/cli/commands.js.map +1 -0
- package/cli/explorer/advanced.d.ts +14 -0
- package/cli/explorer/advanced.js +321 -329
- package/cli/explorer/advanced.js.map +1 -0
- package/cli/explorer/app.d.ts +1 -0
- package/cli/explorer/app.js +384 -313
- package/cli/explorer/app.js.map +1 -0
- package/cli/explorer/assistant.d.ts +9 -0
- package/cli/explorer/assistant.js +58 -0
- package/cli/explorer/assistant.js.map +1 -0
- package/cli/explorer/commands.d.ts +17 -0
- package/cli/explorer/commands.js +368 -302
- package/cli/explorer/commands.js.map +1 -0
- package/cli/explorer/featureViews.d.ts +124 -0
- package/cli/explorer/featureViews.js +179 -0
- package/cli/explorer/featureViews.js.map +1 -0
- package/cli/explorer/github.d.ts +21 -0
- package/cli/explorer/github.js +42 -44
- package/cli/explorer/github.js.map +1 -0
- package/cli/explorer/graphs.d.ts +7 -0
- package/cli/explorer/graphs.js +90 -95
- package/cli/explorer/graphs.js.map +1 -0
- package/cli/explorer/picker.d.ts +22 -0
- package/cli/explorer/picker.js +150 -0
- package/cli/explorer/picker.js.map +1 -0
- package/cli/explorer/report.d.ts +85 -0
- package/cli/explorer/report.js +60 -0
- package/cli/explorer/report.js.map +1 -0
- package/cli/explorer/session.d.ts +449 -0
- package/cli/explorer/session.js +143 -144
- package/cli/explorer/session.js.map +1 -0
- package/cli/explorer/views.d.ts +19 -0
- package/cli/explorer/views.js +465 -482
- package/cli/explorer/views.js.map +1 -0
- package/cli/explorer/wrap.d.ts +1 -0
- package/cli/explorer/wrap.js +28 -44
- package/cli/explorer/wrap.js.map +1 -0
- package/cli/main.d.ts +1 -0
- package/cli/main.js +214 -161
- package/cli/main.js.map +1 -0
- package/cli/prompt.d.ts +5 -0
- package/cli/prompt.js +84 -80
- package/cli/prompt.js.map +1 -0
- package/cli/scanOptions.d.ts +2 -0
- package/cli/scanOptions.js +11 -0
- package/cli/scanOptions.js.map +1 -0
- package/cli/ui.d.ts +33 -0
- package/cli/ui.js +35 -44
- package/cli/ui.js.map +1 -0
- package/cli/wizard.d.ts +187 -0
- package/cli/wizard.js +304 -284
- package/cli/wizard.js.map +1 -0
- package/package.json +15 -4
- package/public/app.d.ts +1 -0
- package/public/app.js +1057 -1009
- package/public/app.js.map +1 -0
- package/public/browser.d.ts +68 -0
- package/public/browser.js +2 -0
- package/public/browser.js.map +1 -0
- package/public/index.html +30 -13
- package/public/js/about.d.ts +6 -0
- package/public/js/about.js +152 -172
- package/public/js/about.js.map +1 -0
- package/public/js/aiDraft.d.ts +3 -0
- package/public/js/aiDraft.js +116 -124
- package/public/js/aiDraft.js.map +1 -0
- package/public/js/analysisPanel.d.ts +7 -0
- package/public/js/analysisPanel.js +166 -166
- package/public/js/analysisPanel.js.map +1 -0
- package/public/js/analysisReport.d.ts +38 -0
- package/public/js/analysisReport.js +105 -110
- package/public/js/analysisReport.js.map +1 -0
- package/public/js/api.d.ts +26 -0
- package/public/js/api.js +176 -167
- package/public/js/api.js.map +1 -0
- package/public/js/atlas.d.ts +6 -0
- package/public/js/atlas.js +50 -58
- package/public/js/atlas.js.map +1 -0
- package/public/js/blameView.d.ts +2 -0
- package/public/js/blameView.js +36 -37
- package/public/js/blameView.js.map +1 -0
- package/public/js/codeTab.d.ts +3 -0
- package/public/js/codeTab.js +175 -180
- package/public/js/codeTab.js.map +1 -0
- package/public/js/codeViewer.d.ts +5 -0
- package/public/js/codeViewer.js +162 -150
- package/public/js/codeViewer.js.map +1 -0
- package/public/js/components/FileChip.d.ts +9 -0
- package/public/js/components/FileChip.js +45 -49
- package/public/js/components/FileChip.js.map +1 -0
- package/public/js/components/MetricSparkline.d.ts +7 -0
- package/public/js/components/MetricSparkline.js +35 -44
- package/public/js/components/MetricSparkline.js.map +1 -0
- package/public/js/components/RiskBadge.d.ts +9 -0
- package/public/js/components/RiskBadge.js +55 -63
- package/public/js/components/RiskBadge.js.map +1 -0
- package/public/js/deepAnalysisView.d.ts +99 -0
- package/public/js/deepAnalysisView.js +282 -302
- package/public/js/deepAnalysisView.js.map +1 -0
- package/public/js/diagramPane.d.ts +8 -0
- package/public/js/diagramPane.js +133 -135
- package/public/js/diagramPane.js.map +1 -0
- package/public/js/diffView.d.ts +6 -0
- package/public/js/diffView.js +222 -209
- package/public/js/diffView.js.map +1 -0
- package/public/js/docsView.d.ts +2 -0
- package/public/js/docsView.js +441 -442
- package/public/js/docsView.js.map +1 -0
- package/public/js/dom.d.ts +189 -0
- package/public/js/dom.js +5 -0
- package/public/js/dom.js.map +1 -0
- package/public/js/fileSourceBrowser.d.ts +5 -0
- package/public/js/fileSourceBrowser.js +33 -41
- package/public/js/fileSourceBrowser.js.map +1 -0
- package/public/js/flameGraph.d.ts +5 -0
- package/public/js/flameGraph.js +62 -72
- package/public/js/flameGraph.js.map +1 -0
- package/public/js/forceGraph.d.ts +10 -0
- package/public/js/forceGraph.js +581 -556
- package/public/js/forceGraph.js.map +1 -0
- package/public/js/heatmap.d.ts +4 -0
- package/public/js/heatmap.js +142 -164
- package/public/js/heatmap.js.map +1 -0
- package/public/js/highlight.d.ts +2 -0
- package/public/js/highlight.js +116 -107
- package/public/js/highlight.js.map +1 -0
- package/public/js/html.d.ts +2 -0
- package/public/js/html.js +14 -44
- package/public/js/html.js.map +1 -0
- package/public/js/insightsView.d.ts +5 -0
- package/public/js/insightsView.js +93 -111
- package/public/js/insightsView.js.map +1 -0
- package/public/js/inspector.d.ts +37 -0
- package/public/js/inspector.js +416 -445
- package/public/js/inspector.js.map +1 -0
- package/public/js/llm.d.ts +113 -0
- package/public/js/llm.js +233 -272
- package/public/js/llm.js.map +1 -0
- package/public/js/mapView.d.ts +3 -0
- package/public/js/mapView.js +121 -120
- package/public/js/mapView.js.map +1 -0
- package/public/js/markdown.d.ts +3 -0
- package/public/js/markdown.js +84 -91
- package/public/js/markdown.js.map +1 -0
- package/public/js/mindmap.d.ts +32 -0
- package/public/js/mindmap.js +244 -259
- package/public/js/mindmap.js.map +1 -0
- package/public/js/mobilePanels.d.ts +5 -0
- package/public/js/mobilePanels.js +50 -0
- package/public/js/mobilePanels.js.map +1 -0
- package/public/js/repoFiles.d.ts +12 -0
- package/public/js/repoFiles.js +28 -27
- package/public/js/repoFiles.js.map +1 -0
- package/public/js/reviewView.d.ts +28 -0
- package/public/js/reviewView.js +256 -0
- package/public/js/reviewView.js.map +1 -0
- package/public/js/sbomView.d.ts +3 -0
- package/public/js/sbomView.js +59 -67
- package/public/js/sbomView.js.map +1 -0
- package/public/js/scanCache.d.ts +16 -0
- package/public/js/scanCache.js +67 -65
- package/public/js/scanCache.js.map +1 -0
- package/public/js/search.d.ts +7 -0
- package/public/js/search.js +868 -800
- package/public/js/search.js.map +1 -0
- package/public/js/searchLocal.d.ts +42 -0
- package/public/js/searchLocal.js +87 -0
- package/public/js/searchLocal.js.map +1 -0
- package/public/js/serverSettings.d.ts +5 -0
- package/public/js/serverSettings.js +153 -164
- package/public/js/serverSettings.js.map +1 -0
- package/public/js/state.d.ts +798 -0
- package/public/js/state.js +114 -122
- package/public/js/state.js.map +1 -0
- package/public/js/tour.d.ts +6 -0
- package/public/js/tour.js +5 -7
- package/public/js/tour.js.map +1 -0
- package/public/js/transitions.d.ts +2 -0
- package/public/js/transitions.js +9 -10
- package/public/js/transitions.js.map +1 -0
- package/public/js/tree.d.ts +12 -0
- package/public/js/tree.js +157 -154
- package/public/js/tree.js.map +1 -0
- package/public/js/workflowsView.d.ts +3 -0
- package/public/js/workflowsView.js +15 -22
- package/public/js/workflowsView.js.map +1 -0
- package/public/search.css +495 -0
- package/public/styles.css +163 -346
- package/public/workbench.css +166 -0
- package/server/apiAuth.d.ts +3 -0
- package/server/apiAuth.js +18 -20
- package/server/apiAuth.js.map +1 -0
- package/server/apiDiff.d.ts +2 -0
- package/server/apiDiff.js +20 -18
- package/server/apiDiff.js.map +1 -0
- package/server/apiDocs.d.ts +2 -0
- package/server/apiDocs.js +38 -40
- package/server/apiDocs.js.map +1 -0
- package/server/apiFile.d.ts +1 -0
- package/server/apiFile.js +14 -17
- package/server/apiFile.js.map +1 -0
- package/server/apiGitBlame.d.ts +2 -0
- package/server/apiGitBlame.js +50 -51
- package/server/apiGitBlame.js.map +1 -0
- package/server/apiMcp.d.ts +4 -0
- package/server/apiMcp.js +64 -66
- package/server/apiMcp.js.map +1 -0
- package/server/apiReview.d.ts +2 -0
- package/server/apiReview.js +45 -0
- package/server/apiReview.js.map +1 -0
- package/server/apiScan.d.ts +5 -0
- package/server/apiScan.js +90 -71
- package/server/apiScan.js.map +1 -0
- package/server/apiSearch.d.ts +33 -0
- package/server/apiSearch.js +184 -200
- package/server/apiSearch.js.map +1 -0
- package/server/apiSettings.d.ts +4 -0
- package/server/apiSettings.js +84 -85
- package/server/apiSettings.js.map +1 -0
- package/server/apiTools.d.ts +3 -0
- package/server/apiTools.js +55 -56
- package/server/apiTools.js.map +1 -0
- package/server/auth.d.ts +5 -0
- package/server/auth.js +54 -51
- package/server/auth.js.map +1 -0
- package/server/config.d.ts +42 -0
- package/server/config.js +189 -194
- package/server/config.js.map +1 -0
- package/server/daemon.d.ts +12 -0
- package/server/daemon.js +124 -114
- package/server/daemon.js.map +1 -0
- package/server/fileSourceNode.d.ts +2 -0
- package/server/fileSourceNode.js +34 -36
- package/server/fileSourceNode.js.map +1 -0
- package/server/gitClone.d.ts +9 -0
- package/server/gitClone.js +59 -61
- package/server/gitClone.js.map +1 -0
- package/server/gitDiff.d.ts +36 -0
- package/server/gitDiff.js +271 -169
- package/server/gitDiff.js.map +1 -0
- package/server/gitHistory.d.ts +12 -0
- package/server/gitHistory.js +80 -80
- package/server/gitHistory.js.map +1 -0
- package/server/gitRemote.d.ts +12 -0
- package/server/gitRemote.js +37 -38
- package/server/gitRemote.js.map +1 -0
- package/server/htmlText.d.ts +4 -0
- package/server/htmlText.js +16 -23
- package/server/htmlText.js.map +1 -0
- package/server/http.d.ts +5 -0
- package/server/http.js +27 -30
- package/server/http.js.map +1 -0
- package/server/httpGuards.d.ts +2 -0
- package/server/httpGuards.js +47 -43
- package/server/httpGuards.js.map +1 -0
- package/server/https.d.ts +34 -0
- package/server/https.js +121 -111
- package/server/https.js.map +1 -0
- package/server/index.d.ts +40 -0
- package/server/index.js +139 -147
- package/server/index.js.map +1 -0
- package/server/layout.d.ts +26 -0
- package/server/layout.js +59 -64
- package/server/layout.js.map +1 -0
- package/server/llmProxy.d.ts +3 -0
- package/server/llmProxy.js +137 -135
- package/server/llmProxy.js.map +1 -0
- package/server/logger.d.ts +38 -0
- package/server/logger.js +198 -211
- package/server/logger.js.map +1 -0
- package/server/mcp/analysis.d.ts +29 -0
- package/server/mcp/analysis.js +99 -120
- package/server/mcp/analysis.js.map +1 -0
- package/server/mcp/http.d.ts +9 -0
- package/server/mcp/http.js +128 -137
- package/server/mcp/http.js.map +1 -0
- package/server/mcp/runner.d.ts +68 -0
- package/server/mcp/runner.js +208 -218
- package/server/mcp/runner.js.map +1 -0
- package/server/mcp/server.d.ts +29 -0
- package/server/mcp/server.js +166 -179
- package/server/mcp/server.js.map +1 -0
- package/server/mcp/standalone.d.ts +1 -0
- package/server/mcp/standalone.js +8 -10
- package/server/mcp/standalone.js.map +1 -0
- package/server/mcp/tools.d.ts +2020 -0
- package/server/mcp/tools.js +523 -574
- package/server/mcp/tools.js.map +1 -0
- package/server/paths.d.ts +3 -0
- package/server/paths.js +17 -15
- package/server/paths.js.map +1 -0
- package/server/pidfile.d.ts +9 -0
- package/server/pidfile.js +43 -45
- package/server/pidfile.js.map +1 -0
- package/server/review.d.ts +5 -0
- package/server/review.js +35 -0
- package/server/review.js.map +1 -0
- package/server/router.d.ts +33 -0
- package/server/router.js +191 -197
- package/server/router.js.map +1 -0
- package/server/scanRequest.d.ts +3 -0
- package/server/scanRequest.js +36 -0
- package/server/scanRequest.js.map +1 -0
- package/server/searchIndex.d.ts +17 -0
- package/server/searchIndex.js +83 -80
- package/server/searchIndex.js.map +1 -0
- package/server/sessions.d.ts +14 -0
- package/server/sessions.js +62 -70
- package/server/sessions.js.map +1 -0
- package/server/startup.d.ts +118 -0
- package/server/startup.js +143 -148
- package/server/startup.js.map +1 -0
- package/server/static.d.ts +6 -0
- package/server/static.js +28 -31
- package/server/static.js.map +1 -0
- package/server/tools/install.d.ts +4 -0
- package/server/tools/install.js +176 -185
- package/server/tools/install.js.map +1 -0
- package/server/tools/parse.d.ts +8 -0
- package/server/tools/parse.js +112 -114
- package/server/tools/parse.js.map +1 -0
- package/server/tools/platform.d.ts +9 -0
- package/server/tools/platform.js +49 -47
- package/server/tools/platform.js.map +1 -0
- package/server/tools/registry.d.ts +137 -0
- package/server/tools/registry.js +173 -172
- package/server/tools/registry.js.map +1 -0
- package/server/tools/scan.d.ts +34 -0
- package/server/tools/scan.js +89 -98
- package/server/tools/scan.js.map +1 -0
- package/server/tools.d.ts +34 -0
- package/server/tools.js +94 -107
- package/server/tools.js.map +1 -0
- package/server/tunnel.d.ts +29 -0
- package/server/tunnel.js +61 -66
- package/server/tunnel.js.map +1 -0
- package/shared/analyzer/docs.d.ts +16 -0
- package/shared/analyzer/docs.js +99 -93
- package/shared/analyzer/docs.js.map +1 -0
- package/shared/analyzer/explainLocal.d.ts +4 -0
- package/shared/analyzer/explainLocal.js +122 -142
- package/shared/analyzer/explainLocal.js.map +1 -0
- package/shared/analyzer/github.d.ts +37 -0
- package/shared/analyzer/github.js +41 -43
- package/shared/analyzer/github.js.map +1 -0
- package/shared/analyzer/graph.d.ts +41 -0
- package/shared/analyzer/graph.js +393 -400
- package/shared/analyzer/graph.js.map +1 -0
- package/shared/analyzer/health.d.ts +33 -0
- package/shared/analyzer/health.js +197 -193
- package/shared/analyzer/health.js.map +1 -0
- package/shared/analyzer/history.d.ts +29 -0
- package/shared/analyzer/history.js +110 -111
- package/shared/analyzer/history.js.map +1 -0
- package/shared/analyzer/jsonConfig.d.ts +2 -0
- package/shared/analyzer/jsonConfig.js +61 -0
- package/shared/analyzer/jsonConfig.js.map +1 -0
- package/shared/analyzer/languages/csharp.d.ts +26 -0
- package/shared/analyzer/languages/csharp.js +83 -88
- package/shared/analyzer/languages/csharp.js.map +1 -0
- package/shared/analyzer/languages/generic.d.ts +23 -0
- package/shared/analyzer/languages/generic.js +94 -105
- package/shared/analyzer/languages/generic.js.map +1 -0
- package/shared/analyzer/languages/go.d.ts +24 -0
- package/shared/analyzer/languages/go.js +45 -54
- package/shared/analyzer/languages/go.js.map +1 -0
- package/shared/analyzer/languages/index.d.ts +6 -0
- package/shared/analyzer/languages/index.js +19 -20
- package/shared/analyzer/languages/index.js.map +1 -0
- package/shared/analyzer/languages/java.d.ts +20 -0
- package/shared/analyzer/languages/java.js +73 -78
- package/shared/analyzer/languages/java.js.map +1 -0
- package/shared/analyzer/languages/javascript.d.ts +12 -0
- package/shared/analyzer/languages/javascript.js +258 -209
- package/shared/analyzer/languages/javascript.js.map +1 -0
- package/shared/analyzer/languages/python.d.ts +23 -0
- package/shared/analyzer/languages/python.js +92 -100
- package/shared/analyzer/languages/python.js.map +1 -0
- package/shared/analyzer/languages/rust.d.ts +17 -0
- package/shared/analyzer/languages/rust.js +96 -98
- package/shared/analyzer/languages/rust.js.map +1 -0
- package/shared/analyzer/languages/typescript.d.ts +11 -0
- package/shared/analyzer/languages/typescript.js +117 -116
- package/shared/analyzer/languages/typescript.js.map +1 -0
- package/shared/analyzer/licenses.d.ts +18 -0
- package/shared/analyzer/licenses.js +130 -133
- package/shared/analyzer/licenses.js.map +1 -0
- package/shared/analyzer/metrics.d.ts +20 -0
- package/shared/analyzer/metrics.js +112 -104
- package/shared/analyzer/metrics.js.map +1 -0
- package/shared/analyzer/pathUtil.d.ts +10 -0
- package/shared/analyzer/pathUtil.js +29 -35
- package/shared/analyzer/pathUtil.js.map +1 -0
- package/shared/analyzer/patterns.d.ts +11 -0
- package/shared/analyzer/patterns.js +231 -253
- package/shared/analyzer/patterns.js.map +1 -0
- package/shared/analyzer/scan.d.ts +62 -0
- package/shared/analyzer/scan.js +451 -442
- package/shared/analyzer/scan.js.map +1 -0
- package/shared/analyzer/scanControl.d.ts +11 -0
- package/shared/analyzer/scanControl.js +62 -0
- package/shared/analyzer/scanControl.js.map +1 -0
- package/shared/analyzer/security.d.ts +18 -0
- package/shared/analyzer/security.js +159 -159
- package/shared/analyzer/security.js.map +1 -0
- package/shared/analyzer/services.d.ts +5 -0
- package/shared/analyzer/services.js +141 -138
- package/shared/analyzer/services.js.map +1 -0
- package/shared/analyzer/stack.d.ts +6 -0
- package/shared/analyzer/stack.js +134 -141
- package/shared/analyzer/stack.js.map +1 -0
- package/shared/analyzer/tour.d.ts +2 -0
- package/shared/analyzer/tour.js +45 -53
- package/shared/analyzer/tour.js.map +1 -0
- package/shared/analyzer/util.d.ts +8 -0
- package/shared/analyzer/util.js +130 -76
- package/shared/analyzer/util.js.map +1 -0
- package/shared/analyzer/workflows.d.ts +8 -0
- package/shared/analyzer/workflows.js +139 -134
- package/shared/analyzer/workflows.js.map +1 -0
- package/shared/contracts.d.ts +250 -0
- package/shared/contracts.js +2 -0
- package/shared/contracts.js.map +1 -0
- package/shared/diagram/aiFacts.d.ts +35 -0
- package/shared/diagram/aiFacts.js +102 -105
- package/shared/diagram/aiFacts.js.map +1 -0
- package/shared/diagram/aiMermaid.d.ts +5 -0
- package/shared/diagram/aiMermaid.js +46 -45
- package/shared/diagram/aiMermaid.js.map +1 -0
- package/shared/diagram/atlas.d.ts +16 -0
- package/shared/diagram/atlas.js +51 -60
- package/shared/diagram/atlas.js.map +1 -0
- package/shared/diagram/mermaid.d.ts +43 -0
- package/shared/diagram/mermaid.js +348 -370
- package/shared/diagram/mermaid.js.map +1 -0
- package/shared/review/contracts.d.ts +95 -0
- package/shared/review/contracts.js +2 -0
- package/shared/review/contracts.js.map +1 -0
- package/shared/review/review.d.ts +10 -0
- package/shared/review/review.js +184 -0
- package/shared/review/review.js.map +1 -0
- package/shared/search/query.d.ts +32 -0
- package/shared/search/query.js +395 -388
- package/shared/search/query.js.map +1 -0
|
@@ -1,59 +1,60 @@
|
|
|
1
1
|
// Turns an LLM's raw answer into trustworthy Mermaid source.
|
|
2
2
|
// Models wrap, apologize, and explain — this strips all of that back to the
|
|
3
3
|
// diagram itself plus the one-line caption we ask for.
|
|
4
|
-
|
|
5
4
|
// Pulls `{ caption, body }` out of `text`; returns null when there is no
|
|
6
5
|
// flowchart to be found. `body` starts at the `flowchart`/`graph` line and
|
|
7
6
|
// has trailing prose trimmed away.
|
|
8
7
|
export function extractAIDiagram(text) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
if (!text || typeof text !== 'string')
|
|
9
|
+
return null;
|
|
10
|
+
// Fences gone first — ```mermaid and plain ``` alike.
|
|
11
|
+
const unfenced = text.replace(/```(?:mermaid)?/gi, '\n');
|
|
12
|
+
const capMatch = unfenced.match(/^%%\s*caption:\s*(.+)$/m);
|
|
13
|
+
const caption = capMatch ? capMatch[1].trim() : '';
|
|
14
|
+
const start = unfenced.search(/^\s*(flowchart|graph)\b/m);
|
|
15
|
+
if (start === -1)
|
|
16
|
+
return null;
|
|
17
|
+
const lines = unfenced.slice(start).split('\n');
|
|
18
|
+
// Trim trailing prose: walk back past anything that doesn't look like
|
|
19
|
+
// Mermaid. Labels, edges, subgraph blocks and classDefs all survive.
|
|
20
|
+
const MERMAID_HINT = /-->|---|\[|\]|\(|\)|\bsubgraph\b|\bend\b|classDef|^class\b|%%|:::|^\s*[\w$]+\s*:/;
|
|
21
|
+
while (lines.length) {
|
|
22
|
+
const tail = lines[lines.length - 1].trim();
|
|
23
|
+
if (!tail) {
|
|
24
|
+
lines.pop();
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (MERMAID_HINT.test(tail))
|
|
28
|
+
break;
|
|
29
|
+
lines.pop(); // a sentence, not a diagram line
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
lines.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const meaningful = lines.filter((l) => l.trim() && !l.trim().startsWith('%%')).length;
|
|
36
|
-
if (meaningful < 2) return null;
|
|
37
|
-
|
|
38
|
-
return { caption, body };
|
|
31
|
+
const body = lines.join('\n').trim();
|
|
32
|
+
const meaningful = lines.filter((l) => l.trim() && !l.trim().startsWith('%%')).length;
|
|
33
|
+
if (meaningful < 2)
|
|
34
|
+
return null;
|
|
35
|
+
return { caption, body };
|
|
39
36
|
}
|
|
40
|
-
|
|
41
37
|
// AI nodes carry no stable ids, so clicks are matched by their text: a full
|
|
42
38
|
// path hit first, then a unique-basename hit. Imperfect and honest about it.
|
|
43
39
|
export function matchNodeText(text, files) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
40
|
+
const t = String(text || '').trim();
|
|
41
|
+
if (!t)
|
|
42
|
+
return null;
|
|
43
|
+
const exact = files.find((f) => t === f.path || t.endsWith('/' + f.path) || t === f.name && false);
|
|
44
|
+
if (exact)
|
|
45
|
+
return exact.path;
|
|
46
|
+
let hit = null;
|
|
47
|
+
for (const f of files) {
|
|
48
|
+
if (!t.includes(f.name))
|
|
49
|
+
continue;
|
|
50
|
+
if (hit && hit !== f.path) {
|
|
51
|
+
// same basename twice — ambiguous only if the paths differ
|
|
52
|
+
const dup = files.filter((x) => x.name === f.name);
|
|
53
|
+
if (dup.length > 1)
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
hit = f.path;
|
|
55
57
|
}
|
|
56
|
-
hit
|
|
57
|
-
}
|
|
58
|
-
return hit;
|
|
58
|
+
return hit;
|
|
59
59
|
}
|
|
60
|
+
//# sourceMappingURL=aiMermaid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiMermaid.js","sourceRoot":"","sources":["../../src/shared/diagram/aiMermaid.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,4EAA4E;AAC5E,uDAAuD;AAEvD,yEAAyE;AACzE,2EAA2E;AAC3E,mCAAmC;AACnC,MAAM,UAAU,gBAAgB,CAAC,IAAI;IACnC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAEnD,sDAAsD;IACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAEzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;IAC1D,IAAI,KAAK,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAE9B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChD,sEAAsE;IACtE,qEAAqE;IACrE,MAAM,YAAY,GAAG,kFAAkF,CAAC;IACxG,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QACpB,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,IAAI,EA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;YAAE,SAAS;QAClC,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;YAC1B,2DAA2D;YAC3D,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;YACnD,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,IAAI,CAAC;QAClC,CAAC;QACD,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// Turns an LLM's raw answer into trustworthy Mermaid source.\n// Models wrap, apologize, and explain — this strips all of that back to the\n// diagram itself plus the one-line caption we ask for.\n\n// Pulls `{ caption, body }` out of `text`; returns null when there is no\n// flowchart to be found. `body` starts at the `flowchart`/`graph` line and\n// has trailing prose trimmed away.\nexport function extractAIDiagram(text) {\n if (!text || typeof text !== 'string') return null;\n\n // Fences gone first — ```mermaid and plain ``` alike.\n const unfenced = text.replace(/```(?:mermaid)?/gi, '\\n');\n\n const capMatch = unfenced.match(/^%%\\s*caption:\\s*(.+)$/m);\n const caption = capMatch ? capMatch[1].trim() : '';\n\n const start = unfenced.search(/^\\s*(flowchart|graph)\\b/m);\n if (start === -1) return null;\n\n const lines = unfenced.slice(start).split('\\n');\n // Trim trailing prose: walk back past anything that doesn't look like\n // Mermaid. Labels, edges, subgraph blocks and classDefs all survive.\n const MERMAID_HINT = /-->|---|\\[|\\]|\\(|\\)|\\bsubgraph\\b|\\bend\\b|classDef|^class\\b|%%|:::|^\\s*[\\w$]+\\s*:/;\n while (lines.length) {\n const tail = lines[lines.length - 1].trim();\n if (!tail) {\n lines.pop();\n continue;\n }\n if (MERMAID_HINT.test(tail)) break;\n lines.pop(); // a sentence, not a diagram line\n }\n\n const body = lines.join('\\n').trim();\n const meaningful = lines.filter((l) => l.trim() && !l.trim().startsWith('%%')).length;\n if (meaningful < 2) return null;\n\n return { caption, body };\n}\n\n// AI nodes carry no stable ids, so clicks are matched by their text: a full\n// path hit first, then a unique-basename hit. Imperfect and honest about it.\nexport function matchNodeText(text, files) {\n const t = String(text || '').trim();\n if (!t) return null;\n const exact = files.find((f) => t === f.path || t.endsWith('/' + f.path) || t === f.name && false);\n if (exact) return exact.path;\n let hit = null;\n for (const f of files) {\n if (!t.includes(f.name)) continue;\n if (hit && hit !== f.path) {\n // same basename twice — ambiguous only if the paths differ\n const dup = files.filter((x) => x.name === f.name);\n if (dup.length > 1) return null;\n }\n hit = f.path;\n }\n return hit;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function atlasSpecs(scan: any, facts: any, manifest: any, patterns: any): {
|
|
2
|
+
kind: string;
|
|
3
|
+
path: string;
|
|
4
|
+
title: string;
|
|
5
|
+
sub: string;
|
|
6
|
+
}[];
|
|
7
|
+
export declare function atlasDiagram(spec: any, { scan, facts, manifest, patterns }: {
|
|
8
|
+
facts: any;
|
|
9
|
+
manifest: any;
|
|
10
|
+
patterns: any;
|
|
11
|
+
scan: any;
|
|
12
|
+
}): {
|
|
13
|
+
source: string;
|
|
14
|
+
nodes: {};
|
|
15
|
+
};
|
|
16
|
+
export declare function filterAtlasItems(specs: any, { text, showTests }?: Record<string, any>): any;
|
package/shared/diagram/atlas.js
CHANGED
|
@@ -9,85 +9,76 @@
|
|
|
9
9
|
// reader will use one card's worth of.
|
|
10
10
|
//
|
|
11
11
|
// Pure, like everything under shared/: no DOM, no app state, no network.
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
overviewDiagram, folderDiagram, fileDetailDiagram, servicesDiagram, layersDiagram,
|
|
15
|
-
} from './mermaid.js';
|
|
12
|
+
import { overviewDiagram, folderDiagram, fileDetailDiagram, servicesDiagram, layersDiagram, } from './mermaid.js';
|
|
16
13
|
import { isTestPath } from '../analyzer/pathUtil.js';
|
|
17
|
-
|
|
18
14
|
// Both caps exist to keep the card list scrollable rather than endless. Files
|
|
19
15
|
// are ranked by fan-in first, so the 200 that survive are the ones the rest of
|
|
20
16
|
// the repo actually depends on — the cap trims the leaves, not the hubs.
|
|
21
17
|
const MAX_FOLDERS = 120;
|
|
22
18
|
const MAX_FILES = 200;
|
|
23
|
-
|
|
24
19
|
const plural = (n, word) => `${n} ${n === 1 ? word : word + 's'}`;
|
|
25
|
-
|
|
26
20
|
const strata = (patterns) => {
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const n = patterns.layersInfo.layers.length;
|
|
22
|
+
return `${n} ${n === 1 ? 'stratum' : 'strata'}`;
|
|
29
23
|
};
|
|
30
|
-
|
|
31
24
|
// The catalogue, in the order it is shown: the whole-repo maps first, then one
|
|
32
25
|
// card per folder, then one per file.
|
|
33
26
|
export function atlasSpecs(scan, facts, manifest, patterns) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return specs;
|
|
27
|
+
const specs = [
|
|
28
|
+
{ kind: 'overview', path: '', title: 'Overview map', sub: plural(scan.stats.filesParsed, 'file') },
|
|
29
|
+
{ kind: 'layers', path: '', title: 'Architecture layers', sub: strata(patterns) },
|
|
30
|
+
];
|
|
31
|
+
// A services map only means something once a manifest declared some.
|
|
32
|
+
if (manifest?.services?.length) {
|
|
33
|
+
specs.push({
|
|
34
|
+
kind: 'services', path: '', title: 'Services',
|
|
35
|
+
sub: `${manifest.services.length} declared`,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const counts = new Map();
|
|
39
|
+
for (const f of scan.files)
|
|
40
|
+
counts.set(f.dir, (counts.get(f.dir) || 0) + 1);
|
|
41
|
+
for (const folder of [...counts.keys()].sort().slice(0, MAX_FOLDERS)) {
|
|
42
|
+
specs.push({
|
|
43
|
+
kind: 'folder', path: folder,
|
|
44
|
+
title: (folder || '(repo root)') + '/',
|
|
45
|
+
sub: plural(counts.get(folder), 'file'),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
const ranked = scan.files.slice()
|
|
49
|
+
.sort((a, b) => (facts.fanIn[b.path] || 0) - (facts.fanIn[a.path] || 0)
|
|
50
|
+
|| a.path.localeCompare(b.path))
|
|
51
|
+
.slice(0, MAX_FILES);
|
|
52
|
+
for (const f of ranked) {
|
|
53
|
+
specs.push({
|
|
54
|
+
kind: 'file', path: f.path, title: f.path,
|
|
55
|
+
sub: plural(facts.fanIn[f.path] || 0, 'dependent'),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return specs;
|
|
69
59
|
}
|
|
70
|
-
|
|
71
60
|
// Draws one card. Called on open, so a card the reader never touches costs
|
|
72
61
|
// nothing but its heading.
|
|
73
62
|
export function atlasDiagram(spec, { scan, facts, manifest, patterns }) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
switch (spec.kind) {
|
|
64
|
+
case 'overview': return overviewDiagram(scan, facts);
|
|
65
|
+
case 'layers': return layersDiagram(scan, facts, patterns.layersInfo);
|
|
66
|
+
case 'services': return servicesDiagram(scan, manifest);
|
|
67
|
+
case 'file': return fileDetailDiagram(scan, facts, spec.path);
|
|
68
|
+
default: return folderDiagram(scan, facts, spec.path);
|
|
69
|
+
}
|
|
81
70
|
}
|
|
82
|
-
|
|
83
71
|
// The stage filters, applied to the catalogue. Matching is on the title so that
|
|
84
72
|
// typing "overview" finds the overview card, which has no path of its own; the
|
|
85
73
|
// tests toggle is by path, and only files have one worth testing.
|
|
86
74
|
export function filterAtlasItems(specs, { text = '', showTests = true } = {}) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
75
|
+
const needle = text.trim().toLowerCase();
|
|
76
|
+
if (!needle && showTests)
|
|
77
|
+
return specs;
|
|
78
|
+
return specs.filter((it) => {
|
|
79
|
+
if (!showTests && it.kind === 'file' && isTestPath(it.path))
|
|
80
|
+
return false;
|
|
81
|
+
return !needle || it.title.toLowerCase().includes(needle);
|
|
82
|
+
});
|
|
93
83
|
}
|
|
84
|
+
//# sourceMappingURL=atlas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atlas.js","sourceRoot":"","sources":["../../src/shared/diagram/atlas.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,0EAA0E;AAC1E,+EAA+E;AAC/E,iFAAiF;AACjF,8EAA8E;AAC9E,uCAAuC;AACvC,EAAE;AACF,yEAAyE;AAEzE,OAAO,EACL,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,GAClF,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,MAAM,WAAW,GAAG,GAAG,CAAC;AACxB,MAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,EAAE,CAAC;AAElE,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,EAAE;I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K,UAAU,EAAE,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrD,KAAK,QAAQ,EAAE,OAAO,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;QACtE,KAAK,UAAU,EAAE,OAAO,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxD,KAAK,MAAM,EAAE,OAAO,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9D,SAAS,OAAO,aAAa,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,+EAA+E;AAC/E,kEAAkE;AAClE,MAAM,UAAU,gBAAgB,CAAC,KAAK,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,GAAwB,EAAE;IAC/F,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,IAAI,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,KAAK,CAAC;IACvC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE;QACzB,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAC1E,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["// The atlas: every map the app knows how to draw, listed in one place.\n//\n// The list is a catalogue of *specs* — kind, subject, title, subtitle — and\n// nothing more. Drawing is deliberately separate: `atlasDiagram` turns one spec\n// into Mermaid when a card is actually opened. The list used to carry the\n// generated source for all of its entries, which meant opening the atlas built\n// three whole-repo maps, 120 folder graphs and 200 file graphs up front, to show\n// a page of headings. On a mid-size repo that is a visible stall for work the\n// reader will use one card's worth of.\n//\n// Pure, like everything under shared/: no DOM, no app state, no network.\n\nimport {\n overviewDiagram, folderDiagram, fileDetailDiagram, servicesDiagram, layersDiagram,\n} from './mermaid.js';\nimport { isTestPath } from '../analyzer/pathUtil.js';\n\n// Both caps exist to keep the card list scrollable rather than endless. Files\n// are ranked by fan-in first, so the 200 that survive are the ones the rest of\n// the repo actually depends on — the cap trims the leaves, not the hubs.\nconst MAX_FOLDERS = 120;\nconst MAX_FILES = 200;\n\nconst plural = (n, word) => `${n} ${n === 1 ? word : word + 's'}`;\n\nconst strata = (patterns) => {\n const n = patterns.layersInfo.layers.length;\n return `${n} ${n === 1 ? 'stratum' : 'strata'}`;\n};\n\n// The catalogue, in the order it is shown: the whole-repo maps first, then one\n// card per folder, then one per file.\nexport function atlasSpecs(scan, facts, manifest, patterns) {\n const specs = [\n { kind: 'overview', path: '', title: 'Overview map', sub: plural(scan.stats.filesParsed, 'file') },\n { kind: 'layers', path: '', title: 'Architecture layers', sub: strata(patterns) },\n ];\n\n // A services map only means something once a manifest declared some.\n if (manifest?.services?.length) {\n specs.push({\n kind: 'services', path: '', title: 'Services',\n sub: `${manifest.services.length} declared`,\n });\n }\n\n const counts = new Map();\n for (const f of scan.files) counts.set(f.dir, (counts.get(f.dir) || 0) + 1);\n for (const folder of [...counts.keys()].sort().slice(0, MAX_FOLDERS)) {\n specs.push({\n kind: 'folder', path: folder,\n title: (folder || '(repo root)') + '/',\n sub: plural(counts.get(folder), 'file'),\n });\n }\n\n const ranked = scan.files.slice()\n .sort((a, b) => (facts.fanIn[b.path] || 0) - (facts.fanIn[a.path] || 0)\n || a.path.localeCompare(b.path))\n .slice(0, MAX_FILES);\n for (const f of ranked) {\n specs.push({\n kind: 'file', path: f.path, title: f.path,\n sub: plural(facts.fanIn[f.path] || 0, 'dependent'),\n });\n }\n\n return specs;\n}\n\n// Draws one card. Called on open, so a card the reader never touches costs\n// nothing but its heading.\nexport function atlasDiagram(spec, { scan, facts, manifest, patterns }) {\n switch (spec.kind) {\n case 'overview': return overviewDiagram(scan, facts);\n case 'layers': return layersDiagram(scan, facts, patterns.layersInfo);\n case 'services': return servicesDiagram(scan, manifest);\n case 'file': return fileDetailDiagram(scan, facts, spec.path);\n default: return folderDiagram(scan, facts, spec.path);\n }\n}\n\n// The stage filters, applied to the catalogue. Matching is on the title so that\n// typing \"overview\" finds the overview card, which has no path of its own; the\n// tests toggle is by path, and only files have one worth testing.\nexport function filterAtlasItems(specs, { text = '', showTests = true }: Record<string, any> = {}) {\n const needle = text.trim().toLowerCase();\n if (!needle && showTests) return specs;\n return specs.filter((it) => {\n if (!showTests && it.kind === 'file' && isTestPath(it.path)) return false;\n return !needle || it.title.toLowerCase().includes(needle);\n });\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare function setDiagramTheme(theme: any): void;
|
|
2
|
+
export declare function getDiagramTheme(): string;
|
|
3
|
+
export declare function diagramThemeBlock(): string;
|
|
4
|
+
export declare function overviewDiagram(scan: any, facts: any): {
|
|
5
|
+
source: string;
|
|
6
|
+
nodes: Record<string, any>;
|
|
7
|
+
};
|
|
8
|
+
export declare function folderDiagram(scan: any, facts: any, folder: any, opts?: Record<string, any>): {
|
|
9
|
+
source: string;
|
|
10
|
+
nodes: {};
|
|
11
|
+
};
|
|
12
|
+
export declare function fileDetailDiagram(scan: any, facts: any, path: any): {
|
|
13
|
+
source: string;
|
|
14
|
+
nodes: {};
|
|
15
|
+
};
|
|
16
|
+
export declare function callsDiagram(file: any): {
|
|
17
|
+
source: string;
|
|
18
|
+
nodes: {};
|
|
19
|
+
};
|
|
20
|
+
export declare function servicesDiagram(scan: any, manifest: any): {
|
|
21
|
+
source: string;
|
|
22
|
+
nodes: {};
|
|
23
|
+
};
|
|
24
|
+
export declare function emptyDiagram(note: any): {
|
|
25
|
+
source: string;
|
|
26
|
+
nodes: {};
|
|
27
|
+
};
|
|
28
|
+
export declare function layersDiagram(scan: any, facts: any, layersInfo: any, opts?: Record<string, any>): {
|
|
29
|
+
source: string;
|
|
30
|
+
nodes: Record<string, any>;
|
|
31
|
+
};
|
|
32
|
+
export declare function healthDiagram(scan: any, facts: any, health: any, opts?: Record<string, any>): {
|
|
33
|
+
source: string;
|
|
34
|
+
nodes: Record<string, any>;
|
|
35
|
+
};
|
|
36
|
+
export declare function securityDiagram(scan: any, facts: any, security: any, opts?: Record<string, any>): {
|
|
37
|
+
source: string;
|
|
38
|
+
nodes: Record<string, any>;
|
|
39
|
+
};
|
|
40
|
+
export declare function historyDiagram(scan: any, facts: any, history: any, opts?: Record<string, any>): {
|
|
41
|
+
source: string;
|
|
42
|
+
nodes: {};
|
|
43
|
+
};
|