@open-agreements/open-agreements 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +359 -0
  3. package/bin/open-agreements.js +4 -0
  4. package/content/external/LICENSE +27 -0
  5. package/content/external/README.md +38 -0
  6. package/content/external/yc-safe-discount/README.md +16 -0
  7. package/content/external/yc-safe-discount/clean.json +4 -0
  8. package/content/external/yc-safe-discount/metadata.yaml +67 -0
  9. package/content/external/yc-safe-discount/replacements.json +13 -0
  10. package/content/external/yc-safe-discount/template.docx +0 -0
  11. package/content/external/yc-safe-mfn/README.md +16 -0
  12. package/content/external/yc-safe-mfn/clean.json +4 -0
  13. package/content/external/yc-safe-mfn/metadata.yaml +64 -0
  14. package/content/external/yc-safe-mfn/replacements.json +12 -0
  15. package/content/external/yc-safe-mfn/template.docx +0 -0
  16. package/content/external/yc-safe-pro-rata-side-letter/README.md +16 -0
  17. package/content/external/yc-safe-pro-rata-side-letter/clean.json +4 -0
  18. package/content/external/yc-safe-pro-rata-side-letter/metadata.yaml +49 -0
  19. package/content/external/yc-safe-pro-rata-side-letter/replacements.json +9 -0
  20. package/content/external/yc-safe-pro-rata-side-letter/template.docx +0 -0
  21. package/content/external/yc-safe-valuation-cap/README.md +16 -0
  22. package/content/external/yc-safe-valuation-cap/clean.json +4 -0
  23. package/content/external/yc-safe-valuation-cap/metadata.yaml +64 -0
  24. package/content/external/yc-safe-valuation-cap/replacements.json +12 -0
  25. package/content/external/yc-safe-valuation-cap/template.docx +0 -0
  26. package/content/recipes/nvca-certificate-of-incorporation/clean.json +8 -0
  27. package/content/recipes/nvca-certificate-of-incorporation/metadata.yaml +43 -0
  28. package/content/recipes/nvca-certificate-of-incorporation/replacements.json +9 -0
  29. package/content/recipes/nvca-indemnification-agreement/clean.json +17 -0
  30. package/content/recipes/nvca-indemnification-agreement/metadata.yaml +79 -0
  31. package/content/recipes/nvca-indemnification-agreement/replacements.json +17 -0
  32. package/content/recipes/nvca-investors-rights-agreement/clean.json +12 -0
  33. package/content/recipes/nvca-investors-rights-agreement/metadata.yaml +71 -0
  34. package/content/recipes/nvca-investors-rights-agreement/replacements.json +18 -0
  35. package/content/recipes/nvca-management-rights-letter/clean.json +7 -0
  36. package/content/recipes/nvca-management-rights-letter/metadata.yaml +47 -0
  37. package/content/recipes/nvca-management-rights-letter/replacements.json +11 -0
  38. package/content/recipes/nvca-rofr-co-sale-agreement/clean.json +7 -0
  39. package/content/recipes/nvca-rofr-co-sale-agreement/metadata.yaml +76 -0
  40. package/content/recipes/nvca-rofr-co-sale-agreement/replacements.json +17 -0
  41. package/content/recipes/nvca-stock-purchase-agreement/clean.json +13 -0
  42. package/content/recipes/nvca-stock-purchase-agreement/computed.json +103 -0
  43. package/content/recipes/nvca-stock-purchase-agreement/metadata.yaml +138 -0
  44. package/content/recipes/nvca-stock-purchase-agreement/normalize.json +83 -0
  45. package/content/recipes/nvca-stock-purchase-agreement/replacements.json +41 -0
  46. package/content/recipes/nvca-voting-agreement/README.md +53 -0
  47. package/content/recipes/nvca-voting-agreement/clean.json +7 -0
  48. package/content/recipes/nvca-voting-agreement/metadata.yaml +66 -0
  49. package/content/recipes/nvca-voting-agreement/replacements.json +18 -0
  50. package/content/templates/bonterms-mutual-nda/README.md +27 -0
  51. package/content/templates/bonterms-mutual-nda/metadata.yaml +58 -0
  52. package/content/templates/bonterms-mutual-nda/source.json +18 -0
  53. package/content/templates/bonterms-mutual-nda/template.docx +0 -0
  54. package/content/templates/bonterms-professional-services-agreement/README.md +24 -0
  55. package/content/templates/bonterms-professional-services-agreement/metadata.yaml +45 -0
  56. package/content/templates/bonterms-professional-services-agreement/selections.json +12 -0
  57. package/content/templates/bonterms-professional-services-agreement/source.json +18 -0
  58. package/content/templates/bonterms-professional-services-agreement/template.docx +0 -0
  59. package/content/templates/closing-checklist/metadata.yaml +39 -0
  60. package/content/templates/closing-checklist/template.docx +0 -0
  61. package/content/templates/common-paper-ai-addendum/README.md +23 -0
  62. package/content/templates/common-paper-ai-addendum/metadata.yaml +31 -0
  63. package/content/templates/common-paper-ai-addendum/template.docx +0 -0
  64. package/content/templates/common-paper-ai-addendum-in-app/README.md +21 -0
  65. package/content/templates/common-paper-ai-addendum-in-app/metadata.yaml +21 -0
  66. package/content/templates/common-paper-ai-addendum-in-app/template.docx +0 -0
  67. package/content/templates/common-paper-amendment/README.md +27 -0
  68. package/content/templates/common-paper-amendment/metadata.yaml +53 -0
  69. package/content/templates/common-paper-amendment/template.docx +0 -0
  70. package/content/templates/common-paper-business-associate-agreement/README.md +29 -0
  71. package/content/templates/common-paper-business-associate-agreement/metadata.yaml +56 -0
  72. package/content/templates/common-paper-business-associate-agreement/replacements.json +3 -0
  73. package/content/templates/common-paper-business-associate-agreement/template.docx +0 -0
  74. package/content/templates/common-paper-cloud-service-agreement/README.md +32 -0
  75. package/content/templates/common-paper-cloud-service-agreement/metadata.yaml +354 -0
  76. package/content/templates/common-paper-cloud-service-agreement/template.docx +0 -0
  77. package/content/templates/common-paper-csa-click-through/README.md +33 -0
  78. package/content/templates/common-paper-csa-click-through/metadata.yaml +73 -0
  79. package/content/templates/common-paper-csa-click-through/template.docx +0 -0
  80. package/content/templates/common-paper-csa-with-ai/README.md +49 -0
  81. package/content/templates/common-paper-csa-with-ai/metadata.yaml +143 -0
  82. package/content/templates/common-paper-csa-with-ai/replacements.json +7 -0
  83. package/content/templates/common-paper-csa-with-ai/template.docx +0 -0
  84. package/content/templates/common-paper-csa-with-sla/README.md +53 -0
  85. package/content/templates/common-paper-csa-with-sla/metadata.yaml +159 -0
  86. package/content/templates/common-paper-csa-with-sla/replacements.json +7 -0
  87. package/content/templates/common-paper-csa-with-sla/template.docx +0 -0
  88. package/content/templates/common-paper-csa-without-sla/README.md +47 -0
  89. package/content/templates/common-paper-csa-without-sla/metadata.yaml +135 -0
  90. package/content/templates/common-paper-csa-without-sla/replacements.json +7 -0
  91. package/content/templates/common-paper-csa-without-sla/template.docx +0 -0
  92. package/content/templates/common-paper-data-processing-agreement/README.md +46 -0
  93. package/content/templates/common-paper-data-processing-agreement/metadata.yaml +130 -0
  94. package/content/templates/common-paper-data-processing-agreement/replacements.json +3 -0
  95. package/content/templates/common-paper-data-processing-agreement/template.docx +0 -0
  96. package/content/templates/common-paper-design-partner-agreement/README.md +29 -0
  97. package/content/templates/common-paper-design-partner-agreement/metadata.yaml +59 -0
  98. package/content/templates/common-paper-design-partner-agreement/replacements.json +4 -0
  99. package/content/templates/common-paper-design-partner-agreement/template.docx +0 -0
  100. package/content/templates/common-paper-independent-contractor-agreement/README.md +27 -0
  101. package/content/templates/common-paper-independent-contractor-agreement/metadata.yaml +55 -0
  102. package/content/templates/common-paper-independent-contractor-agreement/template.docx +0 -0
  103. package/content/templates/common-paper-letter-of-intent/README.md +25 -0
  104. package/content/templates/common-paper-letter-of-intent/metadata.yaml +42 -0
  105. package/content/templates/common-paper-letter-of-intent/template.docx +0 -0
  106. package/content/templates/common-paper-mutual-nda/README.md +29 -0
  107. package/content/templates/common-paper-mutual-nda/metadata.yaml +59 -0
  108. package/content/templates/common-paper-mutual-nda/selections.json +38 -0
  109. package/content/templates/common-paper-mutual-nda/template.docx +0 -0
  110. package/content/templates/common-paper-one-way-nda/README.md +27 -0
  111. package/content/templates/common-paper-one-way-nda/metadata.yaml +59 -0
  112. package/content/templates/common-paper-one-way-nda/template.docx +0 -0
  113. package/content/templates/common-paper-order-form/README.md +36 -0
  114. package/content/templates/common-paper-order-form/metadata.yaml +87 -0
  115. package/content/templates/common-paper-order-form/replacements.json +5 -0
  116. package/content/templates/common-paper-order-form/template.docx +0 -0
  117. package/content/templates/common-paper-order-form-with-sla/README.md +42 -0
  118. package/content/templates/common-paper-order-form-with-sla/metadata.yaml +111 -0
  119. package/content/templates/common-paper-order-form-with-sla/replacements.json +5 -0
  120. package/content/templates/common-paper-order-form-with-sla/template.docx +0 -0
  121. package/content/templates/common-paper-partnership-agreement/README.md +34 -0
  122. package/content/templates/common-paper-partnership-agreement/metadata.yaml +78 -0
  123. package/content/templates/common-paper-partnership-agreement/replacements.json +7 -0
  124. package/content/templates/common-paper-partnership-agreement/template.docx +0 -0
  125. package/content/templates/common-paper-pilot-agreement/README.md +34 -0
  126. package/content/templates/common-paper-pilot-agreement/metadata.yaml +100 -0
  127. package/content/templates/common-paper-pilot-agreement/replacements.json +4 -0
  128. package/content/templates/common-paper-pilot-agreement/selections.json +37 -0
  129. package/content/templates/common-paper-pilot-agreement/template.docx +0 -0
  130. package/content/templates/common-paper-professional-services-agreement/README.md +44 -0
  131. package/content/templates/common-paper-professional-services-agreement/metadata.yaml +124 -0
  132. package/content/templates/common-paper-professional-services-agreement/replacements.json +8 -0
  133. package/content/templates/common-paper-professional-services-agreement/template.docx +0 -0
  134. package/content/templates/common-paper-software-license-agreement/README.md +18 -0
  135. package/content/templates/common-paper-software-license-agreement/metadata.yaml +13 -0
  136. package/content/templates/common-paper-software-license-agreement/template.docx +0 -0
  137. package/content/templates/common-paper-statement-of-work/README.md +32 -0
  138. package/content/templates/common-paper-statement-of-work/metadata.yaml +71 -0
  139. package/content/templates/common-paper-statement-of-work/replacements.json +3 -0
  140. package/content/templates/common-paper-statement-of-work/template.docx +0 -0
  141. package/content/templates/common-paper-term-sheet/README.md +22 -0
  142. package/content/templates/common-paper-term-sheet/metadata.yaml +28 -0
  143. package/content/templates/common-paper-term-sheet/template.docx +0 -0
  144. package/content/templates/openagreements-employee-ip-inventions-assignment/README.md +31 -0
  145. package/content/templates/openagreements-employee-ip-inventions-assignment/metadata.yaml +71 -0
  146. package/content/templates/openagreements-employee-ip-inventions-assignment/template.docx +0 -0
  147. package/content/templates/openagreements-employee-ip-inventions-assignment/template.md +80 -0
  148. package/content/templates/openagreements-employment-confidentiality-acknowledgement/README.md +30 -0
  149. package/content/templates/openagreements-employment-confidentiality-acknowledgement/metadata.yaml +60 -0
  150. package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.docx +0 -0
  151. package/content/templates/openagreements-employment-confidentiality-acknowledgement/template.md +51 -0
  152. package/content/templates/openagreements-employment-offer-letter/README.md +33 -0
  153. package/content/templates/openagreements-employment-offer-letter/metadata.yaml +75 -0
  154. package/content/templates/openagreements-employment-offer-letter/template.docx +0 -0
  155. package/content/templates/openagreements-employment-offer-letter/template.md +90 -0
  156. package/content/templates/working-group-list/metadata.yaml +22 -0
  157. package/content/templates/working-group-list/template.docx +0 -0
  158. package/dist/cli/index.d.ts +4 -0
  159. package/dist/cli/index.d.ts.map +1 -0
  160. package/dist/cli/index.js +199 -0
  161. package/dist/cli/index.js.map +1 -0
  162. package/dist/commands/checklist.d.ts +22 -0
  163. package/dist/commands/checklist.d.ts.map +1 -0
  164. package/dist/commands/checklist.js +222 -0
  165. package/dist/commands/checklist.js.map +1 -0
  166. package/dist/commands/fill.d.ts +18 -0
  167. package/dist/commands/fill.d.ts.map +1 -0
  168. package/dist/commands/fill.js +119 -0
  169. package/dist/commands/fill.js.map +1 -0
  170. package/dist/commands/list.d.ts +7 -0
  171. package/dist/commands/list.d.ts.map +1 -0
  172. package/dist/commands/list.js +247 -0
  173. package/dist/commands/list.js.map +1 -0
  174. package/dist/commands/recipe.d.ts +24 -0
  175. package/dist/commands/recipe.d.ts.map +1 -0
  176. package/dist/commands/recipe.js +96 -0
  177. package/dist/commands/recipe.js.map +1 -0
  178. package/dist/commands/scan.d.ts +28 -0
  179. package/dist/commands/scan.d.ts.map +1 -0
  180. package/dist/commands/scan.js +138 -0
  181. package/dist/commands/scan.js.map +1 -0
  182. package/dist/commands/validate.d.ts +6 -0
  183. package/dist/commands/validate.d.ts.map +1 -0
  184. package/dist/commands/validate.js +158 -0
  185. package/dist/commands/validate.js.map +1 -0
  186. package/dist/core/checklist/index.d.ts +38 -0
  187. package/dist/core/checklist/index.d.ts.map +1 -0
  188. package/dist/core/checklist/index.js +229 -0
  189. package/dist/core/checklist/index.js.map +1 -0
  190. package/dist/core/checklist/patch-apply.d.ts +65 -0
  191. package/dist/core/checklist/patch-apply.d.ts.map +1 -0
  192. package/dist/core/checklist/patch-apply.js +274 -0
  193. package/dist/core/checklist/patch-apply.js.map +1 -0
  194. package/dist/core/checklist/patch-schemas.d.ts +86 -0
  195. package/dist/core/checklist/patch-schemas.d.ts.map +1 -0
  196. package/dist/core/checklist/patch-schemas.js +89 -0
  197. package/dist/core/checklist/patch-schemas.js.map +1 -0
  198. package/dist/core/checklist/patch-validator.d.ts +76 -0
  199. package/dist/core/checklist/patch-validator.d.ts.map +1 -0
  200. package/dist/core/checklist/patch-validator.js +404 -0
  201. package/dist/core/checklist/patch-validator.js.map +1 -0
  202. package/dist/core/checklist/schemas.d.ts +270 -0
  203. package/dist/core/checklist/schemas.d.ts.map +1 -0
  204. package/dist/core/checklist/schemas.js +229 -0
  205. package/dist/core/checklist/schemas.js.map +1 -0
  206. package/dist/core/checklist/test-utils.d.ts +7 -0
  207. package/dist/core/checklist/test-utils.d.ts.map +1 -0
  208. package/dist/core/checklist/test-utils.js +13 -0
  209. package/dist/core/checklist/test-utils.js.map +1 -0
  210. package/dist/core/command-generation/adapters/claude.d.ts +11 -0
  211. package/dist/core/command-generation/adapters/claude.d.ts.map +1 -0
  212. package/dist/core/command-generation/adapters/claude.js +91 -0
  213. package/dist/core/command-generation/adapters/claude.js.map +1 -0
  214. package/dist/core/command-generation/types.d.ts +14 -0
  215. package/dist/core/command-generation/types.d.ts.map +1 -0
  216. package/dist/core/command-generation/types.js +2 -0
  217. package/dist/core/command-generation/types.js.map +1 -0
  218. package/dist/core/employment/jurisdiction-rules.d.ts +20 -0
  219. package/dist/core/employment/jurisdiction-rules.d.ts.map +1 -0
  220. package/dist/core/employment/jurisdiction-rules.js +57 -0
  221. package/dist/core/employment/jurisdiction-rules.js.map +1 -0
  222. package/dist/core/employment/memo.d.ts +57 -0
  223. package/dist/core/employment/memo.d.ts.map +1 -0
  224. package/dist/core/employment/memo.js +589 -0
  225. package/dist/core/employment/memo.js.map +1 -0
  226. package/dist/core/engine.d.ts +13 -0
  227. package/dist/core/engine.d.ts.map +1 -0
  228. package/dist/core/engine.js +182 -0
  229. package/dist/core/engine.js.map +1 -0
  230. package/dist/core/external/index.d.ts +8 -0
  231. package/dist/core/external/index.d.ts.map +1 -0
  232. package/dist/core/external/index.js +50 -0
  233. package/dist/core/external/index.js.map +1 -0
  234. package/dist/core/external/types.d.ts +18 -0
  235. package/dist/core/external/types.d.ts.map +1 -0
  236. package/dist/core/external/types.js +2 -0
  237. package/dist/core/external/types.js.map +1 -0
  238. package/dist/core/fill-pipeline.d.ts +64 -0
  239. package/dist/core/fill-pipeline.d.ts.map +1 -0
  240. package/dist/core/fill-pipeline.js +350 -0
  241. package/dist/core/fill-pipeline.js.map +1 -0
  242. package/dist/core/fill-utils.d.ts +39 -0
  243. package/dist/core/fill-utils.d.ts.map +1 -0
  244. package/dist/core/fill-utils.js +127 -0
  245. package/dist/core/fill-utils.js.map +1 -0
  246. package/dist/core/metadata.d.ts +194 -0
  247. package/dist/core/metadata.d.ts.map +1 -0
  248. package/dist/core/metadata.js +197 -0
  249. package/dist/core/metadata.js.map +1 -0
  250. package/dist/core/recipe/bracket-normalizer.d.ts +46 -0
  251. package/dist/core/recipe/bracket-normalizer.d.ts.map +1 -0
  252. package/dist/core/recipe/bracket-normalizer.js +354 -0
  253. package/dist/core/recipe/bracket-normalizer.js.map +1 -0
  254. package/dist/core/recipe/cleaner.d.ts +27 -0
  255. package/dist/core/recipe/cleaner.d.ts.map +1 -0
  256. package/dist/core/recipe/cleaner.js +345 -0
  257. package/dist/core/recipe/cleaner.js.map +1 -0
  258. package/dist/core/recipe/computed.d.ts +136 -0
  259. package/dist/core/recipe/computed.d.ts.map +1 -0
  260. package/dist/core/recipe/computed.js +225 -0
  261. package/dist/core/recipe/computed.js.map +1 -0
  262. package/dist/core/recipe/downloader.d.ts +8 -0
  263. package/dist/core/recipe/downloader.d.ts.map +1 -0
  264. package/dist/core/recipe/downloader.js +58 -0
  265. package/dist/core/recipe/downloader.js.map +1 -0
  266. package/dist/core/recipe/index.d.ts +17 -0
  267. package/dist/core/recipe/index.d.ts.map +1 -0
  268. package/dist/core/recipe/index.js +90 -0
  269. package/dist/core/recipe/index.js.map +1 -0
  270. package/dist/core/recipe/ooxml-parts.d.ts +21 -0
  271. package/dist/core/recipe/ooxml-parts.d.ts.map +1 -0
  272. package/dist/core/recipe/ooxml-parts.js +33 -0
  273. package/dist/core/recipe/ooxml-parts.js.map +1 -0
  274. package/dist/core/recipe/patcher.d.ts +34 -0
  275. package/dist/core/recipe/patcher.d.ts.map +1 -0
  276. package/dist/core/recipe/patcher.js +423 -0
  277. package/dist/core/recipe/patcher.js.map +1 -0
  278. package/dist/core/recipe/replacement-keys.d.ts +33 -0
  279. package/dist/core/recipe/replacement-keys.d.ts.map +1 -0
  280. package/dist/core/recipe/replacement-keys.js +53 -0
  281. package/dist/core/recipe/replacement-keys.js.map +1 -0
  282. package/dist/core/recipe/source-drift.d.ts +33 -0
  283. package/dist/core/recipe/source-drift.d.ts.map +1 -0
  284. package/dist/core/recipe/source-drift.js +113 -0
  285. package/dist/core/recipe/source-drift.js.map +1 -0
  286. package/dist/core/recipe/types.d.ts +33 -0
  287. package/dist/core/recipe/types.d.ts.map +1 -0
  288. package/dist/core/recipe/types.js +2 -0
  289. package/dist/core/recipe/types.js.map +1 -0
  290. package/dist/core/recipe/verifier.d.ts +24 -0
  291. package/dist/core/recipe/verifier.d.ts.map +1 -0
  292. package/dist/core/recipe/verifier.js +158 -0
  293. package/dist/core/recipe/verifier.js.map +1 -0
  294. package/dist/core/selector.d.ts +41 -0
  295. package/dist/core/selector.d.ts.map +1 -0
  296. package/dist/core/selector.js +323 -0
  297. package/dist/core/selector.js.map +1 -0
  298. package/dist/core/unified-pipeline.d.ts +53 -0
  299. package/dist/core/unified-pipeline.d.ts.map +1 -0
  300. package/dist/core/unified-pipeline.js +107 -0
  301. package/dist/core/unified-pipeline.js.map +1 -0
  302. package/dist/core/validation/external.d.ts +16 -0
  303. package/dist/core/validation/external.d.ts.map +1 -0
  304. package/dist/core/validation/external.js +114 -0
  305. package/dist/core/validation/external.js.map +1 -0
  306. package/dist/core/validation/license.d.ts +15 -0
  307. package/dist/core/validation/license.d.ts.map +1 -0
  308. package/dist/core/validation/license.js +30 -0
  309. package/dist/core/validation/license.js.map +1 -0
  310. package/dist/core/validation/output.d.ts +12 -0
  311. package/dist/core/validation/output.d.ts.map +1 -0
  312. package/dist/core/validation/output.js +47 -0
  313. package/dist/core/validation/output.js.map +1 -0
  314. package/dist/core/validation/recipe.d.ts +19 -0
  315. package/dist/core/validation/recipe.d.ts.map +1 -0
  316. package/dist/core/validation/recipe.js +159 -0
  317. package/dist/core/validation/recipe.js.map +1 -0
  318. package/dist/core/validation/scan-metadata.d.ts +21 -0
  319. package/dist/core/validation/scan-metadata.d.ts.map +1 -0
  320. package/dist/core/validation/scan-metadata.js +70 -0
  321. package/dist/core/validation/scan-metadata.js.map +1 -0
  322. package/dist/core/validation/template.d.ts +11 -0
  323. package/dist/core/validation/template.d.ts.map +1 -0
  324. package/dist/core/validation/template.js +248 -0
  325. package/dist/core/validation/template.js.map +1 -0
  326. package/dist/index.d.ts +16 -0
  327. package/dist/index.d.ts.map +1 -0
  328. package/dist/index.js +23 -0
  329. package/dist/index.js.map +1 -0
  330. package/dist/utils/paths.d.ts +43 -0
  331. package/dist/utils/paths.d.ts.map +1 -0
  332. package/dist/utils/paths.js +149 -0
  333. package/dist/utils/paths.js.map +1 -0
  334. package/package.json +148 -0
  335. package/skills/cloud-service-agreement/CONNECTORS.md +19 -0
  336. package/skills/cloud-service-agreement/SKILL.md +172 -0
  337. package/skills/data-privacy-agreement/CONNECTORS.md +19 -0
  338. package/skills/data-privacy-agreement/SKILL.md +158 -0
  339. package/skills/delaware-franchise-tax/CONNECTORS.md +16 -0
  340. package/skills/delaware-franchise-tax/SKILL.md +206 -0
  341. package/skills/delaware-franchise-tax/reference/ecorp-portal-playwright-notes.md +136 -0
  342. package/skills/delaware-franchise-tax/reference/faq.md +101 -0
  343. package/skills/delaware-franchise-tax/reference/filing-instructions.md +111 -0
  344. package/skills/delaware-franchise-tax/reference/tax-calculation.md +167 -0
  345. package/skills/employment-contract/CONNECTORS.md +19 -0
  346. package/skills/employment-contract/SKILL.md +157 -0
  347. package/skills/nda/CONNECTORS.md +19 -0
  348. package/skills/nda/SKILL.md +153 -0
  349. package/skills/open-agreements/CONNECTORS.md +19 -0
  350. package/skills/open-agreements/SKILL.md +182 -0
  351. package/skills/safe/CONNECTORS.md +19 -0
  352. package/skills/safe/SKILL.md +161 -0
  353. package/skills/services-agreement/CONNECTORS.md +19 -0
  354. package/skills/services-agreement/SKILL.md +156 -0
  355. package/skills/unit-test-philosophy/SKILL.md +113 -0
  356. package/skills/unit-test-philosophy/references/allure-test-spec-writing-guide.md +164 -0
  357. package/skills/venture-financing/CONNECTORS.md +19 -0
  358. package/skills/venture-financing/SKILL.md +169 -0
