open-wiki-spec 0.1.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 (487) hide show
  1. package/README.md +294 -0
  2. package/bin/open-wiki-spec.js +2 -0
  3. package/dist/cli/commands/apply.d.ts +3 -0
  4. package/dist/cli/commands/apply.d.ts.map +1 -0
  5. package/dist/cli/commands/apply.js +60 -0
  6. package/dist/cli/commands/apply.js.map +1 -0
  7. package/dist/cli/commands/archive.d.ts +20 -0
  8. package/dist/cli/commands/archive.d.ts.map +1 -0
  9. package/dist/cli/commands/archive.js +87 -0
  10. package/dist/cli/commands/archive.js.map +1 -0
  11. package/dist/cli/commands/continue.d.ts +6 -0
  12. package/dist/cli/commands/continue.d.ts.map +1 -0
  13. package/dist/cli/commands/continue.js +35 -0
  14. package/dist/cli/commands/continue.js.map +1 -0
  15. package/dist/cli/commands/formatters.d.ts +9 -0
  16. package/dist/cli/commands/formatters.d.ts.map +1 -0
  17. package/dist/cli/commands/formatters.js +55 -0
  18. package/dist/cli/commands/formatters.js.map +1 -0
  19. package/dist/cli/commands/init.d.ts +6 -0
  20. package/dist/cli/commands/init.d.ts.map +1 -0
  21. package/dist/cli/commands/init.js +36 -0
  22. package/dist/cli/commands/init.js.map +1 -0
  23. package/dist/cli/commands/list.d.ts +28 -0
  24. package/dist/cli/commands/list.d.ts.map +1 -0
  25. package/dist/cli/commands/list.js +85 -0
  26. package/dist/cli/commands/list.js.map +1 -0
  27. package/dist/cli/commands/migrate.d.ts +6 -0
  28. package/dist/cli/commands/migrate.d.ts.map +1 -0
  29. package/dist/cli/commands/migrate.js +103 -0
  30. package/dist/cli/commands/migrate.js.map +1 -0
  31. package/dist/cli/commands/propose.d.ts +3 -0
  32. package/dist/cli/commands/propose.d.ts.map +1 -0
  33. package/dist/cli/commands/propose.js +64 -0
  34. package/dist/cli/commands/propose.js.map +1 -0
  35. package/dist/cli/commands/query.d.ts +3 -0
  36. package/dist/cli/commands/query.d.ts.map +1 -0
  37. package/dist/cli/commands/query.js +62 -0
  38. package/dist/cli/commands/query.js.map +1 -0
  39. package/dist/cli/commands/status.d.ts +30 -0
  40. package/dist/cli/commands/status.d.ts.map +1 -0
  41. package/dist/cli/commands/status.js +144 -0
  42. package/dist/cli/commands/status.js.map +1 -0
  43. package/dist/cli/commands/verify.d.ts +3 -0
  44. package/dist/cli/commands/verify.d.ts.map +1 -0
  45. package/dist/cli/commands/verify.js +38 -0
  46. package/dist/cli/commands/verify.js.map +1 -0
  47. package/dist/cli/index.d.ts +6 -0
  48. package/dist/cli/index.d.ts.map +1 -0
  49. package/dist/cli/index.js +40 -0
  50. package/dist/cli/index.js.map +1 -0
  51. package/dist/cli/init/init-engine.d.ts +6 -0
  52. package/dist/cli/init/init-engine.d.ts.map +1 -0
  53. package/dist/cli/init/init-engine.js +107 -0
  54. package/dist/cli/init/init-engine.js.map +1 -0
  55. package/dist/cli/init/meta-files.d.ts +9 -0
  56. package/dist/cli/init/meta-files.d.ts.map +1 -0
  57. package/dist/cli/init/meta-files.js +156 -0
  58. package/dist/cli/init/meta-files.js.map +1 -0
  59. package/dist/cli/init/skill-generator.d.ts +11 -0
  60. package/dist/cli/init/skill-generator.d.ts.map +1 -0
  61. package/dist/cli/init/skill-generator.js +753 -0
  62. package/dist/cli/init/skill-generator.js.map +1 -0
  63. package/dist/cli/init/types.d.ts +27 -0
  64. package/dist/cli/init/types.d.ts.map +1 -0
  65. package/dist/cli/init/types.js +5 -0
  66. package/dist/cli/init/types.js.map +1 -0
  67. package/dist/cli/vault-discovery.d.ts +9 -0
  68. package/dist/cli/vault-discovery.d.ts.map +1 -0
  69. package/dist/cli/vault-discovery.js +31 -0
  70. package/dist/cli/vault-discovery.js.map +1 -0
  71. package/dist/core/config/index.d.ts +2 -0
  72. package/dist/core/config/index.d.ts.map +1 -0
  73. package/dist/core/config/index.js +3 -0
  74. package/dist/core/config/index.js.map +1 -0
  75. package/dist/core/index/build.d.ts +10 -0
  76. package/dist/core/index/build.d.ts.map +1 -0
  77. package/dist/core/index/build.js +190 -0
  78. package/dist/core/index/build.js.map +1 -0
  79. package/dist/core/index/index.d.ts +7 -0
  80. package/dist/core/index/index.d.ts.map +1 -0
  81. package/dist/core/index/index.js +7 -0
  82. package/dist/core/index/index.js.map +1 -0
  83. package/dist/core/index/resolve.d.ts +41 -0
  84. package/dist/core/index/resolve.d.ts.map +1 -0
  85. package/dist/core/index/resolve.js +63 -0
  86. package/dist/core/index/resolve.js.map +1 -0
  87. package/dist/core/index/reverse.d.ts +7 -0
  88. package/dist/core/index/reverse.d.ts.map +1 -0
  89. package/dist/core/index/reverse.js +24 -0
  90. package/dist/core/index/reverse.js.map +1 -0
  91. package/dist/core/index/scan.d.ts +16 -0
  92. package/dist/core/index/scan.d.ts.map +1 -0
  93. package/dist/core/index/scan.js +19 -0
  94. package/dist/core/index/scan.js.map +1 -0
  95. package/dist/core/index/schema-version.d.ts +5 -0
  96. package/dist/core/index/schema-version.d.ts.map +1 -0
  97. package/dist/core/index/schema-version.js +19 -0
  98. package/dist/core/index/schema-version.js.map +1 -0
  99. package/dist/core/index/validate.d.ts +14 -0
  100. package/dist/core/index/validate.d.ts.map +1 -0
  101. package/dist/core/index/validate.js +77 -0
  102. package/dist/core/index/validate.js.map +1 -0
  103. package/dist/core/migrate/change-converter.d.ts +18 -0
  104. package/dist/core/migrate/change-converter.d.ts.map +1 -0
  105. package/dist/core/migrate/change-converter.js +475 -0
  106. package/dist/core/migrate/change-converter.js.map +1 -0
  107. package/dist/core/migrate/index.d.ts +8 -0
  108. package/dist/core/migrate/index.d.ts.map +1 -0
  109. package/dist/core/migrate/index.js +7 -0
  110. package/dist/core/migrate/index.js.map +1 -0
  111. package/dist/core/migrate/migrate.d.ts +15 -0
  112. package/dist/core/migrate/migrate.d.ts.map +1 -0
  113. package/dist/core/migrate/migrate.js +149 -0
  114. package/dist/core/migrate/migrate.js.map +1 -0
  115. package/dist/core/migrate/scanner.d.ts +10 -0
  116. package/dist/core/migrate/scanner.d.ts.map +1 -0
  117. package/dist/core/migrate/scanner.js +188 -0
  118. package/dist/core/migrate/scanner.js.map +1 -0
  119. package/dist/core/migrate/source-converter.d.ts +6 -0
  120. package/dist/core/migrate/source-converter.d.ts.map +1 -0
  121. package/dist/core/migrate/source-converter.js +63 -0
  122. package/dist/core/migrate/source-converter.js.map +1 -0
  123. package/dist/core/migrate/spec-converter.d.ts +16 -0
  124. package/dist/core/migrate/spec-converter.d.ts.map +1 -0
  125. package/dist/core/migrate/spec-converter.js +157 -0
  126. package/dist/core/migrate/spec-converter.js.map +1 -0
  127. package/dist/core/migrate/system-inferrer.d.ts +23 -0
  128. package/dist/core/migrate/system-inferrer.d.ts.map +1 -0
  129. package/dist/core/migrate/system-inferrer.js +118 -0
  130. package/dist/core/migrate/system-inferrer.js.map +1 -0
  131. package/dist/core/migrate/types.d.ts +125 -0
  132. package/dist/core/migrate/types.d.ts.map +1 -0
  133. package/dist/core/migrate/types.js +5 -0
  134. package/dist/core/migrate/types.js.map +1 -0
  135. package/dist/core/parser/delta-summary-parser.d.ts +10 -0
  136. package/dist/core/parser/delta-summary-parser.d.ts.map +1 -0
  137. package/dist/core/parser/delta-summary-parser.js +101 -0
  138. package/dist/core/parser/delta-summary-parser.js.map +1 -0
  139. package/dist/core/parser/frontmatter-parser.d.ts +21 -0
  140. package/dist/core/parser/frontmatter-parser.d.ts.map +1 -0
  141. package/dist/core/parser/frontmatter-parser.js +87 -0
  142. package/dist/core/parser/frontmatter-parser.js.map +1 -0
  143. package/dist/core/parser/index.d.ts +9 -0
  144. package/dist/core/parser/index.d.ts.map +1 -0
  145. package/dist/core/parser/index.js +8 -0
  146. package/dist/core/parser/index.js.map +1 -0
  147. package/dist/core/parser/note-parser.d.ts +9 -0
  148. package/dist/core/parser/note-parser.d.ts.map +1 -0
  149. package/dist/core/parser/note-parser.js +106 -0
  150. package/dist/core/parser/note-parser.js.map +1 -0
  151. package/dist/core/parser/requirement-parser.d.ts +13 -0
  152. package/dist/core/parser/requirement-parser.d.ts.map +1 -0
  153. package/dist/core/parser/requirement-parser.js +127 -0
  154. package/dist/core/parser/requirement-parser.js.map +1 -0
  155. package/dist/core/parser/section-parser.d.ts +15 -0
  156. package/dist/core/parser/section-parser.d.ts.map +1 -0
  157. package/dist/core/parser/section-parser.js +90 -0
  158. package/dist/core/parser/section-parser.js.map +1 -0
  159. package/dist/core/parser/task-parser.d.ts +9 -0
  160. package/dist/core/parser/task-parser.d.ts.map +1 -0
  161. package/dist/core/parser/task-parser.js +35 -0
  162. package/dist/core/parser/task-parser.js.map +1 -0
  163. package/dist/core/parser/types.d.ts +94 -0
  164. package/dist/core/parser/types.d.ts.map +1 -0
  165. package/dist/core/parser/types.js +2 -0
  166. package/dist/core/parser/types.js.map +1 -0
  167. package/dist/core/parser/wikilink-parser.d.ts +19 -0
  168. package/dist/core/parser/wikilink-parser.d.ts.map +1 -0
  169. package/dist/core/parser/wikilink-parser.js +74 -0
  170. package/dist/core/parser/wikilink-parser.js.map +1 -0
  171. package/dist/core/retrieval/classify.d.ts +11 -0
  172. package/dist/core/retrieval/classify.d.ts.map +1 -0
  173. package/dist/core/retrieval/classify.js +92 -0
  174. package/dist/core/retrieval/classify.js.map +1 -0
  175. package/dist/core/retrieval/constants.d.ts +49 -0
  176. package/dist/core/retrieval/constants.d.ts.map +1 -0
  177. package/dist/core/retrieval/constants.js +29 -0
  178. package/dist/core/retrieval/constants.js.map +1 -0
  179. package/dist/core/retrieval/graph-expand.d.ts +7 -0
  180. package/dist/core/retrieval/graph-expand.d.ts.map +1 -0
  181. package/dist/core/retrieval/graph-expand.js +20 -0
  182. package/dist/core/retrieval/graph-expand.js.map +1 -0
  183. package/dist/core/retrieval/helpers.d.ts +15 -0
  184. package/dist/core/retrieval/helpers.d.ts.map +1 -0
  185. package/dist/core/retrieval/helpers.js +36 -0
  186. package/dist/core/retrieval/helpers.js.map +1 -0
  187. package/dist/core/retrieval/index.d.ts +11 -0
  188. package/dist/core/retrieval/index.d.ts.map +1 -0
  189. package/dist/core/retrieval/index.js +9 -0
  190. package/dist/core/retrieval/index.js.map +1 -0
  191. package/dist/core/retrieval/lexical.d.ts +8 -0
  192. package/dist/core/retrieval/lexical.d.ts.map +1 -0
  193. package/dist/core/retrieval/lexical.js +107 -0
  194. package/dist/core/retrieval/lexical.js.map +1 -0
  195. package/dist/core/retrieval/retrieve.d.ts +16 -0
  196. package/dist/core/retrieval/retrieve.d.ts.map +1 -0
  197. package/dist/core/retrieval/retrieve.js +58 -0
  198. package/dist/core/retrieval/retrieve.js.map +1 -0
  199. package/dist/core/retrieval/scoring.d.ts +14 -0
  200. package/dist/core/retrieval/scoring.d.ts.map +1 -0
  201. package/dist/core/retrieval/scoring.js +169 -0
  202. package/dist/core/retrieval/scoring.js.map +1 -0
  203. package/dist/core/retrieval/warnings.d.ts +16 -0
  204. package/dist/core/retrieval/warnings.d.ts.map +1 -0
  205. package/dist/core/retrieval/warnings.js +73 -0
  206. package/dist/core/retrieval/warnings.js.map +1 -0
  207. package/dist/core/schema/base.schema.d.ts +31 -0
  208. package/dist/core/schema/base.schema.d.ts.map +1 -0
  209. package/dist/core/schema/base.schema.js +32 -0
  210. package/dist/core/schema/base.schema.js.map +1 -0
  211. package/dist/core/schema/change.schema.d.ts +96 -0
  212. package/dist/core/schema/change.schema.d.ts.map +1 -0
  213. package/dist/core/schema/change.schema.js +64 -0
  214. package/dist/core/schema/change.schema.js.map +1 -0
  215. package/dist/core/schema/decision.schema.d.ts +33 -0
  216. package/dist/core/schema/decision.schema.d.ts.map +1 -0
  217. package/dist/core/schema/decision.schema.js +19 -0
  218. package/dist/core/schema/decision.schema.js.map +1 -0
  219. package/dist/core/schema/delta-summary.d.ts +57 -0
  220. package/dist/core/schema/delta-summary.d.ts.map +1 -0
  221. package/dist/core/schema/delta-summary.js +38 -0
  222. package/dist/core/schema/delta-summary.js.map +1 -0
  223. package/dist/core/schema/feature.schema.d.ts +40 -0
  224. package/dist/core/schema/feature.schema.d.ts.map +1 -0
  225. package/dist/core/schema/feature.schema.js +25 -0
  226. package/dist/core/schema/feature.schema.js.map +1 -0
  227. package/dist/core/schema/frontmatter.d.ts +207 -0
  228. package/dist/core/schema/frontmatter.d.ts.map +1 -0
  229. package/dist/core/schema/frontmatter.js +23 -0
  230. package/dist/core/schema/frontmatter.js.map +1 -0
  231. package/dist/core/schema/index.d.ts +235 -0
  232. package/dist/core/schema/index.d.ts.map +1 -0
  233. package/dist/core/schema/index.js +52 -0
  234. package/dist/core/schema/index.js.map +1 -0
  235. package/dist/core/schema/query.schema.d.ts +39 -0
  236. package/dist/core/schema/query.schema.d.ts.map +1 -0
  237. package/dist/core/schema/query.schema.js +20 -0
  238. package/dist/core/schema/query.schema.js.map +1 -0
  239. package/dist/core/schema/requirement.d.ts +69 -0
  240. package/dist/core/schema/requirement.d.ts.map +1 -0
  241. package/dist/core/schema/requirement.js +35 -0
  242. package/dist/core/schema/requirement.js.map +1 -0
  243. package/dist/core/schema/source.schema.d.ts +33 -0
  244. package/dist/core/schema/source.schema.d.ts.map +1 -0
  245. package/dist/core/schema/source.schema.js +24 -0
  246. package/dist/core/schema/source.schema.js.map +1 -0
  247. package/dist/core/schema/system.schema.d.ts +27 -0
  248. package/dist/core/schema/system.schema.d.ts.map +1 -0
  249. package/dist/core/schema/system.schema.js +17 -0
  250. package/dist/core/schema/system.schema.js.map +1 -0
  251. package/dist/core/schema/templates.d.ts +14 -0
  252. package/dist/core/schema/templates.d.ts.map +1 -0
  253. package/dist/core/schema/templates.js +220 -0
  254. package/dist/core/schema/templates.js.map +1 -0
  255. package/dist/core/schema/validation-constants.d.ts +5 -0
  256. package/dist/core/schema/validation-constants.d.ts.map +1 -0
  257. package/dist/core/schema/validation-constants.js +5 -0
  258. package/dist/core/schema/validation-constants.js.map +1 -0
  259. package/dist/core/sequencing/analyze.d.ts +13 -0
  260. package/dist/core/sequencing/analyze.d.ts.map +1 -0
  261. package/dist/core/sequencing/analyze.js +107 -0
  262. package/dist/core/sequencing/analyze.js.map +1 -0
  263. package/dist/core/sequencing/index.d.ts +8 -0
  264. package/dist/core/sequencing/index.d.ts.map +1 -0
  265. package/dist/core/sequencing/index.js +8 -0
  266. package/dist/core/sequencing/index.js.map +1 -0
  267. package/dist/core/sequencing/ordering.d.ts +11 -0
  268. package/dist/core/sequencing/ordering.d.ts.map +1 -0
  269. package/dist/core/sequencing/ordering.js +148 -0
  270. package/dist/core/sequencing/ordering.js.map +1 -0
  271. package/dist/core/sequencing/out-of-order-detector.d.ts +9 -0
  272. package/dist/core/sequencing/out-of-order-detector.d.ts.map +1 -0
  273. package/dist/core/sequencing/out-of-order-detector.js +42 -0
  274. package/dist/core/sequencing/out-of-order-detector.js.map +1 -0
  275. package/dist/core/sequencing/priority-queue.d.ts +18 -0
  276. package/dist/core/sequencing/priority-queue.d.ts.map +1 -0
  277. package/dist/core/sequencing/priority-queue.js +31 -0
  278. package/dist/core/sequencing/priority-queue.js.map +1 -0
  279. package/dist/core/sequencing/requirement-conflict-detector.d.ts +9 -0
  280. package/dist/core/sequencing/requirement-conflict-detector.d.ts.map +1 -0
  281. package/dist/core/sequencing/requirement-conflict-detector.js +90 -0
  282. package/dist/core/sequencing/requirement-conflict-detector.js.map +1 -0
  283. package/dist/core/sequencing/stale-detector.d.ts +9 -0
  284. package/dist/core/sequencing/stale-detector.d.ts.map +1 -0
  285. package/dist/core/sequencing/stale-detector.js +49 -0
  286. package/dist/core/sequencing/stale-detector.js.map +1 -0
  287. package/dist/core/sequencing/touches-analyzer.d.ts +8 -0
  288. package/dist/core/sequencing/touches-analyzer.d.ts.map +1 -0
  289. package/dist/core/sequencing/touches-analyzer.js +91 -0
  290. package/dist/core/sequencing/touches-analyzer.js.map +1 -0
  291. package/dist/core/vault/index.d.ts +2 -0
  292. package/dist/core/vault/index.d.ts.map +1 -0
  293. package/dist/core/vault/index.js +3 -0
  294. package/dist/core/vault/index.js.map +1 -0
  295. package/dist/core/workflow/apply/apply.d.ts +17 -0
  296. package/dist/core/workflow/apply/apply.d.ts.map +1 -0
  297. package/dist/core/workflow/apply/apply.js +302 -0
  298. package/dist/core/workflow/apply/apply.js.map +1 -0
  299. package/dist/core/workflow/apply/delta-parser.d.ts +11 -0
  300. package/dist/core/workflow/apply/delta-parser.d.ts.map +1 -0
  301. package/dist/core/workflow/apply/delta-parser.js +164 -0
  302. package/dist/core/workflow/apply/delta-parser.js.map +1 -0
  303. package/dist/core/workflow/apply/feature-updater.d.ts +12 -0
  304. package/dist/core/workflow/apply/feature-updater.d.ts.map +1 -0
  305. package/dist/core/workflow/apply/feature-updater.js +75 -0
  306. package/dist/core/workflow/apply/feature-updater.js.map +1 -0
  307. package/dist/core/workflow/apply/index.d.ts +7 -0
  308. package/dist/core/workflow/apply/index.d.ts.map +1 -0
  309. package/dist/core/workflow/apply/index.js +6 -0
  310. package/dist/core/workflow/apply/index.js.map +1 -0
  311. package/dist/core/workflow/apply/stale-checker.d.ts +17 -0
  312. package/dist/core/workflow/apply/stale-checker.d.ts.map +1 -0
  313. package/dist/core/workflow/apply/stale-checker.js +99 -0
  314. package/dist/core/workflow/apply/stale-checker.js.map +1 -0
  315. package/dist/core/workflow/apply/types.d.ts +112 -0
  316. package/dist/core/workflow/apply/types.d.ts.map +1 -0
  317. package/dist/core/workflow/apply/types.js +2 -0
  318. package/dist/core/workflow/apply/types.js.map +1 -0
  319. package/dist/core/workflow/apply/verify-apply.d.ts +16 -0
  320. package/dist/core/workflow/apply/verify-apply.d.ts.map +1 -0
  321. package/dist/core/workflow/apply/verify-apply.js +81 -0
  322. package/dist/core/workflow/apply/verify-apply.js.map +1 -0
  323. package/dist/core/workflow/continue/continue.d.ts +17 -0
  324. package/dist/core/workflow/continue/continue.d.ts.map +1 -0
  325. package/dist/core/workflow/continue/continue.js +213 -0
  326. package/dist/core/workflow/continue/continue.js.map +1 -0
  327. package/dist/core/workflow/continue/decision-promoter.d.ts +20 -0
  328. package/dist/core/workflow/continue/decision-promoter.d.ts.map +1 -0
  329. package/dist/core/workflow/continue/decision-promoter.js +36 -0
  330. package/dist/core/workflow/continue/decision-promoter.js.map +1 -0
  331. package/dist/core/workflow/continue/index.d.ts +6 -0
  332. package/dist/core/workflow/continue/index.d.ts.map +1 -0
  333. package/dist/core/workflow/continue/index.js +5 -0
  334. package/dist/core/workflow/continue/index.js.map +1 -0
  335. package/dist/core/workflow/continue/next-action.d.ts +13 -0
  336. package/dist/core/workflow/continue/next-action.d.ts.map +1 -0
  337. package/dist/core/workflow/continue/next-action.js +129 -0
  338. package/dist/core/workflow/continue/next-action.js.map +1 -0
  339. package/dist/core/workflow/continue/section-checker.d.ts +18 -0
  340. package/dist/core/workflow/continue/section-checker.d.ts.map +1 -0
  341. package/dist/core/workflow/continue/section-checker.js +114 -0
  342. package/dist/core/workflow/continue/section-checker.js.map +1 -0
  343. package/dist/core/workflow/continue/types.d.ts +113 -0
  344. package/dist/core/workflow/continue/types.d.ts.map +1 -0
  345. package/dist/core/workflow/continue/types.js +2 -0
  346. package/dist/core/workflow/continue/types.js.map +1 -0
  347. package/dist/core/workflow/index.d.ts +11 -0
  348. package/dist/core/workflow/index.d.ts.map +1 -0
  349. package/dist/core/workflow/index.js +12 -0
  350. package/dist/core/workflow/index.js.map +1 -0
  351. package/dist/core/workflow/propose/index.d.ts +6 -0
  352. package/dist/core/workflow/propose/index.d.ts.map +1 -0
  353. package/dist/core/workflow/propose/index.js +5 -0
  354. package/dist/core/workflow/propose/index.js.map +1 -0
  355. package/dist/core/workflow/propose/note-creator.d.ts +35 -0
  356. package/dist/core/workflow/propose/note-creator.d.ts.map +1 -0
  357. package/dist/core/workflow/propose/note-creator.js +178 -0
  358. package/dist/core/workflow/propose/note-creator.js.map +1 -0
  359. package/dist/core/workflow/propose/prerequisites.d.ts +17 -0
  360. package/dist/core/workflow/propose/prerequisites.d.ts.map +1 -0
  361. package/dist/core/workflow/propose/prerequisites.js +78 -0
  362. package/dist/core/workflow/propose/prerequisites.js.map +1 -0
  363. package/dist/core/workflow/propose/propose.d.ts +13 -0
  364. package/dist/core/workflow/propose/propose.d.ts.map +1 -0
  365. package/dist/core/workflow/propose/propose.js +204 -0
  366. package/dist/core/workflow/propose/propose.js.map +1 -0
  367. package/dist/core/workflow/propose/query-normalizer.d.ts +7 -0
  368. package/dist/core/workflow/propose/query-normalizer.d.ts.map +1 -0
  369. package/dist/core/workflow/propose/query-normalizer.js +77 -0
  370. package/dist/core/workflow/propose/query-normalizer.js.map +1 -0
  371. package/dist/core/workflow/propose/types.d.ts +71 -0
  372. package/dist/core/workflow/propose/types.d.ts.map +1 -0
  373. package/dist/core/workflow/propose/types.js +2 -0
  374. package/dist/core/workflow/propose/types.js.map +1 -0
  375. package/dist/core/workflow/query/index.d.ts +6 -0
  376. package/dist/core/workflow/query/index.d.ts.map +1 -0
  377. package/dist/core/workflow/query/index.js +5 -0
  378. package/dist/core/workflow/query/index.js.map +1 -0
  379. package/dist/core/workflow/query/noteworthiness.d.ts +14 -0
  380. package/dist/core/workflow/query/noteworthiness.d.ts.map +1 -0
  381. package/dist/core/workflow/query/noteworthiness.js +48 -0
  382. package/dist/core/workflow/query/noteworthiness.js.map +1 -0
  383. package/dist/core/workflow/query/query-note-creator.d.ts +13 -0
  384. package/dist/core/workflow/query/query-note-creator.d.ts.map +1 -0
  385. package/dist/core/workflow/query/query-note-creator.js +168 -0
  386. package/dist/core/workflow/query/query-note-creator.js.map +1 -0
  387. package/dist/core/workflow/query/query-search.d.ts +19 -0
  388. package/dist/core/workflow/query/query-search.d.ts.map +1 -0
  389. package/dist/core/workflow/query/query-search.js +252 -0
  390. package/dist/core/workflow/query/query-search.js.map +1 -0
  391. package/dist/core/workflow/query/query.d.ts +18 -0
  392. package/dist/core/workflow/query/query.d.ts.map +1 -0
  393. package/dist/core/workflow/query/query.js +29 -0
  394. package/dist/core/workflow/query/query.js.map +1 -0
  395. package/dist/core/workflow/query/types.d.ts +67 -0
  396. package/dist/core/workflow/query/types.d.ts.map +1 -0
  397. package/dist/core/workflow/query/types.js +2 -0
  398. package/dist/core/workflow/query/types.js.map +1 -0
  399. package/dist/core/workflow/verify/coherence.d.ts +30 -0
  400. package/dist/core/workflow/verify/coherence.d.ts.map +1 -0
  401. package/dist/core/workflow/verify/coherence.js +206 -0
  402. package/dist/core/workflow/verify/coherence.js.map +1 -0
  403. package/dist/core/workflow/verify/completeness.d.ts +24 -0
  404. package/dist/core/workflow/verify/completeness.d.ts.map +1 -0
  405. package/dist/core/workflow/verify/completeness.js +172 -0
  406. package/dist/core/workflow/verify/completeness.js.map +1 -0
  407. package/dist/core/workflow/verify/correctness.d.ts +38 -0
  408. package/dist/core/workflow/verify/correctness.d.ts.map +1 -0
  409. package/dist/core/workflow/verify/correctness.js +352 -0
  410. package/dist/core/workflow/verify/correctness.js.map +1 -0
  411. package/dist/core/workflow/verify/index.d.ts +7 -0
  412. package/dist/core/workflow/verify/index.d.ts.map +1 -0
  413. package/dist/core/workflow/verify/index.js +6 -0
  414. package/dist/core/workflow/verify/index.js.map +1 -0
  415. package/dist/core/workflow/verify/vault-integrity.d.ts +45 -0
  416. package/dist/core/workflow/verify/vault-integrity.d.ts.map +1 -0
  417. package/dist/core/workflow/verify/vault-integrity.js +141 -0
  418. package/dist/core/workflow/verify/vault-integrity.js.map +1 -0
  419. package/dist/core/workflow/verify/verify.d.ts +23 -0
  420. package/dist/core/workflow/verify/verify.d.ts.map +1 -0
  421. package/dist/core/workflow/verify/verify.js +122 -0
  422. package/dist/core/workflow/verify/verify.js.map +1 -0
  423. package/dist/index.d.ts +10 -0
  424. package/dist/index.d.ts.map +1 -0
  425. package/dist/index.js +2 -0
  426. package/dist/index.js.map +1 -0
  427. package/dist/types/delta.d.ts +17 -0
  428. package/dist/types/delta.d.ts.map +1 -0
  429. package/dist/types/delta.js +2 -0
  430. package/dist/types/delta.js.map +1 -0
  431. package/dist/types/frontmatter.d.ts +51 -0
  432. package/dist/types/frontmatter.d.ts.map +1 -0
  433. package/dist/types/frontmatter.js +2 -0
  434. package/dist/types/frontmatter.js.map +1 -0
  435. package/dist/types/index-record.d.ts +46 -0
  436. package/dist/types/index-record.d.ts.map +1 -0
  437. package/dist/types/index-record.js +2 -0
  438. package/dist/types/index-record.js.map +1 -0
  439. package/dist/types/index.d.ts +11 -0
  440. package/dist/types/index.d.ts.map +1 -0
  441. package/dist/types/index.js +2 -0
  442. package/dist/types/index.js.map +1 -0
  443. package/dist/types/next-action.d.ts +10 -0
  444. package/dist/types/next-action.d.ts.map +1 -0
  445. package/dist/types/next-action.js +2 -0
  446. package/dist/types/next-action.js.map +1 -0
  447. package/dist/types/notes.d.ts +9 -0
  448. package/dist/types/notes.d.ts.map +1 -0
  449. package/dist/types/notes.js +2 -0
  450. package/dist/types/notes.js.map +1 -0
  451. package/dist/types/requirement.d.ts +19 -0
  452. package/dist/types/requirement.d.ts.map +1 -0
  453. package/dist/types/requirement.js +2 -0
  454. package/dist/types/requirement.js.map +1 -0
  455. package/dist/types/retrieval.d.ts +32 -0
  456. package/dist/types/retrieval.d.ts.map +1 -0
  457. package/dist/types/retrieval.js +2 -0
  458. package/dist/types/retrieval.js.map +1 -0
  459. package/dist/types/sequencing.d.ts +83 -0
  460. package/dist/types/sequencing.d.ts.map +1 -0
  461. package/dist/types/sequencing.js +2 -0
  462. package/dist/types/sequencing.js.map +1 -0
  463. package/dist/types/task.d.ts +7 -0
  464. package/dist/types/task.d.ts.map +1 -0
  465. package/dist/types/task.js +2 -0
  466. package/dist/types/task.js.map +1 -0
  467. package/dist/types/verify.d.ts +23 -0
  468. package/dist/types/verify.d.ts.map +1 -0
  469. package/dist/types/verify.js +2 -0
  470. package/dist/types/verify.js.map +1 -0
  471. package/dist/utils/hash.d.ts +6 -0
  472. package/dist/utils/hash.d.ts.map +1 -0
  473. package/dist/utils/hash.js +9 -0
  474. package/dist/utils/hash.js.map +1 -0
  475. package/dist/utils/id-generator.d.ts +17 -0
  476. package/dist/utils/id-generator.d.ts.map +1 -0
  477. package/dist/utils/id-generator.js +24 -0
  478. package/dist/utils/id-generator.js.map +1 -0
  479. package/dist/utils/index.d.ts +4 -0
  480. package/dist/utils/index.d.ts.map +1 -0
  481. package/dist/utils/index.js +4 -0
  482. package/dist/utils/index.js.map +1 -0
  483. package/dist/utils/normalize.d.ts +11 -0
  484. package/dist/utils/normalize.d.ts.map +1 -0
  485. package/dist/utils/normalize.js +15 -0
  486. package/dist/utils/normalize.js.map +1 -0
  487. package/package.json +61 -0
