@vpxa/kb 0.1.13 → 0.1.15
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 +8 -2
- package/package.json +10 -7
- package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -20
- package/packages/analyzers/dist/blast-radius-analyzer.js +6 -12
- package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -27
- package/packages/analyzers/dist/dependency-analyzer.js +7 -9
- package/packages/analyzers/dist/diagram-generator.d.ts +12 -8
- package/packages/analyzers/dist/diagram-generator.js +3 -4
- package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -35
- package/packages/analyzers/dist/entry-point-analyzer.js +5 -6
- package/packages/analyzers/dist/index.d.ts +12 -14
- package/packages/analyzers/dist/index.js +1 -1
- package/packages/analyzers/dist/knowledge-producer.d.ts +29 -25
- package/packages/analyzers/dist/knowledge-producer.js +16 -15
- package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -10
- package/packages/analyzers/dist/pattern-analyzer.js +3 -5
- package/packages/analyzers/dist/regex-call-graph.d.ts +6 -12
- package/packages/analyzers/dist/regex-call-graph.js +2 -1
- package/packages/analyzers/dist/structure-analyzer.d.ts +13 -9
- package/packages/analyzers/dist/structure-analyzer.js +3 -4
- package/packages/analyzers/dist/symbol-analyzer.d.ts +12 -8
- package/packages/analyzers/dist/symbol-analyzer.js +8 -13
- package/packages/analyzers/dist/ts-call-graph.d.ts +16 -13
- package/packages/analyzers/dist/ts-call-graph.js +2 -1
- package/packages/analyzers/dist/types.d.ts +82 -79
- package/packages/analyzers/dist/types.js +1 -0
- package/packages/chunker/dist/call-graph-extractor.d.ts +13 -10
- package/packages/chunker/dist/call-graph-extractor.js +2 -1
- package/packages/chunker/dist/chunker-factory.d.ts +6 -2
- package/packages/chunker/dist/chunker-factory.js +2 -1
- package/packages/chunker/dist/chunker.interface.d.ts +8 -4
- package/packages/chunker/dist/chunker.interface.js +1 -0
- package/packages/chunker/dist/code-chunker.d.ts +16 -12
- package/packages/chunker/dist/code-chunker.js +12 -14
- package/packages/chunker/dist/generic-chunker.d.ts +14 -10
- package/packages/chunker/dist/generic-chunker.js +6 -5
- package/packages/chunker/dist/index.d.ts +8 -8
- package/packages/chunker/dist/index.js +1 -1
- package/packages/chunker/dist/markdown-chunker.d.ts +16 -12
- package/packages/chunker/dist/markdown-chunker.js +4 -10
- package/packages/chunker/dist/treesitter-chunker.d.ts +28 -31
- package/packages/chunker/dist/treesitter-chunker.js +7 -8
- package/packages/cli/dist/commands/analyze.d.ts +6 -2
- package/packages/cli/dist/commands/analyze.js +3 -3
- package/packages/cli/dist/commands/context-cmds.d.ts +6 -2
- package/packages/cli/dist/commands/context-cmds.js +2 -1
- package/packages/cli/dist/commands/environment.d.ts +6 -2
- package/packages/cli/dist/commands/environment.js +2 -2
- package/packages/cli/dist/commands/execution.d.ts +6 -2
- package/packages/cli/dist/commands/execution.js +2 -1
- package/packages/cli/dist/commands/graph.d.ts +6 -2
- package/packages/cli/dist/commands/graph.js +6 -6
- package/packages/cli/dist/commands/init/adapters.d.ts +27 -0
- package/packages/cli/dist/commands/init/adapters.js +2 -0
- package/packages/cli/dist/commands/init/config.d.ts +11 -0
- package/packages/cli/dist/commands/init/config.js +4 -0
- package/packages/cli/dist/commands/init/curated.d.ts +8 -0
- package/packages/cli/dist/commands/init/curated.js +2 -0
- package/packages/cli/dist/commands/init/index.d.ts +23 -0
- package/packages/cli/dist/commands/init/index.js +3 -0
- package/packages/cli/dist/commands/init/scaffold.d.ts +24 -0
- package/packages/cli/dist/commands/init/scaffold.js +2 -0
- package/packages/cli/dist/commands/init/templates.d.ts +10 -0
- package/packages/cli/dist/commands/init/templates.js +302 -0
- package/packages/cli/dist/commands/init.d.ts +8 -3
- package/packages/cli/dist/commands/init.js +120 -123
- package/packages/cli/dist/commands/knowledge.d.ts +6 -2
- package/packages/cli/dist/commands/knowledge.js +2 -1
- package/packages/cli/dist/commands/search.d.ts +6 -2
- package/packages/cli/dist/commands/search.js +2 -8
- package/packages/cli/dist/commands/system.d.ts +6 -2
- package/packages/cli/dist/commands/system.js +5 -7
- package/packages/cli/dist/commands/workspace.d.ts +6 -2
- package/packages/cli/dist/commands/workspace.js +2 -2
- package/packages/cli/dist/context.d.ts +7 -4
- package/packages/cli/dist/context.js +2 -1
- package/packages/cli/dist/helpers.d.ts +51 -47
- package/packages/cli/dist/helpers.js +6 -5
- package/packages/cli/dist/index.d.ts +4 -1
- package/packages/cli/dist/index.js +3 -2
- package/packages/cli/dist/kb-init.d.ts +48 -50
- package/packages/cli/dist/kb-init.js +2 -1
- package/packages/cli/dist/types.d.ts +8 -5
- package/packages/cli/dist/types.js +1 -0
- package/packages/core/dist/constants.d.ts +36 -33
- package/packages/core/dist/constants.js +2 -1
- package/packages/core/dist/content-detector.d.ts +8 -7
- package/packages/core/dist/content-detector.js +2 -1
- package/packages/core/dist/errors.d.ts +15 -12
- package/packages/core/dist/errors.js +2 -1
- package/packages/core/dist/index.d.ts +6 -6
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/logger.d.ts +16 -7
- package/packages/core/dist/logger.js +2 -1
- package/packages/core/dist/types.d.ts +107 -91
- package/packages/core/dist/types.js +2 -0
- package/packages/embeddings/dist/embedder.interface.d.ts +22 -19
- package/packages/embeddings/dist/embedder.interface.js +1 -0
- package/packages/embeddings/dist/index.d.ts +3 -3
- package/packages/embeddings/dist/index.js +1 -1
- package/packages/embeddings/dist/onnx-embedder.d.ts +21 -22
- package/packages/embeddings/dist/onnx-embedder.js +2 -1
- package/packages/enterprise-bridge/dist/cache.d.ts +29 -0
- package/packages/enterprise-bridge/dist/cache.js +2 -0
- package/packages/enterprise-bridge/dist/er-client.d.ts +38 -0
- package/packages/enterprise-bridge/dist/er-client.js +2 -0
- package/packages/enterprise-bridge/dist/evolution-collector.d.ts +63 -0
- package/packages/enterprise-bridge/dist/evolution-collector.js +2 -0
- package/packages/enterprise-bridge/dist/index.d.ts +8 -0
- package/packages/enterprise-bridge/dist/index.js +1 -0
- package/packages/enterprise-bridge/dist/policy-store.d.ts +46 -0
- package/packages/enterprise-bridge/dist/policy-store.js +2 -0
- package/packages/enterprise-bridge/dist/push-adapter.d.ts +24 -0
- package/packages/enterprise-bridge/dist/push-adapter.js +2 -0
- package/packages/enterprise-bridge/dist/result-merger.d.ts +15 -0
- package/packages/enterprise-bridge/dist/result-merger.js +2 -0
- package/packages/enterprise-bridge/dist/types.d.ts +82 -0
- package/packages/enterprise-bridge/dist/types.js +2 -0
- package/packages/indexer/dist/file-hasher.d.ts +5 -2
- package/packages/indexer/dist/file-hasher.js +2 -1
- package/packages/indexer/dist/filesystem-crawler.d.ts +23 -20
- package/packages/indexer/dist/filesystem-crawler.js +2 -1
- package/packages/indexer/dist/graph-extractor.d.ts +9 -12
- package/packages/indexer/dist/graph-extractor.js +2 -1
- package/packages/indexer/dist/incremental-indexer.d.ts +49 -43
- package/packages/indexer/dist/incremental-indexer.js +2 -1
- package/packages/indexer/dist/index.d.ts +5 -5
- package/packages/indexer/dist/index.js +1 -1
- package/packages/server/dist/api.d.ts +3 -8
- package/packages/server/dist/api.js +1 -1
- package/packages/server/dist/config.d.ts +6 -2
- package/packages/server/dist/config.js +2 -1
- package/packages/server/dist/curated-manager.d.ts +79 -76
- package/packages/server/dist/curated-manager.js +6 -10
- package/packages/server/dist/index.d.ts +1 -2
- package/packages/server/dist/index.js +2 -1
- package/packages/server/dist/replay-interceptor.d.ts +6 -6
- package/packages/server/dist/replay-interceptor.js +2 -1
- package/packages/server/dist/resources/resources.d.ts +7 -3
- package/packages/server/dist/resources/resources.js +3 -2
- package/packages/server/dist/server.d.ts +34 -24
- package/packages/server/dist/server.js +2 -1
- package/packages/server/dist/tools/analyze.tools.d.ts +14 -10
- package/packages/server/dist/tools/analyze.tools.js +2 -3
- package/packages/server/dist/tools/audit.tool.d.ts +8 -4
- package/packages/server/dist/tools/audit.tool.js +2 -4
- package/packages/server/dist/tools/bridge.tools.d.ts +35 -0
- package/packages/server/dist/tools/bridge.tools.js +16 -0
- package/packages/server/dist/tools/evolution.tools.d.ts +8 -0
- package/packages/server/dist/tools/evolution.tools.js +6 -0
- package/packages/server/dist/tools/forge.tools.d.ts +13 -11
- package/packages/server/dist/tools/forge.tools.js +11 -13
- package/packages/server/dist/tools/forget.tool.d.ts +7 -3
- package/packages/server/dist/tools/forget.tool.js +2 -7
- package/packages/server/dist/tools/graph.tool.d.ts +7 -3
- package/packages/server/dist/tools/graph.tool.js +5 -5
- package/packages/server/dist/tools/list.tool.d.ts +7 -3
- package/packages/server/dist/tools/list.tool.js +3 -8
- package/packages/server/dist/tools/lookup.tool.d.ts +7 -3
- package/packages/server/dist/tools/lookup.tool.js +3 -9
- package/packages/server/dist/tools/onboard.tool.d.ts +8 -4
- package/packages/server/dist/tools/onboard.tool.js +3 -2
- package/packages/server/dist/tools/policy.tools.d.ts +8 -0
- package/packages/server/dist/tools/policy.tools.js +3 -0
- package/packages/server/dist/tools/produce.tool.d.ts +6 -2
- package/packages/server/dist/tools/produce.tool.js +3 -2
- package/packages/server/dist/tools/read.tool.d.ts +7 -3
- package/packages/server/dist/tools/read.tool.js +3 -6
- package/packages/server/dist/tools/reindex.tool.d.ts +10 -6
- package/packages/server/dist/tools/reindex.tool.js +3 -2
- package/packages/server/dist/tools/remember.tool.d.ts +8 -3
- package/packages/server/dist/tools/remember.tool.js +4 -5
- package/packages/server/dist/tools/replay.tool.d.ts +6 -2
- package/packages/server/dist/tools/replay.tool.js +3 -6
- package/packages/server/dist/tools/search.tool.d.ts +10 -4
- package/packages/server/dist/tools/search.tool.js +7 -22
- package/packages/server/dist/tools/status.tool.d.ts +7 -3
- package/packages/server/dist/tools/status.tool.js +3 -3
- package/packages/server/dist/tools/toolkit.tools.d.ts +36 -34
- package/packages/server/dist/tools/toolkit.tools.js +20 -24
- package/packages/server/dist/tools/update.tool.d.ts +7 -3
- package/packages/server/dist/tools/update.tool.js +2 -6
- package/packages/server/dist/tools/utility.tools.d.ts +15 -14
- package/packages/server/dist/tools/utility.tools.js +11 -23
- package/packages/server/dist/version-check.d.ts +5 -1
- package/packages/server/dist/version-check.js +2 -1
- package/packages/store/dist/graph-store.interface.d.ts +89 -86
- package/packages/store/dist/graph-store.interface.js +1 -0
- package/packages/store/dist/index.d.ts +6 -6
- package/packages/store/dist/index.js +1 -1
- package/packages/store/dist/lance-store.d.ts +37 -30
- package/packages/store/dist/lance-store.js +2 -1
- package/packages/store/dist/sqlite-graph-store.d.ts +43 -46
- package/packages/store/dist/sqlite-graph-store.js +14 -13
- package/packages/store/dist/store-factory.d.ts +11 -7
- package/packages/store/dist/store-factory.js +2 -1
- package/packages/store/dist/store.interface.d.ts +47 -46
- package/packages/store/dist/store.interface.js +1 -0
- package/packages/tools/dist/audit.d.ts +61 -61
- package/packages/tools/dist/audit.js +5 -5
- package/packages/tools/dist/batch.d.ts +20 -17
- package/packages/tools/dist/batch.js +2 -1
- package/packages/tools/dist/changelog.d.ts +29 -26
- package/packages/tools/dist/changelog.js +3 -2
- package/packages/tools/dist/check.d.ts +42 -38
- package/packages/tools/dist/check.js +3 -2
- package/packages/tools/dist/checkpoint.d.ts +17 -14
- package/packages/tools/dist/checkpoint.js +2 -2
- package/packages/tools/dist/codemod.d.ts +35 -32
- package/packages/tools/dist/codemod.js +3 -2
- package/packages/tools/dist/compact.d.ts +34 -37
- package/packages/tools/dist/compact.js +3 -2
- package/packages/tools/dist/data-transform.d.ts +10 -7
- package/packages/tools/dist/data-transform.js +2 -1
- package/packages/tools/dist/dead-symbols.d.ts +29 -25
- package/packages/tools/dist/dead-symbols.js +3 -2
- package/packages/tools/dist/delegate.d.ts +26 -23
- package/packages/tools/dist/delegate.js +2 -5
- package/packages/tools/dist/diff-parse.d.ts +24 -21
- package/packages/tools/dist/diff-parse.js +4 -3
- package/packages/tools/dist/digest.d.ts +43 -45
- package/packages/tools/dist/digest.js +5 -5
- package/packages/tools/dist/encode.d.ts +11 -8
- package/packages/tools/dist/encode.js +2 -1
- package/packages/tools/dist/env-info.d.ts +25 -22
- package/packages/tools/dist/env-info.js +2 -1
- package/packages/tools/dist/eval.d.ts +13 -10
- package/packages/tools/dist/eval.js +3 -3
- package/packages/tools/dist/evidence-map.d.ts +64 -61
- package/packages/tools/dist/evidence-map.js +3 -3
- package/packages/tools/dist/file-cache.d.ts +42 -0
- package/packages/tools/dist/file-cache.js +4 -0
- package/packages/tools/dist/file-summary.d.ts +34 -29
- package/packages/tools/dist/file-summary.js +3 -2
- package/packages/tools/dist/file-walk.d.ts +6 -3
- package/packages/tools/dist/file-walk.js +2 -1
- package/packages/tools/dist/find-examples.d.ts +26 -21
- package/packages/tools/dist/find-examples.js +4 -3
- package/packages/tools/dist/find.d.ts +39 -40
- package/packages/tools/dist/find.js +2 -1
- package/packages/tools/dist/forge-classify.d.ts +35 -38
- package/packages/tools/dist/forge-classify.js +3 -2
- package/packages/tools/dist/forge-ground.d.ts +58 -60
- package/packages/tools/dist/forge-ground.js +2 -1
- package/packages/tools/dist/git-context.d.ts +22 -19
- package/packages/tools/dist/git-context.js +4 -3
- package/packages/tools/dist/graph-query.d.ts +75 -78
- package/packages/tools/dist/graph-query.js +2 -1
- package/packages/tools/dist/guide.d.ts +14 -11
- package/packages/tools/dist/guide.js +2 -1
- package/packages/tools/dist/health.d.ts +13 -10
- package/packages/tools/dist/health.js +3 -2
- package/packages/tools/dist/http-request.d.ts +20 -17
- package/packages/tools/dist/http-request.js +2 -1
- package/packages/tools/dist/index.d.ts +54 -53
- package/packages/tools/dist/index.js +1 -1
- package/packages/tools/dist/lane.d.ts +28 -25
- package/packages/tools/dist/lane.js +7 -7
- package/packages/tools/dist/measure.d.ts +32 -29
- package/packages/tools/dist/measure.js +3 -2
- package/packages/tools/dist/onboard.d.ts +29 -26
- package/packages/tools/dist/onboard.js +18 -41
- package/packages/tools/dist/parse-output.d.ts +48 -45
- package/packages/tools/dist/parse-output.js +3 -2
- package/packages/tools/dist/path-resolver.d.ts +4 -1
- package/packages/tools/dist/path-resolver.js +2 -1
- package/packages/tools/dist/process-manager.d.ts +18 -15
- package/packages/tools/dist/process-manager.js +2 -1
- package/packages/tools/dist/queue.d.ts +28 -25
- package/packages/tools/dist/queue.js +2 -2
- package/packages/tools/dist/regex-test.d.ts +26 -23
- package/packages/tools/dist/regex-test.js +2 -1
- package/packages/tools/dist/rename.d.ts +28 -25
- package/packages/tools/dist/rename.js +3 -2
- package/packages/tools/dist/replay.d.ts +32 -29
- package/packages/tools/dist/replay.js +5 -6
- package/packages/tools/dist/response-envelope.d.ts +32 -29
- package/packages/tools/dist/response-envelope.js +2 -1
- package/packages/tools/dist/schema-validate.d.ts +15 -12
- package/packages/tools/dist/schema-validate.js +2 -1
- package/packages/tools/dist/scope-map.d.ts +45 -47
- package/packages/tools/dist/scope-map.js +2 -1
- package/packages/tools/dist/snippet.d.ts +26 -24
- package/packages/tools/dist/snippet.js +2 -1
- package/packages/tools/dist/stash.d.ts +13 -10
- package/packages/tools/dist/stash.js +2 -2
- package/packages/tools/dist/stratum-card.d.ts +27 -27
- package/packages/tools/dist/stratum-card.js +4 -5
- package/packages/tools/dist/symbol.d.ts +29 -25
- package/packages/tools/dist/symbol.js +4 -3
- package/packages/tools/dist/test-run.d.ts +19 -15
- package/packages/tools/dist/test-run.js +3 -2
- package/packages/tools/dist/text-utils.d.ts +6 -3
- package/packages/tools/dist/text-utils.js +3 -2
- package/packages/tools/dist/time-utils.d.ts +15 -12
- package/packages/tools/dist/time-utils.js +2 -1
- package/packages/tools/dist/trace.d.ts +24 -20
- package/packages/tools/dist/trace.js +3 -2
- package/packages/tools/dist/truncation.d.ts +6 -3
- package/packages/tools/dist/truncation.js +8 -14
- package/packages/tools/dist/watch.d.ts +28 -25
- package/packages/tools/dist/watch.js +2 -1
- package/packages/tools/dist/web-fetch.d.ts +35 -32
- package/packages/tools/dist/web-fetch.js +7 -12
- package/packages/tools/dist/web-search.d.ts +16 -13
- package/packages/tools/dist/web-search.js +2 -1
- package/packages/tools/dist/workset.d.ts +19 -16
- package/packages/tools/dist/workset.js +2 -2
- package/packages/tui/dist/App-BAlmxCCw.js +3 -0
- package/packages/tui/dist/App.d.ts +11 -5
- package/packages/tui/dist/App.js +1 -450
- package/packages/tui/dist/CuratedPanel-sYdZAICX.js +3 -0
- package/packages/tui/dist/LogPanel-DVB8Sv46.js +4 -0
- package/packages/tui/dist/SearchPanel-DREo6zgt.js +3 -0
- package/packages/tui/dist/StatusPanel-2ex8fLOO.js +3 -0
- package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
- package/packages/tui/dist/devtools-DUyj952l.js +8 -0
- package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +29 -0
- package/packages/tui/dist/index-B9VpfVPP.d.ts +14 -0
- package/packages/tui/dist/index.d.ts +3 -19
- package/packages/tui/dist/index.js +2 -476
- package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +317 -0
- package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -5
- package/packages/tui/dist/panels/CuratedPanel.js +1 -371
- package/packages/tui/dist/panels/LogPanel.d.ts +7 -2
- package/packages/tui/dist/panels/LogPanel.js +1 -449
- package/packages/tui/dist/panels/SearchPanel.d.ts +14 -7
- package/packages/tui/dist/panels/SearchPanel.js +1 -372
- package/packages/tui/dist/panels/StatusPanel.d.ts +11 -5
- package/packages/tui/dist/panels/StatusPanel.js +1 -371
- package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +151 -0
- package/scaffold/adapters/claude-code.mjs +20 -0
- package/scaffold/adapters/copilot.mjs +320 -0
- package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +14 -0
- package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +14 -0
- package/scaffold/copilot/agents/Code-Reviewer-Alpha.agent.md +12 -0
- package/scaffold/copilot/agents/Code-Reviewer-Beta.agent.md +12 -0
- package/scaffold/copilot/agents/Debugger.agent.md +31 -0
- package/scaffold/copilot/agents/Documenter.agent.md +35 -0
- package/scaffold/copilot/agents/Explorer.agent.md +50 -0
- package/scaffold/copilot/agents/Frontend.agent.md +29 -0
- package/scaffold/copilot/agents/Implementer.agent.md +31 -0
- package/scaffold/copilot/agents/Orchestrator.agent.md +96 -0
- package/scaffold/copilot/agents/Planner.agent.md +45 -0
- package/scaffold/copilot/agents/README.md +57 -0
- package/scaffold/copilot/agents/Refactor.agent.md +30 -0
- package/scaffold/copilot/agents/Researcher-Alpha.agent.md +12 -0
- package/scaffold/copilot/agents/Researcher-Beta.agent.md +12 -0
- package/scaffold/copilot/agents/Researcher-Delta.agent.md +12 -0
- package/scaffold/copilot/agents/Researcher-Gamma.agent.md +12 -0
- package/scaffold/copilot/agents/Security.agent.md +42 -0
- package/scaffold/copilot/agents/_shared/adr-protocol.md +91 -0
- package/scaffold/copilot/agents/_shared/architect-reviewer-base.md +50 -0
- package/scaffold/copilot/agents/_shared/code-agent-base.md +70 -0
- package/scaffold/copilot/agents/_shared/code-reviewer-base.md +54 -0
- package/scaffold/copilot/agents/_shared/decision-protocol.md +27 -0
- package/scaffold/copilot/agents/_shared/forge-protocol.md +46 -0
- package/scaffold/copilot/agents/_shared/researcher-base.md +61 -0
- package/scaffold/copilot/agents/templates/adr-template.md +27 -0
- package/scaffold/copilot/agents/templates/execution-state.md +25 -0
- package/scaffold/copilot/prompts/ask.prompt.md +20 -0
- package/scaffold/copilot/prompts/debug.prompt.md +25 -0
- package/scaffold/copilot/prompts/design.prompt.md +22 -0
- package/scaffold/copilot/prompts/implement.prompt.md +26 -0
- package/scaffold/copilot/prompts/plan.prompt.md +24 -0
- package/scaffold/copilot/prompts/review.prompt.md +31 -0
- package/scaffold/definitions/agents.mjs +165 -0
- package/scaffold/definitions/bodies.mjs +292 -0
- package/scaffold/definitions/hooks.mjs +43 -0
- package/scaffold/definitions/models.mjs +56 -0
- package/scaffold/definitions/plugins.mjs +24 -0
- package/scaffold/definitions/prompts.mjs +145 -0
- package/scaffold/definitions/protocols.mjs +322 -0
- package/scaffold/definitions/tools.mjs +176 -0
- package/scaffold/generate.mjs +74 -0
- package/skills/brainstorming/SKILL.md +259 -0
- package/skills/brainstorming/scripts/frame-template.html +365 -0
- package/skills/brainstorming/scripts/helper.js +216 -0
- package/skills/brainstorming/scripts/server.cjs +9 -0
- package/skills/brainstorming/scripts/server.src.cjs +249 -0
- package/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/brainstorming/visual-companion.md +430 -0
- package/skills/knowledge-base/SKILL.md +22 -9
|
@@ -1,98 +1,101 @@
|
|
|
1
|
+
//#region packages/analyzers/src/types.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Analyzer interfaces and result types.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
interface AnalysisResult {
|
|
6
|
+
/** Formatted output (Markdown, JSON, or Mermaid) */
|
|
7
|
+
output: string;
|
|
8
|
+
/** Structured data for programmatic access */
|
|
9
|
+
data: Record<string, unknown>;
|
|
10
|
+
/** Analysis metadata */
|
|
11
|
+
meta: {
|
|
12
|
+
analyzedAt: string;
|
|
13
|
+
scope: string;
|
|
14
|
+
fileCount: number;
|
|
15
|
+
durationMs: number;
|
|
16
|
+
};
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
interface AnalyzerOptions {
|
|
19
|
+
format?: 'json' | 'markdown' | 'mermaid';
|
|
20
|
+
[key: string]: unknown;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
interface IAnalyzer<TOpts extends AnalyzerOptions = AnalyzerOptions> {
|
|
23
|
+
readonly name: string;
|
|
24
|
+
analyze(rootPath: string, options?: TOpts): Promise<AnalysisResult>;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
interface StructureAnalyzerOptions extends AnalyzerOptions {
|
|
27
|
+
format?: 'json' | 'markdown';
|
|
28
|
+
maxDepth?: number;
|
|
29
|
+
/** When true, only include source code and config files (no docs, images, fonts, etc.) */
|
|
30
|
+
sourceOnly?: boolean;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
interface DependencyAnalyzerOptions extends AnalyzerOptions {
|
|
33
|
+
format?: 'json' | 'markdown' | 'mermaid';
|
|
34
|
+
maxNodes?: number;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
interface SymbolAnalyzerOptions extends AnalyzerOptions {
|
|
37
|
+
filter?: string;
|
|
38
|
+
format?: 'json' | 'markdown';
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
interface DiagramOptions extends AnalyzerOptions {
|
|
41
|
+
diagramType?: 'architecture' | 'dependencies';
|
|
42
|
+
scope?: string;
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
interface TreeNode {
|
|
45
|
+
name: string;
|
|
46
|
+
type: 'file' | 'directory';
|
|
47
|
+
purpose?: string;
|
|
48
|
+
language?: string;
|
|
49
|
+
size?: number;
|
|
50
|
+
children?: TreeNode[];
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
interface ProjectStats {
|
|
53
|
+
totalFiles: number;
|
|
54
|
+
totalSize: number;
|
|
55
|
+
languages: Record<string, number>;
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
interface ImportInfo {
|
|
58
|
+
source: string;
|
|
59
|
+
specifiers: string[];
|
|
60
|
+
filePath: string;
|
|
61
|
+
isExternal: boolean;
|
|
62
|
+
/** Confidence level based on import resolution method */
|
|
63
|
+
confidence: 'high' | 'medium' | 'low';
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
interface SymbolInfo {
|
|
66
|
+
name: string;
|
|
67
|
+
kind: 'function' | 'class' | 'interface' | 'type' | 'const' | 'enum' | 'variable' | 'method';
|
|
68
|
+
exported: boolean;
|
|
69
|
+
filePath: string;
|
|
70
|
+
line: number;
|
|
71
|
+
/** Full signature for functions/methods (parameter list + return type) */
|
|
72
|
+
signature?: string;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
interface PatternMatch {
|
|
75
|
+
pattern: string;
|
|
76
|
+
description: string;
|
|
77
|
+
locations: string[];
|
|
78
|
+
confidence: 'high' | 'medium' | 'low';
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
interface EntryPoint {
|
|
81
|
+
name: string;
|
|
82
|
+
type: 'lambda-handler' | 'main' | 'bin' | 'server' | 'cli' | 'test' | 'cdk-construct';
|
|
83
|
+
filePath: string;
|
|
84
|
+
trigger?: string;
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
interface ExtractionBaselines {
|
|
87
|
+
structure?: AnalysisResult;
|
|
88
|
+
dependencies?: AnalysisResult;
|
|
89
|
+
symbols?: AnalysisResult;
|
|
90
|
+
patterns?: AnalysisResult;
|
|
91
|
+
entryPoints?: AnalysisResult;
|
|
92
|
+
diagrams?: AnalysisResult[];
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
interface ExistingKnowledge {
|
|
95
|
+
categories: string[];
|
|
96
|
+
lastProduced: Record<string, string>;
|
|
97
|
+
documentCount: number;
|
|
97
98
|
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { AnalysisResult, AnalyzerOptions, DependencyAnalyzerOptions, DiagramOptions, EntryPoint, ExistingKnowledge, ExtractionBaselines, IAnalyzer, ImportInfo, PatternMatch, ProjectStats, StructureAnalyzerOptions, SymbolAnalyzerOptions, SymbolInfo, TreeNode };
|
|
98
101
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
//#region packages/chunker/src/call-graph-extractor.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Call-graph extractor using tree-sitter AST.
|
|
3
4
|
*
|
|
4
5
|
* Extracts function-level call sites from parsed code, producing
|
|
5
6
|
* caller→callee edges for blast-radius and dependency analysis.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
interface CallEdge {
|
|
9
|
+
/** File containing the call */
|
|
10
|
+
callerFile: string;
|
|
11
|
+
/** Function/method making the call (or '<module>' for top-level) */
|
|
12
|
+
callerName: string;
|
|
13
|
+
/** Name of the function/method being called */
|
|
14
|
+
calleeName: string;
|
|
15
|
+
/** 1-based line number of the call site */
|
|
16
|
+
line: number;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Extract call edges from a source file using tree-sitter AST.
|
|
19
20
|
* Returns null if tree-sitter is unavailable or doesn't support the language.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
declare function extractCallEdges(content: string, filePath: string): CallEdge[] | null;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { CallEdge, extractCallEdges };
|
|
22
25
|
//# sourceMappingURL=call-graph-extractor.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{TreeSitterRuntime as e}from"./treesitter-chunker.js";import{extname as t}from"node:path";const n=new Set([`function_declaration`,`method_definition`,`arrow_function`,`function_definition`,`function_declaration`,`method_declaration`,`function_item`,`method_declaration`,`constructor_declaration`]),r=new Set([`call_expression`,`new_expression`,`call`]);function i(n,r){let i=e.get();if(!i)return null;let o=t(r).toLowerCase();if(!i.hasLanguage(o))return null;let s=i.parse(n,o);if(!s)return null;let c=[],l=s.rootNode;return a(l,r,`<module>`,c),c}function a(e,t,i,c){if(!e)return;let l=i;if(n.has(e.type)&&(l=o(e)??i),r.has(e.type)){let n=s(e);n&&c.push({callerFile:t,callerName:l,calleeName:n,line:(e.startPosition?.row??0)+1})}for(let n=0;n<(e.childCount??0);n++){let r=e.child(n);r&&a(r,t,l,c)}}function o(e){for(let t=0;t<(e.childCount??0);t++){let n=e.child(t);if(n&&(n.type===`identifier`||n.type===`property_identifier`||n.type===`name`))return n.text??null}return null}function s(e){let t=e.childForFieldName?.(`function`)??e.child(0);return t?t.type===`identifier`||t.type===`name`?t.text??null:t.type===`member_expression`||t.type===`attribute`?(t.childForFieldName?.(`property`)??t.childForFieldName?.(`attribute`))?.text??null:e.type===`new_expression`?e.child(1)?.text??null:null:null}export{i as extractCallEdges};
|
|
2
|
+
//# sourceMappingURL=call-graph-extractor.js.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IChunker } from "./chunker.interface.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/chunker/src/chunker-factory.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Create the appropriate chunker for a file extension.
|
|
4
6
|
* Prefers tree-sitter AST-based chunking when available; falls back to regex-based.
|
|
5
7
|
*/
|
|
6
|
-
|
|
8
|
+
declare function createChunker(fileExtension: string): IChunker;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createChunker };
|
|
7
11
|
//# sourceMappingURL=chunker-factory.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{CodeChunker as
|
|
1
|
+
import{CodeChunker as e}from"./code-chunker.js";import{TreeSitterChunker as t,TreeSitterRuntime as n}from"./treesitter-chunker.js";import{GenericChunker as r}from"./generic-chunker.js";import{MarkdownChunker as i}from"./markdown-chunker.js";function a(a){let o=a.toLowerCase();switch(o){case`.md`:case`.mdx`:return new i;case`.ts`:case`.tsx`:case`.mts`:case`.cts`:case`.js`:case`.jsx`:case`.mjs`:case`.cjs`:case`.py`:case`.go`:case`.rs`:case`.java`:{let r=n.get();return r?.hasLanguage(o)?new t(r):new e}default:return new r}}export{a as createChunker};
|
|
2
|
+
//# sourceMappingURL=chunker-factory.js.map
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ChunkMetadata, RawChunk } from "@kb/core";
|
|
2
|
+
|
|
3
|
+
//#region packages/chunker/src/chunker.interface.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Interface for content chunkers.
|
|
4
6
|
* Each chunker splits a specific content type into searchable chunks.
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
interface IChunker {
|
|
9
|
+
/** Split content into chunks */
|
|
10
|
+
chunk(content: string, metadata: ChunkMetadata): RawChunk[];
|
|
9
11
|
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { IChunker };
|
|
10
14
|
//# sourceMappingURL=chunker.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { IChunker } from "./chunker.interface.js";
|
|
2
|
+
import { ChunkMetadata, RawChunk } from "@kb/core";
|
|
3
|
+
|
|
4
|
+
//#region packages/chunker/src/code-chunker.d.ts
|
|
5
|
+
declare class CodeChunker implements IChunker {
|
|
6
|
+
private readonly maxChunkSize;
|
|
7
|
+
constructor(options?: {
|
|
8
|
+
maxChunkSize?: number;
|
|
9
|
+
});
|
|
10
|
+
chunk(content: string, metadata: ChunkMetadata): RawChunk[];
|
|
11
|
+
private findDeclarationBoundaries;
|
|
12
|
+
private fallbackChunk;
|
|
13
|
+
private splitByLines;
|
|
14
|
+
private getLineNumber;
|
|
13
15
|
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { CodeChunker };
|
|
14
18
|
//# sourceMappingURL=code-chunker.d.ts.map
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import{CHUNK_SIZES as
|
|
2
|
-
|
|
3
|
-
`).length;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`)
|
|
8
|
-
`)
|
|
9
|
-
|
|
10
|
-
`)
|
|
11
|
-
`)
|
|
12
|
-
|
|
13
|
-
`)),s}getLineNumber(e,n){return e.slice(0,n).split(`
|
|
14
|
-
`).length}}export{C as CodeChunker};
|
|
1
|
+
import{CHUNK_SIZES as e}from"../../core/dist/index.js";var t=class{maxChunkSize;constructor(t){this.maxChunkSize=t?.maxChunkSize??e.code.max}chunk(e,t){let n=this.findDeclarationBoundaries(e);if(n.length===0)return this.fallbackChunk(e,t);let r=[];for(let i=0;i<n.length;i++){let a=n[i].offset,o=i+1<n.length?n[i+1].offset:e.length,s=e.slice(a,o).trim();if(s=`// File: ${t.sourcePath}\n`+s,s.length>this.maxChunkSize){let n=this.splitByLines(s,this.maxChunkSize),i=this.getLineNumber(e,a);for(let e of n){let n=e.split(`
|
|
2
|
+
`).length;r.push({text:e,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:i,endLine:i+n-1}),i+=n}}else{let n=this.getLineNumber(e,a);r.push({text:s,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:n,endLine:n+s.split(`
|
|
3
|
+
`).length-1})}}if(n[0].offset>0){let i=e.slice(0,n[0].offset).trim();i.length>0&&r.unshift({text:`// File: ${t.sourcePath}\n${i}`,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:0,totalChunks:0,startLine:1,endLine:this.getLineNumber(e,n[0].offset)-1})}return r.map((e,t)=>({...e,chunkIndex:t,totalChunks:r.length}))}findDeclarationBoundaries(e){let t=/^(?:export\s+)?(?:default\s+)?(?:async\s+)?(?:function|class|interface|type|const|enum|abstract\s+class)\s+(\w+)/gm,n=[],r;for(;(r=t.exec(e))!==null;){let t=e.lastIndexOf(`
|
|
4
|
+
`,r.index-1)+1,i=t,a=e.slice(0,t).split(`
|
|
5
|
+
`),o=a.length-1;for(;o>=0;){let e=a[o].trim();if(e===``||e.startsWith(`//`)||e.startsWith(`*`)||e.startsWith(`/*`)||e.startsWith(`*/`)||e.startsWith(`@`))o--;else break}o<a.length-1&&(i=a.slice(0,o+1).join(`
|
|
6
|
+
`).length+1),n.push({offset:i,name:r[1]})}return n}fallbackChunk(e,t){return[{text:`// File: ${t.sourcePath}\n`+e,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:0,totalChunks:1,startLine:1,endLine:e.split(`
|
|
7
|
+
`).length}]}splitByLines(e,t){let n=e.split(`
|
|
8
|
+
`),r=[],i=[],a=0;for(let e of n)a+e.length+1>t&&i.length>0?(r.push(i.join(`
|
|
9
|
+
`)),i=[e],a=e.length):(i.push(e),a+=e.length+1);return i.length>0&&r.push(i.join(`
|
|
10
|
+
`)),r}getLineNumber(e,t){return e.slice(0,t).split(`
|
|
11
|
+
`).length}};export{t as CodeChunker};
|
|
12
|
+
//# sourceMappingURL=code-chunker.js.map
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { IChunker } from "./chunker.interface.js";
|
|
2
|
+
import { ChunkMetadata, RawChunk } from "@kb/core";
|
|
3
|
+
|
|
4
|
+
//#region packages/chunker/src/generic-chunker.d.ts
|
|
5
|
+
declare class GenericChunker implements IChunker {
|
|
6
|
+
private readonly maxChunkSize;
|
|
7
|
+
private readonly overlap;
|
|
8
|
+
constructor(options?: {
|
|
9
|
+
maxChunkSize?: number;
|
|
10
|
+
overlap?: number;
|
|
11
|
+
});
|
|
12
|
+
chunk(content: string, metadata: ChunkMetadata): RawChunk[];
|
|
11
13
|
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { GenericChunker };
|
|
12
16
|
//# sourceMappingURL=generic-chunker.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import{CHUNK_SIZES as
|
|
2
|
-
`).length}];
|
|
3
|
-
`),r=[]
|
|
4
|
-
`),sourcePath:
|
|
5
|
-
`),sourcePath:
|
|
1
|
+
import{CHUNK_SIZES as e}from"../../core/dist/index.js";var t=class{maxChunkSize;overlap;constructor(t){this.maxChunkSize=t?.maxChunkSize??e.default.max,this.overlap=t?.overlap??e.default.overlap}chunk(e,t){if(e.length<=this.maxChunkSize)return[{text:e,sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:0,totalChunks:1,startLine:1,endLine:e.split(`
|
|
2
|
+
`).length}];let n=e.split(`
|
|
3
|
+
`),r=[],i=[],a=0,o=1;for(let e=0;e<n.length;e++){let s=n[e];if(a+s.length+1>this.maxChunkSize&&i.length>0){r.push({text:i.join(`
|
|
4
|
+
`),sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:o,endLine:o+i.length-1});let e=[],n=0;for(let t=i.length-1;t>=0&&!(n+i[t].length+1>this.overlap);t--)e.unshift(i[t]),n+=i[t].length+1;o=o+i.length-e.length,i=[...e,s],a=n+s.length+1}else i.push(s),a+=s.length+1}return i.length>0&&r.push({text:i.join(`
|
|
5
|
+
`),sourcePath:t.sourcePath,contentType:t.contentType,chunkIndex:r.length,totalChunks:0,startLine:o,endLine:o+i.length-1}),r.map((e,t)=>({...e,chunkIndex:t,totalChunks:r.length}))}};export{t as GenericChunker};
|
|
6
|
+
//# sourceMappingURL=generic-chunker.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { CallEdge, extractCallEdges } from "./call-graph-extractor.js";
|
|
2
|
+
import { IChunker } from "./chunker.interface.js";
|
|
3
|
+
import { createChunker } from "./chunker-factory.js";
|
|
4
|
+
import { CodeChunker } from "./code-chunker.js";
|
|
5
|
+
import { GenericChunker } from "./generic-chunker.js";
|
|
6
|
+
import { MarkdownChunker } from "./markdown-chunker.js";
|
|
7
|
+
import { TreeSitterChunker, TreeSitterRuntime, initializeTreeSitter } from "./treesitter-chunker.js";
|
|
8
|
+
export { type CallEdge, CodeChunker, GenericChunker, type IChunker, MarkdownChunker, TreeSitterChunker, TreeSitterRuntime, createChunker, extractCallEdges, initializeTreeSitter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{CodeChunker as e}from"./code-chunker.js";import{TreeSitterChunker as t,TreeSitterRuntime as n,initializeTreeSitter as r}from"./treesitter-chunker.js";import{extractCallEdges as i}from"./call-graph-extractor.js";import{GenericChunker as a}from"./generic-chunker.js";import{MarkdownChunker as o}from"./markdown-chunker.js";import{createChunker as s}from"./chunker-factory.js";export{e as CodeChunker,a as GenericChunker,o as MarkdownChunker,t as TreeSitterChunker,n as TreeSitterRuntime,s as createChunker,i as extractCallEdges,r as initializeTreeSitter};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { IChunker } from "./chunker.interface.js";
|
|
2
|
+
import { ChunkMetadata, RawChunk } from "@kb/core";
|
|
3
|
+
|
|
4
|
+
//#region packages/chunker/src/markdown-chunker.d.ts
|
|
5
|
+
declare class MarkdownChunker implements IChunker {
|
|
6
|
+
private readonly maxChunkSize;
|
|
7
|
+
private readonly minChunkSize;
|
|
8
|
+
constructor(options?: {
|
|
9
|
+
maxChunkSize?: number;
|
|
10
|
+
minChunkSize?: number;
|
|
11
|
+
});
|
|
12
|
+
chunk(content: string, metadata: ChunkMetadata): RawChunk[];
|
|
13
|
+
private splitByHeadings;
|
|
14
|
+
private splitByParagraphs;
|
|
13
15
|
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { MarkdownChunker };
|
|
14
18
|
//# sourceMappingURL=markdown-chunker.d.ts.map
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import{CHUNK_SIZES as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`),h=[];let t=null;const n=[];let i=!1;for(let e=0;e<s.length;e++){/^```/.test(s[e])&&(i=!i);const a=i?null:s[e].match(/^(#{1,6})\s+(.+)/);if(a){t&&h.push(t);const o=a[1].length,c=a[2].trim();for(;n.length>=o;)n.pop();n.push(`${"#".repeat(o)} ${c}`),t={text:s[e],headingPath:n.join(" > "),startLine:e+1,endLine:e+1}}else t?(t.text+=`
|
|
6
|
-
${s[e]}`,t.endLine=e+1):t={text:s[e],headingPath:"(intro)",startLine:e+1,endLine:e+1}}return t&&h.push(t),h}splitByParagraphs(r,s){const h=r.split(/\n\n+/),t=[];let n="";for(const i of h)`${n}
|
|
7
|
-
|
|
8
|
-
${i}`.length>s&&n.length>0?(t.push(n.trim()),n=i):n=n?`${n}
|
|
9
|
-
|
|
10
|
-
${i}`:i;return n.trim()&&t.push(n.trim()),t}}export{k as MarkdownChunker};
|
|
1
|
+
import{CHUNK_SIZES as e}from"../../core/dist/index.js";var t=class{maxChunkSize;minChunkSize;constructor(t){this.maxChunkSize=t?.maxChunkSize??e.markdown.max,this.minChunkSize=t?.minChunkSize??e.markdown.min}chunk(e,t){let n=this.splitByHeadings(e),r=[];for(let e of n){if(e.text.trim().length<this.minChunkSize&&r.length>0){let t=r[r.length-1];t.text+=`\n\n${e.text}`,t.endLine=e.endLine;continue}if(e.text.length>this.maxChunkSize){let n=this.splitByParagraphs(e.text,this.maxChunkSize),i=e.startLine;for(let a of n){let n=a.split(`
|
|
2
|
+
`).length;r.push({text:a,sourcePath:t.sourcePath,contentType:t.contentType,headingPath:e.headingPath,chunkIndex:r.length,totalChunks:0,startLine:i,endLine:i+n-1}),i+=n}}else r.push({text:e.text,sourcePath:t.sourcePath,contentType:t.contentType,headingPath:e.headingPath,chunkIndex:r.length,totalChunks:0,startLine:e.startLine,endLine:e.endLine})}return r.map((e,t)=>({...e,chunkIndex:t,totalChunks:r.length}))}splitByHeadings(e){let t=e.split(`
|
|
3
|
+
`),n=[],r=null,i=[],a=!1;for(let e=0;e<t.length;e++){/^```/.test(t[e])&&(a=!a);let o=a?null:t[e].match(/^(#{1,6})\s+(.+)/);if(o){r&&n.push(r);let a=o[1].length,s=o[2].trim();for(;i.length>=a;)i.pop();i.push(`${`#`.repeat(a)} ${s}`),r={text:t[e],headingPath:i.join(` > `),startLine:e+1,endLine:e+1}}else r?(r.text+=`\n${t[e]}`,r.endLine=e+1):r={text:t[e],headingPath:`(intro)`,startLine:e+1,endLine:e+1}}return r&&n.push(r),n}splitByParagraphs(e,t){let n=e.split(/\n\n+/),r=[],i=``;for(let e of n)`${i}\n\n${e}`.length>t&&i.length>0?(r.push(i.trim()),i=e):i=i?`${i}\n\n${e}`:e;return i.trim()&&r.push(i.trim()),r}};export{t as MarkdownChunker};
|
|
4
|
+
//# sourceMappingURL=markdown-chunker.js.map
|
|
@@ -1,47 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* Falls back gracefully to regex-based CodeChunker if tree-sitter or grammars
|
|
6
|
-
* are not installed (they are optional dependencies).
|
|
7
|
-
*/
|
|
8
|
-
import type { ChunkMetadata, RawChunk } from '@kb/core';
|
|
9
|
-
import type { IChunker } from './chunker.interface.js';
|
|
1
|
+
import { IChunker } from "./chunker.interface.js";
|
|
2
|
+
import { ChunkMetadata, RawChunk } from "@kb/core";
|
|
3
|
+
|
|
4
|
+
//#region packages/chunker/src/treesitter-chunker.d.ts
|
|
10
5
|
/**
|
|
11
6
|
* Singleton runtime that loads tree-sitter parser + language grammars once.
|
|
12
7
|
* Call `TreeSitterRuntime.initialize()` at startup; if it returns null,
|
|
13
8
|
* tree-sitter is not available and the factory will fall back to CodeChunker.
|
|
14
9
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
declare class TreeSitterRuntime {
|
|
11
|
+
private static instance;
|
|
12
|
+
private parser;
|
|
13
|
+
private languages;
|
|
14
|
+
static initialize(): Promise<TreeSitterRuntime | null>;
|
|
15
|
+
static get(): TreeSitterRuntime | null;
|
|
16
|
+
private init;
|
|
17
|
+
/** Parse source code with the grammar for the given file extension. */
|
|
18
|
+
parse(content: string, ext: string): any | null;
|
|
19
|
+
/** Check if a grammar is loaded for the given file extension. */
|
|
20
|
+
hasLanguage(ext: string): boolean;
|
|
26
21
|
}
|
|
27
22
|
/**
|
|
28
23
|
* Initialize the tree-sitter runtime. Call once at startup.
|
|
29
24
|
* Returns true if tree-sitter is available, false otherwise.
|
|
30
25
|
*/
|
|
31
|
-
|
|
26
|
+
declare function initializeTreeSitter(): Promise<boolean>;
|
|
32
27
|
/**
|
|
33
28
|
* AST-based code chunker that uses tree-sitter for precise declaration
|
|
34
29
|
* boundary detection. Produces cleaner chunks than the regex-based CodeChunker.
|
|
35
30
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
declare class TreeSitterChunker implements IChunker {
|
|
32
|
+
private readonly maxChunkSize;
|
|
33
|
+
private readonly runtime;
|
|
34
|
+
private readonly regexFallback;
|
|
35
|
+
constructor(runtime: TreeSitterRuntime, options?: {
|
|
36
|
+
maxChunkSize?: number;
|
|
37
|
+
});
|
|
38
|
+
chunk(content: string, metadata: ChunkMetadata): RawChunk[];
|
|
39
|
+
private chunkFromAst;
|
|
40
|
+
private splitByLines;
|
|
46
41
|
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { TreeSitterChunker, TreeSitterRuntime, initializeTreeSitter };
|
|
47
44
|
//# sourceMappingURL=treesitter-chunker.d.ts.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import{extname as
|
|
2
|
-
`).length-1})}}if(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`)
|
|
6
|
-
`),
|
|
7
|
-
|
|
8
|
-
`)),c}}export{L as TreeSitterChunker,u as TreeSitterRuntime,w as initializeTreeSitter};
|
|
1
|
+
import{CodeChunker as e}from"./code-chunker.js";import{extname as t}from"node:path";import{CHUNK_SIZES as n,createLogger as r}from"../../core/dist/index.js";const i=r(`chunker`),a={".ts":{package:`tree-sitter-typescript`,subLanguage:`typescript`},".tsx":{package:`tree-sitter-typescript`,subLanguage:`tsx`},".mts":{package:`tree-sitter-typescript`,subLanguage:`typescript`},".cts":{package:`tree-sitter-typescript`,subLanguage:`typescript`},".js":{package:`tree-sitter-javascript`},".jsx":{package:`tree-sitter-javascript`},".mjs":{package:`tree-sitter-javascript`},".cjs":{package:`tree-sitter-javascript`},".py":{package:`tree-sitter-python`},".go":{package:`tree-sitter-go`},".rs":{package:`tree-sitter-rust`},".java":{package:`tree-sitter-java`}},o=new Set(`function_declaration.class_declaration.interface_declaration.type_alias_declaration.enum_declaration.lexical_declaration.export_statement.variable_declaration.abstract_class_declaration.function_definition.class_definition.decorated_definition.function_declaration.method_declaration.type_declaration.function_item.impl_item.struct_item.enum_item.trait_item.mod_item.type_item.class_declaration.interface_declaration.method_declaration.enum_declaration`.split(`.`));var s=class e{static instance=null;parser=null;languages=new Map;static async initialize(){if(e.instance)return e.instance;let t=new e;return await t.init()?(e.instance=t,t):null}static get(){return e.instance}async init(){try{let e=await import(`tree-sitter`);this.parser=new(e.default??e);for(let[e,t]of Object.entries(a))try{let n=await import(t.package),r=n.default??n,i=t.subLanguage?r[t.subLanguage]:r;i&&this.languages.set(e,i)}catch{}let t=this.languages.size>0;return t&&i.info(`Tree-sitter initialized`,{languageCount:this.languages.size,extensions:[...this.languages.keys()]}),t}catch{return!1}}parse(e,t){let n=this.languages.get(t);return n?(this.parser.setLanguage(n),this.parser.parse(e)):null}hasLanguage(e){return this.languages.has(e)}};async function c(){return await s.initialize()!==null}var l=class{maxChunkSize;runtime;regexFallback;constructor(t,r){this.runtime=t,this.maxChunkSize=r?.maxChunkSize??n.code.max,this.regexFallback=new e(r)}chunk(e,n){let r=t(n.sourcePath).toLowerCase(),i=this.runtime.parse(e,r);if(!i)return this.regexFallback.chunk(e,n);try{return this.chunkFromAst(i,e,n)}catch{return this.regexFallback.chunk(e,n)}}chunkFromAst(e,t,n){let r=e.rootNode,i=[],a=[];for(let e=0;e<r.childCount;e++){let n=r.child(e);if(n&&o.has(n.type)){let e=n.startPosition?n.startIndex:n.startByte??0,r=n.startPosition?.row??0,i=n.previousSibling;for(;i&&(i.type===`comment`||i.type===`line_comment`||i.type===`block_comment`||i.type===`decorator`);)e=i.startIndex??i.startByte??e,r=i.startPosition?.row??r,i=i.previousSibling;a.push({startByte:e,endByte:n.endIndex??n.endByte??t.length,startRow:r,endRow:n.endPosition?.row??t.split(`
|
|
2
|
+
`).length-1})}}if(a.length===0)return this.regexFallback.chunk(t,n);if(a[0].startByte>0){let e=t.slice(0,a[0].startByte).trim();e.length>0&&i.push({text:`// File: ${n.sourcePath}\n${e}`,sourcePath:n.sourcePath,contentType:n.contentType,chunkIndex:0,totalChunks:0,startLine:1,endLine:a[0].startRow+1})}for(let e of a){let r=t.slice(e.startByte,e.endByte).trim();if(r=`// File: ${n.sourcePath}\n`+r,r.length>this.maxChunkSize){let t=this.splitByLines(r,this.maxChunkSize),a=e.startRow+1;for(let e of t){let t=e.split(`
|
|
3
|
+
`).length;i.push({text:e,sourcePath:n.sourcePath,contentType:n.contentType,chunkIndex:i.length,totalChunks:0,startLine:a,endLine:a+t-1}),a+=t}}else i.push({text:r,sourcePath:n.sourcePath,contentType:n.contentType,chunkIndex:i.length,totalChunks:0,startLine:e.startRow+1,endLine:e.endRow+1})}return i.map((e,t)=>({...e,chunkIndex:t,totalChunks:i.length}))}splitByLines(e,t){let n=e.split(`
|
|
4
|
+
`),r=[],i=[],a=0;for(let e of n)a+e.length+1>t&&i.length>0?(r.push(i.join(`
|
|
5
|
+
`)),i=[e],a=e.length):(i.push(e),a+=e.length+1);return i.length>0&&r.push(i.join(`
|
|
6
|
+
`)),r}};export{l as TreeSitterChunker,s as TreeSitterRuntime,c as initializeTreeSitter};
|
|
7
|
+
//# sourceMappingURL=treesitter-chunker.js.map
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Command } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/cli/src/commands/analyze.d.ts
|
|
4
|
+
declare const analyzeCommands: Command[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { analyzeCommands };
|
|
3
7
|
//# sourceMappingURL=analyze.d.ts.map
|