@@ -0,0 +1,158 @@
1
+ import { validateMetadata } from '../core/metadata.js';
2
+ import { validateTemplate } from '../core/validation/template.js';
3
+ import { validateLicense } from '../core/validation/license.js';
4
+ import { validateRecipe } from '../core/validation/recipe.js';
5
+ import { validateExternal } from '../core/validation/external.js';
6
+ import { findExternalDir, findRecipeDir, findTemplateDir, listExternalEntries, listRecipeEntries, listTemplateEntries, } from '../utils/paths.js';
7
+ export function runValidate(args) {
8
+ if (args.template) {
9
+ runValidateSingle(args);
10
+ return;
11
+ }
12
+ let hasErrors = false;
13
+ // Validate templates
14
+ hasErrors = validateTemplates(listTemplateEntries().map((entry) => ({
15
+ id: entry.id,
16
+ dir: entry.dir,
17
+ }))) || hasErrors;
18
+ // Validate external templates (unless a specific template was requested)
19
+ hasErrors = validateExternalTemplates(listExternalEntries().map((entry) => ({
20
+ id: entry.id,
21
+ dir: entry.dir,
22
+ }))) || hasErrors;
23
+ // Validate recipes (unless a specific template was requested)
24
+ hasErrors = validateRecipes(listRecipeEntries().map((entry) => ({ id: entry.id, dir: entry.dir })), args) || hasErrors;
25
+ if (hasErrors) {
26
+ console.error('Validation FAILED');
27
+ process.exit(1);
28
+ }
29
+ else {
30
+ console.log('Validation PASSED');
31
+ }
32
+ }
33
+ function runValidateSingle(args) {
34
+ const id = args.template;
35
+ const templateDir = findTemplateDir(id);
36
+ if (templateDir) {
37
+ const hasErrors = validateTemplates([{ id, dir: templateDir }]);
38
+ if (hasErrors) {
39
+ console.error('Validation FAILED');
40
+ process.exit(1);
41
+ }
42
+ console.log('Validation PASSED');
43
+ return;
44
+ }
45
+ const externalDir = findExternalDir(id);
46
+ if (externalDir) {
47
+ const hasErrors = validateExternalTemplates([{ id, dir: externalDir }]);
48
+ if (hasErrors) {
49
+ console.error('Validation FAILED');
50
+ process.exit(1);
51
+ }
52
+ console.log('Validation PASSED');
53
+ return;
54
+ }
55
+ const recipeDir = findRecipeDir(id);
56
+ if (recipeDir) {
57
+ const hasErrors = validateRecipes([{ id, dir: recipeDir }], args);
58
+ if (hasErrors) {
59
+ console.error('Validation FAILED');
60
+ process.exit(1);
61
+ }
62
+ console.log('Validation PASSED');
63
+ return;
64
+ }
65
+ console.error(`Agreement "${id}" not found in templates, external, or recipes.`);
66
+ process.exit(1);
67
+ }
68
+ function validateTemplates(entries) {
69
+ if (entries.length === 0) {
70
+ console.log('No templates found.');
71
+ return false;
72
+ }
73
+ let hasErrors = false;
74
+ for (const entry of entries) {
75
+ const id = entry.id;
76
+ const dir = entry.dir;
77
+ console.log(`\nValidating template: ${id}`);
78
+ const metaResult = validateMetadata(dir);
79
+ if (!metaResult.valid) {
80
+ hasErrors = true;
81
+ console.error(` FAIL metadata: ${metaResult.errors.join('; ')}`);
82
+ }
83
+ else {
84
+ console.log(' PASS metadata');
85
+ }
86
+ const tmplResult = validateTemplate(dir, id);
87
+ if (!tmplResult.valid) {
88
+ hasErrors = true;
89
+ for (const e of tmplResult.errors)
90
+ console.error(` FAIL template: ${e}`);
91
+ }
92
+ else {
93
+ console.log(' PASS template');
94
+ }
95
+ for (const w of tmplResult.warnings)
96
+ console.log(` WARN template: ${w}`);
97
+ const licResult = validateLicense(dir, id);
98
+ if (!licResult.valid) {
99
+ hasErrors = true;
100
+ for (const e of licResult.errors)
101
+ console.error(` FAIL license: ${e}`);
102
+ }
103
+ else {
104
+ console.log(' PASS license');
105
+ }
106
+ }
107
+ console.log(`\n${entries.length} template(s) validated.`);
108
+ return hasErrors;
109
+ }
110
+ function validateExternalTemplates(entries) {
111
+ if (entries.length === 0) {
112
+ return false;
113
+ }
114
+ let hasErrors = false;
115
+ for (const entry of entries) {
116
+ const id = entry.id;
117
+ const dir = entry.dir;
118
+ console.log(`\nValidating external: ${id}`);
119
+ const result = validateExternal(dir, id);
120
+ if (!result.valid) {
121
+ hasErrors = true;
122
+ for (const e of result.errors)
123
+ console.error(` FAIL: ${e}`);
124
+ }
125
+ else {
126
+ console.log(' PASS');
127
+ }
128
+ for (const w of result.warnings)
129
+ console.log(` WARN: ${w}`);
130
+ }
131
+ console.log(`\n${entries.length} external template(s) validated.`);
132
+ return hasErrors;
133
+ }
134
+ function validateRecipes(entries, args) {
135
+ if (entries.length === 0) {
136
+ return false;
137
+ }
138
+ let hasErrors = false;
139
+ for (const entry of entries) {
140
+ const id = entry.id;
141
+ const dir = entry.dir;
142
+ console.log(`\nValidating recipe: ${id}`);
143
+ const result = validateRecipe(dir, id, { strict: args.strict });
144
+ if (!result.valid) {
145
+ hasErrors = true;
146
+ for (const e of result.errors)
147
+ console.error(` FAIL: ${e}`);
148
+ }
149
+ else {
150
+ console.log(` PASS${result.scaffold ? ' (scaffold)' : ''}`);
151
+ }
152
+ for (const w of result.warnings)
153
+ console.log(` WARN: ${w}`);
154
+ }
155
+ console.log(`\n${entries.length} recipe(s) validated.`);
156
+ return hasErrors;
157
+ }
158
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,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,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ;YAAE,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,MAAM,uBAAuB,CAAC,CAAC;IACxD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,38 @@
1
+ export { ClosingChecklistSchema, type ClosingChecklist } from './schemas.js';
2
+ export { ChecklistPatchModeEnum, JsonPointerSchema, PatchCitationSchema, ChecklistPatchSourceEventSchema, ChecklistPatchOperationSchema, ChecklistPatchEnvelopeSchema, ChecklistPatchApplyRequestSchema, type ChecklistPatchMode, type JsonPointer, type PatchCitation, type ChecklistPatchSourceEvent, type ChecklistPatchOperation, type ChecklistPatchEnvelope, type ChecklistPatchApplyRequest, } from './patch-schemas.js';
3
+ export { CHECKLIST_PATCH_VALIDATION_TTL_MS, DANGEROUS_KEYS, applyChecklistPatchOperations, computeChecklistPatchHash, validateChecklistPatch, getChecklistPatchValidationArtifact, setChecklistPatchValidationStore, getChecklistPatchValidationStore, type ChecklistPatchValidationErrorCode, type ChecklistPatchValidationDiagnostic, type ResolvedChecklistPatchOperation, type ChecklistPatchValidationArtifact, type ChecklistPatchValidationStore, type ValidateChecklistPatchInput, type ChecklistPatchValidationSuccess, type ChecklistPatchValidationFailure, type ChecklistPatchValidationResult, } from './patch-validator.js';
4
+ export { applyChecklistPatch, setChecklistAppliedPatchStore, getChecklistAppliedPatchStore, setChecklistProposedPatchStore, getChecklistProposedPatchStore, type ChecklistAppliedPatchRecord, type ChecklistAppliedPatchStore, type ChecklistProposedPatchRecord, type ChecklistProposedPatchStore, type ChecklistPatchApplyErrorCode, type ChecklistPatchApplyFailure, type ChecklistPatchApplySuccess, type ChecklistPatchApplyResult, type ApplyChecklistPatchInput, } from './patch-apply.js';
5
+ interface LegacyTemplateDocumentRow {
6
+ document_name: string;
7
+ status: string;
8
+ }
9
+ interface LegacyTemplateActionRow {
10
+ item_id: string;
11
+ description: string;
12
+ status: string;
13
+ assigned_to: {
14
+ organization: string;
15
+ };
16
+ due_date: string;
17
+ }
18
+ interface LegacyTemplateIssueRow {
19
+ issue_id: string;
20
+ title: string;
21
+ status: string;
22
+ escalation_tier: string;
23
+ resolution: string;
24
+ }
25
+ export interface ChecklistTemplateContext {
26
+ deal_name: string;
27
+ updated_at: string;
28
+ working_group: Array<Record<string, unknown>>;
29
+ documents: LegacyTemplateDocumentRow[];
30
+ action_items: LegacyTemplateActionRow[];
31
+ open_issues: LegacyTemplateIssueRow[];
32
+ }
33
+ /**
34
+ * Build template values for the legacy closing-checklist DOCX template from
35
+ * document-first v2 checklist input.
36
+ */
37
+ export declare function buildChecklistTemplateContext(data: unknown): ChecklistTemplateContext;
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/checklist/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,gCAAgC,EAChC,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,GAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iCAAiC,EACjC,cAAc,EACd,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,mCAAmC,EACnC,gCAAgC,EAChC,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AAC;IACxC,WAAW,EAAE,sBAAsB,EAAE,CAAC;CACvC;AAiKD;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,OAAO,GAAG,wBAAwB,CA2ErF"}
@@ -0,0 +1,229 @@
1
+ import { ClosingChecklistSchema, } from './schemas.js';
2
+ export { ClosingChecklistSchema } from './schemas.js';
3
+ export { ChecklistPatchModeEnum, JsonPointerSchema, PatchCitationSchema, ChecklistPatchSourceEventSchema, ChecklistPatchOperationSchema, ChecklistPatchEnvelopeSchema, ChecklistPatchApplyRequestSchema, } from './patch-schemas.js';
4
+ export { CHECKLIST_PATCH_VALIDATION_TTL_MS, DANGEROUS_KEYS, applyChecklistPatchOperations, computeChecklistPatchHash, validateChecklistPatch, getChecklistPatchValidationArtifact, setChecklistPatchValidationStore, getChecklistPatchValidationStore, } from './patch-validator.js';
5
+ export { applyChecklistPatch, setChecklistAppliedPatchStore, getChecklistAppliedPatchStore, setChecklistProposedPatchStore, getChecklistProposedPatchStore, } from './patch-apply.js';
6
+ const STAGE_ORDER = ['PRE_SIGNING', 'SIGNING', 'CLOSING', 'POST_CLOSING'];
7
+ const STAGE_HEADINGS = {
8
+ PRE_SIGNING: 'PRE-SIGNING',
9
+ SIGNING: 'SIGNING',
10
+ CLOSING: 'CLOSING',
11
+ POST_CLOSING: 'POST-CLOSING',
12
+ };
13
+ const STAGE_ROMANS = ['I', 'II', 'III', 'IV'];
14
+ function compareBySortKey(a, b) {
15
+ const keyCompare = a.sort_key.localeCompare(b.sort_key, undefined, { numeric: true, sensitivity: 'base' });
16
+ if (keyCompare !== 0)
17
+ return keyCompare;
18
+ return a.entry_id.localeCompare(b.entry_id);
19
+ }
20
+ function nonEmpty(values) {
21
+ return values.map((v) => v.trim()).filter((v) => v.length > 0);
22
+ }
23
+ function responsibilityLabel(responsibility) {
24
+ if (!responsibility)
25
+ return '';
26
+ return nonEmpty([
27
+ responsibility.individual_name ?? '',
28
+ responsibility.organization ?? '',
29
+ responsibility.role ?? '',
30
+ ]).join(', ');
31
+ }
32
+ function citationLabel(citation) {
33
+ const base = citation.text ?? citation.ref ?? '';
34
+ const sources = nonEmpty([citation.link ?? '', citation.filepath ?? '']);
35
+ if (!base)
36
+ return sources.join(' | ');
37
+ if (sources.length === 0)
38
+ return base;
39
+ return `${base} (${sources.join(' | ')})`;
40
+ }
41
+ function latestCitationLabel(citations) {
42
+ if (citations.length === 0)
43
+ return '';
44
+ return citationLabel(citations[citations.length - 1]);
45
+ }
46
+ function signatoryLabel(signatory) {
47
+ const who = nonEmpty([signatory.party, signatory.name ?? '', signatory.title ?? '']).join(' ');
48
+ const artifacts = signatory.signature_artifacts
49
+ .map((artifact) => artifact.uri ?? artifact.path ?? '')
50
+ .filter((value) => value.length > 0);
51
+ if (artifacts.length === 0) {
52
+ return `${who} [${signatory.status}]`;
53
+ }
54
+ return `${who} [${signatory.status}] (${artifacts.join(', ')})`;
55
+ }
56
+ function toArray(collection) {
57
+ return Array.isArray(collection) ? collection : Object.values(collection);
58
+ }
59
+ function buildRenderModel(data) {
60
+ const checklist = ClosingChecklistSchema.parse(data);
61
+ const documents = toArray(checklist.documents);
62
+ const entries = toArray(checklist.checklist_entries);
63
+ const actions = toArray(checklist.action_items);
64
+ const issues = toArray(checklist.issues);
65
+ const documentsById = new Map(documents.map((document) => [document.document_id, document]));
66
+ const entryDocumentIds = new Set(entries
67
+ .map((entry) => entry.document_id)
68
+ .filter((documentId) => Boolean(documentId)));
69
+ const actionsByDocument = new Map();
70
+ const unlinkedActions = [];
71
+ for (const action of actions) {
72
+ const linkedDocumentIds = action.related_document_ids.filter((documentId) => entryDocumentIds.has(documentId));
73
+ if (linkedDocumentIds.length === 0) {
74
+ unlinkedActions.push(action);
75
+ continue;
76
+ }
77
+ for (const documentId of linkedDocumentIds) {
78
+ const current = actionsByDocument.get(documentId) ?? [];
79
+ current.push(action);
80
+ actionsByDocument.set(documentId, current);
81
+ }
82
+ }
83
+ const issuesByDocument = new Map();
84
+ const unlinkedIssues = [];
85
+ for (const issue of issues) {
86
+ const linkedDocumentIds = issue.related_document_ids.filter((documentId) => entryDocumentIds.has(documentId));
87
+ if (linkedDocumentIds.length === 0) {
88
+ unlinkedIssues.push(issue);
89
+ continue;
90
+ }
91
+ for (const documentId of linkedDocumentIds) {
92
+ const current = issuesByDocument.get(documentId) ?? [];
93
+ current.push(issue);
94
+ issuesByDocument.set(documentId, current);
95
+ }
96
+ }
97
+ for (const actionGroup of actionsByDocument.values()) {
98
+ actionGroup.sort((a, b) => a.action_id.localeCompare(b.action_id));
99
+ }
100
+ for (const issueGroup of issuesByDocument.values()) {
101
+ issueGroup.sort((a, b) => a.issue_id.localeCompare(b.issue_id));
102
+ }
103
+ unlinkedActions.sort((a, b) => a.action_id.localeCompare(b.action_id));
104
+ unlinkedIssues.sort((a, b) => a.issue_id.localeCompare(b.issue_id));
105
+ const rowsByStage = new Map();
106
+ for (const stage of STAGE_ORDER) {
107
+ const stageEntries = entries
108
+ .filter((entry) => entry.stage === stage)
109
+ .sort(compareBySortKey);
110
+ const stageEntriesById = new Map(stageEntries.map((entry) => [entry.entry_id, entry]));
111
+ const childrenByParent = new Map();
112
+ const roots = [];
113
+ for (const entry of stageEntries) {
114
+ if (entry.parent_entry_id && stageEntriesById.has(entry.parent_entry_id)) {
115
+ const children = childrenByParent.get(entry.parent_entry_id) ?? [];
116
+ children.push(entry);
117
+ childrenByParent.set(entry.parent_entry_id, children);
118
+ }
119
+ else {
120
+ roots.push(entry);
121
+ }
122
+ }
123
+ roots.sort(compareBySortKey);
124
+ for (const [parentId, children] of childrenByParent.entries()) {
125
+ children.sort(compareBySortKey);
126
+ childrenByParent.set(parentId, children);
127
+ }
128
+ const stageRows = [];
129
+ const visit = (entry, depth, number) => {
130
+ const document = entry.document_id ? (documentsById.get(entry.document_id) ?? null) : null;
131
+ stageRows.push({
132
+ entry,
133
+ document,
134
+ number,
135
+ depth,
136
+ linkedActions: entry.document_id ? (actionsByDocument.get(entry.document_id) ?? []) : [],
137
+ linkedIssues: entry.document_id ? (issuesByDocument.get(entry.document_id) ?? []) : [],
138
+ });
139
+ const children = childrenByParent.get(entry.entry_id) ?? [];
140
+ children.forEach((child, index) => {
141
+ visit(child, depth + 1, `${number}.${index + 1}`);
142
+ });
143
+ };
144
+ roots.forEach((entry, index) => {
145
+ visit(entry, 0, `${index + 1}`);
146
+ });
147
+ rowsByStage.set(stage, stageRows);
148
+ }
149
+ return {
150
+ checklist,
151
+ rowsByStage,
152
+ unlinkedActions,
153
+ unlinkedIssues,
154
+ };
155
+ }
156
+ /**
157
+ * Build template values for the legacy closing-checklist DOCX template from
158
+ * document-first v2 checklist input.
159
+ */
160
+ export function buildChecklistTemplateContext(data) {
161
+ const model = buildRenderModel(data);
162
+ const documentRows = [];
163
+ STAGE_ORDER.forEach((stage, index) => {
164
+ const stageRows = model.rowsByStage.get(stage) ?? [];
165
+ if (stageRows.length === 0)
166
+ return;
167
+ documentRows.push({
168
+ document_name: `${STAGE_ROMANS[index]}. ${STAGE_HEADINGS[stage]}`,
169
+ status: '',
170
+ });
171
+ for (const row of stageRows) {
172
+ const indent = '\u00A0\u00A0'.repeat(row.depth);
173
+ const citationText = row.entry.citations.map(citationLabel).join('; ');
174
+ const linkText = row.document?.primary_link ? ` (${row.document.primary_link})` : '';
175
+ const documentName = `${row.number} ${indent}${row.entry.title}${citationText ? ` [${citationText}]` : ''}${linkText}`;
176
+ const statusParts = [row.entry.status];
177
+ if (row.entry.signatories.length > 0) {
178
+ statusParts.push(row.entry.signatories.map(signatoryLabel).join('; '));
179
+ }
180
+ const responsibility = responsibilityLabel(row.entry.responsible_party);
181
+ if (responsibility) {
182
+ statusParts.push(`Resp: ${responsibility}`);
183
+ }
184
+ documentRows.push({
185
+ document_name: documentName,
186
+ status: statusParts.join(' | '),
187
+ });
188
+ for (const action of row.linkedActions) {
189
+ const latestCitation = latestCitationLabel(action.citations);
190
+ documentRows.push({
191
+ document_name: `\u00A0\u00A0${indent}\u21B3 Action ${action.action_id}: ${action.description}`,
192
+ status: latestCitation ? `${action.status} | Evidence: ${latestCitation}` : action.status,
193
+ });
194
+ }
195
+ for (const issue of row.linkedIssues) {
196
+ const latestCitation = latestCitationLabel(issue.citations);
197
+ documentRows.push({
198
+ document_name: `\u00A0\u00A0${indent}\u21B3 Issue ${issue.issue_id}: ${issue.title}`,
199
+ status: latestCitation ? `${issue.status} | Evidence: ${latestCitation}` : issue.status,
200
+ });
201
+ }
202
+ }
203
+ });
204
+ const fallbackActions = model.unlinkedActions.map((action) => ({
205
+ item_id: action.action_id,
206
+ description: action.description,
207
+ status: latestCitationLabel(action.citations) ? `${action.status} | ${latestCitationLabel(action.citations)}` : action.status,
208
+ assigned_to: {
209
+ organization: responsibilityLabel(action.assigned_to) || '',
210
+ },
211
+ due_date: action.due_date ?? '',
212
+ }));
213
+ const fallbackIssues = model.unlinkedIssues.map((issue) => ({
214
+ issue_id: issue.issue_id,
215
+ title: issue.title,
216
+ status: issue.status,
217
+ escalation_tier: '',
218
+ resolution: nonEmpty([issue.summary ?? '', latestCitationLabel(issue.citations)]).join(' | '),
219
+ }));
220
+ return {
221
+ deal_name: model.checklist.deal_name,
222
+ updated_at: model.checklist.updated_at,
223
+ working_group: [],
224
+ documents: documentRows,
225
+ action_items: fallbackActions,
226
+ open_issues: fallbackIssues,
227
+ };
228
+ }
229
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/checklist/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,GAUvB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAyB,MAAM,cAAc,CAAC;AAC7E,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,+BAA+B,EAC/B,6BAA6B,EAC7B,4BAA4B,EAC5B,gCAAgC,GAQjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,iCAAiC,EACjC,cAAc,EACd,6BA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WAAW;QAC/B,MAAM,EAAE,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,MAAM,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM;QAC7H,WAAW,EAAE;YACX,YAAY,EAAE,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE;SAC5D;QACD,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,EAAE;KAChC,CAAC,CAAC,CAAC;IAEJ,MAAM,cAAc,GAA6B,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACpF,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,eAAe,EAAE,EAAE;QACnB,UAAU,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,EAAE,mBAAmB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;KAC9F,CAAC,CAAC,CAAC;IAEJ,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS;QACpC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU;QACtC,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,YAAY;QACvB,YAAY,EAAE,eAAe;QAC7B,WAAW,EAAE,cAAc;KAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { type ClosingChecklist } from './schemas.js';
2
+ import { type ChecklistPatchEnvelope } from './patch-schemas.js';
3
+ import { type ChecklistPatchValidationDiagnostic, type ChecklistPatchValidationStore, type ResolvedChecklistPatchOperation } from './patch-validator.js';
4
+ export interface ChecklistAppliedPatchRecord {
5
+ checklist_id: string;
6
+ patch_id: string;
7
+ patch_hash: string;
8
+ applied_at_ms: number;
9
+ revision_before: number;
10
+ revision_after: number;
11
+ patch: ChecklistPatchEnvelope;
12
+ }
13
+ export interface ChecklistAppliedPatchStore {
14
+ get(checklistId: string, patchId: string): Promise<ChecklistAppliedPatchRecord | null>;
15
+ set(record: ChecklistAppliedPatchRecord): Promise<void>;
16
+ }
17
+ export interface ChecklistProposedPatchRecord {
18
+ checklist_id: string;
19
+ patch_id: string;
20
+ patch_hash: string;
21
+ proposed_at_ms: number;
22
+ expected_revision: number;
23
+ validation_id: string;
24
+ resolved_operations: ResolvedChecklistPatchOperation[];
25
+ }
26
+ export interface ChecklistProposedPatchStore {
27
+ get(checklistId: string, patchId: string): Promise<ChecklistProposedPatchRecord | null>;
28
+ set(record: ChecklistProposedPatchRecord): Promise<void>;
29
+ }
30
+ export declare function setChecklistAppliedPatchStore(store: ChecklistAppliedPatchStore | null): void;
31
+ export declare function getChecklistAppliedPatchStore(): ChecklistAppliedPatchStore;
32
+ export declare function setChecklistProposedPatchStore(store: ChecklistProposedPatchStore | null): void;
33
+ export declare function getChecklistProposedPatchStore(): ChecklistProposedPatchStore;
34
+ export type ChecklistPatchApplyErrorCode = 'CHECKLIST_SCHEMA_INVALID' | 'APPLY_REQUEST_SCHEMA_INVALID' | 'VALIDATION_REQUIRED' | 'VALIDATION_MISMATCH' | 'REVISION_CONFLICT' | 'PATCH_ID_CONFLICT' | 'APPLY_OPERATION_FAILED' | 'POST_PATCH_SCHEMA_INVALID';
35
+ export interface ChecklistPatchApplyFailure {
36
+ ok: false;
37
+ error_code: ChecklistPatchApplyErrorCode;
38
+ message: string;
39
+ diagnostics: ChecklistPatchValidationDiagnostic[];
40
+ }
41
+ export interface ChecklistPatchApplySuccess {
42
+ ok: true;
43
+ checklist: ClosingChecklist;
44
+ previous_revision: number;
45
+ new_revision: number;
46
+ patch_id: string;
47
+ patch_hash: string;
48
+ idempotent_replay: boolean;
49
+ mode: 'APPLY' | 'PROPOSED';
50
+ applied: boolean;
51
+ resolved_operations: ResolvedChecklistPatchOperation[];
52
+ }
53
+ export type ChecklistPatchApplyResult = ChecklistPatchApplySuccess | ChecklistPatchApplyFailure;
54
+ export interface ApplyChecklistPatchInput {
55
+ checklist_id: string;
56
+ checklist: unknown;
57
+ current_revision: number;
58
+ request: unknown;
59
+ now_ms?: number;
60
+ validation_store?: ChecklistPatchValidationStore;
61
+ applied_patch_store?: ChecklistAppliedPatchStore;
62
+ proposed_patch_store?: ChecklistProposedPatchStore;
63
+ }
64
+ export declare function applyChecklistPatch(input: ApplyChecklistPatchInput): Promise<ChecklistPatchApplyResult>;
65
+ //# sourceMappingURL=patch-apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-apply.d.ts","sourceRoot":"","sources":["../../../src/core/checklist/patch-apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAqE,KAAK,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACpI,OAAO,EAKL,KAAK,kCAAkC,EACvC,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACrC,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,sBAAsB,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC,CAAC;IACvF,GAAG,CAAC,MAAM,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,4BAA4B;I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