@vpxa/kb 0.1.15 → 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 +62 -15
- package/package.json +5 -1
- package/packages/analyzers/dist/blast-radius-analyzer.d.ts +1 -2
- package/packages/analyzers/dist/blast-radius-analyzer.js +1 -2
- package/packages/analyzers/dist/dependency-analyzer.d.ts +2 -3
- package/packages/analyzers/dist/dependency-analyzer.js +3 -4
- package/packages/analyzers/dist/diagram-generator.d.ts +1 -2
- package/packages/analyzers/dist/diagram-generator.js +1 -2
- package/packages/analyzers/dist/entry-point-analyzer.d.ts +1 -2
- package/packages/analyzers/dist/entry-point-analyzer.js +3 -4
- package/packages/analyzers/dist/knowledge-producer.d.ts +6 -2
- package/packages/analyzers/dist/knowledge-producer.js +4 -3
- package/packages/analyzers/dist/pattern-analyzer.d.ts +1 -2
- package/packages/analyzers/dist/pattern-analyzer.js +2 -3
- package/packages/analyzers/dist/regex-call-graph.d.ts +1 -2
- package/packages/analyzers/dist/regex-call-graph.js +1 -2
- package/packages/analyzers/dist/structure-analyzer.d.ts +1 -2
- package/packages/analyzers/dist/structure-analyzer.js +1 -2
- package/packages/analyzers/dist/symbol-analyzer.d.ts +3 -3
- package/packages/analyzers/dist/symbol-analyzer.js +8 -7
- package/packages/analyzers/dist/ts-call-graph.d.ts +1 -2
- package/packages/analyzers/dist/ts-call-graph.js +1 -2
- package/packages/analyzers/dist/types.d.ts +1 -2
- package/packages/chunker/dist/call-graph-extractor.d.ts +3 -3
- package/packages/chunker/dist/call-graph-extractor.js +1 -2
- package/packages/chunker/dist/chunker-factory.d.ts +12 -4
- package/packages/chunker/dist/chunker-factory.js +1 -2
- package/packages/chunker/dist/chunker.interface.d.ts +1 -2
- package/packages/chunker/dist/code-chunker.d.ts +1 -2
- package/packages/chunker/dist/code-chunker.js +1 -2
- 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 +1 -2
- package/packages/chunker/dist/generic-chunker.js +1 -2
- package/packages/chunker/dist/index.d.ts +15 -4
- package/packages/chunker/dist/index.js +1 -1
- package/packages/chunker/dist/markdown-chunker.d.ts +1 -2
- package/packages/chunker/dist/markdown-chunker.js +1 -2
- 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 +1 -2
- package/packages/cli/dist/commands/analyze.js +1 -2
- package/packages/cli/dist/commands/context-cmds.d.ts +1 -2
- package/packages/cli/dist/commands/context-cmds.js +1 -2
- package/packages/cli/dist/commands/environment.d.ts +1 -2
- package/packages/cli/dist/commands/environment.js +1 -2
- package/packages/cli/dist/commands/execution.d.ts +1 -2
- package/packages/cli/dist/commands/execution.js +1 -2
- package/packages/cli/dist/commands/graph.d.ts +1 -2
- package/packages/cli/dist/commands/graph.js +1 -2
- package/packages/cli/dist/commands/init/adapters.d.ts +4 -3
- package/packages/cli/dist/commands/init/adapters.js +1 -2
- package/packages/cli/dist/commands/init/config.d.ts +1 -2
- package/packages/cli/dist/commands/init/config.js +3 -4
- 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 +1 -2
- package/packages/cli/dist/commands/init/curated.js +1 -2
- 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 +7 -2
- package/packages/cli/dist/commands/init/index.js +5 -3
- package/packages/cli/dist/commands/init/scaffold.d.ts +1 -2
- package/packages/cli/dist/commands/init/scaffold.js +1 -2
- package/packages/cli/dist/commands/init/templates.d.ts +3 -4
- package/packages/cli/dist/commands/init/templates.js +106 -243
- package/packages/cli/dist/commands/knowledge.d.ts +1 -2
- package/packages/cli/dist/commands/knowledge.js +1 -2
- package/packages/cli/dist/commands/search.d.ts +1 -2
- package/packages/cli/dist/commands/search.js +1 -2
- package/packages/cli/dist/commands/system.d.ts +1 -2
- package/packages/cli/dist/commands/system.js +3 -4
- package/packages/cli/dist/commands/workspace.d.ts +1 -2
- package/packages/cli/dist/commands/workspace.js +1 -2
- package/packages/cli/dist/context.d.ts +1 -2
- package/packages/cli/dist/context.js +1 -2
- package/packages/cli/dist/helpers.d.ts +1 -2
- package/packages/cli/dist/helpers.js +1 -2
- package/packages/cli/dist/index.d.ts +1 -2
- package/packages/cli/dist/index.js +1 -2
- package/packages/cli/dist/kb-init.d.ts +1 -2
- package/packages/cli/dist/kb-init.js +1 -2
- package/packages/cli/dist/types.d.ts +1 -2
- package/packages/core/dist/constants.d.ts +23 -2
- package/packages/core/dist/constants.js +1 -2
- package/packages/core/dist/content-detector.d.ts +1 -2
- package/packages/core/dist/content-detector.js +1 -2
- package/packages/core/dist/errors.d.ts +1 -2
- package/packages/core/dist/errors.js +1 -2
- 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 +4 -3
- package/packages/core/dist/index.js +1 -1
- package/packages/core/dist/logger.d.ts +4 -2
- package/packages/core/dist/logger.js +1 -2
- package/packages/core/dist/types.d.ts +1 -2
- package/packages/core/dist/types.js +1 -2
- package/packages/embeddings/dist/embedder.interface.d.ts +1 -2
- package/packages/embeddings/dist/onnx-embedder.d.ts +1 -2
- package/packages/embeddings/dist/onnx-embedder.js +1 -2
- package/packages/enterprise-bridge/dist/cache.d.ts +1 -2
- package/packages/enterprise-bridge/dist/cache.js +1 -2
- package/packages/enterprise-bridge/dist/er-client.d.ts +1 -2
- package/packages/enterprise-bridge/dist/er-client.js +1 -2
- package/packages/enterprise-bridge/dist/evolution-collector.d.ts +1 -2
- package/packages/enterprise-bridge/dist/evolution-collector.js +1 -2
- package/packages/enterprise-bridge/dist/policy-store.d.ts +1 -2
- package/packages/enterprise-bridge/dist/policy-store.js +1 -2
- package/packages/enterprise-bridge/dist/push-adapter.d.ts +1 -2
- package/packages/enterprise-bridge/dist/push-adapter.js +1 -2
- package/packages/enterprise-bridge/dist/result-merger.d.ts +1 -2
- package/packages/enterprise-bridge/dist/result-merger.js +1 -2
- package/packages/enterprise-bridge/dist/types.d.ts +1 -2
- package/packages/enterprise-bridge/dist/types.js +1 -2
- package/packages/indexer/dist/file-hasher.d.ts +1 -2
- package/packages/indexer/dist/file-hasher.js +1 -2
- package/packages/indexer/dist/filesystem-crawler.d.ts +1 -2
- package/packages/indexer/dist/filesystem-crawler.js +1 -2
- package/packages/indexer/dist/graph-extractor.d.ts +1 -2
- package/packages/indexer/dist/graph-extractor.js +1 -2
- package/packages/indexer/dist/incremental-indexer.d.ts +1 -2
- package/packages/indexer/dist/incremental-indexer.js +1 -2
- package/packages/server/dist/config.d.ts +1 -2
- package/packages/server/dist/config.js +1 -2
- 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 +2 -3
- package/packages/server/dist/curated-manager.js +4 -5
- package/packages/server/dist/index.js +1 -2
- package/packages/server/dist/replay-interceptor.d.ts +1 -2
- package/packages/server/dist/replay-interceptor.js +1 -2
- package/packages/server/dist/resources/resources.d.ts +1 -2
- package/packages/server/dist/resources/resources.js +1 -2
- package/packages/server/dist/server.d.ts +4 -2
- package/packages/server/dist/server.js +1 -2
- package/packages/server/dist/tools/analyze.tools.d.ts +1 -2
- package/packages/server/dist/tools/analyze.tools.js +1 -2
- package/packages/server/dist/tools/audit.tool.d.ts +1 -2
- package/packages/server/dist/tools/audit.tool.js +1 -2
- package/packages/server/dist/tools/bridge.tools.d.ts +1 -2
- package/packages/server/dist/tools/bridge.tools.js +1 -2
- package/packages/server/dist/tools/evolution.tools.d.ts +1 -2
- package/packages/server/dist/tools/evolution.tools.js +1 -2
- package/packages/server/dist/tools/forge.tools.d.ts +1 -2
- package/packages/server/dist/tools/forge.tools.js +5 -6
- package/packages/server/dist/tools/forget.tool.d.ts +1 -2
- package/packages/server/dist/tools/forget.tool.js +1 -2
- package/packages/server/dist/tools/graph.tool.d.ts +1 -2
- package/packages/server/dist/tools/graph.tool.js +1 -2
- package/packages/server/dist/tools/list.tool.d.ts +1 -2
- package/packages/server/dist/tools/list.tool.js +1 -2
- package/packages/server/dist/tools/lookup.tool.d.ts +1 -2
- package/packages/server/dist/tools/lookup.tool.js +1 -2
- package/packages/server/dist/tools/onboard.tool.d.ts +1 -2
- package/packages/server/dist/tools/onboard.tool.js +1 -2
- package/packages/server/dist/tools/policy.tools.d.ts +1 -2
- package/packages/server/dist/tools/policy.tools.js +1 -2
- package/packages/server/dist/tools/produce.tool.d.ts +1 -2
- package/packages/server/dist/tools/produce.tool.js +1 -2
- package/packages/server/dist/tools/read.tool.d.ts +1 -2
- package/packages/server/dist/tools/read.tool.js +2 -3
- package/packages/server/dist/tools/reindex.tool.d.ts +1 -2
- package/packages/server/dist/tools/reindex.tool.js +3 -3
- package/packages/server/dist/tools/remember.tool.d.ts +1 -2
- package/packages/server/dist/tools/remember.tool.js +1 -2
- package/packages/server/dist/tools/replay.tool.d.ts +1 -2
- package/packages/server/dist/tools/replay.tool.js +1 -2
- package/packages/server/dist/tools/search.tool.d.ts +1 -2
- package/packages/server/dist/tools/search.tool.js +4 -5
- package/packages/server/dist/tools/status.tool.d.ts +7 -3
- package/packages/server/dist/tools/status.tool.js +2 -3
- package/packages/server/dist/tools/toolkit.tools.d.ts +1 -2
- package/packages/server/dist/tools/toolkit.tools.js +19 -19
- package/packages/server/dist/tools/update.tool.d.ts +1 -2
- package/packages/server/dist/tools/update.tool.js +1 -2
- package/packages/server/dist/tools/utility.tools.d.ts +1 -2
- package/packages/server/dist/tools/utility.tools.js +2 -3
- package/packages/server/dist/version-check.d.ts +1 -2
- package/packages/server/dist/version-check.js +1 -2
- package/packages/store/dist/graph-store.interface.d.ts +1 -2
- package/packages/store/dist/lance-store.d.ts +1 -2
- package/packages/store/dist/lance-store.js +1 -2
- package/packages/store/dist/sqlite-graph-store.d.ts +1 -2
- package/packages/store/dist/sqlite-graph-store.js +6 -7
- package/packages/store/dist/store-factory.d.ts +1 -2
- package/packages/store/dist/store-factory.js +1 -2
- package/packages/store/dist/store.interface.d.ts +1 -2
- package/packages/tools/dist/audit.d.ts +1 -2
- package/packages/tools/dist/audit.js +1 -2
- package/packages/tools/dist/batch.d.ts +1 -2
- package/packages/tools/dist/batch.js +1 -2
- package/packages/tools/dist/changelog.d.ts +1 -2
- package/packages/tools/dist/changelog.js +2 -3
- package/packages/tools/dist/check.d.ts +1 -2
- package/packages/tools/dist/check.js +2 -3
- package/packages/tools/dist/checkpoint.d.ts +1 -2
- package/packages/tools/dist/checkpoint.js +1 -2
- package/packages/tools/dist/codemod.d.ts +1 -2
- package/packages/tools/dist/codemod.js +1 -2
- package/packages/tools/dist/compact.d.ts +1 -2
- package/packages/tools/dist/compact.js +1 -2
- package/packages/tools/dist/data-transform.d.ts +1 -2
- package/packages/tools/dist/data-transform.js +1 -2
- package/packages/tools/dist/dead-symbols.d.ts +1 -2
- package/packages/tools/dist/dead-symbols.js +2 -3
- package/packages/tools/dist/delegate.d.ts +1 -2
- package/packages/tools/dist/delegate.js +1 -2
- package/packages/tools/dist/diff-parse.d.ts +1 -2
- package/packages/tools/dist/diff-parse.js +1 -2
- package/packages/tools/dist/digest.d.ts +1 -2
- package/packages/tools/dist/digest.js +1 -2
- 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 +1 -2
- package/packages/tools/dist/encode.js +1 -2
- package/packages/tools/dist/env-info.d.ts +1 -2
- package/packages/tools/dist/env-info.js +1 -2
- package/packages/tools/dist/eval.d.ts +1 -2
- package/packages/tools/dist/eval.js +1 -2
- package/packages/tools/dist/evidence-map.d.ts +1 -2
- package/packages/tools/dist/evidence-map.js +2 -3
- package/packages/tools/dist/file-cache.d.ts +1 -2
- package/packages/tools/dist/file-cache.js +1 -2
- package/packages/tools/dist/file-summary.d.ts +17 -2
- package/packages/tools/dist/file-summary.js +2 -3
- package/packages/tools/dist/file-walk.d.ts +1 -2
- package/packages/tools/dist/file-walk.js +1 -2
- package/packages/tools/dist/find-examples.d.ts +1 -2
- package/packages/tools/dist/find-examples.js +1 -2
- package/packages/tools/dist/find.d.ts +1 -2
- package/packages/tools/dist/find.js +1 -2
- package/packages/tools/dist/forge-classify.d.ts +1 -2
- package/packages/tools/dist/forge-classify.js +2 -3
- package/packages/tools/dist/forge-ground.d.ts +1 -2
- package/packages/tools/dist/forge-ground.js +1 -2
- package/packages/tools/dist/git-context.d.ts +1 -2
- package/packages/tools/dist/git-context.js +1 -2
- package/packages/tools/dist/graph-query.d.ts +1 -2
- package/packages/tools/dist/graph-query.js +1 -2
- package/packages/tools/dist/guide.d.ts +1 -2
- package/packages/tools/dist/guide.js +1 -2
- package/packages/tools/dist/health.d.ts +1 -2
- package/packages/tools/dist/health.js +1 -2
- package/packages/tools/dist/http-request.d.ts +1 -2
- package/packages/tools/dist/http-request.js +1 -2
- package/packages/tools/dist/index.d.ts +2 -1
- package/packages/tools/dist/index.js +1 -1
- package/packages/tools/dist/lane.d.ts +1 -2
- package/packages/tools/dist/lane.js +3 -4
- package/packages/tools/dist/measure.d.ts +4 -3
- package/packages/tools/dist/measure.js +2 -3
- package/packages/tools/dist/onboard.d.ts +1 -2
- package/packages/tools/dist/onboard.js +14 -15
- package/packages/tools/dist/parse-output.d.ts +1 -2
- package/packages/tools/dist/parse-output.js +2 -3
- package/packages/tools/dist/path-resolver.d.ts +1 -2
- package/packages/tools/dist/path-resolver.js +1 -2
- package/packages/tools/dist/process-manager.d.ts +1 -2
- package/packages/tools/dist/process-manager.js +1 -2
- package/packages/tools/dist/queue.d.ts +1 -2
- package/packages/tools/dist/queue.js +1 -2
- package/packages/tools/dist/regex-test.d.ts +1 -2
- package/packages/tools/dist/regex-test.js +1 -2
- package/packages/tools/dist/rename.d.ts +1 -2
- package/packages/tools/dist/rename.js +1 -2
- package/packages/tools/dist/replay.d.ts +2 -3
- package/packages/tools/dist/replay.js +4 -5
- package/packages/tools/dist/response-envelope.d.ts +1 -2
- package/packages/tools/dist/response-envelope.js +1 -2
- package/packages/tools/dist/schema-validate.d.ts +1 -2
- package/packages/tools/dist/schema-validate.js +1 -2
- package/packages/tools/dist/scope-map.d.ts +1 -2
- package/packages/tools/dist/scope-map.js +1 -2
- package/packages/tools/dist/snippet.d.ts +1 -2
- package/packages/tools/dist/snippet.js +1 -2
- package/packages/tools/dist/stash.d.ts +1 -2
- package/packages/tools/dist/stash.js +1 -2
- package/packages/tools/dist/stratum-card.d.ts +1 -2
- package/packages/tools/dist/stratum-card.js +1 -2
- package/packages/tools/dist/symbol.d.ts +3 -2
- package/packages/tools/dist/symbol.js +3 -4
- package/packages/tools/dist/test-run.d.ts +1 -2
- package/packages/tools/dist/test-run.js +2 -3
- package/packages/tools/dist/text-utils.d.ts +1 -2
- package/packages/tools/dist/text-utils.js +1 -2
- package/packages/tools/dist/time-utils.d.ts +1 -2
- package/packages/tools/dist/time-utils.js +1 -2
- package/packages/tools/dist/trace.d.ts +3 -2
- package/packages/tools/dist/trace.js +2 -3
- package/packages/tools/dist/truncation.d.ts +1 -2
- package/packages/tools/dist/truncation.js +1 -2
- package/packages/tools/dist/watch.d.ts +1 -2
- package/packages/tools/dist/watch.js +1 -2
- package/packages/tools/dist/web-fetch.d.ts +1 -2
- package/packages/tools/dist/web-fetch.js +1 -2
- package/packages/tools/dist/web-search.d.ts +1 -2
- package/packages/tools/dist/web-search.js +1 -2
- package/packages/tools/dist/workset.d.ts +1 -2
- package/packages/tools/dist/workset.js +1 -2
- package/packages/tui/dist/{App-BAlmxCCw.js → App-CYLNJLr6.js} +1 -2
- package/packages/tui/dist/App.d.ts +1 -2
- package/packages/tui/dist/App.js +1 -1
- package/packages/tui/dist/CuratedPanel-sYdZAICX.js +1 -2
- package/packages/tui/dist/LogPanel-DtMnoyXT.js +3 -0
- package/packages/tui/dist/SearchPanel-DREo6zgt.js +1 -2
- package/packages/tui/dist/StatusPanel-2ex8fLOO.js +1 -2
- package/packages/tui/dist/devtools-DUyj952l.js +1 -2
- package/packages/tui/dist/embedder.interface-D4ew0HPW.d.ts +1 -2
- package/packages/tui/dist/index-B9VpfVPP.d.ts +1 -2
- package/packages/tui/dist/index.js +1 -2
- package/packages/tui/dist/jsx-runtime-Cof-kwFn.js +1 -2
- package/packages/tui/dist/panels/CuratedPanel.d.ts +1 -2
- package/packages/tui/dist/panels/LogPanel.d.ts +1 -2
- package/packages/tui/dist/panels/LogPanel.js +1 -1
- package/packages/tui/dist/panels/SearchPanel.d.ts +1 -2
- package/packages/tui/dist/panels/StatusPanel.d.ts +1 -2
- package/packages/tui/dist/store.interface-CnY6SPOH.d.ts +1 -2
- package/scaffold/copilot/agents/Architect-Reviewer-Alpha.agent.md +7 -0
- package/scaffold/copilot/agents/Architect-Reviewer-Beta.agent.md +7 -0
- package/scaffold/copilot/agents/Documenter.agent.md +7 -0
- package/scaffold/copilot/agents/Orchestrator.agent.md +8 -0
- package/scaffold/copilot/agents/Planner.agent.md +9 -0
- package/scaffold/copilot/agents/Refactor.agent.md +6 -0
- package/scaffold/copilot/agents/Researcher-Alpha.agent.md +8 -0
- package/scaffold/copilot/agents/Researcher-Beta.agent.md +8 -0
- package/scaffold/copilot/agents/Researcher-Delta.agent.md +8 -0
- package/scaffold/copilot/agents/Researcher-Gamma.agent.md +8 -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/Documenter.agent.md +42 -0
- package/scaffold/general/agents/Orchestrator.agent.md +104 -0
- package/scaffold/general/agents/Planner.agent.md +55 -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/{copilot → general}/agents/_shared/code-agent-base.md +18 -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/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 +78 -1
- 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 -44
- package/packages/chunker/dist/treesitter-chunker.js +0 -7
- package/packages/cli/dist/commands/init.d.ts +0 -15
- package/packages/cli/dist/commands/init.js +0 -305
- package/packages/tui/dist/LogPanel-DVB8Sv46.js +0 -4
- /package/scaffold/{copilot → general}/agents/Code-Reviewer-Alpha.agent.md +0 -0
- /package/scaffold/{copilot → general}/agents/Code-Reviewer-Beta.agent.md +0 -0
- /package/scaffold/{copilot → general}/agents/Debugger.agent.md +0 -0
- /package/scaffold/{copilot → general}/agents/Explorer.agent.md +0 -0
- /package/scaffold/{copilot → general}/agents/Frontend.agent.md +0 -0
- /package/scaffold/{copilot → general}/agents/Implementer.agent.md +0 -0
- /package/scaffold/{copilot → general}/agents/README.md +0 -0
- /package/scaffold/{copilot → general}/agents/Security.agent.md +0 -0
- /package/scaffold/{copilot → general}/agents/_shared/adr-protocol.md +0 -0
- /package/scaffold/{copilot → general}/agents/_shared/architect-reviewer-base.md +0 -0
- /package/scaffold/{copilot → general}/agents/_shared/code-reviewer-base.md +0 -0
- /package/scaffold/{copilot → general}/agents/_shared/decision-protocol.md +0 -0
- /package/scaffold/{copilot → general}/agents/_shared/forge-protocol.md +0 -0
- /package/scaffold/{copilot → general}/agents/_shared/researcher-base.md +0 -0
- /package/scaffold/{copilot → general}/agents/templates/adr-template.md +0 -0
- /package/scaffold/{copilot → general}/agents/templates/execution-state.md +0 -0
- /package/scaffold/{copilot → general}/prompts/ask.prompt.md +0 -0
- /package/scaffold/{copilot → general}/prompts/debug.prompt.md +0 -0
- /package/scaffold/{copilot → general}/prompts/design.prompt.md +0 -0
- /package/scaffold/{copilot → general}/prompts/implement.prompt.md +0 -0
- /package/scaffold/{copilot → general}/prompts/plan.prompt.md +0 -0
- /package/scaffold/{copilot → general}/prompts/review.prompt.md +0 -0
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{EMBEDDING_DEFAULTS as e,SEARCH_DEFAULTS as t,STORE_DEFAULTS as n,createLogger as r,serializeError as i,sourceTypeContentTypes as a}from"../../core/dist/index.js";import{Index as o,connect as s}from"@lancedb/lancedb";function c(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}const l=/^[\w.\-/ ]+$/,u=r(`store`);function d(e,t){if(!l.test(e))throw Error(`Invalid ${t} filter value: contains disallowed characters`);return e.replace(/'/g,`''`)}var f=class{db=null;table=null;dbPath;tableName;_writeQueue=Promise.resolve();enqueueWrite(e){let t=this._writeQueue.then(()=>e());return this._writeQueue=t.then(()=>void 0,()=>void 0),t}constructor(e){this.dbPath=e?.path??n.path,this.tableName=e?.tableName??n.tableName}async initialize(){this.db=await s(this.dbPath),(await this.db.tableNames()).includes(this.tableName)&&(this.table=await this.db.openTable(this.tableName),await this.createFtsIndex())}async upsert(e,t){if(e.length!==0){if(e.length!==t.length)throw Error(`Record count (${e.length}) does not match vector count (${t.length})`);return this.enqueueWrite(()=>this._upsertImpl(e,t))}}async _upsertImpl(e,t){let n=e.map((e,n)=>({id:e.id,vector:Array.from(t[n]),content:e.content,sourcePath:e.sourcePath,contentType:e.contentType,headingPath:e.headingPath??``,chunkIndex:e.chunkIndex,totalChunks:e.totalChunks,startLine:e.startLine,endLine:e.endLine,fileHash:e.fileHash,indexedAt:e.indexedAt,origin:e.origin,tags:JSON.stringify(e.tags),category:e.category??``,version:e.version}));if(this.table){let t=[...new Set(e.map(e=>e.sourcePath))];for(let e of t)try{await this.table.delete(`sourcePath = '${d(e,`sourcePath`)}'`)}catch{}await this.table.add(n)}else try{this.table=await this.db?.createTable(this.tableName,n)??null}catch(e){if(String(e).includes(`already exists`)&&this.db)this.table=await this.db.openTable(this.tableName),await this.table.add(n);else throw e}}async search(e,n){if(!this.table)return[];let r=n?.limit??t.maxResults,i=n?.minScore??t.minScore,a=this.table.search(e).limit(r*2),o=this.buildFilterString(n);return o&&(a=a.where(o)),(await a.toArray()).map(e=>({record:this.fromLanceRecord(e),score:1-(e._distance??1)})).filter(e=>e.score>=i).slice(0,r)}async createFtsIndex(){return this.enqueueWrite(()=>this._createFtsIndexImpl())}async _createFtsIndexImpl(){if(this.table)try{await this.table.createIndex(`content`,{config:o.fts()}),u.info(`FTS index created`,{column:`content`})}catch(e){String(e).includes(`already exists`)||u.warn(`FTS index creation failed`,i(e))}}async ftsSearch(e,n){if(!this.table)return[];let r=n?.limit??t.maxResults;try{let t=this.table.search(e).limit(r*2),i=this.buildFilterString(n);return i&&(t=t.where(i)),(await t.toArray()).map(e=>({record:this.fromLanceRecord(e),score:e._score??e._relevance_score??0}))}catch(e){return u.warn(`FTS search failed`,i(e)),[]}}async getById(e){if(!this.table)return null;let t=await this.table.query().where(`id = '${d(e,`id`)}'`).limit(1).toArray();return t.length===0?null:this.fromLanceRecord(t[0])}async deleteBySourcePath(e){return this.enqueueWrite(()=>this._deleteBySourcePathImpl(e))}async _deleteBySourcePathImpl(e){if(!this.table)return 0;let t=await this.getBySourcePath(e);return t.length===0?0:(await this.table.delete(`sourcePath = '${d(e,`sourcePath`)}'`),t.length)}async deleteById(e){return this.enqueueWrite(()=>this._deleteByIdImpl(e))}async _deleteByIdImpl(e){return!this.table||!await this.getById(e)?!1:(await this.table.delete(`id = '${d(e,`id`)}'`),!0)}async getBySourcePath(e){return this.table?(await this.table.query().where(`sourcePath = '${d(e,`sourcePath`)}'`).limit(1e3).toArray()).map(e=>this.fromLanceRecord(e)):[]}async getStats(){if(!this.table)return{totalRecords:0,totalFiles:0,contentTypeBreakdown:{},lastIndexedAt:null,storeBackend:`lancedb`,embeddingModel:e.model};let t=await this.table.countRows(),n=await this.table.query().select([`sourcePath`,`contentType`,`indexedAt`]).limit(1e5).toArray(),r={},i=new Set,a=null;for(let e of n){let t=e;r[t.contentType]=(r[t.contentType]??0)+1,i.add(t.sourcePath),(!a||t.indexedAt>a)&&(a=t.indexedAt)}return{totalRecords:t,totalFiles:i.size,contentTypeBreakdown:r,lastIndexedAt:a,storeBackend:`lancedb`,embeddingModel:e.model}}async listSourcePaths(){if(!this.table)return[];let e=await this.table.query().select([`sourcePath`]).limit(1e5).toArray();return[...new Set(e.map(e=>e.sourcePath))]}async dropTable(){return this.enqueueWrite(()=>this._dropTableImpl())}async _dropTableImpl(){if(this.db&&(await this.db.tableNames()).includes(this.tableName))for(let e=1;e<=3;e++)try{await this.db.dropTable(this.tableName);break}catch(t){if(e===3)throw t;let n=e*500;u.warn(`dropTable attempt failed, retrying`,{attempt:e,delayMs:n}),await new Promise(e=>setTimeout(e,n))}this.table=null}async close(){try{this.db&&typeof this.db.close==`function`&&await this.db.close()}catch{}this.table=null,this.db=null}buildFilterString(e){let t=[];if(e?.contentType&&t.push(`contentType = '${d(e.contentType,`contentType`)}'`),e?.sourceType){let n=a(e.sourceType);if(n.length>0){let e=n.map(e=>`'${d(e,`sourceType`)}'`).join(`, `);t.push(`contentType IN (${e})`)}}if(e?.origin&&t.push(`origin = '${d(e.origin,`origin`)}'`),e?.category&&t.push(`category = '${d(e.category,`category`)}'`),e?.tags&&e.tags.length>0){let n=e.tags.map(e=>`tags LIKE '%${d(e,`tag`)}%'`);t.push(`(${n.join(` OR `)})`)}return t.length>0?t.join(` AND `):null}fromLanceRecord(e){return{id:e.id,content:e.content,sourcePath:e.sourcePath,contentType:e.contentType,headingPath:e.headingPath||void 0,chunkIndex:e.chunkIndex,totalChunks:e.totalChunks,startLine:e.startLine,endLine:e.endLine,fileHash:e.fileHash,indexedAt:e.indexedAt,origin:e.origin,tags:c(e.tags),category:e.category||void 0,version:e.version}}};export{f as LanceStore};
|
|
2
|
-
//# sourceMappingURL=lance-store.js.map
|
|
1
|
+
import{EMBEDDING_DEFAULTS as e,SEARCH_DEFAULTS as t,STORE_DEFAULTS as n,createLogger as r,serializeError as i,sourceTypeContentTypes as a}from"../../core/dist/index.js";import{Index as o,connect as s}from"@lancedb/lancedb";function c(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}const l=/^[\w.\-/ ]+$/,u=r(`store`);function d(e,t){if(!l.test(e))throw Error(`Invalid ${t} filter value: contains disallowed characters`);return e.replace(/'/g,`''`)}var f=class{db=null;table=null;dbPath;tableName;_writeQueue=Promise.resolve();enqueueWrite(e){let t=this._writeQueue.then(()=>e());return this._writeQueue=t.then(()=>void 0,()=>void 0),t}constructor(e){this.dbPath=e?.path??n.path,this.tableName=e?.tableName??n.tableName}async initialize(){this.db=await s(this.dbPath),(await this.db.tableNames()).includes(this.tableName)&&(this.table=await this.db.openTable(this.tableName),await this.createFtsIndex())}async upsert(e,t){if(e.length!==0){if(e.length!==t.length)throw Error(`Record count (${e.length}) does not match vector count (${t.length})`);return this.enqueueWrite(()=>this._upsertImpl(e,t))}}async _upsertImpl(e,t){let n=e.map((e,n)=>({id:e.id,vector:Array.from(t[n]),content:e.content,sourcePath:e.sourcePath,contentType:e.contentType,headingPath:e.headingPath??``,chunkIndex:e.chunkIndex,totalChunks:e.totalChunks,startLine:e.startLine,endLine:e.endLine,fileHash:e.fileHash,indexedAt:e.indexedAt,origin:e.origin,tags:JSON.stringify(e.tags),category:e.category??``,version:e.version}));if(this.table){let t=[...new Set(e.map(e=>e.sourcePath))];for(let e of t)try{await this.table.delete(`sourcePath = '${d(e,`sourcePath`)}'`)}catch{}await this.table.add(n)}else try{this.table=await this.db?.createTable(this.tableName,n)??null}catch(e){if(String(e).includes(`already exists`)&&this.db)this.table=await this.db.openTable(this.tableName),await this.table.add(n);else throw e}}async search(e,n){if(!this.table)return[];let r=n?.limit??t.maxResults,i=n?.minScore??t.minScore,a=this.table.search(e).limit(r*2),o=this.buildFilterString(n);return o&&(a=a.where(o)),(await a.toArray()).map(e=>({record:this.fromLanceRecord(e),score:1-(e._distance??1)})).filter(e=>e.score>=i).slice(0,r)}async createFtsIndex(){return this.enqueueWrite(()=>this._createFtsIndexImpl())}async _createFtsIndexImpl(){if(this.table)try{await this.table.createIndex(`content`,{config:o.fts()}),u.info(`FTS index created`,{column:`content`})}catch(e){String(e).includes(`already exists`)||u.warn(`FTS index creation failed`,i(e))}}async ftsSearch(e,n){if(!this.table)return[];let r=n?.limit??t.maxResults;try{let t=this.table.search(e).limit(r*2),i=this.buildFilterString(n);return i&&(t=t.where(i)),(await t.toArray()).map(e=>({record:this.fromLanceRecord(e),score:e._score??e._relevance_score??0}))}catch(e){return u.warn(`FTS search failed`,i(e)),[]}}async getById(e){if(!this.table)return null;let t=await this.table.query().where(`id = '${d(e,`id`)}'`).limit(1).toArray();return t.length===0?null:this.fromLanceRecord(t[0])}async deleteBySourcePath(e){return this.enqueueWrite(()=>this._deleteBySourcePathImpl(e))}async _deleteBySourcePathImpl(e){if(!this.table)return 0;let t=await this.getBySourcePath(e);return t.length===0?0:(await this.table.delete(`sourcePath = '${d(e,`sourcePath`)}'`),t.length)}async deleteById(e){return this.enqueueWrite(()=>this._deleteByIdImpl(e))}async _deleteByIdImpl(e){return!this.table||!await this.getById(e)?!1:(await this.table.delete(`id = '${d(e,`id`)}'`),!0)}async getBySourcePath(e){return this.table?(await this.table.query().where(`sourcePath = '${d(e,`sourcePath`)}'`).limit(1e3).toArray()).map(e=>this.fromLanceRecord(e)):[]}async getStats(){if(!this.table)return{totalRecords:0,totalFiles:0,contentTypeBreakdown:{},lastIndexedAt:null,storeBackend:`lancedb`,embeddingModel:e.model};let t=await this.table.countRows(),n=await this.table.query().select([`sourcePath`,`contentType`,`indexedAt`]).limit(1e5).toArray(),r={},i=new Set,a=null;for(let e of n){let t=e;r[t.contentType]=(r[t.contentType]??0)+1,i.add(t.sourcePath),(!a||t.indexedAt>a)&&(a=t.indexedAt)}return{totalRecords:t,totalFiles:i.size,contentTypeBreakdown:r,lastIndexedAt:a,storeBackend:`lancedb`,embeddingModel:e.model}}async listSourcePaths(){if(!this.table)return[];let e=await this.table.query().select([`sourcePath`]).limit(1e5).toArray();return[...new Set(e.map(e=>e.sourcePath))]}async dropTable(){return this.enqueueWrite(()=>this._dropTableImpl())}async _dropTableImpl(){if(this.db&&(await this.db.tableNames()).includes(this.tableName))for(let e=1;e<=3;e++)try{await this.db.dropTable(this.tableName);break}catch(t){if(e===3)throw t;let n=e*500;u.warn(`dropTable attempt failed, retrying`,{attempt:e,delayMs:n}),await new Promise(e=>setTimeout(e,n))}this.table=null}async close(){try{this.db&&typeof this.db.close==`function`&&await this.db.close()}catch{}this.table=null,this.db=null}buildFilterString(e){let t=[];if(e?.contentType&&t.push(`contentType = '${d(e.contentType,`contentType`)}'`),e?.sourceType){let n=a(e.sourceType);if(n.length>0){let e=n.map(e=>`'${d(e,`sourceType`)}'`).join(`, `);t.push(`contentType IN (${e})`)}}if(e?.origin&&t.push(`origin = '${d(e.origin,`origin`)}'`),e?.category&&t.push(`category = '${d(e.category,`category`)}'`),e?.tags&&e.tags.length>0){let n=e.tags.map(e=>`tags LIKE '%${d(e,`tag`)}%'`);t.push(`(${n.join(` OR `)})`)}return t.length>0?t.join(` AND `):null}fromLanceRecord(e){return{id:e.id,content:e.content,sourcePath:e.sourcePath,contentType:e.contentType,headingPath:e.headingPath||void 0,chunkIndex:e.chunkIndex,totalChunks:e.totalChunks,startLine:e.startLine,endLine:e.endLine,fileHash:e.fileHash,indexedAt:e.indexedAt,origin:e.origin,tags:c(e.tags),category:e.category||void 0,version:e.version}}};export{f as LanceStore};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{existsSync as
|
|
1
|
+
import{KB_PATHS as e}from"../../core/dist/index.js";import{existsSync as t,mkdirSync as n,readFileSync as r,writeFileSync as i}from"node:fs";import{dirname as a,join as o}from"node:path";var s=class{db=null;dbPath;dirty=!1;constructor(t){this.dbPath=o(t?.path??e.data,`graph.db`)}async initialize(){let e=a(this.dbPath);t(e)||n(e,{recursive:!0});let i=(await import(`sql.js`)).default,o=await i();if(t(this.dbPath)){let e=r(this.dbPath);this.db=new o.Database(e)}else this.db=new o.Database;this.db.run(`PRAGMA journal_mode = WAL`),this.db.exec(`PRAGMA foreign_keys = ON;`),this.db.run(`
|
|
2
2
|
CREATE TABLE IF NOT EXISTS nodes (
|
|
3
3
|
id TEXT PRIMARY KEY,
|
|
4
4
|
type TEXT NOT NULL,
|
|
@@ -19,7 +19,7 @@ import{existsSync as e,mkdirSync as t,readFileSync as n,writeFileSync as r}from"
|
|
|
19
19
|
FOREIGN KEY (from_id) REFERENCES nodes(id) ON DELETE CASCADE,
|
|
20
20
|
FOREIGN KEY (to_id) REFERENCES nodes(id) ON DELETE CASCADE
|
|
21
21
|
)
|
|
22
|
-
`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_type ON nodes(type)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_source_path ON nodes(source_path)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_from ON edges(from_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_to ON edges(to_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_type ON edges(type)`),this.persist()}ensureDb(){if(!this.db)throw Error(`Graph store not initialized — call initialize() first`);return this.db}persist(){if(!this.db)return;let e=this.db.export();try{
|
|
22
|
+
`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_type ON nodes(type)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_name ON nodes(name)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_nodes_source_path ON nodes(source_path)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_from ON edges(from_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_to ON edges(to_id)`),this.db.run(`CREATE INDEX IF NOT EXISTS idx_edges_type ON edges(type)`),this.persist()}ensureDb(){if(!this.db)throw Error(`Graph store not initialized — call initialize() first`);return this.db}persist(){if(!this.db)return;let e=this.db.export();try{i(this.dbPath,Buffer.from(e))}finally{this.db.exec(`PRAGMA foreign_keys = ON;`)}this.dirty=!1}markDirty(){this.dirty=!0}flushIfDirty(){this.dirty&&this.persist()}query(e,t=[]){let n=this.ensureDb().prepare(e);n.bind(t);let r=[];try{for(;n.step();)r.push(n.getAsObject())}finally{n.free()}return r}run(e,t=[]){this.ensureDb().run(e,t)}async upsertNode(e){this.run(`INSERT INTO nodes (id, type, name, properties, source_record_id, source_path, created_at)
|
|
23
23
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
24
24
|
ON CONFLICT(id) DO UPDATE SET
|
|
25
25
|
type = excluded.type, name = excluded.name, properties = excluded.properties,
|
|
@@ -31,17 +31,16 @@ import{existsSync as e,mkdirSync as t,readFileSync as n,writeFileSync as r}from"
|
|
|
31
31
|
VALUES (?, ?, ?, ?, ?, ?, ?)
|
|
32
32
|
ON CONFLICT(id) DO UPDATE SET
|
|
33
33
|
type = excluded.type, name = excluded.name, properties = excluded.properties,
|
|
34
|
-
source_record_id = excluded.source_record_id, source_path = excluded.source_path`,[t.id,t.type,t.name,JSON.stringify(t.properties),t.sourceRecordId??null,t.sourcePath??null,t.createdAt??new Date().toISOString()]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async upsertEdges(e){if(e.length===0)return;let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{for(let t of e)this.run(`INSERT INTO edges (id, from_id, to_id, type, weight, properties)
|
|
34
|
+
source_record_id = excluded.source_record_id, source_path = excluded.source_path`,[t.id,t.type,t.name,JSON.stringify(t.properties),t.sourceRecordId??null,t.sourcePath??null,t.createdAt??new Date().toISOString()]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async upsertEdges(e){if(e.length===0)return;let t=this.ensureDb();t.run(`PRAGMA foreign_keys = OFF`),t.run(`BEGIN TRANSACTION`);try{for(let t of e)this.run(`INSERT INTO edges (id, from_id, to_id, type, weight, properties)
|
|
35
35
|
VALUES (?, ?, ?, ?, ?, ?)
|
|
36
36
|
ON CONFLICT(id) DO UPDATE SET
|
|
37
37
|
from_id = excluded.from_id, to_id = excluded.to_id,
|
|
38
|
-
type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[t.id,t.fromId,t.toId,t.type,t.weight??1,JSON.stringify(t.properties??{})]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async getNode(e){let t=this.query(`SELECT * FROM nodes WHERE id = ?`,[e]);return t.length>0?
|
|
38
|
+
type = excluded.type, weight = excluded.weight, properties = excluded.properties`,[t.id,t.fromId,t.toId,t.type,t.weight??1,JSON.stringify(t.properties??{})]);t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}finally{t.run(`PRAGMA foreign_keys = ON`)}this.markDirty(),this.flushIfDirty()}async getNode(e){let t=this.query(`SELECT * FROM nodes WHERE id = ?`,[e]);return t.length>0?l(t[0]):null}async getNeighbors(e,t){let n=t?.direction??`both`,r=t?.edgeType,i=t?.limit??50,a=[],o=[],s=new Set;if(n===`outgoing`||n===`both`){let t=`
|
|
39
39
|
SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight, e.properties AS edge_props,
|
|
40
40
|
n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
|
|
41
41
|
n.source_record_id AS node_src_rec, n.source_path AS node_src_path, n.created_at AS node_created
|
|
42
|
-
FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(
|
|
42
|
+
FROM edges e JOIN nodes n ON e.to_id = n.id WHERE e.from_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(d(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(f(e)))}if(n===`incoming`||n===`both`){let t=`
|
|
43
43
|
SELECT e.id AS edge_id, e.from_id, e.to_id, e.type AS edge_type, e.weight, e.properties AS edge_props,
|
|
44
44
|
n.id AS node_id, n.type AS node_type, n.name AS node_name, n.properties AS node_props,
|
|
45
45
|
n.source_record_id AS node_src_rec, n.source_path AS node_src_path, n.created_at AS node_created
|
|
46
|
-
FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(
|
|
47
|
-
//# sourceMappingURL=sqlite-graph-store.js.map
|
|
46
|
+
FROM edges e JOIN nodes n ON e.from_id = n.id WHERE e.to_id = ?`,n=[e];r&&(t+=` AND e.type = ?`,n.push(r)),t+=` LIMIT ?`,n.push(i);let c=this.query(t,n);for(let e of c)o.push(d(e)),s.has(e.node_id)||(s.add(e.node_id),a.push(f(e)))}return{nodes:a,edges:o}}async traverse(e,t){let n=t?.maxDepth??2,r=t?.direction??`both`,i=t?.edgeType,a=t?.limit??50,o=new Map,s=new Map,c=new Set,l=[{nodeId:e,depth:0}];for(;l.length>0&&o.size<a;){let e=l.shift();if(!e||c.has(e.nodeId)||e.depth>n)continue;c.add(e.nodeId);let t=await this.getNeighbors(e.nodeId,{direction:r,edgeType:i,limit:a-o.size});for(let r of t.nodes)o.has(r.id)||(o.set(r.id,r),e.depth+1<n&&l.push({nodeId:r.id,depth:e.depth+1}));for(let e of t.edges)s.set(e.id,e)}return{nodes:[...o.values()],edges:[...s.values()]}}async findNodes(e){let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.namePattern&&(t.push(`name LIKE ?`),n.push(`%${e.namePattern}%`)),e.sourcePath&&(t.push(`source_path = ?`),n.push(e.sourcePath));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM nodes ${r} LIMIT ?`,[...n,i]).map(e=>l(e))}async findEdges(e){let t=[],n=[];e.type&&(t.push(`type = ?`),n.push(e.type)),e.fromId&&(t.push(`from_id = ?`),n.push(e.fromId)),e.toId&&(t.push(`to_id = ?`),n.push(e.toId));let r=t.length>0?`WHERE ${t.join(` AND `)}`:``,i=e.limit??100;return this.query(`SELECT * FROM edges ${r} LIMIT ?`,[...n,i]).map(e=>u(e))}async deleteNode(e){let t=this.ensureDb();t.run(`BEGIN TRANSACTION`);try{this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e,e]),this.run(`DELETE FROM nodes WHERE id = ?`,[e]),t.run(`COMMIT`)}catch(e){throw t.run(`ROLLBACK`),e}this.markDirty(),this.flushIfDirty()}async deleteBySourcePath(e){let t=this.query(`SELECT id FROM nodes WHERE source_path = ?`,[e]);if(t.length===0)return 0;let n=this.ensureDb();n.run(`BEGIN TRANSACTION`);try{for(let e of t)this.run(`DELETE FROM edges WHERE from_id = ? OR to_id = ?`,[e.id,e.id]);this.run(`DELETE FROM nodes WHERE source_path = ?`,[e]),n.run(`COMMIT`)}catch(e){throw n.run(`ROLLBACK`),e}return this.markDirty(),this.flushIfDirty(),t.length}async clear(){this.run(`DELETE FROM edges`),this.run(`DELETE FROM nodes`),this.markDirty(),this.flushIfDirty()}async getStats(){let e=this.query(`SELECT COUNT(*) as count FROM nodes`)[0]?.count??0,t=this.query(`SELECT COUNT(*) as count FROM edges`)[0]?.count??0,n=this.query(`SELECT type, COUNT(*) as count FROM nodes GROUP BY type`),r={};for(let e of n)r[e.type]=e.count;let i=this.query(`SELECT type, COUNT(*) as count FROM edges GROUP BY type`),a={};for(let e of i)a[e.type]=e.count;return{nodeCount:e,edgeCount:t,nodeTypes:r,edgeTypes:a}}async close(){this.db&&=(this.flushIfDirty(),this.db.close(),null)}};function c(e){if(!e)return{};try{return JSON.parse(e)}catch{return{}}}function l(e){return{id:e.id,type:e.type,name:e.name,properties:c(e.properties),sourceRecordId:e.source_record_id??void 0,sourcePath:e.source_path??void 0,createdAt:e.created_at}}function u(e){return{id:e.id,fromId:e.from_id,toId:e.to_id,type:e.type,weight:e.weight??1,properties:c(e.properties)}}function d(e){return{id:e.edge_id,fromId:e.from_id,toId:e.to_id,type:e.edge_type,weight:e.weight??1,properties:c(e.edge_props??`{}`)}}function f(e){return{id:e.node_id,type:e.node_type,name:e.node_name,properties:c(e.node_props??`{}`),sourceRecordId:e.node_src_rec??void 0,sourcePath:e.node_src_path??void 0,createdAt:e.node_created}}export{s as SqliteGraphStore};
|
|
@@ -9,5 +9,4 @@ interface StoreConfig {
|
|
|
9
9
|
}
|
|
10
10
|
declare function createStore(config: StoreConfig): Promise<IKnowledgeStore>;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { StoreBackend, StoreConfig, createStore };
|
|
13
|
-
//# sourceMappingURL=store-factory.d.ts.map
|
|
12
|
+
export { StoreBackend, StoreConfig, createStore };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
async function e(e){switch(e.backend){case`lancedb`:{let{LanceStore:t}=await import(`./lance-store.js`);return new t({path:e.path})}default:throw Error(`Unknown store backend: "${e.backend}". Supported: lancedb`)}}export{e as createStore};
|
|
2
|
-
//# sourceMappingURL=store-factory.js.map
|
|
1
|
+
async function e(e){switch(e.backend){case`lancedb`:{let{LanceStore:t}=await import(`./lance-store.js`);return new t({path:e.path})}default:throw Error(`Unknown store backend: "${e.backend}". Supported: lancedb`)}}export{e as createStore};
|
|
@@ -62,5 +62,4 @@ interface AuditData {
|
|
|
62
62
|
}
|
|
63
63
|
declare function audit(store: IKnowledgeStore, embedder: IEmbedder, options?: AuditOptions): Promise<KBResponse<AuditData>>;
|
|
64
64
|
//#endregion
|
|
65
|
-
export { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit };
|
|
66
|
-
//# sourceMappingURL=audit.d.ts.map
|
|
65
|
+
export { AuditCheck, AuditData, AuditOptions, AuditRecommendation, audit };
|
|
@@ -3,5 +3,4 @@ import{check as e,summarizeCheckResult as t}from"./check.js";import{findDeadSymb
|
|
|
3
3
|
`);for(let t of e.recommendations){let e=t.priority===`high`?`🔴`:t.priority===`medium`?`🟡`:`🟢`;n.push(`${e} **${t.area}:** ${t.message}`)}}if(t===`full`&&e.patterns&&e.patterns.length>0){n.push(`
|
|
4
4
|
### Patterns Detected
|
|
5
5
|
`),n.push(`| Pattern | Confidence | Count |`),n.push(`|---------|-----------|-------|`);for(let t of e.patterns)n.push(`| ${t.name} | ${t.confidence} | ${t.count} |`)}return n.join(`
|
|
6
|
-
`)}export{f as audit};
|
|
7
|
-
//# sourceMappingURL=audit.js.map
|
|
6
|
+
`)}export{f as audit};
|
|
@@ -20,5 +20,4 @@ interface BatchOptions {
|
|
|
20
20
|
}
|
|
21
21
|
declare function batch(operations: BatchOperation[], executor: (op: BatchOperation) => Promise<unknown>, options?: BatchOptions): Promise<BatchResult[]>;
|
|
22
22
|
//#endregion
|
|
23
|
-
export { BatchOperation, BatchOptions, BatchResult, batch };
|
|
24
|
-
//# sourceMappingURL=batch.d.ts.map
|
|
23
|
+
export { BatchOperation, BatchOptions, BatchResult, batch };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
async function e(e,t,n={}){let r=Math.max(1,n.concurrency??4),i=[],a=[...e];async function o(e){let n=Date.now();try{let r=await t(e);return{id:e.id,status:`success`,result:r,durationMs:Date.now()-n}}catch(t){return{id:e.id,status:`error`,error:t instanceof Error?t.message:String(t),durationMs:Date.now()-n}}}for(;a.length>0;){let e=a.splice(0,r),t=await Promise.allSettled(e.map(e=>o(e)));for(let e of t){if(e.status===`fulfilled`){i.push(e.value);continue}i.push({id:`unknown`,status:`error`,error:e.reason instanceof Error?e.reason.message:`Promise rejected`,durationMs:0})}}return i}export{e as batch};
|
|
2
|
-
//# sourceMappingURL=batch.js.map
|
|
1
|
+
async function e(e,t,n={}){let r=Math.max(1,n.concurrency??4),i=[],a=[...e];async function o(e){let n=Date.now();try{let r=await t(e);return{id:e.id,status:`success`,result:r,durationMs:Date.now()-n}}catch(t){return{id:e.id,status:`error`,error:t instanceof Error?t.message:String(t),durationMs:Date.now()-n}}}for(;a.length>0;){let e=a.splice(0,r),t=await Promise.allSettled(e.map(e=>o(e)));for(let e of t){if(e.status===`fulfilled`){i.push(e.value);continue}i.push({id:`unknown`,status:`error`,error:e.reason instanceof Error?e.reason.message:`Promise rejected`,durationMs:0})}}return i}export{e as batch};
|
|
@@ -33,5 +33,4 @@ declare function changelog(options: ChangelogOptions): ChangelogResult;
|
|
|
33
33
|
/** Exported for testing */
|
|
34
34
|
declare function formatChangelog(entries: ChangelogEntry[], format: ChangelogFormat, includeBreaking: boolean): string;
|
|
35
35
|
//#endregion
|
|
36
|
-
export { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog };
|
|
37
|
-
//# sourceMappingURL=changelog.d.ts.map
|
|
36
|
+
export { ChangelogEntry, ChangelogFormat, ChangelogOptions, ChangelogResult, changelog, formatChangelog };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`)}export{n as changelog,r as formatChangelog};
|
|
3
|
-
//# sourceMappingURL=changelog.js.map
|
|
1
|
+
import{execFileSync as e}from"node:child_process";const t=/^[a-zA-Z0-9_./\-~^@{}]+$/;function n(n){let{from:i,to:a=`HEAD`,format:o=`grouped`,includeBreaking:s=!0,cwd:c=process.cwd()}=n;if(!t.test(i))throw Error(`Invalid git ref: ${i}`);if(!t.test(a))throw Error(`Invalid git ref: ${a}`);let l;try{l=e(`git`,[`log`,`${i}..${a}`,`--format=%H%s%b%an%ai`],{cwd:c,encoding:`utf8`,maxBuffer:10*1024*1024,timeout:3e4})}catch{throw Error(`Git log failed. Ensure "${i}" and "${a}" are valid refs.`)}let u=l.split(``).map(e=>e.trim()).filter(Boolean).map(e=>{let[t=``,n=``,r=``,i=``,a=``]=e.split(``),o=n.match(/^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.+)/);return{hash:t.slice(0,8),type:o?.[1]??`other`,scope:o?.[2]??``,subject:o?.[4]??n,body:r.trim(),author:i.trim(),date:a.trim().split(` `)[0],breaking:!!(o?.[3]||/BREAKING[\s-]CHANGE/i.test(r))}}),d={},f=0;for(let e of u)d[e.type]=(d[e.type]??0)+1,e.breaking&&f++;return{entries:u,markdown:r(u,o,s),stats:{total:u.length,breaking:f,types:d}}}function r(e,t,n){let r=[`# Changelog`,``];if(n){let t=e.filter(e=>e.breaking);if(t.length>0){r.push(`## Breaking Changes`,``);for(let e of t)r.push(`- ${e.subject} (${e.hash})`);r.push(``)}}if(t===`grouped`){let t={};for(let n of e)t[n.type]||(t[n.type]=[]),t[n.type].push(n);let n=[`feat`,`fix`,`refactor`,`perf`,`test`,`docs`,`chore`],i={feat:`Features`,fix:`Bug Fixes`,refactor:`Refactoring`,perf:`Performance`,test:`Tests`,docs:`Documentation`,chore:`Chores`,other:`Other`};for(let e of[...n,...Object.keys(t).filter(e=>!n.includes(e))])if(t[e]?.length){r.push(`## ${i[e]??e}`,``);for(let n of t[e]){let e=n.scope?`**${n.scope}:** `:``;r.push(`- ${e}${n.subject} (${n.hash})`)}r.push(``)}}else if(t===`chronological`)for(let t of e){let e=t.scope?`(${t.scope}) `:``;r.push(`- \`${t.date}\` ${t.type}: ${e}${t.subject} (${t.hash})`)}else{let t={};for(let n of e){let e=n.scope||`general`;t[e]||(t[e]=[]),t[e].push(n)}for(let[e,n]of Object.entries(t)){r.push(`## ${e}`,``);for(let e of n)r.push(`- ${e.type}: ${e.subject} (${e.hash})`);r.push(``)}}return r.join(`
|
|
2
|
+
`)}export{n as changelog,r as formatChangelog};
|
|
@@ -45,5 +45,4 @@ declare function check(options?: CheckOptions): Promise<CheckResult>;
|
|
|
45
45
|
/** Produce a minimal summary for LLM consumption (~300 tokens) */
|
|
46
46
|
declare function summarizeCheckResult(result: CheckResult): CheckSummaryResult;
|
|
47
47
|
//#endregion
|
|
48
|
-
export { CheckOptions, CheckResult, CheckSummaryResult, check, summarizeCheckResult };
|
|
49
|
-
//# sourceMappingURL=check.d.ts.map
|
|
48
|
+
export { CheckOptions, CheckResult, CheckSummaryResult, check, summarizeCheckResult };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import{parseBiome as e,parseTsc as t}from"./parse-output.js";import{
|
|
2
|
-
`).trim()||t.message||`Command failed`}async function l(e={}){if(s>=2)throw Error(`Too many concurrent check runs (max 2). Try again later.`);s++;try{return await u(e)}finally{s--}}async function u(n){let a=n.cwd??process.cwd(),s={errors:[],passed:!0,raw:``},l={errors:[],passed:!0,raw:``};if(!n.skipTypes)try{let e=i(a,`package.json`),t=!1;try{t=!!JSON.parse(await r(e,`utf-8`)).scripts?.typecheck}catch{}if(t&&!n.files?.length)await o(`npx
|
|
3
|
-
//# sourceMappingURL=check.js.map
|
|
1
|
+
import{parseBiome as e,parseTsc as t}from"./parse-output.js";import{exec as n}from"node:child_process";import{readFile as r}from"node:fs/promises";import{join as i}from"node:path";import{promisify as a}from"node:util";const o=a(n);let s=0;function c(e){let t=e;return[t.stdout?.toString()??``,t.stderr?.toString()??``].filter(Boolean).join(`
|
|
2
|
+
`).trim()||t.message||`Command failed`}async function l(e={}){if(s>=2)throw Error(`Too many concurrent check runs (max 2). Try again later.`);s++;try{return await u(e)}finally{s--}}async function u(n){let a=n.cwd??process.cwd(),s={errors:[],passed:!0,raw:``},l={errors:[],passed:!0,raw:``};if(!n.skipTypes)try{let e=i(a,`package.json`),t=!1;try{t=!!JSON.parse(await r(e,`utf-8`)).scripts?.typecheck}catch{}if(t&&!n.files?.length)await o(`npx turbo run typecheck`,{cwd:a,timeout:12e4});else{let e=[`--noEmit`];n.files?.length&&e.push(...n.files),await o(`npx tsc ${e.join(` `)}`,{cwd:a,timeout:12e4})}}catch(e){s.raw=c(e),s.errors=t(s.raw),s.passed=s.errors.length===0}if(!n.skipLint)try{let e=[`check`];n.files?.length&&e.push(...n.files),await o(`npx biome ${e.join(` `)}`,{cwd:a,timeout:12e4})}catch(t){l.raw=c(t),l.errors=e(l.raw),l.passed=l.errors.length===0}let u=n.detail??`full`,d={tsc:s,biome:l,passed:s.passed&&l.passed};return u===`full`?d:u===`errors`?{tsc:{errors:s.errors,passed:s.passed},biome:{errors:l.errors,passed:l.passed},passed:d.passed}:d}function d(e){let t=e.tsc.errors.filter(e=>e.severity===`error`),n=e.tsc.errors.filter(e=>e.severity===`warning`),r=e.biome.errors.filter(e=>e.severity===`error`),i=e.biome.errors.filter(e=>e.severity===`warning`);return{passed:e.passed,tsc:{passed:e.tsc.passed,errorCount:t.length,warningCount:n.length,topErrors:t.slice(0,3).map(e=>`${e.file}:${e.line} — ${e.message}`)},biome:{passed:e.biome.passed,errorCount:r.length,warningCount:i.length,topErrors:r.slice(0,3).map(e=>`${e.file}:${e.line} — ${e.message}`)}}}export{l as check,d as summarizeCheckResult};
|
|
@@ -16,5 +16,4 @@ declare function checkpointLoad(id: string, cwd?: string): Checkpoint | undefine
|
|
|
16
16
|
declare function checkpointList(cwd?: string): Checkpoint[];
|
|
17
17
|
declare function checkpointLatest(cwd?: string): Checkpoint | undefined;
|
|
18
18
|
//#endregion
|
|
19
|
-
export { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave };
|
|
20
|
-
//# sourceMappingURL=checkpoint.d.ts.map
|
|
19
|
+
export { Checkpoint, checkpointLatest, checkpointList, checkpointLoad, checkpointSave };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{resolve as e}from"node:path";import{existsSync as t,mkdirSync as n,readFileSync as r,readdirSync as i,writeFileSync as a}from"node:fs";function
|
|
2
|
-
//# sourceMappingURL=checkpoint.js.map
|
|
1
|
+
import{resolve as e}from"node:path";import{existsSync as t,mkdirSync as n,readFileSync as r,readdirSync as i,writeFileSync as a}from"node:fs";import{KB_PATHS as o}from"../../core/dist/index.js";const s=`${o.state}/checkpoints`;function c(r){let i=e(r??process.cwd(),s);return t(i)||n(i,{recursive:!0}),i}function l(t,n,r){let i=t.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)||`checkpoint`,o={id:`${Date.now()}-${i}`,label:t,createdAt:new Date().toISOString(),data:n,files:r?.files,notes:r?.notes};return a(e(c(r?.cwd),`${o.id}.json`),`${JSON.stringify(o,null,2)}\n`,`utf-8`),o}function u(n,i){let a=e(c(i),`${n}.json`);if(t(a))try{return JSON.parse(r(a,`utf-8`))}catch{return}}function d(t){let n=c(t);return i(n).filter(e=>e.endsWith(`.json`)).flatMap(t=>{try{return[JSON.parse(r(e(n,t),`utf-8`))]}catch{return[]}}).sort((e,t)=>t.createdAt.localeCompare(e.createdAt))}function f(e){return d(e)[0]}export{f as checkpointLatest,d as checkpointList,u as checkpointLoad,l as checkpointSave};
|
|
@@ -36,5 +36,4 @@ interface CodemodResult {
|
|
|
36
36
|
}
|
|
37
37
|
declare function codemod(options: CodemodOptions): Promise<CodemodResult>;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { CodemodChange, CodemodOptions, CodemodResult, CodemodRule, codemod };
|
|
40
|
-
//# sourceMappingURL=codemod.d.ts.map
|
|
39
|
+
export { CodemodChange, CodemodOptions, CodemodResult, CodemodRule, codemod };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import{DEFAULT_TOOL_EXTENSIONS as e,matchesGlobPattern as t,walkFiles as n}from"./file-walk.js";import{readFile as r,writeFile as i}from"node:fs/promises";import{relative as a}from"node:path";function o(e){return e.replace(/\\/g,`/`)}async function s(s){let{rootPath:c,rules:l,extensions:u=e,exclude:d=[],dryRun:f=!1}=s,p=l.map(e=>({...e,regex:new RegExp(e.pattern,`g`)})),m=await n(c,u,d),h=[],g=new Set,_=0;for(let e of m){let n=o(a(c,e)),s=(await r(e,`utf-8`)).split(/\r?\n/),l=!1;for(let[e,r]of p.entries())if(!(r.fileFilter&&!t(n,r.fileFilter)))for(let t=0;t<s.length;t++){let i=s[t];r.regex.lastIndex=0;let a=i.replace(r.regex,r.replacement);i!==a&&(s[t]=a,l=!0,g.add(e),h.push({rule:r.description,path:n,line:t+1,before:i,after:a}))}l&&(_+=1,f||await i(e,s.join(`
|
|
2
|
-
`),`utf-8`))}return{changes:h,rulesApplied:g.size,filesModified:_,dryRun:f}}export{s as codemod};
|
|
3
|
-
//# sourceMappingURL=codemod.js.map
|
|
2
|
+
`),`utf-8`))}return{changes:h,rulesApplied:g.size,filesModified:_,dryRun:f}}export{s as codemod};
|
|
@@ -36,5 +36,4 @@ interface CompactResult {
|
|
|
36
36
|
*/
|
|
37
37
|
declare function compact(embedder: IEmbedder, options: CompactOptions): Promise<CompactResult>;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { CompactOptions, CompactResult, compact };
|
|
40
|
-
//# sourceMappingURL=compact.d.ts.map
|
|
39
|
+
export { CompactOptions, CompactResult, compact };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import{cosineSimilarity as e,segment as t}from"./text-utils.js";import{readFile as n}from"node:fs/promises";async function r(r,i){let{query:a,maxChars:o=3e3,minScore:s=.3,segmentation:c=`paragraph`}=i,l;if(i.text)l=i.text;else if(i.path)l=i.cache?(await i.cache.get(i.path)).content:await n(i.path,`utf-8`);else throw Error(`Either "text" or "path" must be provided`);if(l.length<=o)return{text:l,originalChars:l.length,compressedChars:l.length,ratio:1,segmentsKept:1,segmentsTotal:1};let u=t(l,c);if(u.length===0)return{text:``,originalChars:l.length,compressedChars:0,ratio:0,segmentsKept:0,segmentsTotal:0};let d=await r.embed(a),f=[];for(let t=0;t<u.length;t++){let n=e(d,await r.embed(u[t]));f.push({text:u[t],score:n,index:t})}let p=f.filter(e=>e.score>=s).sort((e,t)=>t.score-e.score),m=[],h=0;for(let e of p){if(h+e.text.length>o){h===0&&(m.push({...e,text:e.text.slice(0,o)}),h=o);break}m.push(e),h+=e.text.length+2}m.sort((e,t)=>e.index-t.index);let g=m.map(e=>e.text).join(`
|
|
2
2
|
|
|
3
|
-
`);return{text:g,originalChars:l.length,compressedChars:g.length,ratio:g.length/l.length,segmentsKept:m.length,segmentsTotal:u.length}}export{r as compact};
|
|
4
|
-
//# sourceMappingURL=compact.js.map
|
|
3
|
+
`);return{text:g,originalChars:l.length,compressedChars:g.length,ratio:g.length/l.length,segmentsKept:m.length,segmentsTotal:u.length}}export{r as compact};
|
|
@@ -9,5 +9,4 @@ interface TransformResult {
|
|
|
9
9
|
}
|
|
10
10
|
declare function dataTransform(options: TransformOptions): TransformResult;
|
|
11
11
|
//#endregion
|
|
12
|
-
export { TransformOptions, TransformResult, dataTransform };
|
|
13
|
-
//# sourceMappingURL=data-transform.d.ts.map
|
|
12
|
+
export { TransformOptions, TransformResult, dataTransform };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
function e(e){let{input:o,expression:s}=e,c;if(typeof o==`string`)try{c=JSON.parse(o)}catch{throw Error(`Invalid JSON input`)}else c=o;let l;if(s===`.`)l=c;else if(s===`keys`)l=Object.keys(a(c));else if(s===`values`)l=Object.values(a(c));else if(s===`length`)l=Array.isArray(c)?c.length:Object.keys(a(c)).length;else if(s===`flatten`)l=i(c).flat();else if(s===`unique`)l=[...new Set(i(c))];else if(s===`sort`)l=[...i(c)].sort();else if(s===`reverse`)l=[...i(c)].reverse();else if(s.startsWith(`.`))l=r(c,s.slice(1));else if(s.startsWith(`map(`)&&s.endsWith(`)`)){let e=s.slice(4,-1).trim(),t=e.startsWith(`.`)?e.slice(1):e;l=i(c).map(e=>r(e,t))}else if(s.startsWith(`select(`)&&s.endsWith(`)`))l=t(i(c),s.slice(7,-1).trim());else if(s.startsWith(`group_by(`)&&s.endsWith(`)`)){let e=s.slice(9,-1).trim().replace(/^\./,``),t={};for(let n of i(c)){let i=String(r(n,e)??`null`);t[i]||(t[i]=[]),t[i].push(n)}l=t}else if(s.startsWith(`pick(`)&&s.endsWith(`)`)){let e=s.slice(5,-1).split(`,`).map(e=>e.trim().replace(/^\./,``)).filter(Boolean);l=Array.isArray(c)?i(c).map(t=>n(t,e)):n(c,e)}else throw Error(`Unsupported expression: ${s}. Supported: ., .path.to.field, keys, values, length, flatten, unique, sort, reverse, map(.field), select(.field == | != | > | < | >= | <= "value"), group_by(.field), pick(.a, .b)`);return{output:l,outputString:typeof l==`string`?l:JSON.stringify(l,null,2)??`null`}}function t(e,t){let n=t.match(/^\.?([\w.[\]]+)\s*(==|!=|>=|<=|>|<)\s*"?([^"]*)"?$/);if(!n)throw Error(`Unsupported select expression: ${t}`);let[,i,a,o]=n;return e.filter(e=>{let t=r(e,i),n=String(t);switch(a){case`==`:return n===o;case`!=`:return n!==o;case`>`:case`<`:case`>=`:case`<=`:{let e=Number(t),n=Number(o);return Number.isNaN(e)||Number.isNaN(n)?!1:a===`>`?e>n:a===`<`?e<n:a===`>=`?e>=n:e<=n}default:return!1}})}function n(e,t){let n={};for(let i of t)n[i]=r(e,i);return n}function r(e,t){if(!t)return e;let n=[...t.matchAll(/([^.[\]]+)|\[(\d+)\]/g)].map(e=>e[1]??Number.parseInt(e[2],10)),r=e;for(let e of n){if(r==null)return;if(typeof e==`number`){if(!Array.isArray(r))return;r=r[e];continue}if(typeof r!=`object`)return;r=r[e]}return r}function i(e){if(!Array.isArray(e))throw Error(`Operation requires an array input.`);return e}function a(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Operation requires an object input.`);return e}export{e as dataTransform};
|
|
2
|
-
//# sourceMappingURL=data-transform.js.map
|
|
1
|
+
function e(e){let{input:o,expression:s}=e,c;if(typeof o==`string`)try{c=JSON.parse(o)}catch{throw Error(`Invalid JSON input`)}else c=o;let l;if(s===`.`)l=c;else if(s===`keys`)l=Object.keys(a(c));else if(s===`values`)l=Object.values(a(c));else if(s===`length`)l=Array.isArray(c)?c.length:Object.keys(a(c)).length;else if(s===`flatten`)l=i(c).flat();else if(s===`unique`)l=[...new Set(i(c))];else if(s===`sort`)l=[...i(c)].sort();else if(s===`reverse`)l=[...i(c)].reverse();else if(s.startsWith(`.`))l=r(c,s.slice(1));else if(s.startsWith(`map(`)&&s.endsWith(`)`)){let e=s.slice(4,-1).trim(),t=e.startsWith(`.`)?e.slice(1):e;l=i(c).map(e=>r(e,t))}else if(s.startsWith(`select(`)&&s.endsWith(`)`))l=t(i(c),s.slice(7,-1).trim());else if(s.startsWith(`group_by(`)&&s.endsWith(`)`)){let e=s.slice(9,-1).trim().replace(/^\./,``),t={};for(let n of i(c)){let i=String(r(n,e)??`null`);t[i]||(t[i]=[]),t[i].push(n)}l=t}else if(s.startsWith(`pick(`)&&s.endsWith(`)`)){let e=s.slice(5,-1).split(`,`).map(e=>e.trim().replace(/^\./,``)).filter(Boolean);l=Array.isArray(c)?i(c).map(t=>n(t,e)):n(c,e)}else throw Error(`Unsupported expression: ${s}. Supported: ., .path.to.field, keys, values, length, flatten, unique, sort, reverse, map(.field), select(.field == | != | > | < | >= | <= "value"), group_by(.field), pick(.a, .b)`);return{output:l,outputString:typeof l==`string`?l:JSON.stringify(l,null,2)??`null`}}function t(e,t){let n=t.match(/^\.?([\w.[\]]+)\s*(==|!=|>=|<=|>|<)\s*"?([^"]*)"?$/);if(!n)throw Error(`Unsupported select expression: ${t}`);let[,i,a,o]=n;return e.filter(e=>{let t=r(e,i),n=String(t);switch(a){case`==`:return n===o;case`!=`:return n!==o;case`>`:case`<`:case`>=`:case`<=`:{let e=Number(t),n=Number(o);return Number.isNaN(e)||Number.isNaN(n)?!1:a===`>`?e>n:a===`<`?e<n:a===`>=`?e>=n:e<=n}default:return!1}})}function n(e,t){let n={};for(let i of t)n[i]=r(e,i);return n}function r(e,t){if(!t)return e;let n=[...t.matchAll(/([^.[\]]+)|\[(\d+)\]/g)].map(e=>e[1]??Number.parseInt(e[2],10)),r=e;for(let e of n){if(r==null)return;if(typeof e==`number`){if(!Array.isArray(r))return;r=r[e];continue}if(typeof r!=`object`)return;r=r[e]}return r}function i(e){if(!Array.isArray(e))throw Error(`Operation requires an array input.`);return e}function a(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Operation requires an object input.`);return e}export{e as dataTransform};
|
|
@@ -29,5 +29,4 @@ interface DeadSymbolResult {
|
|
|
29
29
|
}
|
|
30
30
|
declare function findDeadSymbols(embedder: IEmbedder, store: IKnowledgeStore, options?: DeadSymbolOptions): Promise<DeadSymbolResult>;
|
|
31
31
|
//#endregion
|
|
32
|
-
export { DeadSymbol, DeadSymbolOptions, DeadSymbolResult, findDeadSymbols };
|
|
33
|
-
//# sourceMappingURL=dead-symbols.d.ts.map
|
|
32
|
+
export { DeadSymbol, DeadSymbolOptions, DeadSymbolResult, findDeadSymbols };
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`).length-1,a=t.slice(r).match(/export\s+(?:async\s+)?(\w+)/);
|
|
3
|
-
//# sourceMappingURL=dead-symbols.js.map
|
|
1
|
+
import{readFile as e}from"node:fs/promises";import{extname as t}from"node:path";import{SUPPORTED_EXTENSIONS as n,WasmRuntime as r,extractSymbols as i}from"../../chunker/dist/index.js";const a=new Set([`.md`,`.mdx`]);async function o(o,l,u={}){let{rootPath:d,limit:f=100}=u,p=await o.embed(`export function class const type interface enum`),m=await l.search(p,{limit:f*3}),h=/^export\s+(?:async\s+)?(?:function|class|const|let|interface|type|enum)\s+(\w+)/gm,g=[],_=new Map;for(let e of m){if(!c(e.record.sourcePath,d))continue;let t=_.get(e.record.sourcePath)??[];t.push(e),_.set(e.record.sourcePath,t)}let v=new Set;if(r.get())for(let[r]of _){let a=t(r);if(n.has(a))try{let t=await i(await e(r,`utf-8`),a,r);for(let e of t)e.exported&&g.push({name:e.name,path:r,line:e.line,kind:e.kind});v.add(r)}catch{}}for(let[e,t]of _)if(!v.has(e))for(let e of t){let t=e.record.content;h.lastIndex=0;for(let n of t.matchAll(h)){let r=n.index??0,i=t.slice(0,r).split(`
|
|
2
|
+
`).length-1,a=t.slice(r).match(/export\s+(?:async\s+)?(\w+)/);g.push({name:n[1],path:e.record.sourcePath,line:e.record.startLine+i,kind:a?.[1]??`unknown`})}}let y=new Map;for(let e of g){let t=`${e.path}:${e.name}`;y.has(t)||y.set(t,e)}let b=[];for(let e of y.values()){let t=s(e.name),n=RegExp(`import\\s+.*\\b${t}\\b.*from`,`m`),r=RegExp(`export\\s+\\{[^}]*\\b${t}\\b`,`m`),i=await l.ftsSearch(`import ${e.name}`,{limit:10}),a=i.some(t=>t.record.sourcePath!==e.path&&n.test(t.record.content)),o=i.some(t=>t.record.sourcePath!==e.path&&r.test(t.record.content));!a&&!o&&b.push(e)}let x=(e,t)=>e.path===t.path?e.line-t.line:e.path.localeCompare(t.path),S=[],C=[];for(let e of b){let n=t(e.path).toLowerCase();a.has(n)?C.push(e):S.push(e)}return S.sort(x),C.sort(x),{deadInSource:S,deadInDocs:C,totalExports:y.size,totalDeadSource:S.length,totalDeadDocs:C.length,deadSymbols:[...S,...C],totalDead:S.length+C.length}}function s(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function c(e,t){if(!t)return!0;let n=l(t).replace(/\/+$/,``),r=l(e);return r===n||r.startsWith(`${n}/`)}function l(e){return e.replace(/\\/g,`/`).replace(/^\.\//,``)}export{o as findDeadSymbols};
|
|
@@ -33,5 +33,4 @@ declare function delegateListModels(baseUrl?: string): Promise<string[]>;
|
|
|
33
33
|
*/
|
|
34
34
|
declare function delegate(options: DelegateOptions): Promise<DelegateResult>;
|
|
35
35
|
//#endregion
|
|
36
|
-
export { DelegateOptions, DelegateResult, delegate, delegateListModels };
|
|
37
|
-
//# sourceMappingURL=delegate.d.ts.map
|
|
36
|
+
export { DelegateOptions, DelegateResult, delegate, delegateListModels };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{request as e}from"node:http";const t=`http://localhost:11434`;async function n(e=t){let n=await i(`${e}/api/tags`),r;try{r=JSON.parse(n)}catch{throw Error(`Ollama returned invalid JSON`)}return(r.models??[]).map(e=>e.name)}async function r(e){let r=e.baseUrl??t,i=e.timeout??12e4,o;try{o=await n(r)}catch{return{model:e.model??`unknown`,response:``,durationMs:0,error:`Ollama is not running at ${r}. Start it with: ollama serve`}}if(o.length===0)return{model:`none`,response:``,durationMs:0,error:`No Ollama models available. Pull one with: ollama pull qwen2.5-coder:7b`};let s=e.model??o[0];if(!o.includes(s))return{model:s,response:``,durationMs:0,error:`Model "${s}" not found. Available: ${o.join(`, `)}`};let c=``;e.context&&(c+=`<context>\n${e.context}\n</context>\n\n`),c+=e.prompt;let l=Date.now(),u=JSON.stringify({model:s,prompt:c,system:e.system,stream:!1,options:{temperature:e.temperature??.3}});try{let e=await a(`${r}/api/generate`,u,i),t=JSON.parse(e);return t.error?{model:s,response:``,durationMs:Date.now()-l,error:t.error}:{model:s,response:(t.response??``).trim(),durationMs:Date.now()-l,tokenCount:t.eval_count}}catch(e){return{model:s,response:``,durationMs:Date.now()-l,error:e instanceof Error?e.message:String(e)}}}function i(t){return new Promise((n,r)=>{let i=new URL(t),a=e({hostname:i.hostname,port:i.port,path:i.pathname,method:`GET`,timeout:5e3},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>n(Buffer.concat(t).toString(`utf-8`)))});a.on(`error`,r),a.on(`timeout`,()=>{a.destroy(),r(Error(`Connection timeout`))}),a.end()})}function a(t,n,r){return new Promise((i,a)=>{let o=new URL(t),s=e({hostname:o.hostname,port:o.port,path:o.pathname,method:`POST`,headers:{"Content-Type":`application/json`,"Content-Length":Buffer.byteLength(n)},timeout:r},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>i(Buffer.concat(t).toString(`utf-8`)))});s.on(`error`,a),s.on(`timeout`,()=>{s.destroy(),a(Error(`Ollama request timed out after ${r}ms`))}),s.write(n),s.end()})}export{r as delegate,n as delegateListModels};
|
|
2
|
-
//# sourceMappingURL=delegate.js.map
|
|
1
|
+
import{request as e}from"node:http";const t=`http://localhost:11434`;async function n(e=t){let n=await i(`${e}/api/tags`),r;try{r=JSON.parse(n)}catch{throw Error(`Ollama returned invalid JSON`)}return(r.models??[]).map(e=>e.name)}async function r(e){let r=e.baseUrl??t,i=e.timeout??12e4,o;try{o=await n(r)}catch{return{model:e.model??`unknown`,response:``,durationMs:0,error:`Ollama is not running at ${r}. Start it with: ollama serve`}}if(o.length===0)return{model:`none`,response:``,durationMs:0,error:`No Ollama models available. Pull one with: ollama pull qwen2.5-coder:7b`};let s=e.model??o[0];if(!o.includes(s))return{model:s,response:``,durationMs:0,error:`Model "${s}" not found. Available: ${o.join(`, `)}`};let c=``;e.context&&(c+=`<context>\n${e.context}\n</context>\n\n`),c+=e.prompt;let l=Date.now(),u=JSON.stringify({model:s,prompt:c,system:e.system,stream:!1,options:{temperature:e.temperature??.3}});try{let e=await a(`${r}/api/generate`,u,i),t=JSON.parse(e);return t.error?{model:s,response:``,durationMs:Date.now()-l,error:t.error}:{model:s,response:(t.response??``).trim(),durationMs:Date.now()-l,tokenCount:t.eval_count}}catch(e){return{model:s,response:``,durationMs:Date.now()-l,error:e instanceof Error?e.message:String(e)}}}function i(t){return new Promise((n,r)=>{let i=new URL(t),a=e({hostname:i.hostname,port:i.port,path:i.pathname,method:`GET`,timeout:5e3},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>n(Buffer.concat(t).toString(`utf-8`)))});a.on(`error`,r),a.on(`timeout`,()=>{a.destroy(),r(Error(`Connection timeout`))}),a.end()})}function a(t,n,r){return new Promise((i,a)=>{let o=new URL(t),s=e({hostname:o.hostname,port:o.port,path:o.pathname,method:`POST`,headers:{"Content-Type":`application/json`,"Content-Length":Buffer.byteLength(n)},timeout:r},e=>{let t=[];e.on(`data`,e=>t.push(e)),e.on(`end`,()=>i(Buffer.concat(t).toString(`utf-8`)))});s.on(`error`,a),s.on(`timeout`,()=>{s.destroy(),a(Error(`Ollama request timed out after ${r}ms`))}),s.write(n),s.end()})}export{r as delegate,n as delegateListModels};
|
|
@@ -25,5 +25,4 @@ interface DiffParseOptions {
|
|
|
25
25
|
}
|
|
26
26
|
declare function diffParse(options: DiffParseOptions): DiffFile[];
|
|
27
27
|
//#endregion
|
|
28
|
-
export { DiffChange, DiffFile, DiffHunk, DiffParseOptions, diffParse };
|
|
29
|
-
//# sourceMappingURL=diff-parse.d.ts.map
|
|
28
|
+
export { DiffChange, DiffFile, DiffHunk, DiffParseOptions, diffParse };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
function e(e){let{diff:r}=e,i=r.split(/^diff --git /m).filter(Boolean);return i.length>0&&/^a\//.test(i[0])?t(i):n(r)}function t(e){let t=[];for(let n of e){let e=n.split(`
|
|
2
2
|
`),r=e[0]?.match(/a\/(.+?)\s+b\/(.+)/);if(!r)continue;let i=r[1],a=r[2],o=`modified`;n.includes(`new file mode`)?o=`added`:n.includes(`deleted file mode`)?o=`deleted`:i!==a&&(o=`renamed`);let s=[],c=0,l=0,u=null,d=0,f=0;for(let t of e){let e=t.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(e){u={oldStart:Number(e[1]),oldLines:Number(e[2]??1),newStart:Number(e[3]),newLines:Number(e[4]??1),header:e[5]?.trim()??``,changes:[]},s.push(u),d=u.oldStart,f=u.newStart;continue}if(!(!u||t.startsWith(`\\`))){if(t.startsWith(`+`)&&!t.startsWith(`+++`)){u.changes.push({type:`add`,line:f,content:t.slice(1)}),c+=1,f+=1;continue}if(t.startsWith(`-`)&&!t.startsWith(`---`)){u.changes.push({type:`delete`,line:d,content:t.slice(1)}),l+=1,d+=1;continue}t.startsWith(` `)&&(u.changes.push({type:`context`,line:f,content:t.slice(1)}),d+=1,f+=1)}}t.push({path:a,oldPath:o===`renamed`?i:void 0,status:o,hunks:s,additions:c,deletions:l})}return t}function n(e){let t=[],n=e.split(`
|
|
3
|
-
`),r=0;for(;r<n.length;){let e=n[r]?.match(/^---\s+(?:a\/)?(.+)/),i=n[r+1]?.match(/^\+\+\+\s+(?:b\/)?(.+)/);if(!e||!i){r++;continue}let a=e[1].trim(),o=i[1].trim(),s=`modified`;a===`/dev/null`?s=`added`:o===`/dev/null`?s=`deleted`:a!==o&&(s=`renamed`),r+=2;let c=[],l=0,u=0;for(;r<n.length&&!n[r]?.startsWith(`--- `);){let e=n[r]?.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(e){let t={oldStart:Number(e[1]),oldLines:Number(e[2]??1),newStart:Number(e[3]),newLines:Number(e[4]??1),header:e[5]?.trim()??``,changes:[]};c.push(t);let i=t.oldStart,a=t.newStart;for(r++;r<n.length;){let e=n[r];if(e?.startsWith(`@@`)||e?.startsWith(`--- `)||e?.startsWith(`diff `))break;if(e?.startsWith(`\\`)){r++;continue}if(e?.startsWith(`+`))t.changes.push({type:`add`,line:a,content:e.slice(1)}),l++,a++;else if(e?.startsWith(`-`))t.changes.push({type:`delete`,line:i,content:e.slice(1)}),u++,i++;else if(e?.startsWith(` `))t.changes.push({type:`context`,line:a,content:e.slice(1)}),i++,a++;else break;r++}}else r++}let d=s===`deleted`?a:o;t.push({path:d,oldPath:s===`renamed`?a:void 0,status:s,hunks:c,additions:l,deletions:u})}return t}export{e as diffParse};
|
|
4
|
-
//# sourceMappingURL=diff-parse.js.map
|
|
3
|
+
`),r=0;for(;r<n.length;){let e=n[r]?.match(/^---\s+(?:a\/)?(.+)/),i=n[r+1]?.match(/^\+\+\+\s+(?:b\/)?(.+)/);if(!e||!i){r++;continue}let a=e[1].trim(),o=i[1].trim(),s=`modified`;a===`/dev/null`?s=`added`:o===`/dev/null`?s=`deleted`:a!==o&&(s=`renamed`),r+=2;let c=[],l=0,u=0;for(;r<n.length&&!n[r]?.startsWith(`--- `);){let e=n[r]?.match(/^@@\s+-(\d+)(?:,(\d+))?\s+\+(\d+)(?:,(\d+))?\s+@@(.*)$/);if(e){let t={oldStart:Number(e[1]),oldLines:Number(e[2]??1),newStart:Number(e[3]),newLines:Number(e[4]??1),header:e[5]?.trim()??``,changes:[]};c.push(t);let i=t.oldStart,a=t.newStart;for(r++;r<n.length;){let e=n[r];if(e?.startsWith(`@@`)||e?.startsWith(`--- `)||e?.startsWith(`diff `))break;if(e?.startsWith(`\\`)){r++;continue}if(e?.startsWith(`+`))t.changes.push({type:`add`,line:a,content:e.slice(1)}),l++,a++;else if(e?.startsWith(`-`))t.changes.push({type:`delete`,line:i,content:e.slice(1)}),u++,i++;else if(e?.startsWith(` `))t.changes.push({type:`context`,line:a,content:e.slice(1)}),i++,a++;else break;r++}}else r++}let d=s===`deleted`?a:o;t.push({path:d,oldPath:s===`renamed`?a:void 0,status:s,hunks:c,additions:l,deletions:u})}return t}export{e as diffParse};
|
|
@@ -47,5 +47,4 @@ interface DigestResult {
|
|
|
47
47
|
*/
|
|
48
48
|
declare function digest(embedder: IEmbedder, options: DigestOptions): Promise<DigestResult>;
|
|
49
49
|
//#endregion
|
|
50
|
-
export { DigestFieldEntry, DigestOptions, DigestResult, DigestSource, digest };
|
|
51
|
-
//# sourceMappingURL=digest.d.ts.map
|
|
50
|
+
export { DigestFieldEntry, DigestOptions, DigestResult, DigestSource, digest };
|
|
@@ -3,5 +3,4 @@ import{cosineSimilarity as e,estimateTokens as t,segment as n}from"./text-utils.
|
|
|
3
3
|
|
|
4
4
|
`)}function g(e,t){return e===0?0:t/e}async function _(n,r){let{sources:i,query:a,maxChars:o=4e3,pinFields:l,segmentation:u=`paragraph`}=r,d={},f=p(i,u,c(l),d),_=i.reduce((e,t)=>e+t.text.length,0);if(_<=o){let e=f.filter(e=>e.originalText.trim().length>0).map(e=>({id:e.id,text:e.originalText})),t=f.map(e=>({id:e.id,originalChars:e.originalText.length,keptChars:e.originalText.length,segmentsKept:e.segments.length,segmentsTotal:e.segments.length}));return{text:h(e),fields:d,sourceStats:t,totalOriginalChars:_,totalCompressedChars:_,ratio:_===0?0:1}}let v=await n.embedQuery(a);for(let t of f)for(let r of t.segments)r.pinnedFields.length>0||(r.score=e(v,await n.embed(r.text)));let y=m(f,o-f.reduce((e,t)=>e+t.pinnedChars,0)),b=[],x=[],S=0;for(let e of f){let n=y.get(e.id)??0,r=new Map,i=0,a=e.segments.filter(e=>e.pinnedFields.length===0).sort((e,n)=>n.score-e.score||t(e.text)-t(n.text)||e.index-n.index),o;for(let e of a){let t=n-i;if(t<=s)break;if(e.text.length<=t+s){r.set(e.index,e.text),i+=e.text.length;continue}o||=e}let c=Math.floor(n-i);if(o&&c>0){let e=o.text.slice(0,c).trimEnd();e.length>0&&(r.set(o.index,e),i+=e.length)}let l=e.segments.filter(e=>e.pinnedFields.length>0||r.has(e.index)).map(e=>({index:e.index,text:r.get(e.index)??e.text})),u=l.reduce((e,t)=>e+t.text.length,0);b.push({id:e.id,originalChars:e.originalText.length,keptChars:u,segmentsKept:l.length,segmentsTotal:e.segments.length}),S+=u,l.length!==0&&x.push({id:e.id,text:l.map(e=>e.text).join(`
|
|
5
5
|
|
|
6
|
-
`)})}return{text:h(x),fields:d,sourceStats:b,totalOriginalChars:_,totalCompressedChars:S,ratio:g(_,S)}}export{_ as digest};
|
|
7
|
-
//# sourceMappingURL=digest.js.map
|
|
6
|
+
`)})}return{text:h(x),fields:d,sourceStats:b,totalOriginalChars:_,totalCompressedChars:S,ratio:g(_,S)}}export{_ as digest};
|
|
@@ -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};
|
|
@@ -13,5 +13,4 @@ interface EncodeResult {
|
|
|
13
13
|
}
|
|
14
14
|
declare function encode(options: EncodeOptions): EncodeResult;
|
|
15
15
|
//#endregion
|
|
16
|
-
export { EncodeOperation, EncodeOptions, EncodeResult, encode };
|
|
17
|
-
//# sourceMappingURL=encode.d.ts.map
|
|
16
|
+
export { EncodeOperation, EncodeOptions, EncodeResult, encode };
|
|
@@ -1,2 +1 @@
|
|
|
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};
|
|
2
|
-
//# sourceMappingURL=encode.js.map
|
|
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,2 +1 @@
|
|
|
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};
|
|
2
|
-
//# sourceMappingURL=env-info.js.map
|
|
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,3 +1,2 @@
|
|
|
1
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};
|
|
3
|
-
//# sourceMappingURL=eval.js.map
|
|
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};
|
|
@@ -78,5 +78,4 @@ interface EvidenceMapResult {
|
|
|
78
78
|
}
|
|
79
79
|
declare function evidenceMap(action: EvidenceMapAction, cwd?: string): EvidenceMapResult;
|
|
80
80
|
//#endregion
|
|
81
|
-
export { EvidenceEntry, EvidenceMapAction, EvidenceMapResult, EvidenceMapState, EvidenceStatus, ForgeTier, GateDecision, GateResult, UnknownType, evidenceMap };
|
|
82
|
-
//# sourceMappingURL=evidence-map.d.ts.map
|
|
81
|
+
export { EvidenceEntry, EvidenceMapAction, EvidenceMapResult, EvidenceMapState, EvidenceStatus, ForgeTier, GateDecision, GateResult, UnknownType, evidenceMap };
|
|
@@ -1,3 +1,2 @@
|
|
|
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";function
|
|
2
|
-
`)}function
|
|
3
|
-
//# sourceMappingURL=evidence-map.js.map
|
|
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};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
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
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};
|
|
4
|
-
//# sourceMappingURL=file-cache.js.map
|
|
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};
|
|
@@ -15,23 +15,38 @@ interface FileSummaryResult {
|
|
|
15
15
|
name: string;
|
|
16
16
|
line: number;
|
|
17
17
|
exported: boolean;
|
|
18
|
+
signature?: string;
|
|
18
19
|
}>;
|
|
19
20
|
classes: Array<{
|
|
20
21
|
name: string;
|
|
21
22
|
line: number;
|
|
22
23
|
exported: boolean;
|
|
24
|
+
signature?: string;
|
|
23
25
|
}>;
|
|
24
26
|
interfaces: Array<{
|
|
25
27
|
name: string;
|
|
26
28
|
line: number;
|
|
29
|
+
exported: boolean;
|
|
27
30
|
}>;
|
|
28
31
|
types: Array<{
|
|
29
32
|
name: string;
|
|
30
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;
|
|
31
47
|
}>;
|
|
32
48
|
estimatedTokens: number;
|
|
33
49
|
}
|
|
34
50
|
declare function fileSummary(options: FileSummaryOptions): Promise<FileSummaryResult>;
|
|
35
51
|
//#endregion
|
|
36
|
-
export { FileSummaryOptions, FileSummaryResult, fileSummary };
|
|
37
|
-
//# sourceMappingURL=file-summary.d.ts.map
|
|
52
|
+
export { FileSummaryOptions, FileSummaryResult, fileSummary };
|