homegraph 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +305 -305
  3. package/dist/bin/command-supervision.d.ts.map +1 -1
  4. package/dist/bin/command-supervision.js +7 -4
  5. package/dist/bin/command-supervision.js.map +1 -1
  6. package/dist/bin/homegraph.js +9 -9
  7. package/dist/db/index.js +36 -36
  8. package/dist/db/migrations.js +37 -37
  9. package/dist/db/queries.js +156 -156
  10. package/dist/db/schema.sql +203 -203
  11. package/dist/directory.js +5 -5
  12. package/dist/extraction/languages/arkts-viewtree.d.ts +2 -4
  13. package/dist/extraction/languages/arkts-viewtree.d.ts.map +1 -1
  14. package/dist/extraction/languages/arkts-viewtree.js +6 -21
  15. package/dist/extraction/languages/arkts-viewtree.js.map +1 -1
  16. package/dist/extraction/languages/arkts.d.ts +16 -6
  17. package/dist/extraction/languages/arkts.d.ts.map +1 -1
  18. package/dist/extraction/languages/arkts.js +174 -21
  19. package/dist/extraction/languages/arkts.js.map +1 -1
  20. package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
  21. package/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
  22. package/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
  23. package/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
  24. package/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
  25. package/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
  26. package/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
  27. package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
  28. package/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
  29. package/dist/installer/instructions-template.js +9 -9
  30. package/dist/mcp/liveness-watchdog.d.ts +18 -0
  31. package/dist/mcp/liveness-watchdog.d.ts.map +1 -1
  32. package/dist/mcp/liveness-watchdog.js +185 -73
  33. package/dist/mcp/liveness-watchdog.js.map +1 -1
  34. package/dist/mcp/server-instructions.js +47 -47
  35. package/dist/reasoning/reasoner.js +32 -32
  36. package/dist/spec/db/commit-node.js +4 -4
  37. package/dist/spec/db/fragment-node.js +10 -10
  38. package/dist/spec/db/fts.js +8 -8
  39. package/dist/spec/db/relations.js +88 -88
  40. package/dist/spec/db/schema.js +6 -6
  41. package/dist/spec/db/schema.sql +121 -121
  42. package/dist/spec/db/spec-node.js +4 -4
  43. package/dist/spec/llm/prompts.js +53 -53
  44. package/dist/spec/utils.d.ts +16 -4
  45. package/dist/spec/utils.d.ts.map +1 -1
  46. package/dist/spec/utils.js +58 -6
  47. package/dist/spec/utils.js.map +1 -1
  48. package/package.json +62 -62
  49. package/scripts/_tmp-cfwk-resolve.log +0 -0
  50. package/scripts/_tmp-cfwk-sig.log +0 -0
  51. package/scripts/_tmp-cfwk-vt.log +0 -0
  52. package/scripts/add-lang/bench.sh +60 -60
  53. package/scripts/add-lang/check-grammar.mjs +75 -75
  54. package/scripts/add-lang/dump-ast.mjs +103 -103
  55. package/scripts/add-lang/verify-extraction.mjs +70 -70
  56. package/scripts/agent-eval/ab-adoption.sh +91 -91
  57. package/scripts/agent-eval/ab-hook.sh +86 -86
  58. package/scripts/agent-eval/ab-impl.sh +78 -78
  59. package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
  60. package/scripts/agent-eval/ab-sufficiency.sh +78 -78
  61. package/scripts/agent-eval/arms-F.sh +21 -21
  62. package/scripts/agent-eval/arms-matrix.sh +37 -37
  63. package/scripts/agent-eval/audit.sh +68 -68
  64. package/scripts/agent-eval/bench-readme.sh +28 -28
  65. package/scripts/agent-eval/bench-why-repo.sh +22 -22
  66. package/scripts/agent-eval/block-read-hook.sh +19 -19
  67. package/scripts/agent-eval/hook-settings.json +15 -15
  68. package/scripts/agent-eval/itrun.sh +120 -120
  69. package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
  70. package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
  71. package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
  72. package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
  73. package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
  74. package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
  75. package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
  76. package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
  77. package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
  78. package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
  79. package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
  80. package/scripts/agent-eval/offload-eval-setup.sh +24 -24
  81. package/scripts/agent-eval/offload-eval-styles.sh +71 -71
  82. package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
  83. package/scripts/agent-eval/offload-eval.md +76 -76
  84. package/scripts/agent-eval/parse-arms.mjs +116 -116
  85. package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
  86. package/scripts/agent-eval/parse-run.mjs +45 -45
  87. package/scripts/agent-eval/parse-session.mjs +93 -93
  88. package/scripts/agent-eval/probe-context.mjs +21 -21
  89. package/scripts/agent-eval/probe-explore.mjs +40 -40
  90. package/scripts/agent-eval/probe-node.mjs +20 -20
  91. package/scripts/agent-eval/probe-sweep.mjs +119 -119
  92. package/scripts/agent-eval/probe-trace.mjs +20 -20
  93. package/scripts/agent-eval/redirect-read-hook.sh +38 -38
  94. package/scripts/agent-eval/repro-concurrent-explore.mjs +119 -119
  95. package/scripts/agent-eval/repro-daemon-clients.mjs +125 -125
  96. package/scripts/agent-eval/run-agent.sh +34 -34
  97. package/scripts/agent-eval/run-all.sh +75 -75
  98. package/scripts/agent-eval/run-arms.sh +56 -56
  99. package/scripts/agent-eval/seq-matrix.mjs +137 -137
  100. package/scripts/bench-arkts-init-rss.log +0 -0
  101. package/scripts/build-bundle.sh +123 -123
  102. package/scripts/exp_boundary_eval/README.md +247 -247
  103. package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-310.pyc +0 -0
  104. package/scripts/exp_boundary_eval/__pycache__/_utils.cpython-38.pyc +0 -0
  105. package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-310.pyc +0 -0
  106. package/scripts/exp_boundary_eval/__pycache__/analyze.cpython-38.pyc +0 -0
  107. package/scripts/exp_boundary_eval/__pycache__/deveco_arm.cpython-38.pyc +0 -0
  108. package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-310.pyc +0 -0
  109. package/scripts/exp_boundary_eval/__pycache__/run_all.cpython-38.pyc +0 -0
  110. package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-310.pyc +0 -0
  111. package/scripts/exp_boundary_eval/__pycache__/run_one.cpython-38.pyc +0 -0
  112. package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-310.pyc +0 -0
  113. package/scripts/exp_boundary_eval/__pycache__/run_session.cpython-38.pyc +0 -0
  114. package/scripts/exp_boundary_eval/__pycache__/setup.cpython-310.pyc +0 -0
  115. package/scripts/exp_boundary_eval/__pycache__/setup.cpython-38.pyc +0 -0
  116. package/scripts/exp_boundary_eval/__pycache__/win_mcp_launcher.cpython-38.pyc +0 -0
  117. package/scripts/exp_boundary_eval/_test_mcp_chain.py +78 -78
  118. package/scripts/exp_boundary_eval/_test_stdin.py +8 -8
  119. package/scripts/exp_boundary_eval/_utils.py +1116 -1116
  120. package/scripts/exp_boundary_eval/analyze.py +1313 -1313
  121. package/scripts/exp_boundary_eval/deveco_arm.py +519 -519
  122. package/scripts/exp_boundary_eval/run_all.py +378 -378
  123. package/scripts/exp_boundary_eval/run_one.py +165 -165
  124. package/scripts/exp_boundary_eval/run_session.py +158 -158
  125. package/scripts/exp_boundary_eval/setup.py +120 -120
  126. package/scripts/exp_boundary_eval/win_mcp_launcher.py +73 -73
  127. package/scripts/exp_boundary_eval/win_mcp_stdio_wrap.js +36 -36
  128. package/scripts/exp_boundary_eval/win_node_launcher.py +24 -24
  129. package/scripts/extract-release-notes.mjs +130 -130
  130. package/scripts/local-install.sh +41 -41
  131. package/scripts/npm-sdk.js +75 -75
  132. package/scripts/npm-shim.js +275 -275
  133. package/scripts/ohos-sdk-publish.mjs +133 -133
  134. package/scripts/pack-npm.sh +119 -119
  135. package/scripts/prepare-release.mjs +270 -270
  136. package/scripts/probe-arkts-mem-why-run.log +0 -0
  137. package/scripts/probe-banner-livecard-ir.log +0 -0
  138. package/scripts/probe-cfwk-ast.stderr.log +0 -0
  139. package/scripts/probe-cfwk-ast.stdout.log +0 -0
  140. package/scripts/probe-cfwk-attr-shape.log +0 -0
  141. package/scripts/probe-cfwk-cfgdump.stderr.log +0 -0
  142. package/scripts/probe-cfwk-cfgdump.stdout.log +0 -0
  143. package/scripts/probe-cfwk-cvc.stderr.log +0 -0
  144. package/scripts/probe-cfwk-cvc.stdout.log +0 -0
  145. package/scripts/probe-cfwk-diag2.log +0 -0
  146. package/scripts/probe-cfwk-diag3.log +0 -0
  147. package/scripts/probe-cfwk-fedbg.stderr.log +0 -0
  148. package/scripts/probe-cfwk-fedbg.stdout.log +0 -0
  149. package/scripts/probe-cfwk-fileresult.log +0 -0
  150. package/scripts/probe-cfwk-fix.stderr.log +0 -0
  151. package/scripts/probe-cfwk-fix.stdout.log +0 -0
  152. package/scripts/probe-cfwk-fix2.stderr.log +0 -0
  153. package/scripts/probe-cfwk-fix2.stdout.log +0 -0
  154. package/scripts/probe-cfwk-fix3.stderr.log +0 -0
  155. package/scripts/probe-cfwk-fix3.stdout.log +0 -0
  156. package/scripts/probe-cfwk-foreach.log +0 -0
  157. package/scripts/probe-cfwk-getmethod-throw.log +0 -0
  158. package/scripts/probe-cfwk-hg-extract.log +0 -0
  159. package/scripts/probe-cfwk-pr1003-noprior.stderr.log +0 -0
  160. package/scripts/probe-cfwk-pr1003-noprior.stdout.log +0 -0
  161. package/scripts/probe-cfwk-pr1003.stderr.log +0 -0
  162. package/scripts/probe-cfwk-pr1003.stdout.log +0 -0
  163. package/scripts/probe-cfwk-preroot-noprior.stderr.log +0 -0
  164. package/scripts/probe-cfwk-preroot-noprior.stdout.log +0 -0
  165. package/scripts/probe-cfwk-preroot-prior.stderr.log +0 -0
  166. package/scripts/probe-cfwk-preroot-prior.stdout.log +0 -0
  167. package/scripts/probe-cfwk-preroot-skipstate.stderr.log +0 -0
  168. package/scripts/probe-cfwk-preroot-skipstate.stdout.log +0 -0
  169. package/scripts/probe-cfwk-resolve-sim.log +0 -0
  170. package/scripts/probe-cfwk-tree-shape.log +0 -0
  171. package/scripts/probe-cfwk-walk-abort.log +0 -0
  172. package/scripts/probe-cfwk.log +0 -0
  173. package/scripts/probe-force-index.log +0 -0
  174. package/scripts/probe-no-force-index.log +0 -0
  175. package/scripts/probe-samefile-ir.stderr.log +0 -0
  176. package/scripts/probe-samefile-ir.stdout.log +224 -0
  177. package/scripts/probe-sdk-vs-project.log +0 -0
  178. package/scripts/probe-viewtree-downgrade.log +0 -0
  179. package/dist/arkts/ohos-api-index.d.ts +0 -15
  180. package/dist/arkts/ohos-api-index.d.ts.map +0 -1
  181. package/dist/arkts/ohos-api-index.js +0 -190
  182. package/dist/arkts/ohos-api-index.js.map +0 -1
  183. package/dist/arkts/ohos-sdk-input.d.ts +0 -36
  184. package/dist/arkts/ohos-sdk-input.d.ts.map +0 -1
  185. package/dist/arkts/ohos-sdk-input.js +0 -214
  186. package/dist/arkts/ohos-sdk-input.js.map +0 -1
  187. package/dist/extraction/languages/arkts-state-decorators.d.ts +0 -13
  188. package/dist/extraction/languages/arkts-state-decorators.d.ts.map +0 -1
  189. package/dist/extraction/languages/arkts-state-decorators.js +0 -26
  190. package/dist/extraction/languages/arkts-state-decorators.js.map +0 -1
  191. package/dist/extraction/languages/ohos-api-consumer.d.ts +0 -34
  192. package/dist/extraction/languages/ohos-api-consumer.d.ts.map +0 -1
  193. package/dist/extraction/languages/ohos-api-consumer.js +0 -283
  194. package/dist/extraction/languages/ohos-api-consumer.js.map +0 -1
  195. package/dist/spec/build/git-scanner.d.ts +0 -93
  196. package/dist/spec/build/git-scanner.d.ts.map +0 -1
  197. package/dist/spec/build/git-scanner.js +0 -254
  198. package/dist/spec/build/git-scanner.js.map +0 -1
  199. package/dist/spec/git-utils.d.ts +0 -8
  200. package/dist/spec/git-utils.d.ts.map +0 -1
  201. package/dist/spec/git-utils.js +0 -14
  202. package/dist/spec/git-utils.js.map +0 -1
  203. package/dist/spec/mine/clusterer.d.ts +0 -63
  204. package/dist/spec/mine/clusterer.d.ts.map +0 -1
  205. package/dist/spec/mine/clusterer.js +0 -904
  206. package/dist/spec/mine/clusterer.js.map +0 -1
  207. package/dist/spec/mine/progress-handler.d.ts +0 -22
  208. package/dist/spec/mine/progress-handler.d.ts.map +0 -1
  209. package/dist/spec/mine/progress-handler.js +0 -108
  210. package/dist/spec/mine/progress-handler.js.map +0 -1
  211. package/dist/spec/mine/progress.d.ts +0 -23
  212. package/dist/spec/mine/progress.d.ts.map +0 -1
  213. package/dist/spec/mine/progress.js +0 -12
  214. package/dist/spec/mine/progress.js.map +0 -1
