@vpxa/kb 0.1.12 → 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 +56 -39
- 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 -17
- package/packages/analyzers/dist/entry-point-analyzer.js +5 -5
- 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 +9 -3
- package/packages/cli/dist/commands/init.js +253 -197
- 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 -4
- 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 -3
- 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 +10 -5
- 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 +108 -90
- 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 -1
- package/packages/server/dist/tools/audit.tool.d.ts +9 -0
- package/packages/server/dist/tools/audit.tool.js +2 -0
- 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 -18
- 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 -21
- 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 -44
- package/packages/store/dist/store.interface.js +1 -0
- package/packages/tools/dist/audit.d.ts +66 -0
- package/packages/tools/dist/audit.js +7 -0
- 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 +45 -22
- 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 -35
- 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 -17
- 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 +26 -0
- package/packages/tools/dist/guide.js +2 -0
- package/packages/tools/dist/health.d.ts +13 -10
- package/packages/tools/dist/health.js +3 -1
- 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 -49
- 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 +15 -0
- package/packages/tools/dist/path-resolver.js +2 -0
- 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 +33 -30
- package/packages/tools/dist/replay.js +5 -6
- package/packages/tools/dist/response-envelope.d.ts +44 -0
- package/packages/tools/dist/response-envelope.js +2 -0
- 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 -45
- 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 +14 -2
- 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 +34 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{existsSync as e,mkdirSync as t,readFileSync as n,writeFileSync as r}from"node:fs";import{dirname as i,join as a}from"node:path";var o=class{db=null;dbPath;dirty=!1;constructor(e){this.dbPath=a(e?.path??`.kb-data`,`graph.db`)}async initialize(){let r=i(this.dbPath);e(r)||t(r,{recursive:!0});let a=(await import(`sql.js`)).default,o=await a();if(e(this.dbPath)){let e=n(this.dbPath);this.db=new o.Database(e)}else this.db=new o.Database;this.db.run(`PRAGMA journal_mode = WAL`),this.db.exec(`PRAGMA foreign_keys = ON;`),this.db.run(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS nodes (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
type TEXT NOT NULL,
|
|
@@ -19,7 +19,7 @@ import{existsSync as g,mkdirSync as l,readFileSync as N,writeFileSync as f}from"
|
|
|
19
19
|
FOREIGN KEY (from_id) REFERENCES nodes(id) ON DELETE CASCADE,
|
|
20
20
|
FOREIGN KEY (to_id) REFERENCES nodes(id) ON DELETE CASCADE
|
|
21
21
|
)
|
|
22
|
-
`),this.db.run(
|
|
22
|
+
`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_type ON nodes(type)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_source_path ON nodes(source_path)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_from ON edges(from_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_to ON edges(to_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_type ON edges(type)`),this.persist()}ensureDb(){if(!this.db)throw Error(`Graph store not initialized — call initialize() first`);return this.db}persist(){if(!this.db)return;let e=this.db.export();try{r(this.dbPath,Buffer.from(e))}finally{this.db.exec(`PRAGMA foreign_keys = ON;`)}this.dirty=!1}markDirty(){this.dirty=!0}flushIfDirty(){this.dirty&&this.persist()}query(e,t=[]){let n=this.ensureDb().prepare(e);n.bind(t);let r=[];try{for(;n.step();)r.push(n.getAsObject())}finally{n.free()}return r}run(e,t=[]){this.ensureDb().run(e,t)}async upsertNode(e){this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at)
|
|
23
23
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
24
24
|
ON CONFLICT(id) DO UPDATE SET
|
|
25
25
|
type = excluded.type, name = excluded.name, properties = excluded.properties,
|
|
@@ -27,20 +27,21 @@ import{existsSync as g,mkdirSync as l,readFileSync as N,writeFileSync as f}from"
|
|
|
27
27
|
VALUES (?, ?, ?, ?, ?, ?)
|
|
28
28
|
ON CONFLICT(id) DO UPDATE SET
|
|
29
29
|
from_id = excluded.from_id, to_id = excluded.to_id,
|
|
30
|
-
type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[e.id,e.fromId,e.toId,e.type,e.weight??1,JSON.stringify(e.properties??{})]),this.markDirty(),this.flushIfDirty()}async upsertNodes(e){if(e.length
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[e.id,e.fromId,e.toId,e.type,e.weight??1,JSON.stringify(e.properties??{})]),this.markDirty(),this.flushIfDirty()}async upsertNodes(e){if(e.length===0)return;let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{for(let t of e)this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at)
|
|
31
|
+
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
32
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
33
|
+
type = excluded.type, name = excluded.name, properties = excluded.properties,
|
|
34
|
+
source_record_id = excluded.source_record_id, source_path = excluded.source_path`,[t.id,t.type,t.name,JSON.stringify(t.properties),t.sourceRecordId??null,t.sourcePath??null,t.createdAt??new Date().toISOString()]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async upsertEdges(e){if(e.length===0)return;let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{for(let t of e)this.run(`INSERT INTO edges (id, from_id, to_id, type, weight, properties)
|
|
35
|
+
VALUES (?, ?, ?, ?, ?, ?)
|
|
36
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
37
|
+
from_id = excluded.from_id, to_id = excluded.to_id,
|
|
38
|
+
type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[t.id,t.fromId,t.toId,t.type,t.weight??1,JSON.stringify(t.properties??{})]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async getNode(e){let t=this.query(`SELECT * FROM nodes WHERE id = ?`,[e]);return t.length>0?c(t[0]):null}async getNeighbors(e,t){let n=t?.direction??`both`,r=t?.edgeType,i=t?.limit??50,a=[],o=[],s=new Set;if(n===`outgoing`||n===`both`){let t=`
|
|
39
39
|
SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight, e.properties AS edge_props,
|
|
40
40
|
n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
|
|
41
41
|
n.source_record_id AS node_src_rec, n.source_path AS node_src_path, n.created_at AS node_created
|
|
42
|
-
FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,
|
|
42
|
+
FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(u(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(d(e)))}if(n===`incoming`||n===`both`){let t=`
|
|
43
43
|
SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight, e.properties AS edge_props,
|
|
44
44
|
n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
|
|
45
45
|
n.source_record_id AS node_src_rec, n.source_path AS node_src_path, n.created_at AS node_created
|
|
46
|
-
FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id =
|
|
46
|
+
FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(u(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(d(e)))}return{nodes:a,edges:o}}async traverse(e,t){let n=t?.maxDepth??2,r=t?.direction??`both`,i=t?.edgeType,a=t?.limit??50,o=new Map,s=new Map,c=new Set,l=[{nodeId:e,depth:0}];for(;l.length>0&&o.size<a;){let e=l.shift();if(!e||c.has(e.nodeId)||e.depth>n)continue;c.add(e.nodeId);let t=await this.getNeighbors(e.nodeId,{direction:r,edgeType:i,limit:a-o.size});for(let r of t.nodes)o.has(r.id)||(o.set(r.id,r),e.depth+1<n&&l.push({nodeId:r.id,depth:e.depth+1}));for(let e of t.edges)s.set(e.id,e)}return{nodes:[...o.values()],edges:[...s.values()]}}async findNodes(e){let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.namePattern&&(t.push(`name LIKE ?`),n.push(`%${e.namePattern}%`)),e.sourcePath&&(t.push(`source_path = ?`),n.push(e.sourcePath));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM nodes ${r} LIMIT ?`,[...n,i]).map(e=>c(e))}async findEdges(e){let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.fromId&&(t.push(`from_id = ?`),n.push(e.fromId)),e.toId&&(t.push(`to_id = ?`),n.push(e.toId));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM edges ${r} LIMIT ?`,[...n,i]).map(e=>l(e))}async deleteNode(e){let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e,e]),this.run(`DELETE FROM nodes WHERE id = ?`,[e]),t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async deleteBySourcePath(e){let t=this.query(`SELECT id FROM nodes WHERE source_path = ?`,[e]);if(t.length===0)return 0;let n=this.ensureDb();n.run(`BEGIN TRANSACTION`);try{for(let e of t)this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e.id,e.id]);this.run(`DELETE FROM nodes WHERE source_path = ?`,[e]),n.run(`COMMIT`)}catch(e){throw n.run(`ROLLBACK`),e}return this.markDirty(),this.flushIfDirty(),t.length}async clear(){this.run(`DELETE FROM edges`),this.run(`DELETE FROM nodes`),this.markDirty(),this.flushIfDirty()}async getStats(){let e=this.query(`SELECT COUNT(*) as count FROM nodes`)[0]?.count??0,t=this.query(`SELECT COUNT(*) as count FROM edges`)[0]?.count??0,n=this.query(`SELECT type, COUNT(*) as count FROM nodes GROUP BY type`),r={};for(let e of n)r[e.type]=e.count;let i=this.query(`SELECT type, COUNT(*) as count FROM edges GROUP BY type`),a={};for(let e of i)a[e.type]=e.count;return{nodeCount:e,edgeCount:t,nodeTypes:r,edgeTypes:a}}async close(){this.db&&=(this.flushIfDirty(),this.db.close(),null)}};function s(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function c(e){return{id:e.id,type:e.type,name:e.name,properties:s(e.properties),sourceRecordId:e.source_record_id??void 0,sourcePath:e.source_path??void 0,createdAt:e.created_at}}function l(e){return{id:e.id,fromId:e.from_id,toId:e.to_id,type:e.type,weight:e.weight??1,properties:s(e.properties)}}function u(e){return{id:e.edge_id,fromId:e.from_id,toId:e.to_id,type:e.edge_type,weight:e.weight??1,properties:s(e.edge_props??`{}`)}}function d(e){return{id:e.node_id,type:e.node_type,name:e.node_name,properties:s(e.node_props??`{}`),sourceRecordId:e.node_src_rec??void 0,sourcePath:e.node_src_path??void 0,createdAt:e.node_created}}export{o as SqliteGraphStore};
|
|
47
|
+
//# sourceMappingURL=sqlite-graph-store.js.map
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { IKnowledgeStore } from "./store.interface.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/store/src/store-factory.d.ts
|
|
4
|
+
type StoreBackend = 'lancedb' | 'sqlite-vec';
|
|
5
|
+
interface StoreConfig {
|
|
6
|
+
backend: StoreBackend;
|
|
7
|
+
path: string;
|
|
8
|
+
options?: Record<string, unknown>;
|
|
7
9
|
}
|
|
8
|
-
|
|
10
|
+
declare function createStore(config: StoreConfig): Promise<IKnowledgeStore>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { StoreBackend, StoreConfig, createStore };
|
|
9
13
|
//# sourceMappingURL=store-factory.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
async function
|
|
1
|
+
async function e(e){switch(e.backend){case`lancedb`:{let{LanceStore:t}=await import(`./lance-store.js`);return new t({path:e.path})}default:throw Error(`Unknown store backend: "${e.backend}". Supported: lancedb`)}}export{e as createStore};
|
|
2
|
+
//# sourceMappingURL=store-factory.js.map
|
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { IndexStats, KnowledgeRecord, SearchResult } from '@kb/core';
|
|
1
|
+
import { ContentType, IndexStats, KnowledgeOrigin, KnowledgeRecord, SearchResult, SourceType } from "@kb/core";
|
|
2
|
+
|
|
3
|
+
//#region packages/store/src/store.interface.d.ts
|
|
5
4
|
/** Options for searching the store */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
interface SearchOptions {
|
|
6
|
+
/** Maximum number of results to return */
|
|
7
|
+
limit?: number;
|
|
8
|
+
/** Minimum similarity score (0-1) */
|
|
9
|
+
minScore?: number;
|
|
10
|
+
/** Filter by content type */
|
|
11
|
+
contentType?: ContentType;
|
|
12
|
+
/** Filter by coarse source type (source, documentation, test, config, generated) */
|
|
13
|
+
sourceType?: SourceType;
|
|
14
|
+
/** Filter by origin */
|
|
15
|
+
origin?: KnowledgeOrigin;
|
|
16
|
+
/** Filter by category */
|
|
17
|
+
category?: string;
|
|
18
|
+
/** Filter by tags (any match) */
|
|
19
|
+
tags?: string[];
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
21
|
+
interface IKnowledgeStore {
|
|
22
|
+
/** Initialize the store (create tables, etc.) */
|
|
23
|
+
initialize(): Promise<void>;
|
|
24
|
+
/** Add or update records with their embedding vectors */
|
|
25
|
+
upsert(records: KnowledgeRecord[], vectors: Float32Array[]): Promise<void>;
|
|
26
|
+
/** Search by vector similarity */
|
|
27
|
+
search(queryVector: Float32Array, options?: SearchOptions): Promise<SearchResult[]>;
|
|
28
|
+
/** Get a specific record by ID */
|
|
29
|
+
getById(id: string): Promise<KnowledgeRecord | null>;
|
|
30
|
+
/** Delete records by source path (used during re-indexing) */
|
|
31
|
+
deleteBySourcePath(sourcePath: string): Promise<number>;
|
|
32
|
+
/** Delete a specific record by ID */
|
|
33
|
+
deleteById(id: string): Promise<boolean>;
|
|
34
|
+
/** Get all records for a source path */
|
|
35
|
+
getBySourcePath(sourcePath: string): Promise<KnowledgeRecord[]>;
|
|
36
|
+
/** Get index statistics */
|
|
37
|
+
getStats(): Promise<IndexStats>;
|
|
38
|
+
/** List all unique source paths in the store */
|
|
39
|
+
listSourcePaths(): Promise<string[]>;
|
|
40
|
+
/** Create a full-text search index on the content column for keyword search */
|
|
41
|
+
createFtsIndex(): Promise<void>;
|
|
42
|
+
/** Full-text keyword search (requires FTS index) */
|
|
43
|
+
ftsSearch(query: string, options?: SearchOptions): Promise<SearchResult[]>;
|
|
44
|
+
/** Drop the backing table entirely — used for hard resets (e.g. dimension changes) */
|
|
45
|
+
dropTable(): Promise<void>;
|
|
46
|
+
/** Close the store connection */
|
|
47
|
+
close(): Promise<void>;
|
|
47
48
|
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { IKnowledgeStore, SearchOptions };
|
|
48
51
|
//# sourceMappingURL=store.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { KBResponse } from "./response-envelope.js";
|
|
2
|
+
import { IEmbedder } from "@kb/embeddings";
|
|
3
|
+
import { IKnowledgeStore } from "@kb/store";
|
|
4
|
+
|
|
5
|
+
//#region packages/tools/src/audit.d.ts
|
|
6
|
+
type AuditCheck = 'structure' | 'dependencies' | 'patterns' | 'health' | 'dead_symbols' | 'check' | 'entry_points';
|
|
7
|
+
interface AuditOptions {
|
|
8
|
+
/** Root path to audit (default: cwd) */
|
|
9
|
+
path?: string;
|
|
10
|
+
/** Which checks to run (default: all) */
|
|
11
|
+
checks?: AuditCheck[];
|
|
12
|
+
/** Detail level (default: 'summary') */
|
|
13
|
+
detail?: 'summary' | 'full';
|
|
14
|
+
}
|
|
15
|
+
interface AuditRecommendation {
|
|
16
|
+
priority: 'high' | 'medium' | 'low';
|
|
17
|
+
area: string;
|
|
18
|
+
message: string;
|
|
19
|
+
}
|
|
20
|
+
interface AuditData {
|
|
21
|
+
score: number;
|
|
22
|
+
structure?: {
|
|
23
|
+
files: number;
|
|
24
|
+
packages: number;
|
|
25
|
+
languages: Record<string, number>;
|
|
26
|
+
};
|
|
27
|
+
dependencies?: {
|
|
28
|
+
external: number;
|
|
29
|
+
internal: number;
|
|
30
|
+
};
|
|
31
|
+
patterns?: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
confidence: string;
|
|
34
|
+
count: number;
|
|
35
|
+
}>;
|
|
36
|
+
health?: {
|
|
37
|
+
score: number;
|
|
38
|
+
checks: number;
|
|
39
|
+
passed: number;
|
|
40
|
+
warned: number;
|
|
41
|
+
failed: number;
|
|
42
|
+
};
|
|
43
|
+
deadSymbols?: {
|
|
44
|
+
source: number;
|
|
45
|
+
docs: number;
|
|
46
|
+
};
|
|
47
|
+
entryPoints?: {
|
|
48
|
+
total: number;
|
|
49
|
+
types: Record<string, number>;
|
|
50
|
+
};
|
|
51
|
+
typecheck?: {
|
|
52
|
+
passed: boolean;
|
|
53
|
+
errorCount: number;
|
|
54
|
+
topErrors: string[];
|
|
55
|
+
};
|
|
56
|
+
lint?: {
|
|
57
|
+
passed: boolean;
|
|
58
|
+
errorCount: number;
|
|
59
|
+
topErrors: string[];
|
|
60
|
+
};
|
|
61
|
+
recommendations: AuditRecommendation[];
|
|
62
|
+
}
|
|
63
|
+
declare function audit(store: IKnowledgeStore, embedder: IEmbedder, options?: AuditOptions): Promise<KBResponse<AuditData>>;
|
|
64
|
+
//#endregion
|
|
65
|
+
export { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit };
|
|
66
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{check as e,summarizeCheckResult as t}from"./check.js";import{findDeadSymbols as n}from"./dead-symbols.js";import{health as r}from"./health.js";import{resolvePath as i}from"./path-resolver.js";import{errorResponse as a,okResponse as o}from"./response-envelope.js";import{DependencyAnalyzer as s,EntryPointAnalyzer as c,PatternAnalyzer as l,StructureAnalyzer as u}from"../../analyzers/dist/index.js";const d=[`structure`,`dependencies`,`patterns`,`health`,`dead_symbols`,`check`,`entry_points`];async function f(f,m,h={}){let g=Date.now(),_=i(h.path),v=h.checks??d,y=h.detail??`summary`,b=[],x={score:100,recommendations:b};try{let i=[];v.includes(`structure`)&&i.push((async()=>{let e=await new u().analyze(_,{format:`json`}),t=e.data;x.structure={files:t.stats?.totalFiles??e.meta.fileCount,packages:Array.isArray(t.packages)?t.packages.length:0,languages:t.stats?.languages??{}}})()),v.includes(`dependencies`)&&i.push((async()=>{let e=(await new s().analyze(_)).data,t=e.imports??[];x.dependencies={external:e.external?.length??t.filter(e=>e.isExternal).length,internal:e.internal?.length??t.filter(e=>!e.isExternal).length}})()),v.includes(`patterns`)&&i.push((async()=>{x.patterns=((await new l().analyze(_)).data.patterns??[]).map(e=>({name:e.pattern,confidence:e.confidence,count:e.locations.length}))})()),v.includes(`entry_points`)&&i.push((async()=>{let e=(await new c().analyze(_)).data,t=e.entryPoints??[],n={};for(let e of t)n[e.type]=(n[e.type]??0)+1;x.entryPoints={total:e.total??t.length,types:n}})()),v.includes(`health`)&&i.push((async()=>{let e=r(_);x.health={score:e.score,checks:e.checks.length,passed:e.checks.filter(e=>e.status===`pass`).length,warned:e.checks.filter(e=>e.status===`warn`).length,failed:e.checks.filter(e=>e.status===`fail`).length},e.score<70&&b.push({priority:`medium`,area:`health`,message:`Health score ${e.score}/100 — ${x.health.failed} failed checks`})})()),v.includes(`dead_symbols`)&&i.push((async()=>{let e=await n(m,f,{rootPath:_});x.deadSymbols={source:e.totalDeadSource,docs:e.totalDeadDocs},e.totalDeadSource>0&&b.push({priority:e.totalDeadSource>10?`high`:`medium`,area:`dead-code`,message:`${e.totalDeadSource} unused exports in source files`})})()),v.includes(`check`)&&i.push((async()=>{let n=t(await e({cwd:_}));x.typecheck={passed:n.tsc.passed,errorCount:n.tsc.errorCount,topErrors:n.tsc.topErrors},x.lint={passed:n.biome.passed,errorCount:n.biome.errorCount,topErrors:n.biome.topErrors},n.tsc.passed||b.push({priority:`high`,area:`type-safety`,message:`Fix ${n.tsc.errorCount} tsc error(s)`}),n.biome.passed||b.push({priority:`medium`,area:`lint`,message:`Fix ${n.biome.errorCount} lint error(s)`})})()),await Promise.all(i);let a=0;x.typecheck&&!x.typecheck.passed&&(a+=15),x.lint&&!x.lint.passed&&(a+=5),x.health&&x.health.score<80&&(a+=10),x.deadSymbols&&x.deadSymbols.source>10&&(a+=5),x.entryPoints&&x.entryPoints.total===0&&(a+=5),x.score=Math.max(0,100-a);let d={high:0,medium:1,low:2};b.sort((e,t)=>d[e.priority]-d[t.priority]);let h=p(x,y),S=[];return x.typecheck&&!x.typecheck.passed&&S.push({tool:`check`,reason:`Get full error details`,suggested_args:{detail:`errors`}}),x.deadSymbols&&x.deadSymbols.source>0&&S.push({tool:`dead_symbols`,reason:`See which exports are unused`,suggested_args:{root_path:_}}),o(`audit`,h,x,{durationMs:Date.now()-g,detail:y},S)}catch{return a(`audit`,{code:`ANALYSIS_FAILED`,category:`runtime`,retryable:!1,message:`Audit failed. Check server logs for details.`},Date.now()-g)}}function p(e,t){let n=[];if(n.push(`## Audit Report — Score: ${e.score}/100\n`),e.structure&&n.push(`**Structure:** ${e.structure.files} files, ${e.structure.packages} packages, ${Object.keys(e.structure.languages).length} languages`),e.entryPoints){let t=Object.entries(e.entryPoints.types).map(([e,t])=>`${t} ${e}`).join(`, `);n.push(`**Entry Points:** ${e.entryPoints.total} (${t||`none`})`)}if(e.dependencies&&n.push(`**Dependencies:** ${e.dependencies.external} external, ${e.dependencies.internal} internal`),e.health&&n.push(`**Health:** ${e.health.score}/100 (${e.health.passed}✓ ${e.health.warned}⚠ ${e.health.failed}✗)`),e.deadSymbols&&n.push(`**Dead Symbols:** ${e.deadSymbols.source} in source (actionable), ${e.deadSymbols.docs} in docs`),e.typecheck){let t=e.typecheck.passed?`✓ passed`:`✗ ${e.typecheck.errorCount} errors`;n.push(`**Typecheck:** ${t}`)}if(e.lint){let t=e.lint.passed?`✓ passed`:`✗ ${e.lint.errorCount} errors`;n.push(`**Lint:** ${t}`)}if(e.recommendations.length>0){n.push(`
|
|
2
|
+
### Recommendations
|
|
3
|
+
`);for(let t of e.recommendations){let e=t.priority===`high`?`🔴`:t.priority===`medium`?`🟡`:`🟢`;n.push(`${e} **${t.area}:** ${t.message}`)}}if(t===`full`&&e.patterns&&e.patterns.length>0){n.push(`
|
|
4
|
+
### Patterns Detected
|
|
5
|
+
`),n.push(`| Pattern | Confidence | Count |`),n.push(`|---------|-----------|-------|`);for(let t of e.patterns)n.push(`| ${t.name} | ${t.confidence} | ${t.count} |`)}return n.join(`
|
|
6
|
+
`)}export{f as audit};
|
|
7
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region packages/tools/src/batch.d.ts
|
|
2
|
+
interface BatchOperation {
|
|
3
|
+
/** Unique ID for this operation */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Operation type */
|
|
6
|
+
type: string;
|
|
7
|
+
/** Arguments for the operation */
|
|
8
|
+
args: Record<string, unknown>;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
interface BatchResult {
|
|
11
|
+
id: string;
|
|
12
|
+
status: 'success' | 'error';
|
|
13
|
+
result?: unknown;
|
|
14
|
+
error?: string;
|
|
15
|
+
durationMs: number;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
interface BatchOptions {
|
|
18
|
+
/** Max concurrent operations (default: 4) */
|
|
19
|
+
concurrency?: number;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
declare function batch(operations: BatchOperation[], executor: (op: BatchOperation) => Promise<unknown>, options?: BatchOptions): Promise<BatchResult[]>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { BatchOperation, BatchOptions, BatchResult, batch };
|
|
21
24
|
//# sourceMappingURL=batch.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
async function
|
|
1
|
+
async function e(e,t,n={}){let r=Math.max(1,n.concurrency??4),i=[],a=[...e];async function o(e){let n=Date.now();try{let r=await t(e);return{id:e.id,status:`success`,result:r,durationMs:Date.now()-n}}catch(t){return{id:e.id,status:`error`,error:t instanceof Error?t.message:String(t),durationMs:Date.now()-n}}}for(;a.length>0;){let e=a.splice(0,r),t=await Promise.allSettled(e.map(e=>o(e)));for(let e of t){if(e.status===`fulfilled`){i.push(e.value);continue}i.push({id:`unknown`,status:`error`,error:e.reason instanceof Error?e.reason.message:`Promise rejected`,durationMs:0})}}return i}export{e as batch};
|
|
2
|
+
//# sourceMappingURL=batch.js.map
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
+
//#region packages/tools/src/changelog.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_changelog — Generate a changelog from git history.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
type ChangelogFormat = 'grouped' | 'chronological' | 'per-scope';
|
|
6
|
+
interface ChangelogOptions {
|
|
7
|
+
from: string;
|
|
8
|
+
to?: string;
|
|
9
|
+
format?: ChangelogFormat;
|
|
10
|
+
includeBreaking?: boolean;
|
|
11
|
+
cwd?: string;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
interface ChangelogEntry {
|
|
14
|
+
hash: string;
|
|
15
|
+
type: string;
|
|
16
|
+
scope: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
body: string;
|
|
19
|
+
author: string;
|
|
20
|
+
date: string;
|
|
21
|
+
breaking: boolean;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
interface ChangelogResult {
|
|
24
|
+
entries: ChangelogEntry[];
|
|
25
|
+
markdown: string;
|
|
26
|
+
stats: {
|
|
27
|
+
total: number;
|
|
28
|
+
breaking: number;
|
|
29
|
+
types: Record<string, number>;
|
|
30
|
+
};
|
|
30
31
|
}
|
|
31
|
-
|
|
32
|
+
declare function changelog(options: ChangelogOptions): ChangelogResult;
|
|
32
33
|
/** Exported for testing */
|
|
33
|
-
|
|
34
|
+
declare function formatChangelog(entries: ChangelogEntry[], format: ChangelogFormat, includeBreaking: boolean): string;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog };
|
|
34
37
|
//# sourceMappingURL=changelog.d.ts.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{execSync as
|
|
2
|
-
`)}export{
|
|
1
|
+
import{execSync as e}from"node:child_process";const t=/^[a-zA-Z0-9_./\-~^@{}]+$/;function n(n){let{from:i,to:a=`HEAD`,format:o=`grouped`,includeBreaking:s=!0,cwd:c=process.cwd()}=n;if(!t.test(i))throw Error(`Invalid git ref: ${i}`);if(!t.test(a))throw Error(`Invalid git ref: ${a}`);let l;try{l=e(`git log "${i}..${a}" --format="%H%s%b%an%ai"`,{cwd:c,encoding:`utf8`,maxBuffer:10*1024*1024,timeout:3e4})}catch{throw Error(`Git log failed. Ensure "${i}" and "${a}" are valid refs.`)}let u=l.split(``).map(e=>e.trim()).filter(Boolean).map(e=>{let[t=``,n=``,r=``,i=``,a=``]=e.split(``),o=n.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)/);return{hash:t.slice(0,8),type:o?.[1]??`other`,scope:o?.[2]??``,subject:o?.[4]??n,body:r.trim(),author:i.trim(),date:a.trim().split(` `)[0],breaking:!!(o?.[3]||/BREAKING[\s-]CHANGE/i.test(r))}}),d={},f=0;for(let e of u)d[e.type]=(d[e.type]??0)+1,e.breaking&&f++;return{entries:u,markdown:r(u,o,s),stats:{total:u.length,breaking:f,types:d}}}function r(e,t,n){let r=[`# Changelog`,``];if(n){let t=e.filter(e=>e.breaking);if(t.length>0){r.push(`## Breaking Changes`,``);for(let e of t)r.push(`- ${e.subject} (${e.hash})`);r.push(``)}}if(t===`grouped`){let t={};for(let n of e)t[n.type]||(t[n.type]=[]),t[n.type].push(n);let n=[`feat`,`fix`,`refactor`,`perf`,`test`,`docs`,`chore`],i={feat:`Features`,fix:`Bug Fixes`,refactor:`Refactoring`,perf:`Performance`,test:`Tests`,docs:`Documentation`,chore:`Chores`,other:`Other`};for(let e of[...n,...Object.keys(t).filter(e=>!n.includes(e))])if(t[e]?.length){r.push(`## ${i[e]??e}`,``);for(let n of t[e]){let e=n.scope?`**${n.scope}:** `:``;r.push(`- ${e}${n.subject} (${n.hash})`)}r.push(``)}}else if(t===`chronological`)for(let t of e){let e=t.scope?`(${t.scope}) `:``;r.push(`- \`${t.date}\` ${t.type}: ${e}${t.subject} (${t.hash})`)}else{let t={};for(let n of e){let e=n.scope||`general`;t[e]||(t[e]=[]),t[e].push(n)}for(let[e,n]of Object.entries(t)){r.push(`## ${e}`,``);for(let e of n)r.push(`- ${e.type}: ${e.subject} (${e.hash})`);r.push(``)}}return r.join(`
|
|
2
|
+
`)}export{n as changelog,r as formatChangelog};
|
|
3
|
+
//# sourceMappingURL=changelog.js.map
|
|
@@ -1,26 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { ParsedError } from "./parse-output.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/tools/src/check.d.ts
|
|
4
|
+
interface CheckOptions {
|
|
5
|
+
/** Specific files to check (if empty, checks all) */
|
|
6
|
+
files?: string[];
|
|
7
|
+
/** Working directory */
|
|
8
|
+
cwd?: string;
|
|
9
|
+
/** Skip typecheck */
|
|
10
|
+
skipTypes?: boolean;
|
|
11
|
+
/** Skip lint */
|
|
12
|
+
skipLint?: boolean;
|
|
13
|
+
/** Detail level: summary (default, minimal), errors (parsed errors), full (includes raw) */
|
|
14
|
+
detail?: 'summary' | 'errors' | 'full';
|
|
11
15
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
passed: boolean;
|
|
16
|
-
raw?: string;
|
|
17
|
-
};
|
|
18
|
-
biome: {
|
|
19
|
-
errors: ParsedError[];
|
|
20
|
-
passed: boolean;
|
|
21
|
-
raw?: string;
|
|
22
|
-
};
|
|
16
|
+
interface CheckSummaryResult {
|
|
17
|
+
passed: boolean;
|
|
18
|
+
tsc: {
|
|
23
19
|
passed: boolean;
|
|
20
|
+
errorCount: number;
|
|
21
|
+
warningCount: number;
|
|
22
|
+
topErrors: string[];
|
|
23
|
+
};
|
|
24
|
+
biome: {
|
|
25
|
+
passed: boolean;
|
|
26
|
+
errorCount: number;
|
|
27
|
+
warningCount: number;
|
|
28
|
+
topErrors: string[];
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface CheckResult {
|
|
32
|
+
tsc: {
|
|
33
|
+
errors: ParsedError[];
|
|
34
|
+
passed: boolean;
|
|
35
|
+
raw?: string;
|
|
36
|
+
};
|
|
37
|
+
biome: {
|
|
38
|
+
errors: ParsedError[];
|
|
39
|
+
passed: boolean;
|
|
40
|
+
raw?: string;
|
|
41
|
+
};
|
|
42
|
+
passed: boolean;
|
|
24
43
|
}
|
|
25
|
-
|
|
44
|
+
declare function check(options?: CheckOptions): Promise<CheckResult>;
|
|
45
|
+
/** Produce a minimal summary for LLM consumption (~300 tokens) */
|
|
46
|
+
declare function summarizeCheckResult(result: CheckResult): CheckSummaryResult;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { CheckOptions, CheckResult, CheckSummaryResult, check, summarizeCheckResult };
|
|
26
49
|
//# sourceMappingURL=check.d.ts.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{execFile as
|
|
2
|
-
`).trim()||t.message
|
|
1
|
+
import{parseBiome as e,parseTsc as t}from"./parse-output.js";import{execFile as n}from"node:child_process";import{readFile as r}from"node:fs/promises";import{join as i}from"node:path";import{promisify as a}from"node:util";const o=a(n);let s=0;function c(e){let t=e;return[t.stdout?.toString()??``,t.stderr?.toString()??``].filter(Boolean).join(`
|
|
2
|
+
`).trim()||t.message||`Command failed`}async function l(e={}){if(s>=2)throw Error(`Too many concurrent check runs (max 2). Try again later.`);s++;try{return await u(e)}finally{s--}}async function u(n){let a=n.cwd??process.cwd(),s={errors:[],passed:!0,raw:``},l={errors:[],passed:!0,raw:``};if(!n.skipTypes)try{let e=i(a,`package.json`),t=!1;try{t=!!JSON.parse(await r(e,`utf-8`)).scripts?.typecheck}catch{}if(t&&!n.files?.length)await o(`npx`,[`turbo`,`run`,`typecheck`],{cwd:a,shell:!0,timeout:12e4});else{let e=[`--noEmit`];n.files?.length&&e.push(...n.files),await o(`npx`,[`tsc`,...e],{cwd:a,shell:!0,timeout:12e4})}}catch(e){s.raw=c(e),s.errors=t(s.raw),s.passed=s.errors.length===0}if(!n.skipLint)try{let e=[`check`];n.files?.length&&e.push(...n.files),await o(`npx`,[`biome`,...e],{cwd:a,shell:!0,timeout:12e4})}catch(t){l.raw=c(t),l.errors=e(l.raw),l.passed=l.errors.length===0}let u=n.detail??`full`,d={tsc:s,biome:l,passed:s.passed&&l.passed};return u===`full`?d:u===`errors`?{tsc:{errors:s.errors,passed:s.passed},biome:{errors:l.errors,passed:l.passed},passed:d.passed}:d}function d(e){let t=e.tsc.errors.filter(e=>e.severity===`error`),n=e.tsc.errors.filter(e=>e.severity===`warning`),r=e.biome.errors.filter(e=>e.severity===`error`),i=e.biome.errors.filter(e=>e.severity===`warning`);return{passed:e.passed,tsc:{passed:e.tsc.passed,errorCount:t.length,warningCount:n.length,topErrors:t.slice(0,3).map(e=>`${e.file}:${e.line} — ${e.message}`)},biome:{passed:e.biome.passed,errorCount:r.length,warningCount:i.length,topErrors:r.slice(0,3).map(e=>`${e.file}:${e.line} — ${e.message}`)}}}export{l as check,d as summarizeCheckResult};
|
|
3
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
//#region packages/tools/src/checkpoint.d.ts
|
|
2
|
+
interface Checkpoint {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
createdAt: string;
|
|
6
|
+
data: Record<string, unknown>;
|
|
7
|
+
files?: string[];
|
|
8
|
+
notes?: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
declare function checkpointSave(label: string, data: Record<string, unknown>, options?: {
|
|
11
|
+
files?: string[];
|
|
12
|
+
notes?: string;
|
|
13
|
+
cwd?: string;
|
|
13
14
|
}): Checkpoint;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
declare function checkpointLoad(id: string, cwd?: string): Checkpoint | undefined;
|
|
16
|
+
declare function checkpointList(cwd?: string): Checkpoint[];
|
|
17
|
+
declare function checkpointLatest(cwd?: string): Checkpoint | undefined;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave };
|
|
17
20
|
//# sourceMappingURL=checkpoint.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{existsSync as
|
|
2
|
-
|
|
1
|
+
import{resolve as e}from"node:path";import{existsSync as t,mkdirSync as n,readFileSync as r,readdirSync as i,writeFileSync as a}from"node:fs";function o(r){let i=e(r??process.cwd(),`.kb-state/checkpoints`);return t(i)||n(i,{recursive:!0}),i}function s(t,n,r){let i=t.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`checkpoint`,s={id:`${Date.now()}-${i}`,label:t,createdAt:new Date().toISOString(),data:n,files:r?.files,notes:r?.notes};return a(e(o(r?.cwd),`${s.id}.json`),`${JSON.stringify(s,null,2)}\n`,`utf-8`),s}function c(n,i){let a=e(o(i),`${n}.json`);if(t(a))try{return JSON.parse(r(a,`utf-8`))}catch{return}}function l(t){let n=o(t);return i(n).filter(e=>e.endsWith(`.json`)).flatMap(t=>{try{return[JSON.parse(r(e(n,t),`utf-8`))]}catch{return[]}}).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function u(e){return l(e)[0]}export{u as checkpointLatest,l as checkpointList,c as checkpointLoad,s as checkpointSave};
|
|
2
|
+
//# sourceMappingURL=checkpoint.js.map
|