@maycombhq/atticus 0.0.0-stage → 2.0.0-beta.10

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 (497) hide show
  1. package/LICENSE +177 -0
  2. package/README.md +17 -2
  3. package/THIRD-PARTY-LICENSES.txt +2607 -0
  4. package/dist/bin.js +47 -0
  5. package/dist/chunk-23M2LUYM.js +55 -0
  6. package/dist/chunk-26PLPSQW.js +48 -0
  7. package/dist/chunk-2G4DFUWJ.js +43 -0
  8. package/dist/chunk-2HMWX4T6.js +226 -0
  9. package/dist/chunk-2KDSXJFJ.js +294 -0
  10. package/dist/chunk-2M6WXO73.js +38 -0
  11. package/dist/chunk-2RX7PI2Y.js +166 -0
  12. package/dist/chunk-2XM6PYQQ.js +199 -0
  13. package/dist/chunk-3G4YI4ZU.js +16 -0
  14. package/dist/chunk-3GTZ2OON.js +362 -0
  15. package/dist/chunk-3QAKDIEU.js +108 -0
  16. package/dist/chunk-47QE246J.js +6115 -0
  17. package/dist/chunk-4GZXS6S2.js +5401 -0
  18. package/dist/chunk-4PJADZRR.js +545 -0
  19. package/dist/chunk-4Q3NN7VF.js +32 -0
  20. package/dist/chunk-4QUQEBFT.js +143 -0
  21. package/dist/chunk-4SKZDI62.js +22 -0
  22. package/dist/chunk-4SVJNVEE.js +80 -0
  23. package/dist/chunk-52R2YXP5.js +80 -0
  24. package/dist/chunk-577AJVRS.js +44694 -0
  25. package/dist/chunk-5F3RJCHB.js +45 -0
  26. package/dist/chunk-5IALSMZ2.js +34 -0
  27. package/dist/chunk-5KTOPOEP.js +174 -0
  28. package/dist/chunk-5MI2SEV5.js +242 -0
  29. package/dist/chunk-5XDNUJ4P.js +2743 -0
  30. package/dist/chunk-5XN76FTF.js +22 -0
  31. package/dist/chunk-5YIBJXGB.js +2007 -0
  32. package/dist/chunk-62YMDXY6.js +38 -0
  33. package/dist/chunk-65C57N7P.js +116 -0
  34. package/dist/chunk-67J3VZBA.js +120 -0
  35. package/dist/chunk-6EDQE7GO.js +27809 -0
  36. package/dist/chunk-6GNS32SI.js +285 -0
  37. package/dist/chunk-6GWHKMQR.js +405 -0
  38. package/dist/chunk-6JLPXDWN.js +7923 -0
  39. package/dist/chunk-6TJCUYC5.js +22 -0
  40. package/dist/chunk-6VBXAGJX.js +234 -0
  41. package/dist/chunk-73VPWF5R.js +415 -0
  42. package/dist/chunk-76WKMA4J.js +14 -0
  43. package/dist/chunk-7DUDLVFJ.js +52 -0
  44. package/dist/chunk-7EFILTCI.js +67 -0
  45. package/dist/chunk-7EKESFWV.js +130 -0
  46. package/dist/chunk-7F2RUWPU.js +101 -0
  47. package/dist/chunk-7GB4ZRE2.js +378 -0
  48. package/dist/chunk-7TGYNOXD.js +189 -0
  49. package/dist/chunk-7UKVYFQ2.js +2078 -0
  50. package/dist/chunk-7URGP4DD.js +102 -0
  51. package/dist/chunk-7YYEKTYF.js +2522 -0
  52. package/dist/chunk-AJJK7GLO.js +252 -0
  53. package/dist/chunk-AKJTKMXU.js +25 -0
  54. package/dist/chunk-APSVL2AI.js +344 -0
  55. package/dist/chunk-AWECWW5Y.js +3206 -0
  56. package/dist/chunk-AY2IUF4K.js +5071 -0
  57. package/dist/chunk-B2VSVN4P.js +34 -0
  58. package/dist/chunk-B3O52AUQ.js +275 -0
  59. package/dist/chunk-B7434AE2.js +104 -0
  60. package/dist/chunk-BDEKREZH.js +155 -0
  61. package/dist/chunk-BJPMKJTL.js +1428 -0
  62. package/dist/chunk-BMCKL3VQ.js +324 -0
  63. package/dist/chunk-BMHGA7WD.js +25 -0
  64. package/dist/chunk-BUYJL3GJ.js +287 -0
  65. package/dist/chunk-BXIX7S7O.js +32 -0
  66. package/dist/chunk-CHC5FKTU.js +26 -0
  67. package/dist/chunk-CITDNDIZ.js +53 -0
  68. package/dist/chunk-CIUHAHM6.js +70 -0
  69. package/dist/chunk-CNKGYDMG.js +334 -0
  70. package/dist/chunk-CRE4BJHM.js +408 -0
  71. package/dist/chunk-D3PO4DOZ.js +261 -0
  72. package/dist/chunk-DAQBIK5G.js +47 -0
  73. package/dist/chunk-DDAHCPGA.js +212 -0
  74. package/dist/chunk-DPHCFZ7W.js +374 -0
  75. package/dist/chunk-DZRQDNPT.js +34 -0
  76. package/dist/chunk-E3JYO547.js +46 -0
  77. package/dist/chunk-E3Z67HRK.js +104 -0
  78. package/dist/chunk-EADP3PEN.js +450 -0
  79. package/dist/chunk-EX6ZXS5K.js +169 -0
  80. package/dist/chunk-EZIUFEN6.js +27 -0
  81. package/dist/chunk-F2FOQLJ7.js +430 -0
  82. package/dist/chunk-F7UQR4ZX.js +149 -0
  83. package/dist/chunk-F7YL2RZ4.js +94 -0
  84. package/dist/chunk-FEZE6NIA.js +69 -0
  85. package/dist/chunk-FJCFYKVO.js +1014 -0
  86. package/dist/chunk-FLOEZA6K.js +29 -0
  87. package/dist/chunk-FMKKVWZD.js +133 -0
  88. package/dist/chunk-FNHSVBRA.js +48 -0
  89. package/dist/chunk-FOGG4AUR.js +114 -0
  90. package/dist/chunk-FPGVOSOG.js +41 -0
  91. package/dist/chunk-FQSRHTTC.js +49 -0
  92. package/dist/chunk-FR7JPYBD.js +182 -0
  93. package/dist/chunk-FTV6I76U.js +211 -0
  94. package/dist/chunk-FV5YFR6I.js +540 -0
  95. package/dist/chunk-FZ2E5LGK.js +54 -0
  96. package/dist/chunk-FZL2HNWP.js +531 -0
  97. package/dist/chunk-G2E5MNYP.js +549 -0
  98. package/dist/chunk-G5SFOH7P.js +256 -0
  99. package/dist/chunk-GFXLPJWY.js +53 -0
  100. package/dist/chunk-GR6YKM55.js +480 -0
  101. package/dist/chunk-GXJVY6WT.js +250 -0
  102. package/dist/chunk-GZ4TKR3Q.js +928 -0
  103. package/dist/chunk-HB6XSGI6.js +131 -0
  104. package/dist/chunk-HE4ZQXZM.js +396 -0
  105. package/dist/chunk-HHUFVJF7.js +1019 -0
  106. package/dist/chunk-HKTUIMH4.js +76 -0
  107. package/dist/chunk-HUZQDKQK.js +48 -0
  108. package/dist/chunk-I7IWQIEB.js +58 -0
  109. package/dist/chunk-IDGSU7JF.js +1496 -0
  110. package/dist/chunk-ILFKECGI.js +69 -0
  111. package/dist/chunk-ISNZYKAS.js +53 -0
  112. package/dist/chunk-IUD3ME4E.js +251 -0
  113. package/dist/chunk-IV7BCWWN.js +101 -0
  114. package/dist/chunk-IZNSAEBX.js +164 -0
  115. package/dist/chunk-J5LHDJU4.js +400 -0
  116. package/dist/chunk-JAA53T23.js +172 -0
  117. package/dist/chunk-JF2NSTFO.js +47 -0
  118. package/dist/chunk-JMSEEBN4.js +41 -0
  119. package/dist/chunk-JQ7XQPQS.js +273 -0
  120. package/dist/chunk-KC5DROFC.js +16667 -0
  121. package/dist/chunk-KIAI6PWL.js +36 -0
  122. package/dist/chunk-KIHOIVST.js +18 -0
  123. package/dist/chunk-KM2FBM3T.js +659 -0
  124. package/dist/chunk-KQDZXGNR.js +14 -0
  125. package/dist/chunk-L4VJ4ETL.js +41 -0
  126. package/dist/chunk-LDKUC2QJ.js +49 -0
  127. package/dist/chunk-LK44ULGI.js +2043 -0
  128. package/dist/chunk-LRS573EX.js +104 -0
  129. package/dist/chunk-LTQANUDH.js +119 -0
  130. package/dist/chunk-LVGBKKSM.js +282 -0
  131. package/dist/chunk-MF7QH4AX.js +162 -0
  132. package/dist/chunk-MGVYVW7Q.js +915 -0
  133. package/dist/chunk-MH5OCRUM.js +240 -0
  134. package/dist/chunk-MKFYQQ5Q.js +36 -0
  135. package/dist/chunk-MKRBG5EF.js +1142 -0
  136. package/dist/chunk-MTAUZW2Z.js +2504 -0
  137. package/dist/chunk-MTEBM4Y4.js +39 -0
  138. package/dist/chunk-N3NBWIYQ.js +48 -0
  139. package/dist/chunk-N4QZJJVB.js +3851 -0
  140. package/dist/chunk-NGPU2ARF.js +1726 -0
  141. package/dist/chunk-NIXVDQVO.js +2929 -0
  142. package/dist/chunk-NNUASOAA.js +34 -0
  143. package/dist/chunk-NPCD54I7.js +226 -0
  144. package/dist/chunk-OEI7LVRP.js +856 -0
  145. package/dist/chunk-OGRWQ562.js +18 -0
  146. package/dist/chunk-OIU657QQ.js +95 -0
  147. package/dist/chunk-OJLRFGBP.js +128 -0
  148. package/dist/chunk-OS7PQ35Z.js +391 -0
  149. package/dist/chunk-OSGQW2Z6.js +104 -0
  150. package/dist/chunk-P3TKKBAH.js +131 -0
  151. package/dist/chunk-PEF5OEMB.js +163 -0
  152. package/dist/chunk-PGKHJYOB.js +706 -0
  153. package/dist/chunk-PIVKU64W.js +688 -0
  154. package/dist/chunk-PKCMRPPB.js +109 -0
  155. package/dist/chunk-QICFHVRW.js +15 -0
  156. package/dist/chunk-QKEFZRHS.js +166 -0
  157. package/dist/chunk-QWVBEK4P.js +113 -0
  158. package/dist/chunk-R4TBNKKC.js +3217 -0
  159. package/dist/chunk-R64GLVBO.js +2919 -0
  160. package/dist/chunk-R6B6XAKK.js +56 -0
  161. package/dist/chunk-R6RY4Q5T.js +51 -0
  162. package/dist/chunk-RK6MKKKP.js +471 -0
  163. package/dist/chunk-ROTY5J2L.js +25 -0
  164. package/dist/chunk-RRVT4MPS.js +150 -0
  165. package/dist/chunk-SS66Q4VE.js +231 -0
  166. package/dist/chunk-T4RTWMJD.js +310 -0
  167. package/dist/chunk-T6USVBEJ.js +105 -0
  168. package/dist/chunk-TM7LC37P.js +4044 -0
  169. package/dist/chunk-TV45EUGM.js +51 -0
  170. package/dist/chunk-TZDSDDSV.js +233 -0
  171. package/dist/chunk-UBWCUP3G.js +55 -0
  172. package/dist/chunk-UF7TAFJM.js +906 -0
  173. package/dist/chunk-UR7RMZ3R.js +19943 -0
  174. package/dist/chunk-UYYN2IUZ.js +1611 -0
  175. package/dist/chunk-V2TH46ZY.js +66 -0
  176. package/dist/chunk-VKMTFIWS.js +315 -0
  177. package/dist/chunk-VOGCSYOI.js +16 -0
  178. package/dist/chunk-W5OYJMBT.js +41 -0
  179. package/dist/chunk-WARBF2KY.js +296 -0
  180. package/dist/chunk-WGZWR4RF.js +130 -0
  181. package/dist/chunk-WLIIQ2A4.js +18 -0
  182. package/dist/chunk-X4W4XXWP.js +134 -0
  183. package/dist/chunk-XB5RFZHH.js +1217 -0
  184. package/dist/chunk-XEG3FE2R.js +766 -0
  185. package/dist/chunk-XIWYUQZQ.js +583 -0
  186. package/dist/chunk-XKS6THI5.js +31 -0
  187. package/dist/chunk-XKZHAD6Y.js +184 -0
  188. package/dist/chunk-XNYNEEBR.js +214 -0
  189. package/dist/chunk-XPCWQXTY.js +37 -0
  190. package/dist/chunk-XPEEICAO.js +325 -0
  191. package/dist/chunk-XQ3YIV5R.js +3507 -0
  192. package/dist/chunk-XRO65C7V.js +1079 -0
  193. package/dist/chunk-XTVDAHH2.js +203 -0
  194. package/dist/chunk-XZRON6IV.js +131 -0
  195. package/dist/chunk-Y4BRGOJR.js +523 -0
  196. package/dist/chunk-Y5PZHS4K.js +3898 -0
  197. package/dist/chunk-Y7KBQ4BD.js +230 -0
  198. package/dist/chunk-YFSSNGLR.js +277 -0
  199. package/dist/chunk-YGKYFMSL.js +60 -0
  200. package/dist/chunk-YGR6OCHQ.js +345 -0
  201. package/dist/chunk-YIEOFHOL.js +30 -0
  202. package/dist/chunk-YLAJAI2W.js +180 -0
  203. package/dist/chunk-YMOJD5BO.js +50 -0
  204. package/dist/chunk-YPBQNJHA.js +33 -0
  205. package/dist/chunk-YPIEYQF4.js +307 -0
  206. package/dist/chunk-YVLMBAYE.js +221 -0
  207. package/dist/chunk-YXJ4XOHF.js +376 -0
  208. package/dist/chunk-ZE3P35DA.js +1247 -0
  209. package/dist/chunk-ZONE6E3Z.js +32 -0
  210. package/dist/chunk-ZP4FJHR4.js +95 -0
  211. package/dist/chunk-ZZXF6OOJ.js +119 -0
  212. package/dist/files.json +1976 -0
  213. package/dist/fixtures/forge/README.md +19 -0
  214. package/dist/fixtures/forge/expected/discrepancies.yaml +54 -0
  215. package/dist/fixtures/forge/expected/inputs.yaml +38 -0
  216. package/dist/fixtures/forge/expected/scan.yaml +342 -0
  217. package/dist/fixtures/forge/inputs/diagrams/forge-context.drawio +23 -0
  218. package/dist/fixtures/forge/inputs/partner-specs/northwind-pay-openapi.yaml +11 -0
  219. package/dist/fixtures/forge/inputs/tickets/ado-stories.json +4 -0
  220. package/dist/fixtures/forge/inputs/tickets/closed-service-requests.json +5 -0
  221. package/dist/fixtures/forge/inputs/wiki/integration-patterns.md +11 -0
  222. package/dist/fixtures/forge/inputs/wiki/ledger-solution-spec.md +9 -0
  223. package/dist/fixtures/forge/inputs/wiki/snow-firewall-request.md +4 -0
  224. package/dist/fixtures/forge/metarepo/judgments/reaches/84af5b6af24f7ca8c23013f3.yaml +17 -0
  225. package/dist/fixtures/forge/metarepo/judgments/reaches/c3917555edebddce8cecb647.yaml +17 -0
  226. package/dist/fixtures/forge/metarepo/judgments/reaches/c5fafd6601f8ca9e34e0bbd0.yaml +17 -0
  227. package/dist/fixtures/forge/metarepo/org-pack/agents/architecture-critic.yaml +9 -0
  228. package/dist/fixtures/forge/metarepo/org-pack/agents/story-writer.yaml +10 -0
  229. package/dist/fixtures/forge/metarepo/org-pack/checklists/architecture.yaml +115 -0
  230. package/dist/fixtures/forge/metarepo/org-pack/dialects/forge.yaml +111 -0
  231. package/dist/fixtures/forge/metarepo/org-pack/gates.yaml +22 -0
  232. package/dist/fixtures/forge/metarepo/org-pack/pack.yaml +11 -0
  233. package/dist/fixtures/forge/metarepo/org-pack/patterns/A.EB.PUB.yaml +12 -0
  234. package/dist/fixtures/forge/metarepo/org-pack/patterns/D.JDBC.yaml +12 -0
  235. package/dist/fixtures/forge/metarepo/org-pack/patterns/S.DIR.BFF.yaml +12 -0
  236. package/dist/fixtures/forge/metarepo/org-pack/patterns/S.GW.SOR.yaml +13 -0
  237. package/dist/fixtures/forge/metarepo/org-pack/patterns/S.GW.VND.yaml +14 -0
  238. package/dist/fixtures/forge/metarepo/org-pack/process/change-templates/feature.md +37 -0
  239. package/dist/fixtures/forge/metarepo/org-pack/process/skills/add-forge-endpoint/SKILL.md +17 -0
  240. package/dist/fixtures/forge/metarepo/org-pack/process/snow/firewall-rule.yaml +14 -0
  241. package/dist/fixtures/forge/metarepo/org-pack/process/snow/gateway-route.yaml +13 -0
  242. package/dist/fixtures/forge/metarepo/org-pack/profiles/forge/profile.yaml +12 -0
  243. package/dist/fixtures/forge/metarepo/org-pack/profiles/forge/repos.manifest.yaml +44 -0
  244. package/dist/fixtures/forge/metarepo/org-pack/roles.yaml +14 -0
  245. package/dist/fixtures/forge/metarepo/org-pack/runtime.yaml +14 -0
  246. package/dist/fixtures/forge/metarepo/org-pack/sources.yaml +3 -0
  247. package/dist/fixtures/forge/repos/forge-events/topics/payments.initiated.yaml +4 -0
  248. package/dist/fixtures/forge/repos/forge-events/topics/transfers.completed.yaml +4 -0
  249. package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/ledger-v1.xml +3 -0
  250. package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/policies/SpikeArrest.xml +3 -0
  251. package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/policies/VerifyOAuth.xml +4 -0
  252. package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/proxies/default.xml +14 -0
  253. package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/targets/ledger.xml +5 -0
  254. package/dist/fixtures/forge/repos/forge-infra/alerts/ledger-api.yaml +5 -0
  255. package/dist/fixtures/forge/repos/forge-infra/k8s/ledger-api.yaml +15 -0
  256. package/dist/fixtures/forge/repos/forge-infra/k8s/portal-bff.yaml +7 -0
  257. package/dist/fixtures/forge/repos/forge-infra/terraform/ledger-db.tf +9 -0
  258. package/dist/fixtures/forge/repos/forge-ledger/api/ledger-openapi.yaml +31 -0
  259. package/dist/fixtures/forge/repos/forge-ledger/forge.yaml +4 -0
  260. package/dist/fixtures/forge/repos/forge-ledger/src/main/java/forge/ledger/LedgerEndpoints.java +13 -0
  261. package/dist/fixtures/forge/repos/forge-ledger/src/main/java/forge/ledger/LedgerEvents.java +11 -0
  262. package/dist/fixtures/forge/repos/forge-ledger/src/main/java/forge/ledger/NorthwindClient.java +10 -0
  263. package/dist/fixtures/forge/repos/forge-ledger/src/main/resources/application.yml +3 -0
  264. package/dist/fixtures/forge/repos/forge-ledger/src/main/resources/db/migration/V1__create_account.sql +5 -0
  265. package/dist/fixtures/forge/repos/forge-ledger/src/main/resources/db/migration/V2__create_entry.sql +7 -0
  266. package/dist/fixtures/forge/repos/forge-portal-bff/pom.xml +1 -0
  267. package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/AuditPublisher.java +12 -0
  268. package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/BalanceController.java +16 -0
  269. package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/LedgerClient.java +13 -0
  270. package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/PaymentEvents.java +13 -0
  271. package/dist/fixtures/forge/repos/forge-portal-bff/src/main/resources/application.yml +8 -0
  272. package/dist/fixtures/forge/repos/forge-portal-ui/package.json +1 -0
  273. package/dist/fixtures/forge/repos/forge-portal-ui/src/api/balance.ts +5 -0
  274. package/dist/fixtures/forge/repos/forge-reports-job/src/main/java/forge/reports/DailyEntriesJob.java +19 -0
  275. package/dist/fixtures/forge/repos/forge-reports-job/src/main/resources/application.yml +3 -0
  276. package/dist/fixtures/forge-change/README.md +41 -0
  277. package/dist/fixtures/forge-change/expected/findings.yaml +301 -0
  278. package/dist/fixtures/forge-change/expected/stories.yaml +101 -0
  279. package/dist/fixtures/forge-change/judgments/personal-data/0b5f3dbf5257a22275d8c74b.yaml +18 -0
  280. package/dist/fixtures/forge-change/judgments/personal-data/2759a66770134c417440bf2d.yaml +18 -0
  281. package/dist/fixtures/forge-change/judgments/personal-data/31b1ea2f14d0737f1aca79fd.yaml +18 -0
  282. package/dist/fixtures/forge-change/judgments/personal-data/49afd70c08228e65ad6ca1ed.yaml +18 -0
  283. package/dist/fixtures/forge-change/judgments/personal-data/761cabcb8a39f5e5866d2dd6.yaml +18 -0
  284. package/dist/fixtures/forge-change/judgments/personal-data/adae902b90cc8ffa0c765145.yaml +18 -0
  285. package/dist/fixtures/forge-change/judgments/personal-data/ba11bb933105ec9493e065dd.yaml +18 -0
  286. package/dist/fixtures/forge-change/judgments/personal-data/bdbcd1cdac3021c68063c3e7.yaml +18 -0
  287. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/brief.md +35 -0
  288. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/change.yaml +120 -0
  289. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/data.md +18 -0
  290. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/design.md +29 -0
  291. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/interfaces.md +17 -0
  292. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/mappings.md +26 -0
  293. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/proposal.md +35 -0
  294. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/snow.md +12 -0
  295. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/specs/transfer-limits/spec.md +19 -0
  296. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s1-refuse-over-limit.md +17 -0
  297. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s2-show-remaining.md +16 -0
  298. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s3-audit-refusals.md +18 -0
  299. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s4-velocity-check.md +16 -0
  300. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories.md +8 -0
  301. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/tasks.md +12 -0
  302. package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/ux.md +7 -0
  303. package/dist/fixtures/forge-change/org-pack/agents/code-and-test-critic.yaml +13 -0
  304. package/dist/fixtures/forge-change/org-pack/agents/complete-critic.yaml +12 -0
  305. package/dist/fixtures/forge-change/org-pack/agents/safe-critic.yaml +12 -0
  306. package/dist/fixtures/forge-change/org-pack/agents/ship-critic.yaml +11 -0
  307. package/dist/fixtures/forge-change/org-pack/agents/true-critic.yaml +11 -0
  308. package/dist/fixtures/forge-change/org-pack/checklists/review.yaml +54 -0
  309. package/dist/fixtures/forge-change/org-pack/gates.yaml +25 -0
  310. package/dist/fixtures/forge-change/org-pack/teams/team-ledger/checklists/ledger-team.yaml +227 -0
  311. package/dist/fixtures/forge-change/recordings/complete-critic/2ad84f84bf39c1d5412697e69fe23034d6983ec45a00314bf0975e627589a3c5.json +12 -0
  312. package/dist/fixtures/forge-change/recordings/complete-critic/417c98d8e54a4387d0fd93441c49f44c2868958739070d855c1dce0c41e24db3.json +12 -0
  313. package/dist/fixtures/forge-change/recordings/complete-critic/50203ee22e9cb3ef047295edb6538fe7d5695e1e4b139f3c929013dc6ce47021.json +12 -0
  314. package/dist/fixtures/forge-change/recordings/complete-critic/89f18d67f5d9c325bf35e2a9e020f9ddb6ee13b8523315037f0905cc57c040b1.json +12 -0
  315. package/dist/fixtures/forge-change/recordings/complete-critic/b4097867d26ae8eadc8b9efa8cdd86897013358035f0b40086c299a59c4ba121.json +12 -0
  316. package/dist/fixtures/forge-change/recordings/safe-critic/302d06f49664dd67ad2e21ab9cf74c1b0f7d3f750709c6ed8eff2b70983274e2.json +12 -0
  317. package/dist/fixtures/forge-change/recordings/safe-critic/32f1049c9a5ab4a759543290db4644ec6e221cc45fdfdcf06193837c6a8ce0b9.json +12 -0
  318. package/dist/fixtures/forge-change/recordings/safe-critic/4e4a84bfc04b9f26ca4250319a879901ff7a1c081c71e46a117675fee05026b0.json +12 -0
  319. package/dist/fixtures/forge-change/recordings/safe-critic/604af0fcdd6df6b76208fa88305fdc15c37606c2a4d1ae816477e46ac8c2dd04.json +12 -0
  320. package/dist/fixtures/forge-change/recordings/safe-critic/f0bf50af11f14c50d07904f0dffe1c8c20fb0cd89770645a8824c1d30a443955.json +12 -0
  321. package/dist/fixtures/forge-change/recordings/ship-critic/350954b58833b2c04880c67db45a1b328b7fd541d9f0d943b63905b8875488a6.json +12 -0
  322. package/dist/fixtures/forge-change/recordings/ship-critic/4af95c6c96a206777cec9de1f9c2d8c55a36ddc9b8db2f81d6eb83217b835efa.json +12 -0
  323. package/dist/fixtures/forge-change/recordings/ship-critic/76c34522a49cf7587a4e5689a5030d384603fa780b8aba97d27815cbc829683e.json +12 -0
  324. package/dist/fixtures/forge-change/recordings/ship-critic/a3b2cd1ace48587e5994333db03b34c3a0f9dec4f1932f1730ddfb687f6918c8.json +12 -0
  325. package/dist/fixtures/forge-change/recordings/ship-critic/de288a4fa64d0fc20890f9a787080ce6eac5203b7b9b72d884df11e8cf111835.json +12 -0
  326. package/dist/fixtures/forge-change/recordings/story-writer/1ddb00eac2aaf91a5ec5d9dfd220116be9f75aec6546a4a3a3b050ed89af2864.json +12 -0
  327. package/dist/packages/assistant-kit/frameworks-kit/README.md +86 -0
  328. package/dist/packages/assistant-kit/frameworks-kit/checklist.md +11 -0
  329. package/dist/packages/assistant-kit/frameworks-kit/examples/tide-lantern.yaml +56 -0
  330. package/dist/packages/assistant-kit/frameworks-kit/examples/tide-platform.yaml +43 -0
  331. package/dist/packages/assistant-kit/frameworks-kit/prompts/write-framework-model.md +12 -0
  332. package/dist/packages/assistant-kit/kit/README.md +98 -0
  333. package/dist/packages/assistant-kit/kit/c2-reference.md +334 -0
  334. package/dist/packages/assistant-kit/kit/checklist.md +39 -0
  335. package/dist/packages/assistant-kit/kit/examples/house-http-client.yaml +102 -0
  336. package/dist/packages/assistant-kit/kit/examples/tide-apigee.yaml +56 -0
  337. package/dist/packages/assistant-kit/kit/examples/tide-apim.yaml +32 -0
  338. package/dist/packages/assistant-kit/kit/examples/tide-kong.yaml +44 -0
  339. package/dist/packages/assistant-kit/kit/prompts/write-dialect.md +34 -0
  340. package/dist/packages/assistant-kit/kit/worked-example.md +198 -0
  341. package/dist/packages/conformance/sample/README.md +4 -0
  342. package/dist/packages/conformance/sample/inputs/notes.md +3 -0
  343. package/dist/packages/conformance/sample/inputs/systems.csv +3 -0
  344. package/dist/packages/conformance/sample/repo/api/greeter.proto +6 -0
  345. package/dist/packages/conformance/sample/repo/api/openapi.yaml +10 -0
  346. package/dist/packages/conformance/sample/repo/api/schema.graphql +3 -0
  347. package/dist/packages/conformance/sample/repo/db/V1__create_greeting.sql +4 -0
  348. package/dist/packages/conformance/sample/repo/package.json +7 -0
  349. package/dist/packages/conformance/sample/repo/src/main/java/sample/HelloController.java +10 -0
  350. package/dist/packages/conformance/sample/repo/web/app.ts +4 -0
  351. package/dist/packages/evals/datasets/critic-lenses.yaml +62 -0
  352. package/dist/packages/evals/datasets/dialect-writer.yaml +14 -0
  353. package/dist/packages/evals/datasets/feature-namer.yaml +34 -0
  354. package/dist/packages/evals/datasets/glossary-definer.yaml +25 -0
  355. package/dist/packages/evals/datasets/story-writer.yaml +13 -0
  356. package/dist/packages/evals/datasets/template-writer.yaml +16 -0
  357. package/dist/packages/evals/datasets/test-writer.yaml +18 -0
  358. package/dist/packages/executors/reference/reference-executor.mjs +233 -0
  359. package/dist/packages/extractors/dialects/argocd.yaml +45 -0
  360. package/dist/packages/extractors/dialects/fixtures/jaxrs/accounts-service/src/main/java/forge/accounts/AccountResource.java +47 -0
  361. package/dist/packages/extractors/dialects/fixtures/jaxrs/accounts-service/src/main/java/forge/accounts/AuditClient.java +12 -0
  362. package/dist/packages/extractors/dialects/fixtures/jaxrs/accounts-service/src/main/java/forge/accounts/LedgerClient.java +17 -0
  363. package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/java/forge/statements/LedgerClient.java +14 -0
  364. package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/java/forge/statements/RatesClient.java +11 -0
  365. package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/java/forge/statements/StatementController.java +36 -0
  366. package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/resources/application.yml +7 -0
  367. package/dist/packages/extractors/dialects/fixtures/quarkus-reactive-messaging/fraud-service/src/main/java/forge/fraud/FraudScorer.java +27 -0
  368. package/dist/packages/extractors/dialects/fixtures/quarkus-reactive-messaging/fraud-service/src/main/resources/application.properties +4 -0
  369. package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/api.tf +38 -0
  370. package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/main.tf +95 -0
  371. package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/terraform.tfvars +1 -0
  372. package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/variables.tf +4 -0
  373. package/dist/packages/extractors/dialects/fixtures/terraform-azure/forge-azure-infra/main.tf +102 -0
  374. package/dist/packages/extractors/dialects/fixtures/terraform-gcp/forge-gcp-infra/main.tf +51 -0
  375. package/dist/packages/extractors/dialects/harness.yaml +101 -0
  376. package/dist/packages/extractors/dialects/jaxrs.yaml +155 -0
  377. package/dist/packages/extractors/dialects/micronaut.yaml +207 -0
  378. package/dist/packages/extractors/dialects/quarkus-reactive-messaging.yaml +158 -0
  379. package/dist/packages/extractors/dialects/tekton.yaml +71 -0
  380. package/dist/packages/extractors/dialects/terraform-aws.yaml +267 -0
  381. package/dist/packages/extractors/dialects/terraform-azure.yaml +212 -0
  382. package/dist/packages/extractors/dialects/terraform-gcp.yaml +109 -0
  383. package/dist/packages/extractors/grammars/README.md +11 -0
  384. package/dist/packages/extractors/grammars/tree-sitter-groovy.LICENSE +21 -0
  385. package/dist/packages/extractors/grammars/tree-sitter-groovy.wasm +0 -0
  386. package/dist/packages/extractors/grammars/vendored.json +11 -0
  387. package/dist/packages/learn/lessons/architect-diagrams-and-code.yaml +69 -0
  388. package/dist/packages/learn/lessons/business-analyst-story-bar.yaml +94 -0
  389. package/dist/packages/learn/lessons/delivery-lead-release-readiness.yaml +44 -0
  390. package/dist/packages/learn/lessons/designer-features-in-user-words.yaml +57 -0
  391. package/dist/packages/learn/lessons/developer-find-your-way.yaml +60 -0
  392. package/dist/packages/learn/lessons/everyone-first-hour.yaml +74 -0
  393. package/dist/packages/learn/lessons/platform-lead-coverage-and-defences.yaml +58 -0
  394. package/dist/packages/learn/lessons/product-owner-first-change.yaml +167 -0
  395. package/dist/packages/learn/lessons/qa-tests-and-trace.yaml +53 -0
  396. package/dist/packages/learn/lessons/team-lead-initiative.yaml +146 -0
  397. package/dist/packages/naysayer/constitution/constitution.yaml +305 -0
  398. package/dist/packages/naysayer/starter/review.yaml +256 -0
  399. package/dist/packages/sdk/npm/index.js +9780 -0
  400. package/dist/packages/speckit/rules/drift.yaml +78 -0
  401. package/dist/packages/taskrun/rules/conform.yaml +38 -0
  402. package/dist/packages/testgen/rules/trace.yaml +49 -0
  403. package/dist/packages/ui/dist/assets/elk-api-Mo5w5xCa.js +2 -0
  404. package/dist/packages/ui/dist/assets/elk-worker.min--dAJroGl.js +6401 -0
  405. package/dist/packages/ui/dist/assets/elk-worker.min-DdYmS5kP.js +2 -0
  406. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-400-normal-BTotfTJu.woff +0 -0
  407. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-400-normal-DZqxrq2p.woff2 +0 -0
  408. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-500-normal-ByOcLdNv.woff +0 -0
  409. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-500-normal-CocWQlwt.woff2 +0 -0
  410. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-600-normal-71GNu3SW.woff2 +0 -0
  411. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-600-normal-BGq0mW3O.woff +0 -0
  412. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-400-normal-Dsrv2Tcn.woff +0 -0
  413. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-400-normal-g30qAdWV.woff2 +0 -0
  414. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-500-normal-Cs5J6C77.woff2 +0 -0
  415. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-500-normal-DB5PtV2g.woff +0 -0
  416. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-600-normal-Bz0x94Yp.woff +0 -0
  417. package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-600-normal-DUMzJB7m.woff2 +0 -0
  418. package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-400-normal-D9ESIMu3.woff +0 -0
  419. package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-400-normal-_efipK4i.woff2 +0 -0
  420. package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-500-normal-CuWXN6rf.woff +0 -0
  421. package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-500-normal-JMMifIXV.woff2 +0 -0
  422. package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-600-normal-D-CqTdkO.woff +0 -0
  423. package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-600-normal-DzTrcv_p.woff2 +0 -0
  424. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
  425. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
  426. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
  427. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
  428. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
  429. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
  430. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-400-normal-C5H60-Va.woff2 +0 -0
  431. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-400-normal-RBey6euL.woff +0 -0
  432. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-500-normal-D0aIdm-b.woff +0 -0
  433. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-500-normal-DakdToA3.woff2 +0 -0
  434. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-600-normal-DIrixKbi.woff +0 -0
  435. package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-600-normal-DOrvGEcy.woff2 +0 -0
  436. package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-400-normal-DG4YqDda.woff2 +0 -0
  437. package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-400-normal-fK1oJ5dG.woff +0 -0
  438. package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-500-normal-BEb3_waV.woff +0 -0
  439. package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-500-normal-e4dixQRQ.woff2 +0 -0
  440. package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-600-normal-DgdngZtN.woff +0 -0
  441. package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-600-normal-DpPYBSTl.woff2 +0 -0
  442. package/dist/packages/ui/dist/assets/index-Bp3XhPHX.css +1 -0
  443. package/dist/packages/ui/dist/assets/index-DM212ZbV.js +29 -0
  444. package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
  445. package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
  446. package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
  447. package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
  448. package/dist/packages/ui/dist/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
  449. package/dist/packages/ui/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
  450. package/dist/packages/ui/dist/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
  451. package/dist/packages/ui/dist/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
  452. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  453. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  454. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  455. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  456. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  457. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
  458. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  459. package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
  460. package/dist/packages/ui/dist/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
  461. package/dist/packages/ui/dist/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
  462. package/dist/packages/ui/dist/assets/rajdhani-devanagari-600-normal-BtY48IV_.woff +0 -0
  463. package/dist/packages/ui/dist/assets/rajdhani-devanagari-600-normal-DhS7ScYx.woff2 +0 -0
  464. package/dist/packages/ui/dist/assets/rajdhani-devanagari-700-normal-BQQOj9BB.woff2 +0 -0
  465. package/dist/packages/ui/dist/assets/rajdhani-devanagari-700-normal-DBRwWuxA.woff +0 -0
  466. package/dist/packages/ui/dist/assets/rajdhani-latin-600-normal-CXCVEoA9.woff2 +0 -0
  467. package/dist/packages/ui/dist/assets/rajdhani-latin-600-normal-Dx02qI2_.woff +0 -0
  468. package/dist/packages/ui/dist/assets/rajdhani-latin-700-normal-BPDUZo87.woff2 +0 -0
  469. package/dist/packages/ui/dist/assets/rajdhani-latin-700-normal-e0Uj8ZlN.woff +0 -0
  470. package/dist/packages/ui/dist/assets/rajdhani-latin-ext-600-normal-BleIgkPp.woff +0 -0
  471. package/dist/packages/ui/dist/assets/rajdhani-latin-ext-600-normal-C9ZjJQAt.woff2 +0 -0
  472. package/dist/packages/ui/dist/assets/rajdhani-latin-ext-700-normal-BPaQ7tlD.woff +0 -0
  473. package/dist/packages/ui/dist/assets/rajdhani-latin-ext-700-normal-S6aYESQK.woff2 +0 -0
  474. package/dist/packages/ui/dist/favicon.svg +1 -0
  475. package/dist/packages/ui/dist/index.html +15 -0
  476. package/dist/third-party.json +575 -0
  477. package/dist/vendor/@fission-ai/openspec/bin/openspec.js +85986 -0
  478. package/dist/vendor/@fission-ai/openspec/package.json +82 -0
  479. package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/schema.yaml +248 -0
  480. package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/design.md +21 -0
  481. package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/proposal.md +34 -0
  482. package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/spec.md +13 -0
  483. package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/tasks.md +11 -0
  484. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
  485. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
  486. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
  487. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
  488. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
  489. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
  490. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
  491. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
  492. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
  493. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
  494. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
  495. package/dist/vendor/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
  496. package/dist/vendor/web-tree-sitter/tree-sitter.wasm +0 -0
  497. package/package.json +36 -3
