@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,31 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
tier?: 'T1' | 'T2';
|
|
13
|
-
maxContentChars?: number;
|
|
1
|
+
import { FileCache } from "./file-cache.js";
|
|
2
|
+
import { IEmbedder } from "@kb/embeddings";
|
|
3
|
+
|
|
4
|
+
//#region packages/tools/src/stratum-card.d.ts
|
|
5
|
+
interface StratumCardOptions {
|
|
6
|
+
files: string[];
|
|
7
|
+
query: string;
|
|
8
|
+
tier?: 'T1' | 'T2';
|
|
9
|
+
maxContentChars?: number;
|
|
10
|
+
/** Optional file cache — avoids redundant reads and eliminates double-read with fileSummary */
|
|
11
|
+
cache?: FileCache;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
interface StratumCard {
|
|
14
|
+
path: string;
|
|
15
|
+
tier: 'T1' | 'T2';
|
|
16
|
+
card: string;
|
|
17
|
+
unknowns: string[];
|
|
18
|
+
riskTier: 'low' | 'medium' | 'high';
|
|
19
|
+
tokenEstimate: number;
|
|
20
|
+
originalTokenEstimate: number;
|
|
23
21
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
interface StratumCardResult {
|
|
23
|
+
cards: StratumCard[];
|
|
24
|
+
totalTokenEstimate: number;
|
|
25
|
+
totalOriginalTokenEstimate: number;
|
|
26
|
+
compressionRatio: number;
|
|
29
27
|
}
|
|
30
|
-
|
|
28
|
+
declare function stratumCard(embedder: IEmbedder, options: StratumCardOptions): Promise<StratumCardResult>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { StratumCard, StratumCardOptions, StratumCardResult, stratumCard };
|
|
31
31
|
//# sourceMappingURL=stratum-card.d.ts.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
${g}`)}return{path:i,tier:n,card:f,unknowns:E,riskTier:w,tokenEstimate:y(f),originalTokenEstimate:p}}catch(c){const p=c.code==="ENOENT"?"file missing":"unreadable file",d=c.code==="ENOENT"?"missing":"unreadable";return C(i,n,d,p,0)}})),s=l.reduce((i,c)=>i+c.tokenEstimate,0),a=l.reduce((i,c)=>i+c.originalTokenEstimate,0);return{cards:l,totalTokenEstimate:s,totalOriginalTokenEstimate:a,compressionRatio:a===0?0:s/a}}function C(t,e,r,o,n){const m=x({displayPath:T(t),tier:e,role:r,deps:[],exports:[],unknowns:[o],riskTier:"low"});return{path:t,tier:e,card:m,unknowns:[o],riskTier:"low",tokenEstimate:y(m),originalTokenEstimate:n}}function x(t){const{displayPath:e,tier:r,role:o,deps:n,exports:m,unknowns:u,riskTier:l}=t;return[`[${r}: ${e}]`,`ROLE: ${o}`,`DEPS: ${k(n)}`,`EXPORTS: ${k(m)}`,`UNKNOWNS: ${k(u,"; ")}`,`RISK: ${l}`].join(`
|
|
4
|
-
`)}function T(t){const e=A(process.cwd(),t).replace(/\\/g,"/");return!e||e.startsWith("..")?h(t):e}function k(t,e=", "){return t.length>0?t.join(e):"none"}function U(t,e){const r=h(t),o=I(r).toLowerCase();return[".json",".yaml",".yml",".env"].includes(o)||/config|settings/i.test(r)?"configuration":/types?\.ts$|\.d\.ts$/i.test(r)?"type-definitions":/schema/i.test(r)?"schema":/test|spec/i.test(r)?"test":/index\.[jt]sx?$/i.test(r)?"barrel-export":/handler|controller|route/i.test(r)?"entry-point":/model|entity/i.test(r)?"data-model":/util|helper/i.test(r)?"utility":/service|provider/i.test(r)?"service":e.classes.length>0?"class-module":e.interfaces.length>2?"type-definitions":"implementation"}function W(t,e){const r=[],o=new Set;for(const n of t.matchAll(/\/\/\s*(TODO|FIXME|HACK|XXX)\s*:?\s*(.+)?$/gm)){const m=`${n[1]}: ${(n[2]??"").trim()}`.trim();b(r,o,m.replace(/:\s*$/,""))}K(t)&&b(r,o,"exported any usage");for(const n of $(e))b(r,o,`cross-package import: ${n}`);return r.slice(0,S)}function b(t,e,r){t.length>=S||!r||e.has(r)||(e.add(r),t.push(r))}function K(t){return[/export\s+(?:async\s+)?function\s+\w+[^\n{;]*\bany\b/g,/export\s+interface\s+\w+[\s\S]*?\{[\s\S]*?\bany\b[\s\S]*?\}/g,/export\s+type\s+\w+\s*=.*\bany\b/g,/export\s+const\s+\w+[^\n=]*\bany\b/g].some(r=>r.test(t))}function _(t,e){return/auth|token|permission|secret|credential|encrypt/i.test(t)?"high":/types?\.ts$|schema|contract|\.d\.ts$/i.test(h(t))||e.exports.length>10?"medium":"low"}function $(t){return t.imports.map(q).filter(e=>!!e).filter(e=>!e.startsWith("./")&&!e.startsWith("../")).slice(0,3)}function q(t){const e=t.match(/from\s+['"]([^'"]+)['"]/);if(e)return e[1];const r=t.match(/^import\s+['"]([^'"]+)['"]/);return r?r[1]:null}async function v(t,e,r,o){if(o<=0)return"";const n=D(r,"paragraph");if(n.length===0)return"";const m=await Promise.all(n.map(async(s,a)=>{const i=await t.embed(s);return{index:a,text:s,score:X(e,i)}})),u=[];let l=0;for(const s of m.sort((a,i)=>i.score-a.score)){const a=o-l;if(a<=0)break;if(s.text.length<=a){u.push({index:s.index,text:s.text}),l+=s.text.length;continue}u.length===0&&(u.push({index:s.index,text:s.text.slice(0,a).trimEnd()}),l=o);break}return u.sort((s,a)=>s.index-a.index).map(s=>s.text).filter(s=>s.length>0).join(`
|
|
1
|
+
import{cosineSimilarity as e,estimateTokens as t,segment as n}from"./text-utils.js";import{fileSummary as r}from"./file-summary.js";import{readFile as i}from"node:fs/promises";import{basename as a,extname as o,relative as s}from"node:path";async function c(e,n){let{files:a,query:o,tier:s=`T1`,maxContentChars:c=800}=n,{cache:f}=n,h=s===`T2`?await e.embedQuery(o):null,g=await Promise.all(a.map(async n=>{try{let a=f?(await f.get(n)).content:await i(n,`utf-8`),o=t(a);if(a.includes(`\0`))return l(n,s,`binary`,`binary file`,o);if(a.trim().length===0){let e=u({displayPath:d(n),tier:s,role:`empty`,deps:[],exports:[],unknowns:[],riskTier:`low`});return{path:n,tier:s,card:e,unknowns:[],riskTier:`low`,tokenEstimate:t(e),originalTokenEstimate:o}}let g=await r({path:n,content:a}),y=p(n,g),x=m(a,g),S=_(n,g),C=v(g),w=[...new Set(g.exports)].slice(0,5),T=u({displayPath:d(n),tier:s,role:y,deps:C,exports:w,unknowns:x,riskTier:S});if(s===`T2`&&h){let t=await b(e,h,a,c);t.length>0&&(T=`${T}\nCONTEXT:\n${t}`)}return{path:n,tier:s,card:T,unknowns:x,riskTier:S,tokenEstimate:t(T),originalTokenEstimate:o}}catch(e){let t=e.code===`ENOENT`?`file missing`:`unreadable file`;return l(n,s,e.code===`ENOENT`?`missing`:`unreadable`,t,0)}})),y=g.reduce((e,t)=>e+t.tokenEstimate,0),x=g.reduce((e,t)=>e+t.originalTokenEstimate,0);return{cards:g,totalTokenEstimate:y,totalOriginalTokenEstimate:x,compressionRatio:x===0?0:y/x}}function l(e,n,r,i,a){let o=u({displayPath:d(e),tier:n,role:r,deps:[],exports:[],unknowns:[i],riskTier:`low`});return{path:e,tier:n,card:o,unknowns:[i],riskTier:`low`,tokenEstimate:t(o),originalTokenEstimate:a}}function u(e){let{displayPath:t,tier:n,role:r,deps:i,exports:a,unknowns:o,riskTier:s}=e;return[`[${n}: ${t}]`,`ROLE: ${r}`,`DEPS: ${f(i)}`,`EXPORTS: ${f(a)}`,`UNKNOWNS: ${f(o,`; `)}`,`RISK: ${s}`].join(`
|
|
2
|
+
`)}function d(e){let t=s(process.cwd(),e).replace(/\\/g,`/`);return!t||t.startsWith(`..`)?a(e):t}function f(e,t=`, `){return e.length>0?e.join(t):`none`}function p(e,t){let n=a(e),r=o(n).toLowerCase();return[`.json`,`.yaml`,`.yml`,`.env`].includes(r)||/config|settings/i.test(n)?`configuration`:/types?\.ts$|\.d\.ts$/i.test(n)?`type-definitions`:/schema/i.test(n)?`schema`:/test|spec/i.test(n)?`test`:/index\.[jt]sx?$/i.test(n)?`barrel-export`:/handler|controller|route/i.test(n)?`entry-point`:/model|entity/i.test(n)?`data-model`:/util|helper/i.test(n)?`utility`:/service|provider/i.test(n)?`service`:t.classes.length>0?`class-module`:t.interfaces.length>2?`type-definitions`:`implementation`}function m(e,t){let n=[],r=new Set;for(let t of e.matchAll(/\/\/\s*(TODO|FIXME|HACK|XXX)\s*:?\s*(.+)?$/gm))h(n,r,`${t[1]}: ${(t[2]??``).trim()}`.trim().replace(/:\s*$/,``));g(e)&&h(n,r,`exported any usage`);for(let e of v(t))h(n,r,`cross-package import: ${e}`);return n.slice(0,3)}function h(e,t,n){e.length>=3||!n||t.has(n)||(t.add(n),e.push(n))}function g(e){return[/export\s+(?:async\s+)?function\s+\w+[^\n{;]*\bany\b/g,/export\s+interface\s+\w+[\s\S]*?\{[\s\S]*?\bany\b[\s\S]*?\}/g,/export\s+type\s+\w+\s*=.*\bany\b/g,/export\s+const\s+\w+[^\n=]*\bany\b/g].some(t=>t.test(e))}function _(e,t){return/auth|token|permission|secret|credential|encrypt/i.test(e)?`high`:/types?\.ts$|schema|contract|\.d\.ts$/i.test(a(e))||t.exports.length>10?`medium`:`low`}function v(e){return e.imports.map(y).filter(e=>!!e).filter(e=>!e.startsWith(`./`)&&!e.startsWith(`../`)).slice(0,3)}function y(e){let t=e.match(/from\s+['"]([^'"]+)['"]/);if(t)return t[1];let n=e.match(/^import\s+['"]([^'"]+)['"]/);return n?n[1]:null}async function b(t,r,i,a){if(a<=0)return``;let o=n(i,`paragraph`);if(o.length===0)return``;let s=await Promise.all(o.map(async(n,i)=>({index:i,text:n,score:e(r,await t.embed(n))}))),c=[],l=0;for(let e of s.sort((e,t)=>t.score-e.score)){let t=a-l;if(t<=0)break;if(e.text.length<=t){c.push({index:e.index,text:e.text}),l+=e.text.length;continue}c.length===0&&(c.push({index:e.index,text:e.text.slice(0,t).trimEnd()}),l=a);break}return c.sort((e,t)=>e.index-t.index).map(e=>e.text).filter(e=>e.length>0).join(`
|
|
5
3
|
|
|
6
|
-
`)}export{
|
|
4
|
+
`)}export{c as stratumCard};
|
|
5
|
+
//# sourceMappingURL=stratum-card.js.map
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { IEmbedder } from "@kb/embeddings";
|
|
2
|
+
import { IKnowledgeStore } from "@kb/store";
|
|
3
|
+
|
|
4
|
+
//#region packages/tools/src/symbol.d.ts
|
|
5
|
+
interface SymbolInfo {
|
|
6
|
+
name: string;
|
|
7
|
+
definedIn?: {
|
|
8
|
+
path: string;
|
|
9
|
+
line: number;
|
|
10
|
+
kind: string;
|
|
11
|
+
};
|
|
12
|
+
importedBy: Array<{
|
|
13
|
+
path: string;
|
|
14
|
+
line: number;
|
|
15
|
+
importStatement: string;
|
|
16
|
+
}>;
|
|
17
|
+
referencedIn: Array<{
|
|
18
|
+
path: string;
|
|
19
|
+
line: number;
|
|
20
|
+
context: string;
|
|
21
|
+
}>;
|
|
20
22
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
interface SymbolOptions {
|
|
24
|
+
/** Symbol name to look up */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Limit results */
|
|
27
|
+
limit?: number;
|
|
26
28
|
}
|
|
27
|
-
|
|
29
|
+
declare function symbol(embedder: IEmbedder, store: IKnowledgeStore, options: SymbolOptions): Promise<SymbolInfo>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { SymbolInfo, SymbolOptions, symbol };
|
|
28
32
|
//# sourceMappingURL=symbol.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
function
|
|
2
|
-
`);for(let n=0;n<
|
|
3
|
-
`);for(let n=0;n<
|
|
1
|
+
function e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}async function t(t,n,r){let{name:i,limit:a=20}=r,o=t.embedQuery?.bind(t)??t.embed.bind(t),s=[`export function ${i}`,`export class ${i}`,`export const ${i}`,`export interface ${i}`,`export type ${i}`,`export enum ${i}`].join(` | `),c=await n.search(await o(s),{limit:a*2}),l=RegExp(`^export\\s+(?:default\\s+)?(?:async\\s+)?(?:function|class|const|let|interface|type|enum)\\s+${e(i)}\\b`,`m`),u;for(let e of c){if(!l.test(e.record.content))continue;let t=e.record.content.match(/export\s+(?:default\s+)?(?:async\s+)?(\w+)/)?.[1]??`unknown`;u={path:e.record.sourcePath,line:e.record.startLine,kind:t};break}let d=RegExp(`import\\s+.*\\b${e(i)}\\b.*from\\s+`,`m`),f=await n.search(await o(`import ${i} from`),{limit:a*3}),p=[],m=new Set;for(let e of f){let t=e.record.content.split(`
|
|
2
|
+
`);for(let n=0;n<t.length;n++){let r=t[n];if(!d.test(r))continue;let i=`${e.record.sourcePath}:${r.trim()}`;m.has(i)||(m.add(i),p.push({path:e.record.sourcePath,line:e.record.startLine+n,importStatement:r.trim()}))}}let h=RegExp(`\\b${e(i)}\\b`),g=await n.search(await o(i),{limit:a*3}),_=[],v=new Set;for(let e of g){if(u&&e.record.sourcePath===u.path)continue;let t=e.record.content.split(`
|
|
3
|
+
`);for(let n=0;n<t.length;n++){let r=t[n];if(!h.test(r)||d.test(r))continue;let i=`${e.record.sourcePath}:${e.record.startLine+n}`;if(!v.has(i)){v.add(i),_.push({path:e.record.sourcePath,line:e.record.startLine+n,context:r.trim().slice(0,120)});break}}}return{name:i,definedIn:u,importedBy:p.slice(0,a),referencedIn:_.slice(0,a)}}export{t as symbol};
|
|
4
|
+
//# sourceMappingURL=symbol.js.map
|
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ParsedTestSummary } from "./parse-output.js";
|
|
2
|
+
|
|
3
|
+
//#region packages/tools/src/test-run.d.ts
|
|
4
|
+
interface TestRunOptions {
|
|
5
|
+
files?: string[];
|
|
6
|
+
cwd?: string;
|
|
7
|
+
timeout?: number;
|
|
8
|
+
grep?: string;
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
interface TestRunResult {
|
|
11
|
+
summary: ParsedTestSummary;
|
|
12
|
+
passed: boolean;
|
|
13
|
+
raw: string;
|
|
14
|
+
durationMs: number;
|
|
13
15
|
}
|
|
14
|
-
|
|
16
|
+
declare function testRun(options?: TestRunOptions): Promise<TestRunResult>;
|
|
15
17
|
/**
|
|
16
18
|
* Classify non-zero exit codes — some tools use exit code 1 for
|
|
17
19
|
* non-error conditions (e.g., grep returns 1 for "no matches").
|
|
18
20
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
declare function classifyExitCode(exitCode: number, _stdout: string, command?: string): {
|
|
22
|
+
isError: boolean;
|
|
23
|
+
reason?: string;
|
|
22
24
|
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { TestRunOptions, TestRunResult, classifyExitCode, testRun };
|
|
23
27
|
//# sourceMappingURL=test-run.d.ts.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`).trim()||
|
|
1
|
+
import{parseVitest as e}from"./parse-output.js";import{execFile as t}from"node:child_process";import{promisify as n}from"node:util";const r=n(t);let i=0;async function a(e={}){if(i>=2)throw Error(`Too many concurrent test runs (max 2). Try again later.`);i++;try{return await o(e)}finally{i--}}async function o(t){let n=t.cwd??process.cwd(),i=t.timeout??6e4,a=Date.now(),o=[`vitest`,`run`,`--reporter=verbose`];t.files?.length&&o.push(...t.files),t.grep&&o.push(`--testNamePattern`,t.grep);try{let{stdout:t}=await r(`npx`,o,{cwd:n,shell:!0,timeout:i}),s=t.toString(),c=e(s);return{summary:c,passed:c.failed===0,raw:s,durationMs:Date.now()-a}}catch(t){let n=s(t);return{summary:e(n),passed:!1,raw:n,durationMs:Date.now()-a}}}function s(e){let t=e;return[t.stdout?.toString()??``,t.stderr?.toString()??``].filter(Boolean).join(`
|
|
2
|
+
`).trim()||t.message||`Test run failed`}function c(e,t,n){if(e===0)return{isError:!1};if(e===1&&n){if(/\b(grep|rg|ripgrep|ag|ack|findstr)\b/i.test(n))return{isError:!1,reason:`grep: no matches (exit 1 is normal)`};if(/\bdiff\b/i.test(n))return{isError:!1,reason:`diff: files differ (exit 1 is normal)`}}return{isError:!0}}export{c as classifyExitCode,a as testRun};
|
|
3
|
+
//# sourceMappingURL=test-run.js.map
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
//#region packages/tools/src/text-utils.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Shared text utilities used by compact, digest, stratum-card, and other tools.
|
|
3
4
|
*/
|
|
4
5
|
/**
|
|
5
6
|
* Approximate token count from character count (~4 chars/token).
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
declare function estimateTokens(text: string): number;
|
|
8
9
|
/**
|
|
9
10
|
* Segment text into chunks for scoring.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
declare function segment(text: string, strategy: 'paragraph' | 'sentence' | 'line'): string[];
|
|
12
13
|
/**
|
|
13
14
|
* Cosine similarity between two vectors.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
+
declare function cosineSimilarity(a: Float32Array, b: Float32Array): number;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { cosineSimilarity, estimateTokens, segment };
|
|
16
19
|
//# sourceMappingURL=text-utils.d.ts.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
function
|
|
2
|
-
`).map(
|
|
1
|
+
function e(e){return Math.ceil(e.length/4)}function t(e,t){switch(t){case`paragraph`:return e.split(/\n\s*\n/).map(e=>e.trim()).filter(e=>e.length>0);case`sentence`:return e.split(/(?<=[.!?])\s+/).map(e=>e.trim()).filter(e=>e.length>0);case`line`:return e.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(e=>e.length>0)}}function n(e,t){let n=0,r=0,i=0;for(let a=0;a<e.length;a++)n+=e[a]*t[a],r+=e[a]*e[a],i+=t[a]*t[a];let a=Math.sqrt(r)*Math.sqrt(i);return a===0?0:n/a}export{n as cosineSimilarity,e as estimateTokens,t as segment};
|
|
3
|
+
//# sourceMappingURL=text-utils.js.map
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
//#region packages/tools/src/time-utils.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_time — Timezone conversion, date parsing, duration calculation.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
type TimeOperation = 'now' | 'parse' | 'convert' | 'diff' | 'add';
|
|
6
|
+
interface TimeOptions {
|
|
7
|
+
operation: TimeOperation;
|
|
8
|
+
input?: string;
|
|
9
|
+
timezone?: string;
|
|
10
|
+
duration?: string;
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
interface TimeResult {
|
|
13
|
+
output: string;
|
|
14
|
+
iso: string;
|
|
15
|
+
unix: number;
|
|
16
|
+
details?: Record<string, string | number>;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
+
declare function timeUtils(options: TimeOptions): TimeResult;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { TimeOperation, TimeOptions, TimeResult, timeUtils };
|
|
18
21
|
//# sourceMappingURL=time-utils.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e){let{operation:a,input:o,timezone:s}=e;switch(a){case`now`:return n(new Date,s);case`parse`:if(!o)throw Error(`input required for parse`);return n(t(o),s);case`convert`:if(!o)throw Error(`input required for convert`);if(!s)throw Error(`timezone required for convert`);return n(t(o),s);case`diff`:{if(!o)throw Error(`input required for diff (two comma-separated dates)`);let e=o.split(`,`).map(e=>e.trim());if(e.length<2)throw Error(`diff requires two comma-separated dates`);let n=t(e[0]),i=t(e[1]),a=Math.abs(i.getTime()-n.getTime());return{output:r(a),iso:`PT${Math.floor(a/1e3)}S`,unix:a,details:{milliseconds:a,seconds:Math.floor(a/1e3),minutes:Math.floor(a/6e4),hours:Math.floor(a/36e5),days:Math.floor(a/864e5)}}}case`add`:{if(!o)throw Error(`input required for add`);let{duration:r}=e;if(!r)throw Error(`duration required for add (e.g., "2h30m")`);let a=t(o),c=i(r);return n(new Date(a.getTime()+c),s)}default:throw Error(`Unknown operation: ${a}`)}}function t(e){let t=Number(e);if(!Number.isNaN(t))return new Date(t>0xe8d4a51000?t:t*1e3);let n=new Date(e);if(Number.isNaN(n.getTime()))throw Error(`Cannot parse date: ${e}`);return n}function n(e,t){let n=t??`UTC`,r=e.toLocaleString(`en-US`,{timeZone:n,dateStyle:`full`,timeStyle:`long`}),i=new Intl.DateTimeFormat(`en-US`,{timeZone:n,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hour12:!1}).formatToParts(e).reduce((e,t)=>(t.type!==`literal`&&(e[t.type]=Number.parseInt(t.value,10)),e),{});return{output:r,iso:e.toISOString(),unix:Math.floor(e.getTime()/1e3),details:{timezone:n,year:i.year,month:i.month,day:i.day,hour:i.hour===24?0:i.hour,minute:i.minute,second:i.second}}}function r(e){let t=[],n=Math.floor(e/864e5);n&&t.push(`${n}d`);let r=Math.floor(e%864e5/36e5);r&&t.push(`${r}h`);let i=Math.floor(e%36e5/6e4);i&&t.push(`${i}m`);let a=Math.floor(e%6e4/1e3);return(a||t.length===0)&&t.push(`${a}s`),t.join(` `)}function i(e){let t=0,n=e.matchAll(/(\d+)\s*(d|h|m|s|ms)/gi);for(let e of n){let n=Number(e[1]);switch(e[2].toLowerCase()){case`d`:t+=n*864e5;break;case`h`:t+=n*36e5;break;case`m`:t+=n*6e4;break;case`s`:t+=n*1e3;break;case`ms`:t+=n;break}}if(t===0)throw Error(`Cannot parse duration: ${e}`);return t}export{e as timeUtils};
|
|
2
|
+
//# sourceMappingURL=time-utils.js.map
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { IEmbedder } from "@kb/embeddings";
|
|
2
|
+
import { IKnowledgeStore } from "@kb/store";
|
|
3
|
+
|
|
4
|
+
//#region packages/tools/src/trace.d.ts
|
|
5
|
+
interface TraceOptions {
|
|
6
|
+
/** Starting point — a symbol or file:line reference */
|
|
7
|
+
start: string;
|
|
8
|
+
/** Direction */
|
|
9
|
+
direction: 'forward' | 'backward' | 'both';
|
|
10
|
+
/** Max depth (default: 3) */
|
|
11
|
+
maxDepth?: number;
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
interface TraceNode {
|
|
14
|
+
path: string;
|
|
15
|
+
symbol: string;
|
|
16
|
+
line: number;
|
|
17
|
+
relationship: 'calls' | 'called-by' | 'imports' | 'imported-by' | 'references';
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
interface TraceResult {
|
|
20
|
+
start: string;
|
|
21
|
+
direction: string;
|
|
22
|
+
nodes: TraceNode[];
|
|
23
|
+
depth: number;
|
|
22
24
|
}
|
|
23
|
-
|
|
25
|
+
declare function trace(embedder: IEmbedder, store: IKnowledgeStore, options: TraceOptions): Promise<TraceResult>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { TraceNode, TraceOptions, TraceResult, trace };
|
|
24
28
|
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
async function
|
|
2
|
-
`);for(let
|
|
1
|
+
async function e(e,a,o){let{start:s,direction:c,maxDepth:l=3}=o,u=[],d=new Set,f=new Set,p=await e.embed(s);if((await a.search(p,{limit:10})).length===0)return{start:s,direction:c,nodes:u,depth:0};let m=[{target:s,depth:0}],h=0;for(;m.length>0;){let i=m.shift();if(!i)break;if(i.depth>=l||d.has(i.target))continue;d.add(i.target);let o=await e.embed(i.target),s=await a.search(o,{limit:20}),p=n(i.target),g=r(i.target);for(let e of s){let n=e.record.content.split(`
|
|
2
|
+
`);for(let r=0;r<n.length;r+=1){let a=n[r],o=e.record.startLine+r,s=e.record.sourcePath;if(c!==`forward`&&RegExp(g?`from\\s+['"]${p}['"]`:`import\\s+.*\\b${p}\\b.*from\\s+`).test(a)){t(f,u,{path:s,symbol:i.target,line:o,relationship:`imported-by`}),h=Math.max(h,i.depth+1);let e=a.match(/from\s+['"]([^'"]+)['"]/);!g&&e&&m.push({target:e[1],depth:i.depth+1})}c!==`backward`&&(g?RegExp(`from\\s+['"]${p}['"]`).test(a)&&(t(f,u,{path:s,symbol:i.target,line:o,relationship:`imports`}),h=Math.max(h,i.depth+1)):RegExp(`\\b${p}\\s*\\(`).test(a)&&!/^\s*(?:export\s+)?(?:async\s+)?function\s/.test(a)&&(t(f,u,{path:s,symbol:i.target,line:o,relationship:`calls`}),h=Math.max(h,i.depth+1))),RegExp(g?`['"]${p}['"]`:`\\b${p}\\b`).test(a)&&!/^\s*import\s/.test(a)&&!/^\s*(?:export\s+)?(?:async\s+)?function\s/.test(a)&&(t(f,u,{path:s,symbol:i.target,line:o,relationship:`references`}),h=Math.max(h,i.depth+1))}}}return{start:s,direction:c,nodes:i(u),depth:h}}function t(e,t,n){let r=`${n.path}:${n.line}:${n.relationship}`;e.has(r)||(e.add(r),t.push(n))}function n(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function r(e){return/[./\\]/.test(e)}function i(e){let t=new Set;return e.filter(e=>{let n=`${e.path}:${e.line}:${e.relationship}`;return t.has(n)?!1:(t.add(n),!0)})}export{e as trace};
|
|
3
|
+
//# sourceMappingURL=trace.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region packages/tools/src/truncation.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Smart truncation utilities.
|
|
3
4
|
*
|
|
@@ -13,10 +14,21 @@
|
|
|
13
14
|
* @param headRatio - Fraction for head portion (default 0.6)
|
|
14
15
|
* @returns Truncated text with separator showing omitted line/char count
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
declare function headTailTruncate(text: string, maxLen: number, headRatio?: number): string;
|
|
17
18
|
/**
|
|
18
19
|
* Truncate at a paragraph boundary near maxLength (head-only).
|
|
19
20
|
* Best for web content and markdown where structure is at the top.
|
|
20
21
|
*/
|
|
21
|
-
|
|
22
|
+
declare function paragraphTruncate(text: string, maxLen: number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Truncate text to fit within a token budget.
|
|
25
|
+
* Uses ~4 chars/token approximation. Snaps to line boundaries.
|
|
26
|
+
*
|
|
27
|
+
* @param text - Full text to truncate
|
|
28
|
+
* @param maxTokens - Maximum token count
|
|
29
|
+
* @returns Original text if within budget, or truncated with notice
|
|
30
|
+
*/
|
|
31
|
+
declare function truncateToTokenBudget(text: string, maxTokens: number): string;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { headTailTruncate, paragraphTruncate, truncateToTokenBudget };
|
|
22
34
|
//# sourceMappingURL=truncation.d.ts.map
|
|
@@ -1,14 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`).length}
|
|
8
|
-
|
|
9
|
-
${r}`}function A(t,n){if(t.length<=n)return t;const c=Math.max(0,n-200),o=t.slice(c,n).lastIndexOf(`
|
|
10
|
-
|
|
11
|
-
`),e=o>=0?c+o:n,a=t.slice(0,e).trimEnd(),s=Math.round(e/t.length*100);return`${a}
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
*[Truncated at ${e.toLocaleString()} chars \u2014 ${s}% of original content]*`}export{m as headTailTruncate,A as paragraphTruncate};
|
|
1
|
+
function e(e,t,n=.6){if(e.length<=t)return e;let r=Math.max(0,t-120),i=Math.floor(r*n),a=r-i,o=e.slice(0,i),s=o.lastIndexOf(`
|
|
2
|
+
`),c=s>0?o.slice(0,s):o,l=e.length-a,u=e.slice(l),d=u.indexOf(`
|
|
3
|
+
`),f=d>=0?u.slice(d+1):u,p=e.length-c.length-f.length,m=1,h=c.length,g=e.length-f.length;for(let t=h;t<g;t++)e.charCodeAt(t)===10&&m++;return`${c}\n\n[… ${m} lines / ${(p/1024).toFixed(1)}KB truncated — showing first ${c.split(`
|
|
4
|
+
`).length} + last ${f.split(`
|
|
5
|
+
`).length} lines]\n\n${f}`}function t(e,t){if(e.length<=t)return e;let n=Math.max(0,t-200),r=e.slice(n,t).lastIndexOf(`
|
|
6
|
+
|
|
7
|
+
`),i=r>=0?n+r:t,a=e.slice(0,i).trimEnd(),o=Math.round(i/e.length*100);return`${a}\n\n---\n*[Truncated at ${i.toLocaleString()} chars — ${o}% of original content]*`}function n(t,n){let r=n*4;return t.length<=r?t:e(t,r)}export{e as headTailTruncate,t as paragraphTruncate,n as truncateToTokenBudget};
|
|
8
|
+
//# sourceMappingURL=truncation.js.map
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region packages/tools/src/watch.d.ts
|
|
2
|
+
interface WatchEvent {
|
|
3
|
+
type: 'change' | 'rename';
|
|
4
|
+
path: string;
|
|
5
|
+
timestamp: string;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
interface WatchOptions {
|
|
8
|
+
/** Directory to watch */
|
|
9
|
+
path: string;
|
|
10
|
+
/** Glob patterns to exclude */
|
|
11
|
+
exclude?: string[];
|
|
12
|
+
/** Max events to buffer (default: 100) */
|
|
13
|
+
maxEvents?: number;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
interface WatchHandle {
|
|
16
|
+
id: string;
|
|
17
|
+
path: string;
|
|
18
|
+
events: WatchEvent[];
|
|
19
|
+
status: 'watching' | 'stopped';
|
|
20
|
+
stop: () => void;
|
|
21
|
+
getEvents: (since?: string) => WatchEvent[];
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
declare function watchStart(options: WatchOptions): WatchHandle;
|
|
24
|
+
declare function watchStop(id: string): boolean;
|
|
25
|
+
declare function watchList(): Array<{
|
|
26
|
+
id: string;
|
|
27
|
+
path: string;
|
|
28
|
+
status: string;
|
|
29
|
+
eventCount: number;
|
|
29
30
|
}>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { WatchEvent, WatchHandle, WatchOptions, watchList, watchStart, watchStop };
|
|
30
33
|
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{watch as
|
|
1
|
+
import{watch as e}from"node:fs";const t=new Map,n=[`node_modules`,`.git`,`dist`,`.turbo`,`.kb-data`,`cdk.out`];function r(r){if(t.size>=20)throw Error(`Watcher limit reached (20). Stop existing watchers first.`);let{path:i,maxEvents:a=100}=r,s=r.exclude??n,c=`watch-${Date.now()}`,l=[],u=e=>s.some(t=>o(e).includes(o(t))),d=e(i,{recursive:!0},(e,t)=>{if(t==null)return;let n=String(t);!n||u(n)||(l.push({type:e,path:o(n),timestamp:new Date().toISOString()}),l.length>a&&l.shift())});d.on(`error`,()=>{f.status=`stopped`,t.delete(c);try{d.close()}catch{}});let f={id:c,path:i,events:l,status:`watching`,stop:()=>{d.close(),f.status=`stopped`,t.delete(c)},getEvents:e=>e?l.filter(t=>t.timestamp>e):l};return t.set(c,{watcher:d,handle:f}),f}function i(e){let n=t.get(e);return n?(n.handle.stop(),!0):!1}function a(){return[...t.values()].map(e=>({id:e.handle.id,path:e.handle.path,status:e.handle.status,eventCount:e.handle.events.length}))}function o(e){return e.replace(/\\/g,`/`)}export{a as watchList,r as watchStart,i as watchStop};
|
|
2
|
+
//# sourceMappingURL=watch.js.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region packages/tools/src/web-fetch.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_web_fetch — Fetch a web page and convert to LLM-friendly format.
|
|
3
4
|
*
|
|
@@ -5,41 +6,43 @@
|
|
|
5
6
|
* extracted links, or heading outline. Strips scripts, styles,
|
|
6
7
|
* and non-content elements for compact, token-efficient output.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
type WebFetchMode = 'markdown' | 'raw' | 'links' | 'outline';
|
|
10
|
+
interface WebFetchOptions {
|
|
11
|
+
/** URL to fetch */
|
|
12
|
+
url: string;
|
|
13
|
+
/** Output mode */
|
|
14
|
+
mode?: WebFetchMode;
|
|
15
|
+
/** CSS selector to extract specific element (default: auto-detect main content) */
|
|
16
|
+
selector?: string;
|
|
17
|
+
/** Max characters in output — smart truncation at paragraph boundaries */
|
|
18
|
+
maxLength?: number;
|
|
19
|
+
/** Include page metadata header (title, description, URL) */
|
|
20
|
+
includeMetadata?: boolean;
|
|
21
|
+
/** Append extracted links list at the end */
|
|
22
|
+
includeLinks?: boolean;
|
|
23
|
+
/** Include image alt texts inline */
|
|
24
|
+
includeImages?: boolean;
|
|
25
|
+
/** Request timeout in milliseconds */
|
|
26
|
+
timeout?: number;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
interface WebFetchResult {
|
|
29
|
+
/** The converted content */
|
|
30
|
+
content: string;
|
|
31
|
+
/** Page title */
|
|
32
|
+
title: string;
|
|
33
|
+
/** Page description (from meta) */
|
|
34
|
+
description: string;
|
|
35
|
+
/** Final URL after redirects */
|
|
36
|
+
url: string;
|
|
37
|
+
/** Content length before truncation */
|
|
38
|
+
originalLength: number;
|
|
39
|
+
/** Whether content was truncated */
|
|
40
|
+
truncated: boolean;
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* Fetch a web page and convert to an LLM-friendly format.
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
+
declare function webFetch(options: WebFetchOptions): Promise<WebFetchResult>;
|
|
46
|
+
//#endregion
|
|
47
|
+
export { WebFetchMode, WebFetchOptions, WebFetchResult, webFetch };
|
|
45
48
|
//# sourceMappingURL=web-fetch.d.ts.map
|