@vpxa/aikit 0.1.58 → 0.1.60
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 +38 -3
- package/package.json +2 -1
- package/packages/aikit-client/dist/index.d.ts +146 -4
- package/packages/aikit-client/dist/index.js +5 -1
- package/packages/analyzers/dist/index.d.ts +309 -11
- package/packages/analyzers/dist/index.js +54 -1
- package/packages/chunker/dist/index.d.ts +451 -18
- package/packages/chunker/dist/index.js +24 -1
- package/packages/cli/dist/{commands/init/constants.js → constants-D3v4VDf0.js} +1 -1
- package/packages/cli/dist/index.js +15 -2
- package/packages/cli/dist/init-D0CiV9PX.js +7 -0
- package/packages/cli/dist/scaffold-CJwkHf-q.js +2 -0
- package/packages/cli/dist/{commands/init/templates.js → templates-DJ7EC5vw.js} +1 -1
- package/packages/cli/dist/user-HmJYNt5b.js +5 -0
- package/packages/core/dist/index.d.ts +357 -6
- package/packages/core/dist/index.js +1 -1
- package/packages/dashboard/dist/assets/{index-Cdke3KDK.js → index-C6D-PCp0.js} +7 -7
- package/packages/dashboard/dist/assets/index-C6D-PCp0.js.map +1 -0
- package/packages/dashboard/dist/index.html +1 -1
- package/packages/elicitation/dist/index.d.ts +139 -4
- package/packages/elicitation/dist/index.js +1 -1
- package/packages/embeddings/dist/index.d.ts +45 -2
- package/packages/embeddings/dist/index.js +1 -1
- package/packages/enterprise-bridge/dist/index.d.ts +275 -7
- package/packages/enterprise-bridge/dist/index.js +1 -1
- package/packages/flows/dist/index.d.ts +345 -12
- package/packages/flows/dist/index.js +15 -1
- package/packages/indexer/dist/index.d.ts +196 -6
- package/packages/indexer/dist/index.js +1 -1
- package/packages/present/dist/index.html +315 -314
- package/packages/server/dist/curated-manager-DX-_oJg0.js +5 -0
- package/packages/server/dist/index.d.ts +139 -1
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/server-eMZ64H9b.js +1274 -0
- package/packages/store/dist/index.d.ts +316 -5
- package/packages/store/dist/index.js +90 -1
- package/packages/store/dist/lance-store-jdHZp-V4.js +1 -0
- package/packages/tools/dist/index.d.ts +2161 -61
- package/packages/tools/dist/index.js +117 -1
- package/packages/tui/dist/{App-CoMyn2kt.js → App-DobfqTPH.js} +1 -1
- package/packages/tui/dist/App.d.ts +1 -1
- package/packages/tui/dist/App.js +1 -1
- package/packages/tui/dist/{LogPanel-CDItCD0E.js → LogPanel-DGeptKim.js} +3 -3
- package/packages/tui/dist/hooks/useKBClient.d.ts +1 -1
- package/packages/tui/dist/{index-MXJeXmCf.d.ts → index-floZQwfo.d.ts} +2 -1
- package/packages/tui/dist/index.d.ts +1 -1
- package/packages/tui/dist/index.js +1 -1
- package/packages/tui/dist/panels/LogPanel.js +1 -1
- package/scaffold/definitions/bodies.mjs +47 -0
- package/scaffold/definitions/protocols.mjs +9 -0
- package/scaffold/definitions/tools.mjs +15 -0
- package/scaffold/general/agents/Debugger.agent.md +9 -0
- package/scaffold/general/agents/Documenter.agent.md +9 -0
- package/scaffold/general/agents/Frontend.agent.md +9 -0
- package/scaffold/general/agents/Implementer.agent.md +9 -0
- package/scaffold/general/agents/Orchestrator.agent.md +47 -0
- package/scaffold/general/agents/Planner.agent.md +9 -0
- package/scaffold/general/agents/Refactor.agent.md +9 -0
- package/scaffold/general/agents/Security.agent.md +9 -0
- package/scaffold/general/agents/_shared/code-agent-base.md +9 -0
- package/scaffold/general/skills/aikit/SKILL.md +71 -7
- package/scaffold/general/skills/c4-architecture/SKILL.md +87 -1
- package/scaffold/general/skills/c4-architecture/references/html-design-system.md +337 -0
- package/scaffold/general/skills/c4-architecture/references/html-template.html +627 -0
- package/scaffold/general/skills/present/SKILL.md +180 -0
- package/packages/aikit-client/dist/direct-client.d.ts +0 -37
- package/packages/aikit-client/dist/direct-client.js +0 -1
- package/packages/aikit-client/dist/mcp-client.d.ts +0 -19
- package/packages/aikit-client/dist/mcp-client.js +0 -4
- package/packages/aikit-client/dist/parsers.d.ts +0 -35
- package/packages/aikit-client/dist/parsers.js +0 -2
- package/packages/aikit-client/dist/types.d.ts +0 -62
- package/packages/aikit-client/dist/types.js +0 -1
- package/packages/analyzers/dist/blast-radius-analyzer.d.ts +0 -19
- package/packages/analyzers/dist/blast-radius-analyzer.js +0 -6
- package/packages/analyzers/dist/dependency-analyzer.d.ts +0 -32
- package/packages/analyzers/dist/dependency-analyzer.js +0 -8
- package/packages/analyzers/dist/diagram-generator.d.ts +0 -16
- package/packages/analyzers/dist/diagram-generator.js +0 -2
- package/packages/analyzers/dist/entry-point-analyzer.d.ts +0 -40
- package/packages/analyzers/dist/entry-point-analyzer.js +0 -4
- package/packages/analyzers/dist/knowledge-producer.d.ts +0 -40
- package/packages/analyzers/dist/knowledge-producer.js +0 -26
- package/packages/analyzers/dist/pattern-analyzer.d.ts +0 -15
- package/packages/analyzers/dist/pattern-analyzer.js +0 -2
- package/packages/analyzers/dist/regex-call-graph.d.ts +0 -10
- package/packages/analyzers/dist/regex-call-graph.js +0 -1
- package/packages/analyzers/dist/structure-analyzer.d.ts +0 -19
- package/packages/analyzers/dist/structure-analyzer.js +0 -4
- package/packages/analyzers/dist/symbol-analyzer.d.ts +0 -14
- package/packages/analyzers/dist/symbol-analyzer.js +0 -9
- package/packages/analyzers/dist/ts-call-graph.d.ts +0 -29
- package/packages/analyzers/dist/ts-call-graph.js +0 -1
- package/packages/analyzers/dist/types.d.ts +0 -110
- package/packages/analyzers/dist/types.js +0 -1
- package/packages/chunker/dist/call-graph-extractor.d.ts +0 -25
- package/packages/chunker/dist/call-graph-extractor.js +0 -1
- package/packages/chunker/dist/chunker-factory.d.ts +0 -19
- package/packages/chunker/dist/chunker-factory.js +0 -1
- package/packages/chunker/dist/chunker.interface.d.ts +0 -13
- package/packages/chunker/dist/chunker.interface.js +0 -1
- package/packages/chunker/dist/code-chunker.d.ts +0 -17
- package/packages/chunker/dist/code-chunker.js +0 -11
- package/packages/chunker/dist/extractors/call-extractor.d.ts +0 -24
- package/packages/chunker/dist/extractors/call-extractor.js +0 -1
- package/packages/chunker/dist/extractors/entry-point-detector.d.ts +0 -14
- package/packages/chunker/dist/extractors/entry-point-detector.js +0 -1
- package/packages/chunker/dist/extractors/import-extractor.d.ts +0 -14
- package/packages/chunker/dist/extractors/import-extractor.js +0 -1
- package/packages/chunker/dist/extractors/pattern-detector.d.ts +0 -14
- package/packages/chunker/dist/extractors/pattern-detector.js +0 -1
- package/packages/chunker/dist/extractors/scope-resolver.d.ts +0 -26
- package/packages/chunker/dist/extractors/scope-resolver.js +0 -1
- package/packages/chunker/dist/extractors/symbol-extractor.d.ts +0 -14
- package/packages/chunker/dist/extractors/symbol-extractor.js +0 -3
- package/packages/chunker/dist/extractors/types.d.ts +0 -44
- package/packages/chunker/dist/extractors/types.js +0 -1
- package/packages/chunker/dist/generic-chunker.d.ts +0 -15
- package/packages/chunker/dist/generic-chunker.js +0 -5
- package/packages/chunker/dist/markdown-chunker.d.ts +0 -17
- package/packages/chunker/dist/markdown-chunker.js +0 -3
- package/packages/chunker/dist/wasm/languages.d.ts +0 -18
- package/packages/chunker/dist/wasm/languages.js +0 -1
- package/packages/chunker/dist/wasm/query-executor.d.ts +0 -70
- package/packages/chunker/dist/wasm/query-executor.js +0 -1
- package/packages/chunker/dist/wasm/runtime.d.ts +0 -44
- package/packages/chunker/dist/wasm/runtime.js +0 -1
- package/packages/chunker/dist/wasm/types.d.ts +0 -84
- package/packages/chunker/dist/wasm/types.js +0 -1
- package/packages/chunker/dist/wasm-chunker.d.ts +0 -23
- package/packages/chunker/dist/wasm-chunker.js +0 -6
- package/packages/cli/dist/aikit-init.d.ts +0 -59
- package/packages/cli/dist/aikit-init.js +0 -1
- package/packages/cli/dist/commands/analyze.d.ts +0 -6
- package/packages/cli/dist/commands/analyze.js +0 -2
- package/packages/cli/dist/commands/context-cmds.d.ts +0 -6
- package/packages/cli/dist/commands/context-cmds.js +0 -1
- package/packages/cli/dist/commands/environment.d.ts +0 -6
- package/packages/cli/dist/commands/environment.js +0 -1
- package/packages/cli/dist/commands/execution.d.ts +0 -6
- package/packages/cli/dist/commands/execution.js +0 -1
- package/packages/cli/dist/commands/flow.d.ts +0 -6
- package/packages/cli/dist/commands/flow.js +0 -1
- package/packages/cli/dist/commands/graph.d.ts +0 -6
- package/packages/cli/dist/commands/graph.js +0 -6
- package/packages/cli/dist/commands/init/adapters.d.ts +0 -28
- package/packages/cli/dist/commands/init/adapters.js +0 -1
- package/packages/cli/dist/commands/init/config.d.ts +0 -10
- package/packages/cli/dist/commands/init/config.js +0 -3
- package/packages/cli/dist/commands/init/constants.d.ts +0 -46
- package/packages/cli/dist/commands/init/curated.d.ts +0 -7
- package/packages/cli/dist/commands/init/curated.js +0 -1
- package/packages/cli/dist/commands/init/frontmatter.d.ts +0 -79
- package/packages/cli/dist/commands/init/frontmatter.js +0 -2
- package/packages/cli/dist/commands/init/index.d.ts +0 -36
- package/packages/cli/dist/commands/init/index.js +0 -5
- package/packages/cli/dist/commands/init/manifest.d.ts +0 -72
- package/packages/cli/dist/commands/init/manifest.js +0 -1
- package/packages/cli/dist/commands/init/scaffold.d.ts +0 -58
- package/packages/cli/dist/commands/init/scaffold.js +0 -1
- package/packages/cli/dist/commands/init/templates.d.ts +0 -9
- package/packages/cli/dist/commands/init/user.d.ts +0 -61
- package/packages/cli/dist/commands/init/user.js +0 -5
- package/packages/cli/dist/commands/knowledge.d.ts +0 -6
- package/packages/cli/dist/commands/knowledge.js +0 -1
- package/packages/cli/dist/commands/search.d.ts +0 -6
- package/packages/cli/dist/commands/search.js +0 -1
- package/packages/cli/dist/commands/system.d.ts +0 -6
- package/packages/cli/dist/commands/system.js +0 -4
- package/packages/cli/dist/commands/upgrade.d.ts +0 -6
- package/packages/cli/dist/commands/upgrade.js +0 -1
- package/packages/cli/dist/commands/workspace.d.ts +0 -6
- package/packages/cli/dist/commands/workspace.js +0 -1
- package/packages/cli/dist/context.d.ts +0 -7
- package/packages/cli/dist/context.js +0 -1
- package/packages/cli/dist/helpers.d.ts +0 -55
- package/packages/cli/dist/helpers.js +0 -5
- package/packages/cli/dist/types.d.ts +0 -9
- package/packages/cli/dist/types.js +0 -1
- package/packages/core/dist/constants.d.ts +0 -74
- package/packages/core/dist/constants.js +0 -1
- package/packages/core/dist/content-detector.d.ts +0 -13
- package/packages/core/dist/content-detector.js +0 -1
- package/packages/core/dist/errors.d.ts +0 -20
- package/packages/core/dist/errors.js +0 -1
- package/packages/core/dist/global-registry.d.ts +0 -69
- package/packages/core/dist/global-registry.js +0 -1
- package/packages/core/dist/logger.d.ts +0 -32
- package/packages/core/dist/logger.js +0 -1
- package/packages/core/dist/types.d.ts +0 -149
- package/packages/core/dist/types.js +0 -1
- package/packages/dashboard/dist/assets/index-Cdke3KDK.js.map +0 -1
- package/packages/elicitation/dist/build.d.ts +0 -14
- package/packages/elicitation/dist/build.js +0 -1
- package/packages/elicitation/dist/fields.d.ts +0 -32
- package/packages/elicitation/dist/fields.js +0 -1
- package/packages/elicitation/dist/normalize.d.ts +0 -15
- package/packages/elicitation/dist/normalize.js +0 -1
- package/packages/elicitation/dist/types.d.ts +0 -88
- package/packages/elicitation/dist/types.js +0 -1
- package/packages/embeddings/dist/embedder.interface.d.ts +0 -26
- package/packages/embeddings/dist/embedder.interface.js +0 -1
- package/packages/embeddings/dist/onnx-embedder.d.ts +0 -23
- package/packages/embeddings/dist/onnx-embedder.js +0 -1
- package/packages/enterprise-bridge/dist/cache.d.ts +0 -28
- package/packages/enterprise-bridge/dist/cache.js +0 -1
- package/packages/enterprise-bridge/dist/er-client.d.ts +0 -37
- package/packages/enterprise-bridge/dist/er-client.js +0 -1
- package/packages/enterprise-bridge/dist/evolution-collector.d.ts +0 -62
- package/packages/enterprise-bridge/dist/evolution-collector.js +0 -1
- package/packages/enterprise-bridge/dist/policy-store.d.ts +0 -45
- package/packages/enterprise-bridge/dist/policy-store.js +0 -1
- package/packages/enterprise-bridge/dist/push-adapter.d.ts +0 -23
- package/packages/enterprise-bridge/dist/push-adapter.js +0 -1
- package/packages/enterprise-bridge/dist/result-merger.d.ts +0 -14
- package/packages/enterprise-bridge/dist/result-merger.js +0 -1
- package/packages/enterprise-bridge/dist/types.d.ts +0 -81
- package/packages/enterprise-bridge/dist/types.js +0 -1
- package/packages/flows/dist/adapters/claude-plugin.d.ts +0 -25
- package/packages/flows/dist/adapters/claude-plugin.js +0 -3
- package/packages/flows/dist/adapters/copilot.d.ts +0 -12
- package/packages/flows/dist/adapters/copilot.js +0 -1
- package/packages/flows/dist/adapters/index.d.ts +0 -12
- package/packages/flows/dist/adapters/index.js +0 -1
- package/packages/flows/dist/adapters/native.d.ts +0 -10
- package/packages/flows/dist/adapters/native.js +0 -1
- package/packages/flows/dist/adapters/openspec.d.ts +0 -40
- package/packages/flows/dist/adapters/openspec.js +0 -1
- package/packages/flows/dist/builtins.d.ts +0 -16
- package/packages/flows/dist/builtins.js +0 -1
- package/packages/flows/dist/foundation.d.ts +0 -20
- package/packages/flows/dist/foundation.js +0 -11
- package/packages/flows/dist/git.d.ts +0 -53
- package/packages/flows/dist/git.js +0 -2
- package/packages/flows/dist/loader.d.ts +0 -13
- package/packages/flows/dist/loader.js +0 -2
- package/packages/flows/dist/registry.d.ts +0 -23
- package/packages/flows/dist/registry.js +0 -1
- package/packages/flows/dist/state-machine.d.ts +0 -23
- package/packages/flows/dist/state-machine.js +0 -1
- package/packages/flows/dist/symlinks.d.ts +0 -17
- package/packages/flows/dist/symlinks.js +0 -1
- package/packages/flows/dist/types.d.ts +0 -127
- package/packages/flows/dist/types.js +0 -1
- package/packages/indexer/dist/file-hasher.d.ts +0 -13
- package/packages/indexer/dist/file-hasher.js +0 -1
- package/packages/indexer/dist/filesystem-crawler.d.ts +0 -29
- package/packages/indexer/dist/filesystem-crawler.js +0 -1
- package/packages/indexer/dist/graph-extractor.d.ts +0 -22
- package/packages/indexer/dist/graph-extractor.js +0 -1
- package/packages/indexer/dist/hash-cache.d.ts +0 -24
- package/packages/indexer/dist/hash-cache.js +0 -1
- package/packages/indexer/dist/incremental-indexer.d.ts +0 -73
- package/packages/indexer/dist/incremental-indexer.js +0 -1
- package/packages/indexer/dist/smart-index-scheduler.d.ts +0 -47
- package/packages/indexer/dist/smart-index-scheduler.js +0 -1
- package/packages/server/dist/api.d.ts +0 -3
- package/packages/server/dist/api.js +0 -1
- package/packages/server/dist/auto-gc.d.ts +0 -30
- package/packages/server/dist/auto-gc.js +0 -1
- package/packages/server/dist/background-task.d.ts +0 -47
- package/packages/server/dist/background-task.js +0 -1
- package/packages/server/dist/completions.d.ts +0 -14
- package/packages/server/dist/completions.js +0 -1
- package/packages/server/dist/compression-interceptor.d.ts +0 -12
- package/packages/server/dist/compression-interceptor.js +0 -1
- package/packages/server/dist/config.d.ts +0 -16
- package/packages/server/dist/cross-workspace.d.ts +0 -43
- package/packages/server/dist/cross-workspace.js +0 -1
- package/packages/server/dist/curated-manager.d.ts +0 -92
- package/packages/server/dist/curated-manager.js +0 -5
- package/packages/server/dist/dashboard-static.d.ts +0 -27
- package/packages/server/dist/elicitor.d.ts +0 -18
- package/packages/server/dist/elicitor.js +0 -1
- package/packages/server/dist/idle-timer.d.ts +0 -33
- package/packages/server/dist/idle-timer.js +0 -1
- package/packages/server/dist/mcp-logging.d.ts +0 -11
- package/packages/server/dist/mcp-logging.js +0 -1
- package/packages/server/dist/memory-monitor.d.ts +0 -37
- package/packages/server/dist/memory-monitor.js +0 -1
- package/packages/server/dist/output-schemas.d.ts +0 -244
- package/packages/server/dist/output-schemas.js +0 -1
- package/packages/server/dist/prompts.d.ts +0 -13
- package/packages/server/dist/prompts.js +0 -13
- package/packages/server/dist/replay-interceptor.d.ts +0 -23
- package/packages/server/dist/replay-interceptor.js +0 -1
- package/packages/server/dist/resource-links.d.ts +0 -34
- package/packages/server/dist/resource-links.js +0 -1
- package/packages/server/dist/resources/curated-resources.d.ts +0 -13
- package/packages/server/dist/resources/curated-resources.js +0 -2
- package/packages/server/dist/resources/resource-notifier.d.ts +0 -45
- package/packages/server/dist/resources/resource-notifier.js +0 -1
- package/packages/server/dist/resources/resources.d.ts +0 -8
- package/packages/server/dist/resources/resources.js +0 -2
- package/packages/server/dist/sampling.d.ts +0 -41
- package/packages/server/dist/sampling.js +0 -2
- package/packages/server/dist/server.d.ts +0 -63
- package/packages/server/dist/server.js +0 -3
- package/packages/server/dist/structured-content-guard.d.ts +0 -28
- package/packages/server/dist/structured-content-guard.js +0 -1
- package/packages/server/dist/task-manager.d.ts +0 -40
- package/packages/server/dist/task-manager.js +0 -1
- package/packages/server/dist/tool-metadata.d.ts +0 -38
- package/packages/server/dist/tool-metadata.js +0 -1
- package/packages/server/dist/tool-prefix.d.ts +0 -12
- package/packages/server/dist/tool-prefix.js +0 -1
- package/packages/server/dist/tool-timeout.d.ts +0 -27
- package/packages/server/dist/tool-timeout.js +0 -1
- package/packages/server/dist/tools/analyze.tools.d.ts +0 -14
- package/packages/server/dist/tools/analyze.tools.js +0 -8
- package/packages/server/dist/tools/audit.tool.d.ts +0 -8
- package/packages/server/dist/tools/audit.tool.js +0 -1
- package/packages/server/dist/tools/brainstorm.tool.d.ts +0 -7
- package/packages/server/dist/tools/brainstorm.tool.js +0 -9
- package/packages/server/dist/tools/bridge.tools.d.ts +0 -34
- package/packages/server/dist/tools/bridge.tools.js +0 -15
- package/packages/server/dist/tools/config.tool.d.ts +0 -8
- package/packages/server/dist/tools/config.tool.js +0 -12
- package/packages/server/dist/tools/context.tools.d.ts +0 -15
- package/packages/server/dist/tools/context.tools.js +0 -10
- package/packages/server/dist/tools/evolution.tools.d.ts +0 -7
- package/packages/server/dist/tools/evolution.tools.js +0 -5
- package/packages/server/dist/tools/execution.tools.d.ts +0 -14
- package/packages/server/dist/tools/execution.tools.js +0 -4
- package/packages/server/dist/tools/flow.tools.d.ts +0 -7
- package/packages/server/dist/tools/flow.tools.js +0 -16
- package/packages/server/dist/tools/forge.tools.d.ts +0 -13
- package/packages/server/dist/tools/forge.tools.js +0 -10
- package/packages/server/dist/tools/forget.tool.d.ts +0 -8
- package/packages/server/dist/tools/forget.tool.js +0 -1
- package/packages/server/dist/tools/graph.tool.d.ts +0 -7
- package/packages/server/dist/tools/graph.tool.js +0 -29
- package/packages/server/dist/tools/infra.tools.d.ts +0 -10
- package/packages/server/dist/tools/infra.tools.js +0 -5
- package/packages/server/dist/tools/list.tool.d.ts +0 -7
- package/packages/server/dist/tools/list.tool.js +0 -2
- package/packages/server/dist/tools/lookup.tool.d.ts +0 -7
- package/packages/server/dist/tools/lookup.tool.js +0 -3
- package/packages/server/dist/tools/manipulation.tools.d.ts +0 -10
- package/packages/server/dist/tools/manipulation.tools.js +0 -4
- package/packages/server/dist/tools/onboard.tool.d.ts +0 -12
- package/packages/server/dist/tools/onboard.tool.js +0 -2
- package/packages/server/dist/tools/persistence.tools.d.ts +0 -10
- package/packages/server/dist/tools/persistence.tools.js +0 -5
- package/packages/server/dist/tools/policy.tools.d.ts +0 -7
- package/packages/server/dist/tools/policy.tools.js +0 -3
- package/packages/server/dist/tools/present/browser.d.ts +0 -4
- package/packages/server/dist/tools/present/browser.js +0 -93
- package/packages/server/dist/tools/present/helpers.d.ts +0 -19
- package/packages/server/dist/tools/present/helpers.js +0 -16
- package/packages/server/dist/tools/present/html.d.ts +0 -18
- package/packages/server/dist/tools/present/html.js +0 -5
- package/packages/server/dist/tools/present/index.d.ts +0 -2
- package/packages/server/dist/tools/present/index.js +0 -1
- package/packages/server/dist/tools/present/markdown.d.ts +0 -32
- package/packages/server/dist/tools/present/markdown.js +0 -11
- package/packages/server/dist/tools/present/templates.d.ts +0 -14
- package/packages/server/dist/tools/present/templates.js +0 -472
- package/packages/server/dist/tools/present/tool.d.ts +0 -27
- package/packages/server/dist/tools/present/tool.js +0 -39
- package/packages/server/dist/tools/present-blocks.d.ts +0 -46
- package/packages/server/dist/tools/present-blocks.js +0 -27
- package/packages/server/dist/tools/present-charts.d.ts +0 -31
- package/packages/server/dist/tools/present-charts.js +0 -34
- package/packages/server/dist/tools/present-theme.d.ts +0 -14
- package/packages/server/dist/tools/present-theme.js +0 -396
- package/packages/server/dist/tools/present-utils.d.ts +0 -11
- package/packages/server/dist/tools/present-utils.js +0 -1
- package/packages/server/dist/tools/present.tool.d.ts +0 -2
- package/packages/server/dist/tools/present.tool.js +0 -1
- package/packages/server/dist/tools/produce.tool.d.ts +0 -7
- package/packages/server/dist/tools/produce.tool.js +0 -4
- package/packages/server/dist/tools/read.tool.d.ts +0 -7
- package/packages/server/dist/tools/read.tool.js +0 -2
- package/packages/server/dist/tools/reindex.tool.d.ts +0 -11
- package/packages/server/dist/tools/reindex.tool.js +0 -9
- package/packages/server/dist/tools/remember.tool.d.ts +0 -9
- package/packages/server/dist/tools/remember.tool.js +0 -4
- package/packages/server/dist/tools/replay.tool.d.ts +0 -6
- package/packages/server/dist/tools/replay.tool.js +0 -3
- package/packages/server/dist/tools/restore.tool.d.ts +0 -6
- package/packages/server/dist/tools/restore.tool.js +0 -3
- package/packages/server/dist/tools/search.tool.d.ts +0 -11
- package/packages/server/dist/tools/search.tool.js +0 -10
- package/packages/server/dist/tools/status.tool.d.ts +0 -28
- package/packages/server/dist/tools/status.tool.js +0 -3
- package/packages/server/dist/tools/update.tool.d.ts +0 -8
- package/packages/server/dist/tools/update.tool.js +0 -1
- package/packages/server/dist/tools/utility.tools.d.ts +0 -15
- package/packages/server/dist/tools/utility.tools.js +0 -13
- package/packages/server/dist/version-check.d.ts +0 -32
- package/packages/store/dist/graph-store.interface.d.ts +0 -159
- package/packages/store/dist/graph-store.interface.js +0 -1
- package/packages/store/dist/lance-store.d.ts +0 -46
- package/packages/store/dist/lance-store.js +0 -1
- package/packages/store/dist/sqlite-graph-store.d.ts +0 -57
- package/packages/store/dist/sqlite-graph-store.js +0 -90
- package/packages/store/dist/store-factory.d.ts +0 -12
- package/packages/store/dist/store-factory.js +0 -1
- package/packages/store/dist/store.interface.d.ts +0 -54
- package/packages/store/dist/store.interface.js +0 -1
- package/packages/tools/dist/audit.d.ts +0 -65
- package/packages/tools/dist/audit.js +0 -6
- package/packages/tools/dist/batch.d.ts +0 -23
- package/packages/tools/dist/batch.js +0 -1
- package/packages/tools/dist/changelog.d.ts +0 -36
- package/packages/tools/dist/changelog.js +0 -2
- package/packages/tools/dist/check.d.ts +0 -48
- package/packages/tools/dist/check.js +0 -2
- package/packages/tools/dist/checkpoint.d.ts +0 -19
- package/packages/tools/dist/checkpoint.js +0 -1
- package/packages/tools/dist/codemod.d.ts +0 -39
- package/packages/tools/dist/codemod.js +0 -2
- package/packages/tools/dist/compact.d.ts +0 -47
- package/packages/tools/dist/compact.js +0 -3
- package/packages/tools/dist/compress-output.d.ts +0 -38
- package/packages/tools/dist/compress-output.js +0 -1
- package/packages/tools/dist/compression/delta-cache.d.ts +0 -29
- package/packages/tools/dist/compression/delta-cache.js +0 -1
- package/packages/tools/dist/compression/engine.d.ts +0 -34
- package/packages/tools/dist/compression/engine.js +0 -4
- package/packages/tools/dist/compression/litm.d.ts +0 -20
- package/packages/tools/dist/compression/litm.js +0 -1
- package/packages/tools/dist/compression/mmr.d.ts +0 -24
- package/packages/tools/dist/compression/mmr.js +0 -1
- package/packages/tools/dist/compression/rules/docker.d.ts +0 -11
- package/packages/tools/dist/compression/rules/docker.js +0 -3
- package/packages/tools/dist/compression/rules/generic.d.ts +0 -11
- package/packages/tools/dist/compression/rules/generic.js +0 -3
- package/packages/tools/dist/compression/rules/git.d.ts +0 -11
- package/packages/tools/dist/compression/rules/git.js +0 -3
- package/packages/tools/dist/compression/rules/index.d.ts +0 -14
- package/packages/tools/dist/compression/rules/index.js +0 -1
- package/packages/tools/dist/compression/rules/kubectl.d.ts +0 -11
- package/packages/tools/dist/compression/rules/kubectl.js +0 -3
- package/packages/tools/dist/compression/rules/lint.d.ts +0 -11
- package/packages/tools/dist/compression/rules/lint.js +0 -3
- package/packages/tools/dist/compression/rules/npm.d.ts +0 -11
- package/packages/tools/dist/compression/rules/npm.js +0 -3
- package/packages/tools/dist/compression/rules/test-runner.d.ts +0 -11
- package/packages/tools/dist/compression/rules/test-runner.js +0 -3
- package/packages/tools/dist/compression/scoring.d.ts +0 -26
- package/packages/tools/dist/compression/scoring.js +0 -1
- package/packages/tools/dist/compression/types.d.ts +0 -61
- package/packages/tools/dist/compression/types.js +0 -1
- package/packages/tools/dist/config-extractor.d.ts +0 -9
- package/packages/tools/dist/config-extractor.js +0 -7
- package/packages/tools/dist/data-transform.d.ts +0 -12
- package/packages/tools/dist/data-transform.js +0 -1
- package/packages/tools/dist/dead-symbols.d.ts +0 -28
- package/packages/tools/dist/dead-symbols.js +0 -2
- package/packages/tools/dist/delegate.d.ts +0 -36
- package/packages/tools/dist/delegate.js +0 -1
- package/packages/tools/dist/diagram-builder.d.ts +0 -9
- package/packages/tools/dist/diagram-builder.js +0 -9
- package/packages/tools/dist/diff-parse.d.ts +0 -28
- package/packages/tools/dist/diff-parse.js +0 -3
- package/packages/tools/dist/digest.d.ts +0 -55
- package/packages/tools/dist/digest.js +0 -6
- package/packages/tools/dist/dogfood-log.d.ts +0 -49
- package/packages/tools/dist/dogfood-log.js +0 -2
- package/packages/tools/dist/encode.d.ts +0 -16
- package/packages/tools/dist/encode.js +0 -1
- package/packages/tools/dist/env-info.d.ts +0 -30
- package/packages/tools/dist/env-info.js +0 -1
- package/packages/tools/dist/eval.d.ts +0 -15
- package/packages/tools/dist/eval.js +0 -2
- package/packages/tools/dist/evidence-map.d.ts +0 -92
- package/packages/tools/dist/evidence-map.js +0 -2
- package/packages/tools/dist/file-cache.d.ts +0 -41
- package/packages/tools/dist/file-cache.js +0 -3
- package/packages/tools/dist/file-summary.d.ts +0 -52
- package/packages/tools/dist/file-summary.js +0 -2
- package/packages/tools/dist/file-walk.d.ts +0 -6
- package/packages/tools/dist/file-walk.js +0 -1
- package/packages/tools/dist/find-examples.d.ts +0 -29
- package/packages/tools/dist/find-examples.js +0 -3
- package/packages/tools/dist/find.d.ts +0 -49
- package/packages/tools/dist/find.js +0 -1
- package/packages/tools/dist/forge-classify.d.ts +0 -44
- package/packages/tools/dist/forge-classify.js +0 -2
- package/packages/tools/dist/forge-ground.d.ts +0 -61
- package/packages/tools/dist/forge-ground.js +0 -1
- package/packages/tools/dist/git-context.d.ts +0 -25
- package/packages/tools/dist/git-context.js +0 -3
- package/packages/tools/dist/graph-query.d.ts +0 -98
- package/packages/tools/dist/graph-query.js +0 -1
- package/packages/tools/dist/guide.d.ts +0 -25
- package/packages/tools/dist/guide.js +0 -1
- package/packages/tools/dist/health.d.ts +0 -16
- package/packages/tools/dist/health.js +0 -2
- package/packages/tools/dist/http-request.d.ts +0 -25
- package/packages/tools/dist/http-request.js +0 -1
- package/packages/tools/dist/lane.d.ts +0 -41
- package/packages/tools/dist/lane.js +0 -6
- package/packages/tools/dist/measure.d.ts +0 -42
- package/packages/tools/dist/measure.js +0 -2
- package/packages/tools/dist/onboard-utils.d.ts +0 -12
- package/packages/tools/dist/onboard-utils.js +0 -1
- package/packages/tools/dist/onboard.d.ts +0 -50
- package/packages/tools/dist/onboard.js +0 -18
- package/packages/tools/dist/parse-output.d.ts +0 -84
- package/packages/tools/dist/parse-output.js +0 -2
- package/packages/tools/dist/path-resolver.d.ts +0 -14
- package/packages/tools/dist/path-resolver.js +0 -1
- package/packages/tools/dist/process-manager.d.ts +0 -20
- package/packages/tools/dist/process-manager.js +0 -1
- package/packages/tools/dist/queue.d.ts +0 -40
- package/packages/tools/dist/queue.js +0 -1
- package/packages/tools/dist/regex-test.d.ts +0 -33
- package/packages/tools/dist/regex-test.js +0 -1
- package/packages/tools/dist/regex-utils.d.ts +0 -8
- package/packages/tools/dist/regex-utils.js +0 -1
- package/packages/tools/dist/rename.d.ts +0 -31
- package/packages/tools/dist/rename.js +0 -2
- package/packages/tools/dist/replay.d.ts +0 -59
- package/packages/tools/dist/replay.js +0 -4
- package/packages/tools/dist/response-envelope.d.ts +0 -43
- package/packages/tools/dist/response-envelope.js +0 -1
- package/packages/tools/dist/restore-points.d.ts +0 -22
- package/packages/tools/dist/restore-points.js +0 -1
- package/packages/tools/dist/schema-validate.d.ts +0 -25
- package/packages/tools/dist/schema-validate.js +0 -1
- package/packages/tools/dist/scope-map.d.ts +0 -51
- package/packages/tools/dist/scope-map.js +0 -1
- package/packages/tools/dist/snippet.d.ts +0 -35
- package/packages/tools/dist/snippet.js +0 -1
- package/packages/tools/dist/stash.d.ts +0 -14
- package/packages/tools/dist/stash.js +0 -1
- package/packages/tools/dist/stratum-card.d.ts +0 -30
- package/packages/tools/dist/stratum-card.js +0 -4
- package/packages/tools/dist/symbol.d.ts +0 -45
- package/packages/tools/dist/symbol.js +0 -3
- package/packages/tools/dist/synthesis-engine.d.ts +0 -13
- package/packages/tools/dist/synthesis-engine.js +0 -6
- package/packages/tools/dist/test-run.d.ts +0 -28
- package/packages/tools/dist/test-run.js +0 -2
- package/packages/tools/dist/text-utils.d.ts +0 -24
- package/packages/tools/dist/text-utils.js +0 -2
- package/packages/tools/dist/time-utils.d.ts +0 -20
- package/packages/tools/dist/time-utils.js +0 -1
- package/packages/tools/dist/trace.d.ts +0 -43
- package/packages/tools/dist/trace.js +0 -2
- package/packages/tools/dist/truncation.d.ts +0 -66
- package/packages/tools/dist/truncation.js +0 -11
- package/packages/tools/dist/watch.d.ts +0 -32
- package/packages/tools/dist/watch.js +0 -1
- package/packages/tools/dist/web-fetch.d.ts +0 -47
- package/packages/tools/dist/web-fetch.js +0 -8
- package/packages/tools/dist/web-search.d.ts +0 -25
- package/packages/tools/dist/web-search.js +0 -1
- package/packages/tools/dist/workset.d.ts +0 -47
- package/packages/tools/dist/workset.js +0 -1
- package/scaffold/__tests__/copilot-inline-shared-protocols.test.mjs +0 -39
- /package/packages/server/dist/{config.js → config-C5IU9Lau.js} +0 -0
- /package/packages/server/dist/{dashboard-static.js → dashboard-static-BfIe0Si1.js} +0 -0
- /package/packages/server/dist/{version-check.js → version-check-D4j0Pykd.js} +0 -0
|
@@ -162,6 +162,154 @@ The dashboard uses a professional dark theme:
|
|
|
162
162
|
|
|
163
163
|
---
|
|
164
164
|
|
|
165
|
+
## Architecture Diagrams
|
|
166
|
+
|
|
167
|
+
> **Behavioral rule:** When asked to present, visualize, or display system architecture, infrastructure, or service topology — **always load the `c4-architecture` skill** and use its HTML/SVG format (Method 2 below) for rich visual output via `present`. The Mermaid method (Method 1) is acceptable only for quick in-chat previews or when the user explicitly asks for Mermaid. Default to HTML/SVG for all architecture presentations.
|
|
168
|
+
|
|
169
|
+
The `present` tool can render C4-style architecture diagrams in both `html` and `browser` formats. The visual design system is centralized in the `c4-architecture` skill's reference file — load that skill for the full type registry, color palette, and template.
|
|
170
|
+
|
|
171
|
+
**Design system source:** `c4-architecture/references/html-design-system.md` (single source of truth for all architecture diagram styling)
|
|
172
|
+
|
|
173
|
+
### When to Use (Auto-Trigger)
|
|
174
|
+
|
|
175
|
+
Load the `c4-architecture` skill and use HTML/SVG format when the user:
|
|
176
|
+
- Asks to "show architecture", "present the system design", "visualize infrastructure"
|
|
177
|
+
- Wants to display service topology, deployment layout, or component relationships
|
|
178
|
+
- Requests architecture review output, system overview dashboards, or technical presentations
|
|
179
|
+
- Uses words like "architecture diagram", "system diagram", "infrastructure diagram"
|
|
180
|
+
|
|
181
|
+
### Rendering Methods
|
|
182
|
+
|
|
183
|
+
| Method | Block Type | Format | When to Use |
|
|
184
|
+
|--------|-----------|--------|-------------|
|
|
185
|
+
| Mermaid C4 | `mermaid` | html / browser | Quick diagrams, developer-focused, version-controlled |
|
|
186
|
+
| HTML/SVG | `markdown` | html / browser | Rich visual presentations, stakeholder reviews, dark-themed dashboards |
|
|
187
|
+
|
|
188
|
+
### Method 1: Mermaid C4 Diagrams
|
|
189
|
+
|
|
190
|
+
Use a `mermaid` content block with standard C4 Mermaid syntax:
|
|
191
|
+
|
|
192
|
+
present({
|
|
193
|
+
format: "html", // or "browser"
|
|
194
|
+
title: "System Architecture",
|
|
195
|
+
content: [
|
|
196
|
+
{
|
|
197
|
+
type: "mermaid",
|
|
198
|
+
title: "C4 Container Diagram",
|
|
199
|
+
value: `C4Container
|
|
200
|
+
title Container Diagram - Payment System
|
|
201
|
+
|
|
202
|
+
Person(user, "Customer", "Places orders")
|
|
203
|
+
|
|
204
|
+
Container_Boundary(app, "Payment Platform") {
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Rendering Troubleshooting
|
|
209
|
+
|
|
210
|
+
### Why `html` format sometimes shows raw text
|
|
211
|
+
|
|
212
|
+
The `html` format renders content inside an MCP Apps companion iframe (UIResource). The chat text fallback is intentionally minimal (just the title). When the UIResource fails to load, the user sees only the title or raw JSON — NOT the rendered dashboard.
|
|
213
|
+
|
|
214
|
+
**Common causes of UIResource rendering failure:**
|
|
215
|
+
1. **MCP Apps not enabled** — The setting `chat.mcp.apps.enabled` must be `true` in VS Code settings
|
|
216
|
+
2. **Companion app build missing** — The `packages/present` companion app must be built (`npm run build`)
|
|
217
|
+
3. **Content too large** — Very large content arrays (20+ blocks or tables with 50+ rows) may cause the companion iframe to fail silently
|
|
218
|
+
4. **Iframe loading error** — Network issues, CSP restrictions, or extension conflicts can prevent the iframe from loading
|
|
219
|
+
|
|
220
|
+
### When to prefer `browser` over `html`
|
|
221
|
+
|
|
222
|
+
Use `format: "browser"` instead of `html` when:
|
|
223
|
+
- Content has **10+ blocks** or tables with **20+ rows** (large payloads are more reliable in browser)
|
|
224
|
+
- The output must be **guaranteed visible** (browser format always opens, no silent failures)
|
|
225
|
+
- You need **charts + tables + markdown** in the same view (browser renders all block types reliably)
|
|
226
|
+
- The user reports that `html` format "didn't show anything" or "showed raw text"
|
|
227
|
+
|
|
228
|
+
> **Reliability rule:** If content is complex (5+ blocks of mixed types), prefer `format: "browser"` for guaranteed rendering. The `html` format is best for simple, single-block content.
|
|
229
|
+
|
|
230
|
+
### Content formatting tips to avoid rendering issues
|
|
231
|
+
|
|
232
|
+
1. **Use `table` block type** instead of markdown tables inside `markdown` blocks — `table` blocks render natively; markdown pipe-tables may show as raw text in fallback
|
|
233
|
+
2. **Use `cards` and `metrics`** for summary data instead of embedding it in markdown text
|
|
234
|
+
3. **Keep `markdown` blocks for narrative text only** — don't embed HTML, tables, or complex formatting
|
|
235
|
+
4. **Split large content** into multiple smaller `present` calls rather than one massive content array
|
|
236
|
+
5. **For charts:** Always use ChartValue format (`chartType`, `data`, `xKey`, `yKeys`) — NOT Chart.js format (`labels`, `datasets`)
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
Container(api, "API Gateway", "Kong", "Routes requests")
|
|
241
|
+
Container(svc, "Payment Service", "Node.js", "Processes payments")
|
|
242
|
+
ContainerDb(db, "Payment DB", "PostgreSQL", "Transaction records")
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
System_Ext(stripe, "Stripe", "Payment processor")
|
|
246
|
+
|
|
247
|
+
Rel(user, api, "HTTPS")
|
|
248
|
+
Rel(api, svc, "gRPC")
|
|
249
|
+
Rel(svc, db, "SQL")
|
|
250
|
+
Rel(svc, stripe, "REST")`
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
})
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Method 2: HTML/SVG Architecture Diagrams
|
|
257
|
+
|
|
258
|
+
For rich visual output, embed the full HTML/SVG diagram in a `markdown` block. Compose with `metrics` and `cards` blocks for a complete dashboard.
|
|
259
|
+
|
|
260
|
+
**Both `format: "html"` and `format: "browser"` work with this approach.**
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
present({
|
|
264
|
+
format: "html", // or "browser"
|
|
265
|
+
title: "System Architecture",
|
|
266
|
+
content: [
|
|
267
|
+
{
|
|
268
|
+
type: "metrics",
|
|
269
|
+
title: "Overview",
|
|
270
|
+
value: [
|
|
271
|
+
{ label: "Services", value: "6" },
|
|
272
|
+
{ label: "Data Stores", value: "2" },
|
|
273
|
+
{ label: "External Systems", value: "3" }
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
type: "markdown",
|
|
278
|
+
title: "Architecture Diagram",
|
|
279
|
+
value: "<div class='arch-diagram'><style>/* design system CSS from c4-architecture/references/html-design-system.md */</style><svg viewBox='0 0 1000 680'><!-- SVG components using category colors --></svg></div>"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
type: "cards",
|
|
283
|
+
title: "Component Summary",
|
|
284
|
+
value: [
|
|
285
|
+
{ title: "Frontend", body: "React SPA + CDN delivery" },
|
|
286
|
+
{ title: "Backend", body: "3 microservices, gRPC mesh" },
|
|
287
|
+
{ title: "Data", body: "PostgreSQL + Redis cache" }
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
]
|
|
291
|
+
})
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Component Categories (Quick Reference)
|
|
295
|
+
|
|
296
|
+
The full type registry with sub-types and icon slots is in `c4-architecture/references/html-design-system.md`. Here is the category summary:
|
|
297
|
+
|
|
298
|
+
| Category | Stroke | CSS Class | Use For |
|
|
299
|
+
|----------|--------|-----------|---------|
|
|
300
|
+
| Frontend | `#22d3ee` | `.cyan` | SPAs, mobile apps, static sites, PWAs |
|
|
301
|
+
| Backend | `#34d399` | `.emerald` | API services, workers, microservices, serverless |
|
|
302
|
+
| Data | `#a78bfa` | `.violet` | Databases, caches, search engines, warehouses |
|
|
303
|
+
| Infrastructure | `#fbbf24` | `.amber` | CDNs, load balancers, DNS, storage |
|
|
304
|
+
| Messaging | `#fb923c` | `.orange` | Queues, event buses, streams, pub/sub |
|
|
305
|
+
| Security | `#fb7185` | `.rose` | Auth, API gateways, WAF, secret managers |
|
|
306
|
+
| External | `#94a3b8` | `.slate` | Third-party APIs, SaaS, legacy systems |
|
|
307
|
+
| Monitoring | `#38bdf8` | `.sky` | Logging, metrics, tracing, alerting |
|
|
308
|
+
|
|
309
|
+
> **Centralization note:** Do not duplicate colors or type definitions here. The `c4-architecture` skill's design system is the single source of truth. When categories or colors change, they are updated in one place.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
165
313
|
## Best Practices
|
|
166
314
|
|
|
167
315
|
1. **Use `browser` format** for data-rich content — charts, tables, dashboards. **Always use `browser` in CLI mode** (the `html` UIResource doesn't render in terminal environments).
|
|
@@ -178,6 +326,38 @@ The dashboard uses a professional dark theme:
|
|
|
178
326
|
|
|
179
327
|
---
|
|
180
328
|
|
|
329
|
+
## Rendering Troubleshooting
|
|
330
|
+
|
|
331
|
+
### Why `html` format sometimes shows raw text
|
|
332
|
+
|
|
333
|
+
The `html` format renders content inside an MCP Apps companion iframe (UIResource). The chat text fallback is intentionally minimal (just the title). When the UIResource fails to load, the user sees only the title or raw JSON — NOT the rendered dashboard.
|
|
334
|
+
|
|
335
|
+
**Common causes of UIResource rendering failure:**
|
|
336
|
+
1. **MCP Apps not enabled** — The setting `chat.mcp.apps.enabled` must be `true` in VS Code settings
|
|
337
|
+
2. **Companion app build missing** — The `packages/present` companion app must be built (`npm run build`)
|
|
338
|
+
3. **Content too large** — Very large content arrays (20+ blocks or tables with 50+ rows) may cause the companion iframe to fail silently
|
|
339
|
+
4. **Iframe loading error** — Network issues, CSP restrictions, or extension conflicts can prevent the iframe from loading
|
|
340
|
+
|
|
341
|
+
### When to prefer `browser` over `html`
|
|
342
|
+
|
|
343
|
+
Use `format: "browser"` instead of `html` when:
|
|
344
|
+
- Content has **10+ blocks** or tables with **20+ rows** (large payloads are more reliable in browser)
|
|
345
|
+
- The output must be **guaranteed visible** (browser format always opens, no silent failures)
|
|
346
|
+
- You need **charts + tables + markdown** in the same view (browser renders all block types reliably)
|
|
347
|
+
- The user reports that `html` format "didn't show anything" or "showed raw text"
|
|
348
|
+
|
|
349
|
+
> **Reliability rule:** If content is complex (5+ blocks of mixed types), prefer `format: "browser"` for guaranteed rendering. The `html` format is best for simple, single-block content.
|
|
350
|
+
|
|
351
|
+
### Content formatting tips to avoid rendering issues
|
|
352
|
+
|
|
353
|
+
1. **Use `table` block type** instead of markdown tables inside `markdown` blocks — `table` blocks render natively; markdown pipe-tables may show as raw text in fallback
|
|
354
|
+
2. **Use `cards` and `metrics`** for summary data instead of embedding it in markdown text
|
|
355
|
+
3. **Keep `markdown` blocks for narrative text only** — don't embed HTML, tables, or complex formatting
|
|
356
|
+
4. **Split large content** into multiple smaller `present` calls rather than one massive content array
|
|
357
|
+
5. **For charts:** Always use ChartValue format (`chartType`, `data`, `xKey`, `yKeys`) — NOT Chart.js format (`labels`, `datasets`)
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
181
361
|
## MCP Apps Templates (VS Code Chat Widgets)
|
|
182
362
|
|
|
183
363
|
When `chat.mcp.apps.enabled` is true in VS Code settings, the `present` tool can render **interactive widgets directly in the chat panel** using the `template` parameter. These are distinct from the browser/html dashboard modes.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus } from "./types.js";
|
|
2
|
-
import { IEmbedder } from "../../embeddings/dist/index.js";
|
|
3
|
-
import { IGraphStore, IKnowledgeStore } from "../../store/dist/index.js";
|
|
4
|
-
|
|
5
|
-
//#region packages/aikit-client/src/direct-client.d.ts
|
|
6
|
-
interface CuratedEntry {
|
|
7
|
-
path: string;
|
|
8
|
-
title: string;
|
|
9
|
-
category: string;
|
|
10
|
-
tags: string[];
|
|
11
|
-
content: string;
|
|
12
|
-
}
|
|
13
|
-
interface DirectClientDeps {
|
|
14
|
-
store: IKnowledgeStore;
|
|
15
|
-
embedder: IEmbedder;
|
|
16
|
-
graphStore?: IGraphStore;
|
|
17
|
-
/** Function to list curated entries */
|
|
18
|
-
listCurated?: () => Promise<CuratedEntry[]>;
|
|
19
|
-
/** Function to read a single curated entry */
|
|
20
|
-
readCurated?: (path: string) => Promise<CuratedEntry | null>;
|
|
21
|
-
}
|
|
22
|
-
declare class DirectKBClient implements IKBClient {
|
|
23
|
-
private readonly deps;
|
|
24
|
-
constructor(deps: DirectClientDeps);
|
|
25
|
-
getStatus(): Promise<KBStatus>;
|
|
26
|
-
search(query: string, options?: {
|
|
27
|
-
limit?: number;
|
|
28
|
-
mode?: 'hybrid' | 'semantic' | 'keyword';
|
|
29
|
-
}): Promise<KBSearchResult[]>;
|
|
30
|
-
listKnowledge(): Promise<KBKnowledgeEntry[]>;
|
|
31
|
-
readKnowledge(path: string): Promise<KBKnowledgeEntry | null>;
|
|
32
|
-
getGraph(query?: string): Promise<KBGraphData>;
|
|
33
|
-
getFileTree(): Promise<string[]>;
|
|
34
|
-
private getEdgesForNodes;
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { DirectClientDeps, DirectKBClient };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=1e3;var t=class{constructor(e){this.deps=e}async getStatus(){let e=await this.deps.store.getStats();return{totalRecords:e.totalRecords,totalFiles:e.totalFiles,lastIndexedAt:e.lastIndexedAt??null,onboarded:e.totalRecords>0}}async search(e,t){let n=t?.limit??10,i=t?.mode??`hybrid`;if(i===`keyword`)return(await this.deps.store.ftsSearch(e,{limit:n})).map(r);let a=await this.deps.embedder.embedQuery(e);if(i===`semantic`)return(await this.deps.store.search(a,{limit:n})).map(r);let[o,s]=await Promise.all([this.deps.store.search(a,{limit:n*2}),this.deps.store.ftsSearch(e,{limit:n*2}).catch(()=>[])]),c=new Map;for(let e of[...o,...s]){let t=c.get(e.record.id);(!t||e.score>t.score)&&c.set(e.record.id,e)}return[...c.values()].sort((e,t)=>t.score-e.score).slice(0,n).map(r)}async listKnowledge(){return this.deps.listCurated?(await this.deps.listCurated()).map(n):[]}async readKnowledge(e){if(!this.deps.readCurated)return null;let t=await this.deps.readCurated(e);return t?n(t):null}async getGraph(t){if(!this.deps.graphStore)return{nodes:[],edges:[]};let n=await this.deps.graphStore.findNodes(t?{namePattern:t,limit:500}:{limit:500});if(n.length===0)return{nodes:[],edges:[]};let r=t?await this.getEdgesForNodes(n):await this.deps.graphStore.findEdges({limit:e});return{nodes:n.map(e=>({id:e.id,name:e.name,type:e.type,...e.sourcePath?{sourcePath:e.sourcePath}:{}})),edges:i(r).map(e=>({fromId:e.fromId,toId:e.toId,type:e.type}))}}async getFileTree(){return this.deps.store.listSourcePaths()}async getEdgesForNodes(t){let n=this.deps.graphStore;if(!n)return[];let r=t.flatMap(t=>[n.findEdges({fromId:t.id,limit:e}),n.findEdges({toId:t.id,limit:e})]);return(await Promise.all(r)).flat()}};function n(e){return{path:e.path,title:e.title,category:e.category,tags:e.tags,content:e.content}}function r(e){return{sourcePath:e.record.sourcePath,contentType:e.record.contentType,score:e.score,content:e.record.content,headingPath:e.record.headingPath,startLine:e.record.startLine,endLine:e.record.endLine}}function i(e){let t=new Map;for(let n of e)t.set(n.id,n);return[...t.values()]}export{t as DirectKBClient};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus } from "./types.js";
|
|
2
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
|
-
|
|
4
|
-
//#region packages/aikit-client/src/mcp-client.d.ts
|
|
5
|
-
declare class McpKBClient implements IKBClient {
|
|
6
|
-
private readonly client;
|
|
7
|
-
constructor(client: Client);
|
|
8
|
-
getStatus(): Promise<KBStatus>;
|
|
9
|
-
search(query: string, options?: {
|
|
10
|
-
limit?: number;
|
|
11
|
-
mode?: 'hybrid' | 'semantic' | 'keyword';
|
|
12
|
-
}): Promise<KBSearchResult[]>;
|
|
13
|
-
listKnowledge(): Promise<KBKnowledgeEntry[]>;
|
|
14
|
-
readKnowledge(path: string): Promise<KBKnowledgeEntry | null>;
|
|
15
|
-
getGraph(query?: string): Promise<KBGraphData>;
|
|
16
|
-
getFileTree(): Promise<string[]>;
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { McpKBClient };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{extractStructured as e,extractText as t}from"./parsers.js";var n=class{constructor(e){this.client=e}async getStatus(){let e=await this.client.callTool({name:`status`,arguments:{}}),t=i(e);if(t)return{totalRecords:l(t.totalRecords),totalFiles:l(t.totalFiles),lastIndexedAt:d(t.lastIndexedAt),onboarded:!!t.onboarded};let n=r(e);return{totalRecords:a(n,/Records:\s*(\d+)/i),totalFiles:a(n,/Files:\s*(\d+)/i),lastIndexedAt:null,onboarded:!/not onboarded/i.test(n)}}async search(e,t){let n=await this.client.callTool({name:`search`,arguments:{query:e,limit:t?.limit??10,search_mode:t?.mode??`hybrid`}}),a=i(n);return a?.results?a.results.map(e=>({sourcePath:f(e.sourcePath??e.path),contentType:f(e.contentType,`unknown`),score:l(e.score),content:f(e.content??e.snippet),headingPath:p(e.headingPath),startLine:u(e.startLine),endLine:u(e.endLine)})):o(r(n))}async listKnowledge(){let e=i(await this.client.callTool({name:`list`,arguments:{}}));return e?.entries?e.entries.map(e=>({path:f(e.path),title:f(e.title),category:f(e.category),tags:m(e.tags),content:f(e.content)})):[]}async readKnowledge(e){try{let t=r(await this.client.callTool({name:`read`,arguments:{path:e}}));return!t||/not found/i.test(t)?null:{path:e,title:e.split(`/`).pop()??e,category:e.split(`/`).at(-2)??`uncategorized`,tags:[],content:t}}catch{return null}}async getGraph(e){let t=s(r(await this.client.callTool({name:`graph`,arguments:{action:`find_nodes`,...e?{name_pattern:e}:{},limit:500}})));return t.length===0?{nodes:[],edges:[]}:{nodes:t,edges:c(r(await this.client.callTool({name:`graph`,arguments:{action:`find_edges`,limit:1e3}})))}}async getFileTree(){let e=await this.client.callTool({name:`find`,arguments:{glob:`**/*`,limit:1e4}}),t=i(e);return t?.results?t.results.map(e=>typeof e==`string`?e:e.path??``).filter(e=>e.length>0):r(e).split(`
|
|
2
|
-
`).map(e=>e.trim()).filter(e=>e.length>0)}};function r(e){return t(e)}function i(t){return e(t)}function a(e,t){let n=t.exec(e);return n?Number.parseInt(n[1],10):0}function o(e){let t=[],n=e.split(/\n(?=\d+\.\s|\*\*)/);for(let e of n){let n=/(?:\*\*|`)([^*`]+?)(?:\*\*|`)/.exec(e),r=/score:\s*([\d.]+)/i.exec(e);n&&t.push({sourcePath:n[1].trim(),contentType:`unknown`,score:r?Number.parseFloat(r[1]):0,content:e.replace(/^.*\n/,``).trim().slice(0,200)})}return t}function s(e){let t=[];for(let n of e.split(`
|
|
3
|
-
`)){let e=/\*\*(.+?)\*\*\s*\(([^,)]+)(?:,\s*id:\s*`?([\w-]+)`?)?/.exec(n);e&&t.push({id:e[3]??`node-${t.length}`,name:e[1],type:e[2]})}return t}function c(e){let t=[];for(let n of e.split(`
|
|
4
|
-
`)){let e=/`?([\w-]+)`?\s*[—-]+\[(\w+)\][→>]\s*`?([\w-]+)`?/.exec(n);e&&t.push({fromId:e[1],toId:e[3],type:e[2]})}return t}function l(e){return typeof e==`number`?e:0}function u(e){return typeof e==`number`?e:void 0}function d(e){return typeof e==`string`?e:null}function f(e,t=``){return typeof e==`string`?e:t}function p(e){return typeof e==`string`?e:void 0}function m(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}export{n as McpKBClient};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//#region packages/aikit-client/src/parsers.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Content parsers for MCP tool responses.
|
|
4
|
-
* Used by McpKBClient to parse structuredContent from tool calls.
|
|
5
|
-
*/
|
|
6
|
-
interface ParsedContent<T = unknown> {
|
|
7
|
-
text: string;
|
|
8
|
-
structured?: T;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Extract text content from an MCP tool result.
|
|
12
|
-
*/
|
|
13
|
-
declare function extractText(result: {
|
|
14
|
-
content?: unknown;
|
|
15
|
-
} | null | undefined): string;
|
|
16
|
-
/**
|
|
17
|
-
* Extract structured content from an MCP tool result.
|
|
18
|
-
*/
|
|
19
|
-
declare function extractStructured<T>(result: {
|
|
20
|
-
structuredContent?: unknown;
|
|
21
|
-
} | null | undefined): T | undefined;
|
|
22
|
-
/**
|
|
23
|
-
* Parse a tool result, returning both text and structured content.
|
|
24
|
-
*/
|
|
25
|
-
declare function parseToolResult<T = unknown>(result: {
|
|
26
|
-
content?: unknown;
|
|
27
|
-
structuredContent?: unknown;
|
|
28
|
-
} | null | undefined): ParsedContent<T>;
|
|
29
|
-
/**
|
|
30
|
-
* Try to parse JSON from a text tool result.
|
|
31
|
-
* Returns undefined if parsing fails.
|
|
32
|
-
*/
|
|
33
|
-
declare function tryParseJson<T = unknown>(text: string): T | undefined;
|
|
34
|
-
//#endregion
|
|
35
|
-
export { ParsedContent, extractStructured, extractText, parseToolResult, tryParseJson };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e){return!Array.isArray(e?.content)||e.content.length===0?``:e.content.filter(e=>typeof e==`object`&&!!e).filter(e=>e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
2
|
-
`)}function t(e){return e?.structuredContent}function n(n){return{text:e(n),structured:t(n)}}function r(e){try{return JSON.parse(e)}catch{return}}export{t as extractStructured,e as extractText,n as parseToolResult,r as tryParseJson};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
//#region packages/aikit-client/src/types.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* IKBClient — Unified data access interface for AI Kit consumers.
|
|
4
|
-
*
|
|
5
|
-
* Implemented by:
|
|
6
|
-
* - DirectKBClient (in-process, used by TUI)
|
|
7
|
-
* - McpKBClient (over MCP transport, used by Dashboard)
|
|
8
|
-
*/
|
|
9
|
-
interface KBStatus {
|
|
10
|
-
totalRecords: number;
|
|
11
|
-
totalFiles: number;
|
|
12
|
-
lastIndexedAt: string | null;
|
|
13
|
-
onboarded: boolean;
|
|
14
|
-
}
|
|
15
|
-
interface KBSearchResult {
|
|
16
|
-
sourcePath: string;
|
|
17
|
-
contentType: string;
|
|
18
|
-
score: number;
|
|
19
|
-
content: string;
|
|
20
|
-
headingPath?: string;
|
|
21
|
-
startLine?: number;
|
|
22
|
-
endLine?: number;
|
|
23
|
-
}
|
|
24
|
-
interface KBKnowledgeEntry {
|
|
25
|
-
path: string;
|
|
26
|
-
title: string;
|
|
27
|
-
category: string;
|
|
28
|
-
tags: string[];
|
|
29
|
-
content: string;
|
|
30
|
-
}
|
|
31
|
-
interface KBGraphData {
|
|
32
|
-
nodes: Array<{
|
|
33
|
-
id: string;
|
|
34
|
-
name: string;
|
|
35
|
-
type: string;
|
|
36
|
-
sourcePath?: string;
|
|
37
|
-
}>;
|
|
38
|
-
edges: Array<{
|
|
39
|
-
fromId: string;
|
|
40
|
-
toId: string;
|
|
41
|
-
type: string;
|
|
42
|
-
}>;
|
|
43
|
-
}
|
|
44
|
-
interface IKBClient {
|
|
45
|
-
/** Get AI Kit status. */
|
|
46
|
-
getStatus(): Promise<KBStatus>;
|
|
47
|
-
/** Search AI Kit. */
|
|
48
|
-
search(query: string, options?: {
|
|
49
|
-
limit?: number;
|
|
50
|
-
mode?: 'hybrid' | 'semantic' | 'keyword';
|
|
51
|
-
}): Promise<KBSearchResult[]>;
|
|
52
|
-
/** List curated knowledge entries. */
|
|
53
|
-
listKnowledge(): Promise<KBKnowledgeEntry[]>;
|
|
54
|
-
/** Read a specific curated entry. */
|
|
55
|
-
readKnowledge(path: string): Promise<KBKnowledgeEntry | null>;
|
|
56
|
-
/** Get knowledge graph data. */
|
|
57
|
-
getGraph(query?: string): Promise<KBGraphData>;
|
|
58
|
-
/** Get file tree of indexed sources. */
|
|
59
|
-
getFileTree(): Promise<string[]>;
|
|
60
|
-
}
|
|
61
|
-
//#endregion
|
|
62
|
-
export { IKBClient, KBGraphData, KBKnowledgeEntry, KBSearchResult, KBStatus };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AnalysisResult } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/analyzers/src/blast-radius-analyzer.d.ts
|
|
4
|
-
interface BlastRadiusOptions {
|
|
5
|
-
/** Changed file paths (relative to root) */
|
|
6
|
-
files: string[];
|
|
7
|
-
/** Maximum depth of transitive dependency traversal (default: 5) */
|
|
8
|
-
maxDepth?: number;
|
|
9
|
-
/** Output format */
|
|
10
|
-
format?: 'json' | 'markdown';
|
|
11
|
-
}
|
|
12
|
-
declare class BlastRadiusAnalyzer {
|
|
13
|
-
readonly name = "blast-radius";
|
|
14
|
-
private depAnalyzer;
|
|
15
|
-
analyze(rootPath: string, options: BlastRadiusOptions): Promise<AnalysisResult>;
|
|
16
|
-
private formatMarkdown;
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { BlastRadiusAnalyzer, BlastRadiusOptions };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{DependencyAnalyzer as e}from"./dependency-analyzer.js";var t=class{name=`blast-radius`;depAnalyzer=new e;async analyze(e,t){let{files:n,maxDepth:r=5,format:i=`markdown`}=t,a=Date.now(),o=(await this.depAnalyzer.analyze(e,{format:`json`})).data,s=o.reverseGraph??{},c=o.testCoverage??{},l=new Map,u=[];for(let e of n){l.set(e,{path:e,reason:`changed`,depth:0});let t=e.replace(/\.[jt]sx?$/,``);u.push({path:t,depth:0})}for(;u.length>0;){let e=u.shift();if(!e)break;let{path:t,depth:n}=e;if(n>=r)continue;let i=s[t]??[];for(let e of i){if(l.has(e))continue;let t=n===0?`direct-importer`:`transitive-importer`;l.set(e,{path:e,reason:t,depth:n+1});let r=e.replace(/\.[jt]sx?$/,``);u.push({path:r,depth:n+1})}}let d=new Set;for(let[e]of l){let t=c[e.replace(/\.[jt]sx?$/,``)]??[];for(let e of t)l.has(e)||(d.add(e),l.set(e,{path:e,reason:`test`,depth:999}))}let f=[...l.values()].sort((e,t)=>e.depth-t.depth);return{output:i===`json`?JSON.stringify({changedFiles:n,affected:f},null,2):this.formatMarkdown(n,f,s),data:{changedFiles:n,affected:f},meta:{analyzedAt:new Date().toISOString(),scope:e,fileCount:f.length,durationMs:Date.now()-a}}}formatMarkdown(e,t,n){let r=[];r.push(`## Blast Radius Analysis
|
|
2
|
-
`),r.push(`**Changed files:** ${e.length}`),r.push(`**Total affected:** ${t.length}\n`);let i=t.filter(e=>e.reason===`changed`);if(i.length>0){r.push(`### Changed Files
|
|
3
|
-
`);for(let e of i)r.push(`- \`${e.path}\``)}let a=t.filter(e=>e.reason===`direct-importer`);if(a.length>0){r.push(`\n### Direct Importers (${a.length} files)\n`);for(let e of a)r.push(`- \`${e.path}\``)}let o=t.filter(e=>e.reason===`transitive-importer`);if(o.length>0){r.push(`\n### Transitive Importers (${o.length} files)\n`);for(let e of o.slice(0,20))r.push(`- \`${e.path}\` (depth ${e.depth})`);o.length>20&&r.push(`- ... and ${o.length-20} more`)}let s=t.filter(e=>e.reason===`test`);if(s.length>0){r.push(`\n### Affected Tests (${s.length} files)\n`);for(let e of s)r.push(`- \`${e.path}\``)}return r.push(`
|
|
4
|
-
### Review Summary
|
|
5
|
-
`),r.push(`| Category | Count |`),r.push(`|----------|-------|`),r.push(`| Changed | ${i.length} |`),r.push(`| Direct importers | ${a.length} |`),r.push(`| Transitive importers | ${o.length} |`),r.push(`| Affected tests | ${s.length} |`),r.push(`| **Total review scope** | **${t.length}** |`),r.join(`
|
|
6
|
-
`)}};export{t as BlastRadiusAnalyzer};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AnalysisResult, DependencyAnalyzerOptions, IAnalyzer, ImportInfo } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/analyzers/src/dependency-analyzer.d.ts
|
|
4
|
-
declare class DependencyAnalyzer implements IAnalyzer<DependencyAnalyzerOptions> {
|
|
5
|
-
readonly name = "dependencies";
|
|
6
|
-
/** Map of workspace package names to their relative entry point paths */
|
|
7
|
-
private workspacePackages;
|
|
8
|
-
analyze(rootPath: string, options?: DependencyAnalyzerOptions): Promise<AnalysisResult>;
|
|
9
|
-
private collectFiles;
|
|
10
|
-
private extractImportsRegex;
|
|
11
|
-
private groupExternalDeps;
|
|
12
|
-
private groupInternalDeps;
|
|
13
|
-
/**
|
|
14
|
-
* Build reverse graph: for each source file, who imports it?
|
|
15
|
-
*/
|
|
16
|
-
buildReverseGraph(imports: ImportInfo[], _rootPath: string): Record<string, string[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Build test coverage map: for each source file, which test files exercise it?
|
|
19
|
-
*/
|
|
20
|
-
buildTestCoverage(imports: ImportInfo[], _rootPath: string): Record<string, string[]>;
|
|
21
|
-
/** Resolve a relative import path to a normalized file path (best-effort). */
|
|
22
|
-
private resolveImportPath;
|
|
23
|
-
/**
|
|
24
|
-
* Build a map of workspace package names → relative entry point paths.
|
|
25
|
-
* Scans for package.json files in common workspace dirs.
|
|
26
|
-
*/
|
|
27
|
-
private buildWorkspaceMap;
|
|
28
|
-
private formatMarkdown;
|
|
29
|
-
private formatMermaid;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { DependencyAnalyzer };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{readFile as e,readdir as t,stat as n}from"node:fs/promises";import{dirname as r,extname as i,join as a,relative as o,resolve as s}from"node:path";import{SUPPORTED_EXTENSIONS as c,WasmRuntime as l,extractImports as u}from"../../chunker/dist/index.js";const d=new Set([`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.py`,`.java`,`.go`,`.cs`,`.kt`,`.scala`,`.rb`,`.rs`,`.php`,`.swift`]),f=[{regex:/import\s+(?:(?:type\s+)?(?:(?:\{[^}]*\}|[\w*]+)\s+from\s+)?)['"]([^'"]+)['"]/g,confidence:`high`},{regex:/import\(\s*['"]([^'"]+)['"]\s*\)/g,confidence:`medium`},{regex:/require\(\s*['"]([^'"]+)['"]\s*\)/g,confidence:`medium`},{regex:/^from\s+([\w.]+)\s+import\b/gm,confidence:`high`,lang:`python`},{regex:/^import\s+([\w.]+)\s*$/gm,confidence:`high`,lang:`python`},{regex:/^import\s+(?:static\s+)?([\w.]+(?:\.\*)?)\s*;/gm,confidence:`high`,lang:`java`},{regex:/(?:^import\s+|^\s+)[""]([^""]+)[""]/gm,confidence:`high`,lang:`go`},{regex:/^using\s+(?:static\s+)?([\w.]+)\s*;/gm,confidence:`high`,lang:`csharp`},{regex:/^use\s+([\w:]+(?:::\w+)*)/gm,confidence:`high`,lang:`rust`},{regex:/^use\s+([\w\\]+)\s*;/gm,confidence:`high`,lang:`php`},{regex:/require(?:_relative)?\s+['"]([^'"]+)['"]/g,confidence:`medium`,lang:`ruby`},{regex:/^import\s+(\w+)\s*$/gm,confidence:`high`,lang:`swift`}],p=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`]),m=[/\.(test|spec)\.[jt]sx?$/,/\/__tests__\//,/\/test\//,/\/tests\//],h={".ts":`js`,".tsx":`js`,".js":`js`,".jsx":`js`,".mjs":`js`,".cjs":`js`,".py":`python`,".java":`java`,".kt":`java`,".scala":`java`,".go":`go`,".cs":`csharp`,".rs":`rust`,".php":`php`,".rb":`ruby`,".swift":`swift`};function g(e,t){return!t||t===`js`?!e.startsWith(`.`)&&!e.startsWith(`/`):t===`python`?!e.startsWith(`.`):t===`java`?!e.startsWith(`com.`)||e.startsWith(`com.amazonaws`)||e.startsWith(`com.google`)||e.startsWith(`com.fasterxml`):t===`go`?e.includes(`.`)&&!e.startsWith(`.`):t===`csharp`?e.startsWith(`System`)||e.startsWith(`Microsoft`)||e.startsWith(`Newtonsoft`)||e.startsWith(`Amazon`):t===`rust`?!e.startsWith(`crate::`)&&!e.startsWith(`self::`)&&!e.startsWith(`super::`):!0}function _(e){return m.some(t=>t.test(e))}var v=class{name=`dependencies`;workspacePackages=new Map;async analyze(t,n={}){let{format:r=`markdown`}=n,a=Date.now();this.workspacePackages=await this.buildWorkspaceMap(t);let s=!1;try{await l.ensure(),s=!0}catch{}let d=await this.collectFiles(t),f=[];for(let n of d){let r=await e(n,`utf-8`),a=i(n).toLowerCase(),l=o(t,n).replace(/\\/g,`/`);if(s&&c.has(a)){let e=await u(r,a,l);if(e.length>0)f.push(...e);else{let e=this.extractImportsRegex(r,n,t);f.push(...e)}}else{let e=this.extractImportsRegex(r,n,t);f.push(...e)}}let p=this.groupExternalDeps(f),m=this.groupInternalDeps(f,t),h=this.buildReverseGraph(f,t),g=this.buildTestCoverage(f,t);return{output:r===`json`?JSON.stringify({external:p,internal:m,reverseGraph:h,testCoverage:g},null,2):r===`mermaid`?this.formatMermaid(m):this.formatMarkdown(p,m,t,g),data:{external:p,internal:m,reverseGraph:h,testCoverage:g,totalImports:f.length},meta:{analyzedAt:new Date().toISOString(),scope:t,fileCount:d.length,durationMs:Date.now()-a}}}async collectFiles(e){let r=[],o=async e=>{if(!(await n(e).catch(()=>null))?.isDirectory())return;let s=await t(e,{withFileTypes:!0});for(let t of s){if(p.has(t.name)||t.name.startsWith(`.`))continue;let n=a(e,t.name);t.isDirectory()?await o(n):d.has(i(t.name))&&r.push(n)}};return await o(e),r}extractImportsRegex(e,t,n){let r=[],a=h[i(t).toLowerCase()];for(let i of f){if(i.lang&&i.lang!==a||!i.lang&&a&&a!==`js`)continue;let s=new RegExp(i.regex.source,i.regex.flags),c;for(;(c=s.exec(e))!==null;){let e=c[1],s=g(e,a);r.push({source:e,specifiers:[],filePath:o(n,t).replace(/\\/g,`/`),isExternal:s,confidence:i.confidence})}}return r}groupExternalDeps(e){let t={};for(let n of e){if(!n.isExternal)continue;let e=h[i(n.filePath).toLowerCase()],r;if(e===`java`){let e=n.source.split(`.`);for(;e.length>1;){let t=e[e.length-1];if(t===`*`||/^[A-Z]/.test(t))e.pop();else break}r=e.length>=2?e.slice(0,2).join(`.`):e.join(`.`)}else if(e===`python`)r=n.source.split(`.`)[0];else if(e===`go`)r=n.source;else if(e===`csharp`){let e=n.source.split(`.`);r=e.length>=2?e.slice(0,2).join(`.`):n.source}else r=n.source.startsWith(`@`)?n.source.split(`/`).slice(0,2).join(`/`):n.source.split(`/`)[0];t[r]||(t[r]={count:0,confidence:n.confidence,usedBy:new Set}),t[r].count++,t[r].usedBy.add(n.filePath),n.confidence===`high`?t[r].confidence=`high`:n.confidence===`medium`&&t[r].confidence===`low`&&(t[r].confidence=`medium`)}let n={};for(let[e,r]of Object.entries(t))n[e]={count:r.count,confidence:r.confidence,usedBy:[...r.usedBy]};return n}groupInternalDeps(e,t){let n={};for(let t of e)t.isExternal||(n[t.filePath]||(n[t.filePath]=new Set),n[t.filePath].add(t.source));let r={};for(let[e,t]of Object.entries(n))r[e]=[...t];return r}buildReverseGraph(e,t){let n={};for(let t of e){let e=r(t.filePath),i=this.resolveImportPath(t.source,e);i&&(n[i]||(n[i]=new Set),n[i].add(t.filePath))}let i={};for(let[e,t]of Object.entries(n))i[e]=[...t];return i}buildTestCoverage(e,t){let n={};for(let t of e){if(!_(t.filePath))continue;let e=r(t.filePath),i=this.resolveImportPath(t.source,e);!i||_(i)||(n[i]||(n[i]=new Set),n[i].add(t.filePath))}let i={};for(let[e,t]of Object.entries(n))i[e]=[...t];return i}resolveImportPath(e,t){if(e.startsWith(`.`))return a(t,e).replace(/\\/g,`/`).replace(/\.[jt]sx?$/,``);let n=e.startsWith(`@`)?e.split(`/`).slice(0,2).join(`/`):e.split(`/`)[0],r=this.workspacePackages.get(n);return r?r.replace(/\.[jt]sx?$/,``):null}async buildWorkspaceMap(n){let r=new Map;for(let i of[`packages`,`functions`,`libs`,`apps`,`cdk`]){let c=a(n,i);try{let i=await t(c,{withFileTypes:!0});for(let t of i)if(!(!t.isDirectory()||p.has(t.name)))try{let i=a(c,t.name,`package.json`),l=JSON.parse(await e(i,`utf-8`));if(l.name){let e=l.main??l.exports?.[`.`]??`src/index.ts`,i=o(n,s(c,t.name,e)).replace(/\\/g,`/`);r.set(l.name,i)}}catch{}}catch{}}return r}formatMarkdown(e,t,n,r){let i=[];i.push(`## Dependencies: ${n}\n`);let a=Object.entries(e).sort((e,t)=>t[1].count-e[1].count),o=a.length,s=a.reduce((e,[,t])=>e+t.count,0),c=a.slice(0,5).map(([e])=>e);i.push(`**${o} external packages**, **${s} total imports**, **${Object.keys(t).length} files** with internal imports.\n`),c.length>0&&i.push(`**Top dependencies**: ${c.join(`, `)}\n`),i.push(`### External Dependencies
|
|
2
|
-
`),i.push(`| Package | Imports | Used By |`),i.push(`|---------|---------|---------|`);for(let[e,t]of a)i.push(`| ${e} | ${t.count} | ${t.usedBy.length} ${t.usedBy.length===1?`file`:`files`} |`);if(r&&Object.keys(r).length>0){let e=Object.keys(r).length,n=Object.keys(t).filter(e=>!_(e)&&!r[e.replace(/\\.[jt]sx?$/,``)]);i.push(`
|
|
3
|
-
### Test Coverage Summary
|
|
4
|
-
`),i.push(`**${e} source modules** with test coverage.`),n.length>0&&i.push(`**${n.length} source files** with no detected test coverage.`);let a=Object.entries(r).sort((e,t)=>t[1].length-e[1].length);i.push(`
|
|
5
|
-
**Most-tested modules:**
|
|
6
|
-
`);for(let[e,t]of a.slice(0,10)){let n=e.replace(/\/dist\/[^/]*$/,`/src/index`).replace(/\.mjs$/,`.ts`);i.push(`- ${n} (${t.length} ${t.length===1?`test`:`tests`})`)}}return i.join(`
|
|
7
|
-
`)}formatMermaid(e){let t=[`graph LR`],n=e=>e.replace(/[^a-zA-Z0-9]/g,`_`);for(let[r,i]of Object.entries(e).slice(0,40)){let e=n(r);for(let a of i){let i=n(a);t.push(` ${e}["${r}"] --> ${i}["${a}"]`)}}return t.join(`
|
|
8
|
-
`)}};export{v as DependencyAnalyzer};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AnalysisResult, DiagramOptions, IAnalyzer } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/analyzers/src/diagram-generator.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Generates Mermaid diagrams by combining output from other analyzers.
|
|
6
|
-
*/
|
|
7
|
-
declare class DiagramGenerator implements IAnalyzer<DiagramOptions> {
|
|
8
|
-
readonly name = "diagrams";
|
|
9
|
-
private readonly structureAnalyzer;
|
|
10
|
-
private readonly dependencyAnalyzer;
|
|
11
|
-
analyze(rootPath: string, options?: DiagramOptions): Promise<AnalysisResult>;
|
|
12
|
-
private generateArchitectureDiagram;
|
|
13
|
-
private generateDependencyDiagram;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { DiagramGenerator };
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{DependencyAnalyzer as e}from"./dependency-analyzer.js";import{StructureAnalyzer as t}from"./structure-analyzer.js";import{join as n}from"node:path";import{readFileSync as r,readdirSync as i}from"node:fs";var a=class{name=`diagrams`;structureAnalyzer=new t;dependencyAnalyzer=new e;async analyze(e,t={}){let{diagramType:n=`architecture`}=t,r=Date.now(),i;switch(n){case`dependencies`:i=await this.generateDependencyDiagram(e);break;default:i=await this.generateArchitectureDiagram(e);break}return{output:i,data:{diagramType:n},meta:{analyzedAt:new Date().toISOString(),scope:e,fileCount:0,durationMs:Date.now()-r}}}async generateArchitectureDiagram(e){let t=(await this.structureAnalyzer.analyze(e,{format:`json`,maxDepth:4})).data.tree,a=await this.dependencyAnalyzer.analyze(e,{format:`json`}),o=a.data,s=["```mermaid",`graph TB`],c=(t.children??[]).filter(e=>e.type===`directory`).slice(0,15);for(let e of c){let t=e.name.replace(/[^a-zA-Z0-9]/g,`_`),n=(e.children??[]).filter(e=>e.type===`directory`);if(n.length>0){s.push(` subgraph ${t}["${e.name}/"]`);for(let e of n.slice(0,12)){let n=`${t}_${e.name.replace(/[^a-zA-Z0-9]/g,`_`)}`,r=Array.isArray(e.children)?e.children.length:0;s.push(` ${n}["${e.name}/ (${r})"]`)}s.push(` end`)}else{let n=Array.isArray(e.children)?e.children.length:0;s.push(` ${t}["${e.name}/ (${n} files)"]`)}}let l=new Set;if(o.internal)for(let[e,t]of Object.entries(o.internal)){let n=e.split(`/`)[0]?.replace(/[^a-zA-Z0-9]/g,`_`);for(let e of t){if(e.startsWith(`.`))continue;let t=e.split(`/`)[0]?.replace(/[^a-zA-Z0-9]/g,`_`);if(n&&t&&n!==t){let e=`${n}->${t}`;l.has(e)||(l.add(e),s.push(` ${n} --> ${t}`))}}}let u=a.data;if(u.external){let t=new Map;for(let a of[`packages`,`apps`,`libs`,`services`,`functions`])try{for(let o of i(n(e,a),{withFileTypes:!0}))if(o.isDirectory())try{let i=JSON.parse(r(n(e,a,o.name,`package.json`),`utf-8`));i.name&&t.set(i.name,`${a}/${o.name}`)}catch{}}catch{}for(let[e,n]of Object.entries(u.external)){let r=t.get(e);if(!r)continue;let i=r.split(`/`)[0]?.replace(/[^a-zA-Z0-9]/g,`_`),a=Array.isArray(n)?n:n.usedBy;for(let e of a??[]){let t=e.split(`/`)[0]?.replace(/[^a-zA-Z0-9]/g,`_`);if(t&&i&&t!==i){let e=`${t}->${i}`;l.has(e)||(l.add(e),s.push(` ${t} --> ${i}`))}}}}return s.push("```"),s.join(`
|
|
2
|
-
`)}async generateDependencyDiagram(e){return`\`\`\`mermaid\n${(await this.dependencyAnalyzer.analyze(e,{format:`mermaid`})).output}\n\`\`\``}};export{a as DiagramGenerator};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AnalysisResult, AnalyzerOptions, IAnalyzer } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/analyzers/src/entry-point-analyzer.d.ts
|
|
4
|
-
declare class EntryPointAnalyzer implements IAnalyzer<AnalyzerOptions> {
|
|
5
|
-
readonly name = "entry-points";
|
|
6
|
-
analyze(rootPath: string, _options?: AnalyzerOptions): Promise<AnalysisResult>;
|
|
7
|
-
private fromPackageJson;
|
|
8
|
-
/** Parse package.json `exports` field into entry points. */
|
|
9
|
-
private parseExportsField;
|
|
10
|
-
/** Resolve export value through condition maps (import > default > first string). */
|
|
11
|
-
private resolveExportValue;
|
|
12
|
-
/**
|
|
13
|
-
* Find all workspace package directories in a monorepo.
|
|
14
|
-
* Supports pnpm-workspace.yaml and package.json#workspaces.
|
|
15
|
-
*/
|
|
16
|
-
private findWorkspacePackages;
|
|
17
|
-
/** Simple YAML parser for pnpm-workspace.yaml — extracts packages list. */
|
|
18
|
-
private parsePnpmWorkspaceYaml;
|
|
19
|
-
/**
|
|
20
|
-
* Expand a workspace glob like "packages/*" into actual directories
|
|
21
|
-
* that contain package.json files.
|
|
22
|
-
*/
|
|
23
|
-
private expandWorkspaceGlob;
|
|
24
|
-
private fromHandlerExports;
|
|
25
|
-
/** Check if a file is a test suite. */
|
|
26
|
-
private isTestFile;
|
|
27
|
-
/** Extract a meaningful name from the file path for non-JS entry points */
|
|
28
|
-
private inferNameFromFile;
|
|
29
|
-
/**
|
|
30
|
-
* Derive a contextual name from the directory path for generic handler/main files.
|
|
31
|
-
* E.g., "services/channels/email/delivery/src/handler.ts" → "email-delivery"
|
|
32
|
-
*/
|
|
33
|
-
private deriveContextualName;
|
|
34
|
-
private inferEntryType;
|
|
35
|
-
private detectTrigger;
|
|
36
|
-
private collectFiles;
|
|
37
|
-
private formatMarkdown;
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { EntryPointAnalyzer };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{access as e,readFile as t,readdir as n,stat as r}from"node:fs/promises";import{extname as i,join as a,relative as o,resolve as s}from"node:path";import{SUPPORTED_EXTENSIONS as c,WasmRuntime as l,detectEntryPoints as u}from"../../chunker/dist/index.js";const d=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,`__pycache__`,`.venv`,`target`,`bin`,`obj`,`.gradle`,`venv`,`env`]),f=new Set([`test`,`tests`,`__tests__`,`spec`,`specs`,`test-utils`]),p=[/export\s+const\s+(handler|main)\s*(?::[^=]*)?\s*=/,/export\s+(?:async\s+)?function\s+(handler|main)\s*\(/,/export\s+const\s+(\w+Handler)\s*(?::[^=]*)?\s*=/,/export\s+default\s+app/,/^app\s*=\s*(?:Flask|FastAPI)\s*\(/m,/^urlpatterns\s*=\s*\[/m,/^if\s+__name__\s*==\s*['"]__main__['"]:/m,/public\s+static\s+void\s+main\s*\(\s*String/,/@SpringBootApplication/,/^func\s+main\s*\(\s*\)/m],m=/export\s+(?:default\s+)?class\s+(\w+)\s+extends\s+(?:Construct|Stack|NestedStack|Stage)/,h=[/from\s+['"]vitest['"]/,/from\s+['"]jest['"]/,/from\s+['"]mocha['"]/,/import\s+.*['"]@jest\/globals['"]/,/require\s*\(\s*['"](?:vitest|jest|mocha)['"]\s*\)/],g=[{regex:/SqsEventSource|SQSEvent|sqs/i,trigger:`SQS`},{regex:/SnsEventSource|SNSEvent|sns/i,trigger:`SNS`},{regex:/ApiGateway|APIGatewayEvent|httpApi|restApi/i,trigger:`API Gateway`},{regex:/ScheduleExpression|EventBridgeRule|schedule/i,trigger:`EventBridge Schedule`},{regex:/S3EventSource|S3Event|s3/i,trigger:`S3`},{regex:/DynamoEventSource|DynamoDBStream/i,trigger:`DynamoDB Stream`},{regex:/@RequestMapping|@GetMapping|@PostMapping/i,trigger:`HTTP Endpoint`},{regex:/http\.ListenAndServe|gin\.Default|echo\.New/i,trigger:`HTTP Server`},{regex:/app\.route\(|@app\.get|@app\.post|@router\./i,trigger:`HTTP Route`}];var _=class{name=`entry-points`;async analyze(e,t={}){let n=Date.now(),r=[],i=await this.findWorkspacePackages(e);if(i.length>0)for(let t of i){let n=await this.fromPackageJson(t,e);r.push(...n)}else{let t=await this.fromPackageJson(e,e);r.push(...t)}let a=await this.fromHandlerExports(e);return r.push(...a),{output:this.formatMarkdown(r,e),data:{entryPoints:r,total:r.length},meta:{analyzedAt:new Date().toISOString(),scope:e,fileCount:r.length,durationMs:Date.now()-n}}}async fromPackageJson(n,r){let i=[],s=o(r,n).replace(/\\/g,`/`)||`.`;try{let r=a(n,`package.json`);await e(r);let o=JSON.parse(await t(r,`utf-8`)),c=s===`.`?``:`${s}/`;if(o.main&&i.push({name:o.name?`${o.name}:main`:`main`,type:`main`,filePath:`${c}${o.main}`}),o.bin){let e=typeof o.bin==`string`?{[o.name??`cli`]:o.bin}:o.bin;for(let[t,n]of Object.entries(e))i.push({name:t,type:`cli`,filePath:`${c}${n}`})}if(o.exports){let e=this.parseExportsField(o.exports,o.name??s,c);i.push(...e)}o.scripts?.start&&i.push({name:o.name?`${o.name}:start`:`start`,type:`server`,filePath:o.scripts.start,trigger:`npm start`})}catch{}return i}parseExportsField(e,t,n){let r=[];if(typeof e==`string`)return r.push({name:t,type:`main`,filePath:`${n}${e}`}),r;if(typeof e!=`object`||!e)return r;for(let[i,a]of Object.entries(e)){if(!i.startsWith(`.`))continue;let e=i===`.`?t:`${t}/${i.slice(2)}`,o=this.resolveExportValue(a);o&&r.push({name:e,type:`main`,filePath:`${n}${o}`})}return r}resolveExportValue(e){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return;let t=e;for(let e of[`import`,`default`,`require`])if(typeof t[e]==`string`)return t[e];for(let e of Object.values(t))if(typeof e==`string`)return e}async findWorkspacePackages(n){let r=[];try{let i=a(n,`pnpm-workspace.yaml`);await e(i);let o=await t(i,`utf-8`),s=this.parsePnpmWorkspaceYaml(o);for(let e of s){let t=await this.expandWorkspaceGlob(n,e);r.push(...t)}if(r.length>0)return r}catch{}try{let e=a(n,`package.json`),i=JSON.parse(await t(e,`utf-8`)),o=Array.isArray(i.workspaces)?i.workspaces:i.workspaces?.packages??[];for(let e of o){let t=await this.expandWorkspaceGlob(n,e);r.push(...t)}}catch{}return r}parsePnpmWorkspaceYaml(e){let t=[],n=!1;for(let r of e.split(`
|
|
2
|
-
`)){let e=r.trim();if(e===`packages:`){n=!0;continue}if(n){if(e.startsWith(`- `))t.push(e.slice(2).replace(/^['"]|['"]$/g,``));else if(e&&!e.startsWith(`#`))break}}return t}async expandWorkspaceGlob(t,r){let i=[],o=r.indexOf(`*`);if(o===-1){let n=s(t,r);try{await e(a(n,`package.json`)),i.push(n)}catch{}return i}let c=s(t,r.slice(0,o));try{let t=await n(c,{withFileTypes:!0});for(let n of t){if(!n.isDirectory()||d.has(n.name))continue;let t=a(c,n.name);try{await e(a(t,`package.json`)),i.push(t)}catch{}}}catch{}return i}async fromHandlerExports(e){let n=[],r=await this.collectFiles(e),a=!1;try{await l.ensure(),a=!0}catch{}for(let s of r)try{let r=await t(s,`utf-8`),l=o(e,s).replace(/\\/g,`/`),d=i(s);if(!l.split(`/`).some(e=>f.has(e))){let e=!1;if(a&&c.has(d)){let t=await u(r,d,l);for(let i of t)i.trigger||(i.type===`cdk-construct`?i.trigger=`CDK Construct`:i.trigger=this.detectTrigger(r)),n.push(i),e=!0}if(!e)for(let t of p){let i=r.match(t);if(i){let t=i[1]??this.inferNameFromFile(l);(t===`handler`||t===`main`)&&(t=this.deriveContextualName(l)??t);let a=/@SpringBootApplication/.test(r)?`HTTP Server`:this.detectTrigger(r);n.push({name:t,type:this.inferEntryType(i[1]??t,l),filePath:l,trigger:a}),e=!0;break}}if(!e){let e=r.match(m);e&&n.push({name:e[1],type:`cdk-construct`,filePath:l,trigger:`CDK Construct`})}}this.isTestFile(l,r)&&n.push({name:this.inferNameFromFile(l),type:`test`,filePath:l,trigger:`Test Suite`})}catch{}return n}isTestFile(e,t){return/\.(test|spec)\.[jt]sx?$/.test(e)?h.some(e=>e.test(t)):!1}inferNameFromFile(e){return(e.split(/[/\\]/).pop()??`default`).replace(/\.\w+$/,``)}deriveContextualName(e){let t=e.split(`/`).filter(e=>e!==`src`&&e!==`lib`);if(t.pop(),t.length===0)return;let n=t.filter(e=>![`services`,`functions`,`lambdas`,`handlers`,`packages`,`apps`].includes(e));if(n.length===0)return;let r=n.slice(-2);return r.length===2&&r[1].startsWith(r[0])?r[1]:r.join(`-`)}inferEntryType(e,t){return e===`handler`||e===`main`||t.includes(`handler`)||/functions[/]/.test(t)||e.endsWith(`Handler`)?`lambda-handler`:(t.endsWith(`.py`)||t.endsWith(`.go`)||t.endsWith(`.java`),`main`)}detectTrigger(e){for(let t of g)if(t.regex.test(e))return t.trigger}async collectFiles(e){let t=[],o=new Set([`.ts`,`.tsx`,`.js`,`.jsx`,`.java`,`.py`,`.go`,`.cs`,`.kt`,`.rb`,`.rs`,`.php`,`.swift`]),s=async(e,c)=>{if(c>10||!(await r(e).catch(()=>null))?.isDirectory())return;let l=await n(e,{withFileTypes:!0});for(let n of l){if(d.has(n.name)||n.name.startsWith(`.`))continue;let r=a(e,n.name);n.isDirectory()?await s(r,c+1):o.has(i(n.name))&&t.push(r)}};return await s(e,0),t}formatMarkdown(e,t){let n=[];if(n.push(`## Entry Points: ${t}\n`),n.push(`**${e.length} entry ${e.length===1?`point`:`points`}** found\n`),e.length===0)return n.push(`No entry points detected.`),n.join(`
|
|
3
|
-
`);let r=new Map;for(let t of e){let e=r.get(t.type)??[];e.push(t),r.set(t.type,e)}let i=[`lambda-handler`,`main`,`server`,`cli`,`bin`,`cdk-construct`,`test`],a=[...r.entries()].sort((e,t)=>i.indexOf(e[0])-i.indexOf(t[0]));n.push(`| Name | Type | File | Trigger |`),n.push(`|------|------|------|---------|`);for(let[,e]of a)for(let t of e)n.push(`| ${t.name} | ${t.type} | ${t.filePath} | ${t.trigger??`—`} |`);return n.join(`
|
|
4
|
-
`)}};export{_ as EntryPointAnalyzer};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ExtractionBaselines } from "./types.js";
|
|
2
|
-
import { DependencyAnalyzer } from "./dependency-analyzer.js";
|
|
3
|
-
import { DiagramGenerator } from "./diagram-generator.js";
|
|
4
|
-
import { EntryPointAnalyzer } from "./entry-point-analyzer.js";
|
|
5
|
-
import { PatternAnalyzer } from "./pattern-analyzer.js";
|
|
6
|
-
import { StructureAnalyzer } from "./structure-analyzer.js";
|
|
7
|
-
import { SymbolAnalyzer } from "./symbol-analyzer.js";
|
|
8
|
-
|
|
9
|
-
//#region packages/analyzers/src/knowledge-producer.d.ts
|
|
10
|
-
interface Analyzers {
|
|
11
|
-
structure: StructureAnalyzer;
|
|
12
|
-
dependencies: DependencyAnalyzer;
|
|
13
|
-
symbols: SymbolAnalyzer;
|
|
14
|
-
patterns: PatternAnalyzer;
|
|
15
|
-
entryPoints: EntryPointAnalyzer;
|
|
16
|
-
diagrams: DiagramGenerator;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Orchestrates Tier 1 deterministic extraction and prepares
|
|
20
|
-
* synthesis instructions for the LLM to produce knowledge.
|
|
21
|
-
*/
|
|
22
|
-
declare class KnowledgeProducer {
|
|
23
|
-
private readonly analyzers;
|
|
24
|
-
constructor(analyzers: Analyzers);
|
|
25
|
-
/**
|
|
26
|
-
* Run Tier 1 deterministic extraction for specified aspects.
|
|
27
|
-
*/
|
|
28
|
-
runExtraction(scope: string, aspects: string[]): Promise<ExtractionBaselines>;
|
|
29
|
-
/**
|
|
30
|
-
* Build synthesis instructions from baselines for the LLM.
|
|
31
|
-
*/
|
|
32
|
-
buildSynthesisInstructions(baselines: ExtractionBaselines, _aspects: string[]): string;
|
|
33
|
-
/**
|
|
34
|
-
* Build cross-references between baselines (symbols ↔ entry-points ↔ patterns).
|
|
35
|
-
* Helps the LLM see connections across independently generated sections.
|
|
36
|
-
*/
|
|
37
|
-
private buildCrossReferences;
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
export { Analyzers, KnowledgeProducer };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const e={structure:`structure`,dependencies:`dependencies`,symbols:`symbols`,patterns:`patterns`,"entry-points":`entryPoints`,diagrams:`diagrams`},t=Object.keys(e);var n=class{constructor(e){this.analyzers=e}async runExtraction(n,r){let i=r.includes(`all`)?t:r,a={},o=[];for(let t of i){let r=e[t];if(!r)continue;let i=this.analyzers[r];i&&(t===`diagrams`?o.push({key:`diagrams`,promise:i.analyze(n,{diagramType:`architecture`})}):o.push({key:t,promise:i.analyze(n)}))}let s=await Promise.allSettled(o.map(async e=>({key:e.key,result:await e.promise})));for(let e of s){if(e.status!==`fulfilled`)continue;let{key:t,result:n}=e.value;t===`diagrams`?a.diagrams=[n]:a[t]=n}return a}buildSynthesisInstructions(e,t){let n=[];if(n.push(`## Knowledge Production Results
|
|
2
|
-
`),n.push(`### Extraction Baselines (auto-generated)
|
|
3
|
-
`),e.structure&&(n.push(`#### File Structure
|
|
4
|
-
`),n.push(e.structure.output),n.push(``)),e.dependencies&&(n.push(`#### Dependencies
|
|
5
|
-
`),n.push(e.dependencies.output),n.push(``)),e.symbols&&(n.push(`#### Symbols
|
|
6
|
-
`),n.push(e.symbols.output),n.push(``)),e.patterns&&(n.push(`#### Detected Patterns
|
|
7
|
-
`),n.push(e.patterns.output),n.push(``)),e.entryPoints&&(n.push(`#### Entry Points
|
|
8
|
-
`),n.push(e.entryPoints.output),n.push(``)),e.diagrams&&e.diagrams.length>0){n.push(`#### Architecture Diagram
|
|
9
|
-
`);for(let t of e.diagrams)n.push(t.output);n.push(``)}let r=this.buildCrossReferences(e);if(r.length>0){n.push(`#### Cross-References
|
|
10
|
-
`),n.push(`_Connections between baselines to aid synthesis:_
|
|
11
|
-
`);for(let e of r)n.push(`- ${e}`);n.push(``)}return n.push(`### Your Task: Synthesize Knowledge
|
|
12
|
-
`),n.push(`Based on the baselines above and your reading of the source files, produce`),n.push("the following knowledge documents using `aikit_remember`:\n"),n.push(`1. **Domain Overview** (category: \`architecture\`)
|
|
13
|
-
- What this service does, boundary with other services
|
|
14
|
-
- Key entities and their lifecycle
|
|
15
|
-
`),n.push(`2. **Architecture Summary** (category: \`architecture\`)
|
|
16
|
-
- Layer structure, dependency flow
|
|
17
|
-
- Key design decisions
|
|
18
|
-
`),n.push(`3. **Pattern Usage** (category: \`patterns\`)
|
|
19
|
-
- Which patterns are used and why
|
|
20
|
-
- Where to find examples
|
|
21
|
-
`),n.push(`4. **Conventions** (category: \`conventions\`)
|
|
22
|
-
- Naming conventions observed
|
|
23
|
-
- File organization rules
|
|
24
|
-
- Testing patterns
|
|
25
|
-
`),n.push("Store each as a separate `aikit_remember` call with descriptive titles.\n"),n.join(`
|
|
26
|
-
`)}buildCrossReferences(e){let t=[],n=new Set;if(e.symbols?.output)for(let t of e.symbols.output.matchAll(/`(\w+)`\s*\((?:function|class|interface|type|const|enum)\)/g))n.add(t[1]);let r=new Set;if(e.entryPoints?.output)for(let t of e.entryPoints.output.matchAll(/`(\w+)`.*?(?:handler|main|server|cli|test|construct)/gi))r.add(t[1]);for(let e of r)n.has(e)&&t.push(`Entry point \`${e}\` is also listed in symbols — check its call graph for downstream dependencies`);if(e.patterns?.output&&n.size>0){for(let r of[`Singleton`,`Factory`,`Observer`,`Builder`,`Strategy`,`Middleware`,`Repository`])if(e.patterns.output.includes(r)){let i=e.patterns.output.split(r)[1]?.slice(0,200)??``;for(let e of n)if(i.includes(e)){t.push(`Symbol \`${e}\` uses the ${r} pattern`);break}}}return t}};export{n as KnowledgeProducer};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AnalysisResult, AnalyzerOptions, IAnalyzer } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region packages/analyzers/src/pattern-analyzer.d.ts
|
|
4
|
-
declare class PatternAnalyzer implements IAnalyzer<AnalyzerOptions> {
|
|
5
|
-
readonly name = "patterns";
|
|
6
|
-
analyze(rootPath: string, _options?: AnalyzerOptions): Promise<AnalysisResult>;
|
|
7
|
-
private collectDirectories;
|
|
8
|
-
private collectCodeFiles;
|
|
9
|
-
private detectDirectoryPatterns;
|
|
10
|
-
private detectCodePatterns;
|
|
11
|
-
private detectConfigPatterns;
|
|
12
|
-
private formatMarkdown;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { PatternAnalyzer };
|