@@ -1,93 +0,0 @@
1
- /**
2
- * Git commit history scanning and spec↔commit pairing.
3
- *
4
- * Replaces `commit4spec/reverse_engineer/git_scanner.py` and
5
- * `commit4spec/reverse_engineer/git_utils.py`. Discovers spec↔commit pairs via
6
- * conventional-commit scope extraction: extracts scopes from commit messages
7
- * and resolves them to spec IDs on disk.
8
- *
9
- * All Git operations use `execFileSync` with an args array (never template
10
- * strings) to avoid shell injection risks — matching the HomeGraph convention
11
- * in `src/sync/git-hooks.ts` and `src/sync/worktree.ts`.
12
- *
13
- * @module spec/build/git-scanner
14
- */
15
- import { SpecConfig } from '../config';
16
- import { SpecMetadata } from './spec-extractor';
17
- export interface CommitInfo {
18
- /** Full 40-char commit hash */
19
- hash: string;
20
- /** First line of commit message */
21
- message: string;
22
- /** Author name */
23
- author: string;
24
- /** Unix epoch milliseconds */
25
- timestamp: number;
26
- }
27
- export interface SpecCommitPair {
28
- specId: string;
29
- commitHash: string;
30
- specMetadata: SpecMetadata | null;
31
- commitMetadata: CommitInfo | null;
32
- }
33
- /**
34
- * Check whether `repoPath` is a git repository.
35
- *
36
- * Runs `git rev-parse --git-dir` and returns `true` on success, `false`
37
- * when the command fails (not a repo, git not installed, etc.).
38
- */
39
- export declare function isGitRepo(repoPath: string): boolean;
40
- /**
41
- * Return every commit in `repoPath` as `CommitInfo` objects.
42
- *
43
- * Runs `git log --format='%H%n%aI%n%an%n%s%n---END---'` and parses the
44
- * output one five-line block per commit. Commits are returned in reverse
45
- * chronological order (most recent first), matching Git's default.
46
- *
47
- * An empty repo yields an empty array.
48
- */
49
- export declare function getAllCommits(repoPath: string): CommitInfo[];
50
- /**
51
- * Retrieve metadata for a single commit.
52
- *
53
- * Runs `git show -s --format='%H%n%aI%n%an%n%s' <commitHash>`. Returns
54
- * `null` when the command fails (hash not found, invalid repo, etc.).
55
- */
56
- export declare function getCommitInfo(repoPath: string, commitHash: string): CommitInfo | null;
57
- /**
58
- * Return the full unified diff introduced by `commitHash`.
59
- *
60
- * Strategy:
61
- * 1. Query the parent hash(es) via `git log --pretty=%P -n 1 <commitHash>`.
62
- * 2. If a parent exists, diff it against the commit: `git diff <parent> <commitHash>`.
63
- * 3. For an initial (root) commit with no parent, use `git diff <commitHash>`
64
- * which shows all files added in that commit.
65
- *
66
- * Returns an empty string when any Git command fails.
67
- */
68
- export declare function getCommitDiff(repoPath: string, commitHash: string): string;
69
- /**
70
- * Return every commit between `fromHash` (exclusive) and `toHash`
71
- * (inclusive) in chronological order (oldest first).
72
- *
73
- * Runs `git log --reverse --format="..." fromHash..toHash`. Returns an empty
74
- * array when either hash is not found or the range is empty.
75
- *
76
- * Callers should validate that `fromHash` is an ancestor of `toHash` before
77
- * calling this function (use `git merge-base --is-ancestor`). Results are
78
- * undefined when the two hashes are on unrelated branches.
79
- */
80
- export declare function getCommitRange(repoPath: string, fromHash: string, toHash: string): CommitInfo[];
81
- /**
82
- * Main scanning function — discovers spec↔commit pairs from commit history.
83
- *
84
- * Iterates every commit in the repo, extracts a conventional-commit scope from
85
- * its message, normalizes it, and checks whether the resulting spec ID exists
86
- * on disk. When a match is found the pair is recorded with full spec and
87
- * commit metadata.
88
- *
89
- * Duplicates (identical specId + commitHash) are de-duplicated via a
90
- * `Map` keyed on `"${specId}|${commitHash}"`.
91
- */
92
- export declare function scan(repoPath: string, specStoragePath: string, config: SpecConfig): SpecCommitPair[];
93
- //# sourceMappingURL=git-scanner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-scanner.d.ts","sourceRoot":"","sources":["../../../src/spec/build/git-scanner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAuB,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAQrE,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,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;AAmBD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOnD;AAMD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,CAiC5D;AAMD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,UAAU,GAAG,IAAI,CA4BnB;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA4C1E;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,UAAU,EAAE,CAiCd;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,UAAU,GACjB,cAAc,EAAE,CA6BlB"}
@@ -1,254 +0,0 @@
1
- "use strict";
2
- /**
3
- * Git commit history scanning and spec↔commit pairing.
4
- *
5
- * Replaces `commit4spec/reverse_engineer/git_scanner.py` and
6
- * `commit4spec/reverse_engineer/git_utils.py`. Discovers spec↔commit pairs via
7
- * conventional-commit scope extraction: extracts scopes from commit messages
8
- * and resolves them to spec IDs on disk.
9
- *
10
- * All Git operations use `execFileSync` with an args array (never template
11
- * strings) to avoid shell injection risks — matching the HomeGraph convention
12
- * in `src/sync/git-hooks.ts` and `src/sync/worktree.ts`.
13
- *
14
- * @module spec/build/git-scanner
15
- */
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.isGitRepo = isGitRepo;
18
- exports.getAllCommits = getAllCommits;
19
- exports.getCommitInfo = getCommitInfo;
20
- exports.getCommitDiff = getCommitDiff;
21
- exports.getCommitRange = getCommitRange;
22
- exports.scan = scan;
23
- const child_process_1 = require("child_process");
24
- const scope_resolver_1 = require("./scope-resolver");
25
- const spec_extractor_1 = require("./spec-extractor");
26
- const errors_1 = require("../../errors");
27
- const git_utils_1 = require("../git-utils");
28
- // ---------------------------------------------------------------------------
29
- // Helpers
30
- // ---------------------------------------------------------------------------
31
- /**
32
- * Convert an ISO-8601 string to Unix epoch milliseconds.
33
- * Returns 0 for invalid or unparseable strings.
34
- */
35
- function parseISOTimestamp(isoString) {
36
- const ts = new Date(isoString).getTime();
37
- return isNaN(ts) ? 0 : ts;
38
- }
39
- // ---------------------------------------------------------------------------
40
- // isGitRepo
41
- // ---------------------------------------------------------------------------
42
- /**
43
- * Check whether `repoPath` is a git repository.
44
- *
45
- * Runs `git rev-parse --git-dir` and returns `true` on success, `false`
46
- * when the command fails (not a repo, git not installed, etc.).
47
- */
48
- function isGitRepo(repoPath) {
49
- try {
50
- (0, child_process_1.execFileSync)('git', ['rev-parse', '--git-dir'], (0, git_utils_1.gitExecOptions)(repoPath));
51
- return true;
52
- }
53
- catch {
54
- return false;
55
- }
56
- }
57
- // ---------------------------------------------------------------------------
58
- // getAllCommits
59
- // ---------------------------------------------------------------------------
60
- /**
61
- * Return every commit in `repoPath` as `CommitInfo` objects.
62
- *
63
- * Runs `git log --format='%H%n%aI%n%an%n%s%n---END---'` and parses the
64
- * output one five-line block per commit. Commits are returned in reverse
65
- * chronological order (most recent first), matching Git's default.
66
- *
67
- * An empty repo yields an empty array.
68
- */
69
- function getAllCommits(repoPath) {
70
- let stdout;
71
- try {
72
- stdout = (0, child_process_1.execFileSync)('git', ['log', "--format=%H%x00%aI%x00%an%x00%s%x00"], (0, git_utils_1.gitExecOptions)(repoPath));
73
- }
74
- catch {
75
- return [];
76
- }
77
- const parts = stdout.replace(/\0+$/, '').trim().split('\0');
78
- const commits = [];
79
- // Each commit occupies 4 NUL-separated fields: hash, timestamp, author, message
80
- for (let i = 0; i + 3 < parts.length; i += 4) {
81
- const hash = parts[i].trim();
82
- const isoString = parts[i + 1].trim();
83
- const author = parts[i + 2].trim();
84
- const message = parts[i + 3].trim();
85
- if (!hash)
86
- continue;
87
- commits.push({
88
- hash,
89
- message,
90
- author,
91
- timestamp: parseISOTimestamp(isoString),
92
- });
93
- }
94
- return commits;
95
- }
96
- // ---------------------------------------------------------------------------
97
- // getCommitInfo
98
- // ---------------------------------------------------------------------------
99
- /**
100
- * Retrieve metadata for a single commit.
101
- *
102
- * Runs `git show -s --format='%H%n%aI%n%an%n%s' <commitHash>`. Returns
103
- * `null` when the command fails (hash not found, invalid repo, etc.).
104
- */
105
- function getCommitInfo(repoPath, commitHash) {
106
- let stdout;
107
- try {
108
- stdout = (0, child_process_1.execFileSync)('git', ['show', '-s', "--format=%H%n%aI%n%an%n%s", commitHash], (0, git_utils_1.gitExecOptions)(repoPath));
109
- }
110
- catch {
111
- return null;
112
- }
113
- const lines = stdout.trim().split('\n');
114
- if (lines.length < 4)
115
- return null;
116
- const hash = lines[0].trim();
117
- const isoString = lines[1].trim();
118
- const author = lines[2].trim();
119
- const message = lines[3].trim();
120
- if (!hash)
121
- return null;
122
- return {
123
- hash,
124
- message,
125
- author,
126
- timestamp: parseISOTimestamp(isoString),
127
- };
128
- }
129
- // ---------------------------------------------------------------------------
130
- // getCommitDiff
131
- // ---------------------------------------------------------------------------
132
- /**
133
- * Return the full unified diff introduced by `commitHash`.
134
- *
135
- * Strategy:
136
- * 1. Query the parent hash(es) via `git log --pretty=%P -n 1 <commitHash>`.
137
- * 2. If a parent exists, diff it against the commit: `git diff <parent> <commitHash>`.
138
- * 3. For an initial (root) commit with no parent, use `git diff <commitHash>`
139
- * which shows all files added in that commit.
140
- *
141
- * Returns an empty string when any Git command fails.
142
- */
143
- function getCommitDiff(repoPath, commitHash) {
144
- // Step 1 — get parent hashes.
145
- let parentStdout;
146
- try {
147
- parentStdout = (0, child_process_1.execFileSync)('git', ['log', '--pretty=%P', '-n', '1', commitHash], (0, git_utils_1.gitExecOptions)(repoPath));
148
- }
149
- catch {
150
- return '';
151
- }
152
- const parents = parentStdout.trim().split(/\s+/).filter(Boolean);
153
- // Step 2 & 3 — run the appropriate diff.
154
- try {
155
- if (parents.length > 0) {
156
- const diffs = [];
157
- for (const parent of parents) {
158
- try {
159
- diffs.push((0, child_process_1.execFileSync)('git', ['diff', parent, commitHash], (0, git_utils_1.gitExecOptions)(repoPath)));
160
- }
161
- catch {
162
- // Skip diffs that fail for an individual parent
163
- }
164
- }
165
- return diffs.join('\n');
166
- }
167
- // Initial commit — no parent.
168
- return (0, child_process_1.execFileSync)('git', ['diff', commitHash], (0, git_utils_1.gitExecOptions)(repoPath));
169
- }
170
- catch {
171
- return '';
172
- }
173
- }
174
- // ---------------------------------------------------------------------------
175
- // getCommitRange
176
- // ---------------------------------------------------------------------------
177
- /**
178
- * Return every commit between `fromHash` (exclusive) and `toHash`
179
- * (inclusive) in chronological order (oldest first).
180
- *
181
- * Runs `git log --reverse --format="..." fromHash..toHash`. Returns an empty
182
- * array when either hash is not found or the range is empty.
183
- *
184
- * Callers should validate that `fromHash` is an ancestor of `toHash` before
185
- * calling this function (use `git merge-base --is-ancestor`). Results are
186
- * undefined when the two hashes are on unrelated branches.
187
- */
188
- function getCommitRange(repoPath, fromHash, toHash) {
189
- let stdout;
190
- try {
191
- stdout = (0, child_process_1.execFileSync)('git', ['log', '--no-merges', '--reverse', `--format=%H%x00%aI%x00%an%x00%s%x00`, `${fromHash}..${toHash}`], (0, git_utils_1.gitExecOptions)(repoPath));
192
- }
193
- catch {
194
- return [];
195
- }
196
- const parts = stdout.replace(/\0+$/, '').trim().split('\0');
197
- const commits = [];
198
- // Each commit occupies 4 NUL-separated fields: hash, timestamp, author, message
199
- for (let i = 0; i + 3 < parts.length; i += 4) {
200
- const hash = parts[i].trim();
201
- const isoString = parts[i + 1].trim();
202
- const author = parts[i + 2].trim();
203
- const message = parts[i + 3].trim();
204
- if (!hash)
205
- continue;
206
- commits.push({
207
- hash,
208
- message,
209
- author,
210
- timestamp: parseISOTimestamp(isoString),
211
- });
212
- }
213
- return commits;
214
- }
215
- // ---------------------------------------------------------------------------
216
- // scan
217
- // ---------------------------------------------------------------------------
218
- /**
219
- * Main scanning function — discovers spec↔commit pairs from commit history.
220
- *
221
- * Iterates every commit in the repo, extracts a conventional-commit scope from
222
- * its message, normalizes it, and checks whether the resulting spec ID exists
223
- * on disk. When a match is found the pair is recorded with full spec and
224
- * commit metadata.
225
- *
226
- * Duplicates (identical specId + commitHash) are de-duplicated via a
227
- * `Map` keyed on `"${specId}|${commitHash}"`.
228
- */
229
- function scan(repoPath, specStoragePath, config) {
230
- const pairs = new Map();
231
- const commits = getAllCommits(repoPath);
232
- for (const commit of commits) {
233
- const specId = (0, scope_resolver_1.resolveScopeToSpec)(commit.message, specStoragePath, config);
234
- if (!specId) {
235
- (0, errors_1.logDebug)('scan: no scope match', {
236
- commitHash: commit.hash.slice(0, 7),
237
- message: commit.message,
238
- });
239
- continue;
240
- }
241
- const specMetadata = (0, spec_extractor_1.extractSpecMetadata)(specStoragePath, specId, config);
242
- const key = `${specId}|${commit.hash}`;
243
- if (!pairs.has(key)) {
244
- pairs.set(key, {
245
- specId,
246
- commitHash: commit.hash,
247
- specMetadata,
248
- commitMetadata: commit,
249
- });
250
- }
251
- }
252
- return Array.from(pairs.values());
253
- }
254
- //# sourceMappingURL=git-scanner.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-scanner.js","sourceRoot":"","sources":["../../../src/spec/build/git-scanner.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAsDH,8BAOC;AAeD,sCAiCC;AAYD,sCA+BC;AAiBD,sCA4CC;AAiBD,wCAqCC;AAiBD,oBAiCC;AA3TD,iDAA6C;AAE7C,qDAAsD;AACtD,qDAAqE;AACrE,yCAAwC;AACxC,4CAA8C;AAwB9C,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;GAGG;AACH,SAAS,iBAAiB,CAAC,SAAiB;IAC1C,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC;IACzC,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5B,CAAC;AAED,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,QAAgB;IACxC,IAAI,CAAC;QACH,IAAA,4BAAY,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,IAAA,0BAAc,EAAC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AAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IAExC,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAA,mCAAkB,EAAC,MAAM,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;QAC3E,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,YAAY,GAAG,IAAA,oCAAmB,EAAC,eAAe,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAE1E,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;gBACZ,cAAc,EAAE,MAAM;aACvB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;AACpC,CAAC"}
@@ -1,8 +0,0 @@
1
- /** Shared options for all `execFileSync` Git calls across the spec module. */
2
- export declare function gitExecOptions(repoPath: string): {
3
- cwd: string;
4
- encoding: "utf8";
5
- stdio: (number | import("stream") | import("child_process").IOType | "ipc" | null | undefined)[];
6
- windowsHide: boolean;
7
- };
8
- //# sourceMappingURL=git-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-utils.d.ts","sourceRoot":"","sources":["../../src/spec/git-utils.ts"],"names":[],"mappings":"AAEA,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM;;;;;EAQ9C"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.gitExecOptions = gitExecOptions;
4
- /** Shared options for all `execFileSync` Git calls across the spec module. */
5
- function gitExecOptions(repoPath) {
6
- const stdio = ['ignore', 'pipe', 'ignore'];
7
- return {
8
- cwd: repoPath,
9
- encoding: 'utf8',
10
- stdio,
11
- windowsHide: true,
12
- };
13
- }
14
- //# sourceMappingURL=git-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git-utils.js","sourceRoot":"","sources":["../../src/spec/git-utils.ts"],"names":[],"mappings":";;AAGA,wCAQC;AATD,8EAA8E;AAC9E,SAAgB,cAAc,CAAC,QAAgB;IAC7C,MAAM,KAAK,GAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACzD,OAAO;QACL,GAAG,EAAE,QAAQ;QACb,QAAQ,EAAE,MAAe;QACzB,KAAK;QACL,WAAW,EAAE,IAAI;KAClB,CAAC;AACJ,CAAC"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Commit Clusterer — multi-signal graph clustering for the `spec mine` pipeline.
3
- *
4
- * Groups commits by structural (AST symbol overlap), file-path, temporal,
5
- * and commit-message similarity. Pure TypeScript implementation — no native
6
- * dependencies required.
7
- *
8
- * Algorithm: Leiden community detection on a weighted similarity graph.
9
- * Replaces Louvain and connected-components (single-linkage) to avoid chaining
10
- * all commits into one giant cluster and to guarantee well-connected communities
11
- * via the refinement phase. A resolution parameter γ is auto-tuned via
12
- * multiplicative search so the output community count stays close to maxClusters.
13
- *
14
- * @module spec/mine/clusterer
15
- */
16
- import { CommitChange } from './scanner';
17
- /** A cluster of semantically-related commits. */
18
- export interface CommitCluster {
19
- id: number;
20
- commits: CommitChange[];
21
- primaryFiles: string[];
22
- primarySymbols: string[];
23
- summary: string;
24
- timeRange: {
25
- start: number;
26
- end: number;
27
- };
28
- }
29
- /** Full clustering result including unclustered outliers and stats. */
30
- export interface ClusterResult {
31
- clusters: CommitCluster[];
32
- unclustered: CommitChange[];
33
- stats: {
34
- totalCommits: number;
35
- clusteredCommits: number;
36
- clusterCount: number;
37
- };
38
- }
39
- /**
40
- * Cluster commits using Leiden community detection on a multi-signal
41
- * similarity graph, with recursive sub-splitting for large clusters.
42
- *
43
- * The pipeline:
44
- * 1. Build a weighted similarity graph from AST symbol, file-path,
45
- * commit-message TF-IDF, ticket-reference, and temporal signals.
46
- * 2. Run Leiden community detection with auto-tuned resolution γ.
47
- * 3. Greedy-merge if still too many communities.
48
- * 4. Recursively split large clusters (≥ 4 commits) by running
49
- * Leiden on their sub-graphs.
50
- *
51
- * Replaces the previous Louvain (no refinement) and connected-components
52
- * (single-linkage chaining) approaches.
53
- *
54
- * @param changes - AST change data for each commit.
55
- * @param threshold - Minimum similarity (0-1) for considering an edge.
56
- * @param maxClusters - Desired maximum number of top-level clusters.
57
- * The resolution parameter γ is auto-tuned to approach
58
- * this target. Recursive splitting may produce more
59
- * clusters at finer granularities.
60
- * @returns Clustered result with stats.
61
- */
62
- export declare function clusterCommits(changes: CommitChange[], threshold: number, maxClusters: number): ClusterResult;
63
- //# sourceMappingURL=clusterer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clusterer.d.ts","sourceRoot":"","sources":["../../../src/spec/mine/clusterer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAQzC,iDAAiD;AACjD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C;AAED,uEAAuE;AACvE,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAs1BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,YAAY,EAAE,EACvB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,aAAa,CA0Mf"}