@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,248 @@
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import AdmZip from 'adm-zip';
4
+ import { loadMetadata } from '../metadata.js';
5
+ import { extractSearchText } from '../recipe/replacement-keys.js';
6
+ /**
7
+ * Extract text content from a DOCX file by unzipping and reading word/document.xml.
8
+ * Concatenates <w:t> text within each <w:p> paragraph, then joins paragraphs with
9
+ * newlines to prevent false {tag} matches across element boundaries.
10
+ */
11
+ function extractDocxText(docxPath) {
12
+ const zip = new AdmZip(docxPath);
13
+ const documentXml = zip.getEntry('word/document.xml');
14
+ if (!documentXml)
15
+ return '';
16
+ const xml = documentXml.getData().toString('utf-8');
17
+ const paragraphs = [];
18
+ const paraRegex = /<w:p[\s>][\s\S]*?<\/w:p>/g;
19
+ let paraMatch;
20
+ while ((paraMatch = paraRegex.exec(xml)) !== null) {
21
+ const paraXml = paraMatch[0];
22
+ const textParts = [];
23
+ const tRegex = /<w:t[^>]*>([^<]*)<\/w:t>/g;
24
+ let tMatch;
25
+ while ((tMatch = tRegex.exec(paraXml)) !== null) {
26
+ textParts.push(tMatch[1]);
27
+ }
28
+ if (textParts.length > 0) {
29
+ paragraphs.push(textParts.join(''));
30
+ }
31
+ }
32
+ return paragraphs.join('\n');
33
+ }
34
+ /**
35
+ * Validate that a template's metadata fields match the placeholders in its DOCX file.
36
+ */
37
+ export function validateTemplate(templateDir, templateId) {
38
+ const errors = [];
39
+ const warnings = [];
40
+ let metadata;
41
+ try {
42
+ metadata = loadMetadata(templateDir);
43
+ }
44
+ catch (err) {
45
+ return {
46
+ templateId,
47
+ valid: false,
48
+ errors: [`Failed to load metadata: ${err.message}`],
49
+ warnings: [],
50
+ };
51
+ }
52
+ const templatePath = join(templateDir, 'template.docx');
53
+ if (!existsSync(templatePath)) {
54
+ return {
55
+ templateId,
56
+ valid: false,
57
+ errors: ['template.docx not found in template directory'],
58
+ warnings: [],
59
+ };
60
+ }
61
+ const metadataFieldNames = new Set(metadata.fields.map((f) => f.name));
62
+ const requiredFieldNames = new Set(metadata.required_fields);
63
+ // Check if this template uses declarative replacements
64
+ const replacementsPath = join(templateDir, 'replacements.json');
65
+ const hasReplacements = existsSync(replacementsPath);
66
+ if (hasReplacements) {
67
+ // Declarative pipeline: tags are in replacement values, not DOCX text.
68
+ // Validate replacement keys exist in DOCX, and replacement value tags match metadata.
69
+ let replacements;
70
+ try {
71
+ replacements = JSON.parse(readFileSync(replacementsPath, 'utf-8'));
72
+ }
73
+ catch (err) {
74
+ return {
75
+ templateId,
76
+ valid: false,
77
+ errors: [`Failed to parse replacements.json: ${err.message}`],
78
+ warnings,
79
+ };
80
+ }
81
+ const docxText = extractDocxText(templatePath);
82
+ // Validate replacement keys exist in the original DOCX text
83
+ for (const key of Object.keys(replacements)) {
84
+ const searchText = extractSearchText(key);
85
+ if (!docxText.includes(searchText)) {
86
+ errors.push(`Replacement key "${searchText}" not found in template.docx`);
87
+ }
88
+ }
89
+ // Collect {tags} from replacement values and the DOCX text
90
+ const foundTags = new Set();
91
+ const foundConditionalFields = new Set();
92
+ // Tags from replacement values (these will exist after patching)
93
+ for (const value of Object.values(replacements)) {
94
+ const placeholderRegex = /\{(\w+)\}/g;
95
+ let match;
96
+ while ((match = placeholderRegex.exec(value)) !== null) {
97
+ foundTags.add(match[1]);
98
+ }
99
+ const conditionalRegex = /\{IF !?(\w+)\}/g;
100
+ let condMatch;
101
+ while ((condMatch = conditionalRegex.exec(value)) !== null) {
102
+ foundConditionalFields.add(condMatch[1]);
103
+ }
104
+ }
105
+ // Tags already in the DOCX (may exist alongside replacements)
106
+ const docxPlaceholderRegex = /\{(\w+)\}/g;
107
+ let docxMatch;
108
+ while ((docxMatch = docxPlaceholderRegex.exec(docxText)) !== null) {
109
+ foundTags.add(docxMatch[1]);
110
+ }
111
+ const docxConditionalRegex = /\{IF !?(\w+)\}/g;
112
+ let docxCondMatch;
113
+ while ((docxCondMatch = docxConditionalRegex.exec(docxText)) !== null) {
114
+ foundConditionalFields.add(docxCondMatch[1]);
115
+ }
116
+ // Check metadata fields are covered by tags
117
+ for (const fieldName of metadataFieldNames) {
118
+ const inTags = foundTags.has(fieldName) || foundConditionalFields.has(fieldName);
119
+ if (!inTags) {
120
+ if (requiredFieldNames.has(fieldName)) {
121
+ errors.push(`Required field "${fieldName}" defined in metadata but not found in replacement values or template.docx`);
122
+ }
123
+ else {
124
+ warnings.push(`Optional field "${fieldName}" defined in metadata but not found in replacement values or template.docx`);
125
+ }
126
+ }
127
+ }
128
+ // Check for tags not in metadata
129
+ const controlTokens = new Set(['IF', 'END']);
130
+ for (const tag of foundTags) {
131
+ if (controlTokens.has(tag))
132
+ continue;
133
+ if (!metadataFieldNames.has(tag)) {
134
+ warnings.push(`Placeholder {${tag}} found in replacements/template but not defined in metadata fields`);
135
+ }
136
+ }
137
+ }
138
+ else {
139
+ // Original behavior: scan DOCX text directly for {tags}
140
+ const text = extractDocxText(templatePath);
141
+ const placeholderRegex = /\{(\w+)\}/g;
142
+ const foundTags = new Set();
143
+ let match;
144
+ while ((match = placeholderRegex.exec(text)) !== null) {
145
+ foundTags.add(match[1]);
146
+ }
147
+ const conditionalRegex = /\{IF !?(\w+)\}/g;
148
+ const foundConditionalFields = new Set();
149
+ let condMatch;
150
+ while ((condMatch = conditionalRegex.exec(text)) !== null) {
151
+ foundConditionalFields.add(condMatch[1]);
152
+ }
153
+ // Extract array field names from FOR loop constructs
154
+ const forLoopRegex = /\{FOR \w+ IN (\w+)\}/g;
155
+ let forMatch;
156
+ while ((forMatch = forLoopRegex.exec(text)) !== null) {
157
+ foundTags.add(forMatch[1]);
158
+ }
159
+ // Security: scan for docx-templates control/code tags that should not exist
160
+ // in open-source templates. Only simple {identifier} tags are allowed.
161
+ const rawXml = extractRawDocumentXml(templatePath);
162
+ if (rawXml) {
163
+ scanForUnsafeTemplateTags(rawXml, errors);
164
+ }
165
+ // Check for fields in metadata but not in DOCX
166
+ for (const fieldName of metadataFieldNames) {
167
+ const inDocx = foundTags.has(fieldName) || foundConditionalFields.has(fieldName);
168
+ if (!inDocx) {
169
+ if (requiredFieldNames.has(fieldName)) {
170
+ errors.push(`Required field "${fieldName}" defined in metadata but not found as {${fieldName}} in template.docx`);
171
+ }
172
+ else {
173
+ warnings.push(`Optional field "${fieldName}" defined in metadata but not found as {${fieldName}} in template.docx`);
174
+ }
175
+ }
176
+ }
177
+ // Check for placeholders in DOCX but not in metadata
178
+ const controlTokens = new Set(['IF', 'END']);
179
+ for (const tag of foundTags) {
180
+ if (controlTokens.has(tag))
181
+ continue;
182
+ if (!metadataFieldNames.has(tag)) {
183
+ warnings.push(`Placeholder {${tag}} found in template.docx but not defined in metadata fields`);
184
+ }
185
+ }
186
+ }
187
+ return { templateId, valid: errors.length === 0, errors, warnings };
188
+ }
189
+ /**
190
+ * Extract raw word/document.xml string from a DOCX file.
191
+ */
192
+ function extractRawDocumentXml(docxPath) {
193
+ const zip = new AdmZip(docxPath);
194
+ const entry = zip.getEntry('word/document.xml');
195
+ if (!entry)
196
+ return null;
197
+ return entry.getData().toString('utf-8');
198
+ }
199
+ /**
200
+ * Allowed tag patterns:
201
+ * {identifier} — simple placeholder
202
+ * {IF [!]identifier} — conditional start
203
+ * {END-IF} — conditional end
204
+ * {FOR var IN identifier} — loop start (docx-templates)
205
+ * {END-FOR var} — loop end
206
+ * {$var.field} / {$var.a.b} — loop variable access
207
+ */
208
+ const SAFE_TAG_RE = /^\{(?:[a-zA-Z_][a-zA-Z0-9_]*|IF !?[a-zA-Z_][a-zA-Z0-9_]*|END-IF|FOR [a-zA-Z_]\w* IN [a-zA-Z_]\w*|END-FOR [a-zA-Z_]\w*|\$[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)+)\}$/;
209
+ /**
210
+ * Scan the raw OOXML text content for any {…} tokens and reject ones that
211
+ * are not simple identifiers. This blocks docx-templates control tags
212
+ * ({#if}, {/if}, {>partial}, {= expression}, etc.) that could execute
213
+ * arbitrary code in the Node VM sandbox.
214
+ *
215
+ * We extract text from <w:t> elements and scan for curly-brace tokens,
216
+ * then also check across run boundaries within paragraphs.
217
+ */
218
+ function scanForUnsafeTemplateTags(xml, errors) {
219
+ // Extract all text content from <w:t> elements and reassemble per-paragraph
220
+ const paragraphs = [];
221
+ const paraRegex = /<w:p[\s>][\s\S]*?<\/w:p>/g;
222
+ let paraMatch;
223
+ while ((paraMatch = paraRegex.exec(xml)) !== null) {
224
+ const paraXml = paraMatch[0];
225
+ const textParts = [];
226
+ const tRegex = /<w:t[^>]*>([^<]*)<\/w:t>/g;
227
+ let tMatch;
228
+ while ((tMatch = tRegex.exec(paraXml)) !== null) {
229
+ textParts.push(tMatch[1]);
230
+ }
231
+ if (textParts.length > 0) {
232
+ paragraphs.push(textParts.join(''));
233
+ }
234
+ }
235
+ const fullText = paragraphs.join('\n');
236
+ // Find all {…} tokens in the reassembled text
237
+ const tokenRegex = /\{[^}]+\}/g;
238
+ let tokenMatch;
239
+ while ((tokenMatch = tokenRegex.exec(fullText)) !== null) {
240
+ const token = tokenMatch[0];
241
+ if (!SAFE_TAG_RE.test(token)) {
242
+ errors.push(`Unsafe template tag "${token}" found in template.docx. ` +
243
+ `Only simple {identifier}, {IF [!]identifier}, and {END-IF} tags are allowed. ` +
244
+ `Control tags ({#...}, {/...}, {>...}, {=...}) are not permitted in open-source templates.`);
245
+ }
246
+ }
247
+ }
248
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/core/validation/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AASlE;;;;GAIG;AACH,SAAS,eAAe,CAAC,QAAgB;IACvC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IACtD,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEpD,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,SAAS,GAAG,2BAA2B,CAAC;IAC9C,IAAI,SAAS,CAAC;IACd,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,2BAA2B,CAAC;QAC3C,IAAI,MAAM,CAAC;QACX,OAAO,CAAC,MAAM,GAAG,M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AE,CAAC,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEvC,8CAA8C;IAC9C,MAAM,UAAU,GAAG,YAAY,CAAC;IAChC,IAAI,UAAU,CAAC;IACf,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACzD,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CACT,wBAAwB,KAAK,4BAA4B;gBACzD,+EAA+E;gBAC/E,2FAA2F,CAC5F,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ export { fillTemplate, type FillOptions, type FillResult } from './core/engine.js';
2
+ export { loadMetadata, validateMetadata, loadRecipeMetadata, validateRecipeMetadata, loadCleanConfig, TemplateMetadataSchema, RecipeMetadataSchema, CleanConfigSchema, LicenseEnum, FieldDefinitionSchema, type TemplateMetadata, type RecipeMetadata, type CleanConfig, type FieldDefinition, type License, } from './core/metadata.js';
3
+ export { runExternalFill, type ExternalFillOptions, type ExternalFillResult, } from './core/external/index.js';
4
+ export { loadExternalMetadata, validateExternalMetadata, ExternalMetadataSchema, type ExternalMetadata, } from './core/metadata.js';
5
+ export { validateTemplate, type TemplateValidationResult } from './core/validation/template.js';
6
+ export { validateLicense, type LicenseValidationResult } from './core/validation/license.js';
7
+ export { validateOutput, type OutputValidationResult } from './core/validation/output.js';
8
+ export { validateRecipe, type RecipeValidationResult } from './core/validation/recipe.js';
9
+ export { validateExternal, type ExternalValidationResult } from './core/validation/external.js';
10
+ export { assessScanMetadataCoverage, type ScanMetadataCoverageInput, type ScanMetadataCoverageReport, } from './core/validation/scan-metadata.js';
11
+ export { runRecipe, cleanDocument, patchDocument, verifyOutput, ensureSourceDocx, checkRecipeSourceDrift, computeSourceStructureSignature, type RecipeRunOptions, type RecipeRunResult, type VerifyResult, type VerifyCheck, } from './core/recipe/index.js';
12
+ export { buildChecklistTemplateContext, ClosingChecklistSchema, ChecklistPatchEnvelopeSchema, ChecklistPatchApplyRequestSchema, ChecklistPatchOperationSchema, PatchCitationSchema, ChecklistPatchModeEnum, JsonPointerSchema, CHECKLIST_PATCH_VALIDATION_TTL_MS, applyChecklistPatchOperations, computeChecklistPatchHash, validateChecklistPatch, getChecklistPatchValidationArtifact, setChecklistPatchValidationStore, getChecklistPatchValidationStore, applyChecklistPatch, setChecklistAppliedPatchStore, getChecklistAppliedPatchStore, setChecklistProposedPatchStore, getChecklistProposedPatchStore, type ClosingChecklist, type ChecklistPatchEnvelope, type ChecklistPatchApplyRequest, type ChecklistPatchOperation, type PatchCitation, type ChecklistPatchMode, type JsonPointer, type ChecklistPatchValidationErrorCode, type ChecklistPatchValidationDiagnostic, type ResolvedChecklistPatchOperation, type ChecklistPatchValidationArtifact, type ChecklistPatchValidationStore, type ValidateChecklistPatchInput, type ChecklistPatchValidationSuccess, type ChecklistPatchValidationFailure, type ChecklistPatchValidationResult, type ChecklistAppliedPatchRecord, type ChecklistAppliedPatchStore, type ChecklistProposedPatchRecord, type ChecklistProposedPatchStore, type ChecklistPatchApplyErrorCode, type ChecklistPatchApplyFailure, type ChecklistPatchApplySuccess, type ChecklistPatchApplyResult, type ApplyChecklistPatchInput, } from './core/checklist/index.js';
13
+ export { ChecklistStageEnum, ChecklistEntryStatusEnum, SignatoryStatusEnum, ChecklistItemStatusEnum, IssueStatusEnum, ResponsibilitySchema, CitationSchema, SignatureArtifactSchema, SignatorySchema, ChecklistDocumentSchema, ChecklistEntrySchema, ActionItemSchema, IssueSchema, type ChecklistStage, type ChecklistEntryStatus, type SignatoryStatus, type ChecklistItemStatus, type IssueStatus, type Responsibility, type Citation, type SignatureArtifact, type Signatory, type ChecklistDocument, type ChecklistEntry, type ActionItem, type Issue, } from './core/checklist/schemas.js';
14
+ export type { ToolCommandAdapter } from './core/command-generation/types.js';
15
+ export { ClaudeCodeAdapter } from './core/command-generation/adapters/claude.js';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnF,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,EACrB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,OAAO,GACb,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,KAAK,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAChG,OAAO,EACL,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,GAChC,MAAM,oCAAoC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AgB,EAChB,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,KAAK,GACX,MAAM,6BAA6B,CAAC;AAGrC,YAAY,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ // Public API exports
2
+ // Template engine
3
+ export { fillTemplate } from './core/engine.js';
4
+ // Metadata schemas and loaders
5
+ export { loadMetadata, validateMetadata, loadRecipeMetadata, validateRecipeMetadata, loadCleanConfig, TemplateMetadataSchema, RecipeMetadataSchema, CleanConfigSchema, LicenseEnum, FieldDefinitionSchema, } from './core/metadata.js';
6
+ // External template engine
7
+ export { runExternalFill, } from './core/external/index.js';
8
+ // Metadata schemas and loaders (external)
9
+ export { loadExternalMetadata, validateExternalMetadata, ExternalMetadataSchema, } from './core/metadata.js';
10
+ // Template validation
11
+ export { validateTemplate } from './core/validation/template.js';
12
+ export { validateLicense } from './core/validation/license.js';
13
+ export { validateOutput } from './core/validation/output.js';
14
+ export { validateRecipe } from './core/validation/recipe.js';
15
+ export { validateExternal } from './core/validation/external.js';
16
+ export { assessScanMetadataCoverage, } from './core/validation/scan-metadata.js';
17
+ // Recipe engine
18
+ export { runRecipe, cleanDocument, patchDocument, verifyOutput, ensureSourceDocx, checkRecipeSourceDrift, computeSourceStructureSignature, } from './core/recipe/index.js';
19
+ // Closing checklist
20
+ export { buildChecklistTemplateContext, ClosingChecklistSchema, ChecklistPatchEnvelopeSchema, ChecklistPatchApplyRequestSchema, ChecklistPatchOperationSchema, PatchCitationSchema, ChecklistPatchModeEnum, JsonPointerSchema, CHECKLIST_PATCH_VALIDATION_TTL_MS, applyChecklistPatchOperations, computeChecklistPatchHash, validateChecklistPatch, getChecklistPatchValidationArtifact, setChecklistPatchValidationStore, getChecklistPatchValidationStore, applyChecklistPatch, setChecklistAppliedPatchStore, getChecklistAppliedPatchStore, setChecklistProposedPatchStore, getChecklistProposedPatchStore, } from './core/checklist/index.js';
21
+ export { ChecklistStageEnum, ChecklistEntryStatusEnum, SignatoryStatusEnum, ChecklistItemStatusEnum, IssueStatusEnum, ResponsibilitySchema, CitationSchema, SignatureArtifactSchema, SignatorySchema, ChecklistDocumentSchema, ChecklistEntrySchema, ActionItemSchema, IssueSchema, } from './core/checklist/schemas.js';
22
+ export { ClaudeCodeAdapter } from './core/command-generation/adapters/claude.js';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AAErB,kBAAkB;AAClB,OAAO,EAAE,YAAY,EAAqC,MAAM,kBAAkB,CAAC;AAEnF,+BAA+B;AAC/B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,qBAAqB,GAMtB,MAAM,oBAAoB,CAAC;AAE5B,2BAA2B;AAC3B,OAAO,EACL,eAAe,GAGhB,MAAM,0BAA0B,CAAC;AAElC,0CAA0C;AAC1C,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,sBAAsB,GAEvB,MAAM,oBAAoB,CAAC;AAE5B,sBAAsB;AACtB,OAAO,EAAE,gBAAgB,EAAiC,MAAM,+BAA+B,CAAC;AAChG,OAAO,EAAE,eAAe,EAAgC,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,cAAc,EAA+B,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,cAAc,EAA+B,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAiC,MAAM,+BAA+B,CAAC;AAChG,OAAO,EACL,0BAA0B,GAG3B,MAAM,oCAAoC,CAAC;AAE5C,gBAAgB;AAChB,OAAO,EACL,SAAS,EACT,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,+BAA+B,GAKhC,MAAM,wBAAwB,CAAC;AAEhC,oBAAoB;AACpB,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,gCAAgC,EAChC,6BAA6B,EAC7B,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,iCAAiC,EACjC,6BAA6B,EAC7B,yBAAyB,EACzB,sBAAsB,EACtB,mCAAmC,EACnC,gCAAgC,EAChC,gCAAgC,EAChC,mBAAmB,EACnB,6BAA6B,EAC7B,6BAA6B,EAC7B,8BAA8B,EAC9B,8BAA8B,GA0B/B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,WAAW,GAcZ,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC"}
@@ -0,0 +1,43 @@
1
+ export interface ContentEntry {
2
+ id: string;
3
+ dir: string;
4
+ baseDir: string;
5
+ }
6
+ /** Root of the open-agreements package */
7
+ export declare function getPackageRoot(): string;
8
+ /** Optional additional content roots. Format is path-delimited, e.g. /a:/b on macOS/Linux. */
9
+ export declare function getContentRoots(): string[];
10
+ /** Templates directory */
11
+ export declare function getTemplatesDir(): string;
12
+ /** All template directories in precedence order (env roots first, package root last). */
13
+ export declare function getAllTemplatesDirs(): string[];
14
+ /** Resolve a specific template directory by ID */
15
+ export declare function resolveTemplateDir(templateId: string): string;
16
+ /** Find a specific template directory by ID across all configured content roots. */
17
+ export declare function findTemplateDir(templateId: string): string | undefined;
18
+ /** List template IDs across all content roots (first match wins for duplicates). */
19
+ export declare function listTemplateEntries(): ContentEntry[];
20
+ export declare function listTemplateIds(): string[];
21
+ /** External templates directory */
22
+ export declare function getExternalDir(): string;
23
+ /** All external template directories in precedence order (env roots first, package root last). */
24
+ export declare function getAllExternalDirs(): string[];
25
+ /** Resolve a specific external template directory by ID */
26
+ export declare function resolveExternalDir(externalId: string): string;
27
+ /** Find a specific external directory by ID across all configured content roots. */
28
+ export declare function findExternalDir(externalId: string): string | undefined;
29
+ /** List external template IDs across all content roots (first match wins for duplicates). */
30
+ export declare function listExternalEntries(): ContentEntry[];
31
+ export declare function listExternalIds(): string[];
32
+ /** Recipes directory */
33
+ export declare function getRecipesDir(): string;
34
+ /** All recipe directories in precedence order (env roots first, package root last). */
35
+ export declare function getAllRecipesDirs(): string[];
36
+ /** Resolve a specific recipe directory by ID */
37
+ export declare function resolveRecipeDir(recipeId: string): string;
38
+ /** Find a specific recipe directory by ID across all configured content roots. */
39
+ export declare function findRecipeDir(recipeId: string): string | undefined;
40
+ /** List recipe IDs across all content roots (first match wins for duplicates). */
41
+ export declare function listRecipeEntries(): ContentEntry[];
42
+ export declare function listRecipeIds(): string[];
43
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,0CAA0C;AAC1C,wBAAgB,cAAc,IAAI,MAAM,CAGvC;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAS1C;AAmBD,0BAA0B;AAC1B,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,yFAAyF;AACzF,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEtE;AAED,oFAAoF;AACpF,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAEpD;AAED,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C;AAED,mCAAmC;AACnC,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,kGAAkG;AAClG,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAE7C;AAED,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,oFAAoF;AACpF,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEtE;AAED,6FAA6F;AAC7F,wBAAgB,mBAAmB,IAAI,YAAY,EAAE,CAEpD;AAED,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C;AAED,wBAAwB;AACxB,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAE5C;AAED,gDAAgD;AAChD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAElE;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,IAAI,YAAY,EAAE,CAElD;AAED,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAExC"}
@@ -0,0 +1,149 @@
1
+ import { join, dirname, resolve, relative, sep, delimiter } from 'node:path';
2
+ import { existsSync, readdirSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
6
+ const CONTENT_ROOTS_ENV = 'OPEN_AGREEMENTS_CONTENT_ROOTS';
7
+ /** Root of the open-agreements package */
8
+ export function getPackageRoot() {
9
+ // From dist/utils/paths.js → go up to package root
10
+ return join(__dirname, '..', '..');
11
+ }
12
+ /** Optional additional content roots. Format is path-delimited, e.g. /a:/b on macOS/Linux. */
13
+ export function getContentRoots() {
14
+ const envRoots = (process.env[CONTENT_ROOTS_ENV] ?? '')
15
+ .split(delimiter)
16
+ .map((value) => value.trim())
17
+ .filter(Boolean)
18
+ .map((value) => resolve(value));
19
+ const roots = [...envRoots, resolve(getPackageRoot())];
20
+ return uniqueOrdered(roots);
21
+ }
22
+ /** Resolve a child directory, rejecting path traversal (e.g. "../../etc") */
23
+ function resolveChildDir(parentDir, childId, label) {
24
+ const resolved = resolve(join(parentDir, childId));
25
+ const rel = relative(resolve(parentDir), resolved);
26
+ if (rel.startsWith('..') || rel.startsWith(sep + sep)) {
27
+ throw new Error(`Invalid ${label} ID: ${childId}`);
28
+ }
29
+ return resolved;
30
+ }
31
+ /** Resolve a content sub-directory, preferring the nested content/ layout. */
32
+ function resolveContentDir(root, kind) {
33
+ const nested = join(root, 'content', kind);
34
+ if (existsSync(nested))
35
+ return nested;
36
+ return join(root, kind);
37
+ }
38
+ /** Templates directory */
39
+ export function getTemplatesDir() {
40
+ return resolveContentDir(getPackageRoot(), 'templates');
41
+ }
42
+ /** All template directories in precedence order (env roots first, package root last). */
43
+ export function getAllTemplatesDirs() {
44
+ return getContentRoots().map((root) => resolveContentDir(root, 'templates'));
45
+ }
46
+ /** Resolve a specific template directory by ID */
47
+ export function resolveTemplateDir(templateId) {
48
+ return findTemplateDir(templateId) ?? resolveChildDir(getTemplatesDir(), templateId, 'template');
49
+ }
50
+ /** Find a specific template directory by ID across all configured content roots. */
51
+ export function findTemplateDir(templateId) {
52
+ return findChildDir(getAllTemplatesDirs(), templateId, 'template');
53
+ }
54
+ /** List template IDs across all content roots (first match wins for duplicates). */
55
+ export function listTemplateEntries() {
56
+ return listEntries(getAllTemplatesDirs(), 'template');
57
+ }
58
+ export function listTemplateIds() {
59
+ return listTemplateEntries().map((entry) => entry.id);
60
+ }
61
+ /** External templates directory */
62
+ export function getExternalDir() {
63
+ return resolveContentDir(getPackageRoot(), 'external');
64
+ }
65
+ /** All external template directories in precedence order (env roots first, package root last). */
66
+ export function getAllExternalDirs() {
67
+ return getContentRoots().map((root) => resolveContentDir(root, 'external'));
68
+ }
69
+ /** Resolve a specific external template directory by ID */
70
+ export function resolveExternalDir(externalId) {
71
+ return findExternalDir(externalId) ?? resolveChildDir(getExternalDir(), externalId, 'external');
72
+ }
73
+ /** Find a specific external directory by ID across all configured content roots. */
74
+ export function findExternalDir(externalId) {
75
+ return findChildDir(getAllExternalDirs(), externalId, 'external');
76
+ }
77
+ /** List external template IDs across all content roots (first match wins for duplicates). */
78
+ export function listExternalEntries() {
79
+ return listEntries(getAllExternalDirs(), 'external');
80
+ }
81
+ export function listExternalIds() {
82
+ return listExternalEntries().map((entry) => entry.id);
83
+ }
84
+ /** Recipes directory */
85
+ export function getRecipesDir() {
86
+ return resolveContentDir(getPackageRoot(), 'recipes');
87
+ }
88
+ /** All recipe directories in precedence order (env roots first, package root last). */
89
+ export function getAllRecipesDirs() {
90
+ return getContentRoots().map((root) => resolveContentDir(root, 'recipes'));
91
+ }
92
+ /** Resolve a specific recipe directory by ID */
93
+ export function resolveRecipeDir(recipeId) {
94
+ return findRecipeDir(recipeId) ?? resolveChildDir(getRecipesDir(), recipeId, 'recipe');
95
+ }
96
+ /** Find a specific recipe directory by ID across all configured content roots. */
97
+ export function findRecipeDir(recipeId) {
98
+ return findChildDir(getAllRecipesDirs(), recipeId, 'recipe');
99
+ }
100
+ /** List recipe IDs across all content roots (first match wins for duplicates). */
101
+ export function listRecipeEntries() {
102
+ return listEntries(getAllRecipesDirs(), 'recipe');
103
+ }
104
+ export function listRecipeIds() {
105
+ return listRecipeEntries().map((entry) => entry.id);
106
+ }
107
+ function uniqueOrdered(paths) {
108
+ const seen = new Set();
109
+ const unique = [];
110
+ for (const value of paths) {
111
+ if (!seen.has(value)) {
112
+ seen.add(value);
113
+ unique.push(value);
114
+ }
115
+ }
116
+ return unique;
117
+ }
118
+ function findChildDir(baseDirs, childId, label) {
119
+ for (const baseDir of baseDirs) {
120
+ const resolved = resolveChildDir(baseDir, childId, label);
121
+ if (existsSync(resolved)) {
122
+ return resolved;
123
+ }
124
+ }
125
+ return undefined;
126
+ }
127
+ function listEntries(baseDirs, label) {
128
+ const entries = [];
129
+ const seenIds = new Set();
130
+ for (const baseDir of baseDirs) {
131
+ if (!existsSync(baseDir)) {
132
+ continue;
133
+ }
134
+ const ids = readdirSync(baseDir, { withFileTypes: true })
135
+ .filter((entry) => entry.isDirectory())
136
+ .map((entry) => entry.name)
137
+ .sort((a, b) => a.localeCompare(b));
138
+ for (const id of ids) {
139
+ if (seenIds.has(id)) {
140
+ continue;
141
+ }
142
+ const dir = resolveChildDir(baseDir, id, label);
143
+ entries.push({ id, dir, baseDir });
144
+ seenIds.add(id);
145
+ }
146
+ }
147
+ return entries;
148
+ }
149
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACtC,MAAM,iBAAiB,GAA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