homegraph 1.1.2 → 1.2.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/LICENSE +21 -21
- package/README.md +268 -243
- package/dist/arkts/ohos-api-index.d.ts +15 -0
- package/dist/arkts/ohos-api-index.d.ts.map +1 -0
- package/dist/arkts/ohos-api-index.js +190 -0
- package/dist/arkts/ohos-api-index.js.map +1 -0
- package/dist/arkts/ohos-sdk-input.d.ts +36 -0
- package/dist/arkts/ohos-sdk-input.d.ts.map +1 -0
- package/dist/arkts/ohos-sdk-input.js +214 -0
- package/dist/arkts/ohos-sdk-input.js.map +1 -0
- package/dist/bin/command-supervision.d.ts +12 -0
- package/dist/bin/command-supervision.d.ts.map +1 -0
- package/dist/bin/command-supervision.js +86 -0
- package/dist/bin/command-supervision.js.map +1 -0
- package/dist/bin/homegraph.d.ts +1 -1
- package/dist/bin/homegraph.js +971 -71
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/db/index.d.ts +20 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +39 -0
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/migrations.js +58 -19
- package/dist/db/migrations.js.map +1 -1
- package/dist/db/queries.d.ts +14 -0
- package/dist/db/queries.d.ts.map +1 -1
- package/dist/db/queries.js +314 -143
- package/dist/db/queries.js.map +1 -1
- package/dist/db/schema.sql +172 -152
- package/dist/directory.d.ts +32 -0
- package/dist/directory.d.ts.map +1 -1
- package/dist/directory.js +88 -5
- package/dist/directory.js.map +1 -1
- package/dist/extraction/arkts-batch-worker.d.ts +2 -0
- package/dist/extraction/arkts-batch-worker.d.ts.map +1 -0
- package/dist/extraction/arkts-batch-worker.js +28 -0
- package/dist/extraction/arkts-batch-worker.js.map +1 -0
- package/dist/extraction/context.d.ts +11 -0
- package/dist/extraction/context.d.ts.map +1 -1
- package/dist/extraction/context.js +20 -0
- package/dist/extraction/context.js.map +1 -1
- package/dist/extraction/index.d.ts +16 -2
- package/dist/extraction/index.d.ts.map +1 -1
- package/dist/extraction/index.js +619 -380
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/languages/arkts-state-decorators.d.ts +13 -0
- package/dist/extraction/languages/arkts-state-decorators.d.ts.map +1 -0
- package/dist/extraction/languages/arkts-state-decorators.js +26 -0
- package/dist/extraction/languages/arkts-state-decorators.js.map +1 -0
- package/dist/extraction/languages/arkts-viewtree.d.ts +4 -2
- package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
- package/dist/extraction/languages/arkts-viewtree.js +21 -6
- package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
- package/dist/extraction/languages/arkts.d.ts +98 -2
- package/dist/extraction/languages/arkts.d.ts.map +1 -1
- package/dist/extraction/languages/arkts.js +1290 -61
- package/dist/extraction/languages/arkts.js.map +1 -1
- package/dist/extraction/languages/c-cpp.d.ts +56 -0
- package/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/dist/extraction/languages/c-cpp.js +198 -1
- package/dist/extraction/languages/c-cpp.js.map +1 -1
- package/dist/extraction/languages/ohos-api-consumer.d.ts +34 -0
- package/dist/extraction/languages/ohos-api-consumer.d.ts.map +1 -0
- package/dist/extraction/languages/ohos-api-consumer.js +283 -0
- package/dist/extraction/languages/ohos-api-consumer.js.map +1 -0
- package/dist/extraction/parse-pool.d.ts +126 -0
- package/dist/extraction/parse-pool.d.ts.map +1 -0
- package/dist/extraction/parse-pool.js +319 -0
- package/dist/extraction/parse-pool.js.map +1 -0
- package/dist/extraction/tree-sitter-types.d.ts +17 -0
- package/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.d.ts +21 -0
- package/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/dist/extraction/tree-sitter.js +198 -27
- 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-pascal.wasm +0 -0
- package/dist/graph/traversal.d.ts.map +1 -1
- package/dist/graph/traversal.js +76 -17
- package/dist/graph/traversal.js.map +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +78 -4
- package/dist/index.js.map +1 -1
- package/dist/installer/instructions-template.js +9 -9
- package/dist/installer/targets/shared.d.ts +5 -6
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +5 -6
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/mcp/daemon-paths.d.ts +30 -3
- package/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/dist/mcp/daemon-paths.js +50 -10
- package/dist/mcp/daemon-paths.js.map +1 -1
- package/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/dist/mcp/daemon-registry.js +7 -3
- package/dist/mcp/daemon-registry.js.map +1 -1
- package/dist/mcp/daemon.d.ts +48 -0
- package/dist/mcp/daemon.d.ts.map +1 -1
- package/dist/mcp/daemon.js +196 -32
- package/dist/mcp/daemon.js.map +1 -1
- package/dist/mcp/engine.d.ts +17 -0
- package/dist/mcp/engine.d.ts.map +1 -1
- package/dist/mcp/engine.js +73 -1
- package/dist/mcp/engine.js.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +25 -43
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/liveness-watchdog.js +16 -16
- package/dist/mcp/ppid-watchdog.d.ts +18 -0
- package/dist/mcp/ppid-watchdog.d.ts.map +1 -1
- package/dist/mcp/ppid-watchdog.js +37 -0
- package/dist/mcp/ppid-watchdog.js.map +1 -1
- package/dist/mcp/query-cache.d.ts +25 -0
- package/dist/mcp/query-cache.d.ts.map +1 -0
- package/dist/mcp/query-cache.js +191 -0
- package/dist/mcp/query-cache.js.map +1 -0
- package/dist/mcp/query-pool.d.ts +94 -0
- package/dist/mcp/query-pool.d.ts.map +1 -0
- package/dist/mcp/query-pool.js +297 -0
- package/dist/mcp/query-pool.js.map +1 -0
- package/dist/mcp/query-worker.d.ts +24 -0
- package/dist/mcp/query-worker.d.ts.map +1 -0
- package/dist/mcp/query-worker.js +87 -0
- package/dist/mcp/query-worker.js.map +1 -0
- package/dist/mcp/server-instructions.d.ts +5 -7
- package/dist/mcp/server-instructions.d.ts.map +1 -1
- package/dist/mcp/server-instructions.js +72 -74
- package/dist/mcp/server-instructions.js.map +1 -1
- package/dist/mcp/tools.d.ts +94 -4
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +877 -71
- package/dist/mcp/tools.js.map +1 -1
- package/dist/project-config.d.ts +20 -0
- package/dist/project-config.d.ts.map +1 -1
- package/dist/project-config.js +42 -2
- package/dist/project-config.js.map +1 -1
- package/dist/reasoning/login.js +1 -1
- package/dist/reasoning/login.js.map +1 -1
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/resolution/c-fnptr-synthesizer.d.ts +0 -28
- package/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/dist/resolution/c-fnptr-synthesizer.js +765 -79
- package/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/dist/resolution/callback-synthesizer.js +72 -11
- package/dist/resolution/callback-synthesizer.js.map +1 -1
- package/dist/resolution/cooperative-yield.d.ts +32 -0
- package/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/dist/resolution/cooperative-yield.js +42 -0
- package/dist/resolution/cooperative-yield.js.map +1 -0
- package/dist/resolution/index.d.ts +11 -2
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +72 -4
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/name-matcher.d.ts +22 -0
- package/dist/resolution/name-matcher.d.ts.map +1 -1
- package/dist/resolution/name-matcher.js +317 -20
- package/dist/resolution/name-matcher.js.map +1 -1
- package/dist/spec/config.d.ts +39 -0
- package/dist/spec/config.d.ts.map +1 -0
- package/dist/spec/config.js +304 -0
- package/dist/spec/config.js.map +1 -0
- package/dist/spec/db/commit-node.d.ts +23 -0
- package/dist/spec/db/commit-node.d.ts.map +1 -0
- package/dist/spec/db/commit-node.js +62 -0
- package/dist/spec/db/commit-node.js.map +1 -0
- package/dist/spec/db/fragment-node.d.ts +24 -0
- package/dist/spec/db/fragment-node.d.ts.map +1 -0
- package/dist/spec/db/fragment-node.js +128 -0
- package/dist/spec/db/fragment-node.js.map +1 -0
- package/dist/spec/db/fts.d.ts +74 -0
- package/dist/spec/db/fts.d.ts.map +1 -0
- package/dist/spec/db/fts.js +324 -0
- package/dist/spec/db/fts.js.map +1 -0
- package/dist/spec/db/index.d.ts +13 -0
- package/dist/spec/db/index.d.ts.map +1 -0
- package/dist/spec/db/index.js +50 -0
- package/dist/spec/db/index.js.map +1 -0
- package/dist/spec/db/relations.d.ts +55 -0
- package/dist/spec/db/relations.d.ts.map +1 -0
- package/dist/spec/db/relations.js +158 -0
- package/dist/spec/db/relations.js.map +1 -0
- package/dist/spec/db/schema.d.ts +33 -0
- package/dist/spec/db/schema.d.ts.map +1 -0
- package/dist/spec/db/schema.js +119 -0
- package/dist/spec/db/schema.js.map +1 -0
- package/dist/spec/db/schema.sql +117 -0
- package/dist/spec/db/spec-node.d.ts +41 -0
- package/dist/spec/db/spec-node.d.ts.map +1 -0
- package/dist/spec/db/spec-node.js +114 -0
- package/dist/spec/db/spec-node.js.map +1 -0
- package/dist/spec/evolve/impact-locator.d.ts +13 -0
- package/dist/spec/evolve/impact-locator.d.ts.map +1 -0
- package/dist/spec/evolve/impact-locator.js +25 -0
- package/dist/spec/evolve/impact-locator.js.map +1 -0
- package/dist/spec/evolve/llm-client.d.ts +50 -0
- package/dist/spec/evolve/llm-client.d.ts.map +1 -0
- package/dist/spec/evolve/llm-client.js +176 -0
- package/dist/spec/evolve/llm-client.js.map +1 -0
- package/dist/spec/evolve/logic-checker.d.ts +12 -0
- package/dist/spec/evolve/logic-checker.d.ts.map +1 -0
- package/dist/spec/evolve/logic-checker.js +24 -0
- package/dist/spec/evolve/logic-checker.js.map +1 -0
- package/dist/spec/evolve/pipeline.d.ts +42 -0
- package/dist/spec/evolve/pipeline.d.ts.map +1 -0
- package/dist/spec/evolve/pipeline.js +567 -0
- package/dist/spec/evolve/pipeline.js.map +1 -0
- package/dist/spec/evolve/spec-rewriter.d.ts +42 -0
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -0
- package/dist/spec/evolve/spec-rewriter.js +230 -0
- package/dist/spec/evolve/spec-rewriter.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +155 -0
- package/dist/spec/graph/queries.d.ts.map +1 -0
- package/dist/spec/graph/queries.js +440 -0
- package/dist/spec/graph/queries.js.map +1 -0
- package/dist/spec/llm/client.d.ts +29 -0
- package/dist/spec/llm/client.d.ts.map +1 -0
- package/dist/spec/llm/client.js +123 -0
- package/dist/spec/llm/client.js.map +1 -0
- package/dist/spec/llm/index.d.ts +3 -0
- package/dist/spec/llm/index.d.ts.map +1 -0
- package/dist/spec/llm/index.js +11 -0
- package/dist/spec/llm/index.js.map +1 -0
- package/dist/spec/llm/prompts.d.ts +13 -0
- package/dist/spec/llm/prompts.d.ts.map +1 -0
- package/dist/spec/llm/prompts.js +75 -0
- package/dist/spec/llm/prompts.js.map +1 -0
- package/dist/spec/mining/diff-parser.d.ts +33 -0
- package/dist/spec/mining/diff-parser.d.ts.map +1 -0
- package/dist/spec/mining/diff-parser.js +166 -0
- package/dist/spec/mining/diff-parser.js.map +1 -0
- package/dist/spec/mining/git-scanner.d.ts +103 -0
- package/dist/spec/mining/git-scanner.d.ts.map +1 -0
- package/dist/spec/mining/git-scanner.js +307 -0
- package/dist/spec/mining/git-scanner.js.map +1 -0
- package/dist/spec/mining/pipeline.d.ts +53 -0
- package/dist/spec/mining/pipeline.d.ts.map +1 -0
- package/dist/spec/mining/pipeline.js +178 -0
- package/dist/spec/mining/pipeline.js.map +1 -0
- package/dist/spec/mining/scope-resolver.d.ts +45 -0
- package/dist/spec/mining/scope-resolver.d.ts.map +1 -0
- package/dist/spec/mining/scope-resolver.js +103 -0
- package/dist/spec/mining/scope-resolver.js.map +1 -0
- package/dist/spec/mining/spec-extractor.d.ts +69 -0
- package/dist/spec/mining/spec-extractor.d.ts.map +1 -0
- package/dist/spec/mining/spec-extractor.js +369 -0
- package/dist/spec/mining/spec-extractor.js.map +1 -0
- package/dist/spec/types.d.ts +149 -0
- package/dist/spec/types.d.ts.map +1 -0
- package/dist/spec/types.js +15 -0
- package/dist/spec/types.js.map +1 -0
- package/dist/spec/utils.d.ts +167 -0
- package/dist/spec/utils.d.ts.map +1 -0
- package/dist/spec/utils.js +463 -0
- package/dist/spec/utils.js.map +1 -0
- package/dist/sync/worktree.d.ts +9 -0
- package/dist/sync/worktree.d.ts.map +1 -1
- package/dist/sync/worktree.js +40 -0
- package/dist/sync/worktree.js.map +1 -1
- package/dist/types.d.ts +6 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.d.ts +2 -0
- package/dist/ui/shimmer-progress.d.ts.map +1 -1
- package/dist/ui/shimmer-progress.js +19 -2
- package/dist/ui/shimmer-progress.js.map +1 -1
- package/dist/upgrade/index.js +1 -1
- package/dist/upgrade/index.js.map +1 -1
- package/package.json +58 -57
- 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 -0
- package/scripts/agent-eval/repro-daemon-clients.mjs +125 -0
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +69 -69
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/build-bundle.sh +118 -118
- package/scripts/exp_boundary_eval/README.md +247 -0
- package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
- package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -0
- package/scripts/exp_boundary_eval/_test_stdin.py +8 -0
- package/scripts/exp_boundary_eval/_utils.py +1116 -0
- package/scripts/exp_boundary_eval/analyze.py +1313 -0
- package/scripts/exp_boundary_eval/data/agents.json +109 -0
- package/scripts/exp_boundary_eval/data/experiments.json +140 -0
- package/scripts/exp_boundary_eval/deveco_arm.py +519 -0
- package/scripts/exp_boundary_eval/run_all.py +378 -0
- package/scripts/exp_boundary_eval/run_one.py +165 -0
- package/scripts/exp_boundary_eval/run_session.py +158 -0
- package/scripts/exp_boundary_eval/setup.py +120 -0
- package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -0
- package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -0
- package/scripts/exp_boundary_eval/win_node_launcher.py +24 -0
- 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 +268 -246
- package/scripts/ohos-sdk-publish.mjs +133 -0
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/qa_eval/README.md +407 -404
- package/scripts/qa_eval/_test_deveco_probe.py +41 -41
- package/scripts/qa_eval/agent_runner.py +526 -526
- package/scripts/qa_eval/data/.gitignore +4 -4
- package/scripts/qa_eval/data/test-set.jsonl +2 -22
- package/scripts/qa_eval/eval_metrics.py +274 -233
- package/scripts/qa_eval/external_agent.py +976 -671
- package/scripts/qa_eval/llm_config.py +92 -92
- package/scripts/qa_eval/memory_monitor.py +132 -132
- package/scripts/qa_eval/my_answer_accuracy.py +187 -187
- package/scripts/qa_eval/requirements.txt +2 -2
- package/scripts/qa_eval/run_pipeline.py +804 -711
- package/scripts/qa_eval/stats_efficiency.py +279 -279
- package/scripts/qa_eval/stats_scores.py +207 -207
|
@@ -0,0 +1,103 @@
|
|
|
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/mining/scope-resolver
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.extractScope = extractScope;
|
|
13
|
+
exports.normalizeScope = normalizeScope;
|
|
14
|
+
exports.resolveScopeToSpec = resolveScopeToSpec;
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
const errors_1 = require("../../errors");
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// extractScope
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* Extract a scope from a commit message using the configured regex.
|
|
22
|
+
*
|
|
23
|
+
* Only searches the **first line** of the commit message. Returns the
|
|
24
|
+
* contents of the first capture group (the scope), or `null` when there is
|
|
25
|
+
* no match or the regex has no capture group.
|
|
26
|
+
*/
|
|
27
|
+
function extractScope(message, scopeRegex) {
|
|
28
|
+
const firstLine = message.split('\n', 1)[0] ?? '';
|
|
29
|
+
let regex;
|
|
30
|
+
try {
|
|
31
|
+
regex = new RegExp(scopeRegex);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
(0, errors_1.logDebug)('extractScope: invalid regex from config, returning null', {
|
|
35
|
+
scopeRegex,
|
|
36
|
+
});
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const match = regex.exec(firstLine);
|
|
40
|
+
if (match && match[1] !== undefined) {
|
|
41
|
+
return match[1];
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
// normalizeScope
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
/**
|
|
49
|
+
* Normalize a scope string.
|
|
50
|
+
*
|
|
51
|
+
* Steps applied in order:
|
|
52
|
+
*
|
|
53
|
+
* 1. **Strip prefixes** — for each prefix in `stripPrefixes`, if `scope`
|
|
54
|
+
* starts with it, remove it and stop (only the first matching prefix is
|
|
55
|
+
* stripped).
|
|
56
|
+
* 2. **Lowercase** — if `lowercase` is `true`, convert to lower case.
|
|
57
|
+
* 3. **Pad spec number** — if `padSpecNumber` is `true`, match the pattern
|
|
58
|
+
* `/^spec(\d+)$/i` and zero-pad the numeric portion to 2 digits
|
|
59
|
+
* (e.g. `spec3` → `spec03`).
|
|
60
|
+
*/
|
|
61
|
+
function normalizeScope(scope, config) {
|
|
62
|
+
let normalized = scope;
|
|
63
|
+
// Step 1: strip the first matching prefix
|
|
64
|
+
for (const prefix of config.stripPrefixes) {
|
|
65
|
+
if (normalized.startsWith(prefix)) {
|
|
66
|
+
normalized = normalized.slice(prefix.length);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Step 2: lowercase
|
|
71
|
+
if (config.lowercase) {
|
|
72
|
+
normalized = normalized.toLowerCase();
|
|
73
|
+
}
|
|
74
|
+
// Step 3: pad spec number (e.g. spec3 → spec03)
|
|
75
|
+
if (config.padSpecNumber) {
|
|
76
|
+
const m = /^spec(\d+)$/i.exec(normalized);
|
|
77
|
+
if (m && m[1] !== undefined) {
|
|
78
|
+
normalized = `spec${m[1].padStart(2, '0')}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return normalized;
|
|
82
|
+
}
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
// resolveScopeToSpec
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
/**
|
|
87
|
+
* Extract a scope from a commit message, normalize it, then check whether the
|
|
88
|
+
* resulting spec ID exists on disk in `specStoragePath`.
|
|
89
|
+
*
|
|
90
|
+
* Returns the normalized spec ID when the scope resolves to an existing spec,
|
|
91
|
+
* otherwise `null`.
|
|
92
|
+
*/
|
|
93
|
+
function resolveScopeToSpec(message, specStoragePath, config) {
|
|
94
|
+
const scope = extractScope(message, config.commitScope.scopeRegex);
|
|
95
|
+
if (!scope) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const normalized = normalizeScope(scope, config.commitScope.normalize);
|
|
99
|
+
const entries = (0, utils_1.discoverSpecs)(specStoragePath);
|
|
100
|
+
const specIds = new Set(entries.map((e) => e.specId));
|
|
101
|
+
return specIds.has(normalized) ? normalized : null;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=scope-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope-resolver.js","sourceRoot":"","sources":["../../../src/spec/mining/scope-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAiBH,oCAkBC;AAmBD,wCA4BC;AAaD,gDAgBC;AA5GD,oCAAyC;AACzC,yCAAwC;AAExC,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E;;;;;;GAMG;AACH,SAAgB,YAAY,CAAC,OAAe,EAAE,UAAkB;IAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAClD,IAAI,KAAa,CAAC;IAClB,IAAI,CAAC;QACH,KAAK,GAAG,IAA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AAO,UAAU,CAAC;AACpB,CAAC;AAED,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,OAAe,EACf,eAAuB,EACvB,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,MAAM,OAAO,GAAG,IAAA,qBAAa,EAAC,eAAe,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAEtD,OAAO,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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, commit hash from commit-info.md).
|
|
7
|
+
*
|
|
8
|
+
* @module spec/mining/spec-extractor
|
|
9
|
+
*/
|
|
10
|
+
import { SpecConfig } from '../config';
|
|
11
|
+
export interface SpecMetadata {
|
|
12
|
+
specId: string;
|
|
13
|
+
title: string;
|
|
14
|
+
subtitles: string[];
|
|
15
|
+
commitHash: string | null;
|
|
16
|
+
filePath: string;
|
|
17
|
+
type: 'directory' | 'flat-file';
|
|
18
|
+
}
|
|
19
|
+
export interface SupplementaryDoc {
|
|
20
|
+
path: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parse ATX headings from markdown content and build breadcrumb-path strings
|
|
25
|
+
* with content previews.
|
|
26
|
+
*
|
|
27
|
+
* Algorithm (ported from `spec_extractor.py:50-88`):
|
|
28
|
+
*
|
|
29
|
+
* 1. Find all `#` … `######` headings (ATX-style) and their line positions.
|
|
30
|
+
* 2. Walk through headings, maintaining a breadcrumb stack — pop until the
|
|
31
|
+
* stack is shorter than the current heading's level, then push the new
|
|
32
|
+
* heading text.
|
|
33
|
+
* 3. For each heading, collect the "direct content" lines — non-heading,
|
|
34
|
+
* non-empty lines between this heading and the next heading of equal or
|
|
35
|
+
* higher level (or EOF).
|
|
36
|
+
* 4. Skip headings that have sub-headings but no direct content.
|
|
37
|
+
* 5. Build a display string: `breadcrumb_path - first_direct_content_line`.
|
|
38
|
+
* 6. Strip `SPEC` suffix from level-1 (root) breadcrumb parts.
|
|
39
|
+
* 7. Truncate the preview to `maxContentLen` characters, appending `…`
|
|
40
|
+
* when truncated.
|
|
41
|
+
*
|
|
42
|
+
* @param content - Raw markdown string.
|
|
43
|
+
* @param maxContentLen - Max characters for the content preview (default 200).
|
|
44
|
+
* @returns Array of formatted heading strings.
|
|
45
|
+
*/
|
|
46
|
+
export declare function extractMarkdownHeadings(content: string, maxContentLen?: number): string[];
|
|
47
|
+
/**
|
|
48
|
+
* Discover and extract metadata for a single spec, given its storage location
|
|
49
|
+
* and directory name.
|
|
50
|
+
*
|
|
51
|
+
* Ported from `spec_extractor.py:177-237`.
|
|
52
|
+
*
|
|
53
|
+
* Two discovery branches are attempted in order:
|
|
54
|
+
*
|
|
55
|
+
* - **Flat-file**: checks `{specStoragePath}/{specDirName}.md`. If it exists,
|
|
56
|
+
* reads it and produces metadata with `type: 'flat-file'`.
|
|
57
|
+
* - **Directory**: checks `{specStoragePath}/{specDirName}/`. If it exists,
|
|
58
|
+
* searches for a primary document using `config.discovery.primaryDocCandidates`,
|
|
59
|
+
* reads it, and produces metadata with `type: 'directory'`.
|
|
60
|
+
*
|
|
61
|
+
* Returns `null` when neither branch yields a readable spec.
|
|
62
|
+
*
|
|
63
|
+
* @param specStoragePath - Root directory where specs are stored.
|
|
64
|
+
* @param specDirName - Name of the spec (e.g. "spec03", "auth-module").
|
|
65
|
+
* @param config - Optional full `SpecConfig`; falls back to defaults
|
|
66
|
+
* when omitted (discovery config resolved at call site).
|
|
67
|
+
*/
|
|
68
|
+
export declare function extractSpecMetadata(specStoragePath: string, specDirName: string, config?: SpecConfig): SpecMetadata | null;
|
|
69
|
+
//# sourceMappingURL=spec-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-extractor.d.ts","sourceRoot":"","sources":["../../../src/spec/mining/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,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,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;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,aAAa,GAAE,MAAY,GAC1B,MAAM,EAAE,CAyFV;AA0JD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CACjC,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,UAAU,GAClB,YAAY,GAAG,IAAI,CAiFrB"}
|
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spec file discovery and metadata extraction.
|
|
4
|
+
*
|
|
5
|
+
* Replaces `commit4spec/reverse_engineer/spec_extractor.py`.
|
|
6
|
+
* Discovers spec files in a storage directory and extracts structured
|
|
7
|
+
* metadata (title, subtitles, commit hash from commit-info.md).
|
|
8
|
+
*
|
|
9
|
+
* @module spec/mining/spec-extractor
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.extractMarkdownHeadings = extractMarkdownHeadings;
|
|
46
|
+
exports.extractSpecMetadata = extractSpecMetadata;
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const config_1 = require("../config");
|
|
50
|
+
const utils_1 = require("../utils");
|
|
51
|
+
const errors_1 = require("../../errors");
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Constants
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
const HEADING_RE = /^(#{1,6})\s+(.*)/;
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// extractMarkdownHeadings
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
/**
|
|
60
|
+
* Parse ATX headings from markdown content and build breadcrumb-path strings
|
|
61
|
+
* with content previews.
|
|
62
|
+
*
|
|
63
|
+
* Algorithm (ported from `spec_extractor.py:50-88`):
|
|
64
|
+
*
|
|
65
|
+
* 1. Find all `#` … `######` headings (ATX-style) and their line positions.
|
|
66
|
+
* 2. Walk through headings, maintaining a breadcrumb stack — pop until the
|
|
67
|
+
* stack is shorter than the current heading's level, then push the new
|
|
68
|
+
* heading text.
|
|
69
|
+
* 3. For each heading, collect the "direct content" lines — non-heading,
|
|
70
|
+
* non-empty lines between this heading and the next heading of equal or
|
|
71
|
+
* higher level (or EOF).
|
|
72
|
+
* 4. Skip headings that have sub-headings but no direct content.
|
|
73
|
+
* 5. Build a display string: `breadcrumb_path - first_direct_content_line`.
|
|
74
|
+
* 6. Strip `SPEC` suffix from level-1 (root) breadcrumb parts.
|
|
75
|
+
* 7. Truncate the preview to `maxContentLen` characters, appending `…`
|
|
76
|
+
* when truncated.
|
|
77
|
+
*
|
|
78
|
+
* @param content - Raw markdown string.
|
|
79
|
+
* @param maxContentLen - Max characters for the content preview (default 200).
|
|
80
|
+
* @returns Array of formatted heading strings.
|
|
81
|
+
*/
|
|
82
|
+
function extractMarkdownHeadings(content, maxContentLen = 200) {
|
|
83
|
+
const lines = content.split('\n');
|
|
84
|
+
const headings = [];
|
|
85
|
+
for (let i = 0; i < lines.length; i++) {
|
|
86
|
+
const match = HEADING_RE.exec(lines[i]);
|
|
87
|
+
if (!match)
|
|
88
|
+
continue;
|
|
89
|
+
const text = match[2].trim();
|
|
90
|
+
if (!text)
|
|
91
|
+
continue;
|
|
92
|
+
headings.push({
|
|
93
|
+
lineIndex: i,
|
|
94
|
+
level: match[1].length,
|
|
95
|
+
text,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
// Second pass: build breadcrumb and collect direct content.
|
|
99
|
+
const breadcrumb = [];
|
|
100
|
+
const result = [];
|
|
101
|
+
for (let hi = 0; hi < headings.length; hi++) {
|
|
102
|
+
const h = headings[hi];
|
|
103
|
+
// Adjust breadcrumb: pop until we're at the right depth.
|
|
104
|
+
while (breadcrumb.length >= h.level) {
|
|
105
|
+
breadcrumb.pop();
|
|
106
|
+
}
|
|
107
|
+
breadcrumb.push(h.text);
|
|
108
|
+
// Determine the end line of this heading's content section.
|
|
109
|
+
// The section ends at the next heading of equal or higher level (or EOF).
|
|
110
|
+
let endLine = lines.length;
|
|
111
|
+
for (let hj = hi + 1; hj < headings.length; hj++) {
|
|
112
|
+
const nextH = headings[hj];
|
|
113
|
+
if (nextH.level <= h.level) {
|
|
114
|
+
endLine = nextH.lineIndex;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Collect direct content: non-heading, non-empty lines within this section.
|
|
119
|
+
const directLines = [];
|
|
120
|
+
let hasSubHeadings = false;
|
|
121
|
+
for (let li = h.lineIndex + 1; li < endLine; li++) {
|
|
122
|
+
const line = lines[li].trim();
|
|
123
|
+
if (!line)
|
|
124
|
+
continue;
|
|
125
|
+
if (HEADING_RE.test(line)) {
|
|
126
|
+
hasSubHeadings = true;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
directLines.push(line);
|
|
130
|
+
}
|
|
131
|
+
// Skip headings that only contain sub-headings (no direct text).
|
|
132
|
+
if (hasSubHeadings && directLines.length === 0) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
// Build the display path.
|
|
136
|
+
let display = breadcrumb.join(' → ');
|
|
137
|
+
// Strip trailing SPEC from level-1 (root) headings.
|
|
138
|
+
if (breadcrumb.length === 1) {
|
|
139
|
+
display = display.replace(/\s*SPEC\s*$/i, '');
|
|
140
|
+
}
|
|
141
|
+
// Append content preview (first direct line, truncated).
|
|
142
|
+
if (directLines.length > 0) {
|
|
143
|
+
let preview = directLines[0];
|
|
144
|
+
if (preview.length > maxContentLen) {
|
|
145
|
+
preview = preview.slice(0, maxContentLen) + '…';
|
|
146
|
+
}
|
|
147
|
+
display += ' - ' + preview;
|
|
148
|
+
}
|
|
149
|
+
result.push(display);
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
// _findPrimaryDoc
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
/**
|
|
157
|
+
* Find the primary spec document by trying each candidate name.
|
|
158
|
+
*
|
|
159
|
+
* Replaces the `{spec_dir}` placeholder in each candidate with `specDirName`,
|
|
160
|
+
* then checks whether the resolved file exists in `specDirPath`. Returns the
|
|
161
|
+
* first match as `[resolvedName, absolutePath]`, or `null` when no candidate
|
|
162
|
+
* matches.
|
|
163
|
+
*
|
|
164
|
+
* Ported from `spec_extractor.py:94-114`.
|
|
165
|
+
*/
|
|
166
|
+
function _findPrimaryDoc(specDirPath, specDirName, candidates) {
|
|
167
|
+
for (const candidate of candidates) {
|
|
168
|
+
const resolved = candidate.replace(/\{spec_dir\}/g, specDirName);
|
|
169
|
+
const absPath = path.join(specDirPath, resolved);
|
|
170
|
+
if (fs.existsSync(absPath)) {
|
|
171
|
+
return [resolved, absPath];
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
// ---------------------------------------------------------------------------
|
|
177
|
+
// Glob helper
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
/**
|
|
180
|
+
* Simple glob-to-regex conversion for supplementary document matching.
|
|
181
|
+
*
|
|
182
|
+
* Only handles `*` (any non-separator characters) and literal text.
|
|
183
|
+
* Does not support `**`, `?`, or character classes — sufficient for
|
|
184
|
+
* patterns like `"*.md"` or `"changelog-*.md"`.
|
|
185
|
+
*/
|
|
186
|
+
function globToRegex(glob) {
|
|
187
|
+
// Escape regex-special characters except *
|
|
188
|
+
let pattern = '';
|
|
189
|
+
for (const ch of glob) {
|
|
190
|
+
if (ch === '*') {
|
|
191
|
+
pattern += '[^/]*';
|
|
192
|
+
}
|
|
193
|
+
else if ('.+^${}()|[]\\'.includes(ch)) {
|
|
194
|
+
pattern += '\\' + ch;
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
pattern += ch;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return new RegExp('^' + pattern + '$');
|
|
201
|
+
}
|
|
202
|
+
// ---------------------------------------------------------------------------
|
|
203
|
+
// _buildMetadata
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
/**
|
|
206
|
+
* Build `SpecMetadata` from raw spec content and supplementary documents.
|
|
207
|
+
*
|
|
208
|
+
* Ported from `spec_extractor.py:120-171`.
|
|
209
|
+
*
|
|
210
|
+
* 1. Extract a title from the first `# ` heading (stripping a trailing
|
|
211
|
+
* `SPEC` suffix); fallback to `specId`.
|
|
212
|
+
* 2. Collect subtitles via `extractMarkdownHeadings`.
|
|
213
|
+
* 3. Discover supplementary `.md` files in `specDirPath` that match
|
|
214
|
+
* `config.supplementaryGlobs` (excluding the primary doc) and merge
|
|
215
|
+
* their headings into the subtitle list.
|
|
216
|
+
* 4. Resolve a commit hash from `commit-info.md` content in `specDirPath`
|
|
217
|
+
* (using `config.commitInfoCandidates`).
|
|
218
|
+
*/
|
|
219
|
+
function _buildMetadata(specId, content, filePath, specDirPath, config) {
|
|
220
|
+
// ---- title ----
|
|
221
|
+
let title = specId;
|
|
222
|
+
const firstH1Match = content.match(/^#\s+(.*)/m);
|
|
223
|
+
if (firstH1Match && firstH1Match[1]) {
|
|
224
|
+
title = firstH1Match[1].trim().replace(/\s*SPEC\s*$/i, '');
|
|
225
|
+
if (!title) {
|
|
226
|
+
title = specId;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
// ---- subtitles from primary doc ----
|
|
230
|
+
const subtitles = extractMarkdownHeadings(content);
|
|
231
|
+
// ---- supplementary docs ----
|
|
232
|
+
// Find the primary doc's filename so we can skip it.
|
|
233
|
+
const primaryDocName = path.basename(filePath);
|
|
234
|
+
let dirEntries;
|
|
235
|
+
try {
|
|
236
|
+
dirEntries = fs.readdirSync(specDirPath, { withFileTypes: true });
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
dirEntries = [];
|
|
240
|
+
}
|
|
241
|
+
const globRegexes = config.supplementaryGlobs.map((g) => globToRegex(g));
|
|
242
|
+
for (const entry of dirEntries) {
|
|
243
|
+
if (!entry.isFile())
|
|
244
|
+
continue;
|
|
245
|
+
if (!entry.name.endsWith('.md'))
|
|
246
|
+
continue;
|
|
247
|
+
if (entry.name === primaryDocName)
|
|
248
|
+
continue;
|
|
249
|
+
// Check if the file name matches any supplementary glob.
|
|
250
|
+
const matchesGlob = globRegexes.some((re) => re.test(entry.name));
|
|
251
|
+
if (!matchesGlob)
|
|
252
|
+
continue;
|
|
253
|
+
const suppPath = path.join(specDirPath, entry.name);
|
|
254
|
+
const suppContent = (0, utils_1.readFileContent)(suppPath);
|
|
255
|
+
if (suppContent === null)
|
|
256
|
+
continue;
|
|
257
|
+
const suppHeadings = extractMarkdownHeadings(suppContent);
|
|
258
|
+
for (const heading of suppHeadings) {
|
|
259
|
+
subtitles.push(heading);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// ---- commit hash ----
|
|
263
|
+
let commitHash = null;
|
|
264
|
+
for (const candidate of config.commitInfoCandidates) {
|
|
265
|
+
const ciPath = path.join(specDirPath, candidate);
|
|
266
|
+
const ciContent = (0, utils_1.readFileContent)(ciPath);
|
|
267
|
+
if (ciContent !== null) {
|
|
268
|
+
commitHash = (0, utils_1.parseCommitInfoMd)(ciContent);
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
(0, errors_1.logDebug)('Built spec metadata', { specId, title, subtitleCount: subtitles.length, commitHash });
|
|
273
|
+
return {
|
|
274
|
+
specId,
|
|
275
|
+
title,
|
|
276
|
+
subtitles,
|
|
277
|
+
commitHash,
|
|
278
|
+
filePath,
|
|
279
|
+
type: 'directory',
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
// ---------------------------------------------------------------------------
|
|
283
|
+
// extractSpecMetadata (public)
|
|
284
|
+
// ---------------------------------------------------------------------------
|
|
285
|
+
/**
|
|
286
|
+
* Discover and extract metadata for a single spec, given its storage location
|
|
287
|
+
* and directory name.
|
|
288
|
+
*
|
|
289
|
+
* Ported from `spec_extractor.py:177-237`.
|
|
290
|
+
*
|
|
291
|
+
* Two discovery branches are attempted in order:
|
|
292
|
+
*
|
|
293
|
+
* - **Flat-file**: checks `{specStoragePath}/{specDirName}.md`. If it exists,
|
|
294
|
+
* reads it and produces metadata with `type: 'flat-file'`.
|
|
295
|
+
* - **Directory**: checks `{specStoragePath}/{specDirName}/`. If it exists,
|
|
296
|
+
* searches for a primary document using `config.discovery.primaryDocCandidates`,
|
|
297
|
+
* reads it, and produces metadata with `type: 'directory'`.
|
|
298
|
+
*
|
|
299
|
+
* Returns `null` when neither branch yields a readable spec.
|
|
300
|
+
*
|
|
301
|
+
* @param specStoragePath - Root directory where specs are stored.
|
|
302
|
+
* @param specDirName - Name of the spec (e.g. "spec03", "auth-module").
|
|
303
|
+
* @param config - Optional full `SpecConfig`; falls back to defaults
|
|
304
|
+
* when omitted (discovery config resolved at call site).
|
|
305
|
+
*/
|
|
306
|
+
function extractSpecMetadata(specStoragePath, specDirName, config) {
|
|
307
|
+
// Resolve discovery config — use provided config or the built-in defaults.
|
|
308
|
+
const discoveryConfig = config?.discovery ?? config_1.DEFAULT_CONFIG.discovery;
|
|
309
|
+
// Branch A: flat-file
|
|
310
|
+
const flatFilePath = path.join(specStoragePath, `${specDirName}.md`);
|
|
311
|
+
if (fs.existsSync(flatFilePath) && fs.statSync(flatFilePath).isFile()) {
|
|
312
|
+
const content = (0, utils_1.readFileContent)(flatFilePath);
|
|
313
|
+
if (content !== null) {
|
|
314
|
+
(0, errors_1.logDebug)('Discovered flat-file spec', { specDirName, path: flatFilePath });
|
|
315
|
+
// Build metadata manually for flat-file (no supplementary docs or
|
|
316
|
+
// commit-info in the same directory — those live alongside the flat
|
|
317
|
+
// file's parent, which is specStoragePath itself).
|
|
318
|
+
let title = specDirName;
|
|
319
|
+
const firstH1Match = content.match(/^#\s+(.*)/m);
|
|
320
|
+
if (firstH1Match && firstH1Match[1]) {
|
|
321
|
+
title = firstH1Match[1].trim().replace(/\s*SPEC\s*$/i, '');
|
|
322
|
+
if (!title)
|
|
323
|
+
title = specDirName;
|
|
324
|
+
}
|
|
325
|
+
const subtitles = extractMarkdownHeadings(content);
|
|
326
|
+
// Attempt to read commit-info from specStoragePath for supplementary
|
|
327
|
+
// context (though flat-file specs rarely have one).
|
|
328
|
+
let commitHash = null;
|
|
329
|
+
for (const candidate of discoveryConfig.commitInfoCandidates) {
|
|
330
|
+
const ciPath = path.join(specStoragePath, candidate);
|
|
331
|
+
const ciContent = (0, utils_1.readFileContent)(ciPath);
|
|
332
|
+
if (ciContent !== null) {
|
|
333
|
+
commitHash = (0, utils_1.parseCommitInfoMd)(ciContent);
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return {
|
|
338
|
+
specId: specDirName,
|
|
339
|
+
title,
|
|
340
|
+
subtitles,
|
|
341
|
+
commitHash,
|
|
342
|
+
filePath: flatFilePath,
|
|
343
|
+
type: 'flat-file',
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// Branch B: directory
|
|
348
|
+
const specDirPath = path.join(specStoragePath, specDirName);
|
|
349
|
+
if (fs.existsSync(specDirPath) && fs.statSync(specDirPath).isDirectory()) {
|
|
350
|
+
const primary = _findPrimaryDoc(specDirPath, specDirName, discoveryConfig.primaryDocCandidates);
|
|
351
|
+
if (primary) {
|
|
352
|
+
const [, primaryAbsPath] = primary;
|
|
353
|
+
const content = (0, utils_1.readFileContent)(primaryAbsPath);
|
|
354
|
+
if (content !== null) {
|
|
355
|
+
(0, errors_1.logDebug)('Discovered directory spec', { specDirName, primaryDoc: primaryAbsPath });
|
|
356
|
+
const meta = _buildMetadata(specDirName, content, primaryAbsPath, specDirPath, discoveryConfig);
|
|
357
|
+
return { ...meta, type: 'directory' };
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
// Directory exists but no primary doc was found or it was unreadable.
|
|
361
|
+
(0, errors_1.logWarn)('Spec directory exists but no primary doc found', {
|
|
362
|
+
specDirName,
|
|
363
|
+
specDirPath,
|
|
364
|
+
candidates: discoveryConfig.primaryDocCandidates,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
//# sourceMappingURL=spec-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-extractor.js","sourceRoot":"","sources":["../../../src/spec/mining/spec-extractor.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DH,0DA4FC;AA+KD,kDAqFC;AAzZD,uCAAyB;AACzB,2C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