mulch-cli 0.4.3 → 0.6.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.
Files changed (193) hide show
  1. package/README.md +24 -4
  2. package/package.json +11 -16
  3. package/src/api.ts +310 -0
  4. package/src/cli.ts +54 -0
  5. package/src/commands/add.ts +61 -0
  6. package/src/commands/compact.ts +924 -0
  7. package/src/commands/delete.ts +103 -0
  8. package/src/commands/diff.ts +209 -0
  9. package/src/commands/doctor.ts +586 -0
  10. package/src/commands/edit.ts +253 -0
  11. package/src/commands/init.ts +33 -0
  12. package/src/commands/learn.ts +170 -0
  13. package/src/commands/onboard.ts +362 -0
  14. package/src/commands/prime.ts +327 -0
  15. package/src/commands/prune.ts +128 -0
  16. package/src/commands/query.ts +177 -0
  17. package/src/commands/ready.ts +194 -0
  18. package/src/commands/record.ts +959 -0
  19. package/src/commands/search.ts +234 -0
  20. package/src/commands/setup.ts +823 -0
  21. package/src/commands/status.ts +83 -0
  22. package/src/commands/sync.ts +224 -0
  23. package/src/commands/update.ts +112 -0
  24. package/src/commands/validate.ts +107 -0
  25. package/src/index.ts +50 -0
  26. package/src/schemas/config.ts +31 -0
  27. package/src/schemas/index.ts +18 -0
  28. package/src/schemas/record-schema.ts +177 -0
  29. package/src/schemas/record.ts +83 -0
  30. package/src/utils/bm25.ts +243 -0
  31. package/src/utils/budget.ts +157 -0
  32. package/src/utils/config.ts +117 -0
  33. package/src/utils/expertise.ts +379 -0
  34. package/src/utils/format.ts +767 -0
  35. package/src/utils/git.ts +89 -0
  36. package/src/utils/index.ts +54 -0
  37. package/src/utils/json-output.ts +13 -0
  38. package/src/utils/lock.ts +82 -0
  39. package/src/utils/markers.ts +51 -0
  40. package/src/utils/scoring.ts +101 -0
  41. package/src/utils/version.ts +46 -0
  42. package/dist/cli.d.ts +0 -3
  43. package/dist/cli.d.ts.map +0 -1
  44. package/dist/cli.js +0 -50
  45. package/dist/cli.js.map +0 -1
  46. package/dist/commands/add.d.ts +0 -3
  47. package/dist/commands/add.d.ts.map +0 -1
  48. package/dist/commands/add.js +0 -47
  49. package/dist/commands/add.js.map +0 -1
  50. package/dist/commands/compact.d.ts +0 -5
  51. package/dist/commands/compact.d.ts.map +0 -1
  52. package/dist/commands/compact.js +0 -709
  53. package/dist/commands/compact.js.map +0 -1
  54. package/dist/commands/delete.d.ts +0 -3
  55. package/dist/commands/delete.d.ts.map +0 -1
  56. package/dist/commands/delete.js +0 -82
  57. package/dist/commands/delete.js.map +0 -1
  58. package/dist/commands/diff.d.ts +0 -11
  59. package/dist/commands/diff.d.ts.map +0 -1
  60. package/dist/commands/diff.js +0 -170
  61. package/dist/commands/diff.js.map +0 -1
  62. package/dist/commands/doctor.d.ts +0 -3
  63. package/dist/commands/doctor.d.ts.map +0 -1
  64. package/dist/commands/doctor.js +0 -391
  65. package/dist/commands/doctor.js.map +0 -1
  66. package/dist/commands/edit.d.ts +0 -3
  67. package/dist/commands/edit.d.ts.map +0 -1
  68. package/dist/commands/edit.js +0 -210
  69. package/dist/commands/edit.js.map +0 -1
  70. package/dist/commands/init.d.ts +0 -3
  71. package/dist/commands/init.d.ts.map +0 -1
  72. package/dist/commands/init.js +0 -30
  73. package/dist/commands/init.js.map +0 -1
  74. package/dist/commands/learn.d.ts +0 -12
  75. package/dist/commands/learn.d.ts.map +0 -1
  76. package/dist/commands/learn.js +0 -130
  77. package/dist/commands/learn.js.map +0 -1
  78. package/dist/commands/onboard.d.ts +0 -10
  79. package/dist/commands/onboard.d.ts.map +0 -1
  80. package/dist/commands/onboard.js +0 -286
  81. package/dist/commands/onboard.js.map +0 -1
  82. package/dist/commands/prime.d.ts +0 -3
  83. package/dist/commands/prime.d.ts.map +0 -1
  84. package/dist/commands/prime.js +0 -242
  85. package/dist/commands/prime.js.map +0 -1
  86. package/dist/commands/prune.d.ts +0 -8
  87. package/dist/commands/prune.d.ts.map +0 -1
  88. package/dist/commands/prune.js +0 -90
  89. package/dist/commands/prune.js.map +0 -1
  90. package/dist/commands/query.d.ts +0 -3
  91. package/dist/commands/query.d.ts.map +0 -1
  92. package/dist/commands/query.js +0 -118
  93. package/dist/commands/query.js.map +0 -1
  94. package/dist/commands/ready.d.ts +0 -3
  95. package/dist/commands/ready.d.ts.map +0 -1
  96. package/dist/commands/ready.js +0 -160
  97. package/dist/commands/ready.js.map +0 -1
  98. package/dist/commands/record.d.ts +0 -13
  99. package/dist/commands/record.d.ts.map +0 -1
  100. package/dist/commands/record.js +0 -688
  101. package/dist/commands/record.js.map +0 -1
  102. package/dist/commands/search.d.ts +0 -3
  103. package/dist/commands/search.d.ts.map +0 -1
  104. package/dist/commands/search.js +0 -163
  105. package/dist/commands/search.js.map +0 -1
  106. package/dist/commands/setup.d.ts +0 -29
  107. package/dist/commands/setup.d.ts.map +0 -1
  108. package/dist/commands/setup.js +0 -548
  109. package/dist/commands/setup.js.map +0 -1
  110. package/dist/commands/status.d.ts +0 -3
  111. package/dist/commands/status.d.ts.map +0 -1
  112. package/dist/commands/status.js +0 -61
  113. package/dist/commands/status.js.map +0 -1
  114. package/dist/commands/sync.d.ts +0 -3
  115. package/dist/commands/sync.d.ts.map +0 -1
  116. package/dist/commands/sync.js +0 -176
  117. package/dist/commands/sync.js.map +0 -1
  118. package/dist/commands/update.d.ts +0 -3
  119. package/dist/commands/update.d.ts.map +0 -1
  120. package/dist/commands/update.js +0 -72
  121. package/dist/commands/update.js.map +0 -1
  122. package/dist/commands/validate.d.ts +0 -3
  123. package/dist/commands/validate.d.ts.map +0 -1
  124. package/dist/commands/validate.js +0 -86
  125. package/dist/commands/validate.js.map +0 -1
  126. package/dist/index.d.ts +0 -7
  127. package/dist/index.d.ts.map +0 -1
  128. package/dist/index.js +0 -8
  129. package/dist/index.js.map +0 -1
  130. package/dist/schemas/config.d.ts +0 -17
  131. package/dist/schemas/config.d.ts.map +0 -1
  132. package/dist/schemas/config.js +0 -16
  133. package/dist/schemas/config.js.map +0 -1
  134. package/dist/schemas/index.d.ts +0 -5
  135. package/dist/schemas/index.d.ts.map +0 -1
  136. package/dist/schemas/index.js +0 -3
  137. package/dist/schemas/index.js.map +0 -1
  138. package/dist/schemas/record-schema.d.ts +0 -379
  139. package/dist/schemas/record-schema.d.ts.map +0 -1
  140. package/dist/schemas/record-schema.js +0 -148
  141. package/dist/schemas/record-schema.js.map +0 -1
  142. package/dist/schemas/record.d.ts +0 -60
  143. package/dist/schemas/record.d.ts.map +0 -1
  144. package/dist/schemas/record.js +0 -2
  145. package/dist/schemas/record.js.map +0 -1
  146. package/dist/utils/bm25.d.ts +0 -39
  147. package/dist/utils/bm25.d.ts.map +0 -1
  148. package/dist/utils/bm25.js +0 -171
  149. package/dist/utils/bm25.js.map +0 -1
  150. package/dist/utils/budget.d.ts +0 -35
  151. package/dist/utils/budget.d.ts.map +0 -1
  152. package/dist/utils/budget.js +0 -114
  153. package/dist/utils/budget.js.map +0 -1
  154. package/dist/utils/config.d.ts +0 -12
  155. package/dist/utils/config.d.ts.map +0 -1
  156. package/dist/utils/config.js +0 -89
  157. package/dist/utils/config.js.map +0 -1
  158. package/dist/utils/expertise.d.ts +0 -57
  159. package/dist/utils/expertise.d.ts.map +0 -1
  160. package/dist/utils/expertise.js +0 -264
  161. package/dist/utils/expertise.js.map +0 -1
  162. package/dist/utils/format.d.ts +0 -31
  163. package/dist/utils/format.d.ts.map +0 -1
  164. package/dist/utils/format.js +0 -556
  165. package/dist/utils/format.js.map +0 -1
  166. package/dist/utils/git.d.ts +0 -6
  167. package/dist/utils/git.d.ts.map +0 -1
  168. package/dist/utils/git.js +0 -81
  169. package/dist/utils/git.js.map +0 -1
  170. package/dist/utils/index.d.ts +0 -8
  171. package/dist/utils/index.d.ts.map +0 -1
  172. package/dist/utils/index.js +0 -8
  173. package/dist/utils/index.js.map +0 -1
  174. package/dist/utils/json-output.d.ts +0 -8
  175. package/dist/utils/json-output.d.ts.map +0 -1
  176. package/dist/utils/json-output.js +0 -7
  177. package/dist/utils/json-output.js.map +0 -1
  178. package/dist/utils/lock.d.ts +0 -6
  179. package/dist/utils/lock.d.ts.map +0 -1
  180. package/dist/utils/lock.js +0 -70
  181. package/dist/utils/lock.js.map +0 -1
  182. package/dist/utils/markers.d.ts +0 -22
  183. package/dist/utils/markers.d.ts.map +0 -1
  184. package/dist/utils/markers.js +0 -42
  185. package/dist/utils/markers.js.map +0 -1
  186. package/dist/utils/scoring.d.ts +0 -73
  187. package/dist/utils/scoring.d.ts.map +0 -1
  188. package/dist/utils/scoring.js +0 -80
  189. package/dist/utils/scoring.js.map +0 -1
  190. package/dist/utils/version.d.ts +0 -15
  191. package/dist/utils/version.d.ts.map +0 -1
  192. package/dist/utils/version.js +0 -48
  193. package/dist/utils/version.js.map +0 -1
