homegraph 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -11
- package/dist/bin/homegraph.js +295 -72
- 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 +293 -16
- package/dist/db/index.js.map +1 -1
- package/dist/db/queries.d.ts +43 -4
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +138 -14
- package/dist/db/queries.js.map +1 -1
- 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/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.d.ts +90 -6
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1579 -128
- 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-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/mcp/query-worker.d.ts +2 -2
- package/dist/mcp/query-worker.js +2 -2
- 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/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/git-scanner.d.ts +93 -0
- package/dist/spec/build/git-scanner.d.ts.map +1 -0
- package/dist/spec/build/git-scanner.js +254 -0
- package/dist/spec/build/git-scanner.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/fts.d.ts.map +1 -1
- package/dist/spec/db/fts.js +19 -50
- 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 +175 -4
- 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 +4 -0
- package/dist/spec/db/schema.js.map +1 -1
- package/dist/spec/db/schema.sql +5 -1
- 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 +11 -5
- 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/git-utils.d.ts +8 -0
- package/dist/spec/git-utils.d.ts.map +1 -0
- package/dist/spec/git-utils.js +14 -0
- package/dist/spec/git-utils.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 +100 -50
- 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/clusterer.d.ts +63 -0
- package/dist/spec/mine/clusterer.d.ts.map +1 -0
- package/dist/spec/mine/clusterer.js +904 -0
- package/dist/spec/mine/clusterer.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/progress-handler.d.ts +22 -0
- package/dist/spec/mine/progress-handler.d.ts.map +1 -0
- package/dist/spec/mine/progress-handler.js +108 -0
- package/dist/spec/mine/progress-handler.js.map +1 -0
- package/dist/spec/mine/progress.d.ts +23 -0
- package/dist/spec/mine/progress.d.ts.map +1 -0
- package/dist/spec/mine/progress.js +12 -0
- package/dist/spec/mine/progress.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/spec/utils.d.ts +4 -16
- package/dist/spec/utils.d.ts.map +1 -1
- package/dist/spec/utils.js +6 -58
- package/dist/spec/utils.js.map +1 -1
- 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 +7 -3
|
@@ -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"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AA4DH,4CAyIC;AAlMD,sCAA2C;AAC3C,oCAA8D;AAC9D,yCAA8C;AAC9C,mDAAqD;AACrD,+CAA2D;AAC3D,2CAA+E;AAC/E,iCAA8B;AAC9B,gCAAoD;AACpD,+CAAkD;AAClD,yCAAwC;AAiBxC,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E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AC1C,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":["../../../src/spec/build/scan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;AAwCH,8CAcC;AAiBD,oBA+CC;AAnHD,gCAAmD;AACnD,oCAAyC;AAEzC,qDAAsD;AACtD,qDAAqE;AACrE,yCAAwC;AAqBxC,8EAA8E;AAC9E,oBAAoB;AACpB,8EAA8E;AAE9E;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC/B,OAA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,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"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Commit message scope parsing and resolution.
|
|
4
|
+
*
|
|
5
|
+
* Replaces `commit4spec/reverse_engineer/scope_resolver.py`.
|
|
6
|
+
* Extracts conventional-commit scopes, normalizes them, and resolves them to
|
|
7
|
+
* spec IDs found on disk.
|
|
8
|
+
*
|
|
9
|
+
* @module spec/build/scope-resolver
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.extractScope = extractScope;
|
|
13
|
+
exports.normalizeScope = normalizeScope;
|
|
14
|
+
exports.resolveScopeToSpec = resolveScopeToSpec;
|
|
15
|
+
const errors_1 = require("../../errors");
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// extractScope
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/**
|
|
20
|
+
* Extract a scope from a commit message using the configured regex.
|
|
21
|
+
*
|
|
22
|
+
* Only searches the **first line** of the commit message. Returns the
|
|
23
|
+
* contents of the first capture group (the scope), or `null` when there is
|
|
24
|
+
* no match or the regex has no capture group.
|
|
25
|
+
*/
|
|
26
|
+
function extractScope(message, scopeRegex) {
|
|
27
|
+
const firstLine = message.split('\n', 1)[0] ?? '';
|
|
28
|
+
let regex;
|
|
29
|
+
try {
|
|
30
|
+
regex = new RegExp(scopeRegex);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
(0, errors_1.logDebug)('extractScope: invalid regex from config, returning null', {
|
|
34
|
+
scopeRegex,
|
|
35
|
+
});
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const match = regex.exec(firstLine);
|
|
39
|
+
if (match && match[1] !== undefined) {
|
|
40
|
+
return match[1];
|
|
41
|
+
}
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// normalizeScope
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
/**
|
|
48
|
+
* Normalize a scope string.
|
|
49
|
+
*
|
|
50
|
+
* Steps applied in order:
|
|
51
|
+
*
|
|
52
|
+
* 1. **Strip prefixes** — for each prefix in `stripPrefixes`, if `scope`
|
|
53
|
+
* starts with it, remove it and stop (only the first matching prefix is
|
|
54
|
+
* stripped).
|
|
55
|
+
* 2. **Lowercase** — if `lowercase` is `true`, convert to lower case.
|
|
56
|
+
* 3. **Pad spec number** — if `padSpecNumber` is `true`, match the pattern
|
|
57
|
+
* `/^spec(\d+)$/i` and zero-pad the numeric portion to 2 digits
|
|
58
|
+
* (e.g. `spec3` → `spec03`).
|
|
59
|
+
*/
|
|
60
|
+
function normalizeScope(scope, config) {
|
|
61
|
+
let normalized = scope;
|
|
62
|
+
// Step 1: strip the first matching prefix
|
|
63
|
+
for (const prefix of config.stripPrefixes) {
|
|
64
|
+
if (normalized.startsWith(prefix)) {
|
|
65
|
+
normalized = normalized.slice(prefix.length);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Step 2: lowercase
|
|
70
|
+
if (config.lowercase) {
|
|
71
|
+
normalized = normalized.toLowerCase();
|
|
72
|
+
}
|
|
73
|
+
// Step 3: pad spec number (e.g. spec3 → spec03)
|
|
74
|
+
if (config.padSpecNumber) {
|
|
75
|
+
const m = /^spec(\d+)$/i.exec(normalized);
|
|
76
|
+
if (m && m[1] !== undefined) {
|
|
77
|
+
normalized = `spec${m[1].padStart(2, '0')}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return normalized;
|
|
81
|
+
}
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
// resolveScopeToSpec
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
/**
|
|
86
|
+
* Extract a scope from a commit message, normalize it, then check whether the
|
|
87
|
+
* resulting spec ID exists among the known on-disk spec IDs.
|
|
88
|
+
*
|
|
89
|
+
* @param message - Commit message (only the first line is searched).
|
|
90
|
+
* @param specIds - Known spec IDs (from `discoverSpecs`, hoisted by the
|
|
91
|
+
* caller so scanning N commits does not re-read the directory N times).
|
|
92
|
+
* @param config - Spec configuration (commitScope section).
|
|
93
|
+
*
|
|
94
|
+
* Returns the normalized spec ID when the scope resolves to an existing spec,
|
|
95
|
+
* otherwise `null`.
|
|
96
|
+
*/
|
|
97
|
+
function resolveScopeToSpec(message, specIds, config) {
|
|
98
|
+
const scope = extractScope(message, config.commitScope.scopeRegex);
|
|
99
|
+
if (!scope) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const normalized = normalizeScope(scope, config.commitScope.normalize);
|
|
103
|
+
return specIds.has(normalized) ? normalized : null;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=scope-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-resolver.js","sourceRoot":"","sources":["../../../src/spec/build/scope-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAgBH,oCAkBC;AAmBD,wCA4BC;AAkBD,gDAaC;AA7GD,yCAAwC;AAExC,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;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I,CAAC,UAAU,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5B,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;;;;;;;;GAWG;AACH,SAAgB,kBAAkB,CAChC,OAAe,EACf,OAAoB,EACpB,MAAkB;IAElB,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IACnE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAEvE,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec file discovery and metadata extraction.
|
|
3
|
+
*
|
|
4
|
+
* Replaces `commit4spec/reverse_engineer/spec_extractor.py`.
|
|
5
|
+
* Discovers spec files in a storage directory and extracts structured
|
|
6
|
+
* metadata (title, subtitles).
|
|
7
|
+
*
|
|
8
|
+
* @module spec/build/spec-extractor
|
|
9
|
+
*/
|
|
10
|
+
import { SpecConfig } from '../config';
|
|
11
|
+
export interface SpecMetadata {
|
|
12
|
+
specId: string;
|
|
13
|
+
title: string;
|
|
14
|
+
subtitles: string[];
|
|
15
|
+
filePath: string;
|
|
16
|
+
type: 'directory' | 'flat-file';
|
|
17
|
+
}
|
|
18
|
+
export interface SupplementaryDoc {
|
|
19
|
+
path: string;
|
|
20
|
+
content: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Extract a title from markdown content: the first `# ` heading with any
|
|
24
|
+
* trailing `SPEC` suffix stripped. Falls back to `fallback` when no usable
|
|
25
|
+
* heading is found.
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractTitleFromMarkdown(content: string, fallback: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Parse ATX headings from markdown content and build breadcrumb-path strings
|
|
30
|
+
* with content previews.
|
|
31
|
+
*
|
|
32
|
+
* Algorithm (ported from `spec_extractor.py:50-88`):
|
|
33
|
+
*
|
|
34
|
+
* 1. Find all `#` … `######` headings (ATX-style) and their line positions.
|
|
35
|
+
* 2. Walk through headings, maintaining a breadcrumb stack — pop until the
|
|
36
|
+
* stack is shorter than the current heading's level, then push the new
|
|
37
|
+
* heading text.
|
|
38
|
+
* 3. For each heading, collect the "direct content" lines — non-heading,
|
|
39
|
+
* non-empty lines between this heading and the next heading of equal or
|
|
40
|
+
* higher level (or EOF).
|
|
41
|
+
* 4. Skip headings that have sub-headings but no direct content.
|
|
42
|
+
* 5. Build a display string: `breadcrumb_path - first_direct_content_line`.
|
|
43
|
+
* 6. Strip `SPEC` suffix from level-1 (root) breadcrumb parts.
|
|
44
|
+
* 7. Truncate the preview to `maxContentLen` characters, appending `…`
|
|
45
|
+
* when truncated.
|
|
46
|
+
*
|
|
47
|
+
* @param content - Raw markdown string.
|
|
48
|
+
* @param maxContentLen - Max characters for the content preview (default 200).
|
|
49
|
+
* @returns Array of formatted heading strings.
|
|
50
|
+
*/
|
|
51
|
+
export declare function extractMarkdownHeadings(content: string, maxContentLen?: number): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Discover and extract metadata for a single spec, given its storage location
|
|
54
|
+
* and directory name.
|
|
55
|
+
*
|
|
56
|
+
* Ported from `spec_extractor.py:177-237`.
|
|
57
|
+
*
|
|
58
|
+
* Two discovery branches are attempted in order:
|
|
59
|
+
*
|
|
60
|
+
* - **Flat-file**: checks `{specStoragePath}/{specDirName}.md`. If it exists,
|
|
61
|
+
* reads it and produces metadata with `type: 'flat-file'`.
|
|
62
|
+
* - **Directory**: checks `{specStoragePath}/{specDirName}/`. If it exists,
|
|
63
|
+
* searches for a primary document using `config.discovery.primaryDocCandidates`,
|
|
64
|
+
* reads it, and produces metadata with `type: 'directory'`.
|
|
65
|
+
*
|
|
66
|
+
* Returns `null` when neither branch yields a readable spec.
|
|
67
|
+
*
|
|
68
|
+
* @param specStoragePath - Root directory where specs are stored.
|
|
69
|
+
* @param specDirName - Name of the spec (e.g. "spec03", "auth-module").
|
|
70
|
+
* @param config - Optional full `SpecConfig`; falls back to defaults
|
|
71
|
+
* when omitted (discovery config resolved at call site).
|
|
72
|
+
*/
|
|
73
|
+
export declare function extractSpecMetadata(specStoragePath: string, specDirName: string, config?: SpecConfig): SpecMetadata | null;
|
|
74
|
+
//# sourceMappingURL=spec-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-extractor.d.ts","sourceRoot":"","sources":["../../../src/spec/build/spec-extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,UAAU,EAAuC,MAAM,WAAW,CAAC;AAQ5E,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,WAAW,GAAG,WAAW,CAAC;CACjC;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOlF;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,MAAY,GAC1B,MAAM,EAAE,CAyFV;AAqID;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,UAAU,GAClB,YAAY,GAAG,IAAI,CAwDrB"}
|