@design-intelligence/ghost 0.20.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 (269) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -0
  3. package/dist/bin.d.ts +3 -0
  4. package/dist/bin.d.ts.map +1 -0
  5. package/dist/bin.js +19 -0
  6. package/dist/bin.js.map +1 -0
  7. package/dist/cli.d.ts +4 -0
  8. package/dist/cli.d.ts.map +1 -0
  9. package/dist/cli.js +29 -0
  10. package/dist/cli.js.map +1 -0
  11. package/dist/commands/checks-command.d.ts +9 -0
  12. package/dist/commands/checks-command.d.ts.map +1 -0
  13. package/dist/commands/checks-command.js +45 -0
  14. package/dist/commands/checks-command.js.map +1 -0
  15. package/dist/commands/command-discovery.d.ts +57 -0
  16. package/dist/commands/command-discovery.d.ts.map +1 -0
  17. package/dist/commands/command-discovery.js +220 -0
  18. package/dist/commands/command-discovery.js.map +1 -0
  19. package/dist/commands/errors.d.ts +7 -0
  20. package/dist/commands/errors.d.ts.map +1 -0
  21. package/dist/commands/errors.js +19 -0
  22. package/dist/commands/errors.js.map +1 -0
  23. package/dist/commands/export-command.d.ts +3 -0
  24. package/dist/commands/export-command.d.ts.map +1 -0
  25. package/dist/commands/export-command.js +157 -0
  26. package/dist/commands/export-command.js.map +1 -0
  27. package/dist/commands/fingerprint-commands.d.ts +10 -0
  28. package/dist/commands/fingerprint-commands.d.ts.map +1 -0
  29. package/dist/commands/fingerprint-commands.js +74 -0
  30. package/dist/commands/fingerprint-commands.js.map +1 -0
  31. package/dist/commands/gather-command.d.ts +3 -0
  32. package/dist/commands/gather-command.d.ts.map +1 -0
  33. package/dist/commands/gather-command.js +152 -0
  34. package/dist/commands/gather-command.js.map +1 -0
  35. package/dist/commands/init-command.d.ts +3 -0
  36. package/dist/commands/init-command.d.ts.map +1 -0
  37. package/dist/commands/init-command.js +79 -0
  38. package/dist/commands/init-command.js.map +1 -0
  39. package/dist/commands/manifest-command.d.ts +9 -0
  40. package/dist/commands/manifest-command.d.ts.map +1 -0
  41. package/dist/commands/manifest-command.js +33 -0
  42. package/dist/commands/manifest-command.js.map +1 -0
  43. package/dist/commands/pull-command.d.ts +3 -0
  44. package/dist/commands/pull-command.d.ts.map +1 -0
  45. package/dist/commands/pull-command.js +224 -0
  46. package/dist/commands/pull-command.js.map +1 -0
  47. package/dist/commands/pulse-command.d.ts +3 -0
  48. package/dist/commands/pulse-command.d.ts.map +1 -0
  49. package/dist/commands/pulse-command.js +257 -0
  50. package/dist/commands/pulse-command.js.map +1 -0
  51. package/dist/commands/review-command.d.ts +3 -0
  52. package/dist/commands/review-command.d.ts.map +1 -0
  53. package/dist/commands/review-command.js +77 -0
  54. package/dist/commands/review-command.js.map +1 -0
  55. package/dist/commands/skill-command.d.ts +3 -0
  56. package/dist/commands/skill-command.d.ts.map +1 -0
  57. package/dist/commands/skill-command.js +96 -0
  58. package/dist/commands/skill-command.js.map +1 -0
  59. package/dist/fingerprint.d.ts +5 -0
  60. package/dist/fingerprint.d.ts.map +1 -0
  61. package/dist/fingerprint.js +3 -0
  62. package/dist/fingerprint.js.map +1 -0
  63. package/dist/ghost-core/catalog/assemble.d.ts +30 -0
  64. package/dist/ghost-core/catalog/assemble.d.ts.map +1 -0
  65. package/dist/ghost-core/catalog/assemble.js +38 -0
  66. package/dist/ghost-core/catalog/assemble.js.map +1 -0
  67. package/dist/ghost-core/catalog/closest.d.ts +16 -0
  68. package/dist/ghost-core/catalog/closest.d.ts.map +1 -0
  69. package/dist/ghost-core/catalog/closest.js +63 -0
  70. package/dist/ghost-core/catalog/closest.js.map +1 -0
  71. package/dist/ghost-core/catalog/index.d.ts +10 -0
  72. package/dist/ghost-core/catalog/index.d.ts.map +1 -0
  73. package/dist/ghost-core/catalog/index.js +9 -0
  74. package/dist/ghost-core/catalog/index.js.map +1 -0
  75. package/dist/ghost-core/catalog/menu.d.ts +36 -0
  76. package/dist/ghost-core/catalog/menu.d.ts.map +1 -0
  77. package/dist/ghost-core/catalog/menu.js +27 -0
  78. package/dist/ghost-core/catalog/menu.js.map +1 -0
  79. package/dist/ghost-core/catalog/types.d.ts +37 -0
  80. package/dist/ghost-core/catalog/types.d.ts.map +1 -0
  81. package/dist/ghost-core/catalog/types.js +2 -0
  82. package/dist/ghost-core/catalog/types.js.map +1 -0
  83. package/dist/ghost-core/check/index.d.ts +12 -0
  84. package/dist/ghost-core/check/index.d.ts.map +1 -0
  85. package/dist/ghost-core/check/index.js +12 -0
  86. package/dist/ghost-core/check/index.js.map +1 -0
  87. package/dist/ghost-core/check/lint.d.ts +9 -0
  88. package/dist/ghost-core/check/lint.d.ts.map +1 -0
  89. package/dist/ghost-core/check/lint.js +119 -0
  90. package/dist/ghost-core/check/lint.js.map +1 -0
  91. package/dist/ghost-core/check/load.d.ts +7 -0
  92. package/dist/ghost-core/check/load.d.ts.map +1 -0
  93. package/dist/ghost-core/check/load.js +44 -0
  94. package/dist/ghost-core/check/load.js.map +1 -0
  95. package/dist/ghost-core/check/parse.d.ts +12 -0
  96. package/dist/ghost-core/check/parse.d.ts.map +1 -0
  97. package/dist/ghost-core/check/parse.js +13 -0
  98. package/dist/ghost-core/check/parse.js.map +1 -0
  99. package/dist/ghost-core/check/source-ref.d.ts +27 -0
  100. package/dist/ghost-core/check/source-ref.d.ts.map +1 -0
  101. package/dist/ghost-core/check/source-ref.js +58 -0
  102. package/dist/ghost-core/check/source-ref.js.map +1 -0
  103. package/dist/ghost-core/check/types.d.ts +48 -0
  104. package/dist/ghost-core/check/types.d.ts.map +1 -0
  105. package/dist/ghost-core/check/types.js +4 -0
  106. package/dist/ghost-core/check/types.js.map +1 -0
  107. package/dist/ghost-core/errors.d.ts +30 -0
  108. package/dist/ghost-core/errors.d.ts.map +1 -0
  109. package/dist/ghost-core/errors.js +33 -0
  110. package/dist/ghost-core/errors.js.map +1 -0
  111. package/dist/ghost-core/glob.d.ts +5 -0
  112. package/dist/ghost-core/glob.d.ts.map +1 -0
  113. package/dist/ghost-core/glob.js +68 -0
  114. package/dist/ghost-core/glob.js.map +1 -0
  115. package/dist/ghost-core/glossary.d.ts +38 -0
  116. package/dist/ghost-core/glossary.d.ts.map +1 -0
  117. package/dist/ghost-core/glossary.js +76 -0
  118. package/dist/ghost-core/glossary.js.map +1 -0
  119. package/dist/ghost-core/index.d.ts +13 -0
  120. package/dist/ghost-core/index.d.ts.map +1 -0
  121. package/dist/ghost-core/index.js +19 -0
  122. package/dist/ghost-core/index.js.map +1 -0
  123. package/dist/ghost-core/markdown.d.ts +15 -0
  124. package/dist/ghost-core/markdown.d.ts.map +1 -0
  125. package/dist/ghost-core/markdown.js +30 -0
  126. package/dist/ghost-core/markdown.js.map +1 -0
  127. package/dist/ghost-core/material-transport.d.ts +43 -0
  128. package/dist/ghost-core/material-transport.d.ts.map +1 -0
  129. package/dist/ghost-core/material-transport.js +231 -0
  130. package/dist/ghost-core/material-transport.js.map +1 -0
  131. package/dist/ghost-core/materials.d.ts +14 -0
  132. package/dist/ghost-core/materials.d.ts.map +1 -0
  133. package/dist/ghost-core/materials.js +52 -0
  134. package/dist/ghost-core/materials.js.map +1 -0
  135. package/dist/ghost-core/node/index.d.ts +11 -0
  136. package/dist/ghost-core/node/index.d.ts.map +1 -0
  137. package/dist/ghost-core/node/index.js +11 -0
  138. package/dist/ghost-core/node/index.js.map +1 -0
  139. package/dist/ghost-core/node/parse.d.ts +16 -0
  140. package/dist/ghost-core/node/parse.d.ts.map +1 -0
  141. package/dist/ghost-core/node/parse.js +55 -0
  142. package/dist/ghost-core/node/parse.js.map +1 -0
  143. package/dist/ghost-core/node/schema.d.ts +17 -0
  144. package/dist/ghost-core/node/schema.d.ts.map +1 -0
  145. package/dist/ghost-core/node/schema.js +49 -0
  146. package/dist/ghost-core/node/schema.js.map +1 -0
  147. package/dist/ghost-core/node/serialize.d.ts +11 -0
  148. package/dist/ghost-core/node/serialize.d.ts.map +1 -0
  149. package/dist/ghost-core/node/serialize.js +21 -0
  150. package/dist/ghost-core/node/serialize.js.map +1 -0
  151. package/dist/ghost-core/node/steering.d.ts +18 -0
  152. package/dist/ghost-core/node/steering.d.ts.map +1 -0
  153. package/dist/ghost-core/node/steering.js +65 -0
  154. package/dist/ghost-core/node/steering.js.map +1 -0
  155. package/dist/ghost-core/node/types.d.ts +42 -0
  156. package/dist/ghost-core/node/types.d.ts.map +1 -0
  157. package/dist/ghost-core/node/types.js +2 -0
  158. package/dist/ghost-core/node/types.js.map +1 -0
  159. package/dist/ghost-core/package-manifest.d.ts +12 -0
  160. package/dist/ghost-core/package-manifest.d.ts.map +1 -0
  161. package/dist/ghost-core/package-manifest.js +14 -0
  162. package/dist/ghost-core/package-manifest.js.map +1 -0
  163. package/dist/ghost-core/skill-bundle-loader.d.ts +28 -0
  164. package/dist/ghost-core/skill-bundle-loader.d.ts.map +1 -0
  165. package/dist/ghost-core/skill-bundle-loader.js +51 -0
  166. package/dist/ghost-core/skill-bundle-loader.js.map +1 -0
  167. package/dist/index.d.ts +5 -0
  168. package/dist/index.d.ts.map +1 -0
  169. package/dist/index.js +5 -0
  170. package/dist/index.js.map +1 -0
  171. package/dist/internal/fs.d.ts +4 -0
  172. package/dist/internal/fs.d.ts.map +1 -0
  173. package/dist/internal/fs.js +24 -0
  174. package/dist/internal/fs.js.map +1 -0
  175. package/dist/observability-events.d.ts +27 -0
  176. package/dist/observability-events.d.ts.map +1 -0
  177. package/dist/observability-events.js +56 -0
  178. package/dist/observability-events.js.map +1 -0
  179. package/dist/package-version.d.ts +3 -0
  180. package/dist/package-version.d.ts.map +1 -0
  181. package/dist/package-version.js +10 -0
  182. package/dist/package-version.js.map +1 -0
  183. package/dist/review/baseline.d.ts +11 -0
  184. package/dist/review/baseline.d.ts.map +1 -0
  185. package/dist/review/baseline.js +35 -0
  186. package/dist/review/baseline.js.map +1 -0
  187. package/dist/review/diff.d.ts +7 -0
  188. package/dist/review/diff.d.ts.map +1 -0
  189. package/dist/review/diff.js +41 -0
  190. package/dist/review/diff.js.map +1 -0
  191. package/dist/review/glob.d.ts +2 -0
  192. package/dist/review/glob.d.ts.map +1 -0
  193. package/dist/review/glob.js +2 -0
  194. package/dist/review/glob.js.map +1 -0
  195. package/dist/review/probes.d.ts +13 -0
  196. package/dist/review/probes.d.ts.map +1 -0
  197. package/dist/review/probes.js +45 -0
  198. package/dist/review/probes.js.map +1 -0
  199. package/dist/review/resolve.d.ts +29 -0
  200. package/dist/review/resolve.d.ts.map +1 -0
  201. package/dist/review/resolve.js +87 -0
  202. package/dist/review/resolve.js.map +1 -0
  203. package/dist/review/review-packet.d.ts +40 -0
  204. package/dist/review/review-packet.d.ts.map +1 -0
  205. package/dist/review/review-packet.js +139 -0
  206. package/dist/review/review-packet.js.map +1 -0
  207. package/dist/scan/check-files.d.ts +23 -0
  208. package/dist/scan/check-files.d.ts.map +1 -0
  209. package/dist/scan/check-files.js +90 -0
  210. package/dist/scan/check-files.js.map +1 -0
  211. package/dist/scan/check-scaffold.d.ts +7 -0
  212. package/dist/scan/check-scaffold.d.ts.map +1 -0
  213. package/dist/scan/check-scaffold.js +37 -0
  214. package/dist/scan/check-scaffold.js.map +1 -0
  215. package/dist/scan/constants.d.ts +21 -0
  216. package/dist/scan/constants.d.ts.map +1 -0
  217. package/dist/scan/constants.js +21 -0
  218. package/dist/scan/constants.js.map +1 -0
  219. package/dist/scan/file-kind.d.ts +12 -0
  220. package/dist/scan/file-kind.d.ts.map +1 -0
  221. package/dist/scan/file-kind.js +114 -0
  222. package/dist/scan/file-kind.js.map +1 -0
  223. package/dist/scan/fingerprint-package-loader.d.ts +5 -0
  224. package/dist/scan/fingerprint-package-loader.d.ts.map +1 -0
  225. package/dist/scan/fingerprint-package-loader.js +105 -0
  226. package/dist/scan/fingerprint-package-loader.js.map +1 -0
  227. package/dist/scan/fingerprint-package.d.ts +58 -0
  228. package/dist/scan/fingerprint-package.d.ts.map +1 -0
  229. package/dist/scan/fingerprint-package.js +301 -0
  230. package/dist/scan/fingerprint-package.js.map +1 -0
  231. package/dist/scan/index.d.ts +3 -0
  232. package/dist/scan/index.d.ts.map +1 -0
  233. package/dist/scan/index.js +3 -0
  234. package/dist/scan/index.js.map +1 -0
  235. package/dist/scan/lint.d.ts +15 -0
  236. package/dist/scan/lint.d.ts.map +1 -0
  237. package/dist/scan/lint.js +2 -0
  238. package/dist/scan/lint.js.map +1 -0
  239. package/dist/scan/node-files.d.ts +25 -0
  240. package/dist/scan/node-files.d.ts.map +1 -0
  241. package/dist/scan/node-files.js +114 -0
  242. package/dist/scan/node-files.js.map +1 -0
  243. package/dist/scan/package-paths.d.ts +10 -0
  244. package/dist/scan/package-paths.d.ts.map +1 -0
  245. package/dist/scan/package-paths.js +49 -0
  246. package/dist/scan/package-paths.js.map +1 -0
  247. package/dist/scan/steering-template.d.ts +8 -0
  248. package/dist/scan/steering-template.d.ts.map +1 -0
  249. package/dist/scan/steering-template.js +266 -0
  250. package/dist/scan/steering-template.js.map +1 -0
  251. package/dist/scan/tarball.d.ts +23 -0
  252. package/dist/scan/tarball.d.ts.map +1 -0
  253. package/dist/scan/tarball.js +145 -0
  254. package/dist/scan/tarball.js.map +1 -0
  255. package/dist/scan/templates.d.ts +24 -0
  256. package/dist/scan/templates.d.ts.map +1 -0
  257. package/dist/scan/templates.js +295 -0
  258. package/dist/scan/templates.js.map +1 -0
  259. package/dist/skill-bundle/SKILL.md +140 -0
  260. package/dist/skill-bundle/references/authoring-scenarios.md +147 -0
  261. package/dist/skill-bundle/references/blocks.md +180 -0
  262. package/dist/skill-bundle/references/brief.md +49 -0
  263. package/dist/skill-bundle/references/capture.md +377 -0
  264. package/dist/skill-bundle/references/recall.md +38 -0
  265. package/dist/skill-bundle/references/schema.md +119 -0
  266. package/dist/skill-bundle/references/self-check.md +65 -0
  267. package/dist/skill-bundle/references/steering-audit.md +61 -0
  268. package/dist/skill-bundle/references/wild.md +30 -0
  269. package/package.json +79 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Closest-id suggestions for an unknown node/surface name. When an agent names