package/dist/utils/git.js DELETED
@@ -1,81 +0,0 @@
1
- import { execFileSync } from "node:child_process";
2
- export function isGitRepo(cwd) {
3
- try {
4
- execFileSync("git", ["rev-parse", "--is-inside-work-tree"], { cwd, stdio: "pipe" });
5
- return true;
6
- }
7
- catch {
8
- return false;
9
- }
10
- }
11
- export function getChangedFiles(cwd, since) {
12
- const files = new Set();
13
- // Committed changes (since ref)
14
- try {
15
- const committed = execFileSync("git", ["diff", "--name-only", since], {
16
- cwd,
17
- encoding: "utf-8",
18
- stdio: ["pipe", "pipe", "pipe"],
19
- }).trim();
20
- if (committed) {
21
- for (const f of committed.split("\n")) {
22
- if (f)
23
- files.add(f);
24
- }
25
- }
26
- }
27
- catch {
28
- // ref might not exist (e.g., first commit) — fall through
29
- }
30
- // Staged but uncommitted changes
31
- try {
32
- const staged = execFileSync("git", ["diff", "--name-only", "--cached"], {
33
- cwd,
34
- encoding: "utf-8",
35
- stdio: ["pipe", "pipe", "pipe"],
36
- }).trim();
37
- if (staged) {
38
- for (const f of staged.split("\n")) {
39
- if (f)
40
- files.add(f);
41
- }
42
- }
43
- }
44
- catch {
45
- // ignore
46
- }
47
- // Unstaged working tree changes
48
- try {
49
- const unstaged = execFileSync("git", ["diff", "--name-only"], {
50
- cwd,
51
- encoding: "utf-8",
52
- stdio: ["pipe", "pipe", "pipe"],
53
- }).trim();
54
- if (unstaged) {
55
- for (const f of unstaged.split("\n")) {
56
- if (f)
57
- files.add(f);
58
- }
59
- }
60
- }
61
- catch {
62
- // ignore
63
- }
64
- return [...files].sort();
65
- }
66
- export function fileMatchesAny(file, changedFiles) {
67
- return changedFiles.some((changed) => changed === file ||
68
- changed.endsWith(file) ||
69
- file.endsWith(changed));
70
- }
71
- export function filterByContext(records, changedFiles) {
72
- return records.filter((r) => {
73
- // Records without a files field are always relevant (conventions, failures, decisions, guides)
74
- if (!("files" in r) || !r.files || r.files.length === 0) {
75
- return true;
76
- }
77
- // Records with files: keep if any file matches a changed file
78
- return r.files.some((f) => fileMatchesAny(f, changedFiles));
79
- });
80
- }
81
- //# sourceMappingURL=git.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,IAAI,CAAC;QACH,YAAY,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,uBAAuB,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;QACpF,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,KAAa;IACxD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAEhC,gCAAgC;IAChC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE;YACpE,GAAG;YACH,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;S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QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;IACX,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,YAAsB;IAEtB,OAAO,YAAY,CAAC,IAAI,CACtB,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,KAAK,IAAI;QAChB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CACzB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAC7B,OAA0B,EAC1B,YAAsB;IAEtB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QAC1B,+FAA+F;QAC/F,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,8DAA8D;QAC9D,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,8 +0,0 @@
1
- export { getMulchDir, getConfigPath, getExpertiseDir, getExpertisePath, readConfig, writeConfig, initMulchDir, } from "./config.js";
2
- export { readExpertiseFile, appendRecord, createExpertiseFile, getFileModTime, countRecords, filterByType, generateRecordId, } from "./expertise.js";
3
- export { formatDomainExpertise, formatPrimeOutput, formatStatusOutput, formatTimeAgo, getRecordSummary, } from "./format.js";
4
- export { outputJson, outputJsonError, } from "./json-output.js";
5
- export { isGitRepo, getChangedFiles, fileMatchesAny, filterByContext, } from "./git.js";
6
- export { MARKER_START, MARKER_END, hasMarkerSection, replaceMarkerSection, removeMarkerSection, wrapInMarkers, } from "./markers.js";
7
- export { getCurrentVersion, getLatestVersion, compareSemver, } from "./version.js";
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,cAAc,CAAC"}
@@ -1,8 +0,0 @@
1
- export { getMulchDir, getConfigPath, getExpertiseDir, getExpertisePath, readConfig, writeConfig, initMulchDir, } from "./config.js";
2
- export { readExpertiseFile, appendRecord, createExpertiseFile, getFileModTime, countRecords, filterByType, generateRecordId, } from "./expertise.js";
3
- export { formatDomainExpertise, formatPrimeOutput, formatStatusOutput, formatTimeAgo, getRecordSummary, } from "./format.js";
4
- export { outputJson, outputJsonError, } from "./json-output.js";
5
- export { isGitRepo, getChangedFiles, fileMatchesAny, filterByContext, } from "./git.js";
6
- export { MARKER_START, MARKER_END, hasMarkerSection, replaceMarkerSection, removeMarkerSection, wrapInMarkers, } from "./markers.js";
7
- export { getCurrentVersion, getLatestVersion, compareSemver, } from "./version.js";
8
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,SAAS,EACT,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,cAAc,CAAC"}
@@ -1,8 +0,0 @@
1
- export interface JsonResult {
2
- success: boolean;
3
- command: string;
4
- [key: string]: unknown;
5
- }
6
- export declare function outputJson(result: JsonResult): void;
7
- export declare function outputJsonError(command: string, error: string): void;
8
- //# sourceMappingURL=json-output.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-output.d.ts","sourceRoot":"","sources":["../../src/utils/json-output.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAEnD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpE"}
@@ -1,7 +0,0 @@
1
- export function outputJson(result) {
2
- console.log(JSON.stringify(result, null, 2));
3
- }
4
- export function outputJsonError(command, error) {
5
- console.error(JSON.stringify({ success: false, command, error }, null, 2));
6
- }
7
- //# sourceMappingURL=json-output.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"json-output.js","sourceRoot":"","sources":["../../src/utils/json-output.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,UAAU,CAAC,MAAkB;IAC3C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,KAAa;IAC5D,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC7E,CAAC"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Advisory file-level lock using O_CREAT | O_EXCL.
3
- * Wraps an async function with lock acquisition and guaranteed cleanup.
4
- */
5
- export declare function withFileLock<T>(filePath: string, fn: () => Promise<T>): Promise<T>;
6
- //# sourceMappingURL=lock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/utils/lock.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,QAAQ,EAAE,MAAM,EAChB,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAQZ"}
@@ -1,70 +0,0 @@
1
- import { open, unlink, lstat } from "node:fs/promises";
2
- import { constants } from "node:fs";
3
- const LOCK_STALE_MS = 30_000; // 30 seconds
4
- const LOCK_RETRY_INTERVAL_MS = 50;
5
- const LOCK_TIMEOUT_MS = 5_000; // 5 seconds
6
- /**
7
- * Advisory file-level lock using O_CREAT | O_EXCL.
8
- * Wraps an async function with lock acquisition and guaranteed cleanup.
9
- */
10
- export async function withFileLock(filePath, fn) {
11
- const lockPath = `${filePath}.lock`;
12
- await acquireLock(lockPath);
13
- try {
14
- return await fn();
15
- }
16
- finally {
17
- await releaseLock(lockPath);
18
- }
19
- }
20
- async function acquireLock(lockPath) {
21
- const deadline = Date.now() + LOCK_TIMEOUT_MS;
22
- while (true) {
23
- try {
24
- const fd = await open(lockPath, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY);
25
- await fd.close();
26
- return;
27
- }
28
- catch (err) {
29
- if (err.code !== "EEXIST") {
30
- throw err;
31
- }
32
- // Lock file exists — check if it's stale
33
- if (await isStaleLock(lockPath)) {
34
- try {
35
- await unlink(lockPath);
36
- }
37
- catch {
38
- // Another process may have already removed it
39
- }
40
- continue;
41
- }
42
- if (Date.now() >= deadline) {
43
- throw new Error(`Timed out waiting for lock on ${lockPath}. If no other mulch process is running, delete the lock file manually.`);
44
- }
45
- await sleep(LOCK_RETRY_INTERVAL_MS);
46
- }
47
- }
48
- }
49
- async function isStaleLock(lockPath) {
50
- try {
51
- const stats = await lstat(lockPath);
52
- return Date.now() - stats.mtimeMs > LOCK_STALE_MS;
53
- }
54
- catch {
55
- // Lock file disappeared between check — not stale, just gone
56
- return false;
57
- }
58
- }
59
- async function releaseLock(lockPath) {
60
- try {
61
- await unlink(lockPath);
62
- }
63
- catch {
64
- // Lock file already gone — acceptable
65
- }
66
- }
67
- function sleep(ms) {
68
- return new Promise((resolve) => setTimeout(resolve, ms));
69
- }
70
- //# sourceMappingURL=lock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"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CAAC;gBACzB,CAAC;gBAAC,MAAM,CAAC;oBACP,8CAA8C;gBAChD,CAAC;gBACD,SAAS;YACX,CAAC;YAED,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CACb,iCAAiC,QAAQ,wEAAwE,CAClH,CAAC;YACJ,CAAC;YAED,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;AACH,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,QAAgB;IACzC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,GAAG,aAAa,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,QAAgB;IACzC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,sCAAsC;IACxC,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -1,22 +0,0 @@
1
- declare const MARKER_START = "<!-- mulch:start -->";
2
- declare const MARKER_END = "<!-- mulch:end -->";
3
- export { MARKER_START, MARKER_END };
4
- /**
5
- * Check whether content contains the mulch marker section.
6
- */
7
- export declare function hasMarkerSection(content: string): boolean;
8
- /**
9
- * Replace the marker-bounded section with new content.
10
- * Returns null if no markers found.
11
- */
12
- export declare function replaceMarkerSection(content: string, newSection: string): string | null;
13
- /**
14
- * Remove the marker-bounded section entirely.
15
- * Cleans up extra newlines left behind.
16
- */
17
- export declare function removeMarkerSection(content: string): string;
18
- /**
19
- * Wrap a snippet in mulch markers.
20
- */
21
- export declare function wrapInMarkers(snippet: string): string;
22
- //# sourceMappingURL=markers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markers.d.ts","sourceRoot":"","sources":["../../src/utils/markers.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY,yBAAyB,CAAC;AAC5C,QAAA,MAAM,UAAU,uBAAuB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAEpC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CASf;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAS3D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -1,42 +0,0 @@
1
- const MARKER_START = "<!-- mulch:start -->";
2
- const MARKER_END = "<!-- mulch:end -->";
3
- export { MARKER_START, MARKER_END };
4
- /**
5
- * Check whether content contains the mulch marker section.
6
- */
7
- export function hasMarkerSection(content) {
8
- return content.includes(MARKER_START);
9
- }
10
- /**
11
- * Replace the marker-bounded section with new content.
12
- * Returns null if no markers found.
13
- */
14
- export function replaceMarkerSection(content, newSection) {
15
- const startIdx = content.indexOf(MARKER_START);
16
- const endIdx = content.indexOf(MARKER_END);
17
- if (startIdx === -1 || endIdx === -1)
18
- return null;
19
- const before = content.substring(0, startIdx);
20
- const after = content.substring(endIdx + MARKER_END.length);
21
- return before + newSection + after;
22
- }
23
- /**
24
- * Remove the marker-bounded section entirely.
25
- * Cleans up extra newlines left behind.
26
- */
27
- export function removeMarkerSection(content) {
28
- const startIdx = content.indexOf(MARKER_START);
29
- const endIdx = content.indexOf(MARKER_END);
30
- if (startIdx === -1 || endIdx === -1)
31
- return content;
32
- const before = content.substring(0, startIdx);
33
- const after = content.substring(endIdx + MARKER_END.length);
34
- return (before + after).replace(/\n{3,}/g, "\n\n").trim() + "\n";
35
- }
36
- /**
37
- * Wrap a snippet in mulch markers.
38
- */
39
- export function wrapInMarkers(snippet) {
40
- return `${MARKER_START}\n${snippet}${MARKER_END}`;
41
- }
42
- //# sourceMappingURL=markers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markers.js","sourceRoot":"","sources":["../../src/utils/markers.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAC5C,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,UAAkB;IAElB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,IAAI,QAAQ,KAAK,CAAC,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IAElD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAE5D,OAAO,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,IAAI,QAAQ,KAAK,CAAC,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC;IAErD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAE5D,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,GAAG,YAAY,KAAK,OAAO,GAAG,UAAU,EAAE,CAAC;AACpD,CAAC"}
@@ -1,73 +0,0 @@
1
- import type { ExpertiseRecord } from "../schemas/record.js";
2
- /**
3
- * Represents the outcome of applying a record (pattern, convention, etc.) in practice.
4
- * Outcomes are recorded by agents after applying a record's guidance.
5
- */
6
- export interface Outcome {
7
- status: "success" | "failure" | "partial";
8
- duration_seconds?: number;
9
- test_results?: {
10
- passed: number;
11
- failed: number;
12
- skipped?: number;
13
- };
14
- notes?: string;
15
- recorded_at: string;
16
- }
17
- /**
18
- * An ExpertiseRecord extended with optional outcome history.
19
- * Used for confirmation-frequency scoring.
20
- */
21
- export type ScoredRecord = ExpertiseRecord & {
22
- outcomes?: Outcome[];
23
- };
24
- /**
25
- * Returns the number of successful outcomes for a record.
26
- * Successful outcomes indicate confirmed, working applications of the record.
27
- */
28
- export declare function getSuccessCount(record: ScoredRecord): number;
29
- /**
30
- * Returns the number of failed outcomes for a record.
31
- */
32
- export declare function getFailureCount(record: ScoredRecord): number;
33
- /**
34
- * Returns the total number of recorded outcomes (applications) for a record.
35
- */
36
- export declare function getTotalApplications(record: ScoredRecord): number;
37
- /**
38
- * Returns the success rate (0-1) for a record.
39
- * Partial outcomes are counted as 0.5 (half success).
40
- * Returns 0 for records with no outcomes.
41
- */
42
- export declare function getSuccessRate(record: ScoredRecord): number;
43
- /**
44
- * Computes the confirmation-frequency score for a record.
45
- *
46
- * The score is the count of successful confirmations (applications where
47
- * the record's guidance was applied and the outcome was "success").
48
- * Partial outcomes contribute 0.5 to the score.
49
- *
50
- * Records with no outcomes return 0.
51
- * Records with only failures return 0.
52
- */
53
- export declare function computeConfirmationScore(record: ScoredRecord): number;
54
- /**
55
- * Applies a confirmation-frequency boost to a base score (e.g., a BM25 relevance score).
56
- *
57
- * Records with no outcomes (score = 0) are returned unchanged.
58
- * Records with confirmed applications receive a multiplicative boost proportional
59
- * to their confirmation score.
60
- *
61
- * @param baseScore - The base relevance score (e.g., from BM25)
62
- * @param record - The record to score
63
- * @param boostFactor - Multiplier controlling boost magnitude (default: 0.1)
64
- * @returns The boosted score
65
- */
66
- export declare function applyConfirmationBoost(baseScore: number, record: ScoredRecord, boostFactor?: number): number;
67
- /**
68
- * Sorts records by confirmation-frequency score, highest first.
69
- * Records with equal scores maintain their original relative order (stable sort).
70
- * Records with no outcomes (score = 0) sort to the end.
71
- */
72
- export declare function sortByConfirmationScore<T extends ScoredRecord>(records: T[]): T[];
73
- //# sourceMappingURL=scoring.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scoring.d.ts","sourceRoot":"","sources":["../../src/utils/scoring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;IAC1C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE;QACb,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG;IAC3C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAG5D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAG5D;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAM3D;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CAKrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,YAAY,EACpB,WAAW,SAAM,GAChB,MAAM,CAIR;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,YAAY,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAIjF"}
@@ -1,80 +0,0 @@
1
- /**
2
- * Returns the number of successful outcomes for a record.
3
- * Successful outcomes indicate confirmed, working applications of the record.
4
- */
5
- export function getSuccessCount(record) {
6
- if (!record.outcomes || record.outcomes.length === 0)
7
- return 0;
8
- return record.outcomes.filter((o) => o.status === "success").length;
9
- }
10
- /**
11
- * Returns the number of failed outcomes for a record.
12
- */
13
- export function getFailureCount(record) {
14
- if (!record.outcomes || record.outcomes.length === 0)
15
- return 0;
16
- return record.outcomes.filter((o) => o.status === "failure").length;
17
- }
18
- /**
19
- * Returns the total number of recorded outcomes (applications) for a record.
20
- */
21
- export function getTotalApplications(record) {
22
- return record.outcomes?.length ?? 0;
23
- }
24
- /**
25
- * Returns the success rate (0-1) for a record.
26
- * Partial outcomes are counted as 0.5 (half success).
27
- * Returns 0 for records with no outcomes.
28
- */
29
- export function getSuccessRate(record) {
30
- const total = getTotalApplications(record);
31
- if (total === 0)
32
- return 0;
33
- const partialCount = record.outcomes?.filter((o) => o.status === "partial").length ?? 0;
34
- const successCount = getSuccessCount(record);
35
- return (successCount + partialCount * 0.5) / total;
36
- }
37
- /**
38
- * Computes the confirmation-frequency score for a record.
39
- *
40
- * The score is the count of successful confirmations (applications where
41
- * the record's guidance was applied and the outcome was "success").
42
- * Partial outcomes contribute 0.5 to the score.
43
- *
44
- * Records with no outcomes return 0.
45
- * Records with only failures return 0.
46
- */
47
- export function computeConfirmationScore(record) {
48
- if (!record.outcomes || record.outcomes.length === 0)
49
- return 0;
50
- const successCount = getSuccessCount(record);
51
- const partialCount = record.outcomes.filter((o) => o.status === "partial").length;
52
- return successCount + partialCount * 0.5;
53
- }
54
- /**
55
- * Applies a confirmation-frequency boost to a base score (e.g., a BM25 relevance score).
56
- *
57
- * Records with no outcomes (score = 0) are returned unchanged.
58
- * Records with confirmed applications receive a multiplicative boost proportional
59
- * to their confirmation score.
60
- *
61
- * @param baseScore - The base relevance score (e.g., from BM25)
62
- * @param record - The record to score
63
- * @param boostFactor - Multiplier controlling boost magnitude (default: 0.1)
64
- * @returns The boosted score
65
- */
66
- export function applyConfirmationBoost(baseScore, record, boostFactor = 0.1) {
67
- const confirmationScore = computeConfirmationScore(record);
68
- if (confirmationScore === 0)
69
- return baseScore;
70
- return baseScore * (1 + boostFactor * confirmationScore);
71
- }
72
- /**
73
- * Sorts records by confirmation-frequency score, highest first.
74
- * Records with equal scores maintain their original relative order (stable sort).
75
- * Records with no outcomes (score = 0) sort to the end.
76
- */
77
- export function sortByConfirmationScore(records) {
78
- return [...records].sort((a, b) => computeConfirmationScore(b) - computeConfirmation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C,CAAC;IAC7C,OAAO,CAAC,YAAY,GAAG,YAAY,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC;AACrD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,MAAoB;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC/D,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC;IAClF,OAAO,YAAY,GAAG,YAAY,GAAG,GAAG,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAAiB,EACjB,MAAoB,EACpB,WAAW,GAAG,GAAG;IAEjB,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,iBAAiB,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC9C,OAAO,SAAS,GAAG,CAAC,CAAC,GAAG,WAAW,GAAG,iBAAiB,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAyB,OAAY;IAC1E,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CACtB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAAC,CAAC,CAAC,CACpE,CAAC;AACJ,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Read the current CLI version from package.json.
3
- */
4
- export declare function getCurrentVersion(): string;
5
- /**
6
- * Fetch the latest published version of mulch-cli from npm.
7
- * Returns null if the registry is unreachable.
8
- */
9
- export declare function getLatestVersion(): string | null;
10
- /**
11
- * Compare two semver strings (major.minor.patch).
12
- * Returns -1 if a < b, 0 if equal, 1 if a > b.
13
- */
14
- export declare function compareSemver(a: string, b: string): -1 | 0 | 1;
15
- //# sourceMappingURL=version.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAI1C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAWhD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAW9D"}
@@ -1,48 +0,0 @@
1
- import { execSync } from "node:child_process";
2
- import { readFileSync } from "node:fs";
3
- import { join, dirname } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- const __dirname = dirname(fileURLToPath(import.meta.url));
6
- /**
7
- * Read the current CLI version from package.json.
8
- */
9
- export function getCurrentVersion() {
10
- const pkgPath = join(__dirname, "..", "..", "package.json");
11
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
12
- return pkg.version;
13
- }
14
- /**
15
- * Fetch the latest published version of mulch-cli from npm.
16
- * Returns null if the registry is unreachable.
17
- */
18
- export function getLatestVersion() {
19
- try {
20
- const result = execSync("npm view mulch-cli version", {
21
- encoding: "utf-8",
22
- timeout: 10000,
23
- stdio: ["pipe", "pipe", "pipe"],
24
- });
25
- return result.trim();
26
- }
27
- catch {
28
- return null;
29
- }
30
- }
31
- /**
32
- * Compare two semver strings (major.minor.patch).
33
- * Returns -1 if a < b, 0 if equal, 1 if a > b.
34
- */
35
- export function compareSemver(a, b) {
36
- const partsA = a.split(".").map(Number);
37
- const partsB = b.split(".").map(Number);
38
- for (let i = 0; i < 3; i++) {
39
- const segA = partsA[i] ?? 0;
40
- const segB = partsB[i] ?? 0;
41
- if (segA < segB)
42
- return -1;
43
- if (segA > segB)
44
- return 1;
45
- }
46
- return 0;
47
- }
48
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/utils/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAwB,CAAC;IAC9E,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,4BAA4B,EAAE;YACpD,QAAQ,EAAE,OAAO;YACjB,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,CAAS,EAAE,CAAS;IAChD,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,C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