@@ -0,0 +1,106 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { createHash } from 'node:crypto';
3
+ import { extractFrontmatter, validateFrontmatter } from './frontmatter-parser.js';
4
+ import { parseSections } from './section-parser.js';
5
+ import { extractWikilinks } from './wikilink-parser.js';
6
+ import { parseRequirements } from './requirement-parser.js';
7
+ import { parseDeltaSummary } from './delta-summary-parser.js';
8
+ import { parseTasks } from './task-parser.js';
9
+ /**
10
+ * Parse a single markdown note into a complete ParseResult.
11
+ * Reads the file at the given path and orchestrates all sub-parsers.
12
+ *
13
+ * Returns ParseResult with raw wikilinks (not resolved to ids).
14
+ */
15
+ export function parseNote(filePath) {
16
+ const content = readFileSync(filePath, 'utf-8');
17
+ const errors = [];
18
+ // 1. Frontmatter
19
+ const { raw, errors: fmExtractErrors } = extractFrontmatter(content);
20
+ errors.push(...fmExtractErrors);
21
+ let frontmatter = null;
22
+ let rawFrontmatter = null;
23
+ let body = content;
24
+ let bodyStartLine = 1;
25
+ if (raw) {
26
+ rawFrontmatter = raw.data;
27
+ body = raw.body;
28
+ bodyStartLine = raw.bodyStartLine;
29
+ const { frontmatter: validated, errors: fmValidateErrors } = validateFrontmatter(raw.data);
30
+ errors.push(...fmValidateErrors);
31
+ frontmatter = validated;
32
+ }
33
+ // 2. Sections
34
+ const { sections, headings, errors: sectionErrors } = parseSections(body, bodyStartLine);
35
+ errors.push(...sectionErrors);
36
+ // 3. Wikilinks (from frontmatter YAML values and body)
37
+ const fmWikilinks = raw
38
+ ? extractWikilinksFromObject(raw.data, 'frontmatter')
39
+ : { wikilinks: [], errors: [] };
40
+ const bodyWikilinks = extractWikilinks(body, 'body', bodyStartLine);
41
+ errors.push(...fmWikilinks.errors, ...bodyWikilinks.errors);
42
+ const allWikilinks = [...fmWikilinks.wikilinks, ...bodyWikilinks.wikilinks];
43
+ // 4. Requirements (Feature only)
44
+ const noteType = frontmatter?.type;
45
+ let requirements = [];
46
+ if (noteType === 'feature') {
47
+ const reqResult = parseRequirements(sections);
48
+ requirements = reqResult.requirements;
49
+ errors.push(...reqResult.errors);
50
+ }
51
+ // 5. Delta Summary + Tasks (Change only)
52
+ let deltaSummary = [];
53
+ let tasks = [];
54
+ if (noteType === 'change') {
55
+ const deltaResult = parseDeltaSummary(sections);
56
+ deltaSummary = deltaResult.entries;
57
+ errors.push(...deltaResult.errors);
58
+ const taskResult = parseTasks(sections);
59
+ tasks = taskResult.tasks;
60
+ errors.push(...taskResult.errors);
61
+ }
62
+ // 6. Content hash
63
+ const contentHash = computeBodyHash(body);
64
+ return {
65
+ frontmatter,
66
+ rawFrontmatter,
67
+ sections,
68
+ headings,
69
+ wikilinks: allWikilinks,
70
+ requirements,
71
+ deltaSummary,
72
+ tasks,
73
+ body,
74
+ contentHash,
75
+ errors,
76
+ };
77
+ }
78
+ function computeBodyHash(body) {
79
+ const hash = createHash('sha256').update(body, 'utf-8').digest('hex');
80
+ return `sha256:${hash}`;
81
+ }
82
+ /**
83
+ * Recursively walk a frontmatter object and extract wikilinks from string values.
84
+ */
85
+ function extractWikilinksFromObject(obj, location) {
86
+ const allWikilinks = [];
87
+ const allErrors = [];
88
+ function walk(value) {
89
+ if (typeof value === 'string') {
90
+ const { wikilinks, errors } = extractWikilinks(value, location, 1);
91
+ allWikilinks.push(...wikilinks);
92
+ allErrors.push(...errors);
93
+ }
94
+ else if (Array.isArray(value)) {
95
+ for (const item of value)
96
+ walk(item);
97
+ }
98
+ else if (typeof value === 'object' && value !== null) {
99
+ for (const v of Object.values(value))
100
+ walk(v);
101
+ }
102
+ }
103
+ walk(obj);
104
+ return { wikilinks: allWikilinks, errors: allErrors };
105
+ }
106
+ //# sourceMappingURL=note-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"note-parser.js","sourceRoot":"","sources":["../../../src/core/parser/note-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAyB,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,iBAAiB;IACjB,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrE,MAAM,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;IAEhC,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,cAAc,GAAG,IAAI,CAAC;IAC1B,IAAI,IAAI,GAAG,OAAO,CAAC;IACnB,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,IAAI,GAAG,EAAE,CAAC;QACR,cAAc,GAAG,GAAG,CAAC,IAAI,CAAC;QAC1B,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QAChB,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC;QAElC,MAAM,EAAE,WAAW,EA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AC,CAAC;YAChC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;QAC5B,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,KAAK,MAAM,IAAI,IAAI,KAAK;gBAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACvD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACxD,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Section, ParseError } from './types.js';
2
+ import type { Requirement } from '../../types/requirement.js';
3
+ /**
4
+ * Parse requirement blocks from a Feature note's section tree.
5
+ *
6
+ * The `key` field is NOT set here (parser doesn't know feature_id).
7
+ * The index engine sets it as `${feature_id}::${name}`.
8
+ */
9
+ export declare function parseRequirements(sections: Section[]): {
10
+ requirements: Requirement[];
11
+ errors: ParseError[];
12
+ };
13
+ //# sourceMappingURL=requirement-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirement-parser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/requirement-parser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAY,MAAM,4BAA4B,CAAC;AAOxE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,EAAE,GAClB;IAAE,YAAY,EAAE,WAAW,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAmGvD"}
@@ -0,0 +1,127 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { findSection } from './section-parser.js';
3
+ import { normalizeForHash } from '../../utils/normalize.js';
4
+ const REQUIREMENT_HEADING_REGEX = /^Requirement:\s*(.+)$/;
5
+ const SCENARIO_HEADING_REGEX = /^Scenario:\s*(.+)$/;
6
+ /**
7
+ * Parse requirement blocks from a Feature note's section tree.
8
+ *
9
+ * The `key` field is NOT set here (parser doesn't know feature_id).
10
+ * The index engine sets it as `${feature_id}::${name}`.
11
+ */
12
+ export function parseRequirements(sections) {
13
+ const requirements = [];
14
+ const errors = [];
15
+ const seenNames = new Set();
16
+ const reqSection = findSection(sections, 'Requirements');
17
+ if (!reqSection) {
18
+ return { requirements, errors };
19
+ }
20
+ for (const child of reqSection.children) {
21
+ const nameMatch = child.title.match(REQUIREMENT_HEADING_REGEX);
22
+ if (!nameMatch)
23
+ continue;
24
+ const name = nameMatch[1].trim();
25
+ if (seenNames.has(name)) {
26
+ errors.push({
27
+ level: 'error',
28
+ source: 'requirement',
29
+ message: `Duplicate requirement name: "${name}"`,
30
+ line: child.line,
31
+ });
32
+ continue;
33
+ }
34
+ seenNames.add(name);
35
+ const normative = extractNormativeStatement(child);
36
+ if (!normative) {
37
+ errors.push({
38
+ level: 'warning',
39
+ source: 'requirement',
40
+ message: `Requirement "${name}" has no normative statement`,
41
+ line: child.line,
42
+ });
43
+ }
44
+ if (normative && !normative.includes('SHALL') && !normative.includes('MUST')) {
45
+ errors.push({
46
+ level: 'warning',
47
+ source: 'requirement',
48
+ message: `Requirement "${name}" normative statement lacks SHALL or MUST`,
49
+ line: child.line,
50
+ });
51
+ }
52
+ const scenarios = [];
53
+ for (const scenarioChild of child.children) {
54
+ const scenarioMatch = scenarioChild.title.match(SCENARIO_HEADING_REGEX);
55
+ if (!scenarioMatch)
56
+ continue;
57
+ const scenarioName = scenarioMatch[1].trim();
58
+ const scenarioText = scenarioChild.content.trim();
59
+ if (!scenarioText) {
60
+ errors.push({
61
+ level: 'warning',
62
+ source: 'requirement',
63
+ message: `Scenario "${scenarioName}" in requirement "${name}" is empty`,
64
+ line: scenarioChild.line,
65
+ });
66
+ continue;
67
+ }
68
+ if (!scenarioText.includes('WHEN') || !scenarioText.includes('THEN')) {
69
+ errors.push({
70
+ level: 'warning',
71
+ source: 'requirement',
72
+ message: `Scenario "${scenarioName}" in requirement "${name}" lacks WHEN/THEN structure`,
73
+ line: scenarioChild.line,
74
+ });
75
+ }
76
+ scenarios.push({ name: scenarioName, raw_text: scenarioText });
77
+ }
78
+ if (scenarios.length === 0) {
79
+ errors.push({
80
+ level: 'warning',
81
+ source: 'requirement',
82
+ message: `Requirement "${name}" has no scenarios`,
83
+ line: child.line,
84
+ });
85
+ }
86
+ const hashInput = normalizeForHashing(normative || '', scenarios);
87
+ const content_hash = computeHash(hashInput);
88
+ requirements.push({
89
+ name,
90
+ key: '', // placeholder; set by index-builder
91
+ normative: normative || '',
92
+ scenarios,
93
+ content_hash,
94
+ });
95
+ }
96
+ return { requirements, errors };
97
+ }
98
+ /**
99
+ * Extract the normative statement from a requirement section.
100
+ * Content before the first child heading.
101
+ */
102
+ function extractNormativeStatement(section) {
103
+ const lines = section.content.split('\n');
104
+ const normativeLines = [];
105
+ for (const line of lines) {
106
+ if (line.match(/^#{1,6}\s+/)) {
107
+ break;
108
+ }
109
+ normativeLines.push(line);
110
+ }
111
+ const text = normativeLines.join('\n').trim();
112
+ return text || null;
113
+ }
114
+ function normalizeForHashing(normative, scenarios) {
115
+ const parts = [
116
+ normalizeForHash(normative),
117
+ ];
118
+ for (const s of scenarios) {
119
+ parts.push(normalizeForHash(s.raw_text));
120
+ }
121
+ return parts.join('\n');
122
+ }
123
+ function computeHash(input) {
124
+ const hash = createHash('sha256').update(input, 'utf-8').digest('hex');
125
+ return `sha256:${hash}`;
126
+ }
127
+ //# sourceMappingURL=requirement-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirement-parser.js","sourceRoot":"","sources":["../../../src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AAC;QACD,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,OAAO,IAAI,IAAI,IAAI,CAAC;AACtB,CAAC;AAED,SAAS,mBAAmB,CAAC,SAAiB,EAAE,SAAqB;IACnE,MAAM,KAAK,GAAa;QACtB,gBAAgB,CAAC,SAAS,CAAC;KAC5B,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,UAAU,IAAI,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { Section, ParseError } from './types.js';
2
+ /**
3
+ * Parse a markdown body into a hierarchical section tree.
4
+ * Skips lines inside fenced code blocks.
5
+ */
6
+ export declare function parseSections(body: string, bodyStartLine?: number): {
7
+ sections: Section[];
8
+ headings: string[];
9
+ errors: ParseError[];
10
+ };
11
+ /**
12
+ * Find a section by title (case-insensitive, recursive).
13
+ */
14
+ export declare function findSection(sections: Section[], title: string): Section | undefined;
15
+ //# sourceMappingURL=section-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section-parser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/section-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAKtD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,aAAa,GAAE,MAAU,GACxB;IAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CA6EnE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAUnF"}
@@ -0,0 +1,90 @@
1
+ const HEADING_REGEX = /^(#{1,6})\s+(.+)$/;
2
+ const CODE_FENCE_REGEX = /^(`{3,}|~{3,})/;
3
+ /**
4
+ * Parse a markdown body into a hierarchical section tree.
5
+ * Skips lines inside fenced code blocks.
6
+ */
7
+ export function parseSections(body, bodyStartLine = 1) {
8
+ const errors = [];
9
+ const sections = [];
10
+ const headings = [];
11
+ const normalizedBody = body.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
12
+ const lines = normalizedBody.split('\n');
13
+ const stack = [];
14
+ // Collect heading positions, skipping code fences
15
+ const headingPositions = [];
16
+ let insideCodeFence = false;
17
+ let codeFenceMarker = '';
18
+ for (let i = 0; i < lines.length; i++) {
19
+ const fenceMatch = lines[i].match(CODE_FENCE_REGEX);
20
+ if (fenceMatch) {
21
+ if (!insideCodeFence) {
22
+ insideCodeFence = true;
23
+ codeFenceMarker = fenceMatch[1][0];
24
+ }
25
+ else if (lines[i].trim().startsWith(codeFenceMarker.repeat(3))) {
26
+ insideCodeFence = false;
27
+ codeFenceMarker = '';
28
+ }
29
+ continue;
30
+ }
31
+ if (insideCodeFence)
32
+ continue;
33
+ const match = lines[i].match(HEADING_REGEX);
34
+ if (match) {
35
+ headingPositions.push({
36
+ index: i,
37
+ level: match[1].length,
38
+ title: match[2].trim(),
39
+ });
40
+ }
41
+ }
42
+ for (let h = 0; h < headingPositions.length; h++) {
43
+ const { index, level, title } = headingPositions[h];
44
+ headings.push(title);
45
+ // Content: lines after this heading until the next heading of same or higher level
46
+ const contentLines = [];
47
+ const nextSameOrHigher = headingPositions.findIndex((hp, idx) => idx > h && hp.level <= level);
48
+ const endIndex = nextSameOrHigher !== -1
49
+ ? headingPositions[nextSameOrHigher].index
50
+ : lines.length;
51
+ for (let i = index + 1; i < endIndex; i++) {
52
+ contentLines.push(lines[i]);
53
+ }
54
+ const section = {
55
+ level,
56
+ title,
57
+ content: contentLines.join('\n').trim(),
58
+ line: bodyStartLine + index,
59
+ children: [],
60
+ };
61
+ // Build hierarchy using stack
62
+ while (stack.length > 0 && stack[stack.length - 1].level >= level) {
63
+ stack.pop();
64
+ }
65
+ if (stack.length === 0) {
66
+ sections.push(section);
67
+ }
68
+ else {
69
+ stack[stack.length - 1].children.push(section);
70
+ }
71
+ stack.push(section);
72
+ }
73
+ return { sections, headings, errors };
74
+ }
75
+ /**
76
+ * Find a section by title (case-insensitive, recursive).
77
+ */
78
+ export function findSection(sections, title) {
79
+ const target = title.toLowerCase();
80
+ for (const section of sections) {
81
+ if (section.title.toLowerCase() === target) {
82
+ return section;
83
+ }
84
+ const child = findSection(section.children, title);
85
+ if (child)
86
+ return child;
87
+ }
88
+ return undefined;
89
+ }
90
+ //# sourceMappingURL=section-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section-parser.js","sourceRoot":"","sources":["../../../src/core/parser/section-parser.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAC1C,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,gBAAwB,CAAC;IAEzB,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KA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I,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,QAAmB,EAAE,KAAa;IAC5D,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IACnC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;YAC3C,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACnD,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IAC1B,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Section, ParsedTaskItem, ParseError } from './types.js';
2
+ /**
3
+ * Parse task checklist items from a Change note's Tasks section.
4
+ */
5
+ export declare function parseTasks(sections: Section[]): {
6
+ tasks: ParsedTaskItem[];
7
+ errors: ParseError[];
8
+ };
9
+ //# sourceMappingURL=task-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-parser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/task-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAKtE;;GAEG;AACH,wBAAgB,UAAU,CACxB,QAAQ,EAAE,OAAO,EAAE,GAClB;IAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CAyBnD"}
@@ -0,0 +1,35 @@
1
+ import { findSection } from './section-parser.js';
2
+ const TASK_REGEX = /^-\s+\[([ xX])\]\s+(.+)$/;
3
+ /**
4
+ * Parse task checklist items from a Change note's Tasks section.
5
+ */
6
+ export function parseTasks(sections) {
7
+ const tasks = [];
8
+ const errors = [];
9
+ const taskSection = findSection(sections, 'Tasks');
10
+ if (!taskSection) {
11
+ return { tasks, errors };
12
+ }
13
+ // taskSection.content already includes all lines up to the next same-or-higher-level heading,
14
+ // including child heading lines. No need to recurse into children.
15
+ const lines = taskSection.content.split('\n');
16
+ for (let i = 0; i < lines.length; i++) {
17
+ const match = lines[i].match(TASK_REGEX);
18
+ if (match) {
19
+ tasks.push({
20
+ text: match[2].trim(),
21
+ done: match[1] !== ' ',
22
+ line: taskSection.line + i + 1,
23
+ });
24
+ }
25
+ }
26
+ return { tasks, errors };
27
+ }
28
+ function gatherAllContent(section) {
29
+ let content = section.content;
30
+ for (const child of section.children) {
31
+ content += '\n' + gatherAllContent(child);
32
+ }
33
+ return content;
34
+ }
35
+ //# sourceMappingURL=task-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-parser.js","sourceRoot":"","sources":["../../../src/core/parser/task-parser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,MAAM,UAAU,GAAG,0BAA0B,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,UAAU,CACxB,QAAmB;IAEnB,MAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC3B,CAAC;IAED,8FAA8F;IAC9F,mEAAmE;IACnE,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,KAAK,EAAE,CAAC;YACV,KAAK,CAAC,IAAI,CAAC;gBACT,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBACrB,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG;gBACtB,IAAI,EAAE,WAAW,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC;aAC/B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AAC3B,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAgB;IACxC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAC9B,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,OAAO,IAAI,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,94 @@
1
+ import type { Frontmatter } from '../schema/frontmatter.js';
2
+ import type { Requirement } from '../../types/requirement.js';
3
+ import type { DeltaSummaryEntry } from '../../types/delta.js';
4
+ /** Result of frontmatter extraction (before Zod validation) */
5
+ export interface RawFrontmatter {
6
+ /** The raw YAML object */
7
+ data: Record<string, unknown>;
8
+ /** The body content after the closing --- */
9
+ body: string;
10
+ /** Line number where the body starts (1-indexed) */
11
+ bodyStartLine: number;
12
+ }
13
+ /** A parsed section from the heading hierarchy */
14
+ export interface Section {
15
+ /** Heading level (1-6) */
16
+ level: number;
17
+ /** Heading text (without # prefix) */
18
+ title: string;
19
+ /** Content between this heading and the next heading of same or higher level */
20
+ content: string;
21
+ /** Line number of the heading (1-indexed) */
22
+ line: number;
23
+ /** Child sections (headings of deeper level) */
24
+ children: Section[];
25
+ }
26
+ /** A wikilink occurrence in the document */
27
+ export interface WikilinkOccurrence {
28
+ /** The raw wikilink text, e.g. "Feature: Auth Login" (without brackets) */
29
+ target: string;
30
+ /** Display alias if present, e.g. "Auth" in [[Feature: Auth Login|Auth]] */
31
+ alias: string | null;
32
+ /** Where this wikilink was found */
33
+ location: 'frontmatter' | 'body';
34
+ /** Line number (1-indexed) */
35
+ line: number;
36
+ }
37
+ /** A parsed task item from a checklist */
38
+ export interface ParsedTaskItem {
39
+ /** The task text (without the checkbox marker) */
40
+ text: string;
41
+ /** Whether the checkbox is checked */
42
+ done: boolean;
43
+ /** Line number (1-indexed) */
44
+ line: number;
45
+ }
46
+ /** Errors collected during parsing */
47
+ export interface ParseError {
48
+ /** Error severity */
49
+ level: 'error' | 'warning';
50
+ /** What component produced this error */
51
+ source: 'frontmatter' | 'section' | 'wikilink' | 'requirement' | 'delta_summary' | 'task' | 'hash';
52
+ /** Human-readable error message */
53
+ message: string;
54
+ /** Line number if applicable (1-indexed) */
55
+ line?: number;
56
+ }
57
+ /**
58
+ * Complete parse result for a single note.
59
+ *
60
+ * IMPORTANT: This is the parser's output, NOT the final IndexRecord shape.
61
+ * Per 00-unified-types.md Ownership Rules:
62
+ * - `requirements[].key` is an empty string placeholder ('').
63
+ * The index engine (Plan 04) computes the composite key as `feature_id::name`.
64
+ * - `deltaSummary[].target_note_id` contains the RAW wikilink target text
65
+ * (e.g. "Feature: Auth Login"), NOT a resolved id.
66
+ * The index engine (Plan 04) resolves this to a canonical id.
67
+ * - All wikilink strings in frontmatter fields are RAW (not resolved to ids).
68
+ * The index engine (Plan 04) resolves them using stripWikilinkSyntax + lookup.
69
+ */
70
+ export interface ParseResult {
71
+ /** Validated frontmatter (null if frontmatter is invalid) */
72
+ frontmatter: Frontmatter | null;
73
+ /** Raw frontmatter data (always present if file has ---) */
74
+ rawFrontmatter: Record<string, unknown> | null;
75
+ /** Section tree */
76
+ sections: Section[];
77
+ /** Flat list of heading titles */
78
+ headings: string[];
79
+ /** All wikilinks found in the document */
80
+ wikilinks: WikilinkOccurrence[];
81
+ /** Parsed requirements (Feature notes only). key is '' placeholder. */
82
+ requirements: Requirement[];
83
+ /** Parsed delta summary entries (Change notes only). target_note_id is raw wikilink text. */
84
+ deltaSummary: DeltaSummaryEntry[];
85
+ /** Parsed tasks (Change notes only) */
86
+ tasks: ParsedTaskItem[];
87
+ /** Body text (markdown without frontmatter) */
88
+ body: string;
89
+ /** SHA-256 hash of the full body text, format: sha256:<hex> */
90
+ contentHash: string;
91
+ /** Errors encountered during parsing */
92
+ errors: ParseError[];
93
+ }
94
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/parser/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,kDAAkD;AAClD,MAAM,WAAW,OAAO;IACtB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,IAAI,EAAE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C7F,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,uCAAuC;IACvC,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,wCAAwC;IACxC,MAAM,EAAE,UAAU,EAAE,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/parser/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { WikilinkOccurrence, ParseError } from './types.js';
2
+ /**
3
+ * Extract all wikilinks from a string, tracking their location.
4
+ * Skips wikilinks inside fenced code blocks.
5
+ */
6
+ export declare function extractWikilinks(text: string, location: 'frontmatter' | 'body', startLine?: number): {
7
+ wikilinks: WikilinkOccurrence[];
8
+ errors: ParseError[];
9
+ };
10
+ /**
11
+ * Strip wikilink syntax from a raw wikilink string.
12
+ * Strips [[...]] brackets and drops the display text after |.
13
+ */
14
+ export declare function stripWikilinkSyntax(wikilink: string): string;
15
+ /**
16
+ * Get unique wikilink target strings.
17
+ */
18
+ export declare function uniqueWikilinkTargets(wikilinks: WikilinkOccurrence[]): string[];
19
+ //# sourceMappingURL=wikilink-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wikilink-parser.d.ts","sourceRoot":"","sources":["../../../src/core/parser/wikilink-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAKjE;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,aAAa,GAAG,MAAM,EAChC,SAAS,GAAE,MAAU,GACpB;IAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,CA8C3D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,MAAM,EAAE,CAM/E"}
@@ -0,0 +1,74 @@
1
+ const WIKILINK_REGEX = /\[\[([^\]|]*?)(?:\|([^\]]+?))?\]\]/g;
2
+ const CODE_FENCE_REGEX = /^(`{3,}|~{3,})/;
3
+ /**
4
+ * Extract all wikilinks from a string, tracking their location.
5
+ * Skips wikilinks inside fenced code blocks.
6
+ */
7
+ export function extractWikilinks(text, location, startLine = 1) {
8
+ const wikilinks = [];
9
+ const errors = [];
10
+ const lines = text.split('\n');
11
+ let insideCodeFence = false;
12
+ let codeFenceMarker = '';
13
+ for (let i = 0; i < lines.length; i++) {
14
+ const line = lines[i];
15
+ const fenceMatch = line.match(CODE_FENCE_REGEX);
16
+ if (fenceMatch) {
17
+ if (!insideCodeFence) {
18
+ insideCodeFence = true;
19
+ codeFenceMarker = fenceMatch[1][0];
20
+ }
21
+ else if (line.trim().startsWith(codeFenceMarker.repeat(3))) {
22
+ insideCodeFence = false;
23
+ codeFenceMarker = '';
24
+ }
25
+ continue;
26
+ }
27
+ if (insideCodeFence)
28
+ continue;
29
+ // Reset regex state for each line
30
+ const regex = new RegExp(WIKILINK_REGEX.source, WIKILINK_REGEX.flags);
31
+ let match;
32
+ while ((match = regex.exec(line)) !== null) {
33
+ const target = match[1].trim();
34
+ const alias = match[2]?.trim() ?? null;
35
+ if (target.length === 0) {
36
+ errors.push({
37
+ level: 'warning',
38
+ source: 'wikilink',
39
+ message: 'Empty wikilink target',
40
+ line: startLine + i,
41
+ });
42
+ continue;
43
+ }
44
+ wikilinks.push({ target, alias, location, line: startLine + i });
45
+ }
46
+ }
47
+ return { wikilinks, errors };
48
+ }
49
+ /**
50
+ * Strip wikilink syntax from a raw wikilink string.
51
+ * Strips [[...]] brackets and drops the display text after |.
52
+ */
53
+ export function stripWikilinkSyntax(wikilink) {
54
+ let result = wikilink.trim();
55
+ if (result.startsWith('[[') && result.endsWith(']]')) {
56
+ result = result.slice(2, -2);
57
+ }
58
+ const pipeIndex = result.indexOf('|');
59
+ if (pipeIndex !== -1) {
60
+ result = result.slice(0, pipeIndex);
61
+ }
62
+ return result.trim();
63
+ }
64
+ /**
65
+ * Get unique wikilink target strings.
66
+ */
67
+ export function uniqueWikilinkTargets(wikilinks) {
68
+ const targets = new Set();
69
+ for (const wl of wikilinks) {
70
+ targets.add(wl.target);
71
+ }
72
+ return Array.from(targets);
73
+ }
74
+ //# sourceMappingURL=wikilink-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wikilink-parser.js","sourceRoot":"","sources":["../../../src/core/parser/wikilink-parser.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,qCAAqC,CAAC;AAC7D,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAY,EACZ,QAAgC,EAChC,YAAoB,CAAC;IAErB,MAAM,SAAS,GAAyB,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,IAAI,eAAe,GAAG,EAAE,CAAC;IAEzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAEtB,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAChD,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC,eAAe,EAAE,CAAC;gBACrB,eAAe,GAAG,IAAI,CAAC;g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