@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 +1,2 @@
|
|
|
1
|
-
import{createHash as
|
|
1
|
+
import{createHash as e}from"node:crypto";function t(t,...n){return`${t}_${e(`sha256`).update(n.join(`|`)).digest(`hex`).slice(0,12)}`}async function n(e,n){let{action:r}=n;switch(r){case`find_nodes`:{let t=await e.findNodes({type:n.nodeType,namePattern:n.namePattern,sourcePath:n.sourcePath,limit:n.limit});return{action:r,nodes:t,summary:`Found ${t.length} node(s)${n.nodeType?` of type "${n.nodeType}"`:``}${n.namePattern?` matching "${n.namePattern}"`:``}`}}case`find_edges`:{let t=await e.findEdges({type:n.edgeType,fromId:n.fromId,toId:n.toId,limit:n.limit});return{action:r,edges:t,summary:`Found ${t.length} edge(s)${n.edgeType?` of type "${n.edgeType}"`:``}`}}case`neighbors`:{if(!n.nodeId)return{action:r,summary:`Error: nodeId is required for neighbors action`};let t=await e.getNeighbors(n.nodeId,{edgeType:n.edgeType,direction:n.direction,limit:n.limit});return{action:r,nodes:t.nodes,edges:t.edges,summary:`Found ${t.nodes.length} neighbor(s) and ${t.edges.length} edge(s) for node "${n.nodeId}"`}}case`traverse`:{if(!n.nodeId)return{action:r,summary:`Error: nodeId is required for traverse action`};let t=await e.traverse(n.nodeId,{edgeType:n.edgeType,maxDepth:n.maxDepth,direction:n.direction,limit:n.limit});return{action:r,nodes:t.nodes,edges:t.edges,summary:`Traversed ${t.nodes.length} node(s) and ${t.edges.length} edge(s) from "${n.nodeId}" (depth=${n.maxDepth??2})`}}case`stats`:{let t=await e.getStats();return{action:r,stats:t,summary:`Graph: ${t.nodeCount} nodes, ${t.edgeCount} edges. Types: ${Object.entries(t.nodeTypes).map(([e,t])=>`${e}(${t})`).join(`, `)||`none`}`}}case`add`:{let i=0,a=0;if(n.nodes&&n.nodes.length>0){let r=n.nodes.map(e=>({id:e.id??t(`node`,e.type,e.name),type:e.type,name:e.name,properties:e.properties??{},sourceRecordId:e.sourceRecordId,sourcePath:e.sourcePath,createdAt:new Date().toISOString()}));await e.upsertNodes(r),i=r.length}if(n.edges&&n.edges.length>0){let r=n.edges.map(e=>({id:e.id??t(`edge`,e.fromId,e.toId,e.type),fromId:e.fromId,toId:e.toId,type:e.type,weight:e.weight,properties:e.properties}));await e.upsertEdges(r),a=r.length}return{action:r,nodesAdded:i,edgesAdded:a,summary:`Added ${i} node(s) and ${a} edge(s) to the graph`}}case`delete`:if(n.nodeId)return await e.deleteNode(n.nodeId),{action:r,deleted:1,summary:`Deleted node "${n.nodeId}" and its edges`};if(n.sourcePath){let t=await e.deleteBySourcePath(n.sourcePath);return{action:r,deleted:t,summary:`Deleted ${t} node(s) from source "${n.sourcePath}"`}}return{action:r,summary:`Error: nodeId or sourcePath required for delete action`};case`clear`:{let t=await e.getStats();return await e.clear(),{action:r,deleted:t.nodeCount,summary:`Cleared graph: removed ${t.nodeCount} node(s) and ${t.edgeCount} edge(s)`}}default:return{action:r,summary:`Unknown action: ${r}`}}}async function r(e,t,n){let r=n?.hops??1,i=n?.maxPerHit??5,a=[];for(let o of t)try{let t=await e.findNodes({sourcePath:o.sourcePath}),s=[],c=[],l=new Set,u=new Set;for(let a of t.slice(0,i))if(!l.has(a.id)&&(l.add(a.id),s.push(a),r>0)){let t=await e.traverse(a.id,{maxDepth:r,edgeType:n?.edgeType,limit:i});for(let e of t.nodes)l.has(e.id)||(l.add(e.id),s.push(e));for(let e of t.edges)u.has(e.id)||(u.add(e.id),c.push(e))}a.push({recordId:o.recordId,score:o.score,sourcePath:o.sourcePath,graphContext:{nodes:s,edges:c}})}catch{a.push({recordId:o.recordId,score:o.score,sourcePath:o.sourcePath,graphContext:{nodes:[],edges:[]}})}return a}export{r as graphAugmentSearch,n as graphQuery};
|
|
2
|
+
//# sourceMappingURL=graph-query.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region packages/tools/src/guide.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Tool discovery — recommends MCP tools and workflows for a given goal.
|
|
4
|
+
*
|
|
5
|
+
* Uses keyword matching against predefined workflow templates.
|
|
6
|
+
* No embeddings required — pure string matching for instant results.
|
|
7
|
+
*/
|
|
8
|
+
interface GuideRecommendation {
|
|
9
|
+
tool: string;
|
|
10
|
+
reason: string;
|
|
11
|
+
order: number;
|
|
12
|
+
suggestedArgs?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
interface GuideResult {
|
|
15
|
+
workflow: string;
|
|
16
|
+
description: string;
|
|
17
|
+
tools: GuideRecommendation[];
|
|
18
|
+
alternativeWorkflows: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Match a goal description to the best workflow and return tool recommendations.
|
|
22
|
+
*/
|
|
23
|
+
declare function guide(goal: string, maxRecommendations?: number): GuideResult;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { GuideRecommendation, GuideResult, guide };
|
|
26
|
+
//# sourceMappingURL=guide.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=[{name:`onboard`,description:`First-time codebase exploration and understanding`,keywords:[`onboard`,`new project`,`understand`,`explore`,`first time`,`getting started`,`learn`,`overview`],tools:[{tool:`status`,reason:`Check index health and record count`,order:1},{tool:`onboard`,reason:`Run all analysis tools in one command`,order:2,suggestedArgs:{path:`.`}},{tool:`search`,reason:`Find specific topics of interest`,order:3},{tool:`graph`,reason:`Explore module relationships`,order:4,suggestedArgs:{action:`stats`}}]},{name:`audit`,description:`Assess project health, quality, and structure`,keywords:[`audit`,`health`,`quality`,`assess`,`review project`,`check quality`,`code quality`,`tech debt`],tools:[{tool:`status`,reason:`Check index freshness`,order:1},{tool:`audit`,reason:`Unified audit report with score and recommendations`,order:2,suggestedArgs:{detail:`summary`}},{tool:`check`,reason:`Typecheck + lint validation`,order:3},{tool:`health`,reason:`Detailed health checks on package.json, tsconfig, etc.`,order:4}]},{name:`bugfix`,description:`Diagnose and fix a bug or failing test`,keywords:[`bug`,`fix`,`debug`,`error`,`failing`,`broken`,`crash`,`wrong`,`issue`,`problem`,`not working`],tools:[{tool:`parse_output`,reason:`Parse error output from build tools (tsc, vitest, biome)`,order:1},{tool:`symbol`,reason:`Find definition and all references of the failing symbol`,order:2},{tool:`trace`,reason:`Trace call chain backward from the failure point`,order:3,suggestedArgs:{direction:`backward`}},{tool:`search`,reason:`Search for related patterns or similar fixes`,order:4},{tool:`test_run`,reason:`Re-run tests after fix`,order:5}]},{name:`implement`,description:`Add a new feature or implement a change`,keywords:[`implement`,`add feature`,`new feature`,`build`,`create`,`add`,`develop`,`write code`],tools:[{tool:`scope_map`,reason:`Generate a reading plan for affected files`,order:1},{tool:`search`,reason:`Find related patterns and prior art`,order:2},{tool:`find`,reason:`Find usage examples of similar patterns`,order:3,suggestedArgs:{mode:`examples`}},{tool:`check`,reason:`Validate after implementation`,order:4},{tool:`test_run`,reason:`Run tests to verify`,order:5},{tool:`blast_radius`,reason:`Check impact of changes`,order:6}]},{name:`refactor`,description:`Restructure or clean up existing code`,keywords:[`refactor`,`restructure`,`clean up`,`reorganize`,`rename`,`move`,`extract`,`DRY`,`dead code`],tools:[{tool:`dead_symbols`,reason:`Find unused exports to remove`,order:1},{tool:`symbol`,reason:`Find all references before renaming`,order:2},{tool:`blast_radius`,reason:`Assess impact before making changes`,order:3},{tool:`rename`,reason:`Safe cross-file rename`,order:4},{tool:`check`,reason:`Validate after refactoring`,order:5},{tool:`test_run`,reason:`Ensure no regressions`,order:6}]},{name:`search`,description:`Find specific code, patterns, or information`,keywords:[`find`,`search`,`where`,`locate`,`look for`,`grep`,`which file`,`how does`],tools:[{tool:`search`,reason:`Hybrid semantic + keyword search`,order:1},{tool:`find`,reason:`Federated search with glob and regex`,order:2},{tool:`symbol`,reason:`Resolve a specific symbol definition and references`,order:3},{tool:`graph`,reason:`Explore entity relationships`,order:4,suggestedArgs:{action:`neighbors`}}]},{name:`context`,description:`Compress or manage context for efficient LLM interaction`,keywords:[`context`,`compress`,`summarize`,`too long`,`token`,`budget`,`reduce`,`compact`],tools:[{tool:`file_summary`,reason:`Quick structural overview without reading full file`,order:1},{tool:`compact`,reason:`Compress file to relevant sections`,order:2,suggestedArgs:{segmentation:`paragraph`}},{tool:`digest`,reason:`Compress multiple sources into budgeted summary`,order:3},{tool:`stratum_card`,reason:`Generate reusable context cards`,order:4}]},{name:`memory`,description:`Manage persistent knowledge across sessions`,keywords:[`memory`,`remember`,`persist`,`save`,`recall`,`decision`,`convention`,`session`,`checkpoint`],tools:[{tool:`list`,reason:`See all stored knowledge entries`,order:1},{tool:`search`,reason:`Search curated knowledge`,order:2,suggestedArgs:{origin:`curated`}},{tool:`remember`,reason:`Store a new decision or pattern`,order:3},{tool:`checkpoint`,reason:`Save/restore session progress`,order:4},{tool:`stash`,reason:`Temporary key-value storage within session`,order:5}]},{name:`validate`,description:`Run checks, tests, and validation`,keywords:[`validate`,`check`,`test`,`lint`,`typecheck`,`verify`,`CI`,`pass`,`run tests`],tools:[{tool:`check`,reason:`Typecheck + lint in one call`,order:1,suggestedArgs:{detail:`errors`}},{tool:`test_run`,reason:`Run tests with structured output`,order:2},{tool:`health`,reason:`Project health assessment`,order:3}]},{name:`analyze`,description:`Deep analysis of codebase structure, dependencies, or patterns`,keywords:[`analyze`,`dependency`,`structure`,`pattern`,`architecture`,`diagram`,`entry point`,`import`],tools:[{tool:`analyze_structure`,reason:`Project structure overview`,order:1},{tool:`analyze_dependencies`,reason:`Dependency graph and analysis`,order:2},{tool:`analyze_patterns`,reason:`Detect code patterns and conventions`,order:3},{tool:`analyze_entry_points`,reason:`Find handlers, exports, and entry points`,order:4},{tool:`analyze_diagram`,reason:`Generate Mermaid diagrams`,order:5}]}];function t(t,n=5){let r=t.toLowerCase(),i=e.map(e=>{let t=0;for(let n of e.keywords)r.includes(n)&&(t+=n.includes(` `)?2:1);return{workflow:e,score:t}}).filter(e=>e.score>0).sort((e,t)=>t.score-e.score),a=e.find(e=>e.name===`search`)??e[0],o=i[0]?.workflow??a,s=i.slice(1,4).map(e=>e.workflow.name).filter(e=>e!==o.name);return{workflow:o.name,description:o.description,tools:o.tools.slice(0,n),alternativeWorkflows:s}}export{t as guide};
|
|
2
|
+
//# sourceMappingURL=guide.js.map
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region packages/tools/src/health.d.ts
|
|
2
|
+
interface HealthCheck {
|
|
3
|
+
name: string;
|
|
4
|
+
status: 'pass' | 'warn' | 'fail';
|
|
5
|
+
message: string;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
interface HealthResult {
|
|
8
|
+
path: string;
|
|
9
|
+
checks: HealthCheck[];
|
|
10
|
+
score: number;
|
|
11
|
+
summary: string;
|
|
11
12
|
}
|
|
12
13
|
/** Run project health checks on a directory. */
|
|
13
|
-
|
|
14
|
+
declare function health(rootPath?: string): HealthResult;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { HealthCheck, HealthResult, health };
|
|
14
17
|
//# sourceMappingURL=health.d.ts.map
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{extname as e,join as t,relative as n,resolve as r}from"node:path";import{existsSync as i,readFileSync as a,readdirSync as o,statSync as s}from"node:fs";function c(e){let n=r(e??process.cwd()),o=[],c=t(n,`package.json`);if(i(c)){o.push({name:`package.json`,status:`pass`,message:`Found`});try{let e=JSON.parse(a(c,`utf-8`));e.name?o.push({name:`package.name`,status:`pass`,message:e.name}):o.push({name:`package.name`,status:`warn`,message:`Missing package name`});let t=e.scripts??{};for(let e of[`build`,`test`,`lint`])t[e]?o.push({name:`script:${e}`,status:`pass`,message:t[e]}):o.push({name:`script:${e}`,status:`warn`,message:`No "${e}" script defined`});e.type===`module`?o.push({name:`esm`,status:`pass`,message:`ESM ("type": "module")`}):e.type===`commonjs`?o.push({name:`esm`,status:`pass`,message:`CJS ("type": "commonjs")`}):o.push({name:`esm`,status:`warn`,message:`No "type" field — defaults to CJS`}),e.engines?.node?o.push({name:`engines.node`,status:`pass`,message:e.engines.node}):o.push({name:`engines.node`,status:`warn`,message:`No Node.js engine constraint`})}catch{o.push({name:`package.json`,status:`fail`,message:`Failed to parse package.json`})}}else o.push({name:`package.json`,status:`fail`,message:`Missing — not a Node.js project`});let f=t(n,`tsconfig.json`);i(f)?o.push({name:`tsconfig.json`,status:`pass`,message:`Found`}):o.push({name:`tsconfig.json`,status:`warn`,message:`Missing`});let p=t(n,`.gitignore`);if(i(p)){let e=a(p,`utf-8`),t=e.includes(`node_modules`),n=e.includes(`dist`);t&&n?o.push({name:`.gitignore`,status:`pass`,message:`Includes node_modules and dist`}):o.push({name:`.gitignore`,status:`warn`,message:`Missing: ${t?``:`node_modules `}${n?``:`dist`}`.trim()})}else o.push({name:`.gitignore`,status:`warn`,message:`Missing`});let h=[`pnpm-lock.yaml`,`package-lock.json`,`yarn.lock`,`bun.lock`].find(e=>i(t(n,e)));h?o.push({name:`lockfile`,status:`pass`,message:h}):o.push({name:`lockfile`,status:`warn`,message:`No lock file found`});let g=t(n,`README.md`);if(i(g)){let e=a(g,`utf-8`).length;o.push({name:`README.md`,status:e>100?`pass`:`warn`,message:e>100?`Found (${e} chars)`:`Found but very short`})}else o.push({name:`README.md`,status:`warn`,message:`Missing`});if(i(t(n,`LICENSE`))||i(t(n,`LICENSE.md`))?o.push({name:`LICENSE`,status:`pass`,message:`Found`}):o.push({name:`LICENSE`,status:`warn`,message:`Missing`}),i(f))try{let e=a(f,`utf-8`).replace(/\/\/.*$/gm,``).replace(/\/\*[\s\S]*?\*\//g,``);JSON.parse(e).compilerOptions?.strict===!0?o.push({name:`typescript.strict`,status:`pass`,message:`strict: true`}):o.push({name:`typescript.strict`,status:`warn`,message:`strict mode not enabled in tsconfig.json`})}catch{}if(i(c))try{let e=JSON.parse(a(c,`utf-8`));e.exports?o.push({name:`package.exports`,status:`pass`,message:`Has exports field`}):e.workspaces||i(t(n,`pnpm-workspace.yaml`))||o.push({name:`package.exports`,status:`warn`,message:`Missing — consider adding exports field for explicit public API`});let r=l(n,e);r.length>0&&u(n,r,o)}catch{}let _=t(n,`dist`),v=t(n,`src`);if(i(_)&&i(v))try{let e=s(_).mtimeMs;d(v)>e?o.push({name:`build.freshness`,status:`warn`,message:`Source files are newer than dist/ — rebuild may be needed`}):o.push({name:`build.freshness`,status:`pass`,message:`Build output is fresh`})}catch{}if(i(v)){let e=m(v);if(e.length===0)o.push({name:`circular_deps`,status:`pass`,message:`No circular imports detected`});else{let t=e.slice(0,3).map(e=>e.join(` → `));o.push({name:`circular_deps`,status:`warn`,message:`${e.length} circular import(s): ${t.join(`; `)}${e.length>3?` (+${e.length-3} more)`:``}`})}}let y=o.length,b=o.filter(e=>e.status===`pass`).length,x=o.filter(e=>e.status===`fail`).length;return{path:n,checks:o,score:y>0?Math.round(b/y*100):0,summary:x>0?`${x} critical issue(s), ${y-b-x} warning(s)`:y-b>0?`${y-b} warning(s)`:`All checks passed`}}function l(e,n){let r=[];Array.isArray(n.workspaces)?r.push(...n.workspaces):n.workspaces&&typeof n.workspaces==`object`&&Array.isArray(n.workspaces.packages)&&r.push(...n.workspaces.packages);let s=t(e,`pnpm-workspace.yaml`);if(i(s)){let e=a(s,`utf-8`);for(let t of e.split(`
|
|
2
|
+
`)){let e=t.match(/^\s*-\s+['"]?([^'"#\s]+)['"]?\s*$/);e&&r.push(e[1])}}let c=[];for(let n of r)if(n.endsWith(`/*`)||n.endsWith(`/**`)){let r=t(e,n.replace(/\/\*+$/,``));if(i(r))try{for(let e of o(r,{withFileTypes:!0}))e.isDirectory()&&i(t(r,e.name,`package.json`))&&c.push(t(r,e.name))}catch{}}else{let r=t(e,n);i(t(r,`package.json`))&&c.push(r)}return c}function u(e,n,r){let i=0,o=0,s=new Map;for(let e of n)try{let n=JSON.parse(a(t(e,`package.json`),`utf-8`));n.scripts?.test||i++,!n.exports&&!n.main&&o++;let r={...n.dependencies,...n.devDependencies};for(let e of Object.values(r))if(typeof e==`string`&&e.startsWith(`workspace:`)){let t=e.startsWith(`workspace:*`)?`workspace:*`:e.startsWith(`workspace:^`)?`workspace:^`:`workspace:~`;s.set(t,(s.get(t)??0)+1)}}catch{}if(i>0?r.push({name:`workspace.test-scripts`,status:`warn`,message:`${i}/${n.length} workspace packages missing test script`}):r.push({name:`workspace.test-scripts`,status:`pass`,message:`All ${n.length} workspace packages have test scripts`}),o>0?r.push({name:`workspace.exports`,status:`warn`,message:`${o}/${n.length} packages missing exports field`}):n.length>0&&r.push({name:`workspace.exports`,status:`pass`,message:`All ${n.length} packages have exports or main field`}),s.size>1){let e=[...s.entries()].map(([e,t])=>`${e} (${t})`).join(`, `);r.push({name:`workspace.protocol`,status:`warn`,message:`Mixed workspace protocols: ${e} — consider standardizing`})}else if(s.size===1){let[e]=s.keys();r.push({name:`workspace.protocol`,status:`pass`,message:`Consistent workspace protocol: ${e}`})}}function d(e){let n=0;try{for(let r of o(e,{withFileTypes:!0})){if(r.name.startsWith(`.`)||r.name===`node_modules`)continue;let i=t(e,r.name);n=r.isDirectory()?Math.max(n,d(i)):Math.max(n,s(i).mtimeMs)}}catch{}return n}const f=/(?:import|export)\s+.*?from\s+['"](\.[^'"]+)['"]/g,p=new Set([`.ts`,`.tsx`,`.mts`]);function m(e){let t=new Map;h(e,e,t);let n=[],r=new Set,i=new Set;function a(e,o){if(i.has(e)){let t=o.indexOf(e);t>=0&&n.push(o.slice(t).concat(e));return}if(!r.has(e)){r.add(e),i.add(e),o.push(e);for(let n of t.get(e)??[])a(n,o);o.pop(),i.delete(e)}}for(let e of t.keys())a(e,[]);return n}function h(r,i,c){let l;try{l=o(r)}catch{return}for(let o of l){if(o.startsWith(`.`)||o===`node_modules`||o===`__tests__`)continue;let l=t(r,o);try{if(s(l).isDirectory())h(l,i,c);else if(p.has(e(o))){let e=n(i,l).replace(/\\/g,`/`),t=a(l,`utf-8`),o=[];for(let e of t.matchAll(f)){let t=e[1],n=g(r,t,i);n&&o.push(n)}c.set(e,o)}}catch{}}}function g(e,t,i){let a=r(e,t);for(let e of[`.ts`,`.tsx`,`.mts`,`.js`,`.mjs`,``])return n(i,e?a.replace(/\.[^.]+$/,``)+e:a).replace(/\\/g,`/`).replace(/\.js$/,`.ts`).replace(/\.mjs$/,`.mts`);return null}export{c as health};
|
|
3
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
+
//#region packages/tools/src/http-request.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_http — Make HTTP requests for API testing and debugging.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD';
|
|
6
|
+
interface HttpRequestOptions {
|
|
7
|
+
url: string;
|
|
8
|
+
method?: HttpMethod;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
body?: string;
|
|
11
|
+
timeout?: number;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
interface HttpRequestResult {
|
|
14
|
+
status: number;
|
|
15
|
+
statusText: string;
|
|
16
|
+
headers: Record<string, string>;
|
|
17
|
+
body: string;
|
|
18
|
+
durationMs: number;
|
|
19
|
+
contentType: string;
|
|
20
|
+
sizeBytes: number;
|
|
21
|
+
truncated: boolean;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
+
declare function httpRequest(options: HttpRequestOptions): Promise<HttpRequestResult>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { HttpMethod, HttpRequestOptions, HttpRequestResult, httpRequest };
|
|
23
26
|
//# sourceMappingURL=http-request.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{headTailTruncate as
|
|
1
|
+
import{headTailTruncate as e}from"./truncation.js";const t=5e4;async function n(n){let{url:r,method:i=`GET`,headers:a={},body:o,timeout:s=15e3}=n,c=new URL(r);if(c.protocol!==`http:`&&c.protocol!==`https:`)throw Error(`Unsupported protocol: ${c.protocol} — only http/https allowed`);let l=c.hostname;if(l===`169.254.169.254`||l===`metadata.google.internal`||l.startsWith(`fd`)||/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/.test(l)||l===`0.0.0.0`||l===`[::]`)throw Error(`Blocked request to private/metadata address: ${l}`);let u=new AbortController,d=setTimeout(()=>u.abort(),s),f=Date.now(),p;try{p=await fetch(r,{method:i,headers:{"User-Agent":`kb-http/1.0`,...a},body:i!==`GET`&&i!==`HEAD`?o:void 0,signal:u.signal,redirect:`follow`})}finally{clearTimeout(d)}let m=Date.now()-f,h=await p.text(),g=p.headers.get(`content-type`)??``,_=h;if(g.includes(`json`))try{_=JSON.stringify(JSON.parse(h),null,2)}catch{}let v=!1;_.length>t&&(_=e(_,t),v=!0);let y={};return p.headers.forEach((e,t)=>{y[t]=e}),{status:p.status,statusText:p.statusText,headers:y,body:_,durationMs:m,contentType:g,sizeBytes:h.length,truncated:v}}export{n as httpRequest};
|
|
2
|
+
//# sourceMappingURL=http-request.js.map
|
|
@@ -1,49 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
1
|
+
import { KBError, KBErrorCode, KBNextHint, KBResponse, KBResponseMeta, errorResponse, okResponse } from "./response-envelope.js";
|
|
2
|
+
import { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit } from "./audit.js";
|
|
3
|
+
import { BatchOperation, BatchOptions, BatchResult, batch } from "./batch.js";
|
|
4
|
+
import { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog } from "./changelog.js";
|
|
5
|
+
import { ParsedError, ParsedGitStatus, ParsedOutput, ParsedTestResult, ParsedTestSummary, parseBiome, parseGitStatus, parseOutput, parseTsc, parseVitest } from "./parse-output.js";
|
|
6
|
+
import { CheckOptions, CheckResult, CheckSummaryResult, check, summarizeCheckResult } from "./check.js";
|
|
7
|
+
import { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave } from "./checkpoint.js";
|
|
8
|
+
import { CodemodChange, CodemodOptions, CodemodResult, CodemodRule, codemod } from "./codemod.js";
|
|
9
|
+
import { FileCache, FileCacheEntry, FileCacheStats } from "./file-cache.js";
|
|
10
|
+
import { CompactOptions, CompactResult, compact } from "./compact.js";
|
|
11
|
+
import { TransformOptions, TransformResult, dataTransform } from "./data-transform.js";
|
|
12
|
+
import { DeadSymbol, DeadSymbolOptions, DeadSymbolResult, findDeadSymbols } from "./dead-symbols.js";
|
|
13
|
+
import { DelegateOptions, DelegateResult, delegate, delegateListModels } from "./delegate.js";
|
|
14
|
+
import { DiffChange, DiffFile, DiffHunk, DiffParseOptions, diffParse } from "./diff-parse.js";
|
|
15
|
+
import { DigestFieldEntry, DigestOptions, DigestResult, DigestSource, digest } from "./digest.js";
|
|
16
|
+
import { EncodeOperation, EncodeOptions, EncodeResult, encode } from "./encode.js";
|
|
17
|
+
import { EnvInfoOptions, EnvInfoResult, envInfo } from "./env-info.js";
|
|
18
|
+
import { EvalOptions, EvalResult, evaluate } from "./eval.js";
|
|
19
|
+
import { EvidenceEntry, EvidenceMapAction, EvidenceMapResult, EvidenceMapState, EvidenceStatus, ForgeTier, GateDecision, GateResult, UnknownType, evidenceMap } from "./evidence-map.js";
|
|
20
|
+
import { FileSummaryOptions, FileSummaryResult, fileSummary } from "./file-summary.js";
|
|
21
|
+
import { Example, FindExamplesOptions, FindExamplesResult, findExamples } from "./find-examples.js";
|
|
22
|
+
import { FindOptions, FindResult, FindResults, find } from "./find.js";
|
|
23
|
+
import { ClassifyTrigger, ForgeClassifyCeremony, ForgeClassifyOptions, ForgeClassifyResult, TypedUnknownSeed, forgeClassify } from "./forge-classify.js";
|
|
24
|
+
import { ScopeMapEntry, ScopeMapOptions, ScopeMapResult, scopeMap } from "./scope-map.js";
|
|
25
|
+
import { ConstraintRef, ForgeGroundOptions, ForgeGroundResult, forgeGround } from "./forge-ground.js";
|
|
26
|
+
import { GitContextOptions, GitContextResult, gitContext } from "./git-context.js";
|
|
27
|
+
import { GraphAugmentOptions, GraphAugmentedResult, GraphQueryOptions, GraphQueryResult, graphAugmentSearch, graphQuery } from "./graph-query.js";
|
|
28
|
+
import { GuideRecommendation, GuideResult, guide } from "./guide.js";
|
|
29
|
+
import { HealthCheck, HealthResult, health } from "./health.js";
|
|
30
|
+
import { HttpMethod, HttpRequestOptions, HttpRequestResult, httpRequest } from "./http-request.js";
|
|
31
|
+
import { LaneDiffEntry, LaneDiffResult, LaneMergeResult, LaneMeta, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus } from "./lane.js";
|
|
32
|
+
import { FileMetrics, MeasureOptions, MeasureResult, analyzeFile, measure } from "./measure.js";
|
|
33
|
+
import { OnboardMode, OnboardOptions, OnboardResult, OnboardStepResult, onboard } from "./onboard.js";
|
|
34
|
+
import { resolvePath } from "./path-resolver.js";
|
|
35
|
+
import { ManagedProcess, processList, processLogs, processStart, processStatus, processStop } from "./process-manager.js";
|
|
36
|
+
import { QueueItem, QueueState, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush } from "./queue.js";
|
|
37
|
+
import { RegexTestOptions, RegexTestResult, regexTest } from "./regex-test.js";
|
|
38
|
+
import { RenameChange, RenameOptions, RenameResult, rename } from "./rename.js";
|
|
39
|
+
import { ReplayEntry, ReplayOptions, replayAppend, replayCapture, replayClear, replayList, replayTrim } from "./replay.js";
|
|
40
|
+
import { SchemaValidateOptions, SchemaValidateResult, ValidationError, schemaValidate } from "./schema-validate.js";
|
|
41
|
+
import { Snippet, SnippetAction, SnippetOptions, SnippetResult, snippet } from "./snippet.js";
|
|
42
|
+
import { StashEntry, stashClear, stashDelete, stashGet, stashList, stashSet } from "./stash.js";
|
|
43
|
+
import { StratumCard, StratumCardOptions, StratumCardResult, stratumCard } from "./stratum-card.js";
|
|
44
|
+
import { SymbolInfo, SymbolOptions, symbol } from "./symbol.js";
|
|
45
|
+
import { TestRunOptions, TestRunResult, classifyExitCode, testRun } from "./test-run.js";
|
|
46
|
+
import { cosineSimilarity, estimateTokens, segment } from "./text-utils.js";
|
|
47
|
+
import { TimeOptions, TimeResult, timeUtils } from "./time-utils.js";
|
|
48
|
+
import { TraceNode, TraceOptions, TraceResult, trace } from "./trace.js";
|
|
49
|
+
import { headTailTruncate, paragraphTruncate, truncateToTokenBudget } from "./truncation.js";
|
|
50
|
+
import { WatchEvent, WatchHandle, WatchOptions, watchList, watchStart, watchStop } from "./watch.js";
|
|
51
|
+
import { WebFetchMode, WebFetchOptions, WebFetchResult, webFetch } from "./web-fetch.js";
|
|
52
|
+
import { WebSearchOptions, WebSearchResult, WebSearchResultItem, parseSearchResults, webSearch } from "./web-search.js";
|
|
53
|
+
import { Workset, addToWorkset, deleteWorkset, getWorkset, listWorksets, removeFromWorkset, saveWorkset } from "./workset.js";
|
|
54
|
+
export { type AuditCheck, type AuditData, type AuditOptions, type AuditRecommendation, type BatchOperation, type BatchOptions, type BatchResult, type ChangelogEntry, type ChangelogFormat, type ChangelogOptions, type ChangelogResult, type CheckOptions, type CheckResult, type CheckSummaryResult, type Checkpoint, type ClassifyTrigger, type CodemodChange, type CodemodOptions, type CodemodResult, type CodemodRule, type CompactOptions, type CompactResult, type ConstraintRef, type DeadSymbol, type DeadSymbolOptions, type DeadSymbolResult, type DelegateOptions, type DelegateResult, type DiffChange, type DiffFile, type DiffHunk, type DiffParseOptions, type DigestFieldEntry, type DigestOptions, type DigestResult, type DigestSource, type EncodeOperation, type EncodeOptions, type EncodeResult, type EnvInfoOptions, type EnvInfoResult, type EvalOptions, type EvalResult, type EvidenceEntry, type EvidenceMapAction, type EvidenceMapResult, type EvidenceMapState, type EvidenceStatus, type Example, FileCache, type FileCacheEntry, type FileCacheStats, type FileMetrics, type FileSummaryOptions, type FileSummaryResult, type FindExamplesOptions, type FindExamplesResult, type FindOptions, type FindResult, type FindResults, type ForgeClassifyCeremony, type ForgeClassifyOptions, type ForgeClassifyResult, type ForgeGroundOptions, type ForgeGroundResult, type ForgeTier, type GateDecision, type GateResult, type GitContextOptions, type GitContextResult, type GraphAugmentOptions, type GraphAugmentedResult, type GraphQueryOptions, type GraphQueryResult, type GuideRecommendation, type GuideResult, type HealthCheck, type HealthResult, type HttpMethod, type HttpRequestOptions, type HttpRequestResult, type KBError, type KBErrorCode, type KBNextHint, type KBResponse, type KBResponseMeta, type LaneDiffEntry, type LaneDiffResult, type LaneMergeResult, type LaneMeta, type ManagedProcess, type MeasureOptions, type MeasureResult, type OnboardMode, type OnboardOptions, type OnboardResult, type OnboardStepResult, type ParsedError, type ParsedGitStatus, type ParsedOutput, type ParsedTestResult, type ParsedTestSummary, type QueueItem, type QueueState, type RegexTestOptions, type RegexTestResult, type RenameChange, type RenameOptions, type RenameResult, type ReplayEntry, type ReplayOptions, type SchemaValidateOptions, type SchemaValidateResult, type ScopeMapEntry, type ScopeMapOptions, type ScopeMapResult, type Snippet, type SnippetAction, type SnippetOptions, type SnippetResult, type StashEntry, type StratumCard, type StratumCardOptions, type StratumCardResult, type SymbolInfo, type SymbolOptions, type TestRunOptions, type TestRunResult, type TimeOptions, type TimeResult, type TraceNode, type TraceOptions, type TraceResult, type TransformOptions, type TransformResult, type TypedUnknownSeed, type UnknownType, type ValidationError, type WatchEvent, type WatchHandle, type WatchOptions, type WebFetchMode, type WebFetchOptions, type WebFetchResult, type WebSearchOptions, type WebSearchResult, type WebSearchResultItem, type Workset, addToWorkset, analyzeFile, audit, batch, changelog, check, checkpointLatest, checkpointList, checkpointLoad, checkpointSave, classifyExitCode, codemod, compact, cosineSimilarity, dataTransform, delegate, delegateListModels, deleteWorkset, diffParse, digest, encode, envInfo, errorResponse, estimateTokens, evaluate, evidenceMap, fileSummary, find, findDeadSymbols, findExamples, forgeClassify, forgeGround, formatChangelog, getWorkset, gitContext, graphAugmentSearch, graphQuery, guide, headTailTruncate, health, httpRequest, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus, listWorksets, measure, okResponse, onboard, paragraphTruncate, parseBiome, parseGitStatus, parseOutput, parseSearchResults, parseTsc, parseVitest, processList, processLogs, processStart, processStatus, processStop, queueClear, queueCreate, queueDelete, queueDone, queueFail, queueGet, queueList, queueNext, queuePush, regexTest, removeFromWorkset, rename, replayAppend, replayCapture, replayClear, replayList, replayTrim, resolvePath, saveWorkset, schemaValidate, scopeMap, segment, snippet, stashClear, stashDelete, stashGet, stashList, stashSet, stratumCard, summarizeCheckResult, symbol, testRun, timeUtils, trace, truncateToTokenBudget, watchList, watchStart, watchStop, webFetch, webSearch };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{parseBiome as e,parseGitStatus as t,parseOutput as n,parseTsc as r,parseVitest as i}from"./parse-output.js";import{check as a,summarizeCheckResult as o}from"./check.js";import{findDeadSymbols as s}from"./dead-symbols.js";import{health as c}from"./health.js";import{resolvePath as l}from"./path-resolver.js";import{cosineSimilarity as u,estimateTokens as d,segment as f}from"./text-utils.js";import{errorResponse as p,okResponse as m}from"./response-envelope.js";import{audit as h}from"./audit.js";import{batch as g}from"./batch.js";import{changelog as _,formatChangelog as v}from"./changelog.js";import{checkpointLatest as y,checkpointList as b,checkpointLoad as x,checkpointSave as S}from"./checkpoint.js";import{codemod as C}from"./codemod.js";import{compact as w}from"./compact.js";import{dataTransform as T}from"./data-transform.js";import{delegate as E,delegateListModels as D}from"./delegate.js";import{diffParse as O}from"./diff-parse.js";import{digest as k}from"./digest.js";import{encode as A}from"./encode.js";import{envInfo as j}from"./env-info.js";import{evaluate as M}from"./eval.js";import{evidenceMap as N}from"./evidence-map.js";import{FileCache as P}from"./file-cache.js";import{fileSummary as F}from"./file-summary.js";import{findExamples as I}from"./find-examples.js";import{find as L}from"./find.js";import{forgeClassify as R}from"./forge-classify.js";import{scopeMap as z}from"./scope-map.js";import{forgeGround as B}from"./forge-ground.js";import{gitContext as V}from"./git-context.js";import{graphAugmentSearch as H,graphQuery as U}from"./graph-query.js";import{guide as W}from"./guide.js";import{headTailTruncate as G,paragraphTruncate as K,truncateToTokenBudget as q}from"./truncation.js";import{httpRequest as J}from"./http-request.js";import{laneCreate as Y,laneDiff as X,laneDiscard as Z,laneList as Q,laneMerge as $,laneStatus as ee}from"./lane.js";import{analyzeFile as te,measure as ne}from"./measure.js";import{onboard as re}from"./onboard.js";import{processList as ie,processLogs as ae,processStart as oe,processStatus as se,processStop as ce}from"./process-manager.js";import{queueClear as le,queueCreate as ue,queueDelete as de,queueDone as fe,queueFail as pe,queueGet as me,queueList as he,queueNext as ge,queuePush as _e}from"./queue.js";import{regexTest as ve}from"./regex-test.js";import{rename as ye}from"./rename.js";import{replayAppend as be,replayCapture as xe,replayClear as Se,replayList as Ce,replayTrim as we}from"./replay.js";import{schemaValidate as Te}from"./schema-validate.js";import{snippet as Ee}from"./snippet.js";import{stashClear as De,stashDelete as Oe,stashGet as ke,stashList as Ae,stashSet as je}from"./stash.js";import{stratumCard as Me}from"./stratum-card.js";import{symbol as Ne}from"./symbol.js";import{classifyExitCode as Pe,testRun as Fe}from"./test-run.js";import{timeUtils as Ie}from"./time-utils.js";import{trace as Le}from"./trace.js";import{watchList as Re,watchStart as ze,watchStop as Be}from"./watch.js";import{webFetch as Ve}from"./web-fetch.js";import{parseSearchResults as He,webSearch as Ue}from"./web-search.js";import{addToWorkset as We,deleteWorkset as Ge,getWorkset as Ke,listWorksets as qe,removeFromWorkset as Je,saveWorkset as Ye}from"./workset.js";export{P as FileCache,We as addToWorkset,te as analyzeFile,h as audit,g as batch,_ as changelog,a as check,y as checkpointLatest,b as checkpointList,x as checkpointLoad,S as checkpointSave,Pe as classifyExitCode,C as codemod,w as compact,u as cosineSimilarity,T as dataTransform,E as delegate,D as delegateListModels,Ge as deleteWorkset,O as diffParse,k as digest,A as encode,j as envInfo,p as errorResponse,d as estimateTokens,M as evaluate,N as evidenceMap,F as fileSummary,L as find,s as findDeadSymbols,I as findExamples,R as forgeClassify,B as forgeGround,v as formatChangelog,Ke as getWorkset,V as gitContext,H as graphAugmentSearch,U as graphQuery,W as guide,G as headTailTruncate,c as health,J as httpRequest,Y as laneCreate,X as laneDiff,Z as laneDiscard,Q as laneList,$ as laneMerge,ee as laneStatus,qe as listWorksets,ne as measure,m as okResponse,re as onboard,K as paragraphTruncate,e as parseBiome,t as parseGitStatus,n as parseOutput,He as parseSearchResults,r as parseTsc,i as parseVitest,ie as processList,ae as processLogs,oe as processStart,se as processStatus,ce as processStop,le as queueClear,ue as queueCreate,de as queueDelete,fe as queueDone,pe as queueFail,me as queueGet,he as queueList,ge as queueNext,_e as queuePush,ve as regexTest,Je as removeFromWorkset,ye as rename,be as replayAppend,xe as replayCapture,Se as replayClear,Ce as replayList,we as replayTrim,l as resolvePath,Ye as saveWorkset,Te as schemaValidate,z as scopeMap,f as segment,Ee as snippet,De as stashClear,Oe as stashDelete,ke as stashGet,Ae as stashList,je as stashSet,Me as stratumCard,o as summarizeCheckResult,Ne as symbol,Fe as testRun,Ie as timeUtils,Le as trace,q as truncateToTokenBudget,Re as watchList,ze as watchStart,Be as watchStop,Ve as webFetch,Ue as webSearch};
|
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region packages/tools/src/lane.d.ts
|
|
2
|
+
interface LaneMeta {
|
|
3
|
+
name: string;
|
|
4
|
+
createdAt: string;
|
|
5
|
+
sourceFiles: string[];
|
|
6
|
+
rootPath: string;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
interface LaneDiffEntry {
|
|
9
|
+
file: string;
|
|
10
|
+
status: 'modified' | 'added' | 'deleted' | 'unchanged';
|
|
11
|
+
diff?: string;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
interface LaneDiffResult {
|
|
14
|
+
name: string;
|
|
15
|
+
entries: LaneDiffEntry[];
|
|
16
|
+
modified: number;
|
|
17
|
+
added: number;
|
|
18
|
+
deleted: number;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
interface LaneMergeResult {
|
|
21
|
+
name: string;
|
|
22
|
+
filesMerged: number;
|
|
23
|
+
files: string[];
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* Create an isolated lane by copying specified files into `.kb-state/lanes/<name>/`.
|
|
26
27
|
* Files are stored with their relative paths preserved.
|
|
27
28
|
*/
|
|
28
|
-
|
|
29
|
+
declare function laneCreate(name: string, files: string[], cwd?: string): LaneMeta;
|
|
29
30
|
/** List all active lanes. */
|
|
30
|
-
|
|
31
|
+
declare function laneList(cwd?: string): LaneMeta[];
|
|
31
32
|
/** Get the status of a lane — which files are modified, added, deleted. */
|
|
32
|
-
|
|
33
|
+
declare function laneStatus(name: string, cwd?: string): LaneDiffResult;
|
|
33
34
|
/** Generate a unified diff for modified files in a lane. */
|
|
34
|
-
|
|
35
|
+
declare function laneDiff(name: string, cwd?: string): LaneDiffResult;
|
|
35
36
|
/** Merge lane files back to the original locations. */
|
|
36
|
-
|
|
37
|
+
declare function laneMerge(name: string, cwd?: string): LaneMergeResult;
|
|
37
38
|
/** Discard a lane entirely. */
|
|
38
|
-
|
|
39
|
+
declare function laneDiscard(name: string, cwd?: string): boolean;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { LaneDiffEntry, LaneDiffResult, LaneMergeResult, LaneMeta, laneCreate, laneDiff, laneDiscard, laneList, laneMerge, laneStatus };
|
|
39
42
|
//# sourceMappingURL=lane.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
3
|
-
`).
|
|
4
|
-
`)
|
|
5
|
-
`),i=r.
|
|
6
|
-
`),
|
|
7
|
-
|
|
1
|
+
import{join as e,relative as t,resolve as n}from"node:path";import{cpSync as r,existsSync as i,mkdirSync as a,readFileSync as o,readdirSync as s,rmSync as c,statSync as l,writeFileSync as u}from"node:fs";const d=`.lane-meta.json`;function f(e){return n(e??process.cwd(),`.kb-state/lanes`)}function p(e,t){let r=f(t),i=n(r,e);if(!i.startsWith(n(r)))throw Error(`Invalid lane name: "${e}"`);return i}function m(t,n){let r=e(p(t,n),d);if(!i(r))throw Error(`Lane "${t}" does not exist`);try{return JSON.parse(o(r,`utf-8`))}catch{throw Error(`Lane "${t}" has corrupted metadata`)}}function h(o,s,c){let l=c??process.cwd(),f=p(o,c);if(i(f))throw Error(`Lane "${o}" already exists`);a(f,{recursive:!0});let m=[];for(let o of s){let s=n(l,o);if(!i(s))throw Error(`Source file does not exist: ${o}`);let c=t(l,s).replace(/\\/g,`/`),u=e(f,c);a(e(u,`..`),{recursive:!0}),r(s,u),m.push(c)}let h={name:o,createdAt:new Date().toISOString(),sourceFiles:m,rootPath:l};return u(e(f,d),`${JSON.stringify(h,null,2)}\n`,`utf-8`),h}function g(t){let n=f(t);if(!i(n))return[];let r=s(n),a=[];for(let t of r){let r=e(n,t,d);if(i(r))try{a.push(JSON.parse(o(r,`utf-8`)))}catch{}}return a}function _(t,r){let a=m(t,r),s=p(t,r),c=a.rootPath,l=[];for(let t of a.sourceFiles){let r=n(c,t),a=e(s,t);if(!i(a)){l.push({file:t,status:`deleted`});continue}if(!i(r)){l.push({file:t,status:`added`});continue}o(r,`utf-8`)===o(a,`utf-8`)?l.push({file:t,status:`unchanged`}):l.push({file:t,status:`modified`})}let u=x(s);for(let e of u)a.sourceFiles.includes(e)||l.push({file:e,status:`added`});return{name:t,entries:l,modified:l.filter(e=>e.status===`modified`).length,added:l.filter(e=>e.status===`added`).length,deleted:l.filter(e=>e.status===`deleted`).length}}function v(t,r){let a=m(t,r),s=p(t,r),c=a.rootPath,l=[],u=new Set(a.sourceFiles);for(let e of x(s))u.add(e);for(let t of u){let r=n(c,t),a=e(s,t),u=i(r),d=i(a);if(!d&&u){l.push({file:t,status:`deleted`});continue}if(d&&!u){let e=o(a,`utf-8`);l.push({file:t,status:`added`,diff:e.split(`
|
|
2
|
+
`).map(e=>`+${e}`).join(`
|
|
3
|
+
`)});continue}if(!d||!u)continue;let f=o(r,`utf-8`),p=o(a,`utf-8`);f===p?l.push({file:t,status:`unchanged`}):l.push({file:t,status:`modified`,diff:S(f,p)})}return{name:t,entries:l,modified:l.filter(e=>e.status===`modified`).length,added:l.filter(e=>e.status===`added`).length,deleted:l.filter(e=>e.status===`deleted`).length}}function y(t,o){let s=m(t,o),l=p(t,o),u=s.rootPath,d=[],f=new Set(s.sourceFiles);for(let e of x(l))f.add(e);for(let t of f){let o=e(l,t);if(!i(o))continue;let s=n(u,t);a(e(s,`..`),{recursive:!0}),r(o,s),d.push(t)}return c(l,{recursive:!0,force:!0}),{name:t,filesMerged:d.length,files:d}}function b(e,t){let n=p(e,t);return i(n)?(c(n,{recursive:!0,force:!0}),!0):!1}function x(n){let r=[];function a(i){for(let o of s(i)){if(o===d)continue;let s=e(i,o);l(s).isDirectory()?a(s):r.push(t(n,s).replace(/\\/g,`/`))}}return i(n)&&a(n),r.sort()}function S(e,t){let n=e.split(`
|
|
4
|
+
`),r=t.split(`
|
|
5
|
+
`),i=[],a=Math.max(n.length,r.length);for(let e=0;e<a;e++){let t=n[e],a=r[e];t===a?i.push(` ${t??``}`):(t!==void 0&&i.push(`-${t}`),a!==void 0&&i.push(`+${a}`))}return i.join(`
|
|
6
|
+
`)}export{h as laneCreate,v as laneDiff,b as laneDiscard,g as laneList,y as laneMerge,_ as laneStatus};
|
|
7
|
+
//# sourceMappingURL=lane.js.map
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
+
//#region packages/tools/src/measure.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_measure — Code complexity and size metrics.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
interface MeasureOptions {
|
|
6
|
+
path: string;
|
|
7
|
+
extensions?: string[];
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
interface FileMetrics {
|
|
10
|
+
path: string;
|
|
11
|
+
lines: {
|
|
12
|
+
total: number;
|
|
13
|
+
code: number;
|
|
14
|
+
blank: number;
|
|
15
|
+
comment: number;
|
|
16
|
+
};
|
|
17
|
+
complexity: number;
|
|
18
|
+
functions: number;
|
|
19
|
+
imports: number;
|
|
20
|
+
exports: number;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
totalFunctions: number;
|
|
22
|
+
interface MeasureResult {
|
|
23
|
+
files: FileMetrics[];
|
|
24
|
+
summary: {
|
|
25
|
+
totalFiles: number;
|
|
26
|
+
totalLines: number;
|
|
27
|
+
totalCodeLines: number;
|
|
28
|
+
avgComplexity: number;
|
|
29
|
+
maxComplexity: {
|
|
30
|
+
file: string;
|
|
31
|
+
value: number;
|
|
33
32
|
};
|
|
33
|
+
totalFunctions: number;
|
|
34
|
+
};
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
declare function measure(options: MeasureOptions): MeasureResult;
|
|
36
37
|
/** Exported for unit testing */
|
|
37
|
-
|
|
38
|
+
declare function analyzeFile(path: string, content: string): FileMetrics;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { FileMetrics, MeasureOptions, MeasureResult, analyzeFile, measure };
|
|
38
41
|
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)
|
|
1
|
+
import{extname as e,join as t,relative as n}from"node:path";import{readFileSync as r,readdirSync as i,statSync as a}from"node:fs";const o=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`cdk.out`,`.cache`]),s=[/\bif\s*\(/g,/\belse\s+if\b/g,/\bfor\s*\(/g,/\bwhile\s*\(/g,/\bcase\s+/g,/\bcatch\s*\(/g,/&&/g,/\|\|/g,/\?\?/g];function c(e){let{path:t,extensions:i=[`.ts`,`.tsx`,`.js`,`.jsx`]}=e,a=u(t,i).map(e=>{let t=r(e,`utf8`);return l(n(process.cwd(),e),t)});a.sort((e,t)=>t.complexity-e.complexity);let o=a.reduce((e,t)=>e+t.lines.total,0),s=a.reduce((e,t)=>e+t.lines.code,0),c=a.reduce((e,t)=>e+t.complexity,0),d=a.reduce((e,t)=>e+t.functions,0),f=a[0]??{path:``,complexity:0};return{files:a,summary:{totalFiles:a.length,totalLines:o,totalCodeLines:s,avgComplexity:a.length>0?Math.round(c/a.length*10)/10:0,maxComplexity:{file:f.path,value:f.complexity},totalFunctions:d}}}function l(e,t){let n=t.split(`
|
|
2
|
+
`),r=0,i=0,a=!1;for(let e of n){let t=e.trim();if(t===``){r++;continue}if(a){i++,t.includes(`*/`)&&(a=!1);continue}if(t.startsWith(`//`)){i++;continue}t.startsWith(`/*`)&&(i++,a=!t.includes(`*/`))}let o=1;for(let e of s){let n=t.match(e);n&&(o+=n.length)}let c=(t.match(/\bfunction\b/g)?.length??0)+(t.match(/=>\s*[{(]/g)?.length??0),l=t.match(/^\s*import\s/gm)?.length??0,u=t.match(/^\s*export\s/gm)?.length??0;return{path:e,lines:{total:n.length,code:n.length-r-i,blank:r,comment:i},complexity:o,functions:c,imports:l,exports:u}}function u(n,r){try{if(a(n).isFile())return[n]}catch{throw Error(`Path not found: ${n}`)}let s=[];function c(n){for(let l of i(n)){if(o.has(l))continue;let i=t(n,l);a(i).isDirectory()?c(i):r.includes(e(l).toLowerCase())&&s.push(i)}}return c(n),s.sort(),s}export{l as analyzeFile,c as measure};
|
|
3
|
+
//# sourceMappingURL=measure.js.map
|