homegraph 1.4.1 → 1.5.1
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/LICENSE +21 -21
- package/README.md +305 -268
- package/dist/bin/command-supervision.d.ts.map +1 -1
- package/dist/bin/command-supervision.js +7 -4
- package/dist/bin/command-supervision.js.map +1 -1
- package/dist/bin/homegraph.js +304 -81
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +32 -11
- package/dist/context/index.js.map +1 -1
- package/dist/db/index.d.ts +143 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +305 -28
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.js +37 -37
- package/dist/db/queries.d.ts +43 -4
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +294 -170
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +203 -203
- package/dist/db/sqlite-adapter.d.ts +24 -17
- package/dist/db/sqlite-adapter.d.ts.map +1 -1
- package/dist/db/sqlite-adapter.js +292 -36
- package/dist/db/sqlite-adapter.js.map +1 -1
- package/dist/db/wal-valve.d.ts +15 -2
- package/dist/db/wal-valve.d.ts.map +1 -1
- package/dist/db/wal-valve.js +88 -6
- package/dist/db/wal-valve.js.map +1 -1
- package/dist/directory.js +5 -5
- package/dist/extraction/arkts-batch-worker.js +3 -2
- package/dist/extraction/arkts-batch-worker.js.map +1 -1
- package/dist/extraction/default-ignore.d.ts +39 -0
- package/dist/extraction/default-ignore.d.ts.map +1 -0
- package/dist/extraction/default-ignore.js +221 -0
- package/dist/extraction/default-ignore.js.map +1 -0
- package/dist/extraction/index.d.ts +9 -10
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +227 -323
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.d.ts +2 -4
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.js +6 -21
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +100 -6
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1777 -173
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/store-worker.d.ts +20 -0
- package/dist/extraction/store-worker.d.ts.map +1 -0
- package/dist/extraction/store-worker.js +102 -0
- package/dist/extraction/store-worker.js.map +1 -0
- package/dist/extraction/store-writer.d.ts +48 -0
- package/dist/extraction/store-writer.d.ts.map +1 -0
- package/dist/extraction/store-writer.js +167 -0
- package/dist/extraction/store-writer.js.map +1 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +47 -0
- package/dist/extraction/tree-sitter.js.map +1 -1
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/dist/extraction/wasm-runtime-flags.d.ts +14 -4
- package/dist/extraction/wasm-runtime-flags.d.ts.map +1 -1
- package/dist/extraction/wasm-runtime-flags.js +55 -7
- package/dist/extraction/wasm-runtime-flags.js.map +1 -1
- package/dist/index.d.ts +16 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +135 -97
- package/dist/index.js.map +1 -1
- package/dist/installer/instructions-template.js +9 -9
- package/dist/mcp/liveness-watchdog.d.ts +18 -0
- package/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/dist/mcp/liveness-watchdog.js +185 -73
- package/dist/mcp/liveness-watchdog.js.map +1 -1
- package/dist/mcp/query-worker.d.ts +2 -2
- package/dist/mcp/query-worker.js +2 -2
- package/dist/mcp/server-instructions.js +47 -47
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +42 -26
- package/dist/mcp/tools.js.map +1 -1
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/resolution/callback-synthesizer.d.ts +52 -16
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +234 -180
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/cooperative-yield.d.ts +10 -2
- package/dist/resolution/cooperative-yield.d.ts.map +1 -1
- package/dist/resolution/cooperative-yield.js +6 -4
- package/dist/resolution/cooperative-yield.js.map +1 -1
- package/dist/resolution/frameworks/go.d.ts.map +1 -1
- package/dist/resolution/frameworks/go.js +29 -6
- package/dist/resolution/frameworks/go.js.map +1 -1
- package/dist/resolution/import-resolver.d.ts +2 -3
- package/dist/resolution/import-resolver.d.ts.map +1 -1
- package/dist/resolution/import-resolver.js +166 -7
- package/dist/resolution/import-resolver.js.map +1 -1
- package/dist/resolution/index.d.ts +87 -2
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +739 -131
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/memory-budget.d.ts +48 -0
- package/dist/resolution/memory-budget.d.ts.map +1 -0
- package/dist/resolution/memory-budget.js +162 -0
- package/dist/resolution/memory-budget.js.map +1 -0
- package/dist/resolution/name-matcher.d.ts +12 -1
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +439 -97
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/resolution/resolver-pool.d.ts +106 -0
- package/dist/resolution/resolver-pool.d.ts.map +1 -0
- package/dist/resolution/resolver-pool.js +344 -0
- package/dist/resolution/resolver-pool.js.map +1 -0
- package/dist/resolution/resolver-worker.d.ts +17 -0
- package/dist/resolution/resolver-worker.d.ts.map +1 -0
- package/dist/resolution/resolver-worker.js +141 -0
- package/dist/resolution/resolver-worker.js.map +1 -0
- package/dist/resolution/types.d.ts +3 -0
- package/dist/resolution/types.d.ts.map +1 -1
- package/dist/spec/build/diff-parser.d.ts +55 -0
- package/dist/spec/build/diff-parser.d.ts.map +1 -0
- package/dist/spec/build/diff-parser.js +205 -0
- package/dist/spec/build/diff-parser.js.map +1 -0
- package/dist/spec/build/pipeline.d.ts +54 -0
- package/dist/spec/build/pipeline.d.ts.map +1 -0
- package/dist/spec/build/pipeline.js +170 -0
- package/dist/spec/build/pipeline.js.map +1 -0
- package/dist/spec/build/scan.d.ts +48 -0
- package/dist/spec/build/scan.d.ts.map +1 -0
- package/dist/spec/build/scan.js +89 -0
- package/dist/spec/build/scan.js.map +1 -0
- package/dist/spec/build/scope-resolver.d.ts +50 -0
- package/dist/spec/build/scope-resolver.d.ts.map +1 -0
- package/dist/spec/build/scope-resolver.js +105 -0
- package/dist/spec/build/scope-resolver.js.map +1 -0
- package/dist/spec/build/spec-extractor.d.ts +74 -0
- package/dist/spec/build/spec-extractor.d.ts.map +1 -0
- package/dist/spec/build/spec-extractor.js +344 -0
- package/dist/spec/build/spec-extractor.js.map +1 -0
- package/dist/spec/config.d.ts +35 -1
- package/dist/spec/config.d.ts.map +1 -1
- package/dist/spec/config.js +30 -5
- package/dist/spec/config.js.map +1 -1
- package/dist/spec/db/commit-node.js +4 -4
- package/dist/spec/db/fragment-node.js +10 -10
- package/dist/spec/db/fts.d.ts.map +1 -1
- package/dist/spec/db/fts.js +27 -58
- package/dist/spec/db/fts.js.map +1 -1
- package/dist/spec/db/index.d.ts +5 -3
- package/dist/spec/db/index.d.ts.map +1 -1
- package/dist/spec/db/index.js +16 -1
- package/dist/spec/db/index.js.map +1 -1
- package/dist/spec/db/persist.d.ts +45 -0
- package/dist/spec/db/persist.d.ts.map +1 -0
- package/dist/spec/db/persist.js +66 -0
- package/dist/spec/db/persist.js.map +1 -0
- package/dist/spec/db/relations.d.ts +80 -1
- package/dist/spec/db/relations.d.ts.map +1 -1
- package/dist/spec/db/relations.js +218 -47
- package/dist/spec/db/relations.js.map +1 -1
- package/dist/spec/db/schema.d.ts +4 -0
- package/dist/spec/db/schema.d.ts.map +1 -1
- package/dist/spec/db/schema.js +10 -6
- package/dist/spec/db/schema.js.map +1 -1
- package/dist/spec/db/schema.sql +121 -117
- package/dist/spec/db/spec-node.d.ts +5 -0
- package/dist/spec/db/spec-node.d.ts.map +1 -1
- package/dist/spec/db/spec-node.js +15 -9
- package/dist/spec/db/spec-node.js.map +1 -1
- package/dist/spec/db/sql-utils.d.ts +11 -0
- package/dist/spec/db/sql-utils.d.ts.map +1 -0
- package/dist/spec/db/sql-utils.js +19 -0
- package/dist/spec/db/sql-utils.js.map +1 -0
- package/dist/spec/evolve/cluster-context.d.ts +30 -0
- package/dist/spec/evolve/cluster-context.d.ts.map +1 -0
- package/dist/spec/evolve/cluster-context.js +78 -0
- package/dist/spec/evolve/cluster-context.js.map +1 -0
- package/dist/spec/evolve/commit-spec-analyzer.d.ts +51 -0
- package/dist/spec/evolve/commit-spec-analyzer.d.ts.map +1 -0
- package/dist/spec/evolve/commit-spec-analyzer.js +88 -0
- package/dist/spec/evolve/commit-spec-analyzer.js.map +1 -0
- package/dist/spec/evolve/commit-spec-persister.d.ts +53 -0
- package/dist/spec/evolve/commit-spec-persister.d.ts.map +1 -0
- package/dist/spec/evolve/commit-spec-persister.js +93 -0
- package/dist/spec/evolve/commit-spec-persister.js.map +1 -0
- package/dist/spec/evolve/impact-locator.d.ts +23 -7
- package/dist/spec/evolve/impact-locator.d.ts.map +1 -1
- package/dist/spec/evolve/impact-locator.js +58 -14
- package/dist/spec/evolve/impact-locator.js.map +1 -1
- package/dist/spec/evolve/pipeline.d.ts +62 -25
- package/dist/spec/evolve/pipeline.d.ts.map +1 -1
- package/dist/spec/evolve/pipeline.js +436 -457
- package/dist/spec/evolve/pipeline.js.map +1 -1
- package/dist/spec/evolve/spec-rewriter.d.ts +13 -13
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -1
- package/dist/spec/evolve/spec-rewriter.js +45 -45
- package/dist/spec/evolve/spec-rewriter.js.map +1 -1
- package/dist/spec/git/commits.d.ts +85 -0
- package/dist/spec/git/commits.d.ts.map +1 -0
- package/dist/spec/git/commits.js +218 -0
- package/dist/spec/git/commits.js.map +1 -0
- package/dist/spec/git/exec.d.ts +13 -0
- package/dist/spec/git/exec.d.ts.map +1 -0
- package/dist/spec/git/exec.js +19 -0
- package/dist/spec/git/exec.js.map +1 -0
- package/dist/spec/git/index.d.ts +9 -0
- package/dist/spec/git/index.d.ts.map +1 -0
- package/dist/spec/git/index.js +22 -0
- package/dist/spec/git/index.js.map +1 -0
- package/dist/spec/graph/index.d.ts +8 -0
- package/dist/spec/graph/index.d.ts.map +1 -0
- package/dist/spec/graph/index.js +17 -0
- package/dist/spec/graph/index.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +6 -35
- package/dist/spec/graph/queries.d.ts.map +1 -1
- package/dist/spec/graph/queries.js +71 -248
- package/dist/spec/graph/queries.js.map +1 -1
- package/dist/spec/llm/agent-client.d.ts +59 -0
- package/dist/spec/llm/agent-client.d.ts.map +1 -0
- package/dist/spec/llm/agent-client.js +213 -0
- package/dist/spec/llm/agent-client.js.map +1 -0
- package/dist/spec/llm/agents/claude-code.d.ts +32 -0
- package/dist/spec/llm/agents/claude-code.d.ts.map +1 -0
- package/dist/spec/llm/agents/claude-code.js +125 -0
- package/dist/spec/llm/agents/claude-code.js.map +1 -0
- package/dist/spec/llm/agents/codex.d.ts +32 -0
- package/dist/spec/llm/agents/codex.d.ts.map +1 -0
- package/dist/spec/llm/agents/codex.js +145 -0
- package/dist/spec/llm/agents/codex.js.map +1 -0
- package/dist/spec/llm/agents/detect-utils.d.ts +28 -0
- package/dist/spec/llm/agents/detect-utils.d.ts.map +1 -0
- package/dist/spec/llm/agents/detect-utils.js +91 -0
- package/dist/spec/llm/agents/detect-utils.js.map +1 -0
- package/dist/spec/llm/agents/deveco-code.d.ts +33 -0
- package/dist/spec/llm/agents/deveco-code.d.ts.map +1 -0
- package/dist/spec/llm/agents/deveco-code.js +165 -0
- package/dist/spec/llm/agents/deveco-code.js.map +1 -0
- package/dist/spec/llm/agents/index.d.ts +31 -0
- package/dist/spec/llm/agents/index.d.ts.map +1 -0
- package/dist/spec/llm/agents/index.js +65 -0
- package/dist/spec/llm/agents/index.js.map +1 -0
- package/dist/spec/llm/agents/types.d.ts +76 -0
- package/dist/spec/llm/agents/types.d.ts.map +1 -0
- package/dist/spec/llm/agents/types.js +15 -0
- package/dist/spec/llm/agents/types.js.map +1 -0
- package/dist/spec/llm/client.d.ts +31 -11
- package/dist/spec/llm/client.d.ts.map +1 -1
- package/dist/spec/llm/client.js +143 -81
- package/dist/spec/llm/client.js.map +1 -1
- package/dist/spec/llm/factory.d.ts +41 -0
- package/dist/spec/llm/factory.d.ts.map +1 -0
- package/dist/spec/llm/factory.js +80 -0
- package/dist/spec/llm/factory.js.map +1 -0
- package/dist/spec/llm/prompts.d.ts +24 -8
- package/dist/spec/llm/prompts.d.ts.map +1 -1
- package/dist/spec/llm/prompts.js +112 -62
- package/dist/spec/llm/prompts.js.map +1 -1
- package/dist/spec/llm/retry.d.ts +53 -0
- package/dist/spec/llm/retry.d.ts.map +1 -0
- package/dist/spec/llm/retry.js +153 -0
- package/dist/spec/llm/retry.js.map +1 -0
- package/dist/spec/mine/clustering/features.d.ts +38 -0
- package/dist/spec/mine/clustering/features.d.ts.map +1 -0
- package/dist/spec/mine/clustering/features.js +108 -0
- package/dist/spec/mine/clustering/features.js.map +1 -0
- package/dist/spec/mine/clustering/index.d.ts +62 -0
- package/dist/spec/mine/clustering/index.d.ts.map +1 -0
- package/dist/spec/mine/clustering/index.js +259 -0
- package/dist/spec/mine/clustering/index.js.map +1 -0
- package/dist/spec/mine/clustering/leiden.d.ts +61 -0
- package/dist/spec/mine/clustering/leiden.d.ts.map +1 -0
- package/dist/spec/mine/clustering/leiden.js +489 -0
- package/dist/spec/mine/clustering/leiden.js.map +1 -0
- package/dist/spec/mine/clustering/text-similarity.d.ts +22 -0
- package/dist/spec/mine/clustering/text-similarity.d.ts.map +1 -0
- package/dist/spec/mine/clustering/text-similarity.js +98 -0
- package/dist/spec/mine/clustering/text-similarity.js.map +1 -0
- package/dist/spec/mine/generator.d.ts +54 -0
- package/dist/spec/mine/generator.d.ts.map +1 -0
- package/dist/spec/mine/generator.js +267 -0
- package/dist/spec/mine/generator.js.map +1 -0
- package/dist/spec/mine/persist.d.ts +37 -0
- package/dist/spec/mine/persist.d.ts.map +1 -0
- package/dist/spec/mine/persist.js +170 -0
- package/dist/spec/mine/persist.js.map +1 -0
- package/dist/spec/mine/pipeline.d.ts +41 -0
- package/dist/spec/mine/pipeline.d.ts.map +1 -0
- package/dist/spec/mine/pipeline.js +236 -0
- package/dist/spec/mine/pipeline.js.map +1 -0
- package/dist/spec/mine/scanner.d.ts +59 -0
- package/dist/spec/mine/scanner.d.ts.map +1 -0
- package/dist/spec/mine/scanner.js +383 -0
- package/dist/spec/mine/scanner.js.map +1 -0
- package/dist/spec/types.d.ts +32 -0
- package/dist/spec/types.d.ts.map +1 -1
- package/dist/spec/ui/index.d.ts +9 -0
- package/dist/spec/ui/index.d.ts.map +1 -0
- package/dist/spec/ui/index.js +16 -0
- package/dist/spec/ui/index.js.map +1 -0
- package/dist/spec/ui/progress-handler.d.ts +33 -0
- package/dist/spec/ui/progress-handler.d.ts.map +1 -0
- package/dist/spec/ui/progress-handler.js +132 -0
- package/dist/spec/ui/progress-handler.js.map +1 -0
- package/dist/spec/ui/progress.d.ts +24 -0
- package/dist/spec/ui/progress.d.ts.map +1 -0
- package/dist/spec/ui/progress.js +13 -0
- package/dist/spec/ui/progress.js.map +1 -0
- package/dist/spec/utils/fs.d.ts +45 -0
- package/dist/spec/utils/fs.d.ts.map +1 -0
- package/dist/spec/utils/fs.js +163 -0
- package/dist/spec/utils/fs.js.map +1 -0
- package/dist/spec/utils/index.d.ts +12 -0
- package/dist/spec/utils/index.d.ts.map +1 -0
- package/dist/spec/utils/index.js +26 -0
- package/dist/spec/utils/index.js.map +1 -0
- package/dist/spec/utils/meta.d.ts +32 -0
- package/dist/spec/utils/meta.d.ts.map +1 -0
- package/dist/spec/utils/meta.js +122 -0
- package/dist/spec/utils/meta.js.map +1 -0
- package/dist/spec/utils/truncate.d.ts +86 -0
- package/dist/spec/utils/truncate.d.ts.map +1 -0
- package/dist/spec/utils/truncate.js +172 -0
- package/dist/spec/utils/truncate.js.map +1 -0
- package/dist/sync/watcher.d.ts +25 -1
- package/dist/sync/watcher.d.ts.map +1 -1
- package/dist/sync/watcher.js +76 -3
- package/dist/sync/watcher.js.map +1 -1
- package/dist/telemetry/index.js +3 -3
- package/dist/telemetry/index.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +62 -58
- package/scripts/_tmp-cfwk-resolve.log +0 -0
- package/scripts/_tmp-cfwk-sig.log +0 -0
- package/scripts/_tmp-cfwk-vt.log +0 -0
- package/scripts/add-lang/bench.sh +60 -60
- package/scripts/add-lang/check-grammar.mjs +75 -75
- package/scripts/add-lang/dump-ast.mjs +103 -103
- package/scripts/add-lang/verify-extraction.mjs +70 -70
- package/scripts/agent-eval/ab-adoption.sh +91 -91
- package/scripts/agent-eval/ab-hook.sh +86 -86
- package/scripts/agent-eval/ab-impl.sh +78 -78
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
- package/scripts/agent-eval/ab-sufficiency.sh +78 -78
- package/scripts/agent-eval/arms-F.sh +21 -21
- package/scripts/agent-eval/arms-matrix.sh +37 -37
- package/scripts/agent-eval/audit.sh +68 -68
- package/scripts/agent-eval/bench-readme.sh +28 -28
- package/scripts/agent-eval/bench-why-repo.sh +22 -22
- package/scripts/agent-eval/block-read-hook.sh +19 -19
- package/scripts/agent-eval/hook-settings.json +15 -15
- package/scripts/agent-eval/itrun.sh +120 -120
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
- package/scripts/agent-eval/offload-eval-setup.sh +24 -24
- package/scripts/agent-eval/offload-eval-styles.sh +71 -71
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
- package/scripts/agent-eval/offload-eval.md +76 -76
- package/scripts/agent-eval/parse-arms.mjs +116 -116
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
- package/scripts/agent-eval/parse-run.mjs +45 -45
- package/scripts/agent-eval/parse-session.mjs +93 -93
- package/scripts/agent-eval/probe-context.mjs +21 -21
- package/scripts/agent-eval/probe-explore.mjs +40 -40
- package/scripts/agent-eval/probe-node.mjs +20 -20
- package/scripts/agent-eval/probe-sweep.mjs +119 -119
- package/scripts/agent-eval/probe-trace.mjs +20 -20
- package/scripts/agent-eval/redirect-read-hook.sh +38 -38
- package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -119
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -125
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +75 -75
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/bench-arkts-init-rss.log +0 -0
- package/scripts/build-bundle.sh +123 -123
- package/scripts/exp_boundary_eval/README.md +247 -247
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/win_mcp_launcher.cpython-38.pyc +0 -0
- package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -78
- package/scripts/exp_boundary_eval/_test_stdin.py +8 -8
- package/scripts/exp_boundary_eval/_utils.py +1116 -1116
- package/scripts/exp_boundary_eval/analyze.py +1313 -1313
- package/scripts/exp_boundary_eval/deveco_arm.py +519 -519
- package/scripts/exp_boundary_eval/run_all.py +378 -378
- package/scripts/exp_boundary_eval/run_one.py +165 -165
- package/scripts/exp_boundary_eval/run_session.py +158 -158
- package/scripts/exp_boundary_eval/setup.py +120 -120
- package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -73
- package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -36
- package/scripts/exp_boundary_eval/win_node_launcher.py +24 -24
- package/scripts/extract-release-notes.mjs +130 -130
- package/scripts/local-install.sh +41 -41
- package/scripts/npm-sdk.js +75 -75
- package/scripts/npm-shim.js +275 -275
- package/scripts/ohos-sdk-publish.mjs +133 -133
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/probe-arkts-mem-why-run.log +0 -0
- package/scripts/probe-banner-livecard-ir.log +0 -0
- package/scripts/probe-cfwk-ast.stderr.log +0 -0
- package/scripts/probe-cfwk-ast.stdout.log +0 -0
- package/scripts/probe-cfwk-attr-shape.log +0 -0
- package/scripts/probe-cfwk-cfgdump.stderr.log +0 -0
- package/scripts/probe-cfwk-cfgdump.stdout.log +0 -0
- package/scripts/probe-cfwk-cvc.stderr.log +0 -0
- package/scripts/probe-cfwk-cvc.stdout.log +0 -0
- package/scripts/probe-cfwk-diag2.log +0 -0
- package/scripts/probe-cfwk-diag3.log +0 -0
- package/scripts/probe-cfwk-fedbg.stderr.log +0 -0
- package/scripts/probe-cfwk-fedbg.stdout.log +0 -0
- package/scripts/probe-cfwk-fileresult.log +0 -0
- package/scripts/probe-cfwk-fix.stderr.log +0 -0
- package/scripts/probe-cfwk-fix.stdout.log +0 -0
- package/scripts/probe-cfwk-fix2.stderr.log +0 -0
- package/scripts/probe-cfwk-fix2.stdout.log +0 -0
- package/scripts/probe-cfwk-fix3.stderr.log +0 -0
- package/scripts/probe-cfwk-fix3.stdout.log +0 -0
- package/scripts/probe-cfwk-foreach.log +0 -0
- package/scripts/probe-cfwk-getmethod-throw.log +0 -0
- package/scripts/probe-cfwk-hg-extract.log +0 -0
- package/scripts/probe-cfwk-pr1003-noprior.stderr.log +0 -0
- package/scripts/probe-cfwk-pr1003-noprior.stdout.log +0 -0
- package/scripts/probe-cfwk-pr1003.stderr.log +0 -0
- package/scripts/probe-cfwk-pr1003.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-noprior.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-noprior.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-prior.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-prior.stdout.log +0 -0
- package/scripts/probe-cfwk-preroot-skipstate.stderr.log +0 -0
- package/scripts/probe-cfwk-preroot-skipstate.stdout.log +0 -0
- package/scripts/probe-cfwk-resolve-sim.log +0 -0
- package/scripts/probe-cfwk-tree-shape.log +0 -0
- package/scripts/probe-cfwk-walk-abort.log +0 -0
- package/scripts/probe-cfwk.log +0 -0
- package/scripts/probe-force-index.log +0 -0
- package/scripts/probe-no-force-index.log +0 -0
- package/scripts/probe-samefile-ir.stderr.log +0 -0
- package/scripts/probe-samefile-ir.stdout.log +224 -0
- package/scripts/probe-sdk-vs-project.log +0 -0
- package/scripts/probe-viewtree-downgrade.log +0 -0
- package/dist/arkts/ohos-api-index.d.ts +0 -15
- package/dist/arkts/ohos-api-index.d.ts.map +0 -1
- package/dist/arkts/ohos-api-index.js +0 -190
- package/dist/arkts/ohos-api-index.js.map +0 -1
- package/dist/arkts/ohos-sdk-input.d.ts +0 -36
- package/dist/arkts/ohos-sdk-input.d.ts.map +0 -1
- package/dist/arkts/ohos-sdk-input.js +0 -214
- package/dist/arkts/ohos-sdk-input.js.map +0 -1
- package/dist/extraction/languages/arkts-state-decorators.d.ts +0 -13
- package/dist/extraction/languages/arkts-state-decorators.d.ts.map +0 -1
- package/dist/extraction/languages/arkts-state-decorators.js +0 -26
- package/dist/extraction/languages/arkts-state-decorators.js.map +0 -1
- package/dist/extraction/languages/ohos-api-consumer.d.ts +0 -34
- package/dist/extraction/languages/ohos-api-consumer.d.ts.map +0 -1
- package/dist/extraction/languages/ohos-api-consumer.js +0 -283
- package/dist/extraction/languages/ohos-api-consumer.js.map +0 -1
package/dist/spec/db/schema.sql
CHANGED
|
@@ -1,117 +1,121 @@
|
|
|
1
|
-
-- Commit4Spec Schema for HomeGraph
|
|
2
|
-
-- Version 2
|
|
3
|
-
--
|
|
4
|
-
-- Independent tables that coexist alongside HomeGraph's `nodes`/`edges`
|
|
5
|
-
-- core graph. These tables form a three-layer Spec→Commit→CodeFragment
|
|
6
|
-
-- relationship model — a higher-level semantic overlay on the code graph.
|
|
7
|
-
--
|
|
8
|
-
-- FTS5 uses a standalone virtual table (not external content) because
|
|
9
|
-
-- Spec text needs CJK character-level segmentation before indexing.
|
|
10
|
-
|
|
11
|
-
-- =============================================================================
|
|
12
|
-
-- Entity Tables
|
|
13
|
-
-- =============================================================================
|
|
14
|
-
|
|
15
|
-
CREATE TABLE IF NOT EXISTS spec_nodes (
|
|
16
|
-
id TEXT PRIMARY KEY,
|
|
17
|
-
title TEXT NOT NULL,
|
|
18
|
-
subtitles TEXT NOT NULL, -- JSON array of markdown heading + preview
|
|
19
|
-
status TEXT NOT NULL DEFAULT 'active', -- 'active' | 'deprecated'
|
|
20
|
-
version INTEGER NOT NULL DEFAULT 1,
|
|
21
|
-
file_path TEXT NOT NULL,
|
|
22
|
-
timestamp INTEGER NOT NULL -- Unix epoch milliseconds
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
CREATE TABLE IF NOT EXISTS commit_nodes (
|
|
26
|
-
hash TEXT PRIMARY KEY, -- Full 40-char commit hash
|
|
27
|
-
message TEXT NOT NULL, -- First line of commit message
|
|
28
|
-
author TEXT NOT NULL,
|
|
29
|
-
timestamp INTEGER NOT NULL -- Unix epoch milliseconds
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
CREATE TABLE IF NOT EXISTS code_fragment_nodes (
|
|
33
|
-
id TEXT PRIMARY KEY, -- 12-char hex UUID prefix
|
|
34
|
-
change_type TEXT NOT NULL, -- 'ADD' | 'MODIFY' | 'DELETE'
|
|
35
|
-
file_path TEXT NOT NULL,
|
|
36
|
-
start_line INTEGER NOT NULL,
|
|
37
|
-
end_line INTEGER NOT NULL,
|
|
38
|
-
code_diff TEXT NOT NULL -- Unified diff text
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
-- =============================================================================
|
|
42
|
-
-- Relation Tables
|
|
43
|
-
-- =============================================================================
|
|
44
|
-
|
|
45
|
-
CREATE TABLE IF NOT EXISTS spec_commit_relations (
|
|
46
|
-
spec_id TEXT NOT NULL,
|
|
47
|
-
commit_hash TEXT NOT NULL,
|
|
48
|
-
relation_type TEXT NOT NULL, -- 'GENERATE' | 'SUMMARIZED_FROM'
|
|
49
|
-
PRIMARY KEY (spec_id, commit_hash, relation_type),
|
|
50
|
-
FOREIGN KEY (spec_id) REFERENCES spec_nodes(id) ON DELETE CASCADE,
|
|
51
|
-
FOREIGN KEY (commit_hash) REFERENCES commit_nodes(hash) ON DELETE CASCADE
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
CREATE TABLE IF NOT EXISTS commit_fragment_relations (
|
|
55
|
-
commit_hash TEXT NOT NULL,
|
|
56
|
-
fragment_id TEXT NOT NULL,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
FOREIGN KEY (
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
FOREIGN KEY (
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
--
|
|
73
|
-
--
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
CREATE INDEX IF NOT EXISTS
|
|
96
|
-
CREATE INDEX IF NOT EXISTS
|
|
97
|
-
CREATE INDEX IF NOT EXISTS
|
|
98
|
-
CREATE INDEX IF NOT EXISTS
|
|
99
|
-
CREATE INDEX IF NOT EXISTS
|
|
100
|
-
CREATE INDEX IF NOT EXISTS
|
|
101
|
-
CREATE INDEX IF NOT EXISTS
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
1
|
+
-- Commit4Spec Schema for HomeGraph
|
|
2
|
+
-- Version 2
|
|
3
|
+
--
|
|
4
|
+
-- Independent tables that coexist alongside HomeGraph's `nodes`/`edges`
|
|
5
|
+
-- core graph. These tables form a three-layer Spec→Commit→CodeFragment
|
|
6
|
+
-- relationship model — a higher-level semantic overlay on the code graph.
|
|
7
|
+
--
|
|
8
|
+
-- FTS5 uses a standalone virtual table (not external content) because
|
|
9
|
+
-- Spec text needs CJK character-level segmentation before indexing.
|
|
10
|
+
|
|
11
|
+
-- =============================================================================
|
|
12
|
+
-- Entity Tables
|
|
13
|
+
-- =============================================================================
|
|
14
|
+
|
|
15
|
+
CREATE TABLE IF NOT EXISTS spec_nodes (
|
|
16
|
+
id TEXT PRIMARY KEY,
|
|
17
|
+
title TEXT NOT NULL,
|
|
18
|
+
subtitles TEXT NOT NULL, -- JSON array of markdown heading + preview
|
|
19
|
+
status TEXT NOT NULL DEFAULT 'active', -- 'active' | 'deprecated'
|
|
20
|
+
version INTEGER NOT NULL DEFAULT 1,
|
|
21
|
+
file_path TEXT NOT NULL,
|
|
22
|
+
timestamp INTEGER NOT NULL -- Unix epoch milliseconds
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
CREATE TABLE IF NOT EXISTS commit_nodes (
|
|
26
|
+
hash TEXT PRIMARY KEY, -- Full 40-char commit hash
|
|
27
|
+
message TEXT NOT NULL, -- First line of commit message
|
|
28
|
+
author TEXT NOT NULL,
|
|
29
|
+
timestamp INTEGER NOT NULL -- Unix epoch milliseconds
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
CREATE TABLE IF NOT EXISTS code_fragment_nodes (
|
|
33
|
+
id TEXT PRIMARY KEY, -- 12-char hex UUID prefix
|
|
34
|
+
change_type TEXT NOT NULL, -- 'ADD' | 'MODIFY' | 'DELETE'
|
|
35
|
+
file_path TEXT NOT NULL,
|
|
36
|
+
start_line INTEGER NOT NULL,
|
|
37
|
+
end_line INTEGER NOT NULL,
|
|
38
|
+
code_diff TEXT NOT NULL -- Unified diff text
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
-- =============================================================================
|
|
42
|
+
-- Relation Tables
|
|
43
|
+
-- =============================================================================
|
|
44
|
+
|
|
45
|
+
CREATE TABLE IF NOT EXISTS spec_commit_relations (
|
|
46
|
+
spec_id TEXT NOT NULL,
|
|
47
|
+
commit_hash TEXT NOT NULL,
|
|
48
|
+
relation_type TEXT NOT NULL, -- 'GENERATE' | 'SUMMARIZED_FROM'
|
|
49
|
+
PRIMARY KEY (spec_id, commit_hash, relation_type),
|
|
50
|
+
FOREIGN KEY (spec_id) REFERENCES spec_nodes(id) ON DELETE CASCADE,
|
|
51
|
+
FOREIGN KEY (commit_hash) REFERENCES commit_nodes(hash) ON DELETE CASCADE
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
CREATE TABLE IF NOT EXISTS commit_fragment_relations (
|
|
55
|
+
commit_hash TEXT NOT NULL,
|
|
56
|
+
fragment_id TEXT NOT NULL,
|
|
57
|
+
relation_type TEXT NOT NULL,
|
|
58
|
+
PRIMARY KEY (commit_hash, fragment_id, relation_type),
|
|
59
|
+
FOREIGN KEY (commit_hash) REFERENCES commit_nodes(hash) ON DELETE CASCADE,
|
|
60
|
+
FOREIGN KEY (fragment_id) REFERENCES code_fragment_nodes(id) ON DELETE CASCADE
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
CREATE TABLE IF NOT EXISTS spec_spec_relations (
|
|
64
|
+
source_id TEXT NOT NULL,
|
|
65
|
+
target_id TEXT NOT NULL,
|
|
66
|
+
relation_type TEXT NOT NULL, -- 'SIMILAR_TO' | 'EVOLVED_FROM'
|
|
67
|
+
PRIMARY KEY (source_id, target_id, relation_type),
|
|
68
|
+
FOREIGN KEY (source_id) REFERENCES spec_nodes(id) ON DELETE CASCADE,
|
|
69
|
+
FOREIGN KEY (target_id) REFERENCES spec_nodes(id) ON DELETE CASCADE
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
-- =============================================================================
|
|
73
|
+
-- Full-Text Search (standalone — CJK-segmented on insert)
|
|
74
|
+
-- =============================================================================
|
|
75
|
+
|
|
76
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS specs_fts USING fts5(
|
|
77
|
+
id,
|
|
78
|
+
title,
|
|
79
|
+
subtitles
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
-- NOTE: `runSpecMigrations` in schema.ts mirrors some of this DDL to patch
|
|
83
|
+
-- pre-existing databases. Keep the two in sync when adding migrations.
|
|
84
|
+
|
|
85
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS code_fragments_fts USING fts5(
|
|
86
|
+
id,
|
|
87
|
+
file_path,
|
|
88
|
+
code_diff
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
-- =============================================================================
|
|
92
|
+
-- Indexes
|
|
93
|
+
-- =============================================================================
|
|
94
|
+
|
|
95
|
+
CREATE INDEX IF NOT EXISTS idx_spec_nodes_status ON spec_nodes(status);
|
|
96
|
+
CREATE INDEX IF NOT EXISTS idx_spec_nodes_file_path ON spec_nodes(file_path);
|
|
97
|
+
CREATE INDEX IF NOT EXISTS idx_commit_nodes_timestamp ON commit_nodes(timestamp);
|
|
98
|
+
CREATE INDEX IF NOT EXISTS idx_code_fragment_file_path ON code_fragment_nodes(file_path);
|
|
99
|
+
CREATE INDEX IF NOT EXISTS idx_code_fragment_path_lines ON code_fragment_nodes(file_path, start_line, end_line);
|
|
100
|
+
CREATE INDEX IF NOT EXISTS idx_scr_spec_id ON spec_commit_relations(spec_id);
|
|
101
|
+
CREATE INDEX IF NOT EXISTS idx_scr_commit_hash ON spec_commit_relations(commit_hash);
|
|
102
|
+
CREATE INDEX IF NOT EXISTS idx_cfr_commit_hash ON commit_fragment_relations(commit_hash);
|
|
103
|
+
CREATE INDEX IF NOT EXISTS idx_cfr_fragment_id ON commit_fragment_relations(fragment_id);
|
|
104
|
+
CREATE INDEX IF NOT EXISTS idx_ssr_source ON spec_spec_relations(source_id);
|
|
105
|
+
CREATE INDEX IF NOT EXISTS idx_ssr_target ON spec_spec_relations(target_id);
|
|
106
|
+
|
|
107
|
+
-- =============================================================================
|
|
108
|
+
-- Schema Version
|
|
109
|
+
-- =============================================================================
|
|
110
|
+
|
|
111
|
+
CREATE TABLE IF NOT EXISTS spec_schema_versions (
|
|
112
|
+
version INTEGER PRIMARY KEY,
|
|
113
|
+
applied_at INTEGER NOT NULL,
|
|
114
|
+
description TEXT
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
INSERT OR IGNORE INTO spec_schema_versions (version, applied_at, description)
|
|
118
|
+
VALUES (1, strftime('%s', 'now') * 1000, 'Initial Commit4Spec schema');
|
|
119
|
+
|
|
120
|
+
INSERT OR IGNORE INTO spec_schema_versions (version, applied_at, description)
|
|
121
|
+
VALUES (2, strftime('%s', 'now') * 1000, 'Add code_fragments_fts for content-based fragment search');
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { SqliteDatabase } from '../../db/sqlite-adapter';
|
|
8
8
|
import { SpecNode } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Parse a JSON-encoded subtitles array, returning [] on any failure.
|
|
11
|
+
* Shared by every query that reads `spec_nodes.subtitles`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseSubtitlesJson(raw: string): string[];
|
|
9
14
|
/**
|
|
10
15
|
* Insert or replace a SpecNode. Also updates the standalone FTS5 index
|
|
11
16
|
* with CJK-segmented text.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-node.d.ts","sourceRoot":"","sources":["../../../src/spec/db/spec-node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"spec-node.d.ts","sourceRoot":"","sources":["../../../src/spec/db/spec-node.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAqBpC;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAMxD;AAkBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CA2B3E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAMhF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAErG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3F;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAGnE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,cAAc,GAAG,QAAQ,EAAE,CAK3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,cAAc,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAW7F"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* text (see `fts.ts` for the segmentation logic).
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.parseSubtitlesJson = parseSubtitlesJson;
|
|
9
10
|
exports.insertSpecNode = insertSpecNode;
|
|
10
11
|
exports.findSpecById = findSpecById;
|
|
11
12
|
exports.updateSpecStatus = updateSpecStatus;
|
|
@@ -17,18 +18,23 @@ const fts_1 = require("./fts");
|
|
|
17
18
|
// ---------------------------------------------------------------------------
|
|
18
19
|
// Helpers
|
|
19
20
|
// ---------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Parse a JSON-encoded subtitles array, returning [] on any failure.
|
|
23
|
+
* Shared by every query that reads `spec_nodes.subtitles`.
|
|
24
|
+
*/
|
|
25
|
+
function parseSubtitlesJson(raw) {
|
|
22
26
|
try {
|
|
23
|
-
|
|
27
|
+
return JSON.parse(raw || '[]');
|
|
24
28
|
}
|
|
25
29
|
catch {
|
|
26
|
-
|
|
30
|
+
return [];
|
|
27
31
|
}
|
|
32
|
+
}
|
|
33
|
+
function rowToSpec(row) {
|
|
28
34
|
return {
|
|
29
35
|
id: row.id,
|
|
30
36
|
title: row.title,
|
|
31
|
-
subtitles,
|
|
37
|
+
subtitles: parseSubtitlesJson(row.subtitles),
|
|
32
38
|
status: row.status,
|
|
33
39
|
version: row.version,
|
|
34
40
|
filePath: row.file_path,
|
|
@@ -44,10 +50,10 @@ function rowToSpec(row) {
|
|
|
44
50
|
*/
|
|
45
51
|
function insertSpecNode(db, node) {
|
|
46
52
|
const subtitlesJson = JSON.stringify(node.subtitles);
|
|
47
|
-
db.prepare(`
|
|
48
|
-
INSERT OR REPLACE INTO spec_nodes
|
|
49
|
-
(id, title, subtitles, status, version, file_path, timestamp)
|
|
50
|
-
VALUES (@id, @title, @subtitles, @status, @version, @filePath, @timestamp)
|
|
53
|
+
db.prepare(`
|
|
54
|
+
INSERT OR REPLACE INTO spec_nodes
|
|
55
|
+
(id, title, subtitles, status, version, file_path, timestamp)
|
|
56
|
+
VALUES (@id, @title, @subtitles, @status, @version, @filePath, @timestamp)
|
|
51
57
|
`).run({
|
|
52
58
|
id: node.id,
|
|
53
59
|
title: node.title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec-node.js","sourceRoot":"","sources":["../../../src/spec/db/spec-node.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;
|
|
1
|
+
{"version":3,"file":"spec-node.js","sourceRoot":"","sources":["../../../src/spec/db/spec-node.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared SQL helpers for the spec db layer.
|
|
3
|
+
*
|
|
4
|
+
* @module spec/db/sql-utils
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Escape LIKE metacharacters (`%`, `_`) and the escape character itself so
|
|
8
|
+
* the input is matched literally in `LIKE ... ESCAPE '\'` queries.
|
|
9
|
+
*/
|
|
10
|
+
export declare function escapeLike(str: string): string;
|
|
11
|
+
//# sourceMappingURL=sql-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-utils.d.ts","sourceRoot":"","sources":["../../../src/spec/db/sql-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK9C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared SQL helpers for the spec db layer.
|
|
4
|
+
*
|
|
5
|
+
* @module spec/db/sql-utils
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.escapeLike = escapeLike;
|
|
9
|
+
/**
|
|
10
|
+
* Escape LIKE metacharacters (`%`, `_`) and the escape character itself so
|
|
11
|
+
* the input is matched literally in `LIKE ... ESCAPE '\'` queries.
|
|
12
|
+
*/
|
|
13
|
+
function escapeLike(str) {
|
|
14
|
+
return str
|
|
15
|
+
.replace(/\\/g, '\\\\')
|
|
16
|
+
.replace(/%/g, '\\%')
|
|
17
|
+
.replace(/_/g, '\\_');
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=sql-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sql-utils.js","sourceRoot":"","sources":["../../../src/spec/db/sql-utils.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAMH,gCAKC;AATD;;;GAGG;AACH,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG;SACP,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cluster-context.ts — Build cluster-level context summary for LLM spec evaluation.
|
|
3
|
+
*
|
|
4
|
+
* References mine/generator.ts buildClusterPrompt for the multi-commit
|
|
5
|
+
* context aggregation pattern, but uses simpler data (diff-based instead of
|
|
6
|
+
* AST-based) since evolve works with unified diffs.
|
|
7
|
+
*
|
|
8
|
+
* The ClusterContext / CommitSummary / CommitContextInput types live in
|
|
9
|
+
* `../types` so the LLM layer can depend on them without importing from a
|
|
10
|
+
* pipeline module.
|
|
11
|
+
*
|
|
12
|
+
* @module spec/evolve/cluster-context
|
|
13
|
+
*/
|
|
14
|
+
import { ClusterContext, CommitSummary, CommitContextInput } from '../types';
|
|
15
|
+
export type { ClusterContext, CommitSummary, CommitContextInput };
|
|
16
|
+
/**
|
|
17
|
+
* Build a cluster context summary for a group of commits affecting the same spec.
|
|
18
|
+
*
|
|
19
|
+
* Steps:
|
|
20
|
+
* 1. For each affecting commit, build a CommitSummary with changed files.
|
|
21
|
+
* The `truncatedDiff` field is left as a placeholder — the caller is
|
|
22
|
+
* responsible for injecting actual diffs via `getCommitDiff()` + `truncateText()`.
|
|
23
|
+
* 2. Compute primaryFiles: files changed in the most commits (top TOP_PRIMARY_FILES).
|
|
24
|
+
*
|
|
25
|
+
* @param affectingCommits - Commit info for commits affecting this spec.
|
|
26
|
+
* @param maxChars - Maximum total characters for commit summaries (default 12000).
|
|
27
|
+
* @returns ClusterContext ready for LLM prompt construction.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildClusterContext(affectingCommits: CommitContextInput[], maxChars?: number): ClusterContext;
|
|
30
|
+
//# sourceMappingURL=cluster-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-context.d.ts","sourceRoot":"","sources":["../../../src/spec/evolve/cluster-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE7E,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,CAAC;AAgBlE;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,kBAAkB,EAAE,EACtC,QAAQ,GAAE,MAAkC,GAC3C,cAAc,CA2ChB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* cluster-context.ts — Build cluster-level context summary for LLM spec evaluation.
|
|
4
|
+
*
|
|
5
|
+
* References mine/generator.ts buildClusterPrompt for the multi-commit
|
|
6
|
+
* context aggregation pattern, but uses simpler data (diff-based instead of
|
|
7
|
+
* AST-based) since evolve works with unified diffs.
|
|
8
|
+
*
|
|
9
|
+
* The ClusterContext / CommitSummary / CommitContextInput types live in
|
|
10
|
+
* `../types` so the LLM layer can depend on them without importing from a
|
|
11
|
+
* pipeline module.
|
|
12
|
+
*
|
|
13
|
+
* @module spec/evolve/cluster-context
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.buildClusterContext = buildClusterContext;
|
|
17
|
+
// =============================================================================
|
|
18
|
+
// Constants
|
|
19
|
+
// =============================================================================
|
|
20
|
+
/** Maximum total characters for the cluster context (~12K tokens @ ~0.25 token/char). */
|
|
21
|
+
const DEFAULT_MAX_CONTEXT_CHARS = 48000;
|
|
22
|
+
/** Number of top files reported in primaryFiles. */
|
|
23
|
+
const TOP_PRIMARY_FILES = 10;
|
|
24
|
+
// =============================================================================
|
|
25
|
+
// Public API
|
|
26
|
+
// =============================================================================
|
|
27
|
+
/**
|
|
28
|
+
* Build a cluster context summary for a group of commits affecting the same spec.
|
|
29
|
+
*
|
|
30
|
+
* Steps:
|
|
31
|
+
* 1. For each affecting commit, build a CommitSummary with changed files.
|
|
32
|
+
* The `truncatedDiff` field is left as a placeholder — the caller is
|
|
33
|
+
* responsible for injecting actual diffs via `getCommitDiff()` + `truncateText()`.
|
|
34
|
+
* 2. Compute primaryFiles: files changed in the most commits (top TOP_PRIMARY_FILES).
|
|
35
|
+
*
|
|
36
|
+
* @param affectingCommits - Commit info for commits affecting this spec.
|
|
37
|
+
* @param maxChars - Maximum total characters for commit summaries (default 12000).
|
|
38
|
+
* @returns ClusterContext ready for LLM prompt construction.
|
|
39
|
+
*/
|
|
40
|
+
function buildClusterContext(affectingCommits, maxChars = DEFAULT_MAX_CONTEXT_CHARS) {
|
|
41
|
+
// 1. Build commit summaries
|
|
42
|
+
const commitSummaries = [];
|
|
43
|
+
let usedBudget = 0;
|
|
44
|
+
// Track file frequency for primaryFiles
|
|
45
|
+
const fileFrequency = new Map();
|
|
46
|
+
for (const input of affectingCommits) {
|
|
47
|
+
const files = input.filePaths;
|
|
48
|
+
for (const f of files) {
|
|
49
|
+
fileFrequency.set(f, (fileFrequency.get(f) ?? 0) + 1);
|
|
50
|
+
}
|
|
51
|
+
// Per-commit overhead estimate: header + file list area
|
|
52
|
+
const overhead = 150; // "### abc1234 — message\n\nFiles: ...\n\n```diff\n...```\n\n"
|
|
53
|
+
const remainingForThis = maxChars - usedBudget - overhead;
|
|
54
|
+
if (remainingForThis <= 0)
|
|
55
|
+
break; // Budget exhausted
|
|
56
|
+
const summary = {
|
|
57
|
+
fullHash: input.commitHash,
|
|
58
|
+
shortHash: input.commitHash.slice(0, 7),
|
|
59
|
+
message: input.message ?? input.commitHash.slice(0, 7),
|
|
60
|
+
changedFiles: files,
|
|
61
|
+
// Placeholder — caller populates with actual diff
|
|
62
|
+
truncatedDiff: '',
|
|
63
|
+
};
|
|
64
|
+
commitSummaries.push(summary);
|
|
65
|
+
usedBudget += overhead;
|
|
66
|
+
}
|
|
67
|
+
// 2. Compute primaryFiles (top-N by frequency)
|
|
68
|
+
const primaryFiles = [...fileFrequency.entries()]
|
|
69
|
+
.sort((a, b) => b[1] - a[1])
|
|
70
|
+
.slice(0, TOP_PRIMARY_FILES)
|
|
71
|
+
.map(([file]) => file);
|
|
72
|
+
return {
|
|
73
|
+
commitCount: affectingCommits.length,
|
|
74
|
+
commitSummaries,
|
|
75
|
+
primaryFiles,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=cluster-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cluster-context.js","sourceRoot":"","sources":["../../../src/spec/evolve/cluster-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAiCH,kDA8CC;AAzED,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,yFAAyF;AACzF,MAAM,yBAAyB,GAAG,KAAK,CAAC;AAExC,oDAAoD;AACpD,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF;;;;;;;;;;;;GAYG;AACH,SAAgB,mBAAmB,CACjC,gBAAsC,EACtC,WAAmB,yBAAyB;IAE5C,4BAA4B;IAC5B,MAAM,eAAe,GAAoB,EAAE,CAAC;IAC5C,IAAI,UAAU,GAAG,CAAC,CAAC;IAEnB,wCAAwC;IACxC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,KAAK,MAAM,KAAK,IAAI,gBAAgB,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;QAC9B,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;YACtB,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,wDAAwD;QACxD,MAAM,QAAQ,GAAG,GAAG,CAAC,CAAC,+DAA+D;QACrF,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;QAC1D,IAAI,gBAAgB,IAAI,CAAC;YAAE,MAAM,CAAC,mBAAmB;QAErD,MAAM,OAAO,GAAkB;YAC7B,QAAQ,EAAE,KAAK,CAAC,UAAU;YAC1B,SAAS,EAAE,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YACvC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YACtD,YAAY,EAAE,KAAK;YACnB,kDAAkD;YAClD,aAAa,EAAE,EAAE;SAClB,CAAC;QAEF,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9B,UAAU,IAAI,QAAQ,CAAC;IACzB,CAAC;IAED,+CAA+C;IAC/C,MAAM,YAAY,GAAG,CAAC,GAAG,aAAa,CAAC,OAAO,EAAE,CAAC;SAC9C,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3B,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAEzB,OAAO;QACL,WAAW,EAAE,gBAAgB,CAAC,MAAM;QACpC,eAAe;QACf,YAAY;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* commit-spec-analyzer.ts — Batch analysis of incremental commits.
|
|
3
|
+
*
|
|
4
|
+
* References build pipeline's scan() Strategy A pattern: iterate commits,
|
|
5
|
+
* resolve scopes, extract metadata, parse diffs — all before any DB writes.
|
|
6
|
+
*
|
|
7
|
+
* @module spec/evolve/commit-spec-analyzer
|
|
8
|
+
*/
|
|
9
|
+
import { SpecConfig } from '../config';
|
|
10
|
+
import { CommitInfo } from '../git';
|
|
11
|
+
import { SpecMetadata } from '../build/spec-extractor';
|
|
12
|
+
import { DiffFragment } from '../build/diff-parser';
|
|
13
|
+
/** Result of analyzing a single commit for spec match. */
|
|
14
|
+
export interface CommitSpecAnalysis {
|
|
15
|
+
/** The commit being analyzed. */
|
|
16
|
+
commit: CommitInfo;
|
|
17
|
+
/** Whether the commit's scope matched a local spec. */
|
|
18
|
+
matched: boolean;
|
|
19
|
+
/** Resolved spec ID (only when matched). */
|
|
20
|
+
specId?: string;
|
|
21
|
+
/** Extracted spec metadata (only when matched). */
|
|
22
|
+
metadata?: SpecMetadata;
|
|
23
|
+
/** Parsed diff fragments (only when matched). */
|
|
24
|
+
fragments?: DiffFragment[];
|
|
25
|
+
/** Human-readable reason for non-match. */
|
|
26
|
+
skipReason?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Batch-analyze a list of incremental commits for spec matching.
|
|
30
|
+
*
|
|
31
|
+
* For each commit:
|
|
32
|
+
* 1. Resolve scope from commit message.
|
|
33
|
+
* 2. If scope matches a local spec file, extract metadata and parse the diff.
|
|
34
|
+
* 3. Return a CommitSpecAnalysis for every commit (matched or not).
|
|
35
|
+
*
|
|
36
|
+
* This function performs NO database writes. All side effects are read-only:
|
|
37
|
+
* `getCommitDiff()` and `analyzeCommitDiff()` read from the git repo's
|
|
38
|
+
* object store but do not modify anything.
|
|
39
|
+
*
|
|
40
|
+
* The most expensive operations (`getCommitDiff` + `analyzeCommitDiff`) are
|
|
41
|
+
* only performed for scope-matched commits so that unmatched commits are
|
|
42
|
+
* nearly zero-cost during scan.
|
|
43
|
+
*
|
|
44
|
+
* @param repoPath - Absolute path to the git repository.
|
|
45
|
+
* @param specStoragePath - Path to spec storage directory.
|
|
46
|
+
* @param commits - Incremental commits to analyze (chronological order).
|
|
47
|
+
* @param config - Resolved SpecConfig.
|
|
48
|
+
* @returns Array of CommitSpecAnalysis, one per input commit.
|
|
49
|
+
*/
|
|
50
|
+
export declare function analyzeIncrementalCommits(repoPath: string, specStoragePath: string, commits: CommitInfo[], config: SpecConfig): CommitSpecAnalysis[];
|
|
51
|
+
//# sourceMappingURL=commit-spec-analyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-spec-analyzer.d.ts","sourceRoot":"","sources":["../../../src/spec/evolve/commit-spec-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAiB,MAAM,QAAQ,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAqB,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAOvE,0DAA0D;AAC1D,MAAM,WAAW,kBAAkB;IACjC,iCAAiC;IACjC,MAAM,EAAE,UAAU,CAAC;IACnB,uDAAuD;IACvD,OAAO,EAAE,OAAO,CAAC;IACjB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,iDAAiD;IACjD,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;IAC3B,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,UAAU,EAAE,EACrB,MAAM,EAAE,UAAU,GACjB,kBAAkB,EAAE,CAqDtB"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* commit-spec-analyzer.ts — Batch analysis of incremental commits.
|
|
4
|
+
*
|
|
5
|
+
* References build pipeline's scan() Strategy A pattern: iterate commits,
|
|
6
|
+
* resolve scopes, extract metadata, parse diffs — all before any DB writes.
|
|
7
|
+
*
|
|
8
|
+
* @module spec/evolve/commit-spec-analyzer
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.analyzeIncrementalCommits = analyzeIncrementalCommits;
|
|
12
|
+
const git_1 = require("../git");
|
|
13
|
+
const scan_1 = require("../build/scan");
|
|
14
|
+
const diff_parser_1 = require("../build/diff-parser");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// Public API
|
|
18
|
+
// =============================================================================
|
|
19
|
+
/**
|
|
20
|
+
* Batch-analyze a list of incremental commits for spec matching.
|
|
21
|
+
*
|
|
22
|
+
* For each commit:
|
|
23
|
+
* 1. Resolve scope from commit message.
|
|
24
|
+
* 2. If scope matches a local spec file, extract metadata and parse the diff.
|
|
25
|
+
* 3. Return a CommitSpecAnalysis for every commit (matched or not).
|
|
26
|
+
*
|
|
27
|
+
* This function performs NO database writes. All side effects are read-only:
|
|
28
|
+
* `getCommitDiff()` and `analyzeCommitDiff()` read from the git repo's
|
|
29
|
+
* object store but do not modify anything.
|
|
30
|
+
*
|
|
31
|
+
* The most expensive operations (`getCommitDiff` + `analyzeCommitDiff`) are
|
|
32
|
+
* only performed for scope-matched commits so that unmatched commits are
|
|
33
|
+
* nearly zero-cost during scan.
|
|
34
|
+
*
|
|
35
|
+
* @param repoPath - Absolute path to the git repository.
|
|
36
|
+
* @param specStoragePath - Path to spec storage directory.
|
|
37
|
+
* @param commits - Incremental commits to analyze (chronological order).
|
|
38
|
+
* @param config - Resolved SpecConfig.
|
|
39
|
+
* @returns Array of CommitSpecAnalysis, one per input commit.
|
|
40
|
+
*/
|
|
41
|
+
function analyzeIncrementalCommits(repoPath, specStoragePath, commits, config) {
|
|
42
|
+
const results = [];
|
|
43
|
+
// Hoist the directory read out of the per-commit loop.
|
|
44
|
+
const specIds = new Set((0, utils_1.discoverSpecs)(specStoragePath).map((e) => e.specId));
|
|
45
|
+
for (const commit of commits) {
|
|
46
|
+
// 1. Scope resolution + spec metadata
|
|
47
|
+
const { specId, metadata } = (0, scan_1.matchCommitToSpec)(commit.message, specIds, specStoragePath, config);
|
|
48
|
+
if (!specId) {
|
|
49
|
+
results.push({
|
|
50
|
+
commit,
|
|
51
|
+
matched: false,
|
|
52
|
+
skipReason: 'Commit message scope did not match any local spec',
|
|
53
|
+
});
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (!metadata) {
|
|
57
|
+
results.push({
|
|
58
|
+
commit,
|
|
59
|
+
matched: false,
|
|
60
|
+
skipReason: `Scope "${specId}" matched but no valid spec metadata found`,
|
|
61
|
+
});
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// 3. Parse diff (only for matched commits — the expensive step)
|
|
65
|
+
let fragments;
|
|
66
|
+
try {
|
|
67
|
+
const diff = (0, git_1.getCommitDiff)(repoPath, commit.hash);
|
|
68
|
+
fragments = (0, diff_parser_1.analyzeCommitDiff)(repoPath, commit.hash, diff);
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
results.push({
|
|
72
|
+
commit,
|
|
73
|
+
matched: false,
|
|
74
|
+
skipReason: `Diff analysis failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
75
|
+
});
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
results.push({
|
|
79
|
+
commit,
|
|
80
|
+
matched: true,
|
|
81
|
+
specId,
|
|
82
|
+
metadata,
|
|
83
|
+
fragments,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return results;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=commit-spec-analyzer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit-spec-analyzer.js","sourceRoot":"","sources":["../../../src/spec/evolve/commit-spec-analyzer.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAuDH,8DA0DC;AA9GD,gCAAmD;AACnD,wCAAkD;AAElD,sDAAuE;AACvE,oCAAyC;AAsBzC,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,yBAAyB,CACvC,QAAgB,EAChB,eAAuB,EACvB,OAAqB,EACrB,MAAkB;IAElB,MAAM,OAAO,GAAyB,EAAE,CAAC;IAEzC,uDAAuD;IACvD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAA,qBAAa,EAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAE7E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,sCAAsC;QACtC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,wBAAiB,EAC5C,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,CACjD,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC;gBACX,MAAM;gBACN,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,mDAAmD;aAChE,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC;gBACX,MAAM;gBACN,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,UAAU,MAAM,4CAA4C;aACzE,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,gEAAgE;QAChE,IAAI,SAAyB,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAA,mBAAa,EAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAClD,SAAS,GAAG,IAAA,+BAAiB,EAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7D,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,IAAI,CAAC;gBACX,MAAM;gBACN,OAAO,EAAE,KAAK;gBACd,UAAU,EAAE,yBAAyB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;aACxF,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,OAAO,CAAC,IAAI,CAAC;YACX,MAAM;YACN,OAAO,EAAE,IAAI;YACb,MAAM;YACN,QAAQ;YACR,SAAS;SACV,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|