3
+ * a node that is not in the package, the surface-naming commands
4
+ * (`gather`/`checks`/`review`) emit a "did you mean" hint rather than silently
5
+ * routing to nothing. This is that hint: deterministic, LLM-free, bounded.
6
+ *
7
+ * It is not a search engine. An inexact `gather <query>` shows the node menu
8
+ * and lets the agent re-pick by description; this only nominates the few ids a
9
+ * typo most likely meant.
10
+ */
11
+ /**
12
+ * Suggest the ids closest to `query`, nearest first. Substring matches always
13
+ * rank above pure edit-distance neighbours.
14
+ */
15
+ export function closestIds(query, ids, max = 3) {
16
+ const needle = query.trim().toLowerCase();
17
+ if (needle.length === 0)
18
+ return [];
19
+ const scored = [];
20
+ for (const id of ids) {
21
+ const lower = id.toLowerCase();
22
+ const segment = lower.split("/").pop() ?? lower;
23
+ const distance = Math.min(levenshtein(needle, lower), levenshtein(needle, segment));
24
+ const substring = lower.includes(needle) || needle.includes(lower);
25
+ if (substring) {
26
+ scored.push({ id, rank: 0, distance });
27
+ }
28
+ else if (distance <= fuzzyThreshold(needle)) {
29
+ scored.push({ id, rank: 1, distance });
30
+ }
31
+ }
32
+ scored.sort((a, b) => a.rank - b.rank || a.distance - b.distance || a.id.localeCompare(b.id));
33
+ return scored.slice(0, Math.max(0, max)).map((entry) => entry.id);
34
+ }
35
+ /** A length-proportional edit-distance threshold for typo tolerance. */
36
+ function fuzzyThreshold(needle) {
37
+ if (needle.length <= 4)
38
+ return 1;
39
+ if (needle.length <= 8)
40
+ return 2;
41
+ return 3;
42
+ }
43
+ /** Classic iterative Levenshtein distance. Dependency-free, O(n*m). */
44
+ function levenshtein(a, b) {
45
+ if (a === b)
46
+ return 0;
47
+ if (a.length === 0)
48
+ return b.length;
49
+ if (b.length === 0)
50
+ return a.length;
51
+ let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
52
+ let curr = new Array(b.length + 1);
53
+ for (let i = 1; i <= a.length; i++) {
54
+ curr[0] = i;
55
+ for (let j = 1; j <= b.length; j++) {
56
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
57
+ curr[j] = Math.min((prev[j] ?? 0) + 1, (curr[j - 1] ?? 0) + 1, (prev[j - 1] ?? 0) + cost);
58
+ }
59
+ [prev, curr] = [curr, prev];
60
+ }
61
+ return prev[b.length] ?? 0;
62
+ }
63
+ //# sourceMappingURL=closest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closest.js","sourceRoot":"","sources":["../../../src/ghost-core/catalog/closest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,KAAa,EACb,GAAqB,EACrB,GAAG,GAAG,CAAC;IAEP,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEnC,MAAM,MAAM,GAAqD,EAAE,CAAC;IACpE,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,KAAK,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CACvB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EAC1B,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAC7B,CAAC;QACF,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACnE,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QACzC,CAAC;aAAM,IAAI,QAAQ,IAAI,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9C,MAAM,CAAC,IAAI,CAAC,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G,CAAC,CAAC,CAAC;IAE3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAChB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAClB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EACtB,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAC1B,CAAC;QACJ,CAAC;QACD,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Public surface for the in-memory fingerprint catalog — a flat map of prose
3
+ * nodes assembled from the package's markdown files. No edges, no cascade, no
4
+ * traversal: the agent selects from the menu (`gather`).
5
+ */
6
+ export { type AssembleCatalogInput, assembleCatalog, type PlacedNode, } from "./assemble.js";
7
+ export { closestIds } from "./closest.js";
8
+ export { type BuildCatalogMenuOptions, buildCatalogMenu, type CatalogMenuEntry, } from "./menu.js";
9
+ export type { GhostCatalog, GhostCatalogNode } from "./types.js";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/catalog/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,oBAAoB,EACzB,eAAe,EACf,KAAK,UAAU,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,KAAK,uBAAuB,EAC5B,gBAAgB,EAChB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Public surface for the in-memory fingerprint catalog — a flat map of prose
3
+ * nodes assembled from the package's markdown files. No edges, no cascade, no
4
+ * traversal: the agent selects from the menu (`gather`).
5
+ */
6
+ export { assembleCatalog, } from "./assemble.js";
7
+ export { closestIds } from "./closest.js";
8
+ export { buildCatalogMenu, } from "./menu.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ghost-core/catalog/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAEL,eAAe,GAEhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAEL,gBAAgB,GAEjB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { GhostCatalog } from "./types.js";
2
+ export interface BuildCatalogMenuOptions {
3
+ /** Include kinds that declare `posture: wild`; default menus omit them. */
4
+ includeWild?: boolean;
5
+ }
6
+ /**
7
+ * One entry in the gather menu: a node presented as `id` + `kind` +
8
+ * `description` — the retrieval payload the agent selects against. The agent
9
+ * matches a natural-language ask against these and reads what it judges
10
+ * relevant; Ghost does no NLP and no selection.
11
+ */
12
+ export interface CatalogMenuEntry {
13
+ id: string;
14
+ /** The node's kind (filename prefix), when it declares one. */
15
+ kind?: string;
16
+ description?: string;
17
+ /** Count of material locators available after pulling this node. */
18
+ materials?: number;
19
+ /** True when this entry carries concrete material by derived structure. */
20
+ concrete: boolean;
21
+ /** True when this entry includes a Skeleton section. */
22
+ hasSkeleton?: true;
23
+ /** Consumption posture for this menu entry. */
24
+ posture: "steady" | "wild" | "guard";
25
+ /** True when this entry pushes past the fingerprint rather than conforming to it. */
26
+ wild?: true;
27
+ /** True when this entry is review-critical guard posture. */
28
+ guard?: true;
29
+ }
30
+ /**
31
+ * Build the gather menu: every authored node, with its kind and description,
32
+ * sorted by id for stable output. A flat catalog — no anchor, no hierarchy;
33
+ * the agent selects from it.
34
+ */
35
+ export declare function buildCatalogMenu(catalog: GhostCatalog, options?: BuildCatalogMenuOptions): CatalogMenuEntry[];
36
+ //# sourceMappingURL=menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/catalog/menu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,uBAAuB;IACtC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,+DAA+D;IAC/D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,+CAA+C;IAC/C,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACrC,qFAAqF;IACrF,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,6DAA6D;IAC7D,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,EAAE,CAqBpB"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Build the gather menu: every authored node, with its kind and description,
3
+ * sorted by id for stable output. A flat catalog — no anchor, no hierarchy;
4
+ * the agent selects from it.
5
+ */
6
+ export function buildCatalogMenu(catalog, options = {}) {
7
+ const entries = [];
8
+ for (const node of catalog.nodes.values()) {
9
+ if (node.wild && !options.includeWild)
10
+ continue;
11
+ entries.push({
12
+ id: node.id,
13
+ ...(node.kind !== undefined ? { kind: node.kind } : {}),
14
+ ...(node.description ? { description: node.description } : {}),
15
+ ...(node.materials !== undefined && node.materials.length > 0
16
+ ? { materials: node.materials.length }
17
+ : {}),
18
+ concrete: node.concrete,
19
+ ...(node.hasSkeleton ? { hasSkeleton: true } : {}),
20
+ posture: node.posture,
21
+ ...(node.wild ? { wild: true } : {}),
22
+ ...(node.guard ? { guard: true } : {}),
23
+ });
24
+ }
25
+ return entries.sort((a, b) => a.id.localeCompare(b.id));
26
+ }
27
+ //# sourceMappingURL=menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../src/ghost-core/catalog/menu.ts"],"names":[],"mappings":"AAgCA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAqB,EACrB,UAAmC,EAAE;IAErC,MAAM,OAAO,GAAuB,EAAE,CAAC;IAEvC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QAC1C,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW;YAAE,SAAS;QAChD,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,GAAG,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;gBAC3D,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;gBACtC,CAAC,CAAC,EAAE,CAAC;YACP,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAChD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * A node in the fingerprint catalog — pure prose plus its filename-derived
3
+ * identity. The body is the design expression; there are no structured content
4
+ * fields. Kind comes from the filename prefix; there is no traversal or
5
+ * containment model — the catalog is a flat map the agent selects from.
6
+ */
7
+ export interface GhostCatalogNode {
8
+ id: string;
9
+ /** Optional filename prefix before the first dot (`principle.density`). */
10
+ kind?: string;
11
+ /** Filename slug: bare name, or the part after the first dot. */
12
+ slug: string;
13
+ /** One-line "what this is / when to gather it" — the retrieval payload. */
14
+ description?: string;
15
+ /** Optional material locators carried by the authored node. */
16
+ materials?: string[];
17
+ /** True when the node carries materials, a substantial fence, or a Skeleton. */
18
+ concrete: boolean;
19
+ /** True when the node declares a `## Skeleton` section. */
20
+ hasSkeleton: boolean;
21
+ /** Consumption posture derived from the node's glossary kind. */
22
+ posture: "steady" | "wild" | "guard";
23
+ /** True when the node's declared kind has `posture: wild` in the glossary. */
24
+ wild?: true;
25
+ /** True when the node's declared kind has `posture: guard` in the glossary. */
26
+ guard?: true;
27
+ body: string;
28
+ }
29
+ /**
30
+ * The in-memory fingerprint catalog: prose nodes indexed by id. A flat map —
31
+ * no edges, no cascade, no traversal. Identity comes from each file's path.
32
+ */
33
+ export interface GhostCatalog {
34
+ /** Every node, indexed by id. */
35
+ nodes: Map<string, GhostCatalogNode>;
36
+ }
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/catalog/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,gFAAgF;IAChF,QAAQ,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,WAAW,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,OAAO,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACrC,8EAA8E;IAC9E,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,+EAA+E;IAC/E,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACtC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ghost-core/catalog/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Public surface for `ghost.check/v1` — markdown + frontmatter checks an agent
3
+ * evaluates (Ghost never runs them). Every check is offered to the reviewer;
4
+ * the agent judges relevance against the diff and the grounded prose. A check's
5
+ * optional `source:` names the fingerprint prose it enforces.
6
+ */
7
+ export { lintGhostCheck } from "./lint.js";
8
+ export { loadGhostCheck } from "./load.js";
9
+ export { type ParsedCheckMarkdown, parseCheckMarkdown } from "./parse.js";
10
+ export { type ParsedSourceRef, parseSourceRef, sliceNodeSection, } from "./source-ref.js";
11
+ export { GHOST_CHECK_SCHEMA, GHOST_CHECK_SEVERITIES, type GhostCheckDocument, type GhostCheckFrontmatter, type GhostCheckLintIssue, type GhostCheckLintReport, type GhostCheckLintSeverity, type GhostCheckMarkdownSeverity, } from "./types.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/check/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,KAAK,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,KAAK,eAAe,EACpB,cAAc,EACd,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,GAChC,MAAM,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Public surface for `ghost.check/v1` — markdown + frontmatter checks an agent
3
+ * evaluates (Ghost never runs them). Every check is offered to the reviewer;
4
+ * the agent judges relevance against the diff and the grounded prose. A check's
5
+ * optional `source:` names the fingerprint prose it enforces.
6
+ */
7
+ export { lintGhostCheck } from "./lint.js";
8
+ export { loadGhostCheck } from "./load.js";
9
+ export { parseCheckMarkdown } from "./parse.js";
10
+ export { parseSourceRef, sliceNodeSection, } from "./source-ref.js";
11
+ export { GHOST_CHECK_SCHEMA, GHOST_CHECK_SEVERITIES, } from "./types.js";
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ghost-core/check/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAA4B,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAEL,cAAc,EACd,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GAOvB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type GhostCheckLintReport } from "./types.js";
2
+ /**
3
+ * Lint a Ghost check markdown file (`ghost.check/v1`): required frontmatter
4
+ * (`name`, `description`, `severity`), an optional `source:` provenance pointer,
5
+ * and a non-empty body. Ghost never executes the check — this only validates
6
+ * that it is well-formed.
7
+ */
8
+ export declare function lintGhostCheck(raw: string): GhostCheckLintReport;
9
+ //# sourceMappingURL=lint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/check/lint.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,CAwGhE"}
@@ -0,0 +1,119 @@
1
+ import { parseCheckMarkdown } from "./parse.js";
2
+ import { parseSourceRef } from "./source-ref.js";
3
+ import { GHOST_CHECK_SEVERITIES, } from "./types.js";
4
+ /**
5
+ * Lint a Ghost check markdown file (`ghost.check/v1`): required frontmatter
6
+ * (`name`, `description`, `severity`), an optional `source:` provenance pointer,
7
+ * and a non-empty body. Ghost never executes the check — this only validates
8
+ * that it is well-formed.
9
+ */
10
+ export function lintGhostCheck(raw) {
11
+ const issues = [];
12
+ const { frontmatter, body } = parseCheckMarkdown(raw);
13
+ if (frontmatter === null) {
14
+ issues.push({
15
+ severity: "error",
16
+ rule: "check-frontmatter-missing",
17
+ message: "check must begin with a YAML frontmatter block delimited by `---` lines",
18
+ path: "<frontmatter>",
19
+ });
20
+ return finalize(issues);
21
+ }
22
+ requireString(frontmatter, "name", issues);
23
+ requireString(frontmatter, "description", issues);
24
+ const severity = frontmatter.severity;
25
+ if (severity === undefined) {
26
+ issues.push({
27
+ severity: "error",
28
+ rule: "check-severity-missing",
29
+ message: "frontmatter must declare a severity",
30
+ path: "severity",
31
+ });
32
+ }
33
+ else if (typeof severity !== "string" ||
34
+ !GHOST_CHECK_SEVERITIES.includes(severity)) {
35
+ issues.push({
36
+ severity: "error",
37
+ rule: "check-severity-invalid",
38
+ message: `severity must be one of: ${GHOST_CHECK_SEVERITIES.join(", ")}`,
39
+ path: "severity",
40
+ });
41
+ }
42
+ const references = frontmatter.references;
43
+ if (references !== undefined) {
44
+ if (!Array.isArray(references)) {
45
+ issues.push({
46
+ severity: "error",
47
+ rule: "check-references-invalid",
48
+ message: "references must be an array of node refs",
49
+ path: "references",
50
+ });
51
+ }
52
+ else {
53
+ references.forEach((reference, index) => {
54
+ if (typeof reference !== "string" ||
55
+ parseSourceRef(reference) === null) {
56
+ issues.push({
57
+ severity: "warning",
58
+ rule: "check-reference-malformed",
59
+ message: "references entries should be node path ids with optional `> Heading` anchors (e.g. 'checkout/payment > Confirmation')",
60
+ path: `references[${index}]`,
61
+ });
62
+ }
63
+ });
64
+ }
65
+ }
66
+ const probe = frontmatter.probe;
67
+ if (probe !== undefined &&
68
+ (typeof probe !== "string" || probe.trim() === "")) {
69
+ issues.push({
70
+ severity: "error",
71
+ rule: "check-probe-invalid",
72
+ message: "probe must be a non-empty shell command string",
73
+ path: "probe",
74
+ });
75
+ }
76
+ const source = frontmatter.source;
77
+ if (source !== undefined) {
78
+ // `source:` is a deprecated soft provenance pointer: `<node-id>` with an
79
+ // optional `> <heading>` anchor. Keep linting it so older standalone check
80
+ // files still get useful feedback.
81
+ if (typeof source !== "string" || parseSourceRef(source) === null) {
82
+ issues.push({
83
+ severity: "warning",
84
+ rule: "check-source-malformed",
85
+ message: "source should be a node path id with an optional `> Heading` anchor (e.g. 'checkout/payment > Confirmation')",
86
+ path: "source",
87
+ });
88
+ }
89
+ }
90
+ if (body.trim().length === 0) {
91
+ issues.push({
92
+ severity: "error",
93
+ rule: "check-body-empty",
94
+ message: "check body must contain instructions for the evaluating agent",
95
+ path: "<body>",
96
+ });
97
+ }
98
+ return finalize(issues);
99
+ }
100
+ function requireString(frontmatter, key, issues) {
101
+ const value = frontmatter[key];
102
+ if (typeof value !== "string" || value.trim().length === 0) {
103
+ issues.push({
104
+ severity: "error",
105
+ rule: `check-${key}-missing`,
106
+ message: `frontmatter must declare a non-empty ${key}`,
107
+ path: key,
108
+ });
109
+ }
110
+ }
111
+ function finalize(issues) {
112
+ return {
113
+ issues,
114
+ errors: issues.filter((issue) => issue.severity === "error").length,
115
+ warnings: issues.filter((issue) => issue.severity === "warning").length,
116
+ info: issues.filter((issue) => issue.severity === "info").length,
117
+ };
118
+ }
119
+ //# sourceMappingURL=lint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../../src/ghost-core/check/lint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,sBAAsB,GAGvB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAEtD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC;YACV,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,2BAA2B;YACjC,OAAO,EACL,yEAAyE;YAC3E,IAAI,EAAE,eAAe;SACtB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3C,aAAa,CAAC,WAAW,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAElD,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IACtC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,CAAC,IAAI,CAAC;YACV,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,wBAAwB;YAC9B,OAAO,EAAE,qCAAqC;YAC9C,IAAI,EAAE,UAAU;SACjB,CAAC,CAAC;IACL,CAAC;SAAM,IACL,OAAO,QAAQ,KAAK,QAAQ;QAC5B,CAAC,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MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,MAAM;QACnE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,MAAM;QACvE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,MAAM;KACjE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { GhostCheckDocument } from "./types.js";
2
+ /**
3
+ * Parse a well-formed Ghost check into a typed document. Assumes the input has
4
+ * already passed `lintGhostCheck` (throws on missing required frontmatter).
5
+ */
6
+ export declare function loadGhostCheck(raw: string): GhostCheckDocument;
7
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/check/load.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,CA+C9D"}
@@ -0,0 +1,44 @@
1
+ import { parseCheckMarkdown } from "./parse.js";
2
+ /**
3
+ * Parse a well-formed Ghost check into a typed document. Assumes the input has
4
+ * already passed `lintGhostCheck` (throws on missing required frontmatter).
5
+ */
6
+ export function loadGhostCheck(raw) {
7
+ const { frontmatter, body } = parseCheckMarkdown(raw);
8
+ if (frontmatter === null) {
9
+ throw new Error("Ghost check is missing a YAML frontmatter block.");
10
+ }
11
+ const name = frontmatter.name;
12
+ const description = frontmatter.description;
13
+ const severity = frontmatter.severity;
14
+ if (typeof name !== "string" || typeof description !== "string") {
15
+ throw new Error("Ghost check frontmatter is missing name or description.");
16
+ }
17
+ const tools = Array.isArray(frontmatter.tools)
18
+ ? frontmatter.tools.filter((tool) => typeof tool === "string")
19
+ : undefined;
20
+ const turnLimit = typeof frontmatter["turn-limit"] === "number"
21
+ ? frontmatter["turn-limit"]
22
+ : typeof frontmatter.turn_limit === "number"
23
+ ? frontmatter.turn_limit
24
+ : undefined;
25
+ const references = Array.isArray(frontmatter.references)
26
+ ? frontmatter.references.filter((reference) => typeof reference === "string")
27
+ : undefined;
28
+ const source = typeof frontmatter.source === "string" ? frontmatter.source : undefined;
29
+ const probe = typeof frontmatter.probe === "string" ? frontmatter.probe : undefined;
30
+ return {
31
+ frontmatter: {
32
+ name,
33
+ description,
34
+ severity: severity,
35
+ ...(tools ? { tools } : {}),
36
+ ...(turnLimit !== undefined ? { turn_limit: turnLimit } : {}),
37
+ ...(references ? { references } : {}),
38
+ ...(source ? { source } : {}),
39
+ ...(probe ? { probe } : {}),
40
+ },
41
+ body,
42
+ };
43
+ }
44
+ //# sourceMappingURL=load.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.js","sourceRoot":"","sources":["../../../src/ghost-core/check/load.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAMhD;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACtD,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC;IAC9B,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC;IAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IACtC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QAChE,MAA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C,CAAC,CAAC,EAAE,CAAC;YAC7D,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7B,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5B;QACD,IAAI;KACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type ParsedMarkdown } from "../markdown.js";
2
+ export type ParsedCheckMarkdown = ParsedMarkdown;
3
+ /**
4
+ * Split a markdown check into its YAML frontmatter and body. A check file is
5
+ * `---\n<yaml>\n---\n<body>`. Returns `frontmatter: null` when there is no
6
+ * leading frontmatter block (the caller's lint reports it as an error).
7
+ *
8
+ * Thin alias over the shared {@link splitMarkdownFrontmatter}; checks and nodes
9
+ * share one envelope splitter.
10
+ */
11
+ export declare function parseCheckMarkdown(raw: string): ParsedCheckMarkdown;
12
+ //# sourceMappingURL=parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/check/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA4B,MAAM,gBAAgB,CAAC;AAE/E,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAEnE"}
@@ -0,0 +1,13 @@
1
+ import { splitMarkdownFrontmatter } from "../markdown.js";
2
+ /**
3
+ * Split a markdown check into its YAML frontmatter and body. A check file is
4
+ * `---\n<yaml>\n---\n<body>`. Returns `frontmatter: null` when there is no
5
+ * leading frontmatter block (the caller's lint reports it as an error).
6
+ *
7
+ * Thin alias over the shared {@link splitMarkdownFrontmatter}; checks and nodes
8
+ * share one envelope splitter.
9
+ */
10
+ export function parseCheckMarkdown(raw) {
11
+ return splitMarkdownFrontmatter(raw);
12
+ }
13
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/ghost-core/check/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAI/E;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAW;IAC5C,OAAO,wBAAwB,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A parsed `source:` reference: the node path id it points at, plus the
3
+ * optional heading anchor (`checkout/payment > Confirmation` → nodeId
4
+ * `checkout/payment`, heading `Confirmation`).
5
+ */
6
+ export interface ParsedSourceRef {
7
+ nodeId: string;
8
+ heading?: string;
9
+ }
10
+ /**
11
+ * Parse the check `source:` reference grammar — `<node-id> > <Heading>`.
12
+ * Splits on the *first* `>` and trims both parts. Returns `null` when the
13
+ * node-id part is not a valid node path id (or the input is empty); the
14
+ * heading is present only when a non-empty anchor follows the `>`. This is
15
+ * shape validation only — whether the node (or heading) exists is the
16
+ * caller's concern: an unresolved ref may name not-yet-written prose.
17
+ */
18
+ export declare function parseSourceRef(raw: string): ParsedSourceRef | null;
19
+ /**
20
+ * Slice the section a heading anchor points at out of a node body. Matches the
21
+ * first markdown heading line (any level) whose text equals `heading`
22
+ * case-insensitively, then returns everything up to the next heading of the
23
+ * same or higher level (or end of body), trimmed. Returns `null` when no
24
+ * heading matches.
25
+ */
26
+ export declare function sliceNodeSection(body: string, heading: string): string | null;
27
+ //# sourceMappingURL=source-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-ref.d.ts","sourceRoot":"","sources":["../../../src/ghost-core/check/source-ref.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAUlE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgC7E"}
@@ -0,0 +1,58 @@
1
+ import { NodeIdSchema } from "../node/schema.js";
2
+ /**
3
+ * Parse the check `source:` reference grammar — `<node-id> > <Heading>`.
4
+ * Splits on the *first* `>` and trims both parts. Returns `null` when the
5
+ * node-id part is not a valid node path id (or the input is empty); the
6
+ * heading is present only when a non-empty anchor follows the `>`. This is
7
+ * shape validation only — whether the node (or heading) exists is the
8
+ * caller's concern: an unresolved ref may name not-yet-written prose.
9
+ */
10
+ export function parseSourceRef(raw) {
11
+ const splitAt = raw.indexOf(">");
12
+ const nodePart = (splitAt === -1 ? raw : raw.slice(0, splitAt)).trim();
13
+ if (!NodeIdSchema.safeParse(nodePart).success) {
14
+ return null;
15
+ }
16
+ const heading = splitAt === -1 ? "" : raw.slice(splitAt + 1).trim();
17
+ return heading.length > 0
18
+ ? { nodeId: nodePart, heading }
19
+ : { nodeId: nodePart };
20
+ }
21
+ /**
22
+ * Slice the section a heading anchor points at out of a node body. Matches the
23
+ * first markdown heading line (any level) whose text equals `heading`
24
+ * case-insensitively, then returns everything up to the next heading of the
25
+ * same or higher level (or end of body), trimmed. Returns `null` when no
26
+ * heading matches.
27
+ */
28
+ export function sliceNodeSection(body, heading) {
29
+ const wanted = heading.trim().toLowerCase();
30
+ const lines = body.split("\n");
31
+ const headingPattern = /^(#{1,6})\s+(.*)$/;
32
+ let startLine = -1;
33
+ let level = 0;
34
+ for (let i = 0; i < lines.length; i += 1) {
35
+ const match = headingPattern.exec(lines[i]);
36
+ if (match && match[2].trim().toLowerCase() === wanted) {
37
+ startLine = i;
38
+ level = match[1].length;
39
+ break;
40
+ }
41
+ }
42
+ if (startLine === -1) {
43
+ return null;
44
+ }
45
+ let endLine = lines.length;
46
+ for (let i = startLine + 1; i < lines.length; i += 1) {
47
+ const match = headingPattern.exec(lines[i]);
48
+ if (match && match[1].length <= level) {
49
+ endLine = i;
50
+ break;
51
+ }
52
+ }
53
+ return lines
54
+ .slice(startLine + 1, endLine)
55
+ .join("\n")
56
+ .trim();
57
+ }
58
+ //# sourceMappingURL=source-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-ref.js","sourceRoot":"","sources":["../../../src/ghost-core/check/source-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAYjD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvE,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACpE,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC;QACvB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;QAC/B,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,MAAM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