@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,10 +1,15 @@
|
|
|
1
|
+
//#region packages/cli/src/commands/init.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* `kb init` — scaffold a knowledge base in the current directory.
|
|
3
4
|
* Creates kb.config.json, .gitignore entry, optional IDE config,
|
|
4
5
|
* agent instruction files (.github/copilot-instructions.md, AGENTS.md),
|
|
5
|
-
* and skills/knowledge-base
|
|
6
|
+
* and .github/skills/ (knowledge-base, brainstorming).
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
declare function initProject(options: {
|
|
9
|
+
force: boolean;
|
|
9
10
|
}): Promise<void>;
|
|
11
|
+
/** Generate a JSON guide report comparing installed vs source files. */
|
|
12
|
+
declare function guideProject(): Promise<void>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { guideProject, initProject };
|
|
10
15
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{appendFileSync as
|
|
1
|
+
import{appendFileSync as e,copyFileSync as t,existsSync as n,mkdirSync as r,readFileSync as i,readdirSync as a,statSync as o,writeFileSync as s}from"node:fs";import{basename as c,dirname as l,resolve as u}from"node:path";import{fileURLToPath as d}from"node:url";const f={serverName:`knowledge-base`,sources:[{path:`.`,excludePatterns:[`**/node_modules/**`,`**/dist/**`,`**/build/**`,`**/.git/**`,`**/.kb-data/**`,`**/coverage/**`,`**/*.min.js`,`**/package-lock.json`,`**/pnpm-lock.yaml`]}],indexing:{chunkSize:1500,chunkOverlap:200,minChunkSize:100},embedding:{model:`mixedbread-ai/mxbai-embed-large-v1`,dimensions:1024},store:{backend:`lancedb`,path:`.kb-data/lance`},curated:{path:`curated`}};function p(e){return{servers:{[e]:{type:`stdio`,command:`npx`,args:[`@vpxa/kb`,`serve`]}}}}function m(e,t){let n=e=>e;return`# ${e} — Copilot Instructions
|
|
2
2
|
|
|
3
3
|
This project uses **@vpxa/kb** as an MCP knowledge base server. The KB provides search, context compression, persistent memory, and validation tools that **MUST** be used to maintain quality and performance.
|
|
4
4
|
|
|
@@ -7,8 +7,8 @@ This project uses **@vpxa/kb** as an MCP knowledge base server. The KB provides
|
|
|
7
7
|
### 1. ALWAYS search before acting
|
|
8
8
|
Before writing or modifying code, you MUST recall prior decisions and understand the affected area:
|
|
9
9
|
\`\`\`
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
${n(`search`)}({ query: "<task keywords>" })
|
|
11
|
+
${n(`scope_map`)}({ task: "<what you are doing>" })
|
|
12
12
|
\`\`\`
|
|
13
13
|
|
|
14
14
|
### 2. ALWAYS compress context before reading large files
|
|
@@ -16,77 +16,77 @@ Do NOT read entire files into context. Use these tools to reduce tokens and focu
|
|
|
16
16
|
|
|
17
17
|
| Situation | Tool | Why |
|
|
18
18
|
|-----------|------|-----|
|
|
19
|
-
| Need relevant sections of a large file | \`
|
|
20
|
-
| Need to summarize multiple sources | \`
|
|
21
|
-
| Need a quick structural overview of a file | \`
|
|
22
|
-
| Need a reusable context card | \`
|
|
19
|
+
| Need relevant sections of a large file | \`${n(`compact`)}\` | Extracts only semantically relevant chunks — 5-20x reduction |
|
|
20
|
+
| Need to summarize multiple sources | \`${n(`digest`)}\` | Compresses multiple text blocks into a token-budgeted summary |
|
|
21
|
+
| Need a quick structural overview of a file | \`${n(`file_summary`)}\` | Returns exports, imports, functions without reading the full file |
|
|
22
|
+
| Need a reusable context card | \`${n(`stratum_card`)}\` | Generates T1/T2 cards — 10-100x token reduction |
|
|
23
23
|
|
|
24
|
-
**Example
|
|
24
|
+
**Example — reading a 400-line file:**
|
|
25
25
|
\`\`\`
|
|
26
26
|
# BAD: read_file entire file (wastes ~3000 tokens)
|
|
27
27
|
# GOOD: get structure first, then compact only what you need
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
${n(`file_summary`)}({ path: "src/http-client.ts" })
|
|
29
|
+
${n(`compact`)}({ path: "src/http-client.ts", query: "retry logic" })
|
|
30
30
|
\`\`\`
|
|
31
31
|
|
|
32
32
|
### 3. ALWAYS use persistent memory
|
|
33
|
-
- **Start of session**: Read prior knowledge with
|
|
34
|
-
- **During session**: Use \`
|
|
35
|
-
- **End of session**: MUST call \`
|
|
36
|
-
- **Before proposing a new approach**: MUST \`
|
|
33
|
+
- **Start of session**: Read prior knowledge with \`${n(`list`)}()\` and \`${n(`search`)}({ query: "SESSION CHECKPOINT", origin: "curated" })\`
|
|
34
|
+
- **During session**: Use \`${n(`stash`)}\` for temporary working data, \`${n(`checkpoint`)}\` to save progress
|
|
35
|
+
- **End of session**: MUST call \`${n(`remember`)}\` to persist decisions, patterns, and lessons learned
|
|
36
|
+
- **Before proposing a new approach**: MUST \`${n(`search`)}\` to check if a decision already exists
|
|
37
37
|
|
|
38
38
|
| Tool | When | Persistence |
|
|
39
39
|
|------|------|-------------|
|
|
40
|
-
| \`
|
|
41
|
-
| \`
|
|
42
|
-
| \`
|
|
40
|
+
| \`${n(`stash`)}\` | Temporary data within a session (intermediate results, scratch notes) | Session only |
|
|
41
|
+
| \`${n(`checkpoint`)}\` | Save/restore session progress (resumable work) | Session only |
|
|
42
|
+
| \`${n(`remember`)}\` | Architecture decisions, conventions, patterns, troubleshooting | Permanent (survives reindex) |
|
|
43
43
|
|
|
44
44
|
### 4. ALWAYS validate before committing
|
|
45
45
|
\`\`\`
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
${n(`check`)}({}) # Typecheck + lint (returns summary by default)
|
|
47
|
+
${n(`test_run`)}({}) # Run tests
|
|
48
|
+
${n(`blast_radius`)}({ changed_files: ["..."] }) # Impact analysis
|
|
49
|
+
${n(`audit`)}({}) # Unified project audit with score and recommendations
|
|
50
50
|
\`\`\`
|
|
51
51
|
|
|
52
52
|
### 5. Use FORGE for complex tasks
|
|
53
53
|
For tasks involving multiple files or architectural decisions:
|
|
54
54
|
\`\`\`
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
${n(`forge_classify`)}({ task: "<description>" }) # Classify complexity tier
|
|
56
|
+
${n(`forge_ground`)}({ task: "<description>" }) # Full analysis: scope + constraints + evidence
|
|
57
|
+
${n(`evidence_map`)}({ claims: [...] }) # Track verified vs assumed claims
|
|
58
58
|
\`\`\`
|
|
59
59
|
|
|
60
60
|
## Quick Workflow
|
|
61
61
|
|
|
62
62
|
\`\`\`
|
|
63
63
|
# 1. Orient
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
${n(`search`)}({ query: "task keywords" })
|
|
65
|
+
${n(`scope_map`)}({ task: "what you are doing" })
|
|
66
66
|
|
|
67
67
|
# 2. Read efficiently (NEVER raw-read large files)
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
${n(`file_summary`)}({ path: "relevant-file.ts" })
|
|
69
|
+
${n(`compact`)}({ path: "relevant-file.ts", query: "specific concern" })
|
|
70
70
|
|
|
71
71
|
# 3. Do the work
|
|
72
72
|
|
|
73
73
|
# 4. Validate
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
${n(`check`)}({})
|
|
75
|
+
${n(`test_run`)}({})
|
|
76
76
|
|
|
77
77
|
# 5. Persist
|
|
78
|
-
|
|
78
|
+
${n(`remember`)}({ title: "What I learned", content: "...", category: "decisions" })
|
|
79
79
|
\`\`\`
|
|
80
80
|
|
|
81
81
|
## Context Budget Rules
|
|
82
82
|
|
|
83
|
-
- **Prefer \`
|
|
84
|
-
- **Prefer \`
|
|
85
|
-
- **Prefer \`
|
|
86
|
-
- **Prefer \`
|
|
87
|
-
- **Use
|
|
88
|
-
- **Use
|
|
89
|
-
`}function
|
|
83
|
+
- **Prefer \`${n(`file_summary`)}\` over \`read_file\`** for understanding file structure
|
|
84
|
+
- **Prefer \`${n(`compact`)}\` over full file reads** when you need specific sections (use \`path\` param to avoid read_file round-trip)
|
|
85
|
+
- **Prefer \`${n(`search`)}\` over \`grep_search\`** for semantic/conceptual queries
|
|
86
|
+
- **Prefer \`${n(`symbol`)}\` over manual grep** for finding definitions and references
|
|
87
|
+
- **Use \`${n(`digest`)}\`** when combining information from 3+ sources
|
|
88
|
+
- **Use \`${n(`stratum_card`)}\`** to create reusable compressed context for repeated reference
|
|
89
|
+
`}function h(e,t){let n=e=>e;return`# ${e} — Agent Instructions
|
|
90
90
|
|
|
91
91
|
## KB Knowledge Base
|
|
92
92
|
|
|
@@ -95,25 +95,26 @@ This project has a **@vpxa/kb** MCP server providing search, analysis, memory, a
|
|
|
95
95
|
### Skills Reference
|
|
96
96
|
|
|
97
97
|
| Context | Skill | Details |
|
|
98
|
-
|
|
99
|
-
| KB search, analysis, memory | \`kb\` | See [skills/knowledge-base/SKILL.md](skills/knowledge-base/SKILL.md) or run
|
|
98
|
+
|---------|-------|--------|
|
|
99
|
+
| KB search, analysis, memory | \`kb\` | See [.github/skills/knowledge-base/SKILL.md](.github/skills/knowledge-base/SKILL.md) or run \`${n(`status`)}({})\` |
|
|
100
|
+
| Brainstorming & design | \`brainstorming\` | See [.github/skills/brainstorming/SKILL.md](.github/skills/brainstorming/SKILL.md) |
|
|
100
101
|
|
|
101
102
|
### Available Tool Categories
|
|
102
103
|
|
|
103
104
|
| Category | Tools | Purpose |
|
|
104
105
|
|----------|-------|---------|
|
|
105
|
-
| Search & Discovery |
|
|
106
|
-
| Code Analysis |
|
|
107
|
-
| Knowledge |
|
|
108
|
-
| Execution |
|
|
109
|
-
| Code Manipulation |
|
|
110
|
-
| Context |
|
|
111
|
-
| FORGE |
|
|
112
|
-
| Web & API |
|
|
113
|
-
| Lanes | \`
|
|
114
|
-
| Git & Environment |
|
|
115
|
-
| Utilities |
|
|
116
|
-
| System |
|
|
106
|
+
| Search & Discovery | \`${n(`search`)}\`, \`${n(`find`)}\`, \`${n(`symbol`)}\`, \`${n(`trace`)}\`, \`${n(`scope_map`)}\`, \`${n(`lookup`)}\`, \`${n(`dead_symbols`)}\`, \`${n(`file_summary`)}\` | Find code, symbols, data flow, reading plans |
|
|
107
|
+
| Code Analysis | \`${n(`analyze_structure`)}\`, \`${n(`analyze_dependencies`)}\`, \`${n(`analyze_symbols`)}\`, \`${n(`analyze_patterns`)}\`, \`${n(`analyze_entry_points`)}\`, \`${n(`analyze_diagram`)}\`, \`${n(`blast_radius`)}\` | Structure, deps, patterns, impact, diagrams |
|
|
108
|
+
| Knowledge | \`${n(`remember`)}\`, \`${n(`read`)}\`, \`${n(`update`)}\`, \`${n(`forget`)}\`, \`${n(`list`)}\`, \`${n(`produce_knowledge`)}\` | Persistent cross-session memory |
|
|
109
|
+
| Execution | \`${n(`check`)}\`, \`${n(`test_run`)}\`, \`${n(`eval`)}\`, \`${n(`batch`)}\`, \`${n(`audit`)}\` | Typecheck, lint, test, run code, unified audit. \`check\` defaults to summary output (~300 tokens) |
|
|
110
|
+
| Code Manipulation | \`${n(`rename`)}\`, \`${n(`codemod`)}\`, \`${n(`diff_parse`)}\`, \`${n(`data_transform`)}\` | Safe renames, transforms, diff parsing |
|
|
111
|
+
| Context | \`${n(`compact`)}\`, \`${n(`workset`)}\`, \`${n(`stash`)}\`, \`${n(`checkpoint`)}\`, \`${n(`parse_output`)}\` | Manage working sets, save progress. \`compact\` accepts \`path\` for server-side file read |
|
|
112
|
+
| FORGE | \`${n(`forge_ground`)}\`, \`${n(`forge_classify`)}\`, \`${n(`evidence_map`)}\`, \`${n(`digest`)}\`, \`${n(`stratum_card`)}\` | Quality gates, context compression |
|
|
113
|
+
| Web & API | \`${n(`web_fetch`)}\`, \`${n(`web_search`)}\`, \`${n(`http`)}\` | Fetch pages, search web, test APIs |
|
|
114
|
+
| Lanes | \`${n(`lane`)}\` | Isolated file copies for parallel exploration (create/list/status/diff/merge/discard) |
|
|
115
|
+
| Git & Environment | \`${n(`git_context`)}\`, \`${n(`process`)}\`, \`${n(`watch`)}\`, \`${n(`delegate`)}\` | Git info, process management |
|
|
116
|
+
| Utilities | \`${n(`regex_test`)}\`, \`${n(`encode`)}\`, \`${n(`measure`)}\`, \`${n(`changelog`)}\`, \`${n(`schema_validate`)}\`, \`${n(`snippet`)}\`, \`${n(`env`)}\`, \`${n(`time`)}\` | Regex, encoding, metrics, validation |
|
|
117
|
+
| System | \`${n(`status`)}\`, \`${n(`reindex`)}\`, \`${n(`health`)}\`, \`${n(`guide`)}\`, \`${n(`onboard`)}\`, \`${n(`graph`)}\`, \`${n(`queue`)}\`, \`${n(`replay`)}\` | Index management, health checks, tool discovery, knowledge graph |
|
|
117
118
|
|
|
118
119
|
---
|
|
119
120
|
|
|
@@ -121,23 +122,23 @@ This project has a **@vpxa/kb** MCP server providing search, analysis, memory, a
|
|
|
121
122
|
|
|
122
123
|
**Every agent interaction MUST minimize context window usage.** Raw file reads waste tokens and degrade LLM output quality. Use these tools instead:
|
|
123
124
|
|
|
124
|
-
### Decision Tree
|
|
125
|
+
### Decision Tree — How to Read Code
|
|
125
126
|
|
|
126
127
|
\`\`\`
|
|
127
128
|
Need to understand a file?
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
├─ Just structure? → ${n(`file_summary`)} (exports, imports, functions — ~50 tokens)
|
|
130
|
+
├─ Specific section? → ${n(`compact`)}({ path: "file.ts", query: "topic" }) — 5-20x reduction
|
|
131
|
+
├─ Multiple files? → ${n(`digest`)} (multi-source compression — token-budgeted)
|
|
132
|
+
├─ Repeated reference? → ${n(`stratum_card`)} (T1/T2 card — 10-100x reduction)
|
|
133
|
+
└─ Full file needed? → ONLY as last resort, and compact it after reading
|
|
133
134
|
\`\`\`
|
|
134
135
|
|
|
135
136
|
### Rules
|
|
136
137
|
1. **NEVER read a file >100 lines without compressing it first**
|
|
137
|
-
2. **ALWAYS use \`
|
|
138
|
-
3. **ALWAYS use \`
|
|
139
|
-
4. **Use \`
|
|
140
|
-
5. **Use \`
|
|
138
|
+
2. **ALWAYS use \`${n(`file_summary`)}\` before \`read_file\`** — often the summary is sufficient
|
|
139
|
+
3. **ALWAYS use \`${n(`compact`)}\` when you only need specific sections** of a file (use \`path\` param to read server-side)
|
|
140
|
+
4. **Use \`${n(`digest`)}\` when synthesizing from 3+ sources** — don't accumulate raw text
|
|
141
|
+
5. **Use \`${n(`stratum_card`)}\` for files you'll reference repeatedly** in a session
|
|
141
142
|
|
|
142
143
|
---
|
|
143
144
|
|
|
@@ -147,24 +148,24 @@ Need to understand a file?
|
|
|
147
148
|
|
|
148
149
|
### Session Start (MUST do ALL of these)
|
|
149
150
|
\`\`\`
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
${n(`status`)}({}) # Verify KB is ready
|
|
152
|
+
${n(`list`)}() # See what knowledge exists
|
|
153
|
+
${n(`search`)}({ query: "SESSION CHECKPOINT", origin: "curated" }) # Resume prior work
|
|
153
154
|
\`\`\`
|
|
154
155
|
|
|
155
156
|
### During Session
|
|
156
157
|
| Situation | Action |
|
|
157
158
|
|-----------|--------|
|
|
158
|
-
| Found a useful intermediate result |
|
|
159
|
-
| Completed a milestone |
|
|
160
|
-
| Made an architecture decision |
|
|
161
|
-
| Discovered a pattern or convention |
|
|
162
|
-
| Found a non-obvious solution |
|
|
163
|
-
| About to propose a new approach |
|
|
159
|
+
| Found a useful intermediate result | \`${n(`stash`)}({ key: "name", value: "data" })\` |
|
|
160
|
+
| Completed a milestone | \`${n(`checkpoint`)}({ action: "save", name: "milestone" })\` |
|
|
161
|
+
| Made an architecture decision | \`${n(`remember`)}({ title: "...", category: "decisions" })\` |
|
|
162
|
+
| Discovered a pattern or convention | \`${n(`remember`)}({ title: "...", category: "patterns" })\` |
|
|
163
|
+
| Found a non-obvious solution | \`${n(`remember`)}({ title: "...", category: "troubleshooting" })\` |
|
|
164
|
+
| About to propose a new approach | \`${n(`search`)}({ query: "..." })\` — check if decided before |
|
|
164
165
|
|
|
165
166
|
### Session End (MUST do this)
|
|
166
167
|
\`\`\`
|
|
167
|
-
|
|
168
|
+
${n(`remember`)}({
|
|
168
169
|
title: "Session checkpoint: <topic>",
|
|
169
170
|
content: "<what was done, decisions made, blockers, next steps>",
|
|
170
171
|
category: "conventions"
|
|
@@ -174,10 +175,10 @@ kb_remember({
|
|
|
174
175
|
### Memory Decision Tree
|
|
175
176
|
\`\`\`
|
|
176
177
|
Is this data temporary (scratch, intermediate)?
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
├─ Yes → ${n(`stash`)} (session-scoped key-value)
|
|
179
|
+
└─ No → Is it resumable progress?
|
|
180
|
+
├─ Yes → ${n(`checkpoint`)} (session-scoped snapshot)
|
|
181
|
+
└─ No → ${n(`remember`)} (permanent, survives reindex)
|
|
181
182
|
Categories: decisions | patterns | conventions | troubleshooting
|
|
182
183
|
\`\`\`
|
|
183
184
|
|
|
@@ -189,12 +190,12 @@ Is this data temporary (scratch, intermediate)?
|
|
|
189
190
|
|
|
190
191
|
\`\`\`
|
|
191
192
|
# Before ANY code change:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
${n(`search`)}({ query: "<what you're about to change>" }) # Prior decisions?
|
|
194
|
+
${n(`scope_map`)}({ task: "<description>" }) # What files to read?
|
|
195
|
+
${n(`symbol`)}({ name: "<key symbol>" }) # Where is it defined/used?
|
|
195
196
|
\`\`\`
|
|
196
197
|
|
|
197
|
-
If \`
|
|
198
|
+
If \`${n(`search`)}\` returns a prior decision about the topic, you MUST follow it or explicitly explain why you're deviating.
|
|
198
199
|
|
|
199
200
|
---
|
|
200
201
|
|
|
@@ -203,10 +204,10 @@ If \`kb_search\` returns a prior decision about the topic, you MUST follow it or
|
|
|
203
204
|
**NEVER commit or present code without validation.**
|
|
204
205
|
|
|
205
206
|
\`\`\`
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
${n(`check`)}({}) # Typecheck + lint (tsc + biome)
|
|
208
|
+
${n(`test_run`)}({}) # Run tests
|
|
209
|
+
${n(`blast_radius`)}({ changed_files: ["..."] }) # Impact analysis
|
|
210
|
+
${n(`audit`)}({}) # Unified project audit (structure, deps, patterns, health, dead symbols, entry points)
|
|
210
211
|
\`\`\`
|
|
211
212
|
|
|
212
213
|
---
|
|
@@ -216,9 +217,9 @@ kb_audit({}) # Unified project audit (structu
|
|
|
216
217
|
For tasks touching 3+ files or involving architectural decisions:
|
|
217
218
|
|
|
218
219
|
\`\`\`
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
${n(`forge_classify`)}({ task: "<description>" }) # Quick: Floor/Standard/Critical tier
|
|
221
|
+
${n(`forge_ground`)}({ task: "<description>" }) # Full: scope + constraints + evidence
|
|
222
|
+
${n(`evidence_map`)}({ claims: ["claim1", "claim2"] }) # Track verified vs assumed
|
|
222
223
|
\`\`\`
|
|
223
224
|
|
|
224
225
|
---
|
|
@@ -227,9 +228,9 @@ kb_evidence_map({ claims: ["claim1", "claim2"] }) # Track verified vs assumed
|
|
|
227
228
|
|
|
228
229
|
| Mode | When | Example |
|
|
229
230
|
|------|------|---------|
|
|
230
|
-
| \`hybrid\` (default) | General queries |
|
|
231
|
-
| \`semantic\` | Conceptual/meaning-based |
|
|
232
|
-
| \`keyword\` | Exact identifiers |
|
|
231
|
+
| \`hybrid\` (default) | General queries | \`${n(`search`)}({ query: "error handling" })\` |
|
|
232
|
+
| \`semantic\` | Conceptual/meaning-based | \`${n(`search`)}({ query: "retry with backoff", search_mode: "semantic" })\` |
|
|
233
|
+
| \`keyword\` | Exact identifiers | \`${n(`search`)}({ query: "CircuitBreaker", search_mode: "keyword" })\` |
|
|
233
234
|
|
|
234
235
|
Filters: \`origin\` (\`indexed\`/\`curated\`/\`produced\`), \`category\`, \`content_type\`, \`tags\`, \`min_score\`.
|
|
235
236
|
|
|
@@ -239,41 +240,41 @@ Filters: \`origin\` (\`indexed\`/\`curated\`/\`produced\`), \`category\`, \`cont
|
|
|
239
240
|
|
|
240
241
|
**Codebase onboarding:**
|
|
241
242
|
\`\`\`
|
|
242
|
-
|
|
243
|
+
${n(`onboard`)}({ path: "." }) → ${n(`produce_knowledge`)}({ path: "src/" }) → ${n(`remember`)}(...)
|
|
243
244
|
\`\`\`
|
|
244
245
|
|
|
245
246
|
**Planning a task:**
|
|
246
247
|
\`\`\`
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
${n(`search`)}({ query: "task keywords" })
|
|
249
|
+
→ ${n(`scope_map`)}({ task: "description" })
|
|
250
|
+
→ ${n(`file_summary`)} for each file in scope
|
|
251
|
+
→ ${n(`compact`)}({ path: "relevant-file.ts", query: "detail needed" }) for files needing detail
|
|
252
|
+
→ ${n(`workset`)}({ action: "save", name: "task", files: [...] })
|
|
252
253
|
\`\`\`
|
|
253
254
|
|
|
254
255
|
**Bug investigation:**
|
|
255
256
|
\`\`\`
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
${n(`parse_output`)}({ output: "<error>" })
|
|
258
|
+
→ ${n(`symbol`)}({ name: "failingFn" })
|
|
259
|
+
→ ${n(`trace`)}({ symbol: "failingFn", direction: "backward" })
|
|
260
|
+
→ ${n(`blast_radius`)}({ changed_files: ["suspect.ts"] })
|
|
260
261
|
\`\`\`
|
|
261
262
|
|
|
262
263
|
**Safe refactor with lanes:**
|
|
263
264
|
\`\`\`
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
265
|
+
${n(`lane`)}({ action: "create", name: "refactor", files: [...] })
|
|
266
|
+
→ [make changes]
|
|
267
|
+
→ ${n(`lane`)}({ action: "diff", name: "refactor" })
|
|
268
|
+
→ ${n(`check`)}({}) → ${n(`test_run`)}({})
|
|
269
|
+
→ ${n(`lane`)}({ action: "merge", name: "refactor" })
|
|
269
270
|
\`\`\`
|
|
270
271
|
|
|
271
272
|
**After making changes:**
|
|
272
273
|
\`\`\`
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
${n(`blast_radius`)}({ changed_files: ["src/file.ts"] })
|
|
275
|
+
→ ${n(`check`)}({}) → ${n(`test_run`)}({})
|
|
276
|
+
→ ${n(`reindex`)}({})
|
|
277
|
+
→ ${n(`remember`)}(...)
|
|
277
278
|
\`\`\`
|
|
278
279
|
|
|
279
280
|
---
|
|
@@ -291,18 +292,14 @@ kb_blast_radius({ changed_files: ["src/file.ts"] })
|
|
|
291
292
|
|
|
292
293
|
## Core Rules Summary
|
|
293
294
|
|
|
294
|
-
1. **Search KB before proposing anything new**
|
|
295
|
-
2. **Compress context aggressively**
|
|
296
|
-
3. **Use persistent memory**
|
|
297
|
-
4. **Validate before committing**
|
|
295
|
+
1. **Search KB before proposing anything new** — prior decisions exist
|
|
296
|
+
2. **Compress context aggressively** — \`file_summary\` → \`compact\` → \`digest\`
|
|
297
|
+
3. **Use persistent memory** — \`remember\` decisions, \`stash\` temporary data
|
|
298
|
+
4. **Validate before committing** — \`check\` + \`test_run\` + \`blast_radius\`
|
|
298
299
|
5. **Follow \`_Next:\` hints** in tool responses for guided workflow
|
|
299
|
-
6. **Use FORGE for complex tasks**
|
|
300
|
-
`}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
.kb-
|
|
304
|
-
|
|
305
|
-
.kb-data/
|
|
306
|
-
`,"utf-8"),console.log(" Created .gitignore with .kb-data/"));const i=w(s),l=e(s,".vscode"),k=e(l,"mcp.json");t(l)&&!t(k)&&(r(k,`${JSON.stringify(A(i),null,2)}
|
|
307
|
-
`,"utf-8"),console.log(" Created .vscode/mcp.json"));const u=e(s,".github"),b=e(u,"copilot-instructions.md");t(b)||(n(u,{recursive:!0}),r(b,T(i),"utf-8"),console.log(" Created .github/copilot-instructions.md"));const m=e(s,"AGENTS.md");t(m)||(r(m,P(i),"utf-8"),console.log(" Created AGENTS.md"));const _=e(s,"skills","knowledge-base"),p=e(_,"SKILL.md");if(!t(p)){const f=S(x(import.meta.url)),g=e(f,"..","..","..","skills","knowledge-base","SKILL.md");t(g)&&(n(_,{recursive:!0}),y(g,p),console.log(" Created skills/knowledge-base/SKILL.md"))}console.log(`
|
|
308
|
-
Knowledge base initialized! Next steps:`),console.log(" kb reindex Index your codebase"),console.log(" kb search Search indexed content"),console.log(" kb serve Start MCP server for IDE integration")}export{R as initProject};
|
|
300
|
+
6. **Use FORGE for complex tasks** — \`forge_classify\` → \`forge_ground\` → \`evidence_map\`
|
|
301
|
+
`}function g(e,i,s=``,c=!1){r(i,{recursive:!0});for(let r of a(e)){let a=u(e,r),l=u(i,r),d=s?`${s}/${r}`:r;if(o(a).isDirectory())g(a,l,d,c);else if(c||!n(l)){let e=n(l)?`Updated`:`Created`;t(a,l),console.log(` ${e} .github/${d}`)}}}function _(e,t,r,s){if(n(e))for(let c of a(e)){let a=u(e,c),l=r?`${r}/${c}`:c;if(o(a).isDirectory())_(a,u(t,c),l,s);else{let e=u(t,c),r=i(a,`utf-8`);n(e)?r===i(e,`utf-8`)?s.push({status:`current`,relativePath:l,sourcePath:a}):s.push({status:`outdated`,relativePath:l,sourcePath:a,content:r}):s.push({status:`new`,relativePath:l,sourcePath:a,content:r})}}}async function v(t){let a=process.cwd(),o=u(a,`kb.config.json`);if(n(o)&&!t.force){console.log(`kb.config.json already exists. Use --force to overwrite.`);return}s(o,`${JSON.stringify(f,null,2)}\n`,`utf-8`),console.log(` Created kb.config.json`);let _=u(a,`curated`);n(_)||(r(_,{recursive:!0}),console.log(` Created curated/`));let v=u(a,`.gitignore`),y=[{dir:`.kb-data/`,label:`Knowledge base vector store`},{dir:`.brainstorm/`,label:`Brainstorming sessions`},{dir:`curated/`,label:`Curated knowledge entries`}];if(n(v)){let t=i(v,`utf-8`),n=y.filter(e=>!t.includes(e.dir));n.length>0&&(e(v,`\n${n.map(e=>`# ${e.label}\n${e.dir}`).join(`
|
|
302
|
+
`)}\n`,`utf-8`),console.log(` Added ${n.map(e=>e.dir).join(`, `)} to .gitignore`))}else s(v,`${y.map(e=>`# ${e.label}\n${e.dir}`).join(`
|
|
303
|
+
`)}\n`,`utf-8`),console.log(` Created .gitignore with KB entries`);let b=c(a),x=f.serverName,S=u(a,`.vscode`),C=u(S,`mcp.json`);n(S)&&!n(C)&&(s(C,`${JSON.stringify(p(x),null,2)}\n`,`utf-8`),console.log(` Created .vscode/mcp.json`));let w=u(a,`.github`),T=u(w,`copilot-instructions.md`);n(T)||(r(w,{recursive:!0}),s(T,m(b,x),`utf-8`),console.log(` Created .github/copilot-instructions.md`));let E=u(a,`AGENTS.md`);n(E)||(s(E,h(b,x),`utf-8`),console.log(` Created AGENTS.md`));let D=u(l(d(import.meta.url)),`..`,`..`,`..`,`..`);for(let e of[`knowledge-base`,`brainstorming`]){let r=u(D,`skills`,e);n(r)&&g(r,u(a,`.github`,`skills`,e),`skills/${e}`,t.force)}let O=u(D,`scaffold`,`copilot`);for(let e of[`agents`,`prompts`]){let r=u(O,e),i=u(a,`.github`,e);n(r)&&g(r,i,``,t.force)}for(let e of[`decisions`,`patterns`,`conventions`,`troubleshooting`]){let t=u(_,e);n(t)||r(t,{recursive:!0})}console.log(` Created curated/{decisions,patterns,conventions,troubleshooting}/`),console.log(`
|
|
304
|
+
Knowledge base initialized! Next steps:`),console.log(` kb reindex Index your codebase`),console.log(` kb search Search indexed content`),console.log(` kb serve Start MCP server for IDE integration`)}async function y(){let e=process.cwd(),t=u(l(d(import.meta.url)),`..`,`..`,`..`,`..`),r=[];for(let i of[`knowledge-base`,`brainstorming`]){let a=u(t,`skills`,i);n(a)&&_(a,u(e,`.github`,`skills`,i),`skills/${i}`,r)}let i=u(t,`scaffold`,`copilot`);for(let t of[`agents`,`prompts`])_(u(i,t),u(e,`.github`,t),t,r);let a={summary:{total:r.length,new:r.filter(e=>e.status===`new`).length,outdated:r.filter(e=>e.status===`outdated`).length,current:r.filter(e=>e.status===`current`).length},files:r};console.log(JSON.stringify(a,null,2))}export{y as guideProject,v as initProject};
|
|
305
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Command } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/cli/src/commands/knowledge.d.ts
|
|
4
|
+
declare const knowledgeCommands: Command[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { knowledgeCommands };
|
|
3
7
|
//# sourceMappingURL=knowledge.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ctx as e}from"../context.js";import{extractNumFlag as t,extractStrFlag as n,readStdin as r,splitCsv as i}from"../helpers.js";import{compact as a}from"../../../tools/dist/index.js";const o=[{name:`remember`,description:`Store curated knowledge`,usage:`kb remember <title> --category <cat> [--tags tag1,tag2]`,run:async t=>{let a=n(t,`--category`,``).trim(),o=i(n(t,`--tags`,``)),s=t.shift()?.trim()??``,c=await r(),l=c.trim().length>0?c:t.join(` `).trim();(!s||!a||!l.trim())&&(console.error(`Usage: kb remember <title> --category <cat> [--tags tag1,tag2]`),process.exit(1));let{curated:u}=await e(),d=await u.remember(s,l,a,o);console.log(`Stored curated entry`),console.log(` Path: ${d.path}`),console.log(` Category: ${a}`),o.length>0&&console.log(` Tags: ${o.join(`, `)}`)}},{name:`forget`,description:`Remove a curated entry`,usage:`kb forget <path> --reason <reason>`,run:async t=>{let r=n(t,`--reason`,``).trim(),i=t.shift()?.trim()??``;(!i||!r)&&(console.error(`Usage: kb forget <path> --reason <reason>`),process.exit(1));let{curated:a}=await e(),o=await a.forget(i,r);console.log(`Removed curated entry: ${o.path}`)}},{name:`read`,description:`Read a curated entry`,usage:`kb read <path>`,run:async t=>{let n=t.shift()?.trim()??``;n||(console.error(`Usage: kb read <path>`),process.exit(1));let{curated:r}=await e(),i=await r.read(n);console.log(i.title),console.log(`─`.repeat(60)),console.log(`Path: ${i.path}`),console.log(`Category: ${i.category}`),console.log(`Version: ${i.version}`),console.log(`Tags: ${i.tags.length>0?i.tags.join(`, `):`None`}`),console.log(``),console.log(i.content)}},{name:`list`,description:`List curated entries`,usage:`kb list [--category <cat>] [--tag <tag>]`,run:async t=>{let r=n(t,`--category`,``).trim()||void 0,i=n(t,`--tag`,``).trim()||void 0,{curated:a}=await e(),o=await a.list({category:r,tag:i});if(o.length===0){console.log(`No curated entries found.`);return}console.log(`Curated entries (${o.length})`),console.log(`─`.repeat(60));for(let e of o){console.log(e.path),console.log(` ${e.title}`),console.log(` Category: ${e.category} | Version: ${e.version}`),console.log(` Tags: ${e.tags.length>0?e.tags.join(`, `):`None`}`);let t=e.contentPreview.replace(/\s+/g,` `).trim();t&&console.log(` Preview: ${t}`),console.log(``)}}},{name:`update`,description:`Update a curated entry`,usage:`kb update <path> --reason <reason>`,run:async t=>{let i=n(t,`--reason`,``).trim(),a=t.shift()?.trim()??``,o=await r();(!a||!i||!o.trim())&&(console.error(`Usage: kb update <path> --reason <reason>`),process.exit(1));let{curated:s}=await e(),c=await s.update(a,o,i);console.log(`Updated curated entry`),console.log(` Path: ${c.path}`),console.log(` Version: ${c.version}`)}},{name:`compact`,description:`Compress text for context`,usage:`kb compact <query> [--path <file>] [--max-chars N] [--segmentation paragraph|sentence|line]`,run:async i=>{let o=t(i,`--max-chars`,3e3),s=n(i,`--path`,``).trim()||void 0,c=n(i,`--segmentation`,`paragraph`),l=i.join(` `).trim(),u=s?void 0:await r();(!l||!s&&!u?.trim())&&(console.error(`Usage: kb compact <query> --path <file> OR cat file | kb compact <query>`),process.exit(1));let{embedder:d}=await e(),f=await a(d,{text:u,path:s,query:l,maxChars:o,segmentation:c});console.log(`Compressed ${f.originalChars} chars to ${f.compressedChars} chars`),console.log(`Ratio: ${(f.ratio*100).toFixed(1)}% | Segments: ${f.segmentsKept}/${f.segmentsTotal}`),console.log(``),console.log(f.text)}}];export{o as knowledgeCommands};
|
|
2
|
+
//# sourceMappingURL=knowledge.js.map
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Command } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/cli/src/commands/search.d.ts
|
|
4
|
+
declare const searchCommands: Command[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { searchCommands };
|
|
3
7
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
${"\u2500".repeat(60)}`),console.log(`${d.length} result(s) found.`),e>0&&d.length>0)try{const{graphAugmentSearch:i}=await import("../../../tools/dist/index.js"),f=d.map(m=>({recordId:m.record.id,score:m.score,sourcePath:m.record.sourcePath})),b=(await i(c,f,{hops:e,maxPerHit:5})).filter(m=>m.graphContext.nodes.length>0);if(b.length>0){console.log(`
|
|
4
|
-
Graph context (${e} hop${e>1?"s":""}):
|
|
5
|
-
`);for(const m of b){console.log(` ${m.sourcePath}:`);for(const u of m.graphContext.nodes.slice(0,5))console.log(` \u2192 ${u.name} (${u.type})`);for(const u of m.graphContext.edges.slice(0,5))console.log(` \u2192 ${u.fromId} --[${u.type}]--> ${u.toId}`)}}}catch(i){console.error(`[graph] augmentation failed: ${i.message}`)}}},{name:"find",description:"Run federated search across indexed content and files",usage:"kb find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]",run:async o=>{const t=p(o,"--limit",10),r=h(o,"--glob","").trim()||void 0,e=h(o,"--pattern","").trim()||void 0,s=o.join(" ").trim()||void 0;!s&&!r&&!e&&(console.error("Usage: kb find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]"),process.exit(1));const{embedder:n,store:a}=await g(),c=await $(n,a,{query:s,glob:r,pattern:e,limit:t});if(c.results.length===0){console.log("No matches found.");return}console.log(`Strategies: ${c.strategies.join(", ")}`),console.log(`Results: ${c.results.length} shown (${c.totalFound} total)`);for(const l of c.results){const d=l.lineRange?`:${l.lineRange.start}-${l.lineRange.end}`:"";console.log(`
|
|
6
|
-
[${l.source}] ${l.path}${d}`),console.log(` Score: ${(l.score*100).toFixed(1)}%`),l.preview&&console.log(` ${l.preview.replace(/\s+/g," ").trim()}`)}}},{name:"scope-map",description:"Generate a reading plan for a task",usage:"kb scope-map <task> [--max-files N]",run:async o=>{const t=p(o,"--max-files",15),r=o.join(" ").trim();r||(console.error("Usage: kb scope-map <task> [--max-files N]"),process.exit(1));const{embedder:e,store:s}=await g(),n=await w(e,s,{task:r,maxFiles:t});console.log(`Task: ${n.task}`),console.log(`Files: ${n.files.length}`),console.log(`Estimated tokens: ${n.totalEstimatedTokens}`),console.log(""),console.log("Reading order:");for(const a of n.readingOrder)console.log(` ${a}`);for(const[a,c]of n.files.entries())console.log(`
|
|
7
|
-
${a+1}. ${c.path}`),console.log(` Relevance: ${(c.relevance*100).toFixed(1)}% | Tokens: ${c.estimatedTokens}`),console.log(` Why: ${c.reason}`),c.focusRanges.length>0&&console.log(` Focus: ${T(c.focusRanges)}`)}},{name:"symbol",description:"Resolve a symbol definition, imports, and references",usage:"kb symbol <name> [--limit N]",run:async o=>{const t=p(o,"--limit",20),r=o.join(" ").trim();r||(console.error("Usage: kb symbol <name> [--limit N]"),process.exit(1));const{embedder:e,store:s}=await g(),n=await N(e,s,{name:r,limit:t});S(n)}},{name:"trace",description:"Trace forward/backward flow for a symbol or file location",usage:"kb trace <start> [--direction forward|backward|both] [--max-depth N]",run:async o=>{const t=h(o,"--direction","both").trim()||"both",r=p(o,"--max-depth",3),e=o.join(" ").trim();(!e||!["forward","backward","both"].includes(t))&&(console.error("Usage: kb trace <start> [--direction forward|backward|both] [--max-depth N]"),process.exit(1));const{embedder:s,store:n}=await g(),a=await R(s,n,{start:e,direction:t,maxDepth:r});j(a)}},{name:"examples",description:"Find real code examples of a symbol or pattern",usage:"kb examples <query> [--limit N] [--content-type type]",run:async o=>{const t=p(o,"--limit",5),r=h(o,"--content-type","").trim()||void 0,e=o.join(" ").trim();e||(console.error("Usage: kb examples <query> [--limit N] [--content-type type]"),process.exit(1));const{embedder:s,store:n}=await g(),a=await x(s,n,{query:e,limit:t,contentType:r});F(a)}},{name:"dead-symbols",description:"Find exported symbols that appear to be unused",usage:"kb dead-symbols [--limit N]",run:async o=>{const t=p(o,"--limit",100),{embedder:r,store:e}=await g(),s=await k(r,e,{limit:t});C(s)}},{name:"lookup",description:"Look up indexed content by record ID or source path",usage:"kb lookup <id>",run:async o=>{const t=o.join(" ").trim();t||(console.error("Usage: kb lookup <id>"),process.exit(1));const{store:r}=await g(),e=await r.getById(t);if(e){console.log(e.id),console.log("\u2500".repeat(60)),console.log(`Path: ${e.sourcePath}`),console.log(`Chunk: ${e.chunkIndex+1}/${e.totalChunks}`),console.log(`Lines: ${e.startLine}-${e.endLine}`),console.log(`Type: ${e.contentType} | Origin: ${e.origin}`),e.tags.length>0&&console.log(`Tags: ${e.tags.join(", ")}`),console.log(""),console.log(e.content);return}const s=await r.getBySourcePath(t);if(s.length===0){console.log(`No indexed content found for: ${t}`);return}s.sort((n,a)=>n.chunkIndex-a.chunkIndex),console.log(t),console.log("\u2500".repeat(60)),console.log(`Chunks: ${s.length} | Type: ${s[0].contentType}`);for(const n of s){const a=n.startLine?` (lines ${n.startLine}-${n.endLine})`:"";console.log(`
|
|
8
|
-
Chunk ${n.chunkIndex+1}/${n.totalChunks}${a}`),console.log(n.content)}}}];export{v as searchCommands};
|
|
1
|
+
import{ctx as e}from"../context.js";import{extractNumFlag as t,extractStrFlag as n,formatFocusRanges as r,printDeadSymbolsResult as i,printExamplesResult as a,printSymbolInfo as o,printTraceResult as s,rrf as c}from"../helpers.js";import{find as l,findDeadSymbols as u,findExamples as d,scopeMap as f,symbol as p,trace as m}from"../../../tools/dist/index.js";const h=[{name:`search`,description:`Search the knowledge base`,usage:`kb search <query> [--limit N] [--mode hybrid|semantic|keyword] [--graph-hops 0-3]`,run:async r=>{let i=t(r,`--limit`,5),a=n(r,`--mode`,`hybrid`),o=t(r,`--graph-hops`,0),s=r.join(` `).trim();s||(console.error(`Usage: kb search <query>`),process.exit(1));let{embedder:l,store:u,graphStore:d}=await e(),f=await l.embedQuery(s),p;if(a===`keyword`)p=await u.ftsSearch(s,{limit:i});else if(a===`semantic`)p=await u.search(f,{limit:i});else{let[e,t]=await Promise.all([u.search(f,{limit:i*2}),u.ftsSearch(s,{limit:i*2}).catch(()=>[])]);p=c(e,t).slice(0,i)}if(p.length===0){console.log(`No results found.`);return}for(let{record:e,score:t}of p){console.log(`\n${`─`.repeat(60)}`),console.log(`[${(t*100).toFixed(1)}%] ${e.sourcePath}:${e.startLine}-${e.endLine}`),console.log(` Type: ${e.contentType} | Origin: ${e.origin}`),e.tags.length>0&&console.log(` Tags: ${e.tags.join(`, `)}`),console.log(``);let n=e.content.length>500?`${e.content.slice(0,500)}...`:e.content;console.log(n)}if(console.log(`\n${`─`.repeat(60)}`),console.log(`${p.length} result(s) found.`),o>0&&p.length>0)try{let{graphAugmentSearch:e}=await import(`../../../tools/dist/index.js`),t=(await e(d,p.map(e=>({recordId:e.record.id,score:e.score,sourcePath:e.record.sourcePath})),{hops:o,maxPerHit:5})).filter(e=>e.graphContext.nodes.length>0);if(t.length>0){console.log(`\nGraph context (${o} hop${o>1?`s`:``}):\n`);for(let e of t){console.log(` ${e.sourcePath}:`);for(let t of e.graphContext.nodes.slice(0,5))console.log(` → ${t.name} (${t.type})`);for(let t of e.graphContext.edges.slice(0,5))console.log(` → ${t.fromId} --[${t.type}]--> ${t.toId}`)}}}catch(e){console.error(`[graph] augmentation failed: ${e.message}`)}}},{name:`find`,description:`Run federated search across indexed content and files`,usage:`kb find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]`,run:async r=>{let i=t(r,`--limit`,10),a=n(r,`--glob`,``).trim()||void 0,o=n(r,`--pattern`,``).trim()||void 0,s=r.join(` `).trim()||void 0;!s&&!a&&!o&&(console.error(`Usage: kb find [query] [--glob <pattern>] [--pattern <regex>] [--limit N]`),process.exit(1));let{embedder:c,store:u}=await e(),d=await l(c,u,{query:s,glob:a,pattern:o,limit:i});if(d.results.length===0){console.log(`No matches found.`);return}console.log(`Strategies: ${d.strategies.join(`, `)}`),console.log(`Results: ${d.results.length} shown (${d.totalFound} total)`);for(let e of d.results){let t=e.lineRange?`:${e.lineRange.start}-${e.lineRange.end}`:``;console.log(`\n[${e.source}] ${e.path}${t}`),console.log(` Score: ${(e.score*100).toFixed(1)}%`),e.preview&&console.log(` ${e.preview.replace(/\s+/g,` `).trim()}`)}}},{name:`scope-map`,description:`Generate a reading plan for a task`,usage:`kb scope-map <task> [--max-files N]`,run:async n=>{let i=t(n,`--max-files`,15),a=n.join(` `).trim();a||(console.error(`Usage: kb scope-map <task> [--max-files N]`),process.exit(1));let{embedder:o,store:s}=await e(),c=await f(o,s,{task:a,maxFiles:i});console.log(`Task: ${c.task}`),console.log(`Files: ${c.files.length}`),console.log(`Estimated tokens: ${c.totalEstimatedTokens}`),console.log(``),console.log(`Reading order:`);for(let e of c.readingOrder)console.log(` ${e}`);for(let[e,t]of c.files.entries())console.log(`\n${e+1}. ${t.path}`),console.log(` Relevance: ${(t.relevance*100).toFixed(1)}% | Tokens: ${t.estimatedTokens}`),console.log(` Why: ${t.reason}`),t.focusRanges.length>0&&console.log(` Focus: ${r(t.focusRanges)}`)}},{name:`symbol`,description:`Resolve a symbol definition, imports, and references`,usage:`kb symbol <name> [--limit N]`,run:async n=>{let r=t(n,`--limit`,20),i=n.join(` `).trim();i||(console.error(`Usage: kb symbol <name> [--limit N]`),process.exit(1));let{embedder:a,store:s}=await e();o(await p(a,s,{name:i,limit:r}))}},{name:`trace`,description:`Trace forward/backward flow for a symbol or file location`,usage:`kb trace <start> [--direction forward|backward|both] [--max-depth N]`,run:async r=>{let i=n(r,`--direction`,`both`).trim()||`both`,a=t(r,`--max-depth`,3),o=r.join(` `).trim();(!o||![`forward`,`backward`,`both`].includes(i))&&(console.error(`Usage: kb trace <start> [--direction forward|backward|both] [--max-depth N]`),process.exit(1));let{embedder:c,store:l}=await e();s(await m(c,l,{start:o,direction:i,maxDepth:a}))}},{name:`examples`,description:`Find real code examples of a symbol or pattern`,usage:`kb examples <query> [--limit N] [--content-type type]`,run:async r=>{let i=t(r,`--limit`,5),o=n(r,`--content-type`,``).trim()||void 0,s=r.join(` `).trim();s||(console.error(`Usage: kb examples <query> [--limit N] [--content-type type]`),process.exit(1));let{embedder:c,store:l}=await e();a(await d(c,l,{query:s,limit:i,contentType:o}))}},{name:`dead-symbols`,description:`Find exported symbols that appear to be unused`,usage:`kb dead-symbols [--limit N]`,run:async n=>{let r=t(n,`--limit`,100),{embedder:a,store:o}=await e();i(await u(a,o,{limit:r}))}},{name:`lookup`,description:`Look up indexed content by record ID or source path`,usage:`kb lookup <id>`,run:async t=>{let n=t.join(` `).trim();n||(console.error(`Usage: kb lookup <id>`),process.exit(1));let{store:r}=await e(),i=await r.getById(n);if(i){console.log(i.id),console.log(`─`.repeat(60)),console.log(`Path: ${i.sourcePath}`),console.log(`Chunk: ${i.chunkIndex+1}/${i.totalChunks}`),console.log(`Lines: ${i.startLine}-${i.endLine}`),console.log(`Type: ${i.contentType} | Origin: ${i.origin}`),i.tags.length>0&&console.log(`Tags: ${i.tags.join(`, `)}`),console.log(``),console.log(i.content);return}let a=await r.getBySourcePath(n);if(a.length===0){console.log(`No indexed content found for: ${n}`);return}a.sort((e,t)=>e.chunkIndex-t.chunkIndex),console.log(n),console.log(`─`.repeat(60)),console.log(`Chunks: ${a.length} | Type: ${a[0].contentType}`);for(let e of a){let t=e.startLine?` (lines ${e.startLine}-${e.endLine})`:``;console.log(`\nChunk ${e.chunkIndex+1}/${e.totalChunks}${t}`),console.log(e.content)}}}];export{h as searchCommands};
|
|
2
|
+
//# sourceMappingURL=search.js.map
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { Command } from "../types.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/cli/src/commands/system.d.ts
|
|
4
|
+
declare const systemCommands: Command[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { systemCommands };
|
|
3
7
|
//# sourceMappingURL=system.d.ts.map
|