@vpxa/kb 0.1.13 → 0.1.16
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 +65 -12
- package/package.json +14 -7
- package/packages/analyzers/dist/blast-radius-analyzer.d.ts +17 -21
- package/packages/analyzers/dist/blast-radius-analyzer.js +5 -12
- package/packages/analyzers/dist/dependency-analyzer.d.ts +31 -28
- package/packages/analyzers/dist/dependency-analyzer.js +6 -9
- package/packages/analyzers/dist/diagram-generator.d.ts +12 -9
- package/packages/analyzers/dist/diagram-generator.js +2 -4
- package/packages/analyzers/dist/entry-point-analyzer.d.ts +39 -36
- package/packages/analyzers/dist/entry-point-analyzer.js +4 -6
- package/packages/analyzers/dist/index.d.ts +12 -14
- package/packages/analyzers/dist/index.js +1 -1
- package/packages/analyzers/dist/knowledge-producer.d.ts +34 -26
- package/packages/analyzers/dist/knowledge-producer.js +17 -15
- package/packages/analyzers/dist/pattern-analyzer.d.ts +14 -11
- package/packages/analyzers/dist/pattern-analyzer.js +2 -5
- package/packages/analyzers/dist/regex-call-graph.d.ts +6 -13
- package/packages/analyzers/dist/regex-call-graph.js +1 -1
- package/packages/analyzers/dist/structure-analyzer.d.ts +13 -10
- package/packages/analyzers/dist/structure-analyzer.js +2 -4
- package/packages/analyzers/dist/symbol-analyzer.d.ts +13 -9
- package/packages/analyzers/dist/symbol-analyzer.js +9 -13
- package/packages/analyzers/dist/ts-call-graph.d.ts +16 -14
- package/packages/analyzers/dist/ts-call-graph.js +1 -1
- package/packages/analyzers/dist/types.d.ts +82 -80
- package/packages/analyzers/dist/types.js +1 -0
- package/packages/chunker/dist/call-graph-extractor.d.ts +15 -12
- package/packages/chunker/dist/call-graph-extractor.js +1 -1
- package/packages/chunker/dist/chunker-factory.d.ts +16 -4
- package/packages/chunker/dist/chunker-factory.js +1 -1
- package/packages/chunker/dist/chunker.interface.d.ts +8 -5
- package/packages/chunker/dist/chunker.interface.js +1 -0
- package/packages/chunker/dist/code-chunker.d.ts +16 -13
- package/packages/chunker/dist/code-chunker.js +11 -14
- package/packages/chunker/dist/extractors/call-extractor.d.ts +24 -0
- package/packages/chunker/dist/extractors/call-extractor.js +1 -0
- package/packages/chunker/dist/extractors/entry-point-detector.d.ts +14 -0
- package/packages/chunker/dist/extractors/entry-point-detector.js +1 -0
- package/packages/chunker/dist/extractors/import-extractor.d.ts +14 -0
- package/packages/chunker/dist/extractors/import-extractor.js +1 -0
- package/packages/chunker/dist/extractors/pattern-detector.d.ts +14 -0
- package/packages/chunker/dist/extractors/pattern-detector.js +1 -0
- package/packages/chunker/dist/extractors/scope-resolver.d.ts +26 -0
- package/packages/chunker/dist/extractors/scope-resolver.js +1 -0
- package/packages/chunker/dist/extractors/symbol-extractor.d.ts +14 -0
- package/packages/chunker/dist/extractors/symbol-extractor.js +1 -0
- package/packages/chunker/dist/extractors/types.d.ts +36 -0
- package/packages/chunker/dist/extractors/types.js +1 -0
- package/packages/chunker/dist/generic-chunker.d.ts +14 -11
- package/packages/chunker/dist/generic-chunker.js +5 -5
- package/packages/chunker/dist/index.d.ts +19 -8
- package/packages/chunker/dist/index.js +1 -1
- package/packages/chunker/dist/markdown-chunker.d.ts +16 -13
- package/packages/chunker/dist/markdown-chunker.js +3 -10
- package/packages/chunker/dist/wasm/languages.d.ts +18 -0
- package/packages/chunker/dist/wasm/languages.js +1 -0
- package/packages/chunker/dist/wasm/query-executor.d.ts +70 -0
- package/packages/chunker/dist/wasm/query-executor.js +1 -0
- package/packages/chunker/dist/wasm/runtime.d.ts +44 -0
- package/packages/chunker/dist/wasm/runtime.js +1 -0
- package/packages/chunker/dist/wasm/types.d.ts +84 -0
- package/packages/chunker/dist/wasm/types.js +1 -0
- package/packages/chunker/dist/wasm-chunker.d.ts +23 -0
- package/packages/chunker/dist/wasm-chunker.js +6 -0
- package/packages/chunker/src/queries/go/calls.scm +11 -0
- package/packages/chunker/src/queries/go/entry-points.scm +20 -0
- package/packages/chunker/src/queries/go/imports.scm +6 -0
- package/packages/chunker/src/queries/go/patterns.scm +25 -0
- package/packages/chunker/src/queries/go/symbols.scm +26 -0
- package/packages/chunker/src/queries/java/calls.scm +10 -0
- package/packages/chunker/src/queries/java/entry-points.scm +27 -0
- package/packages/chunker/src/queries/java/imports.scm +11 -0
- package/packages/chunker/src/queries/java/patterns.scm +27 -0
- package/packages/chunker/src/queries/java/symbols.scm +28 -0
- package/packages/chunker/src/queries/javascript/calls.scm +21 -0
- package/packages/chunker/src/queries/javascript/entry-points.scm +31 -0
- package/packages/chunker/src/queries/javascript/imports.scm +32 -0
- package/packages/chunker/src/queries/javascript/patterns.scm +28 -0
- package/packages/chunker/src/queries/javascript/symbols.scm +52 -0
- package/packages/chunker/src/queries/python/calls.scm +11 -0
- package/packages/chunker/src/queries/python/entry-points.scm +21 -0
- package/packages/chunker/src/queries/python/imports.scm +14 -0
- package/packages/chunker/src/queries/python/patterns.scm +25 -0
- package/packages/chunker/src/queries/python/symbols.scm +17 -0
- package/packages/chunker/src/queries/rust/calls.scm +20 -0
- package/packages/chunker/src/queries/rust/entry-points.scm +7 -0
- package/packages/chunker/src/queries/rust/imports.scm +26 -0
- package/packages/chunker/src/queries/rust/patterns.scm +18 -0
- package/packages/chunker/src/queries/rust/symbols.scm +73 -0
- package/packages/chunker/src/queries/typescript/calls.scm +21 -0
- package/packages/chunker/src/queries/typescript/entry-points.scm +48 -0
- package/packages/chunker/src/queries/typescript/imports.scm +35 -0
- package/packages/chunker/src/queries/typescript/patterns.scm +47 -0
- package/packages/chunker/src/queries/typescript/symbols.scm +79 -0
- package/packages/chunker/wasm/tree-sitter-go.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-java.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-javascript.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-python.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-rust.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter-typescript.wasm +0 -0
- package/packages/chunker/wasm/tree-sitter.wasm +0 -0
- package/packages/cli/dist/commands/analyze.d.ts +6 -3
- package/packages/cli/dist/commands/analyze.js +2 -3
- package/packages/cli/dist/commands/context-cmds.d.ts +6 -3
- package/packages/cli/dist/commands/context-cmds.js +1 -1
- package/packages/cli/dist/commands/environment.d.ts +6 -3
- package/packages/cli/dist/commands/environment.js +1 -2
- package/packages/cli/dist/commands/execution.d.ts +6 -3
- package/packages/cli/dist/commands/execution.js +1 -1
- package/packages/cli/dist/commands/graph.d.ts +6 -3
- package/packages/cli/dist/commands/graph.js +5 -6
- package/packages/cli/dist/commands/init/adapters.d.ts +28 -0
- package/packages/cli/dist/commands/init/adapters.js +1 -0
- package/packages/cli/dist/commands/init/config.d.ts +10 -0
- package/packages/cli/dist/commands/init/config.js +3 -0
- package/packages/cli/dist/commands/init/constants.d.ts +18 -0
- package/packages/cli/dist/commands/init/constants.js +1 -0
- package/packages/cli/dist/commands/init/curated.d.ts +7 -0
- package/packages/cli/dist/commands/init/curated.js +1 -0
- package/packages/cli/dist/commands/init/global.d.ts +34 -0
- package/packages/cli/dist/commands/init/global.js +5 -0
- package/packages/cli/dist/commands/init/index.d.ts +28 -0
- package/packages/cli/dist/commands/init/index.js +5 -0
- package/packages/cli/dist/commands/init/scaffold.d.ts +23 -0
- package/packages/cli/dist/commands/init/scaffold.js +1 -0
- package/packages/cli/dist/commands/init/templates.d.ts +9 -0
- package/packages/cli/dist/commands/init/templates.js +165 -0
- package/packages/cli/dist/commands/knowledge.d.ts +6 -3
- package/packages/cli/dist/commands/knowledge.js +1 -1
- package/packages/cli/dist/commands/search.d.ts +6 -3
- package/packages/cli/dist/commands/search.js +1 -8
- package/packages/cli/dist/commands/system.d.ts +6 -3
- package/packages/cli/dist/commands/system.js +4 -7
- package/packages/cli/dist/commands/workspace.d.ts +6 -3
- package/packages/cli/dist/commands/workspace.js +1 -2
- package/packages/cli/dist/context.d.ts +7 -5
- package/packages/cli/dist/context.js +1 -1
- package/packages/cli/dist/helpers.d.ts +51 -48
- package/packages/cli/dist/helpers.js +5 -5
- package/packages/cli/dist/index.d.ts +4 -2
- package/packages/cli/dist/index.js +2 -2
- package/packages/cli/dist/kb-init.d.ts +48 -51
- package/packages/cli/dist/kb-init.js +1 -1
- package/packages/cli/dist/types.d.ts +8 -6
- package/packages/cli/dist/types.js +1 -0
- package/packages/core/dist/constants.d.ts +58 -34
- package/packages/core/dist/constants.js +1 -1
- package/packages/core/dist/content-detector.d.ts +8 -8
- package/packages/core/dist/content-detector.js +1 -1
- package/packages/core/dist/errors.d.ts +15 -13
- package/packages/core/dist/errors.js +1 -1
- package/packages/core/dist/global-registry.d.ts +62 -0
- package/packages/core/dist/global-registry.js +1 -0
- package/packages/core/dist/index.d.ts +7 -6
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/logger.d.ts +19 -8
- package/packages/core/dist/logger.js +1 -1
- package/packages/core/dist/types.d.ts +107 -92
- package/packages/core/dist/types.js +1 -0
- package/packages/embeddings/dist/embedder.interface.d.ts +22 -20
- 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 -23
- package/packages/embeddings/dist/onnx-embedder.js +1 -1
- package/packages/enterprise-bridge/dist/cache.d.ts +28 -0
- package/packages/enterprise-bridge/dist/cache.js +1 -0
- package/packages/enterprise-bridge/dist/er-client.d.ts +37 -0
- package/packages/enterprise-bridge/dist/er-client.js +1 -0
- package/packages/enterprise-bridge/dist/evolution-collector.d.ts +62 -0
- package/packages/enterprise-bridge/dist/evolution-collector.js +1 -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 +45 -0
- package/packages/enterprise-bridge/dist/policy-store.js +1 -0
- package/packages/enterprise-bridge/dist/push-adapter.d.ts +23 -0
- package/packages/enterprise-bridge/dist/push-adapter.js +1 -0
- package/packages/enterprise-bridge/dist/result-merger.d.ts +14 -0
- package/packages/enterprise-bridge/dist/result-merger.js +1 -0
- package/packages/enterprise-bridge/dist/types.d.ts +81 -0
- package/packages/enterprise-bridge/dist/types.js +1 -0
- package/packages/indexer/dist/file-hasher.d.ts +5 -3
- package/packages/indexer/dist/file-hasher.js +1 -1
- package/packages/indexer/dist/filesystem-crawler.d.ts +23 -21
- package/packages/indexer/dist/filesystem-crawler.js +1 -1
- package/packages/indexer/dist/graph-extractor.d.ts +9 -13
- package/packages/indexer/dist/graph-extractor.js +1 -1
- package/packages/indexer/dist/incremental-indexer.d.ts +49 -44
- package/packages/indexer/dist/incremental-indexer.js +1 -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 -3
- package/packages/server/dist/config.js +1 -1
- package/packages/server/dist/cross-workspace.d.ts +43 -0
- package/packages/server/dist/cross-workspace.js +1 -0
- package/packages/server/dist/curated-manager.d.ts +80 -78
- package/packages/server/dist/curated-manager.js +5 -10
- package/packages/server/dist/index.d.ts +1 -2
- package/packages/server/dist/index.js +1 -1
- package/packages/server/dist/replay-interceptor.d.ts +6 -7
- package/packages/server/dist/replay-interceptor.js +1 -1
- package/packages/server/dist/resources/resources.d.ts +7 -4
- package/packages/server/dist/resources/resources.js +2 -2
- package/packages/server/dist/server.d.ts +37 -25
- package/packages/server/dist/server.js +1 -1
- package/packages/server/dist/tools/analyze.tools.d.ts +14 -11
- package/packages/server/dist/tools/analyze.tools.js +1 -3
- package/packages/server/dist/tools/audit.tool.d.ts +8 -5
- package/packages/server/dist/tools/audit.tool.js +1 -4
- package/packages/server/dist/tools/bridge.tools.d.ts +34 -0
- package/packages/server/dist/tools/bridge.tools.js +15 -0
- package/packages/server/dist/tools/evolution.tools.d.ts +7 -0
- package/packages/server/dist/tools/evolution.tools.js +5 -0
- package/packages/server/dist/tools/forge.tools.d.ts +13 -12
- package/packages/server/dist/tools/forge.tools.js +10 -13
- package/packages/server/dist/tools/forget.tool.d.ts +7 -4
- package/packages/server/dist/tools/forget.tool.js +1 -7
- package/packages/server/dist/tools/graph.tool.d.ts +7 -4
- package/packages/server/dist/tools/graph.tool.js +4 -5
- package/packages/server/dist/tools/list.tool.d.ts +7 -4
- package/packages/server/dist/tools/list.tool.js +2 -8
- package/packages/server/dist/tools/lookup.tool.d.ts +7 -4
- package/packages/server/dist/tools/lookup.tool.js +2 -9
- package/packages/server/dist/tools/onboard.tool.d.ts +8 -5
- package/packages/server/dist/tools/onboard.tool.js +2 -2
- package/packages/server/dist/tools/policy.tools.d.ts +7 -0
- package/packages/server/dist/tools/policy.tools.js +2 -0
- package/packages/server/dist/tools/produce.tool.d.ts +6 -3
- package/packages/server/dist/tools/produce.tool.js +2 -2
- package/packages/server/dist/tools/read.tool.d.ts +7 -4
- package/packages/server/dist/tools/read.tool.js +2 -6
- package/packages/server/dist/tools/reindex.tool.d.ts +10 -7
- package/packages/server/dist/tools/reindex.tool.js +3 -2
- package/packages/server/dist/tools/remember.tool.d.ts +8 -4
- package/packages/server/dist/tools/remember.tool.js +3 -5
- package/packages/server/dist/tools/replay.tool.d.ts +6 -3
- package/packages/server/dist/tools/replay.tool.js +2 -6
- package/packages/server/dist/tools/search.tool.d.ts +10 -5
- package/packages/server/dist/tools/search.tool.js +6 -22
- package/packages/server/dist/tools/status.tool.d.ts +12 -4
- package/packages/server/dist/tools/status.tool.js +2 -3
- package/packages/server/dist/tools/toolkit.tools.d.ts +36 -35
- package/packages/server/dist/tools/toolkit.tools.js +20 -24
- package/packages/server/dist/tools/update.tool.d.ts +7 -4
- package/packages/server/dist/tools/update.tool.js +1 -6
- package/packages/server/dist/tools/utility.tools.d.ts +15 -15
- package/packages/server/dist/tools/utility.tools.js +10 -23
- package/packages/server/dist/version-check.d.ts +5 -2
- package/packages/server/dist/version-check.js +1 -1
- package/packages/store/dist/graph-store.interface.d.ts +89 -87
- 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 -31
- package/packages/store/dist/lance-store.js +1 -1
- package/packages/store/dist/sqlite-graph-store.d.ts +43 -47
- package/packages/store/dist/sqlite-graph-store.js +13 -13
- package/packages/store/dist/store-factory.d.ts +11 -8
- package/packages/store/dist/store-factory.js +1 -1
- package/packages/store/dist/store.interface.d.ts +47 -47
- package/packages/store/dist/store.interface.js +1 -0
- package/packages/tools/dist/audit.d.ts +61 -62
- package/packages/tools/dist/audit.js +4 -5
- package/packages/tools/dist/batch.d.ts +20 -18
- package/packages/tools/dist/batch.js +1 -1
- package/packages/tools/dist/changelog.d.ts +29 -27
- package/packages/tools/dist/changelog.js +2 -2
- package/packages/tools/dist/check.d.ts +42 -39
- package/packages/tools/dist/check.js +2 -2
- package/packages/tools/dist/checkpoint.d.ts +17 -15
- package/packages/tools/dist/checkpoint.js +1 -2
- package/packages/tools/dist/codemod.d.ts +35 -33
- package/packages/tools/dist/codemod.js +2 -2
- package/packages/tools/dist/compact.d.ts +34 -38
- package/packages/tools/dist/compact.js +2 -2
- package/packages/tools/dist/data-transform.d.ts +10 -8
- package/packages/tools/dist/data-transform.js +1 -1
- package/packages/tools/dist/dead-symbols.d.ts +29 -26
- package/packages/tools/dist/dead-symbols.js +2 -2
- package/packages/tools/dist/delegate.d.ts +26 -24
- package/packages/tools/dist/delegate.js +1 -5
- package/packages/tools/dist/diff-parse.d.ts +24 -22
- package/packages/tools/dist/diff-parse.js +3 -3
- package/packages/tools/dist/digest.d.ts +43 -46
- package/packages/tools/dist/digest.js +4 -5
- package/packages/tools/dist/dogfood-log.d.ts +49 -0
- package/packages/tools/dist/dogfood-log.js +2 -0
- package/packages/tools/dist/encode.d.ts +11 -9
- package/packages/tools/dist/encode.js +1 -1
- package/packages/tools/dist/env-info.d.ts +25 -23
- package/packages/tools/dist/env-info.js +1 -1
- package/packages/tools/dist/eval.d.ts +13 -11
- package/packages/tools/dist/eval.js +2 -3
- package/packages/tools/dist/evidence-map.d.ts +64 -62
- package/packages/tools/dist/evidence-map.js +2 -3
- package/packages/tools/dist/file-cache.d.ts +41 -0
- package/packages/tools/dist/file-cache.js +3 -0
- package/packages/tools/dist/file-summary.d.ts +50 -30
- package/packages/tools/dist/file-summary.js +2 -2
- package/packages/tools/dist/file-walk.d.ts +6 -4
- package/packages/tools/dist/file-walk.js +1 -1
- package/packages/tools/dist/find-examples.d.ts +26 -22
- package/packages/tools/dist/find-examples.js +3 -3
- package/packages/tools/dist/find.d.ts +39 -41
- package/packages/tools/dist/find.js +1 -1
- package/packages/tools/dist/forge-classify.d.ts +35 -39
- package/packages/tools/dist/forge-classify.js +2 -2
- package/packages/tools/dist/forge-ground.d.ts +58 -61
- package/packages/tools/dist/forge-ground.js +1 -1
- package/packages/tools/dist/git-context.d.ts +22 -20
- package/packages/tools/dist/git-context.js +3 -3
- package/packages/tools/dist/graph-query.d.ts +75 -79
- package/packages/tools/dist/graph-query.js +1 -1
- package/packages/tools/dist/guide.d.ts +14 -12
- package/packages/tools/dist/guide.js +1 -1
- package/packages/tools/dist/health.d.ts +13 -11
- package/packages/tools/dist/health.js +2 -2
- package/packages/tools/dist/http-request.d.ts +20 -18
- package/packages/tools/dist/http-request.js +1 -1
- package/packages/tools/dist/index.d.ts +55 -53
- package/packages/tools/dist/index.js +1 -1
- package/packages/tools/dist/lane.d.ts +28 -26
- package/packages/tools/dist/lane.js +6 -7
- package/packages/tools/dist/measure.d.ts +34 -30
- package/packages/tools/dist/measure.js +2 -2
- package/packages/tools/dist/onboard.d.ts +29 -27
- package/packages/tools/dist/onboard.js +17 -41
- package/packages/tools/dist/parse-output.d.ts +48 -46
- package/packages/tools/dist/parse-output.js +2 -2
- package/packages/tools/dist/path-resolver.d.ts +4 -2
- package/packages/tools/dist/path-resolver.js +1 -1
- package/packages/tools/dist/process-manager.d.ts +18 -16
- package/packages/tools/dist/process-manager.js +1 -1
- package/packages/tools/dist/queue.d.ts +28 -26
- package/packages/tools/dist/queue.js +1 -2
- package/packages/tools/dist/regex-test.d.ts +26 -24
- package/packages/tools/dist/regex-test.js +1 -1
- package/packages/tools/dist/rename.d.ts +28 -26
- package/packages/tools/dist/rename.js +2 -2
- package/packages/tools/dist/replay.d.ts +33 -31
- package/packages/tools/dist/replay.js +4 -6
- package/packages/tools/dist/response-envelope.d.ts +32 -30
- package/packages/tools/dist/response-envelope.js +1 -1
- package/packages/tools/dist/schema-validate.d.ts +15 -13
- package/packages/tools/dist/schema-validate.js +1 -1
- package/packages/tools/dist/scope-map.d.ts +45 -48
- package/packages/tools/dist/scope-map.js +1 -1
- package/packages/tools/dist/snippet.d.ts +26 -25
- package/packages/tools/dist/snippet.js +1 -1
- package/packages/tools/dist/stash.d.ts +13 -11
- package/packages/tools/dist/stash.js +1 -2
- package/packages/tools/dist/stratum-card.d.ts +27 -28
- package/packages/tools/dist/stratum-card.js +3 -5
- package/packages/tools/dist/symbol.d.ts +31 -26
- package/packages/tools/dist/symbol.js +3 -3
- package/packages/tools/dist/test-run.d.ts +19 -16
- package/packages/tools/dist/test-run.js +2 -2
- package/packages/tools/dist/text-utils.d.ts +6 -4
- package/packages/tools/dist/text-utils.js +2 -2
- package/packages/tools/dist/time-utils.d.ts +15 -13
- package/packages/tools/dist/time-utils.js +1 -1
- package/packages/tools/dist/trace.d.ts +26 -21
- package/packages/tools/dist/trace.js +2 -2
- package/packages/tools/dist/truncation.d.ts +6 -4
- package/packages/tools/dist/truncation.js +6 -13
- package/packages/tools/dist/watch.d.ts +28 -26
- package/packages/tools/dist/watch.js +1 -1
- package/packages/tools/dist/web-fetch.d.ts +35 -33
- package/packages/tools/dist/web-fetch.js +6 -12
- package/packages/tools/dist/web-search.d.ts +16 -14
- package/packages/tools/dist/web-search.js +1 -1
- package/packages/tools/dist/workset.d.ts +19 -17
- package/packages/tools/dist/workset.js +1 -2
- package/packages/tui/dist/App-CYLNJLr6.js +2 -0
- package/packages/tui/dist/App.d.ts +11 -6
- package/packages/tui/dist/App.js +1 -450
- package/packages/tui/dist/CuratedPanel-sYdZAICX.js +2 -0
- package/packages/tui/dist/LogPanel-DtMnoyXT.js +3 -0
- package/packages/tui/dist/SearchPanel-DREo6zgt.js +2 -0
- package/packages/tui/dist/StatusPanel-2ex8fLOO.js +2 -0
- package/packages/tui/dist/chunk-D6axbAb-.js +2 -0
- package/packages/tui/dist/devtools-DUyj952l.js +7 -0
- package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +28 -0
- package/packages/tui/dist/index-B9VpfVPP.d.ts +13 -0
- package/packages/tui/dist/index.d.ts +3 -19
- package/packages/tui/dist/index.js +1 -476
- package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +316 -0
- package/packages/tui/dist/panels/CuratedPanel.d.ts +11 -6
- package/packages/tui/dist/panels/CuratedPanel.js +1 -371
- package/packages/tui/dist/panels/LogPanel.d.ts +7 -3
- package/packages/tui/dist/panels/LogPanel.js +1 -449
- package/packages/tui/dist/panels/SearchPanel.d.ts +14 -8
- package/packages/tui/dist/panels/SearchPanel.js +1 -372
- package/packages/tui/dist/panels/StatusPanel.d.ts +11 -6
- package/packages/tui/dist/panels/StatusPanel.js +1 -371
- package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +150 -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 +21 -0
- package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +21 -0
- package/scaffold/copilot/agents/Documenter.agent.md +42 -0
- package/scaffold/copilot/agents/Orchestrator.agent.md +104 -0
- package/scaffold/copilot/agents/Planner.agent.md +54 -0
- package/scaffold/copilot/agents/Refactor.agent.md +36 -0
- package/scaffold/copilot/agents/Researcher-Alpha.agent.md +20 -0
- package/scaffold/copilot/agents/Researcher-Beta.agent.md +20 -0
- package/scaffold/copilot/agents/Researcher-Delta.agent.md +20 -0
- package/scaffold/copilot/agents/Researcher-Gamma.agent.md +20 -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/general/agents/Architect-Reviewer-Alpha.agent.md +21 -0
- package/scaffold/general/agents/Architect-Reviewer-Beta.agent.md +21 -0
- package/scaffold/general/agents/Code-Reviewer-Alpha.agent.md +12 -0
- package/scaffold/general/agents/Code-Reviewer-Beta.agent.md +12 -0
- package/scaffold/general/agents/Debugger.agent.md +31 -0
- package/scaffold/general/agents/Documenter.agent.md +42 -0
- package/scaffold/general/agents/Explorer.agent.md +50 -0
- package/scaffold/general/agents/Frontend.agent.md +29 -0
- package/scaffold/general/agents/Implementer.agent.md +31 -0
- package/scaffold/general/agents/Orchestrator.agent.md +104 -0
- package/scaffold/general/agents/Planner.agent.md +55 -0
- package/scaffold/general/agents/README.md +57 -0
- package/scaffold/general/agents/Refactor.agent.md +36 -0
- package/scaffold/general/agents/Researcher-Alpha.agent.md +20 -0
- package/scaffold/general/agents/Researcher-Beta.agent.md +20 -0
- package/scaffold/general/agents/Researcher-Delta.agent.md +20 -0
- package/scaffold/general/agents/Researcher-Gamma.agent.md +20 -0
- package/scaffold/general/agents/Security.agent.md +42 -0
- package/scaffold/general/agents/_shared/adr-protocol.md +91 -0
- package/scaffold/general/agents/_shared/architect-reviewer-base.md +50 -0
- package/scaffold/general/agents/_shared/code-agent-base.md +88 -0
- package/scaffold/general/agents/_shared/code-reviewer-base.md +54 -0
- package/scaffold/general/agents/_shared/decision-protocol.md +27 -0
- package/scaffold/general/agents/_shared/forge-protocol.md +46 -0
- package/scaffold/general/agents/_shared/researcher-base.md +61 -0
- package/scaffold/general/agents/templates/adr-template.md +27 -0
- package/scaffold/general/agents/templates/execution-state.md +25 -0
- package/scaffold/general/prompts/ask.prompt.md +20 -0
- package/scaffold/general/prompts/debug.prompt.md +25 -0
- package/scaffold/general/prompts/design.prompt.md +22 -0
- package/scaffold/general/prompts/implement.prompt.md +26 -0
- package/scaffold/general/prompts/plan.prompt.md +24 -0
- package/scaffold/general/prompts/review.prompt.md +31 -0
- package/scaffold/generate.mjs +74 -0
- package/skills/adr-skill/SKILL.md +329 -0
- package/skills/adr-skill/assets/templates/adr-madr.md +89 -0
- package/skills/adr-skill/assets/templates/adr-readme.md +20 -0
- package/skills/adr-skill/assets/templates/adr-simple.md +46 -0
- package/skills/adr-skill/references/adr-conventions.md +95 -0
- package/skills/adr-skill/references/examples.md +193 -0
- package/skills/adr-skill/references/review-checklist.md +77 -0
- package/skills/adr-skill/references/template-variants.md +52 -0
- package/skills/adr-skill/scripts/bootstrap_adr.js +259 -0
- package/skills/adr-skill/scripts/new_adr.js +391 -0
- package/skills/adr-skill/scripts/set_adr_status.js +169 -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/c4-architecture/SKILL.md +295 -0
- package/skills/c4-architecture/references/advanced-patterns.md +552 -0
- package/skills/c4-architecture/references/c4-syntax.md +492 -0
- package/skills/c4-architecture/references/common-mistakes.md +437 -0
- package/skills/knowledge-base/SKILL.md +100 -10
- package/skills/lesson-learned/SKILL.md +105 -0
- package/skills/lesson-learned/references/anti-patterns.md +55 -0
- package/skills/lesson-learned/references/se-principles.md +109 -0
- package/skills/requirements-clarity/SKILL.md +324 -0
- package/skills/session-handoff/SKILL.md +189 -0
- package/skills/session-handoff/references/handoff-template.md +139 -0
- package/skills/session-handoff/references/resume-checklist.md +80 -0
- package/skills/session-handoff/scripts/check_staleness.js +269 -0
- package/skills/session-handoff/scripts/create_handoff.js +299 -0
- package/skills/session-handoff/scripts/list_handoffs.js +113 -0
- package/skills/session-handoff/scripts/validate_handoff.js +241 -0
- package/packages/chunker/dist/treesitter-chunker.d.ts +0 -47
- package/packages/chunker/dist/treesitter-chunker.js +0 -8
- package/packages/cli/dist/commands/init.d.ts +0 -10
- package/packages/cli/dist/commands/init.js +0 -308
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region packages/tools/src/dogfood-log.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* kb_dogfood — Review persistent warn/error logs for dogfooding.
|
|
4
|
+
*
|
|
5
|
+
* Reads daily JSONL log files from .kb-state/logs/ and returns a
|
|
6
|
+
* summarized or detailed view of recent issues. Useful for periodic
|
|
7
|
+
* review cycles to identify and fix recurring problems.
|
|
8
|
+
*/
|
|
9
|
+
interface DogfoodLogEntry {
|
|
10
|
+
ts: string;
|
|
11
|
+
level: 'warn' | 'error';
|
|
12
|
+
component: string;
|
|
13
|
+
msg: string;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
interface DogfoodLogOptions {
|
|
17
|
+
/** Number of days to look back (default: 7) */
|
|
18
|
+
days?: number;
|
|
19
|
+
/** Filter by level */
|
|
20
|
+
level?: 'warn' | 'error';
|
|
21
|
+
/** Filter by component name */
|
|
22
|
+
component?: string;
|
|
23
|
+
/** Maximum entries to return in detail (default: 50) */
|
|
24
|
+
limit?: number;
|
|
25
|
+
}
|
|
26
|
+
interface DogfoodLogGroupedEntry {
|
|
27
|
+
component: string;
|
|
28
|
+
msg: string;
|
|
29
|
+
level: 'warn' | 'error';
|
|
30
|
+
count: number;
|
|
31
|
+
firstSeen: string;
|
|
32
|
+
lastSeen: string;
|
|
33
|
+
}
|
|
34
|
+
interface DogfoodLogResult {
|
|
35
|
+
/** Total entries found matching filters */
|
|
36
|
+
totalEntries: number;
|
|
37
|
+
/** Unique issue groups (by component + message) */
|
|
38
|
+
groups: DogfoodLogGroupedEntry[];
|
|
39
|
+
/** Most recent entries (up to limit) */
|
|
40
|
+
recent: DogfoodLogEntry[];
|
|
41
|
+
/** Date range covered */
|
|
42
|
+
dateRange: {
|
|
43
|
+
from: string;
|
|
44
|
+
to: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
declare function dogfoodLog(options?: DogfoodLogOptions): DogfoodLogResult;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { DogfoodLogEntry, DogfoodLogGroupedEntry, DogfoodLogOptions, DogfoodLogResult, dogfoodLog };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{join as e,resolve as t}from"node:path";import{readFileSync as n,readdirSync as r}from"node:fs";import{KB_PATHS as i}from"../../core/dist/index.js";function a(){return t(process.cwd(),i.logs)}function o(t={}){let{days:i=7,level:o,component:s,limit:c=50}=t,l=a(),u=new Date,d=new Date(u.getTime()-i*864e5).toISOString().slice(0,10),f=u.toISOString().slice(0,10),p;try{p=r(l).filter(e=>e.endsWith(`.jsonl`)&&e.slice(0,10)>=d).sort()}catch{return{totalEntries:0,groups:[],recent:[],dateRange:{from:d,to:f}}}let m=[];for(let t of p)try{let r=n(e(l,t),`utf-8`);for(let e of r.trim().split(`
|
|
2
|
+
`))if(e)try{let t=JSON.parse(e);if(o&&t.level!==o||s&&t.component!==s)continue;m.push(t)}catch{}}catch{}let h=new Map;for(let e of m){let t=`${e.component}::${e.msg}`,n=h.get(t);n?(n.count++,e.ts<n.firstSeen&&(n.firstSeen=e.ts),e.ts>n.lastSeen&&(n.lastSeen=e.ts)):h.set(t,{component:e.component,msg:e.msg,level:e.level,count:1,firstSeen:e.ts,lastSeen:e.ts})}let g=[...h.values()].sort((e,t)=>t.count-e.count),_=m.slice(-c);return{totalEntries:m.length,groups:g,recent:_,dateRange:{from:p.length>0?p[0].slice(0,10):d,to:f}}}export{o as dogfoodLog};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
//#region packages/tools/src/encode.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_encode — Encoding, decoding, and hashing utilities.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
type EncodeOperation = 'base64_encode' | 'base64_decode' | 'url_encode' | 'url_decode' | 'sha256' | 'md5' | 'jwt_decode' | 'hex_encode' | 'hex_decode';
|
|
6
|
+
interface EncodeOptions {
|
|
7
|
+
operation: EncodeOperation;
|
|
8
|
+
input: string;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
interface EncodeResult {
|
|
11
|
+
output: string;
|
|
12
|
+
operation: string;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
-
//#
|
|
14
|
+
declare function encode(options: EncodeOptions): EncodeResult;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { EncodeOperation, EncodeOptions, EncodeResult, encode };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash as
|
|
1
|
+
import{createHash as e}from"node:crypto";function t(t){let{operation:n,input:r}=t,i;switch(n){case`base64_encode`:i=Buffer.from(r).toString(`base64`);break;case`base64_decode`:i=Buffer.from(r,`base64`).toString(`utf8`);break;case`url_encode`:i=encodeURIComponent(r);break;case`url_decode`:i=decodeURIComponent(r);break;case`sha256`:i=e(`sha256`).update(r).digest(`hex`);break;case`md5`:i=e(`md5`).update(r).digest(`hex`);break;case`jwt_decode`:{let e=r.split(`.`);if(e.length!==3)throw Error(`Invalid JWT: expected 3 dot-separated parts`);let t,n;try{t=JSON.parse(Buffer.from(e[0],`base64url`).toString()),n=JSON.parse(Buffer.from(e[1],`base64url`).toString())}catch{throw Error(`Invalid JWT: header or payload is not valid JSON`)}i=JSON.stringify({header:t,payload:n},null,2);break}case`hex_encode`:i=Buffer.from(r).toString(`hex`);break;case`hex_decode`:i=Buffer.from(r,`hex`).toString(`utf8`);break;default:throw Error(`Unknown operation: ${n}`)}return{output:i,operation:n}}export{t as encode};
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
+
//#region packages/tools/src/env-info.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_env — System environment and runtime information.
|
|
3
4
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interface EnvInfoOptions {
|
|
6
|
+
includeEnv?: boolean;
|
|
7
|
+
filterEnv?: string;
|
|
8
|
+
showSensitive?: boolean;
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
interface EnvInfoResult {
|
|
11
|
+
system: {
|
|
12
|
+
platform: string;
|
|
13
|
+
arch: string;
|
|
14
|
+
release: string;
|
|
15
|
+
hostname: string;
|
|
16
|
+
type: string;
|
|
17
|
+
cpus: number;
|
|
18
|
+
memoryTotalGb: number;
|
|
19
|
+
memoryFreeGb: number;
|
|
20
|
+
};
|
|
21
|
+
runtime: {
|
|
22
|
+
node: string;
|
|
23
|
+
v8: string;
|
|
24
|
+
};
|
|
25
|
+
cwd: string;
|
|
26
|
+
env?: Record<string, string>;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
//#
|
|
28
|
+
declare function envInfo(options?: EnvInfoOptions): EnvInfoResult;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { EnvInfoOptions, EnvInfoResult, envInfo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{arch as
|
|
1
|
+
import{arch as e,cpus as t,freemem as n,hostname as r,platform as i,release as a,totalmem as o,type as s}from"node:os";const c=[/key/i,/secret/i,/token/i,/password/i,/passwd/i,/credential/i,/private/i,/certificate/i];function l(l={}){let{includeEnv:u=!1,filterEnv:d,showSensitive:f=!1}=l,p={system:{platform:i(),arch:e(),release:a(),hostname:r(),type:s(),cpus:t().length,memoryTotalGb:Math.round(o()/1024**3*10)/10,memoryFreeGb:Math.round(n()/1024**3*10)/10},runtime:{node:process.versions.node,v8:process.versions.v8},cwd:process.cwd()};if(u){let e={};for(let[t,n]of Object.entries(process.env))n&&(d&&!t.toLowerCase().includes(d.toLowerCase())||(!f&&c.some(e=>e.test(t))?e[t]=`[REDACTED]`:e[t]=n));p.env=e}return p}export{l as envInfo};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region packages/tools/src/eval.d.ts
|
|
2
|
+
interface EvalOptions {
|
|
3
|
+
code: string;
|
|
4
|
+
lang?: 'js' | 'ts';
|
|
5
|
+
timeout?: number;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
interface EvalResult {
|
|
8
|
+
success: boolean;
|
|
9
|
+
output: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
durationMs: number;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
//#
|
|
13
|
+
declare function evaluate(options: EvalOptions): EvalResult;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { EvalOptions, EvalResult, evaluate };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`)+(
|
|
3
|
-
\u2192 ${a(r)}`:""):r!==void 0?a(r):"(no output)",durationMs:Date.now()-i}}catch(s){return{success:!1,output:"",error:s.message,durationMs:Date.now()-i}}}function a(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="object")try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function g(e){return e.replace(/^\s*import\s+type\s+.*?;\s*$/gm,"").replace(/^\s*(?:export\s+)?interface\s+\w+[^{]*\{[\s\S]*?^\s*}\s*$/gm,"").replace(/^\s*(?:export\s+)?type\s+\w+\s*=.*?;\s*$/gm,"").replace(/([,(]\s*[A-Za-z_$][\w$]*)\s*:\s*[^,)=\n]+/g,"$1").replace(/\)\s*:\s*[^={\n]+(?=\s*(?:=>|\{))/g,")").replace(/\s+as\s+[A-Za-z_$][\w$<>,[\]|&\s.]*/g,"").replace(/<(?:[A-Za-z_$][\w$]*\s*,?\s*)+>(?=\s*\()/g,"")}export{w as evaluate};
|
|
1
|
+
import e from"node:vm";function t(t){let{code:i,lang:a=`js`,timeout:o=5e3}=t,s=Date.now();try{let t=a===`ts`?r(i):i,c=[],l={console:{log:(...e)=>c.push(e.map(String).join(` `)),error:(...e)=>c.push(`[error] ${e.map(String).join(` `)}`),warn:(...e)=>c.push(`[warn] ${e.map(String).join(` `)}`)},setTimeout:void 0,setInterval:void 0,setImmediate:void 0,fetch:void 0,process:void 0,require:void 0,JSON,Math,Date,Array,Object,String,Number,Boolean,Map,Set,RegExp,Error,Promise,parseInt,parseFloat,isNaN,isFinite},u=e.createContext(l,{codeGeneration:{strings:!1,wasm:!1}}),d=e.runInContext(t,u,{timeout:o});return{success:!0,output:c.length>0?c.join(`
|
|
2
|
+
`)+(d===void 0?``:`\n→ ${n(d)}`):d===void 0?`(no output)`:n(d),durationMs:Date.now()-s}}catch(e){return{success:!1,output:``,error:e.message,durationMs:Date.now()-s}}}function n(e){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`object`)try{return JSON.stringify(e,null,2)}catch{return String(e)}return String(e)}function r(e){return e.replace(/^\s*import\s+type\s+.*?;\s*$/gm,``).replace(/^\s*(?:export\s+)?interface\s+\w+[^{]*\{[\s\S]*?^\s*}\s*$/gm,``).replace(/^\s*(?:export\s+)?type\s+\w+\s*=.*?;\s*$/gm,``).replace(/([,(]\s*[A-Za-z_$][\w$]*)\s*:\s*[^,)=\n]+/g,`$1`).replace(/\)\s*:\s*[^={\n]+(?=\s*(?:=>|\{))/g,`)`).replace(/\s+as\s+[A-Za-z_$][\w$<>,[\]|&\s.]*/g,``).replace(/<(?:[A-Za-z_$][\w$]*\s*,?\s*)+>(?=\s*\()/g,``)}export{t as evaluate};
|
|
@@ -1,79 +1,81 @@
|
|
|
1
|
+
//#region packages/tools/src/evidence-map.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* kb_evidence_map — FORGE Evidence Map CRUD + Gate evaluator.
|
|
3
4
|
*
|
|
4
5
|
* Structured storage, validation, and gate evaluation for FORGE Evidence Map entries.
|
|
5
6
|
* Persisted in .kb-state/evidence-maps.json.
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
type EvidenceStatus = 'V' | 'A' | 'U';
|
|
9
|
+
type UnknownType = 'contract' | 'convention' | 'freshness' | 'runtime' | 'data-flow' | 'impact';
|
|
10
|
+
type GateDecision = 'YIELD' | 'HOLD' | 'HARD_BLOCK' | 'FORCED_DELIVERY';
|
|
11
|
+
type ForgeTier = 'floor' | 'standard' | 'critical';
|
|
12
|
+
interface EvidenceEntry {
|
|
13
|
+
id: number;
|
|
14
|
+
claim: string;
|
|
15
|
+
status: EvidenceStatus;
|
|
16
|
+
receipt: string;
|
|
17
|
+
criticalPath: boolean;
|
|
18
|
+
unknownType?: UnknownType;
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
interface EvidenceMapState {
|
|
21
|
+
taskId: string;
|
|
22
|
+
tier: ForgeTier;
|
|
23
|
+
entries: EvidenceEntry[];
|
|
24
|
+
createdAt: string;
|
|
25
|
+
updatedAt: string;
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
interface GateResult {
|
|
28
|
+
decision: GateDecision;
|
|
29
|
+
reason: string;
|
|
30
|
+
unresolvedCritical: EvidenceEntry[];
|
|
31
|
+
warnings: string[];
|
|
32
|
+
stats: {
|
|
33
|
+
total: number;
|
|
34
|
+
verified: number;
|
|
35
|
+
assumed: number;
|
|
36
|
+
unresolved: number;
|
|
37
|
+
};
|
|
38
|
+
annotation?: string;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
type EvidenceMapAction = {
|
|
41
|
+
action: 'create';
|
|
42
|
+
taskId: string;
|
|
43
|
+
tier: ForgeTier;
|
|
43
44
|
} | {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
action: 'add';
|
|
46
|
+
taskId: string;
|
|
47
|
+
claim: string;
|
|
48
|
+
status: EvidenceStatus;
|
|
49
|
+
receipt: string;
|
|
50
|
+
criticalPath?: boolean;
|
|
51
|
+
unknownType?: UnknownType;
|
|
51
52
|
} | {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
action: 'update';
|
|
54
|
+
taskId: string;
|
|
55
|
+
id: number;
|
|
56
|
+
status: EvidenceStatus;
|
|
57
|
+
receipt: string;
|
|
57
58
|
} | {
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
action: 'get';
|
|
60
|
+
taskId: string;
|
|
60
61
|
} | {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
action: 'gate';
|
|
63
|
+
taskId: string;
|
|
64
|
+
retryCount?: number;
|
|
64
65
|
} | {
|
|
65
|
-
|
|
66
|
+
action: 'list';
|
|
66
67
|
} | {
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
action: 'delete';
|
|
69
|
+
taskId: string;
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
interface EvidenceMapResult {
|
|
72
|
+
state?: EvidenceMapState;
|
|
73
|
+
states?: EvidenceMapState[];
|
|
74
|
+
entry?: EvidenceEntry;
|
|
75
|
+
gate?: GateResult;
|
|
76
|
+
deleted?: boolean;
|
|
77
|
+
formattedMap?: string;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
//#
|
|
79
|
+
declare function evidenceMap(action: EvidenceMapAction, cwd?: string): EvidenceMapResult;
|
|
80
|
+
//#endregion
|
|
81
|
+
export { EvidenceEntry, EvidenceMapAction, EvidenceMapResult, EvidenceMapState, EvidenceStatus, ForgeTier, GateDecision, GateResult, UnknownType, evidenceMap };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import{existsSync as
|
|
2
|
-
|
|
3
|
-
`)}function I(t){return{total:t.length,verified:t.filter(n=>n.status==="V").length,assumed:t.filter(n=>n.status==="A").length,unresolved:t.filter(n=>n.status==="U").length}}function w(t){const n=[];for(const e of t.entries)e.status==="V"&&e.receipt.trim()===""&&n.push("V entry without receipt"),e.status==="A"&&t.tier==="critical"&&e.unknownType==="contract"&&n.push("Assumed contract at Critical tier \u2014 should be Verified");return n}function b(t){return`FORCED DELIVERY annotation: unresolved entries remain -> ${t.filter(r=>r.status==="U").map(r=>`#${r.id} ${r.claim}`).join("; ")}`}function A(t,n=0){const e=t.entries.filter(a=>a.criticalPath&&a.status==="U"),r=w(t),i=I(t.entries);return e.find(a=>a.unknownType==="contract")?{decision:"HARD_BLOCK",reason:"Unresolved contract unknown on critical path",unresolvedCritical:e,warnings:r,stats:i}:e.length>0&&n===0?{decision:"HOLD",reason:"Unresolved critical-path unknown \u2014 retry available",unresolvedCritical:e,warnings:r,stats:i}:e.length>0&&n>=1?{decision:"FORCED_DELIVERY",reason:"Unresolved critical-path unknown after retry",unresolvedCritical:e,warnings:r,stats:i,annotation:b(t.entries)}:{decision:"YIELD",reason:"All critical-path claims satisfy gate rules",unresolvedCritical:[],warnings:r,stats:i}}function D(t,n){switch(t.action){case"create":{const e=o(n),r=new Date().toISOString(),i={taskId:t.taskId,tier:t.tier,entries:[],createdAt:r,updatedAt:r};return e[t.taskId]=i,c(e,n),{state:i,formattedMap:s(i)}}case"add":{const{maps:e,state:r}=d(t.taskId,n),i={id:S(r.entries),claim:M(t.claim),status:t.status,receipt:t.receipt,criticalPath:t.criticalPath??!1,unknownType:t.unknownType};return r.entries.push(i),r.updatedAt=new Date().toISOString(),e[t.taskId]=r,c(e,n),{state:r,entry:i,formattedMap:s(r)}}case"update":{const{maps:e,state:r}=d(t.taskId,n),i=r.entries.find(l=>l.id===t.id);if(!i)throw new Error(`Evidence entry not found: ${t.id}`);return i.status=t.status,i.receipt=t.receipt,r.updatedAt=new Date().toISOString(),e[t.taskId]=r,c(e,n),{state:r,entry:i,formattedMap:s(r)}}case"get":{const{state:e}=d(t.taskId,n);return{state:e,formattedMap:s(e)}}case"gate":{const{state:e}=d(t.taskId,n);return{state:e,gate:A(e,t.retryCount??0),formattedMap:s(e)}}case"list":return{states:Object.values(o(n)).sort((r,i)=>r.createdAt.localeCompare(i.createdAt))};case"delete":{const e=o(n);return t.taskId in e?(delete e[t.taskId],c(e,n),{deleted:!0}):{deleted:!1}}}}export{D as evidenceMap};
|
|
1
|
+
import{dirname as e,resolve as t}from"node:path";import{existsSync as n,mkdirSync as r,readFileSync as i,writeFileSync as a}from"node:fs";import{KB_PATHS as o}from"../../core/dist/index.js";const s=o.state;function c(e){return t(e??process.cwd(),s,`evidence-maps.json`)}function l(e){let t=c(e);if(!n(t))return{};try{let e=i(t,`utf-8`);return JSON.parse(e)}catch{return{}}}function u(t,i){let o=c(i),s=e(o);n(s)||r(s,{recursive:!0}),a(o,`${JSON.stringify(t,null,2)}\n`,`utf-8`)}function d(e,t){let n=l(t),r=n[e];if(!r)throw Error(`Evidence map not found: ${e}`);return{maps:n,state:r}}function f(e){return e.reduce((e,t)=>Math.max(e,t.id),0)+1}function p(e){let t=e.trim();if(!t)throw Error(`Claim is required`);if(/\r?\n/.test(t))throw Error(`Claim must be a single line`);return t}function m(e){return(e??``).replace(/\r?\n/g,` `).replace(/\|/g,`\\|`)}function h(e){let t=[`| # | Claim | Status | Receipt | Critical | Type |`,`|---|-------|--------|---------|----------|------|`];for(let n of e.entries)t.push(`| ${n.id} | ${m(n.claim)} | ${n.status} | ${m(n.receipt)} | ${n.criticalPath?`yes`:`no`} | ${m(n.unknownType)} |`);return t.join(`
|
|
2
|
+
`)}function g(e){return{total:e.length,verified:e.filter(e=>e.status===`V`).length,assumed:e.filter(e=>e.status===`A`).length,unresolved:e.filter(e=>e.status===`U`).length}}function _(e){let t=[];for(let n of e.entries)n.status===`V`&&n.receipt.trim()===``&&t.push(`V entry without receipt`),n.status===`A`&&e.tier===`critical`&&n.unknownType===`contract`&&t.push(`Assumed contract at Critical tier — should be Verified`);return t}function v(e){return`FORCED DELIVERY annotation: unresolved entries remain -> ${e.filter(e=>e.status===`U`).map(e=>`#${e.id} ${e.claim}`).join(`; `)}`}function y(e,t=0){let n=e.entries.filter(e=>e.criticalPath&&e.status===`U`),r=_(e),i=g(e.entries);return n.find(e=>e.unknownType===`contract`)?{decision:`HARD_BLOCK`,reason:`Unresolved contract unknown on critical path`,unresolvedCritical:n,warnings:r,stats:i}:n.length>0&&t===0?{decision:`HOLD`,reason:`Unresolved critical-path unknown — retry available`,unresolvedCritical:n,warnings:r,stats:i}:n.length>0&&t>=1?{decision:`FORCED_DELIVERY`,reason:`Unresolved critical-path unknown after retry`,unresolvedCritical:n,warnings:r,stats:i,annotation:v(e.entries)}:{decision:`YIELD`,reason:`All critical-path claims satisfy gate rules`,unresolvedCritical:[],warnings:r,stats:i}}function b(e,t){switch(e.action){case`create`:{let n=l(t),r=new Date().toISOString(),i={taskId:e.taskId,tier:e.tier,entries:[],createdAt:r,updatedAt:r};return n[e.taskId]=i,u(n,t),{state:i,formattedMap:h(i)}}case`add`:{let{maps:n,state:r}=d(e.taskId,t),i={id:f(r.entries),claim:p(e.claim),status:e.status,receipt:e.receipt,criticalPath:e.criticalPath??!1,unknownType:e.unknownType};return r.entries.push(i),r.updatedAt=new Date().toISOString(),n[e.taskId]=r,u(n,t),{state:r,entry:i,formattedMap:h(r)}}case`update`:{let{maps:n,state:r}=d(e.taskId,t),i=r.entries.find(t=>t.id===e.id);if(!i)throw Error(`Evidence entry not found: ${e.id}`);return i.status=e.status,i.receipt=e.receipt,r.updatedAt=new Date().toISOString(),n[e.taskId]=r,u(n,t),{state:r,entry:i,formattedMap:h(r)}}case`get`:{let{state:n}=d(e.taskId,t);return{state:n,formattedMap:h(n)}}case`gate`:{let{state:n}=d(e.taskId,t);return{state:n,gate:y(n,e.retryCount??0),formattedMap:h(n)}}case`list`:return{states:Object.values(l(t)).sort((e,t)=>e.createdAt.localeCompare(t.createdAt))};case`delete`:{let n=l(t);return e.taskId in n?(delete n[e.taskId],u(n,t),{deleted:!0}):{deleted:!1}}}}export{b as evidenceMap};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region packages/tools/src/file-cache.d.ts
|
|
2
|
+
interface FileCacheEntry {
|
|
3
|
+
/** Full file content */
|
|
4
|
+
content: string;
|
|
5
|
+
/** SHA-256 hash of content */
|
|
6
|
+
hash: string;
|
|
7
|
+
/** Line count */
|
|
8
|
+
lines: number;
|
|
9
|
+
/** Estimated token count (~chars/4) */
|
|
10
|
+
estimatedTokens: number;
|
|
11
|
+
/** How many times this file has been requested */
|
|
12
|
+
hitCount: number;
|
|
13
|
+
/** Whether content changed since last read (false on cache hit) */
|
|
14
|
+
changed: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface FileCacheStats {
|
|
17
|
+
totalReads: number;
|
|
18
|
+
cacheHits: number;
|
|
19
|
+
filesTracked: number;
|
|
20
|
+
}
|
|
21
|
+
declare class FileCache {
|
|
22
|
+
private cache;
|
|
23
|
+
private totalReads;
|
|
24
|
+
private cacheHits;
|
|
25
|
+
private static readonly MAX_ENTRIES;
|
|
26
|
+
/**
|
|
27
|
+
* Get file content with deduplication.
|
|
28
|
+
* First call: reads from disk, hashes, caches.
|
|
29
|
+
* Subsequent calls: checks mtime → if unchanged, cache hit (skip read).
|
|
30
|
+
* If mtime changed: re-reads, re-hashes, checks if content actually changed.
|
|
31
|
+
*/
|
|
32
|
+
get(filePath: string): Promise<FileCacheEntry>;
|
|
33
|
+
/** Remove a single file from cache. Returns true if it was cached. */
|
|
34
|
+
invalidate(filePath: string): boolean;
|
|
35
|
+
/** Clear all cached files. Returns how many were cleared. */
|
|
36
|
+
clear(): number;
|
|
37
|
+
/** Get cache statistics. */
|
|
38
|
+
stats(): FileCacheStats;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { FileCache, FileCacheEntry, FileCacheStats };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{estimateTokens as e}from"./text-utils.js";import{readFile as t,stat as n}from"node:fs/promises";import{resolve as r}from"node:path";import{createHash as i}from"node:crypto";var a=class i{cache=new Map;totalReads=0;cacheHits=0;static MAX_ENTRIES=500;async get(a){let s=r(a);this.totalReads++;let c=(await n(s)).mtimeMs,l=this.cache.get(s);if(l){if(l.mtimeMs===c)return this.cacheHits++,l.hitCount++,{content:l.content,hash:l.hash,lines:l.lines,estimatedTokens:l.estimatedTokens,hitCount:l.hitCount,changed:!1};let n=await t(s,`utf-8`),r=o(n);if(r===l.hash)return this.cacheHits++,l.hitCount++,l.mtimeMs=c,{content:l.content,hash:l.hash,lines:l.lines,estimatedTokens:l.estimatedTokens,hitCount:l.hitCount,changed:!1};let i=n.split(`
|
|
2
|
+
`).length,a=e(n);return l.content=n,l.hash=r,l.lines=i,l.estimatedTokens=a,l.hitCount++,l.mtimeMs=c,{content:n,hash:r,lines:i,estimatedTokens:a,hitCount:l.hitCount,changed:!0}}let u=await t(s,`utf-8`),d=o(u),f=u.split(`
|
|
3
|
+
`).length,p=e(u);if(this.cache.set(s,{content:u,hash:d,lines:f,estimatedTokens:p,hitCount:1,mtimeMs:c}),this.cache.size>i.MAX_ENTRIES){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}return{content:u,hash:d,lines:f,estimatedTokens:p,hitCount:1,changed:!0}}invalidate(e){return this.cache.delete(r(e))}clear(){let e=this.cache.size;return this.cache.clear(),e}stats(){return{totalReads:this.totalReads,cacheHits:this.cacheHits,filesTracked:this.cache.size}}};function o(e){return i(`sha256`).update(e).digest(`hex`)}export{a as FileCache};
|
|
@@ -1,32 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region packages/tools/src/file-summary.d.ts
|
|
2
|
+
interface FileSummaryOptions {
|
|
3
|
+
path: string;
|
|
4
|
+
/** Pre-loaded content — skip readFile when provided (e.g., from FileCache) */
|
|
5
|
+
content?: string;
|
|
6
|
+
previewLines?: number;
|
|
4
7
|
}
|
|
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
|
-
|
|
8
|
+
interface FileSummaryResult {
|
|
9
|
+
path: string;
|
|
10
|
+
lines: number;
|
|
11
|
+
language: string;
|
|
12
|
+
imports: string[];
|
|
13
|
+
exports: string[];
|
|
14
|
+
functions: Array<{
|
|
15
|
+
name: string;
|
|
16
|
+
line: number;
|
|
17
|
+
exported: boolean;
|
|
18
|
+
signature?: string;
|
|
19
|
+
}>;
|
|
20
|
+
classes: Array<{
|
|
21
|
+
name: string;
|
|
22
|
+
line: number;
|
|
23
|
+
exported: boolean;
|
|
24
|
+
signature?: string;
|
|
25
|
+
}>;
|
|
26
|
+
interfaces: Array<{
|
|
27
|
+
name: string;
|
|
28
|
+
line: number;
|
|
29
|
+
exported: boolean;
|
|
30
|
+
}>;
|
|
31
|
+
types: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
line: number;
|
|
34
|
+
exported: boolean;
|
|
35
|
+
}>;
|
|
36
|
+
/** Import details with external/internal classification (AST-powered) */
|
|
37
|
+
importDetails?: Array<{
|
|
38
|
+
source: string;
|
|
39
|
+
specifiers: string[];
|
|
40
|
+
isExternal: boolean;
|
|
41
|
+
}>;
|
|
42
|
+
/** Intra-file call edges showing which functions call which (AST-powered) */
|
|
43
|
+
callEdges?: Array<{
|
|
44
|
+
caller: string;
|
|
45
|
+
callee: string;
|
|
46
|
+
line: number;
|
|
47
|
+
}>;
|
|
48
|
+
estimatedTokens: number;
|
|
30
49
|
}
|
|
31
|
-
|
|
32
|
-
//#
|
|
50
|
+
declare function fileSummary(options: FileSummaryOptions): Promise<FileSummaryResult>;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { FileSummaryOptions, FileSummaryResult, fileSummary };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{readFile as
|
|
2
|
-
`),
|
|
1
|
+
import{readFile as e}from"node:fs/promises";import{extname as t}from"node:path";import{SUPPORTED_EXTENSIONS as n,WasmRuntime as r,extractCalls as i,extractImports as a,extractSymbols as o}from"../../chunker/dist/index.js";async function s(i){let{path:a,previewLines:o=3}=i,s=i.content??await e(a,`utf-8`),u=s.split(`
|
|
2
|
+
`),d=a.split(`.`).pop()??``,f=t(a);return r.get()&&n.has(f)?c(a,s,u,d,f):l(a,s,u,d)}async function c(e,t,n,r,s){let[c,l,d]=await Promise.all([o(t,s,e),a(t,s,e),i(t,s,e).catch(()=>[])]),f=l.map(e=>`import ${e.specifiers.length>0?`{ ${e.specifiers.join(`, `)} }`:`*`} from '${e.source}'`),p=[],m=[],h=[],g=[],_=[];for(let e of c)switch(e.exported&&p.push(e.name),e.kind){case`function`:case`method`:m.push({name:e.name,line:e.line,exported:e.exported,signature:e.signature});break;case`class`:h.push({name:e.name,line:e.line,exported:e.exported,signature:e.signature});break;case`interface`:g.push({name:e.name,line:e.line,exported:e.exported});break;case`type`:_.push({name:e.name,line:e.line,exported:e.exported});break}let v=l.map(e=>({source:e.source,specifiers:e.specifiers,isExternal:e.isExternal})),y=d.map(e=>({caller:e.callerName,callee:e.calleeName,line:e.line}));return{path:e,lines:n.length,language:u(r),imports:f,exports:p,functions:m,classes:h,interfaces:g,types:_,importDetails:v,callEdges:y.length>0?y:void 0,estimatedTokens:Math.ceil(t.length/4)}}function l(e,t,n,r){let i=[],a=[],o=[],s=[],c=[],l=[];for(let e=0;e<n.length;e+=1){let t=n[e],r=e+1;if(/^import\s+.+/.test(t)){i.push(t.trim());continue}let u=t.match(/^export\s+(?:async\s+)?function\s+(\w+)/);if(u){o.push({name:u[1],line:r,exported:!0}),a.push(u[1]);continue}let d=t.match(/^(?:async\s+)?function\s+(\w+)/);if(d){o.push({name:d[1],line:r,exported:!1});continue}let f=t.match(/^(export\s+)?const\s+(\w+)\s*=.*(?:=>|\bfunction\b)/);if(f){let e=!!f[1];o.push({name:f[2],line:r,exported:e}),e&&a.push(f[2]);continue}let p=t.match(/^export\s+const\s+(\w+)\s*=/);if(p){a.push(p[1]);continue}let m=t.match(/^(export\s+)?(?:abstract\s+)?class\s+(\w+)/);if(m){let e=!!m[1];s.push({name:m[2],line:r,exported:e}),e&&a.push(m[2]);continue}let h=t.match(/^(export\s+)?interface\s+(\w+)/);if(h){let e=!!h[1];c.push({name:h[2],line:r,exported:e}),e&&a.push(h[2]);continue}let g=t.match(/^(export\s+)?type\s+(\w+)/);if(g){let e=!!g[1];l.push({name:g[2],line:r,exported:e}),e&&a.push(g[2]);continue}let _=t.match(/^export\s+\{(.+)\}/);if(_){let e=_[1].split(`,`).map(e=>e.trim().split(/\s+as\s+/).pop()?.trim()??``).filter(Boolean);a.push(...e)}}return{path:e,lines:n.length,language:u(r),imports:i,exports:a,functions:o,classes:s,interfaces:c,types:l,estimatedTokens:Math.ceil(t.length/4)}}function u(e){return{ts:`typescript`,tsx:`typescript-jsx`,js:`javascript`,jsx:`javascript-jsx`,py:`python`,rs:`rust`,go:`go`,java:`java`,rb:`ruby`,md:`markdown`,json:`json`,yaml:`yaml`,yml:`yaml`,css:`css`,html:`html`,sh:`shell`,bash:`shell`}[e]??e}export{s as fileSummary};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region packages/tools/src/file-walk.d.ts
|
|
2
|
+
declare const DEFAULT_TOOL_EXTENSIONS: string[];
|
|
3
|
+
declare function matchesGlobPattern(path: string, pattern: string): boolean;
|
|
4
|
+
declare function walkFiles(rootPath: string, extensions: string[], exclude: string[]): Promise<string[]>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { DEFAULT_TOOL_EXTENSIONS, matchesGlobPattern, walkFiles };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readdir as
|
|
1
|
+
import{readdir as e,stat as t}from"node:fs/promises";import{extname as n,join as r,relative as i}from"node:path";import{KB_PATHS as a}from"../../core/dist/index.js";const o=[`.ts`,`.tsx`,`.js`,`.jsx`],s=new Set([`node_modules`,`.git`,`dist`,`build`,`coverage`,`.turbo`,`.cache`,`cdk.out`,a.state]);function c(e){return e.replace(/\\/g,`/`)}function l(e){return e.replace(/[.+^${}()|[\]\\]/g,`\\$&`)}function u(e,t){let n=c(e),r=c(t).trim();if(!r)return!1;let i=l(r).replace(/\*\*/g,`::DOUBLE_STAR::`).replace(/\*/g,`[^/]*`).replace(/\?/g,`[^/]`).replace(/::DOUBLE_STAR::/g,`.*`);return RegExp(`^${i}$`).test(n)}function d(e,t,n){return t.some(t=>u(e,t)?!0:n?u(`${e}/`,t):!1)}async function f(a,o,l){let u=[],f=o.map(e=>e.toLowerCase());async function p(o){let m=await e(o);for(let e of m){if(s.has(e))continue;let m=r(o,e),h=await t(m),g=c(i(a,m));if(h.isDirectory()){d(g,l,!0)||await p(m);continue}d(g,l,!1)||f.includes(n(e).toLowerCase())&&u.push(m)}}return await p(a),u.sort((e,t)=>e.localeCompare(t)),u}export{o as DEFAULT_TOOL_EXTENSIONS,u as matchesGlobPattern,f as walkFiles};
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { IEmbedder } from "@kb/embeddings";
|
|
2
|
+
import { IKnowledgeStore } from "@kb/store";
|
|
3
|
+
import { ContentType } from "@kb/core";
|
|
4
|
+
|
|
5
|
+
//#region packages/tools/src/find-examples.d.ts
|
|
6
|
+
interface FindExamplesOptions {
|
|
7
|
+
/** Symbol or pattern to find examples of */
|
|
8
|
+
query: string;
|
|
9
|
+
/** Max examples to return (default: 5) */
|
|
10
|
+
limit?: number;
|
|
11
|
+
/** Filter by content type */
|
|
12
|
+
contentType?: ContentType;
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
interface Example {
|
|
15
|
+
path: string;
|
|
16
|
+
startLine: number;
|
|
17
|
+
endLine: number;
|
|
18
|
+
content: string;
|
|
19
|
+
relevance: number;
|
|
20
|
+
context: string;
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
interface FindExamplesResult {
|
|
23
|
+
query: string;
|
|
24
|
+
examples: Example[];
|
|
25
|
+
totalFound: number;
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
//#
|
|
27
|
+
declare function findExamples(embedder: IEmbedder, store: IKnowledgeStore, options: FindExamplesOptions): Promise<FindExamplesResult>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Example, FindExamplesOptions, FindExamplesResult, findExamples };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
async function
|
|
2
|
-
`),
|
|
3
|
-
`);return{path:e.record.sourcePath,startLine:e.record.startLine,endLine:e.record.endLine,content:
|
|
1
|
+
async function e(e,n,r){let{query:i,limit:a=5,contentType:o}=r,s=`usage example of ${i}`,c=await e.embed(s),l=await n.search(c,{limit:a*3,contentType:o}),u=RegExp(`\\b${t(i)}\\b`,`i`),d=l.filter(e=>u.test(e.record.content));return{query:i,examples:d.map(e=>{let t=e.record.content,n=/export\s+(?:async\s+)?(?:function|class|const|interface|type)\s/.test(t),r=/^\s*import\s/m.test(t),i=/(?:^|[\\/])(test|tests|__tests__|spec)(?:[\\/]|$)/i.test(e.record.sourcePath)||/\.(test|spec)\.[jt]sx?$/i.test(e.record.sourcePath),a=0;n||(a+=.1),r||(a+=.05),i&&(a+=.05);let o=t.split(`
|
|
2
|
+
`),s=o.findIndex(e=>u.test(e)),c=Math.max(0,s-2),l=Math.min(o.length,s+5),d=o.slice(c,l).join(`
|
|
3
|
+
`);return{path:e.record.sourcePath,startLine:e.record.startLine,endLine:e.record.endLine,content:d||t.slice(0,300),relevance:Math.min(1,e.score+a),context:i?`test`:n?`definition`:`usage`}}).sort((e,t)=>t.relevance-e.relevance).slice(0,a),totalFound:d.length}}function t(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}export{e as findExamples};
|