@@ -0,0 +1,1019 @@
1
+ import { createRequire as __atticusCreateRequire } from "node:module";
2
+ import { fileURLToPath as __atticusFileURLToPath } from "node:url";
3
+ var require = __atticusCreateRequire(import.meta.url);
4
+ var __atticusUrl = (p) => new URL("./" + p, import.meta.url).href;
5
+ var __atticusPath = (p) => __atticusFileURLToPath(__atticusUrl(p));
6
+ import {
7
+ readRound,
8
+ reviewedGates,
9
+ roundsOf
10
+ } from "./chunk-47QE246J.js";
11
+ import {
12
+ changeFolder,
13
+ changeStore
14
+ } from "./chunk-XQ3YIV5R.js";
15
+ import {
16
+ QueryError,
17
+ askLookup,
18
+ graph,
19
+ impact,
20
+ openIndex,
21
+ translate
22
+ } from "./chunk-N4QZJJVB.js";
23
+ import {
24
+ baseClonePath,
25
+ gitUser,
26
+ loadRepos
27
+ } from "./chunk-PGKHJYOB.js";
28
+ import {
29
+ API_VERSION,
30
+ DEFAULT_PORT,
31
+ Lens,
32
+ RECORD_KINDS,
33
+ Severity,
34
+ catalogDirOf,
35
+ factsDirOf,
36
+ fastPathOf,
37
+ inputsDirOf,
38
+ knowledgeDirOf,
39
+ layoutOf,
40
+ loadOrgPack,
41
+ openspecDirOf,
42
+ orgPackDirOf,
43
+ proposalsDirOf,
44
+ questionOfLens,
45
+ questionsDirOf,
46
+ runsDirOf,
47
+ specsDirOf,
48
+ withSignal
49
+ } from "./chunk-577AJVRS.js";
50
+ import {
51
+ SCHEMA_VERSION
52
+ } from "./chunk-D3PO4DOZ.js";
53
+
54
+ // packages/server/dist/http.js
55
+ var HttpError = class extends Error {
56
+ status;
57
+ title;
58
+ detail;
59
+ extra;
60
+ constructor(status, title, detail, extra = {}) {
61
+ super(detail ?? title);
62
+ this.status = status;
63
+ this.title = title;
64
+ this.detail = detail;
65
+ this.extra = extra;
66
+ }
67
+ };
68
+ var badRequest = (detail, extra = {}) => new HttpError(400, "The request isn't valid", detail, extra);
69
+ var notFound = (detail) => new HttpError(404, "Not found", detail);
70
+ var conflict = (detail) => new HttpError(409, "Conflict", detail);
71
+ var Router = class {
72
+ routes = [];
73
+ add(method, pattern, handler, o = {}) {
74
+ this.routes.push({
75
+ method,
76
+ parts: pattern.split("/").filter(Boolean),
77
+ handler,
78
+ ...o.maxBody ? { maxBody: o.maxBody } : {}
79
+ });
80
+ return this;
81
+ }
82
+ /** The handler and path params, or the methods the path does allow (for 405). */
83
+ match(method, path) {
84
+ const segs = path.split("/").filter(Boolean);
85
+ const allowed = [];
86
+ for (const r of this.routes) {
87
+ if (r.parts.length !== segs.length)
88
+ continue;
89
+ const params = {};
90
+ let ok = true;
91
+ for (let i = 0; i < segs.length; i++) {
92
+ const want = r.parts[i];
93
+ let got;
94
+ try {
95
+ got = decodeURIComponent(segs[i]);
96
+ } catch {
97
+ ok = false;
98
+ break;
99
+ }
100
+ if (want.startsWith("{") && want.endsWith("}"))
101
+ params[want.slice(1, -1)] = got;
102
+ else if (want !== got) {
103
+ ok = false;
104
+ break;
105
+ }
106
+ }
107
+ if (!ok)
108
+ continue;
109
+ if (r.method === method)
110
+ return { handler: r.handler, params, ...r.maxBody ? { maxBody: r.maxBody } : {} };
111
+ allowed.push(r.method);
112
+ }
113
+ return { allowed };
114
+ }
115
+ };
116
+ function problem(e) {
117
+ return {
118
+ type: `https://atticus.dev/problems/${e.status}`,
119
+ title: e.title,
120
+ status: e.status,
121
+ ...e.detail ? { detail: e.detail } : {},
122
+ ...e.extra
123
+ };
124
+ }
125
+ function intParam(q, name, min, max) {
126
+ const v = q.get(name);
127
+ if (v === null || v === "")
128
+ return void 0;
129
+ const n = Number(v);
130
+ if (!Number.isInteger(n) || n < min || n > max)
131
+ throw badRequest(`${name} must be a whole number from ${min} to ${max}.`);
132
+ return n;
133
+ }
134
+ var strParam = (q, name) => q.get(name) || void 0;
135
+
136
+ // packages/server/dist/server.js
137
+ import { randomBytes, timingSafeEqual } from "node:crypto";
138
+ import { createServer } from "node:http";
139
+
140
+ // packages/server/dist/jobs.js
141
+ var JobManager = class {
142
+ publish;
143
+ now;
144
+ jobs = /* @__PURE__ */ new Map();
145
+ cancelledIds = /* @__PURE__ */ new Set();
146
+ aborts = /* @__PURE__ */ new Map();
147
+ seq = 0;
148
+ running = /* @__PURE__ */ new Map();
149
+ constructor(publish, now = () => /* @__PURE__ */ new Date()) {
150
+ this.publish = publish;
151
+ this.now = now;
152
+ }
153
+ /** The running job of a kind, if any (one scan at a time: a second asks gets 409). */
154
+ runningOf(kind) {
155
+ const id = this.running.get(kind);
156
+ return id ? this.jobs.get(id) : void 0;
157
+ }
158
+ get(id) {
159
+ return this.jobs.get(id);
160
+ }
161
+ start(kind, work) {
162
+ const id = `job-${++this.seq}`;
163
+ const job = {
164
+ id,
165
+ kind,
166
+ state: "running",
167
+ progress: { done: 0, total: 0, message: "Starting" },
168
+ startedAt: this.now().toISOString(),
169
+ errors: []
170
+ };
171
+ this.jobs.set(id, job);
172
+ this.running.set(kind, id);
173
+ const abort = new AbortController();
174
+ this.aborts.set(id, abort);
175
+ const cancelled = this.cancelledIds;
176
+ const control = {
177
+ progress: (done, total, message) => {
178
+ job.progress = { done, total, message };
179
+ this.publish({ type: "job.progress", jobId: id, done, total, message });
180
+ },
181
+ get cancelled() {
182
+ return cancelled.has(id);
183
+ }
184
+ };
185
+ void (async () => {
186
+ try {
187
+ const out = await withSignal(abort.signal, () => work(control));
188
+ if (out?.result)
189
+ job.result = out.result;
190
+ if (out?.errors?.length)
191
+ job.errors.push(...out.errors);
192
+ job.state = this.cancelledIds.has(id) ? "cancelled" : job.errors.length ? "failed" : "done";
193
+ } catch (e) {
194
+ if (this.cancelledIds.has(id))
195
+ job.state = "cancelled";
196
+ else {
197
+ job.errors.push(e instanceof Error ? e.message : String(e));
198
+ job.state = "failed";
199
+ }
200
+ }
201
+ this.aborts.delete(id);
202
+ job.finishedAt = this.now().toISOString();
203
+ if (this.running.get(kind) === id)
204
+ this.running.delete(kind);
205
+ this.publish({ type: "job.done", jobId: id, state: job.state });
206
+ })();
207
+ return job;
208
+ }
209
+ /** Ask a running job to stop; false when it already finished. */
210
+ cancel(id) {
211
+ const j = this.jobs.get(id);
212
+ if (!j || j.state !== "running")
213
+ return false;
214
+ this.cancelledIds.add(id);
215
+ this.aborts.get(id)?.abort();
216
+ return true;
217
+ }
218
+ /** Wait for a job to finish (tests and the CLI). */
219
+ async settle(id, timeoutMs = 6e4) {
220
+ const start = Date.now();
221
+ for (; ; ) {
222
+ const j = this.jobs.get(id);
223
+ if (!j)
224
+ throw new Error(`No job ${id}`);
225
+ if (j.state !== "running" && j.state !== "queued")
226
+ return j;
227
+ if (Date.now() - start > timeoutMs)
228
+ throw new Error(`Job ${id} did not finish`);
229
+ await new Promise((r) => setTimeout(r, 20));
230
+ }
231
+ }
232
+ };
233
+
234
+ // packages/server/dist/routes.js
235
+ import { readFile, stat } from "node:fs/promises";
236
+ import { join } from "node:path";
237
+ var queues = /* @__PURE__ */ new Map();
238
+ async function withIndex(root, f) {
239
+ const before = queues.get(root) ?? Promise.resolve();
240
+ const mine = before.then(async () => {
241
+ const ix = await openIndex(root);
242
+ try {
243
+ return f(ix);
244
+ } finally {
245
+ ix.close();
246
+ }
247
+ });
248
+ const settled = mine.catch(() => void 0);
249
+ queues.set(root, settled);
250
+ void settled.then(() => {
251
+ if (queues.get(root) === settled)
252
+ queues.delete(root);
253
+ });
254
+ return mine;
255
+ }
256
+ function kindParam(kind) {
257
+ if (!RECORD_KINDS.includes(kind))
258
+ throw badRequest(`${kind} is not a record kind. Kinds: ${RECORD_KINDS.join(", ")}.`);
259
+ return kind;
260
+ }
261
+ function enumParam(q, name, options) {
262
+ const v = strParam(q, name);
263
+ if (v !== void 0 && !options.includes(v))
264
+ throw badRequest(`${name} must be one of ${options.join(", ")}.`);
265
+ return v;
266
+ }
267
+ async function latestFindings(root, change) {
268
+ const out = [];
269
+ for (const gate of await reviewedGates(root, change)) {
270
+ const rounds = await roundsOf(root, change, gate);
271
+ if (rounds.length === 0)
272
+ continue;
273
+ const r = await readRound(root, change, gate, rounds[rounds.length - 1]);
274
+ out.push(...r.findings.map((f) => f.finding));
275
+ }
276
+ return out;
277
+ }
278
+ function summary(c, findings, fast = false) {
279
+ const open = { blocking: 0, gap: 0, risk: 0, idea: 0 };
280
+ for (const f of findings)
281
+ if (f.state === "open")
282
+ open[f.severity] += 1;
283
+ const last = c.history[c.history.length - 1];
284
+ return {
285
+ id: c.id,
286
+ title: c.title,
287
+ type: c.type,
288
+ state: c.state,
289
+ repos: c.touches.repos,
290
+ openFindings: open,
291
+ updatedAt: last?.at ?? c.createdAt,
292
+ ...fast ? { fastPath: true } : {}
293
+ };
294
+ }
295
+ function apiRoutes(r, ctx) {
296
+ const { root } = ctx;
297
+ return r.add("GET", "/api/health", () => ({
298
+ status: 200,
299
+ body: {
300
+ version: ctx.version,
301
+ apiVersion: API_VERSION,
302
+ schemaVersion: SCHEMA_VERSION,
303
+ root,
304
+ openspec: layoutOf(root).openspec.replace(/\/+$/, ""),
305
+ user: ctx.user,
306
+ full: ctx.full === true
307
+ }
308
+ })).add("GET", "/api/catalog/kinds", async () => ({
309
+ status: 200,
310
+ body: await withIndex(root, (ix) => ix.kinds())
311
+ })).add("GET", "/api/catalog/{kind}", async ({ params, query }) => {
312
+ const kind = kindParam(params.kind);
313
+ const limit = intParam(query, "limit", 1, 500);
314
+ const o = {
315
+ ...strParam(query, "status") ? { status: strParam(query, "status") } : {},
316
+ ...strParam(query, "system") ? { system: strParam(query, "system") } : {},
317
+ ...strParam(query, "q") ? { q: strParam(query, "q") } : {},
318
+ ...strParam(query, "cursor") ? { cursor: strParam(query, "cursor") } : {},
319
+ ...limit !== void 0 ? { limit } : {}
320
+ };
321
+ return { status: 200, body: await withIndex(root, (ix) => ix.list(kind, o)) };
322
+ }).add("GET", "/api/catalog/{kind}/{id}", async ({ params }) => {
323
+ const kind = kindParam(params.kind);
324
+ const rec = await withIndex(root, (ix) => ix.get(kind, params.id));
325
+ if (!rec)
326
+ throw notFound(`There is no ${kind} ${params.id}.`);
327
+ return { status: 200, body: rec };
328
+ }).add("GET", "/api/search", async ({ query }) => {
329
+ const q = strParam(query, "q");
330
+ if (!q)
331
+ throw badRequest("Say what to look for: ?q=<words or filters>.");
332
+ const limit = intParam(query, "limit", 1, 500) ?? 100;
333
+ const offset = intParam(query, "offset", 0, 1e6) ?? 0;
334
+ try {
335
+ return { status: 200, body: await withIndex(root, (ix) => ix.query(q, { limit, offset })) };
336
+ } catch (e) {
337
+ if (e instanceof QueryError)
338
+ throw badRequest(e.message);
339
+ throw e;
340
+ }
341
+ }).add("GET", "/api/ask", async ({ query }) => {
342
+ const q = strParam(query, "q");
343
+ if (!q)
344
+ throw badRequest("Ask a question: ?q=<plain words>.");
345
+ return {
346
+ status: 200,
347
+ body: await withIndex(root, (ix) => {
348
+ const asked = translate(q, askLookup(ix));
349
+ if (asked.action === "impact")
350
+ return { question: q, ...asked, impact: impact(ix, asked.id, 4) };
351
+ if (asked.action === "owner") {
352
+ const r2 = ix.find(asked.id)[0];
353
+ const owner = r2?.owner ?? r2?.ownerComponent ?? (r2 ? ix.find(String(r2.system ?? ""))[0]?.owner : void 0);
354
+ return { question: q, ...asked, owner: owner ?? null };
355
+ }
356
+ try {
357
+ return { question: q, ...asked, result: ix.query(asked.query, { limit: 60 }) };
358
+ } catch (e) {
359
+ if (e instanceof QueryError)
360
+ return { question: q, ...asked, error: e.message };
361
+ throw e;
362
+ }
363
+ })
364
+ };
365
+ }).add("GET", "/api/graph", async ({ query }) => {
366
+ const depth = intParam(query, "depth", 1, 6);
367
+ const o = {
368
+ ...strParam(query, "focus") ? { focus: strParam(query, "focus") } : {},
369
+ ...strParam(query, "status") ? { status: strParam(query, "status") } : {},
370
+ ...depth !== void 0 ? { depth } : {}
371
+ };
372
+ return { status: 200, body: await withIndex(root, (ix) => graph(ix, o)) };
373
+ }).add("GET", "/api/impact/{id}", async ({ params, query }) => {
374
+ const depth = intParam(query, "depth", 1, 10);
375
+ const res = await withIndex(root, (ix) => impact(ix, params.id, depth));
376
+ if (!res)
377
+ throw notFound(`There is no record ${params.id} in the catalog.`);
378
+ return { status: 200, body: res };
379
+ }).add("GET", "/api/incident/{id}", async ({ params }) => {
380
+ const res = await withIndex(root, (ix) => {
381
+ const reach = impact(ix, params.id, 3);
382
+ if (!reach)
383
+ return void 0;
384
+ const rootRec = ix.find(params.id)[0];
385
+ const ids = [params.id, ...reach.affected.map((a) => a.id)];
386
+ const kindOf = new Map(reach.affected.map((a) => [a.id, a.kind]));
387
+ kindOf.set(params.id, rootRec.kind);
388
+ const systems = /* @__PURE__ */ new Set();
389
+ for (const id of ids) {
390
+ const k = kindOf.get(id);
391
+ const sys = k === "System" ? id : ix.systemOf(k, id);
392
+ if (sys)
393
+ systems.add(sys);
394
+ }
395
+ const owners = /* @__PURE__ */ new Map();
396
+ const unowned = [];
397
+ for (const sys of [...systems].sort()) {
398
+ const rec = ix.get("System", sys);
399
+ if (!rec?.owner)
400
+ unowned.push(sys);
401
+ else {
402
+ const o = owners.get(rec.owner) ?? { owner: rec.owner, systems: [] };
403
+ o.systems.push(sys);
404
+ owners.set(rec.owner, o);
405
+ }
406
+ }
407
+ const components = new Set(ids.filter((id) => kindOf.get(id) === "Component"));
408
+ const watch2 = ix.query("kind:observabilityasset", { limit: 500 }).rows.map((r2) => ix.get(r2.kind, r2.id)).filter((a) => components.has(String(a.component))).map((a) => ({
409
+ component: String(a.component),
410
+ kind: String(a.assetKind),
411
+ name: String(a.name),
412
+ ...a.link ? { link: String(a.link) } : {}
413
+ }));
414
+ return {
415
+ reach,
416
+ systems: [...systems].sort(),
417
+ owners: [...owners.values()],
418
+ unowned,
419
+ watch: watch2
420
+ };
421
+ });
422
+ if (!res)
423
+ throw notFound(`There is no record ${params.id} in the catalog.`);
424
+ const near = /* @__PURE__ */ new Set([...res.systems, params.id, ...res.reach.affected.map((a) => a.id)]);
425
+ const changes = (await changeStore(root).list()).filter((c) => c.systems.some((s) => near.has(s)) || [...c.touches.records, ...c.touches.tables, ...c.touches.dataStores].some((x) => near.has(x))).map((c) => ({
426
+ id: c.id,
427
+ title: c.title,
428
+ state: c.state,
429
+ updatedAt: c.history.at(-1)?.at ?? c.createdAt,
430
+ systems: c.systems.filter((s) => near.has(s))
431
+ })).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
432
+ return {
433
+ status: 200,
434
+ body: {
435
+ id: params.id,
436
+ blastRadius: res.reach.affected.length,
437
+ affected: res.reach.affected,
438
+ systems: res.systems,
439
+ call: res.owners,
440
+ ownerUnknown: res.unowned,
441
+ watch: res.watch,
442
+ recentChanges: changes
443
+ }
444
+ };
445
+ }).add("GET", "/api/repos", async () => {
446
+ const repos = await loadRepos(root);
447
+ const body = [];
448
+ for (const repo of repos) {
449
+ const present = await stat(join(baseClonePath(root, repo.id), ".git")).then(() => true, () => false);
450
+ body.push({ ...repo, baseClone: { present } });
451
+ }
452
+ return { status: 200, body };
453
+ }).add("GET", "/api/changes", async ({ query }) => {
454
+ const state = strParam(query, "state");
455
+ const changes = (await changeStore(root).list()).filter((c) => !state || c.state === state);
456
+ const body = [];
457
+ const types = await loadOrgPack(orgPackDirOf(root)).then((op) => op.changeTypes.types, () => []);
458
+ for (const c of changes.sort((a, b) => a.id.localeCompare(b.id))) {
459
+ const type = types.find((t) => t.id === c.type);
460
+ const fast = !!type && (type.size === "small" || !!type.smallWhenBriefSays) && fastPathOf(type, await readFile(join(changeFolder(root, c.id), "brief.md"), "utf8").catch(() => "")).fast;
461
+ body.push(summary(c, await latestFindings(root, c.id), fast));
462
+ }
463
+ return { status: 200, body };
464
+ }).add("GET", "/api/findings", async ({ query }) => {
465
+ const change = strParam(query, "change");
466
+ const gate = strParam(query, "gate");
467
+ const state = strParam(query, "state");
468
+ const lens = enumParam(query, "lens", Lens.options);
469
+ const severity = enumParam(query, "severity", Severity.options);
470
+ const ids = change ? [change] : (await changeStore(root).list()).map((c) => c.id).sort();
471
+ const body = [];
472
+ for (const id of ids)
473
+ for (const f of await latestFindings(root, id))
474
+ if ((!gate || f.gate === gate) && (!state || f.state === state) && // A lens filter asks its question: an old lens name finds what its question raised.
475
+ (!lens || questionOfLens(f.lens) === questionOfLens(lens)) && (!severity || f.severity === severity))
476
+ body.push(f);
477
+ return { status: 200, body };
478
+ }).add("GET", "/api/findings/{changeId}/{findingId}", async ({ params }) => {
479
+ const f = (await latestFindings(root, params.changeId)).find((x) => x.id === params.findingId);
480
+ if (!f)
481
+ throw notFound(`Change ${params.changeId} has no finding ${params.findingId}.`);
482
+ return { status: 200, body: f };
483
+ }).add("GET", "/api/orgpack", async () => {
484
+ const op = await loadOrgPack(orgPackDirOf(root));
485
+ return {
486
+ status: 200,
487
+ body: {
488
+ defaulted: op.defaulted,
489
+ counts: {
490
+ patterns: op.patterns.length,
491
+ dialects: op.dialects.length,
492
+ checklists: op.checklists.length,
493
+ agents: op.agents.length,
494
+ procedures: op.procedures.length,
495
+ serviceRequests: op.serviceRequests.length,
496
+ profiles: op.profiles.length,
497
+ gates: Object.keys(op.gates ?? {}).length
498
+ },
499
+ // Additive (ADR 0043): the patterns, checklists and procedures themselves, for the screen.
500
+ patterns: op.patterns,
501
+ checklists: op.checklists.map((c) => ({
502
+ name: c.name,
503
+ version: c.version,
504
+ rules: c.rules.length
505
+ })),
506
+ procedures: op.procedures.map((x) => ({
507
+ id: x.id,
508
+ title: x.title,
509
+ steps: x.steps?.length ?? 0
510
+ })),
511
+ problems: op.problems.map((p) => ({
512
+ file: p.file,
513
+ path: p.path ?? "",
514
+ message: p.message
515
+ }))
516
+ }
517
+ };
518
+ });
519
+ }
520
+
521
+ // packages/server/dist/static.js
522
+ import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
523
+ import { extname, join as join2, normalize, sep } from "node:path";
524
+ var TYPES = {
525
+ ".html": "text/html; charset=utf-8",
526
+ ".js": "text/javascript; charset=utf-8",
527
+ ".css": "text/css; charset=utf-8",
528
+ ".json": "application/json; charset=utf-8",
529
+ ".svg": "image/svg+xml",
530
+ ".png": "image/png",
531
+ ".ico": "image/x-icon",
532
+ ".woff": "font/woff",
533
+ ".woff2": "font/woff2",
534
+ ".map": "application/json; charset=utf-8",
535
+ ".txt": "text/plain; charset=utf-8"
536
+ };
537
+ function appCsp(port, embed) {
538
+ return [
539
+ "default-src 'self'",
540
+ `connect-src 'self' ws://127.0.0.1:${port} ws://localhost:${port}`,
541
+ "img-src 'self' data:",
542
+ "style-src 'self' 'unsafe-inline'",
543
+ "font-src 'self' data:",
544
+ "script-src 'self'",
545
+ "object-src 'none'",
546
+ "base-uri 'none'",
547
+ embed === "vscode" ? "frame-ancestors vscode-webview:" : "frame-ancestors 'none'",
548
+ "form-action 'self'"
549
+ ].join("; ");
550
+ }
551
+ var escapeAttr = (s) => s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
552
+ async function staticFile(dir, path, token) {
553
+ let rel;
554
+ try {
555
+ rel = decodeURIComponent(path);
556
+ } catch {
557
+ return { status: 400, type: TYPES[".txt"], body: "Bad path", cache: "no-store" };
558
+ }
559
+ if (rel === "/" || rel === "")
560
+ rel = "/index.html";
561
+ const file = normalize(join2(dir, rel));
562
+ if (file !== dir && !file.startsWith(dir.endsWith(sep) ? dir : dir + sep))
563
+ return { status: 404, type: TYPES[".txt"], body: "Not found", cache: "no-store" };
564
+ const info = await stat2(file).catch(() => void 0);
565
+ const target = info?.isFile() ? file : extname(rel) ? void 0 : join2(dir, "index.html");
566
+ if (!target)
567
+ return { status: 404, type: TYPES[".txt"], body: "Not found", cache: "no-store" };
568
+ const ext = extname(target).toLowerCase();
569
+ const type = TYPES[ext] ?? "application/octet-stream";
570
+ if (ext === ".html") {
571
+ const html = (await readFile2(target, "utf8")).replace(/<meta name="atticus-token" content="[^"]*"\s*\/?>/, `<meta name="atticus-token" content="${escapeAttr(token)}" />`);
572
+ return { status: 200, type, body: html, cache: "no-store" };
573
+ }
574
+ return {
575
+ status: 200,
576
+ type,
577
+ body: await readFile2(target),
578
+ // Built assets carry a content hash in their name.
579
+ cache: /[.-][A-Za-z0-9_-]{8,}\.(js|css|woff2?)$/.test(target) ? "public, max-age=31536000, immutable" : "no-cache"
580
+ };
581
+ }
582
+
583
+ // packages/server/dist/watch.js
584
+ import { statSync, watch } from "node:fs";
585
+ import { join as join3, relative, sep as sep2 } from "node:path";
586
+ var SKIP = /* @__PURE__ */ new Set([".git", "node_modules", ".index", "workspace", "logs", ".vitest-cache"]);
587
+ var TEMP = /(~|\.swp|\.swx|\.tmp|\.crdownload|\.part)$/i;
588
+ var posix = (p) => p.split(sep2).join("/");
589
+ var isDir = (p) => {
590
+ try {
591
+ return statSync(p).isDirectory();
592
+ } catch {
593
+ return false;
594
+ }
595
+ };
596
+ function watchMetarepo(o) {
597
+ const root = o.root;
598
+ const delay = o.delayMs ?? 300;
599
+ const maxPaths = o.maxPaths ?? 50;
600
+ const watchers = /* @__PURE__ */ new Map();
601
+ const problems = [];
602
+ const pending = /* @__PURE__ */ new Set();
603
+ let timer;
604
+ let first = 0;
605
+ let closed = false;
606
+ const skipped = (rel) => rel === "" || rel.startsWith("..") || TEMP.test(rel) || rel.split("/").some((s) => SKIP.has(s));
607
+ const flush = () => {
608
+ timer = void 0;
609
+ first = 0;
610
+ if (closed || !pending.size)
611
+ return;
612
+ let out = [...pending].sort();
613
+ pending.clear();
614
+ if (out.length > maxPaths)
615
+ out = [...new Set(out.map((p) => p.split("/").slice(0, 2).join("/")))].sort();
616
+ for (const path of out)
617
+ o.publish({ type: "file.changed", path });
618
+ };
619
+ const note = (abs) => {
620
+ const rel = posix(relative(root, abs));
621
+ if (skipped(rel))
622
+ return;
623
+ pending.add(rel);
624
+ const now = Date.now();
625
+ if (!first)
626
+ first = now;
627
+ clearTimeout(timer);
628
+ timer = setTimeout(flush, now - first > delay * 5 ? 0 : delay);
629
+ };
630
+ const folders = () => {
631
+ const all = [
632
+ orgPackDirOf(root),
633
+ catalogDirOf(root),
634
+ openspecDirOf(root),
635
+ specsDirOf(root),
636
+ questionsDirOf(root),
637
+ knowledgeDirOf(root),
638
+ proposalsDirOf(root),
639
+ inputsDirOf(root),
640
+ runsDirOf(root),
641
+ // ADR 0124: the facts and the verifier's reports, for the Map's Trust tab.
642
+ factsDirOf(root),
643
+ join3(root, ".atticus", "history")
644
+ ].filter((d) => !skipped(posix(relative(root, d))));
645
+ const unique = [...new Set(all)].sort();
646
+ return unique.filter((d) => !unique.some((p) => p !== d && d.startsWith(p + sep2)));
647
+ };
648
+ const follow = (dir, recursive) => {
649
+ if (closed || watchers.has(dir) || !isDir(dir))
650
+ return;
651
+ try {
652
+ const w = watch(dir, { recursive }, (_event, name) => {
653
+ if (!recursive && name) {
654
+ attach();
655
+ if (watchers.has(join3(dir, String(name))))
656
+ return;
657
+ }
658
+ note(name ? join3(dir, String(name)) : dir);
659
+ });
660
+ w.on("error", (e) => {
661
+ problems.push(`${posix(relative(root, dir)) || "."}: ${e.message}`);
662
+ w.close();
663
+ watchers.delete(dir);
664
+ });
665
+ watchers.set(dir, w);
666
+ } catch (e) {
667
+ problems.push(`${posix(relative(root, dir)) || "."}: ${e.message}`);
668
+ }
669
+ };
670
+ const attach = () => {
671
+ for (const d of folders())
672
+ follow(d, true);
673
+ };
674
+ follow(root, false);
675
+ follow(join3(root, ".atticus"), false);
676
+ attach();
677
+ return {
678
+ get following() {
679
+ return [...watchers.keys()].filter((d) => d !== root && d !== join3(root, ".atticus")).map((d) => posix(relative(root, d))).sort();
680
+ },
681
+ problems,
682
+ close() {
683
+ closed = true;
684
+ clearTimeout(timer);
685
+ for (const w of watchers.values())
686
+ w.close();
687
+ watchers.clear();
688
+ pending.clear();
689
+ }
690
+ };
691
+ }
692
+
693
+ // packages/server/dist/ws.js
694
+ import { createHash } from "node:crypto";
695
+ var GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
696
+ function acceptKey(key) {
697
+ return createHash("sha1").update(key + GUID).digest("base64");
698
+ }
699
+ function frame(opcode, payload) {
700
+ const len = payload.length;
701
+ let head;
702
+ if (len < 126)
703
+ head = Buffer.from([128 | opcode, len]);
704
+ else if (len < 65536) {
705
+ head = Buffer.alloc(4);
706
+ head[0] = 128 | opcode;
707
+ head[1] = 126;
708
+ head.writeUInt16BE(len, 2);
709
+ } else {
710
+ head = Buffer.alloc(10);
711
+ head[0] = 128 | opcode;
712
+ head[1] = 127;
713
+ head.writeBigUInt64BE(BigInt(len), 2);
714
+ }
715
+ return Buffer.concat([head, payload]);
716
+ }
717
+ var Socket = class {
718
+ sock;
719
+ onClose;
720
+ buf = Buffer.alloc(0);
721
+ closed = false;
722
+ constructor(sock, onClose) {
723
+ this.sock = sock;
724
+ this.onClose = onClose;
725
+ sock.on("data", (d) => this.read(d));
726
+ sock.on("close", () => this.end());
727
+ sock.on("error", () => this.end());
728
+ }
729
+ send(text) {
730
+ if (!this.closed)
731
+ this.sock.write(frame(1, Buffer.from(text, "utf8")));
732
+ }
733
+ close() {
734
+ if (this.closed)
735
+ return;
736
+ this.sock.write(frame(8, Buffer.alloc(0)));
737
+ this.sock.end();
738
+ this.end();
739
+ }
740
+ end() {
741
+ if (this.closed)
742
+ return;
743
+ this.closed = true;
744
+ this.onClose(this);
745
+ }
746
+ /** Client frames are masked; only control frames matter to us. */
747
+ read(d) {
748
+ this.buf = Buffer.concat([this.buf, d]);
749
+ while (this.buf.length >= 2) {
750
+ const opcode = this.buf[0] & 15;
751
+ const masked = (this.buf[1] & 128) !== 0;
752
+ let len = this.buf[1] & 127;
753
+ let off = 2;
754
+ if (len === 126) {
755
+ if (this.buf.length < 4)
756
+ return;
757
+ len = this.buf.readUInt16BE(2);
758
+ off = 4;
759
+ } else if (len === 127) {
760
+ if (this.buf.length < 10)
761
+ return;
762
+ len = Number(this.buf.readBigUInt64BE(2));
763
+ off = 10;
764
+ }
765
+ const maskOff = off;
766
+ if (masked)
767
+ off += 4;
768
+ if (this.buf.length < off + len)
769
+ return;
770
+ const payload = Buffer.from(this.buf.subarray(off, off + len));
771
+ if (masked)
772
+ for (let i = 0; i < payload.length; i++)
773
+ payload[i] ^= this.buf[maskOff + i % 4];
774
+ this.buf = this.buf.subarray(off + len);
775
+ if (opcode === 8)
776
+ return this.close();
777
+ if (opcode === 9)
778
+ this.sock.write(frame(10, payload));
779
+ }
780
+ }
781
+ };
782
+ function upgrade(req, sock, onClose) {
783
+ const key = req.headers["sec-websocket-key"];
784
+ if (typeof key !== "string" || req.headers["sec-websocket-version"] !== "13") {
785
+ sock.end("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n");
786
+ return void 0;
787
+ }
788
+ sock.write([
789
+ "HTTP/1.1 101 Switching Protocols",
790
+ "Upgrade: websocket",
791
+ "Connection: Upgrade",
792
+ `Sec-WebSocket-Accept: ${acceptKey(key)}`,
793
+ "",
794
+ ""
795
+ ].join("\r\n"));
796
+ return new Socket(sock, onClose);
797
+ }
798
+
799
+ // packages/server/dist/server.js
800
+ var EventHub = class {
801
+ sockets = /* @__PURE__ */ new Set();
802
+ listeners = /* @__PURE__ */ new Set();
803
+ /** Hear every event in this process too (ADR 0119: a reader that keeps files in memory). */
804
+ listen(fn) {
805
+ this.listeners.add(fn);
806
+ return () => this.listeners.delete(fn);
807
+ }
808
+ add(s) {
809
+ this.sockets.add(s);
810
+ }
811
+ remove(s) {
812
+ this.sockets.delete(s);
813
+ }
814
+ get size() {
815
+ return this.sockets.size;
816
+ }
817
+ publish(e) {
818
+ for (const fn of this.listeners)
819
+ fn(e);
820
+ const text = JSON.stringify(e);
821
+ for (const s of this.sockets)
822
+ s.send(text);
823
+ }
824
+ closeAll() {
825
+ for (const s of [...this.sockets])
826
+ s.close();
827
+ }
828
+ };
829
+ var MAX_BODY = 4 * 1024 * 1024;
830
+ function sameToken(a, b) {
831
+ const x = Buffer.from(a);
832
+ const y = Buffer.from(b);
833
+ return x.length === y.length && timingSafeEqual(x, y);
834
+ }
835
+ async function readBody(req, max = MAX_BODY) {
836
+ const chunks = [];
837
+ let size = 0;
838
+ for await (const c of req) {
839
+ size += c.length;
840
+ if (size > max)
841
+ throw new HttpError(413, "The request body is too large");
842
+ chunks.push(c);
843
+ }
844
+ if (size === 0)
845
+ return void 0;
846
+ const type = req.headers["content-type"] ?? "";
847
+ if (!type.startsWith("application/json"))
848
+ throw new HttpError(415, "Send the body as application/json");
849
+ try {
850
+ return JSON.parse(Buffer.concat(chunks).toString("utf8"));
851
+ } catch {
852
+ throw new HttpError(400, "The request isn't valid", "The body is not valid JSON.");
853
+ }
854
+ }
855
+ var HARDENING = {
856
+ "X-Content-Type-Options": "nosniff",
857
+ "X-Frame-Options": "DENY",
858
+ "Cross-Origin-Resource-Policy": "same-origin",
859
+ "Cross-Origin-Opener-Policy": "same-origin",
860
+ "Referrer-Policy": "no-referrer",
861
+ "Permissions-Policy": "camera=(), microphone=(), geolocation=(), usb=(), payment=()"
862
+ };
863
+ function send(res, status, body, type = "application/json") {
864
+ const text = body === void 0 ? "" : JSON.stringify(body);
865
+ res.writeHead(status, {
866
+ ...HARDENING,
867
+ "Content-Type": `${type}; charset=utf-8`,
868
+ "Cache-Control": "no-store"
869
+ });
870
+ res.end(text);
871
+ }
872
+ async function startServer(o) {
873
+ const host = o.host ?? "127.0.0.1";
874
+ if (host !== "127.0.0.1")
875
+ throw new Error(`Atticus only listens on 127.0.0.1 (asked for ${host}).`);
876
+ const token = o.token && /^[A-Za-z0-9_-]{32,}$/.test(o.token) ? o.token : randomBytes(32).toString("base64url");
877
+ const events = new EventHub();
878
+ const jobs = new JobManager((e) => events.publish(e));
879
+ const person = o.user ? { handle: o.user, source: "given" } : await gitUser(o.root);
880
+ const ctx = {
881
+ root: o.root,
882
+ user: person.handle,
883
+ person,
884
+ version: o.version ?? "0.0.0",
885
+ full: o.full === true,
886
+ events,
887
+ jobs
888
+ };
889
+ const router = apiRoutes(new Router(), ctx).add("GET", "/api/jobs/{jobId}", ({ params }) => {
890
+ const j = jobs.get(params.jobId);
891
+ if (!j)
892
+ throw notFound(`There is no job ${params.jobId}.`);
893
+ return { status: 200, body: j };
894
+ }).add("POST", "/api/jobs/{jobId}/cancel", ({ params }) => {
895
+ const j = jobs.get(params.jobId);
896
+ if (!j)
897
+ throw notFound(`There is no job ${params.jobId}.`);
898
+ if (!jobs.cancel(j.id))
899
+ throw conflict(`Job ${j.id} already finished (${j.state}).`);
900
+ return { status: 200, body: j };
901
+ });
902
+ o.extend?.(router, ctx);
903
+ let port = 0;
904
+ const allowedHosts = () => /* @__PURE__ */ new Set([`127.0.0.1:${port}`, `localhost:${port}`]);
905
+ const guard = (req, url, tokenFromQuery) => {
906
+ if (!allowedHosts().has(req.headers.host ?? ""))
907
+ throw new HttpError(403, "Requests must be addressed to this server");
908
+ const origin = req.headers.origin;
909
+ if (origin && !allowedHosts().has(origin.replace(/^https?:\/\//, "")))
910
+ throw new HttpError(403, "Requests from other sites are not allowed");
911
+ const given = req.headers["x-atticus-token"] ?? (tokenFromQuery ? url.searchParams.get("token") ?? void 0 : void 0);
912
+ if (!given || !sameToken(given, token))
913
+ throw new HttpError(401, "Missing or wrong session token");
914
+ };
915
+ const server = createServer(async (req, res) => {
916
+ const t0 = Date.now();
917
+ const done = (status, error) => {
918
+ const path = (req.url ?? "/").split("?")[0];
919
+ if (path.startsWith("/api/"))
920
+ o.onRequest?.({
921
+ method: req.method ?? "GET",
922
+ path,
923
+ status,
924
+ ms: Date.now() - t0,
925
+ ...error ? { error } : {}
926
+ });
927
+ };
928
+ try {
929
+ const url = new URL(req.url ?? "/", "http://127.0.0.1");
930
+ if (!url.pathname.startsWith("/api/")) {
931
+ if (!allowedHosts().has(req.headers.host ?? ""))
932
+ throw new HttpError(403, "Requests must be addressed to this server");
933
+ if (!o.staticDir || req.method !== "GET" && req.method !== "HEAD")
934
+ throw new HttpError(404, "Not found", `Nothing is served at ${url.pathname}.`);
935
+ const f = await staticFile(o.staticDir, url.pathname, token);
936
+ const { "X-Frame-Options": deny, ...rest } = HARDENING;
937
+ res.writeHead(f.status, {
938
+ ...o.embed ? rest : { ...rest, "X-Frame-Options": deny },
939
+ "Content-Type": f.type,
940
+ "Cache-Control": f.cache,
941
+ "Content-Security-Policy": appCsp(port, o.embed)
942
+ });
943
+ res.end(req.method === "HEAD" ? void 0 : f.body);
944
+ return;
945
+ }
946
+ guard(req, url, false);
947
+ const m = router.match(req.method ?? "GET", url.pathname);
948
+ if ("allowed" in m) {
949
+ if (m.allowed.length === 0)
950
+ throw new HttpError(404, "Not found", `There is no API call ${url.pathname}.`);
951
+ throw new HttpError(405, "Method not allowed", `Use ${m.allowed.join(" or ")}.`);
952
+ }
953
+ const body = await readBody(req, m.maxBody);
954
+ const out = await m.handler({
955
+ method: req.method ?? "GET",
956
+ path: url.pathname,
957
+ params: m.params,
958
+ query: url.searchParams,
959
+ body
960
+ });
961
+ send(res, out.status, out.body);
962
+ done(out.status);
963
+ } catch (e) {
964
+ const err = e instanceof HttpError ? e : new HttpError(500, "Something went wrong", e instanceof Error ? e.message : String(e));
965
+ send(res, err.status, problem(err), "application/problem+json");
966
+ done(err.status, err.status >= 500 && e instanceof Error ? e : void 0);
967
+ }
968
+ });
969
+ server.on("upgrade", (req, sock) => {
970
+ const url = new URL(req.url ?? "/", "http://127.0.0.1");
971
+ try {
972
+ if (url.pathname !== "/api/events")
973
+ throw new HttpError(404, "Not found");
974
+ guard(req, url, true);
975
+ } catch (e) {
976
+ const err = e instanceof HttpError ? e : new HttpError(400, "Bad request");
977
+ sock.end(`HTTP/1.1 ${err.status} ${err.title}\r
978
+ Connection: close\r
979
+ \r
980
+ `);
981
+ return;
982
+ }
983
+ const s = upgrade(req, sock, (x) => events.remove(x));
984
+ if (s)
985
+ events.add(s);
986
+ });
987
+ await new Promise((resolve, reject) => {
988
+ server.once("error", reject);
989
+ server.listen(o.port ?? DEFAULT_PORT, host, () => resolve());
990
+ });
991
+ port = server.address().port;
992
+ const watcher = o.watch === false ? void 0 : watchMetarepo({ root: o.root, publish: (e) => events.publish(e) });
993
+ return {
994
+ url: `http://127.0.0.1:${port}`,
995
+ port,
996
+ token,
997
+ events,
998
+ jobs,
999
+ person,
1000
+ get following() {
1001
+ return watcher?.following ?? [];
1002
+ },
1003
+ close: () => new Promise((resolve) => {
1004
+ watcher?.close();
1005
+ events.closeAll();
1006
+ server.closeAllConnections?.();
1007
+ server.close(() => resolve());
1008
+ })
1009
+ };
1010
+ }
1011
+
1012
+ export {
1013
+ HttpError,
1014
+ badRequest,
1015
+ notFound,
1016
+ conflict,
1017
+ strParam,
1018
+ startServer
1019
+ };