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
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Unified diff parser — converts `git diff` output into structured code
|
|
4
|
+
* fragments.
|
|
5
|
+
*
|
|
6
|
+
* Replaces `commit4spec/reverse_engineer/change_analyzer.py`. Parses
|
|
7
|
+
* unified diff output and extracts file-level change information (change
|
|
8
|
+
* type, line range, diff text).
|
|
9
|
+
*
|
|
10
|
+
* @module spec/build/diff-parser
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.analyzeCommitDiff = analyzeCommitDiff;
|
|
14
|
+
exports.listChangedFiles = listChangedFiles;
|
|
15
|
+
exports.parseDiff = parseDiff;
|
|
16
|
+
const git_1 = require("../git");
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// analyzeCommitDiff
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* Retrieve and parse the diff for a single commit.
|
|
22
|
+
*
|
|
23
|
+
* 1. Call `getCommitDiff(repoPath, commitHash)` to get raw diff text.
|
|
24
|
+
* 2. Parse the diff into structured `DiffFragment` objects.
|
|
25
|
+
* 3. Return the fragments.
|
|
26
|
+
*
|
|
27
|
+
* Returns an empty array when the diff cannot be retrieved or is empty.
|
|
28
|
+
*/
|
|
29
|
+
function analyzeCommitDiff(repoPath, commitHash, preFetchedDiff) {
|
|
30
|
+
const diff = preFetchedDiff ?? (0, git_1.getCommitDiff)(repoPath, commitHash);
|
|
31
|
+
if (!diff) {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return parseDiff(diff);
|
|
35
|
+
}
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// listChangedFiles
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
/**
|
|
40
|
+
* Parse changed file paths from a unified diff string.
|
|
41
|
+
*
|
|
42
|
+
* Matches `--- a/path` and `+++ b/path` headers to identify files,
|
|
43
|
+
* skipping `/dev/null`. Returns a list of unique changed file paths.
|
|
44
|
+
*
|
|
45
|
+
* Both headers are needed:
|
|
46
|
+
* - `+++ b/` captures added and modified files. For deletions the line is
|
|
47
|
+
* `+++ /dev/null`, which is skipped.
|
|
48
|
+
* - `--- a/` captures deleted files. For additions the line is
|
|
49
|
+
* `--- /dev/null`, which is skipped.
|
|
50
|
+
*/
|
|
51
|
+
function listChangedFiles(diff) {
|
|
52
|
+
const files = new Set();
|
|
53
|
+
const lines = diff.split('\n');
|
|
54
|
+
for (const line of lines) {
|
|
55
|
+
let match = /^\+\+\+ b\/(.+)$/.exec(line);
|
|
56
|
+
if (match) {
|
|
57
|
+
const fp = match[1];
|
|
58
|
+
if (fp !== '/dev/null') {
|
|
59
|
+
files.add(fp);
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
match = /^--- a\/(.+)$/.exec(line);
|
|
64
|
+
if (match) {
|
|
65
|
+
const fp = match[1];
|
|
66
|
+
if (fp !== '/dev/null') {
|
|
67
|
+
files.add(fp);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return Array.from(files);
|
|
72
|
+
}
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// parseDiff
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
/**
|
|
77
|
+
* State-machine parser for unified diff format.
|
|
78
|
+
*
|
|
79
|
+
* Walks through the diff line-by-line, tracking the current file, change
|
|
80
|
+
* type, and line-number range. Accumulates lines into a buffer and emits a
|
|
81
|
+
* `DiffFragment` each time a new `diff --git` section begins (or when the
|
|
82
|
+
* input is exhausted).
|
|
83
|
+
*/
|
|
84
|
+
function parseDiff(diff) {
|
|
85
|
+
const lines = diff.split('\n');
|
|
86
|
+
// ---- state ----
|
|
87
|
+
const fragments = [];
|
|
88
|
+
let buf = [];
|
|
89
|
+
let currentFilePath = null;
|
|
90
|
+
let currentChangeType = 'MODIFY';
|
|
91
|
+
let currentStartLine = 0;
|
|
92
|
+
let currentEndLine = 0;
|
|
93
|
+
let inHunk = false;
|
|
94
|
+
// ---- flush helper ----
|
|
95
|
+
const _flush = () => {
|
|
96
|
+
if (buf.length === 0 || currentFilePath === null) {
|
|
97
|
+
buf = [];
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// DELETE files have no lines in the new version — use [0, 0].
|
|
101
|
+
let startLine;
|
|
102
|
+
let endLine;
|
|
103
|
+
if (currentChangeType === 'DELETE') {
|
|
104
|
+
startLine = 0;
|
|
105
|
+
endLine = 0;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// When no hunk was ever encountered, default startLine to 1.
|
|
109
|
+
startLine = currentStartLine === 0 ? 1 : currentStartLine;
|
|
110
|
+
endLine = currentEndLine;
|
|
111
|
+
}
|
|
112
|
+
fragments.push({
|
|
113
|
+
filePath: currentFilePath,
|
|
114
|
+
changeType: currentChangeType,
|
|
115
|
+
startLine,
|
|
116
|
+
endLine,
|
|
117
|
+
codeDiff: buf.join('\n'),
|
|
118
|
+
});
|
|
119
|
+
buf = [];
|
|
120
|
+
};
|
|
121
|
+
// ---- line-by-line parser ----
|
|
122
|
+
for (const line of lines) {
|
|
123
|
+
// Rule 1 — new file section: flush the previous file.
|
|
124
|
+
if (line.startsWith('diff --git ')) {
|
|
125
|
+
_flush();
|
|
126
|
+
buf = [line];
|
|
127
|
+
currentFilePath = null;
|
|
128
|
+
currentChangeType = 'MODIFY';
|
|
129
|
+
currentStartLine = 0;
|
|
130
|
+
currentEndLine = 0;
|
|
131
|
+
inHunk = false;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// Rule 2 — new file mode → change type is ADD.
|
|
135
|
+
if (line.startsWith('new file mode ')) {
|
|
136
|
+
currentChangeType = 'ADD';
|
|
137
|
+
buf.push(line);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
// Rule 3 — deleted file mode → change type is DELETE.
|
|
141
|
+
if (line.startsWith('deleted file mode ')) {
|
|
142
|
+
currentChangeType = 'DELETE';
|
|
143
|
+
buf.push(line);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
// Rule 4 — file path lines (--- a/path or +++ b/path).
|
|
147
|
+
if (line.startsWith('--- a/') || line.startsWith('+++ b/')) {
|
|
148
|
+
const isPlus = line.startsWith('+++ b/');
|
|
149
|
+
// Extract the path, skipping `/dev/null`.
|
|
150
|
+
let pathPart = '';
|
|
151
|
+
if (isPlus) {
|
|
152
|
+
pathPart = line.slice(6); // '+++ b/'.length
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
pathPart = line.slice(6); // '--- a/'.length
|
|
156
|
+
}
|
|
157
|
+
if (pathPart !== '/dev/null') {
|
|
158
|
+
currentFilePath = pathPart;
|
|
159
|
+
}
|
|
160
|
+
buf.push(line);
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
// Rule 5 — hunk header: @@ -oldStart[,oldCount] +newStart[,newCount] @@
|
|
164
|
+
const hunkMatch = line.match(/^@@ -\d+(?:,\d+)? \+(\d+)(?:,\d+)? @@/);
|
|
165
|
+
if (hunkMatch) {
|
|
166
|
+
const newStart = parseInt(hunkMatch[1], 10);
|
|
167
|
+
if (currentStartLine === 0) {
|
|
168
|
+
currentStartLine = newStart;
|
|
169
|
+
}
|
|
170
|
+
currentEndLine = newStart;
|
|
171
|
+
inHunk = true;
|
|
172
|
+
buf.push(line);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
// Rule 6 — added lines (start with '+', but not '+++').
|
|
176
|
+
if (line.startsWith('+') && !line.startsWith('+++')) {
|
|
177
|
+
if (inHunk) {
|
|
178
|
+
currentEndLine++;
|
|
179
|
+
}
|
|
180
|
+
buf.push(line);
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
// Rule 7 — removed lines (start with '-', but not '---').
|
|
184
|
+
if (line.startsWith('-') && !line.startsWith('---')) {
|
|
185
|
+
buf.push(line);
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
// Rule 8 — context lines (start with a space).
|
|
189
|
+
if (line.startsWith(' ')) {
|
|
190
|
+
if (inHunk) {
|
|
191
|
+
currentEndLine++;
|
|
192
|
+
}
|
|
193
|
+
buf.push(line);
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
// Rule 9 — all other lines (e.g. `rename from` / `rename to`,
|
|
197
|
+
// `similarity index`, `Binary files differ`, `\ No newline at end of
|
|
198
|
+
// file`, blank lines between sections, etc.).
|
|
199
|
+
buf.push(line);
|
|
200
|
+
}
|
|
201
|
+
// Flush the final file.
|
|
202
|
+
_flush();
|
|
203
|
+
return fragments;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=diff-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-parser.js","sourceRoot":"","sources":["../../../src/spec/build/diff-parser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAkCH,8CAUC;AAkBD,4CAqBC;AAcD,8BA0IC;AAzOD,gCAAuC;AAmBvC,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,QAAgB,EAChB,UAAkB,EAClB,cAAuB;IAEvB,MAAM,IAAI,GAAG,cAAc,IAAI,IAAA,mBAAa,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACnE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E;;;;;;;;;;;GAWG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;YACrB,IAAI,EAAE,KAAK,WAAW,EAAE,CAAC;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GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,SAAS;QACX,CAAC;QAED,+CAA+C;QAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,IAAI,MAAM,EAAE,CAAC;gBACX,cAAc,EAAE,CAAC;YACnB,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACf,SAAS;QACX,CAAC;QAED,8DAA8D;QAC9D,qEAAqE;QACrE,8CAA8C;QAC9C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IAED,wBAAwB;IACxB,MAAM,EAAE,CAAC;IAET,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build pipeline orchestrator — main entry point for building spec
|
|
3
|
+
* knowledge from Git history.
|
|
4
|
+
*
|
|
5
|
+
* Replaces `commit4spec/reverse_engineer/pipeline.py`. Discovers spec↔commit
|
|
6
|
+
* pairs via `scan()`, persists them into the SQLite knowledge graph, and
|
|
7
|
+
* writes a `.homegraph/commit4spec/meta.json` anchor so the self-evolve pipeline can
|
|
8
|
+
* pick up where build left off.
|
|
9
|
+
*
|
|
10
|
+
* @module spec/build/pipeline
|
|
11
|
+
*/
|
|
12
|
+
import { SqliteDatabase } from '../../db/sqlite-adapter';
|
|
13
|
+
import type { ProgressCallback } from '../ui';
|
|
14
|
+
export interface BuildResult {
|
|
15
|
+
specsFound: number;
|
|
16
|
+
commitsFound: number;
|
|
17
|
+
fragmentsFound: number;
|
|
18
|
+
relationsCreated: number;
|
|
19
|
+
totalEntries: number;
|
|
20
|
+
skippedEntries: Array<{
|
|
21
|
+
specId: string;
|
|
22
|
+
reason: string;
|
|
23
|
+
}>;
|
|
24
|
+
upToDate?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Run the full build pipeline.
|
|
28
|
+
*
|
|
29
|
+
* Steps (ported from `pipeline.py:49-151`):
|
|
30
|
+
*
|
|
31
|
+
* 1. Initialise the spec knowledge-graph schema in the database.
|
|
32
|
+
* 2. Discover all specs on disk (for the `totalEntries` count).
|
|
33
|
+
* 3. Scan the repository for spec↔commit pairs.
|
|
34
|
+
* 4. Sort pairs by commit timestamp ascending so that `INSERT OR REPLACE`
|
|
35
|
+
* gives the most-recent commit the final word for each spec node.
|
|
36
|
+
* 5. Process each pair:
|
|
37
|
+
* - Insert a SpecNode (once per specId; deduplicated by commit timestamp).
|
|
38
|
+
* - Insert a CommitNode (once per commit hash).
|
|
39
|
+
* - Insert a SUMMARIZED_FROM relation.
|
|
40
|
+
* - Parse the commit diff into code fragments and persist them.
|
|
41
|
+
* 6. Build a list of specs discovered on disk but never matched to a commit.
|
|
42
|
+
* 7. Write `.homegraph/commit4spec/meta.json`.
|
|
43
|
+
* 8. Return the `BuildResult` with all counts.
|
|
44
|
+
*
|
|
45
|
+
* Edge cases:
|
|
46
|
+
* - Empty pairs → zero counts, write meta anyway, return result.
|
|
47
|
+
* - Pair with commit metadata but no spec metadata → commit and fragments
|
|
48
|
+
* are still persisted; SpecNode and spec_commit_relation are skipped.
|
|
49
|
+
* - Pair with spec metadata but no commit metadata → entire pair is skipped.
|
|
50
|
+
* - Same spec in multiple pairs → only counted once in `specsFound`, but
|
|
51
|
+
* every commit relation is created.
|
|
52
|
+
*/
|
|
53
|
+
export declare function runBuildPipeline(repoPath: string, specStoragePath: string, db: SqliteDatabase, onProgress?: ProgressCallback): BuildResult;
|
|
54
|
+
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/spec/build/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAWzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAM9C,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,EAAE,EAAE,cAAc,EAClB,UAAU,CAAC,EAAE,gBAAgB,GAC5B,WAAW,CAoIb"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Build pipeline orchestrator — main entry point for building spec
|
|
4
|
+
* knowledge from Git history.
|
|
5
|
+
*
|
|
6
|
+
* Replaces `commit4spec/reverse_engineer/pipeline.py`. Discovers spec↔commit
|
|
7
|
+
* pairs via `scan()`, persists them into the SQLite knowledge graph, and
|
|
8
|
+
* writes a `.homegraph/commit4spec/meta.json` anchor so the self-evolve pipeline can
|
|
9
|
+
* pick up where build left off.
|
|
10
|
+
*
|
|
11
|
+
* @module spec/build/pipeline
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.runBuildPipeline = runBuildPipeline;
|
|
15
|
+
const config_1 = require("../config");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
const schema_1 = require("../db/schema");
|
|
18
|
+
const commit_node_1 = require("../db/commit-node");
|
|
19
|
+
const relations_1 = require("../db/relations");
|
|
20
|
+
const persist_1 = require("../db/persist");
|
|
21
|
+
const scan_1 = require("./scan");
|
|
22
|
+
const git_1 = require("../git");
|
|
23
|
+
const diff_parser_1 = require("./diff-parser");
|
|
24
|
+
const errors_1 = require("../../errors");
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// runBuildPipeline
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
/**
|
|
29
|
+
* Run the full build pipeline.
|
|
30
|
+
*
|
|
31
|
+
* Steps (ported from `pipeline.py:49-151`):
|
|
32
|
+
*
|
|
33
|
+
* 1. Initialise the spec knowledge-graph schema in the database.
|
|
34
|
+
* 2. Discover all specs on disk (for the `totalEntries` count).
|
|
35
|
+
* 3. Scan the repository for spec↔commit pairs.
|
|
36
|
+
* 4. Sort pairs by commit timestamp ascending so that `INSERT OR REPLACE`
|
|
37
|
+
* gives the most-recent commit the final word for each spec node.
|
|
38
|
+
* 5. Process each pair:
|
|
39
|
+
* - Insert a SpecNode (once per specId; deduplicated by commit timestamp).
|
|
40
|
+
* - Insert a CommitNode (once per commit hash).
|
|
41
|
+
* - Insert a SUMMARIZED_FROM relation.
|
|
42
|
+
* - Parse the commit diff into code fragments and persist them.
|
|
43
|
+
* 6. Build a list of specs discovered on disk but never matched to a commit.
|
|
44
|
+
* 7. Write `.homegraph/commit4spec/meta.json`.
|
|
45
|
+
* 8. Return the `BuildResult` with all counts.
|
|
46
|
+
*
|
|
47
|
+
* Edge cases:
|
|
48
|
+
* - Empty pairs → zero counts, write meta anyway, return result.
|
|
49
|
+
* - Pair with commit metadata but no spec metadata → commit and fragments
|
|
50
|
+
* are still persisted; SpecNode and spec_commit_relation are skipped.
|
|
51
|
+
* - Pair with spec metadata but no commit metadata → entire pair is skipped.
|
|
52
|
+
* - Same spec in multiple pairs → only counted once in `specsFound`, but
|
|
53
|
+
* every commit relation is created.
|
|
54
|
+
*/
|
|
55
|
+
function runBuildPipeline(repoPath, specStoragePath, db, onProgress) {
|
|
56
|
+
// Pre-check: if meta.json exists and HEAD hasn't changed since the last
|
|
57
|
+
// build, the knowledge graph is already current — skip the full rebuild.
|
|
58
|
+
const existingMeta = (0, utils_1.readMeta)(repoPath);
|
|
59
|
+
if (existingMeta?.currentCommitID) {
|
|
60
|
+
const headHash = (0, git_1.getHeadHash)(repoPath);
|
|
61
|
+
if (headHash && headHash === existingMeta.currentCommitID) {
|
|
62
|
+
(0, errors_1.logDebug)('Skipping spec build: knowledge graph is up to date', {
|
|
63
|
+
currentCommitID: existingMeta.currentCommitID,
|
|
64
|
+
});
|
|
65
|
+
return {
|
|
66
|
+
specsFound: 0,
|
|
67
|
+
commitsFound: 0,
|
|
68
|
+
fragmentsFound: 0,
|
|
69
|
+
relationsCreated: 0,
|
|
70
|
+
totalEntries: (0, utils_1.discoverSpecs)(specStoragePath).length,
|
|
71
|
+
skippedEntries: [],
|
|
72
|
+
upToDate: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// ---- Step 1: init schema ----
|
|
77
|
+
(0, schema_1.initSpecSchema)(db);
|
|
78
|
+
// ---- Step 2: discover specs (for totalEntries) ----
|
|
79
|
+
const allEntries = (0, utils_1.discoverSpecs)(specStoragePath);
|
|
80
|
+
const totalEntries = allEntries.length;
|
|
81
|
+
// ---- Step 3: scan for pairs ----
|
|
82
|
+
const pairs = (0, scan_1.scan)(repoPath, specStoragePath, (0, config_1.loadSpecConfig)(repoPath), onProgress);
|
|
83
|
+
// ---- Step 4: sort by commit timestamp ascending (oldest first) ----
|
|
84
|
+
// INSERT OR REPLACE is used for SpecNode — when the same spec appears
|
|
85
|
+
// in multiple pairs, the LAST write (most-recent commit) naturally wins.
|
|
86
|
+
pairs.sort((a, b) => {
|
|
87
|
+
const aTs = a.commitMetadata?.timestamp ?? 0;
|
|
88
|
+
const bTs = b.commitMetadata?.timestamp ?? 0;
|
|
89
|
+
return aTs - bTs;
|
|
90
|
+
});
|
|
91
|
+
// ---- Step 5: process pairs ----
|
|
92
|
+
const writtenSpecIds = new Set();
|
|
93
|
+
const seenCommitHashes = new Set();
|
|
94
|
+
let specsFound = 0;
|
|
95
|
+
let commitsFound = 0;
|
|
96
|
+
let fragmentsFound = 0;
|
|
97
|
+
let relationsCreated = 0;
|
|
98
|
+
const pairsTotal = pairs.length;
|
|
99
|
+
let pairsCurrent = 0;
|
|
100
|
+
for (const pair of pairs) {
|
|
101
|
+
pairsCurrent++;
|
|
102
|
+
onProgress?.({
|
|
103
|
+
phase: 'persisting',
|
|
104
|
+
current: pairsCurrent,
|
|
105
|
+
total: pairsTotal,
|
|
106
|
+
message: `${pair.specId} @ ${pair.commitHash.slice(0, 7)}`,
|
|
107
|
+
});
|
|
108
|
+
// Skip if no commit metadata (no data to insert).
|
|
109
|
+
const cm = pair.commitMetadata;
|
|
110
|
+
if (!cm) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const sm = pair.specMetadata;
|
|
114
|
+
// Insert SpecNode if spec metadata is present.
|
|
115
|
+
// INSERT OR REPLACE lets the most-recent commit (last in ascending
|
|
116
|
+
// order) overwrite the timestamp. We still track writtenSpecIds to
|
|
117
|
+
// correctly count distinct specs (not overwrites).
|
|
118
|
+
if (sm) {
|
|
119
|
+
(0, errors_1.logDebug)('Processing pair: inserting SpecNode', {
|
|
120
|
+
specId: sm.specId,
|
|
121
|
+
title: sm.title,
|
|
122
|
+
});
|
|
123
|
+
(0, persist_1.upsertSpecFromMetadata)(db, sm, cm.timestamp);
|
|
124
|
+
if (!writtenSpecIds.has(pair.specId)) {
|
|
125
|
+
writtenSpecIds.add(pair.specId);
|
|
126
|
+
specsFound++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Insert CommitNode if not yet seen.
|
|
130
|
+
if (!seenCommitHashes.has(cm.hash)) {
|
|
131
|
+
(0, commit_node_1.insertCommitNode)(db, {
|
|
132
|
+
hash: cm.hash,
|
|
133
|
+
message: cm.message,
|
|
134
|
+
author: cm.author,
|
|
135
|
+
timestamp: cm.timestamp,
|
|
136
|
+
});
|
|
137
|
+
seenCommitHashes.add(cm.hash);
|
|
138
|
+
commitsFound++;
|
|
139
|
+
}
|
|
140
|
+
// Insert spec_commit_relation (only when spec metadata exists).
|
|
141
|
+
if (sm) {
|
|
142
|
+
(0, relations_1.insertSpecCommitRelation)(db, pair.specId, cm.hash, 'SUMMARIZED_FROM');
|
|
143
|
+
relationsCreated++;
|
|
144
|
+
}
|
|
145
|
+
// ---- Analyze diff and insert fragments ----
|
|
146
|
+
const preFetchedDiff = (0, git_1.getCommitDiff)(repoPath, cm.hash);
|
|
147
|
+
const fragments = (0, diff_parser_1.analyzeCommitDiff)(repoPath, cm.hash, preFetchedDiff);
|
|
148
|
+
const persisted = (0, persist_1.persistCommitFragments)(db, cm.hash, fragments);
|
|
149
|
+
fragmentsFound += persisted.fragmentsInserted;
|
|
150
|
+
relationsCreated += persisted.relationsCreated;
|
|
151
|
+
}
|
|
152
|
+
// ---- Step 6: build skipped entries ----
|
|
153
|
+
const skippedEntries = allEntries
|
|
154
|
+
.filter((e) => !writtenSpecIds.has(e.specId))
|
|
155
|
+
.map((e) => ({ specId: e.specId, reason: 'No matching commits found' }));
|
|
156
|
+
// ---- Step 7: write meta ----
|
|
157
|
+
const headHash = (0, git_1.getHeadHash)(repoPath) ?? undefined;
|
|
158
|
+
(0, utils_1.writeMeta)(repoPath, specStoragePath, headHash);
|
|
159
|
+
onProgress?.({ phase: 'done', current: 0, total: 0 });
|
|
160
|
+
// ---- Step 8: return result ----
|
|
161
|
+
return {
|
|
162
|
+
specsFound,
|
|
163
|
+
commitsFound,
|
|
164
|
+
fragmentsFound,
|
|
165
|
+
relationsCreated,
|
|
166
|
+
totalEntries,
|
|
167
|
+
skippedEntries,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../src/spec/build/pipeline.ts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CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACvE,MAAM,SAAS,GAAG,IAAA,gCAAsB,EAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACjE,cAAc,IAAI,SAAS,CAAC,iBAAiB,CAAC;QAC9C,gBAAgB,IAAI,SAAS,CAAC,gBAAgB,CAAC;IACjD,CAAC;IAED,0CAA0C;IAC1C,MAAM,cAAc,GAAG,UAAU;SAC9B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,2BAA2B,EAAE,CAAC,CAAC,CAAC;IAE3E,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,IAAA,iBAAW,EAAC,QAAQ,CAAC,IAAI,SAAS,CAAC;IACpD,IAAA,iBAAS,EAAC,QAAQ,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;IAE/C,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAEtD,kCAAkC;IAClC,OAAO;QACL,UAAU;QACV,YAAY;QACZ,cAAc;QACd,gBAAgB;QAChB,YAAY;QACZ,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec↔commit pairing — discovers which commits reference which specs via
|
|
3
|
+
* conventional-commit scope extraction.
|
|
4
|
+
*
|
|
5
|
+
* Replaces `commit4spec/reverse_engineer/git_scanner.py`'s `scan()` (Strategy
|
|
6
|
+
* A). Shared by the build pipeline and the evolve pipeline's incremental
|
|
7
|
+
* commit analyzer.
|
|
8
|
+
*
|
|
9
|
+
* @module spec/build/scan
|
|
10
|
+
*/
|
|
11
|
+
import { SpecConfig } from '../config';
|
|
12
|
+
import { CommitInfo } from '../git';
|
|
13
|
+
import type { ProgressCallback } from '../ui';
|
|
14
|
+
import { SpecMetadata } from './spec-extractor';
|
|
15
|
+
export interface SpecCommitPair {
|
|
16
|
+
specId: string;
|
|
17
|
+
commitHash: string;
|
|
18
|
+
specMetadata: SpecMetadata | null;
|
|
19
|
+
commitMetadata: CommitInfo | null;
|
|
20
|
+
}
|
|
21
|
+
/** Result of matching a single commit message against the on-disk specs. */
|
|
22
|
+
export interface SpecMatch {
|
|
23
|
+
/** Resolved spec ID, or null when the commit scope matched nothing. */
|
|
24
|
+
specId: string | null;
|
|
25
|
+
/** Extracted spec metadata (null when the spec doc could not be read). */
|
|
26
|
+
metadata: SpecMetadata | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Match a single commit message to an on-disk spec: resolve the
|
|
30
|
+
* conventional-commit scope to a spec ID, then extract that spec's metadata.
|
|
31
|
+
*
|
|
32
|
+
* This is the shared per-commit matching step used by both {@link scan}
|
|
33
|
+
* (build) and the evolve pipeline's incremental analyzer.
|
|
34
|
+
*/
|
|
35
|
+
export declare function matchCommitToSpec(message: string, specIds: Set<string>, specStoragePath: string, config: SpecConfig): SpecMatch;
|
|
36
|
+
/**
|
|
37
|
+
* Main scanning function — discovers spec↔commit pairs from commit history.
|
|
38
|
+
*
|
|
39
|
+
* Iterates every commit in the repo, extracts a conventional-commit scope from
|
|
40
|
+
* its message, normalizes it, and checks whether the resulting spec ID exists
|
|
41
|
+
* on disk. When a match is found the pair is recorded with full spec and
|
|
42
|
+
* commit metadata.
|
|
43
|
+
*
|
|
44
|
+
* Duplicates (identical specId + commitHash) are de-duplicated via a
|
|
45
|
+
* `Map` keyed on `"${specId}|${commitHash}"`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function scan(repoPath: string, specStoragePath: string, config: SpecConfig, onProgress?: ProgressCallback): SpecCommitPair[];
|
|
48
|
+
//# sourceMappingURL=scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/spec/build/scan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,UAAU,EAAiB,MAAM,QAAQ,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAuB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,UAAU,GAAG,IAAI,CAAC;CACnC;AAED,4EAA4E;AAC5E,MAAM,WAAW,SAAS;IACxB,uEAAuE;IACvE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;CAC/B;AAMD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,UAAU,GACjB,SAAS,CASX;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,UAAU,EAClB,UAAU,CAAC,EAAE,gBAAgB,GAC5B,cAAc,EAAE,CA0ClB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spec↔commit pairing — discovers which commits reference which specs via
|
|
4
|
+
* conventional-commit scope extraction.
|
|
5
|
+
*
|
|
6
|
+
* Replaces `commit4spec/reverse_engineer/git_scanner.py`'s `scan()` (Strategy
|
|
7
|
+
* A). Shared by the build pipeline and the evolve pipeline's incremental
|
|
8
|
+
* commit analyzer.
|
|
9
|
+
*
|
|
10
|
+
* @module spec/build/scan
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.matchCommitToSpec = matchCommitToSpec;
|
|
14
|
+
exports.scan = scan;
|
|
15
|
+
const git_1 = require("../git");
|
|
16
|
+
const utils_1 = require("../utils");
|
|
17
|
+
const scope_resolver_1 = require("./scope-resolver");
|
|
18
|
+
const spec_extractor_1 = require("./spec-extractor");
|
|
19
|
+
const errors_1 = require("../../errors");
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// matchCommitToSpec
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
/**
|
|
24
|
+
* Match a single commit message to an on-disk spec: resolve the
|
|
25
|
+
* conventional-commit scope to a spec ID, then extract that spec's metadata.
|
|
26
|
+
*
|
|
27
|
+
* This is the shared per-commit matching step used by both {@link scan}
|
|
28
|
+
* (build) and the evolve pipeline's incremental analyzer.
|
|
29
|
+
*/
|
|
30
|
+
function matchCommitToSpec(message, specIds, specStoragePath, config) {
|
|
31
|
+
const specId = (0, scope_resolver_1.resolveScopeToSpec)(message, specIds, config);
|
|
32
|
+
if (!specId) {
|
|
33
|
+
return { specId: null, metadata: null };
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
specId,
|
|
37
|
+
metadata: (0, spec_extractor_1.extractSpecMetadata)(specStoragePath, specId, config),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// scan
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
/**
|
|
44
|
+
* Main scanning function — discovers spec↔commit pairs from commit history.
|
|
45
|
+
*
|
|
46
|
+
* Iterates every commit in the repo, extracts a conventional-commit scope from
|
|
47
|
+
* its message, normalizes it, and checks whether the resulting spec ID exists
|
|
48
|
+
* on disk. When a match is found the pair is recorded with full spec and
|
|
49
|
+
* commit metadata.
|
|
50
|
+
*
|
|
51
|
+
* Duplicates (identical specId + commitHash) are de-duplicated via a
|
|
52
|
+
* `Map` keyed on `"${specId}|${commitHash}"`.
|
|
53
|
+
*/
|
|
54
|
+
function scan(repoPath, specStoragePath, config, onProgress) {
|
|
55
|
+
const pairs = new Map();
|
|
56
|
+
// Hoist the directory read out of the per-commit loop.
|
|
57
|
+
const specIds = new Set((0, utils_1.discoverSpecs)(specStoragePath).map((e) => e.specId));
|
|
58
|
+
const commits = (0, git_1.getAllCommits)(repoPath);
|
|
59
|
+
const total = commits.length;
|
|
60
|
+
let current = 0;
|
|
61
|
+
for (const commit of commits) {
|
|
62
|
+
current++;
|
|
63
|
+
onProgress?.({
|
|
64
|
+
phase: 'scanning',
|
|
65
|
+
current,
|
|
66
|
+
total,
|
|
67
|
+
message: `${commit.hash.slice(0, 7)} ${commit.message.slice(0, 30)}`,
|
|
68
|
+
});
|
|
69
|
+
const { specId, metadata } = matchCommitToSpec(commit.message, specIds, specStoragePath, config);
|
|
70
|
+
if (!specId) {
|
|
71
|
+
(0, errors_1.logDebug)('scan: no scope match', {
|
|
72
|
+
commitHash: commit.hash.slice(0, 7),
|
|
73
|
+
message: commit.message,
|
|
74
|
+
});
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
const key = `${specId}|${commit.hash}`;
|
|
78
|
+
if (!pairs.has(key)) {
|
|
79
|
+
pairs.set(key, {
|
|
80
|
+
specId,
|
|
81
|
+
commitHash: commit.hash,
|
|
82
|
+
specMetadata: metadata,
|
|
83
|
+
commitMetadata: commit,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return Array.from(pairs.values());
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../../../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YACX,KAAK,EAAE,UAAU;YACjB,OAAO;YACP,KAAK;YACL,OAAO,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE;SACrE,CAAC,CAAC;QAEH,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,iBAAiB,CAC5C,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,CACjD,CAAC;QACF,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAA,iBAAQ,EAAC,sBAAsB,EAAE;gBAC/B,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;gBACnC,OAAO,EAAE,MAAM,CAAC,OAAO;aACxB,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE;gBACb,MAAM;gBACN,UAAU,EAAE,MAAM,CAAC,IAAI;gBACvB,YAAY,EAAE,QAAQ;gBACtB,cAAc,EAAE,MAAM;aACvB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commit message scope parsing and resolution.
|
|
3
|
+
*
|
|
4
|
+
* Replaces `commit4spec/reverse_engineer/scope_resolver.py`.
|
|
5
|
+
* Extracts conventional-commit scopes, normalizes them, and resolves them to
|
|
6
|
+
* spec IDs found on disk.
|
|
7
|
+
*
|
|
8
|
+
* @module spec/build/scope-resolver
|
|
9
|
+
*/
|
|
10
|
+
import { SpecConfig } from '../config';
|
|
11
|
+
/**
|
|
12
|
+
* Extract a scope from a commit message using the configured regex.
|
|
13
|
+
*
|
|
14
|
+
* Only searches the **first line** of the commit message. Returns the
|
|
15
|
+
* contents of the first capture group (the scope), or `null` when there is
|
|
16
|
+
* no match or the regex has no capture group.
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractScope(message: string, scopeRegex: string): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Normalize a scope string.
|
|
21
|
+
*
|
|
22
|
+
* Steps applied in order:
|
|
23
|
+
*
|
|
24
|
+
* 1. **Strip prefixes** — for each prefix in `stripPrefixes`, if `scope`
|
|
25
|
+
* starts with it, remove it and stop (only the first matching prefix is
|
|
26
|
+
* stripped).
|
|
27
|
+
* 2. **Lowercase** — if `lowercase` is `true`, convert to lower case.
|
|
28
|
+
* 3. **Pad spec number** — if `padSpecNumber` is `true`, match the pattern
|
|
29
|
+
* `/^spec(\d+)$/i` and zero-pad the numeric portion to 2 digits
|
|
30
|
+
* (e.g. `spec3` → `spec03`).
|
|
31
|
+
*/
|
|
32
|
+
export declare function normalizeScope(scope: string, config: {
|
|
33
|
+
stripPrefixes: string[];
|
|
34
|
+
lowercase: boolean;
|
|
35
|
+
padSpecNumber: boolean;
|
|
36
|
+
}): string;
|
|
37
|
+
/**
|
|
38
|
+
* Extract a scope from a commit message, normalize it, then check whether the
|
|
39
|
+
* resulting spec ID exists among the known on-disk spec IDs.
|
|
40
|
+
*
|
|
41
|
+
* @param message - Commit message (only the first line is searched).
|
|
42
|
+
* @param specIds - Known spec IDs (from `discoverSpecs`, hoisted by the
|
|
43
|
+
* caller so scanning N commits does not re-read the directory N times).
|
|
44
|
+
* @param config - Spec configuration (commitScope section).
|
|
45
|
+
*
|
|
46
|
+
* Returns the normalized spec ID when the scope resolves to an existing spec,
|
|
47
|
+
* otherwise `null`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveScopeToSpec(message: string, specIds: Set<string>, config: SpecConfig): string | null;
|
|
50
|
+
//# sourceMappingURL=scope-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-resolver.d.ts","sourceRoot":"","sources":["../../../src/spec/build/scope-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAOvC;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkB/E;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE;IAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,GAC9E,MAAM,CAyBR;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,EACpB,MAAM,EAAE,UAAU,GACjB,MAAM,GAAG,IAAI,CASf"}
|