@maycombhq/atticus 0.0.0-stage → 2.0.0-beta.2
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.
- package/LICENSE +177 -0
- package/README.md +17 -2
- package/THIRD-PARTY-LICENSES.txt +2607 -0
- package/dist/bin.js +47 -0
- package/dist/chunk-23W7VWKR.js +2609 -0
- package/dist/chunk-27NKUS3X.js +4330 -0
- package/dist/chunk-2ANOROX3.js +2522 -0
- package/dist/chunk-2BF2EYJV.js +174 -0
- package/dist/chunk-2BFCZ3RK.js +315 -0
- package/dist/chunk-2DIQQJCB.js +378 -0
- package/dist/chunk-2RMYG36Q.js +1227 -0
- package/dist/chunk-2VHF7OXM.js +55 -0
- package/dist/chunk-3ALD2W2A.js +95 -0
- package/dist/chunk-3C7EYRFZ.js +41 -0
- package/dist/chunk-3G4YI4ZU.js +16 -0
- package/dist/chunk-3HI6Z55Y.js +5949 -0
- package/dist/chunk-3USYZGRF.js +324 -0
- package/dist/chunk-42EVSKME.js +37 -0
- package/dist/chunk-4AK7IBVP.js +915 -0
- package/dist/chunk-4BKGMUIK.js +53 -0
- package/dist/chunk-4BN53TG3.js +343 -0
- package/dist/chunk-4NDAAFQT.js +103 -0
- package/dist/chunk-4Q3NN7VF.js +32 -0
- package/dist/chunk-4RS5KZQD.js +25 -0
- package/dist/chunk-4SKZDI62.js +22 -0
- package/dist/chunk-4WBVUHXN.js +69 -0
- package/dist/chunk-5GDRCDQB.js +32 -0
- package/dist/chunk-5GGOLAKC.js +856 -0
- package/dist/chunk-5KLGBXG5.js +48 -0
- package/dist/chunk-5WG5YP4T.js +34 -0
- package/dist/chunk-64EQYWCA.js +180 -0
- package/dist/chunk-652QWTLZ.js +242 -0
- package/dist/chunk-65NYPGRC.js +766 -0
- package/dist/chunk-66YVAGGM.js +46 -0
- package/dist/chunk-6BNC6EQ4.js +41 -0
- package/dist/chunk-6BVONWJ7.js +50 -0
- package/dist/chunk-6D2CQ5II.js +41 -0
- package/dist/chunk-6IU67AEK.js +325 -0
- package/dist/chunk-6J5OKA4Y.js +49 -0
- package/dist/chunk-6JCPI55B.js +92 -0
- package/dist/chunk-6JUBZBMW.js +56 -0
- package/dist/chunk-6M5NK3K3.js +415 -0
- package/dist/chunk-6QSERWXH.js +53 -0
- package/dist/chunk-6TACQN3N.js +41 -0
- package/dist/chunk-76WKMA4J.js +14 -0
- package/dist/chunk-7AVHLZGD.js +45 -0
- package/dist/chunk-7EFILTCI.js +67 -0
- package/dist/chunk-7EKXJZ2Y.js +2902 -0
- package/dist/chunk-7EOBHUMC.js +133 -0
- package/dist/chunk-7FBGJFEE.js +66 -0
- package/dist/chunk-7JUKDRSZ.js +1726 -0
- package/dist/chunk-7SW2QWLU.js +212 -0
- package/dist/chunk-7WD63HU2.js +143 -0
- package/dist/chunk-7ZUIMTOU.js +108 -0
- package/dist/chunk-A3GY6SOA.js +95 -0
- package/dist/chunk-A7UPUQFY.js +2356 -0
- package/dist/chunk-AA6YULYB.js +376 -0
- package/dist/chunk-ABWHYWNI.js +101 -0
- package/dist/chunk-AIOQPLA5.js +540 -0
- package/dist/chunk-AVJDSJ2F.js +18 -0
- package/dist/chunk-B2WLAWNJ.js +374 -0
- package/dist/chunk-BKVWTZ6A.js +211 -0
- package/dist/chunk-BOHJZTEQ.js +1991 -0
- package/dist/chunk-BWZ77RQT.js +25 -0
- package/dist/chunk-C6EKFH7J.js +169 -0
- package/dist/chunk-CAQZUNOH.js +1150 -0
- package/dist/chunk-CEXSU4S6.js +1217 -0
- package/dist/chunk-CKSITVS4.js +16101 -0
- package/dist/chunk-CNUKCS2T.js +2741 -0
- package/dist/chunk-CPA6HPVR.js +3206 -0
- package/dist/chunk-CR3MTH32.js +207 -0
- package/dist/chunk-CSZ4C5N6.js +307 -0
- package/dist/chunk-D3PO4DOZ.js +261 -0
- package/dist/chunk-D46WUV3T.js +33 -0
- package/dist/chunk-DE76JROX.js +80 -0
- package/dist/chunk-DFBCSHVT.js +69 -0
- package/dist/chunk-DHPACDG7.js +104 -0
- package/dist/chunk-DKJA76CJ.js +113 -0
- package/dist/chunk-DPUYDDQG.js +164 -0
- package/dist/chunk-DPZHZQKE.js +285 -0
- package/dist/chunk-E36QOJMD.js +47 -0
- package/dist/chunk-EADP3PEN.js +450 -0
- package/dist/chunk-EBEW3XXQ.js +166 -0
- package/dist/chunk-EDS2L2LD.js +106 -0
- package/dist/chunk-EFHQ3TWP.js +637 -0
- package/dist/chunk-EPTBZ3GP.js +101 -0
- package/dist/chunk-EYWIDJFU.js +130 -0
- package/dist/chunk-F7HYOUFF.js +287 -0
- package/dist/chunk-FHH4I4ZV.js +128 -0
- package/dist/chunk-FITWGOJ2.js +131 -0
- package/dist/chunk-FQXYPF7E.js +147 -0
- package/dist/chunk-G2B4ZQGH.js +240 -0
- package/dist/chunk-GBRFVT63.js +45 -0
- package/dist/chunk-GDLULHTC.js +2919 -0
- package/dist/chunk-GLUX4EEP.js +583 -0
- package/dist/chunk-GQ4N4WKF.js +1142 -0
- package/dist/chunk-GT4I4ZWM.js +38 -0
- package/dist/chunk-HFQCFSJR.js +60 -0
- package/dist/chunk-HITVBIJS.js +1247 -0
- package/dist/chunk-HLJAXMM4.js +233 -0
- package/dist/chunk-HVUPKCGJ.js +162 -0
- package/dist/chunk-I3E7CX4H.js +155 -0
- package/dist/chunk-I4JRCD6M.js +184 -0
- package/dist/chunk-ICY36XCH.js +34 -0
- package/dist/chunk-IHMLFRVV.js +228 -0
- package/dist/chunk-IPKHE5D6.js +1963 -0
- package/dist/chunk-J4K3KVLD.js +131 -0
- package/dist/chunk-JBTK5OP2.js +55 -0
- package/dist/chunk-JCZIKA4C.js +163 -0
- package/dist/chunk-JGZCG5VM.js +189 -0
- package/dist/chunk-JIITQXFB.js +4087 -0
- package/dist/chunk-JMSCMUCA.js +271 -0
- package/dist/chunk-JZU3H6UQ.js +54 -0
- package/dist/chunk-K65BJIMT.js +49 -0
- package/dist/chunk-KEM4SDDP.js +3898 -0
- package/dist/chunk-KQDZXGNR.js +14 -0
- package/dist/chunk-L24C55VN.js +7923 -0
- package/dist/chunk-L6SGQIR3.js +471 -0
- package/dist/chunk-LR3R6Z2A.js +400 -0
- package/dist/chunk-M766ZJ6W.js +119 -0
- package/dist/chunk-MC3H7736.js +19910 -0
- package/dist/chunk-MGYZM27B.js +205 -0
- package/dist/chunk-MMOSZPWJ.js +273 -0
- package/dist/chunk-MVZVGYXH.js +1611 -0
- package/dist/chunk-N7IXEHK3.js +549 -0
- package/dist/chunk-NE2W3OO7.js +230 -0
- package/dist/chunk-NN2ZQEB4.js +38 -0
- package/dist/chunk-NXFPS2LR.js +182 -0
- package/dist/chunk-O3WI5KWW.js +31 -0
- package/dist/chunk-OLQJTJJU.js +76 -0
- package/dist/chunk-ONLS5QA5.js +102 -0
- package/dist/chunk-OT2O76OS.js +1496 -0
- package/dist/chunk-PAMPPUR6.js +4500 -0
- package/dist/chunk-PCOCACY3.js +385 -0
- package/dist/chunk-PCVDV3UZ.js +430 -0
- package/dist/chunk-PRPPGYZG.js +104 -0
- package/dist/chunk-Q4D5X7QB.js +264 -0
- package/dist/chunk-Q5AMFEWD.js +119 -0
- package/dist/chunk-QRAOANID.js +214 -0
- package/dist/chunk-QSXK2RGH.js +688 -0
- package/dist/chunk-QZSX3F7C.js +389 -0
- package/dist/chunk-R6RY4Q5T.js +51 -0
- package/dist/chunk-R6XF6UR3.js +149 -0
- package/dist/chunk-R77KLRB3.js +166 -0
- package/dist/chunk-RRTKKSLQ.js +251 -0
- package/dist/chunk-RTEYOSJY.js +29 -0
- package/dist/chunk-RUVFXE2L.js +666 -0
- package/dist/chunk-RVH5SUW5.js +69 -0
- package/dist/chunk-RZPYKDWS.js +26 -0
- package/dist/chunk-S2A7YC3Q.js +41433 -0
- package/dist/chunk-S3QNRWYR.js +25 -0
- package/dist/chunk-SJRGMG6A.js +174 -0
- package/dist/chunk-SP2I63OO.js +252 -0
- package/dist/chunk-T2UYZSCQ.js +545 -0
- package/dist/chunk-T6AIP7H5.js +3851 -0
- package/dist/chunk-T6XQL73F.js +94 -0
- package/dist/chunk-TANFV3MZ.js +531 -0
- package/dist/chunk-TDD55CJH.js +119 -0
- package/dist/chunk-TV45EUGM.js +51 -0
- package/dist/chunk-TXLH6WHQ.js +2078 -0
- package/dist/chunk-TYAID7B7.js +408 -0
- package/dist/chunk-UBBC2XSG.js +873 -0
- package/dist/chunk-UGLN7QHV.js +27 -0
- package/dist/chunk-UNM6ZOKP.js +878 -0
- package/dist/chunk-V2YTAIQO.js +1075 -0
- package/dist/chunk-VN3DP4LQ.js +43 -0
- package/dist/chunk-VOGCSYOI.js +16 -0
- package/dist/chunk-VYDBJ73M.js +32 -0
- package/dist/chunk-W3BQAZ3Q.js +34 -0
- package/dist/chunk-W5BVQF44.js +36 -0
- package/dist/chunk-WVPJSRRJ.js +52 -0
- package/dist/chunk-WY6PP6AA.js +53 -0
- package/dist/chunk-XAKWMCXI.js +285 -0
- package/dist/chunk-XPCM366L.js +70 -0
- package/dist/chunk-XPTOBS2D.js +48 -0
- package/dist/chunk-XY3P7JW7.js +3479 -0
- package/dist/chunk-XZRON6IV.js +131 -0
- package/dist/chunk-YEDDOYSC.js +27809 -0
- package/dist/chunk-YISXLPHN.js +496 -0
- package/dist/chunk-YMZ3TNYB.js +18 -0
- package/dist/chunk-YY6ZQQBP.js +203 -0
- package/dist/chunk-YYQN46FY.js +334 -0
- package/dist/chunk-Z6LF7HQN.js +22 -0
- package/dist/chunk-ZCJDOK2S.js +116 -0
- package/dist/chunk-ZDPAS56H.js +76 -0
- package/dist/chunk-ZMAINWBW.js +18 -0
- package/dist/chunk-ZMFPW66A.js +22 -0
- package/dist/chunk-ZNCEKR4J.js +296 -0
- package/dist/chunk-ZVM6AKKM.js +47 -0
- package/dist/files.json +1888 -0
- package/dist/fixtures/forge/README.md +19 -0
- package/dist/fixtures/forge/expected/discrepancies.yaml +54 -0
- package/dist/fixtures/forge/expected/inputs.yaml +38 -0
- package/dist/fixtures/forge/expected/scan.yaml +342 -0
- package/dist/fixtures/forge/inputs/diagrams/forge-context.drawio +23 -0
- package/dist/fixtures/forge/inputs/partner-specs/northwind-pay-openapi.yaml +11 -0
- package/dist/fixtures/forge/inputs/tickets/ado-stories.json +4 -0
- package/dist/fixtures/forge/inputs/tickets/closed-service-requests.json +5 -0
- package/dist/fixtures/forge/inputs/wiki/integration-patterns.md +11 -0
- package/dist/fixtures/forge/inputs/wiki/ledger-solution-spec.md +9 -0
- package/dist/fixtures/forge/inputs/wiki/snow-firewall-request.md +4 -0
- package/dist/fixtures/forge/metarepo/judgments/reaches/84af5b6af24f7ca8c23013f3.yaml +17 -0
- package/dist/fixtures/forge/metarepo/judgments/reaches/c3917555edebddce8cecb647.yaml +17 -0
- package/dist/fixtures/forge/metarepo/judgments/reaches/c5fafd6601f8ca9e34e0bbd0.yaml +17 -0
- package/dist/fixtures/forge/metarepo/org-pack/agents/architecture-critic.yaml +9 -0
- package/dist/fixtures/forge/metarepo/org-pack/agents/story-writer.yaml +10 -0
- package/dist/fixtures/forge/metarepo/org-pack/checklists/architecture.yaml +115 -0
- package/dist/fixtures/forge/metarepo/org-pack/dialects/forge.yaml +111 -0
- package/dist/fixtures/forge/metarepo/org-pack/gates.yaml +22 -0
- package/dist/fixtures/forge/metarepo/org-pack/pack.yaml +11 -0
- package/dist/fixtures/forge/metarepo/org-pack/patterns/A.EB.PUB.yaml +12 -0
- package/dist/fixtures/forge/metarepo/org-pack/patterns/D.JDBC.yaml +12 -0
- package/dist/fixtures/forge/metarepo/org-pack/patterns/S.DIR.BFF.yaml +12 -0
- package/dist/fixtures/forge/metarepo/org-pack/patterns/S.GW.SOR.yaml +13 -0
- package/dist/fixtures/forge/metarepo/org-pack/patterns/S.GW.VND.yaml +14 -0
- package/dist/fixtures/forge/metarepo/org-pack/process/change-templates/feature.md +37 -0
- package/dist/fixtures/forge/metarepo/org-pack/process/skills/add-forge-endpoint/SKILL.md +17 -0
- package/dist/fixtures/forge/metarepo/org-pack/process/snow/firewall-rule.yaml +14 -0
- package/dist/fixtures/forge/metarepo/org-pack/process/snow/gateway-route.yaml +13 -0
- package/dist/fixtures/forge/metarepo/org-pack/profiles/forge/profile.yaml +12 -0
- package/dist/fixtures/forge/metarepo/org-pack/profiles/forge/repos.manifest.yaml +44 -0
- package/dist/fixtures/forge/metarepo/org-pack/roles.yaml +14 -0
- package/dist/fixtures/forge/metarepo/org-pack/runtime.yaml +14 -0
- package/dist/fixtures/forge/metarepo/org-pack/sources.yaml +3 -0
- package/dist/fixtures/forge/repos/forge-events/topics/payments.initiated.yaml +4 -0
- package/dist/fixtures/forge/repos/forge-events/topics/transfers.completed.yaml +4 -0
- package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/ledger-v1.xml +3 -0
- package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/policies/SpikeArrest.xml +3 -0
- package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/policies/VerifyOAuth.xml +4 -0
- package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/proxies/default.xml +14 -0
- package/dist/fixtures/forge/repos/forge-gateway/proxies/ledger-v1/apiproxy/targets/ledger.xml +5 -0
- package/dist/fixtures/forge/repos/forge-infra/alerts/ledger-api.yaml +5 -0
- package/dist/fixtures/forge/repos/forge-infra/k8s/ledger-api.yaml +15 -0
- package/dist/fixtures/forge/repos/forge-infra/k8s/portal-bff.yaml +7 -0
- package/dist/fixtures/forge/repos/forge-infra/terraform/ledger-db.tf +9 -0
- package/dist/fixtures/forge/repos/forge-ledger/api/ledger-openapi.yaml +31 -0
- package/dist/fixtures/forge/repos/forge-ledger/forge.yaml +4 -0
- package/dist/fixtures/forge/repos/forge-ledger/src/main/java/forge/ledger/LedgerEndpoints.java +13 -0
- package/dist/fixtures/forge/repos/forge-ledger/src/main/java/forge/ledger/LedgerEvents.java +11 -0
- package/dist/fixtures/forge/repos/forge-ledger/src/main/java/forge/ledger/NorthwindClient.java +10 -0
- package/dist/fixtures/forge/repos/forge-ledger/src/main/resources/application.yml +3 -0
- package/dist/fixtures/forge/repos/forge-ledger/src/main/resources/db/migration/V1__create_account.sql +5 -0
- package/dist/fixtures/forge/repos/forge-ledger/src/main/resources/db/migration/V2__create_entry.sql +7 -0
- package/dist/fixtures/forge/repos/forge-portal-bff/pom.xml +1 -0
- package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/AuditPublisher.java +12 -0
- package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/BalanceController.java +16 -0
- package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/LedgerClient.java +13 -0
- package/dist/fixtures/forge/repos/forge-portal-bff/src/main/java/forge/portal/PaymentEvents.java +13 -0
- package/dist/fixtures/forge/repos/forge-portal-bff/src/main/resources/application.yml +8 -0
- package/dist/fixtures/forge/repos/forge-portal-ui/package.json +1 -0
- package/dist/fixtures/forge/repos/forge-portal-ui/src/api/balance.ts +5 -0
- package/dist/fixtures/forge/repos/forge-reports-job/src/main/java/forge/reports/DailyEntriesJob.java +19 -0
- package/dist/fixtures/forge/repos/forge-reports-job/src/main/resources/application.yml +3 -0
- package/dist/fixtures/forge-change/README.md +41 -0
- package/dist/fixtures/forge-change/expected/findings.yaml +301 -0
- package/dist/fixtures/forge-change/expected/stories.yaml +101 -0
- package/dist/fixtures/forge-change/judgments/personal-data/0b5f3dbf5257a22275d8c74b.yaml +18 -0
- package/dist/fixtures/forge-change/judgments/personal-data/2759a66770134c417440bf2d.yaml +18 -0
- package/dist/fixtures/forge-change/judgments/personal-data/31b1ea2f14d0737f1aca79fd.yaml +18 -0
- package/dist/fixtures/forge-change/judgments/personal-data/49afd70c08228e65ad6ca1ed.yaml +18 -0
- package/dist/fixtures/forge-change/judgments/personal-data/761cabcb8a39f5e5866d2dd6.yaml +18 -0
- package/dist/fixtures/forge-change/judgments/personal-data/adae902b90cc8ffa0c765145.yaml +18 -0
- package/dist/fixtures/forge-change/judgments/personal-data/ba11bb933105ec9493e065dd.yaml +18 -0
- package/dist/fixtures/forge-change/judgments/personal-data/bdbcd1cdac3021c68063c3e7.yaml +18 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/brief.md +35 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/change.yaml +120 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/data.md +18 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/design.md +29 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/interfaces.md +17 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/mappings.md +26 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/proposal.md +35 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/snow.md +12 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/specs/transfer-limits/spec.md +19 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s1-refuse-over-limit.md +17 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s2-show-remaining.md +16 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s3-audit-refusals.md +18 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories/s4-velocity-check.md +16 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/stories.md +8 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/tasks.md +12 -0
- package/dist/fixtures/forge-change/openspec/changes/add-transfer-limit/ux.md +7 -0
- package/dist/fixtures/forge-change/org-pack/agents/code-and-test-critic.yaml +13 -0
- package/dist/fixtures/forge-change/org-pack/agents/complete-critic.yaml +12 -0
- package/dist/fixtures/forge-change/org-pack/agents/safe-critic.yaml +12 -0
- package/dist/fixtures/forge-change/org-pack/agents/ship-critic.yaml +11 -0
- package/dist/fixtures/forge-change/org-pack/agents/true-critic.yaml +11 -0
- package/dist/fixtures/forge-change/org-pack/checklists/review.yaml +54 -0
- package/dist/fixtures/forge-change/org-pack/gates.yaml +25 -0
- package/dist/fixtures/forge-change/org-pack/teams/team-ledger/checklists/ledger-team.yaml +227 -0
- package/dist/fixtures/forge-change/recordings/complete-critic/2ad84f84bf39c1d5412697e69fe23034d6983ec45a00314bf0975e627589a3c5.json +12 -0
- package/dist/fixtures/forge-change/recordings/complete-critic/417c98d8e54a4387d0fd93441c49f44c2868958739070d855c1dce0c41e24db3.json +12 -0
- package/dist/fixtures/forge-change/recordings/complete-critic/50203ee22e9cb3ef047295edb6538fe7d5695e1e4b139f3c929013dc6ce47021.json +12 -0
- package/dist/fixtures/forge-change/recordings/complete-critic/89f18d67f5d9c325bf35e2a9e020f9ddb6ee13b8523315037f0905cc57c040b1.json +12 -0
- package/dist/fixtures/forge-change/recordings/complete-critic/b4097867d26ae8eadc8b9efa8cdd86897013358035f0b40086c299a59c4ba121.json +12 -0
- package/dist/fixtures/forge-change/recordings/safe-critic/302d06f49664dd67ad2e21ab9cf74c1b0f7d3f750709c6ed8eff2b70983274e2.json +12 -0
- package/dist/fixtures/forge-change/recordings/safe-critic/32f1049c9a5ab4a759543290db4644ec6e221cc45fdfdcf06193837c6a8ce0b9.json +12 -0
- package/dist/fixtures/forge-change/recordings/safe-critic/4e4a84bfc04b9f26ca4250319a879901ff7a1c081c71e46a117675fee05026b0.json +12 -0
- package/dist/fixtures/forge-change/recordings/safe-critic/604af0fcdd6df6b76208fa88305fdc15c37606c2a4d1ae816477e46ac8c2dd04.json +12 -0
- package/dist/fixtures/forge-change/recordings/safe-critic/f0bf50af11f14c50d07904f0dffe1c8c20fb0cd89770645a8824c1d30a443955.json +12 -0
- package/dist/fixtures/forge-change/recordings/ship-critic/350954b58833b2c04880c67db45a1b328b7fd541d9f0d943b63905b8875488a6.json +12 -0
- package/dist/fixtures/forge-change/recordings/ship-critic/4af95c6c96a206777cec9de1f9c2d8c55a36ddc9b8db2f81d6eb83217b835efa.json +12 -0
- package/dist/fixtures/forge-change/recordings/ship-critic/76c34522a49cf7587a4e5689a5030d384603fa780b8aba97d27815cbc829683e.json +12 -0
- package/dist/fixtures/forge-change/recordings/ship-critic/a3b2cd1ace48587e5994333db03b34c3a0f9dec4f1932f1730ddfb687f6918c8.json +12 -0
- package/dist/fixtures/forge-change/recordings/ship-critic/de288a4fa64d0fc20890f9a787080ce6eac5203b7b9b72d884df11e8cf111835.json +12 -0
- package/dist/fixtures/forge-change/recordings/story-writer/1ddb00eac2aaf91a5ec5d9dfd220116be9f75aec6546a4a3a3b050ed89af2864.json +12 -0
- package/dist/packages/assistant-kit/frameworks-kit/README.md +86 -0
- package/dist/packages/assistant-kit/frameworks-kit/checklist.md +11 -0
- package/dist/packages/assistant-kit/frameworks-kit/examples/tide-lantern.yaml +56 -0
- package/dist/packages/assistant-kit/frameworks-kit/examples/tide-platform.yaml +43 -0
- package/dist/packages/assistant-kit/frameworks-kit/prompts/write-framework-model.md +12 -0
- package/dist/packages/assistant-kit/kit/README.md +98 -0
- package/dist/packages/assistant-kit/kit/c2-reference.md +334 -0
- package/dist/packages/assistant-kit/kit/checklist.md +39 -0
- package/dist/packages/assistant-kit/kit/examples/house-http-client.yaml +102 -0
- package/dist/packages/assistant-kit/kit/examples/tide-apigee.yaml +56 -0
- package/dist/packages/assistant-kit/kit/examples/tide-apim.yaml +32 -0
- package/dist/packages/assistant-kit/kit/examples/tide-kong.yaml +44 -0
- package/dist/packages/assistant-kit/kit/prompts/write-dialect.md +34 -0
- package/dist/packages/assistant-kit/kit/worked-example.md +198 -0
- package/dist/packages/conformance/sample/README.md +4 -0
- package/dist/packages/conformance/sample/inputs/notes.md +3 -0
- package/dist/packages/conformance/sample/inputs/systems.csv +3 -0
- package/dist/packages/conformance/sample/repo/api/greeter.proto +6 -0
- package/dist/packages/conformance/sample/repo/api/openapi.yaml +10 -0
- package/dist/packages/conformance/sample/repo/api/schema.graphql +3 -0
- package/dist/packages/conformance/sample/repo/db/V1__create_greeting.sql +4 -0
- package/dist/packages/conformance/sample/repo/package.json +7 -0
- package/dist/packages/conformance/sample/repo/src/main/java/sample/HelloController.java +10 -0
- package/dist/packages/conformance/sample/repo/web/app.ts +4 -0
- package/dist/packages/evals/datasets/critic-lenses.yaml +62 -0
- package/dist/packages/evals/datasets/dialect-writer.yaml +14 -0
- package/dist/packages/evals/datasets/feature-namer.yaml +34 -0
- package/dist/packages/evals/datasets/glossary-definer.yaml +25 -0
- package/dist/packages/evals/datasets/story-writer.yaml +13 -0
- package/dist/packages/evals/datasets/template-writer.yaml +16 -0
- package/dist/packages/evals/datasets/test-writer.yaml +18 -0
- package/dist/packages/executors/reference/reference-executor.mjs +233 -0
- package/dist/packages/extractors/dialects/argocd.yaml +45 -0
- package/dist/packages/extractors/dialects/fixtures/jaxrs/accounts-service/src/main/java/forge/accounts/AccountResource.java +47 -0
- package/dist/packages/extractors/dialects/fixtures/jaxrs/accounts-service/src/main/java/forge/accounts/AuditClient.java +12 -0
- package/dist/packages/extractors/dialects/fixtures/jaxrs/accounts-service/src/main/java/forge/accounts/LedgerClient.java +17 -0
- package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/java/forge/statements/LedgerClient.java +14 -0
- package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/java/forge/statements/RatesClient.java +11 -0
- package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/java/forge/statements/StatementController.java +36 -0
- package/dist/packages/extractors/dialects/fixtures/micronaut/statements-service/src/main/resources/application.yml +7 -0
- package/dist/packages/extractors/dialects/fixtures/quarkus-reactive-messaging/fraud-service/src/main/java/forge/fraud/FraudScorer.java +27 -0
- package/dist/packages/extractors/dialects/fixtures/quarkus-reactive-messaging/fraud-service/src/main/resources/application.properties +4 -0
- package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/api.tf +38 -0
- package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/main.tf +95 -0
- package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/terraform.tfvars +1 -0
- package/dist/packages/extractors/dialects/fixtures/terraform-aws/forge-aws-infra/envs/prod/variables.tf +4 -0
- package/dist/packages/extractors/dialects/fixtures/terraform-azure/forge-azure-infra/main.tf +102 -0
- package/dist/packages/extractors/dialects/fixtures/terraform-gcp/forge-gcp-infra/main.tf +51 -0
- package/dist/packages/extractors/dialects/harness.yaml +101 -0
- package/dist/packages/extractors/dialects/jaxrs.yaml +155 -0
- package/dist/packages/extractors/dialects/micronaut.yaml +207 -0
- package/dist/packages/extractors/dialects/quarkus-reactive-messaging.yaml +158 -0
- package/dist/packages/extractors/dialects/tekton.yaml +71 -0
- package/dist/packages/extractors/dialects/terraform-aws.yaml +267 -0
- package/dist/packages/extractors/dialects/terraform-azure.yaml +212 -0
- package/dist/packages/extractors/dialects/terraform-gcp.yaml +109 -0
- package/dist/packages/extractors/grammars/README.md +11 -0
- package/dist/packages/extractors/grammars/tree-sitter-groovy.LICENSE +21 -0
- package/dist/packages/extractors/grammars/tree-sitter-groovy.wasm +0 -0
- package/dist/packages/extractors/grammars/vendored.json +11 -0
- package/dist/packages/learn/lessons/architect-diagrams-and-code.yaml +69 -0
- package/dist/packages/learn/lessons/business-analyst-story-bar.yaml +94 -0
- package/dist/packages/learn/lessons/delivery-lead-release-readiness.yaml +44 -0
- package/dist/packages/learn/lessons/designer-features-in-user-words.yaml +57 -0
- package/dist/packages/learn/lessons/developer-find-your-way.yaml +60 -0
- package/dist/packages/learn/lessons/everyone-first-hour.yaml +74 -0
- package/dist/packages/learn/lessons/platform-lead-coverage-and-defences.yaml +58 -0
- package/dist/packages/learn/lessons/product-owner-first-change.yaml +167 -0
- package/dist/packages/learn/lessons/qa-tests-and-trace.yaml +53 -0
- package/dist/packages/learn/lessons/team-lead-initiative.yaml +146 -0
- package/dist/packages/naysayer/constitution/constitution.yaml +286 -0
- package/dist/packages/naysayer/starter/review.yaml +256 -0
- package/dist/packages/sdk/npm/index.js +8892 -0
- package/dist/packages/speckit/rules/drift.yaml +78 -0
- package/dist/packages/taskrun/rules/conform.yaml +38 -0
- package/dist/packages/testgen/rules/trace.yaml +49 -0
- package/dist/packages/ui/dist/assets/elk-api-tma0MCuh.js +2 -0
- package/dist/packages/ui/dist/assets/elk-worker.min--dAJroGl.js +6401 -0
- package/dist/packages/ui/dist/assets/elk-worker.min-DdYmS5kP.js +2 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-400-normal-BTotfTJu.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-400-normal-DZqxrq2p.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-500-normal-ByOcLdNv.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-500-normal-CocWQlwt.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-600-normal-71GNu3SW.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-600-normal-BGq0mW3O.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-400-normal-Dsrv2Tcn.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-400-normal-g30qAdWV.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-500-normal-Cs5J6C77.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-500-normal-DB5PtV2g.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-600-normal-Bz0x94Yp.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-cyrillic-ext-600-normal-DUMzJB7m.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-400-normal-D9ESIMu3.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-400-normal-_efipK4i.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-500-normal-CuWXN6rf.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-500-normal-JMMifIXV.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-600-normal-D-CqTdkO.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-greek-600-normal-DzTrcv_p.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-400-normal-C5H60-Va.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-400-normal-RBey6euL.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-500-normal-D0aIdm-b.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-500-normal-DakdToA3.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-600-normal-DIrixKbi.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-latin-ext-600-normal-DOrvGEcy.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-400-normal-DG4YqDda.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-400-normal-fK1oJ5dG.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-500-normal-BEb3_waV.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-500-normal-e4dixQRQ.woff2 +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-600-normal-DgdngZtN.woff +0 -0
- package/dist/packages/ui/dist/assets/ibm-plex-sans-vietnamese-600-normal-DpPYBSTl.woff2 +0 -0
- package/dist/packages/ui/dist/assets/index-B54fm9FQ.js +29 -0
- package/dist/packages/ui/dist/assets/index-DD_hufQz.css +1 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/packages/ui/dist/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-devanagari-600-normal-BtY48IV_.woff +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-devanagari-600-normal-DhS7ScYx.woff2 +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-devanagari-700-normal-BQQOj9BB.woff2 +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-devanagari-700-normal-DBRwWuxA.woff +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-600-normal-CXCVEoA9.woff2 +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-600-normal-Dx02qI2_.woff +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-700-normal-BPDUZo87.woff2 +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-700-normal-e0Uj8ZlN.woff +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-ext-600-normal-BleIgkPp.woff +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-ext-600-normal-C9ZjJQAt.woff2 +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-ext-700-normal-BPaQ7tlD.woff +0 -0
- package/dist/packages/ui/dist/assets/rajdhani-latin-ext-700-normal-S6aYESQK.woff2 +0 -0
- package/dist/packages/ui/dist/favicon.svg +1 -0
- package/dist/packages/ui/dist/index.html +15 -0
- package/dist/third-party.json +575 -0
- package/dist/vendor/@fission-ai/openspec/bin/openspec.js +85986 -0
- package/dist/vendor/@fission-ai/openspec/package.json +82 -0
- package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/schema.yaml +248 -0
- package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/design.md +21 -0
- package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/proposal.md +34 -0
- package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/spec.md +13 -0
- package/dist/vendor/@fission-ai/openspec/schemas/spec-driven/templates/tasks.md +11 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
- package/dist/vendor/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
- package/dist/vendor/web-tree-sitter/tree-sitter.wasm +0 -0
- package/package.json +36 -3
|
@@ -0,0 +1,1227 @@
|
|
|
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
|
+
catalogRecords
|
|
8
|
+
} from "./chunk-B2WLAWNJ.js";
|
|
9
|
+
import {
|
|
10
|
+
readRound,
|
|
11
|
+
reviewedGates,
|
|
12
|
+
roundsOf
|
|
13
|
+
} from "./chunk-3HI6Z55Y.js";
|
|
14
|
+
import {
|
|
15
|
+
changeFolder,
|
|
16
|
+
changeStore
|
|
17
|
+
} from "./chunk-XY3P7JW7.js";
|
|
18
|
+
import {
|
|
19
|
+
QueryError,
|
|
20
|
+
askLookup,
|
|
21
|
+
graph,
|
|
22
|
+
impact,
|
|
23
|
+
openIndex,
|
|
24
|
+
translate
|
|
25
|
+
} from "./chunk-T6AIP7H5.js";
|
|
26
|
+
import {
|
|
27
|
+
baseClonePath,
|
|
28
|
+
gitUser,
|
|
29
|
+
loadRepos
|
|
30
|
+
} from "./chunk-EFHQ3TWP.js";
|
|
31
|
+
import {
|
|
32
|
+
API_VERSION,
|
|
33
|
+
DEFAULT_PORT,
|
|
34
|
+
Lens,
|
|
35
|
+
RECORD_KINDS,
|
|
36
|
+
RecordId,
|
|
37
|
+
Severity,
|
|
38
|
+
catalogDirOf,
|
|
39
|
+
changesDirOf,
|
|
40
|
+
factsDirOf,
|
|
41
|
+
fastPathOf,
|
|
42
|
+
inputsDirOf,
|
|
43
|
+
knowledgeDirOf,
|
|
44
|
+
layoutOf,
|
|
45
|
+
loadOrgPack,
|
|
46
|
+
openspecDirOf,
|
|
47
|
+
orgPackDirOf,
|
|
48
|
+
proposalsDirOf,
|
|
49
|
+
questionOfLens,
|
|
50
|
+
questionsDirOf,
|
|
51
|
+
readRepoSpec,
|
|
52
|
+
require_dist,
|
|
53
|
+
runsDirOf,
|
|
54
|
+
specRepos,
|
|
55
|
+
specsDirOf,
|
|
56
|
+
withSignal
|
|
57
|
+
} from "./chunk-S2A7YC3Q.js";
|
|
58
|
+
import {
|
|
59
|
+
SCHEMA_VERSION
|
|
60
|
+
} from "./chunk-D3PO4DOZ.js";
|
|
61
|
+
import {
|
|
62
|
+
__toESM
|
|
63
|
+
} from "./chunk-TV45EUGM.js";
|
|
64
|
+
|
|
65
|
+
// packages/cli/dist/ui-api-cites.js
|
|
66
|
+
import { readdir, readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
67
|
+
import { isAbsolute, join as join4, relative as relative2, sep as sep3 } from "node:path";
|
|
68
|
+
|
|
69
|
+
// packages/server/dist/http.js
|
|
70
|
+
var HttpError = class extends Error {
|
|
71
|
+
status;
|
|
72
|
+
title;
|
|
73
|
+
detail;
|
|
74
|
+
extra;
|
|
75
|
+
constructor(status, title, detail, extra = {}) {
|
|
76
|
+
super(detail ?? title);
|
|
77
|
+
this.status = status;
|
|
78
|
+
this.title = title;
|
|
79
|
+
this.detail = detail;
|
|
80
|
+
this.extra = extra;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var badRequest = (detail, extra = {}) => new HttpError(400, "The request isn't valid", detail, extra);
|
|
84
|
+
var notFound = (detail) => new HttpError(404, "Not found", detail);
|
|
85
|
+
var conflict = (detail) => new HttpError(409, "Conflict", detail);
|
|
86
|
+
var Router = class {
|
|
87
|
+
routes = [];
|
|
88
|
+
add(method, pattern, handler, o = {}) {
|
|
89
|
+
this.routes.push({
|
|
90
|
+
method,
|
|
91
|
+
parts: pattern.split("/").filter(Boolean),
|
|
92
|
+
handler,
|
|
93
|
+
...o.maxBody ? { maxBody: o.maxBody } : {}
|
|
94
|
+
});
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
/** The handler and path params, or the methods the path does allow (for 405). */
|
|
98
|
+
match(method, path) {
|
|
99
|
+
const segs = path.split("/").filter(Boolean);
|
|
100
|
+
const allowed = [];
|
|
101
|
+
for (const r of this.routes) {
|
|
102
|
+
if (r.parts.length !== segs.length)
|
|
103
|
+
continue;
|
|
104
|
+
const params = {};
|
|
105
|
+
let ok = true;
|
|
106
|
+
for (let i = 0; i < segs.length; i++) {
|
|
107
|
+
const want = r.parts[i];
|
|
108
|
+
let got;
|
|
109
|
+
try {
|
|
110
|
+
got = decodeURIComponent(segs[i]);
|
|
111
|
+
} catch {
|
|
112
|
+
ok = false;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (want.startsWith("{") && want.endsWith("}"))
|
|
116
|
+
params[want.slice(1, -1)] = got;
|
|
117
|
+
else if (want !== got) {
|
|
118
|
+
ok = false;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (!ok)
|
|
123
|
+
continue;
|
|
124
|
+
if (r.method === method)
|
|
125
|
+
return { handler: r.handler, params, ...r.maxBody ? { maxBody: r.maxBody } : {} };
|
|
126
|
+
allowed.push(r.method);
|
|
127
|
+
}
|
|
128
|
+
return { allowed };
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
function problem(e) {
|
|
132
|
+
return {
|
|
133
|
+
type: `https://atticus.dev/problems/${e.status}`,
|
|
134
|
+
title: e.title,
|
|
135
|
+
status: e.status,
|
|
136
|
+
...e.detail ? { detail: e.detail } : {},
|
|
137
|
+
...e.extra
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function intParam(q, name, min, max) {
|
|
141
|
+
const v = q.get(name);
|
|
142
|
+
if (v === null || v === "")
|
|
143
|
+
return void 0;
|
|
144
|
+
const n = Number(v);
|
|
145
|
+
if (!Number.isInteger(n) || n < min || n > max)
|
|
146
|
+
throw badRequest(`${name} must be a whole number from ${min} to ${max}.`);
|
|
147
|
+
return n;
|
|
148
|
+
}
|
|
149
|
+
var strParam = (q, name) => q.get(name) || void 0;
|
|
150
|
+
|
|
151
|
+
// packages/server/dist/routes.js
|
|
152
|
+
import { readFile, stat } from "node:fs/promises";
|
|
153
|
+
import { join } from "node:path";
|
|
154
|
+
var queues = /* @__PURE__ */ new Map();
|
|
155
|
+
async function withIndex(root, f) {
|
|
156
|
+
const before = queues.get(root) ?? Promise.resolve();
|
|
157
|
+
const mine = before.then(async () => {
|
|
158
|
+
const ix = await openIndex(root);
|
|
159
|
+
try {
|
|
160
|
+
return f(ix);
|
|
161
|
+
} finally {
|
|
162
|
+
ix.close();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
const settled = mine.catch(() => void 0);
|
|
166
|
+
queues.set(root, settled);
|
|
167
|
+
void settled.then(() => {
|
|
168
|
+
if (queues.get(root) === settled)
|
|
169
|
+
queues.delete(root);
|
|
170
|
+
});
|
|
171
|
+
return mine;
|
|
172
|
+
}
|
|
173
|
+
function kindParam(kind) {
|
|
174
|
+
if (!RECORD_KINDS.includes(kind))
|
|
175
|
+
throw badRequest(`${kind} is not a record kind. Kinds: ${RECORD_KINDS.join(", ")}.`);
|
|
176
|
+
return kind;
|
|
177
|
+
}
|
|
178
|
+
function enumParam(q, name, options) {
|
|
179
|
+
const v = strParam(q, name);
|
|
180
|
+
if (v !== void 0 && !options.includes(v))
|
|
181
|
+
throw badRequest(`${name} must be one of ${options.join(", ")}.`);
|
|
182
|
+
return v;
|
|
183
|
+
}
|
|
184
|
+
async function latestFindings(root, change) {
|
|
185
|
+
const out = [];
|
|
186
|
+
for (const gate of await reviewedGates(root, change)) {
|
|
187
|
+
const rounds = await roundsOf(root, change, gate);
|
|
188
|
+
if (rounds.length === 0)
|
|
189
|
+
continue;
|
|
190
|
+
const r = await readRound(root, change, gate, rounds[rounds.length - 1]);
|
|
191
|
+
out.push(...r.findings.map((f) => f.finding));
|
|
192
|
+
}
|
|
193
|
+
return out;
|
|
194
|
+
}
|
|
195
|
+
function summary(c, findings, fast = false) {
|
|
196
|
+
const open = { blocking: 0, gap: 0, risk: 0, idea: 0 };
|
|
197
|
+
for (const f of findings)
|
|
198
|
+
if (f.state === "open")
|
|
199
|
+
open[f.severity] += 1;
|
|
200
|
+
const last = c.history[c.history.length - 1];
|
|
201
|
+
return {
|
|
202
|
+
id: c.id,
|
|
203
|
+
title: c.title,
|
|
204
|
+
type: c.type,
|
|
205
|
+
state: c.state,
|
|
206
|
+
repos: c.touches.repos,
|
|
207
|
+
openFindings: open,
|
|
208
|
+
updatedAt: last?.at ?? c.createdAt,
|
|
209
|
+
...fast ? { fastPath: true } : {}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function apiRoutes(r, ctx) {
|
|
213
|
+
const { root } = ctx;
|
|
214
|
+
return r.add("GET", "/api/health", () => ({
|
|
215
|
+
status: 200,
|
|
216
|
+
body: {
|
|
217
|
+
version: ctx.version,
|
|
218
|
+
apiVersion: API_VERSION,
|
|
219
|
+
schemaVersion: SCHEMA_VERSION,
|
|
220
|
+
root,
|
|
221
|
+
openspec: layoutOf(root).openspec.replace(/\/+$/, ""),
|
|
222
|
+
user: ctx.user,
|
|
223
|
+
full: ctx.full === true
|
|
224
|
+
}
|
|
225
|
+
})).add("GET", "/api/catalog/kinds", async () => ({
|
|
226
|
+
status: 200,
|
|
227
|
+
body: await withIndex(root, (ix) => ix.kinds())
|
|
228
|
+
})).add("GET", "/api/catalog/{kind}", async ({ params, query }) => {
|
|
229
|
+
const kind = kindParam(params.kind);
|
|
230
|
+
const limit = intParam(query, "limit", 1, 500);
|
|
231
|
+
const o = {
|
|
232
|
+
...strParam(query, "status") ? { status: strParam(query, "status") } : {},
|
|
233
|
+
...strParam(query, "system") ? { system: strParam(query, "system") } : {},
|
|
234
|
+
...strParam(query, "q") ? { q: strParam(query, "q") } : {},
|
|
235
|
+
...strParam(query, "cursor") ? { cursor: strParam(query, "cursor") } : {},
|
|
236
|
+
...limit !== void 0 ? { limit } : {}
|
|
237
|
+
};
|
|
238
|
+
return { status: 200, body: await withIndex(root, (ix) => ix.list(kind, o)) };
|
|
239
|
+
}).add("GET", "/api/catalog/{kind}/{id}", async ({ params }) => {
|
|
240
|
+
const kind = kindParam(params.kind);
|
|
241
|
+
const rec = await withIndex(root, (ix) => ix.get(kind, params.id));
|
|
242
|
+
if (!rec)
|
|
243
|
+
throw notFound(`There is no ${kind} ${params.id}.`);
|
|
244
|
+
return { status: 200, body: rec };
|
|
245
|
+
}).add("GET", "/api/search", async ({ query }) => {
|
|
246
|
+
const q = strParam(query, "q");
|
|
247
|
+
if (!q)
|
|
248
|
+
throw badRequest("Say what to look for: ?q=<words or filters>.");
|
|
249
|
+
const limit = intParam(query, "limit", 1, 500) ?? 100;
|
|
250
|
+
const offset = intParam(query, "offset", 0, 1e6) ?? 0;
|
|
251
|
+
try {
|
|
252
|
+
return { status: 200, body: await withIndex(root, (ix) => ix.query(q, { limit, offset })) };
|
|
253
|
+
} catch (e) {
|
|
254
|
+
if (e instanceof QueryError)
|
|
255
|
+
throw badRequest(e.message);
|
|
256
|
+
throw e;
|
|
257
|
+
}
|
|
258
|
+
}).add("GET", "/api/ask", async ({ query }) => {
|
|
259
|
+
const q = strParam(query, "q");
|
|
260
|
+
if (!q)
|
|
261
|
+
throw badRequest("Ask a question: ?q=<plain words>.");
|
|
262
|
+
return {
|
|
263
|
+
status: 200,
|
|
264
|
+
body: await withIndex(root, (ix) => {
|
|
265
|
+
const asked = translate(q, askLookup(ix));
|
|
266
|
+
if (asked.action === "impact")
|
|
267
|
+
return { question: q, ...asked, impact: impact(ix, asked.id, 4) };
|
|
268
|
+
if (asked.action === "owner") {
|
|
269
|
+
const r2 = ix.find(asked.id)[0];
|
|
270
|
+
const owner = r2?.owner ?? r2?.ownerComponent ?? (r2 ? ix.find(String(r2.system ?? ""))[0]?.owner : void 0);
|
|
271
|
+
return { question: q, ...asked, owner: owner ?? null };
|
|
272
|
+
}
|
|
273
|
+
try {
|
|
274
|
+
return { question: q, ...asked, result: ix.query(asked.query, { limit: 60 }) };
|
|
275
|
+
} catch (e) {
|
|
276
|
+
if (e instanceof QueryError)
|
|
277
|
+
return { question: q, ...asked, error: e.message };
|
|
278
|
+
throw e;
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
};
|
|
282
|
+
}).add("GET", "/api/graph", async ({ query }) => {
|
|
283
|
+
const depth = intParam(query, "depth", 1, 6);
|
|
284
|
+
const o = {
|
|
285
|
+
...strParam(query, "focus") ? { focus: strParam(query, "focus") } : {},
|
|
286
|
+
...strParam(query, "status") ? { status: strParam(query, "status") } : {},
|
|
287
|
+
...depth !== void 0 ? { depth } : {}
|
|
288
|
+
};
|
|
289
|
+
return { status: 200, body: await withIndex(root, (ix) => graph(ix, o)) };
|
|
290
|
+
}).add("GET", "/api/impact/{id}", async ({ params, query }) => {
|
|
291
|
+
const depth = intParam(query, "depth", 1, 10);
|
|
292
|
+
const res = await withIndex(root, (ix) => impact(ix, params.id, depth));
|
|
293
|
+
if (!res)
|
|
294
|
+
throw notFound(`There is no record ${params.id} in the catalog.`);
|
|
295
|
+
return { status: 200, body: res };
|
|
296
|
+
}).add("GET", "/api/incident/{id}", async ({ params }) => {
|
|
297
|
+
const res = await withIndex(root, (ix) => {
|
|
298
|
+
const reach = impact(ix, params.id, 3);
|
|
299
|
+
if (!reach)
|
|
300
|
+
return void 0;
|
|
301
|
+
const rootRec = ix.find(params.id)[0];
|
|
302
|
+
const ids = [params.id, ...reach.affected.map((a) => a.id)];
|
|
303
|
+
const kindOf = new Map(reach.affected.map((a) => [a.id, a.kind]));
|
|
304
|
+
kindOf.set(params.id, rootRec.kind);
|
|
305
|
+
const systems = /* @__PURE__ */ new Set();
|
|
306
|
+
for (const id of ids) {
|
|
307
|
+
const k = kindOf.get(id);
|
|
308
|
+
const sys = k === "System" ? id : ix.systemOf(k, id);
|
|
309
|
+
if (sys)
|
|
310
|
+
systems.add(sys);
|
|
311
|
+
}
|
|
312
|
+
const owners = /* @__PURE__ */ new Map();
|
|
313
|
+
const unowned = [];
|
|
314
|
+
for (const sys of [...systems].sort()) {
|
|
315
|
+
const rec = ix.get("System", sys);
|
|
316
|
+
if (!rec?.owner)
|
|
317
|
+
unowned.push(sys);
|
|
318
|
+
else {
|
|
319
|
+
const o = owners.get(rec.owner) ?? { owner: rec.owner, systems: [] };
|
|
320
|
+
o.systems.push(sys);
|
|
321
|
+
owners.set(rec.owner, o);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
const components = new Set(ids.filter((id) => kindOf.get(id) === "Component"));
|
|
325
|
+
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) => ({
|
|
326
|
+
component: String(a.component),
|
|
327
|
+
kind: String(a.assetKind),
|
|
328
|
+
name: String(a.name),
|
|
329
|
+
...a.link ? { link: String(a.link) } : {}
|
|
330
|
+
}));
|
|
331
|
+
return {
|
|
332
|
+
reach,
|
|
333
|
+
systems: [...systems].sort(),
|
|
334
|
+
owners: [...owners.values()],
|
|
335
|
+
unowned,
|
|
336
|
+
watch: watch2
|
|
337
|
+
};
|
|
338
|
+
});
|
|
339
|
+
if (!res)
|
|
340
|
+
throw notFound(`There is no record ${params.id} in the catalog.`);
|
|
341
|
+
const near = /* @__PURE__ */ new Set([...res.systems, params.id, ...res.reach.affected.map((a) => a.id)]);
|
|
342
|
+
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) => ({
|
|
343
|
+
id: c.id,
|
|
344
|
+
title: c.title,
|
|
345
|
+
state: c.state,
|
|
346
|
+
updatedAt: c.history.at(-1)?.at ?? c.createdAt,
|
|
347
|
+
systems: c.systems.filter((s) => near.has(s))
|
|
348
|
+
})).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
349
|
+
return {
|
|
350
|
+
status: 200,
|
|
351
|
+
body: {
|
|
352
|
+
id: params.id,
|
|
353
|
+
blastRadius: res.reach.affected.length,
|
|
354
|
+
affected: res.reach.affected,
|
|
355
|
+
systems: res.systems,
|
|
356
|
+
call: res.owners,
|
|
357
|
+
ownerUnknown: res.unowned,
|
|
358
|
+
watch: res.watch,
|
|
359
|
+
recentChanges: changes
|
|
360
|
+
}
|
|
361
|
+
};
|
|
362
|
+
}).add("GET", "/api/repos", async () => {
|
|
363
|
+
const repos = await loadRepos(root);
|
|
364
|
+
const body = [];
|
|
365
|
+
for (const repo of repos) {
|
|
366
|
+
const present = await stat(join(baseClonePath(root, repo.id), ".git")).then(() => true, () => false);
|
|
367
|
+
body.push({ ...repo, baseClone: { present } });
|
|
368
|
+
}
|
|
369
|
+
return { status: 200, body };
|
|
370
|
+
}).add("GET", "/api/changes", async ({ query }) => {
|
|
371
|
+
const state = strParam(query, "state");
|
|
372
|
+
const changes = (await changeStore(root).list()).filter((c) => !state || c.state === state);
|
|
373
|
+
const body = [];
|
|
374
|
+
const types = await loadOrgPack(orgPackDirOf(root)).then((op) => op.changeTypes.types, () => []);
|
|
375
|
+
for (const c of changes.sort((a, b) => a.id.localeCompare(b.id))) {
|
|
376
|
+
const type = types.find((t) => t.id === c.type);
|
|
377
|
+
const fast = !!type && (type.size === "small" || !!type.smallWhenBriefSays) && fastPathOf(type, await readFile(join(changeFolder(root, c.id), "brief.md"), "utf8").catch(() => "")).fast;
|
|
378
|
+
body.push(summary(c, await latestFindings(root, c.id), fast));
|
|
379
|
+
}
|
|
380
|
+
return { status: 200, body };
|
|
381
|
+
}).add("GET", "/api/findings", async ({ query }) => {
|
|
382
|
+
const change = strParam(query, "change");
|
|
383
|
+
const gate = strParam(query, "gate");
|
|
384
|
+
const state = strParam(query, "state");
|
|
385
|
+
const lens = enumParam(query, "lens", Lens.options);
|
|
386
|
+
const severity = enumParam(query, "severity", Severity.options);
|
|
387
|
+
const ids = change ? [change] : (await changeStore(root).list()).map((c) => c.id).sort();
|
|
388
|
+
const body = [];
|
|
389
|
+
for (const id of ids)
|
|
390
|
+
for (const f of await latestFindings(root, id))
|
|
391
|
+
if ((!gate || f.gate === gate) && (!state || f.state === state) && // A lens filter asks its question: an old lens name finds what its question raised.
|
|
392
|
+
(!lens || questionOfLens(f.lens) === questionOfLens(lens)) && (!severity || f.severity === severity))
|
|
393
|
+
body.push(f);
|
|
394
|
+
return { status: 200, body };
|
|
395
|
+
}).add("GET", "/api/findings/{changeId}/{findingId}", async ({ params }) => {
|
|
396
|
+
const f = (await latestFindings(root, params.changeId)).find((x) => x.id === params.findingId);
|
|
397
|
+
if (!f)
|
|
398
|
+
throw notFound(`Change ${params.changeId} has no finding ${params.findingId}.`);
|
|
399
|
+
return { status: 200, body: f };
|
|
400
|
+
}).add("GET", "/api/orgpack", async () => {
|
|
401
|
+
const op = await loadOrgPack(orgPackDirOf(root));
|
|
402
|
+
return {
|
|
403
|
+
status: 200,
|
|
404
|
+
body: {
|
|
405
|
+
defaulted: op.defaulted,
|
|
406
|
+
counts: {
|
|
407
|
+
patterns: op.patterns.length,
|
|
408
|
+
dialects: op.dialects.length,
|
|
409
|
+
checklists: op.checklists.length,
|
|
410
|
+
agents: op.agents.length,
|
|
411
|
+
procedures: op.procedures.length,
|
|
412
|
+
serviceRequests: op.serviceRequests.length,
|
|
413
|
+
profiles: op.profiles.length,
|
|
414
|
+
gates: Object.keys(op.gates ?? {}).length
|
|
415
|
+
},
|
|
416
|
+
// Additive (ADR 0043): the patterns, checklists and procedures themselves, for the screen.
|
|
417
|
+
patterns: op.patterns,
|
|
418
|
+
checklists: op.checklists.map((c) => ({
|
|
419
|
+
name: c.name,
|
|
420
|
+
version: c.version,
|
|
421
|
+
rules: c.rules.length
|
|
422
|
+
})),
|
|
423
|
+
procedures: op.procedures.map((x) => ({
|
|
424
|
+
id: x.id,
|
|
425
|
+
title: x.title,
|
|
426
|
+
steps: x.steps?.length ?? 0
|
|
427
|
+
})),
|
|
428
|
+
problems: op.problems.map((p) => ({
|
|
429
|
+
file: p.file,
|
|
430
|
+
path: p.path ?? "",
|
|
431
|
+
message: p.message
|
|
432
|
+
}))
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// packages/server/dist/server.js
|
|
439
|
+
import { randomBytes, timingSafeEqual } from "node:crypto";
|
|
440
|
+
import { createServer } from "node:http";
|
|
441
|
+
|
|
442
|
+
// packages/server/dist/jobs.js
|
|
443
|
+
var JobManager = class {
|
|
444
|
+
publish;
|
|
445
|
+
now;
|
|
446
|
+
jobs = /* @__PURE__ */ new Map();
|
|
447
|
+
cancelledIds = /* @__PURE__ */ new Set();
|
|
448
|
+
aborts = /* @__PURE__ */ new Map();
|
|
449
|
+
seq = 0;
|
|
450
|
+
running = /* @__PURE__ */ new Map();
|
|
451
|
+
constructor(publish, now = () => /* @__PURE__ */ new Date()) {
|
|
452
|
+
this.publish = publish;
|
|
453
|
+
this.now = now;
|
|
454
|
+
}
|
|
455
|
+
/** The running job of a kind, if any (one scan at a time: a second asks gets 409). */
|
|
456
|
+
runningOf(kind) {
|
|
457
|
+
const id = this.running.get(kind);
|
|
458
|
+
return id ? this.jobs.get(id) : void 0;
|
|
459
|
+
}
|
|
460
|
+
get(id) {
|
|
461
|
+
return this.jobs.get(id);
|
|
462
|
+
}
|
|
463
|
+
start(kind, work) {
|
|
464
|
+
const id = `job-${++this.seq}`;
|
|
465
|
+
const job = {
|
|
466
|
+
id,
|
|
467
|
+
kind,
|
|
468
|
+
state: "running",
|
|
469
|
+
progress: { done: 0, total: 0, message: "Starting" },
|
|
470
|
+
startedAt: this.now().toISOString(),
|
|
471
|
+
errors: []
|
|
472
|
+
};
|
|
473
|
+
this.jobs.set(id, job);
|
|
474
|
+
this.running.set(kind, id);
|
|
475
|
+
const abort = new AbortController();
|
|
476
|
+
this.aborts.set(id, abort);
|
|
477
|
+
const cancelled = this.cancelledIds;
|
|
478
|
+
const control = {
|
|
479
|
+
progress: (done, total, message) => {
|
|
480
|
+
job.progress = { done, total, message };
|
|
481
|
+
this.publish({ type: "job.progress", jobId: id, done, total, message });
|
|
482
|
+
},
|
|
483
|
+
get cancelled() {
|
|
484
|
+
return cancelled.has(id);
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
void (async () => {
|
|
488
|
+
try {
|
|
489
|
+
const out = await withSignal(abort.signal, () => work(control));
|
|
490
|
+
if (out?.result)
|
|
491
|
+
job.result = out.result;
|
|
492
|
+
if (out?.errors?.length)
|
|
493
|
+
job.errors.push(...out.errors);
|
|
494
|
+
job.state = this.cancelledIds.has(id) ? "cancelled" : job.errors.length ? "failed" : "done";
|
|
495
|
+
} catch (e) {
|
|
496
|
+
if (this.cancelledIds.has(id))
|
|
497
|
+
job.state = "cancelled";
|
|
498
|
+
else {
|
|
499
|
+
job.errors.push(e instanceof Error ? e.message : String(e));
|
|
500
|
+
job.state = "failed";
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
this.aborts.delete(id);
|
|
504
|
+
job.finishedAt = this.now().toISOString();
|
|
505
|
+
if (this.running.get(kind) === id)
|
|
506
|
+
this.running.delete(kind);
|
|
507
|
+
this.publish({ type: "job.done", jobId: id, state: job.state });
|
|
508
|
+
})();
|
|
509
|
+
return job;
|
|
510
|
+
}
|
|
511
|
+
/** Ask a running job to stop; false when it already finished. */
|
|
512
|
+
cancel(id) {
|
|
513
|
+
const j = this.jobs.get(id);
|
|
514
|
+
if (!j || j.state !== "running")
|
|
515
|
+
return false;
|
|
516
|
+
this.cancelledIds.add(id);
|
|
517
|
+
this.aborts.get(id)?.abort();
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
520
|
+
/** Wait for a job to finish (tests and the CLI). */
|
|
521
|
+
async settle(id, timeoutMs = 6e4) {
|
|
522
|
+
const start = Date.now();
|
|
523
|
+
for (; ; ) {
|
|
524
|
+
const j = this.jobs.get(id);
|
|
525
|
+
if (!j)
|
|
526
|
+
throw new Error(`No job ${id}`);
|
|
527
|
+
if (j.state !== "running" && j.state !== "queued")
|
|
528
|
+
return j;
|
|
529
|
+
if (Date.now() - start > timeoutMs)
|
|
530
|
+
throw new Error(`Job ${id} did not finish`);
|
|
531
|
+
await new Promise((r) => setTimeout(r, 20));
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// packages/server/dist/static.js
|
|
537
|
+
import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
|
|
538
|
+
import { extname, join as join2, normalize, sep } from "node:path";
|
|
539
|
+
var TYPES = {
|
|
540
|
+
".html": "text/html; charset=utf-8",
|
|
541
|
+
".js": "text/javascript; charset=utf-8",
|
|
542
|
+
".css": "text/css; charset=utf-8",
|
|
543
|
+
".json": "application/json; charset=utf-8",
|
|
544
|
+
".svg": "image/svg+xml",
|
|
545
|
+
".png": "image/png",
|
|
546
|
+
".ico": "image/x-icon",
|
|
547
|
+
".woff": "font/woff",
|
|
548
|
+
".woff2": "font/woff2",
|
|
549
|
+
".map": "application/json; charset=utf-8",
|
|
550
|
+
".txt": "text/plain; charset=utf-8"
|
|
551
|
+
};
|
|
552
|
+
function appCsp(port, embed) {
|
|
553
|
+
return [
|
|
554
|
+
"default-src 'self'",
|
|
555
|
+
`connect-src 'self' ws://127.0.0.1:${port} ws://localhost:${port}`,
|
|
556
|
+
"img-src 'self' data:",
|
|
557
|
+
"style-src 'self' 'unsafe-inline'",
|
|
558
|
+
"font-src 'self' data:",
|
|
559
|
+
"script-src 'self'",
|
|
560
|
+
"object-src 'none'",
|
|
561
|
+
"base-uri 'none'",
|
|
562
|
+
embed === "vscode" ? "frame-ancestors vscode-webview:" : "frame-ancestors 'none'",
|
|
563
|
+
"form-action 'self'"
|
|
564
|
+
].join("; ");
|
|
565
|
+
}
|
|
566
|
+
var escapeAttr = (s) => s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
567
|
+
async function staticFile(dir, path, token) {
|
|
568
|
+
let rel;
|
|
569
|
+
try {
|
|
570
|
+
rel = decodeURIComponent(path);
|
|
571
|
+
} catch {
|
|
572
|
+
return { status: 400, type: TYPES[".txt"], body: "Bad path", cache: "no-store" };
|
|
573
|
+
}
|
|
574
|
+
if (rel === "/" || rel === "")
|
|
575
|
+
rel = "/index.html";
|
|
576
|
+
const file = normalize(join2(dir, rel));
|
|
577
|
+
if (file !== dir && !file.startsWith(dir.endsWith(sep) ? dir : dir + sep))
|
|
578
|
+
return { status: 404, type: TYPES[".txt"], body: "Not found", cache: "no-store" };
|
|
579
|
+
const info = await stat2(file).catch(() => void 0);
|
|
580
|
+
const target = info?.isFile() ? file : extname(rel) ? void 0 : join2(dir, "index.html");
|
|
581
|
+
if (!target)
|
|
582
|
+
return { status: 404, type: TYPES[".txt"], body: "Not found", cache: "no-store" };
|
|
583
|
+
const ext = extname(target).toLowerCase();
|
|
584
|
+
const type = TYPES[ext] ?? "application/octet-stream";
|
|
585
|
+
if (ext === ".html") {
|
|
586
|
+
const html = (await readFile2(target, "utf8")).replace(/<meta name="atticus-token" content="[^"]*"\s*\/?>/, `<meta name="atticus-token" content="${escapeAttr(token)}" />`);
|
|
587
|
+
return { status: 200, type, body: html, cache: "no-store" };
|
|
588
|
+
}
|
|
589
|
+
return {
|
|
590
|
+
status: 200,
|
|
591
|
+
type,
|
|
592
|
+
body: await readFile2(target),
|
|
593
|
+
// Built assets carry a content hash in their name.
|
|
594
|
+
cache: /[.-][A-Za-z0-9_-]{8,}\.(js|css|woff2?)$/.test(target) ? "public, max-age=31536000, immutable" : "no-cache"
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
// packages/server/dist/watch.js
|
|
599
|
+
import { statSync, watch } from "node:fs";
|
|
600
|
+
import { join as join3, relative, sep as sep2 } from "node:path";
|
|
601
|
+
var SKIP = /* @__PURE__ */ new Set([".git", "node_modules", ".index", "workspace", "logs", ".vitest-cache"]);
|
|
602
|
+
var TEMP = /(~|\.swp|\.swx|\.tmp|\.crdownload|\.part)$/i;
|
|
603
|
+
var posix = (p) => p.split(sep2).join("/");
|
|
604
|
+
var isDir = (p) => {
|
|
605
|
+
try {
|
|
606
|
+
return statSync(p).isDirectory();
|
|
607
|
+
} catch {
|
|
608
|
+
return false;
|
|
609
|
+
}
|
|
610
|
+
};
|
|
611
|
+
function watchMetarepo(o) {
|
|
612
|
+
const root = o.root;
|
|
613
|
+
const delay = o.delayMs ?? 300;
|
|
614
|
+
const maxPaths = o.maxPaths ?? 50;
|
|
615
|
+
const watchers = /* @__PURE__ */ new Map();
|
|
616
|
+
const problems = [];
|
|
617
|
+
const pending = /* @__PURE__ */ new Set();
|
|
618
|
+
let timer;
|
|
619
|
+
let first = 0;
|
|
620
|
+
let closed = false;
|
|
621
|
+
const skipped = (rel) => rel === "" || rel.startsWith("..") || TEMP.test(rel) || rel.split("/").some((s) => SKIP.has(s));
|
|
622
|
+
const flush = () => {
|
|
623
|
+
timer = void 0;
|
|
624
|
+
first = 0;
|
|
625
|
+
if (closed || !pending.size)
|
|
626
|
+
return;
|
|
627
|
+
let out = [...pending].sort();
|
|
628
|
+
pending.clear();
|
|
629
|
+
if (out.length > maxPaths)
|
|
630
|
+
out = [...new Set(out.map((p) => p.split("/").slice(0, 2).join("/")))].sort();
|
|
631
|
+
for (const path of out)
|
|
632
|
+
o.publish({ type: "file.changed", path });
|
|
633
|
+
};
|
|
634
|
+
const note = (abs) => {
|
|
635
|
+
const rel = posix(relative(root, abs));
|
|
636
|
+
if (skipped(rel))
|
|
637
|
+
return;
|
|
638
|
+
pending.add(rel);
|
|
639
|
+
const now = Date.now();
|
|
640
|
+
if (!first)
|
|
641
|
+
first = now;
|
|
642
|
+
clearTimeout(timer);
|
|
643
|
+
timer = setTimeout(flush, now - first > delay * 5 ? 0 : delay);
|
|
644
|
+
};
|
|
645
|
+
const folders = () => {
|
|
646
|
+
const all = [
|
|
647
|
+
orgPackDirOf(root),
|
|
648
|
+
catalogDirOf(root),
|
|
649
|
+
openspecDirOf(root),
|
|
650
|
+
specsDirOf(root),
|
|
651
|
+
questionsDirOf(root),
|
|
652
|
+
knowledgeDirOf(root),
|
|
653
|
+
proposalsDirOf(root),
|
|
654
|
+
inputsDirOf(root),
|
|
655
|
+
runsDirOf(root),
|
|
656
|
+
// ADR 0124: the facts and the verifier's reports, for the Map's Trust tab.
|
|
657
|
+
factsDirOf(root),
|
|
658
|
+
join3(root, ".atticus", "history")
|
|
659
|
+
].filter((d) => !skipped(posix(relative(root, d))));
|
|
660
|
+
const unique = [...new Set(all)].sort();
|
|
661
|
+
return unique.filter((d) => !unique.some((p) => p !== d && d.startsWith(p + sep2)));
|
|
662
|
+
};
|
|
663
|
+
const follow = (dir, recursive) => {
|
|
664
|
+
if (closed || watchers.has(dir) || !isDir(dir))
|
|
665
|
+
return;
|
|
666
|
+
try {
|
|
667
|
+
const w = watch(dir, { recursive }, (_event, name) => {
|
|
668
|
+
if (!recursive && name) {
|
|
669
|
+
attach();
|
|
670
|
+
if (watchers.has(join3(dir, String(name))))
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
note(name ? join3(dir, String(name)) : dir);
|
|
674
|
+
});
|
|
675
|
+
w.on("error", (e) => {
|
|
676
|
+
problems.push(`${posix(relative(root, dir)) || "."}: ${e.message}`);
|
|
677
|
+
w.close();
|
|
678
|
+
watchers.delete(dir);
|
|
679
|
+
});
|
|
680
|
+
watchers.set(dir, w);
|
|
681
|
+
} catch (e) {
|
|
682
|
+
problems.push(`${posix(relative(root, dir)) || "."}: ${e.message}`);
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
const attach = () => {
|
|
686
|
+
for (const d of folders())
|
|
687
|
+
follow(d, true);
|
|
688
|
+
};
|
|
689
|
+
follow(root, false);
|
|
690
|
+
follow(join3(root, ".atticus"), false);
|
|
691
|
+
attach();
|
|
692
|
+
return {
|
|
693
|
+
get following() {
|
|
694
|
+
return [...watchers.keys()].filter((d) => d !== root && d !== join3(root, ".atticus")).map((d) => posix(relative(root, d))).sort();
|
|
695
|
+
},
|
|
696
|
+
problems,
|
|
697
|
+
close() {
|
|
698
|
+
closed = true;
|
|
699
|
+
clearTimeout(timer);
|
|
700
|
+
for (const w of watchers.values())
|
|
701
|
+
w.close();
|
|
702
|
+
watchers.clear();
|
|
703
|
+
pending.clear();
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// packages/server/dist/ws.js
|
|
709
|
+
import { createHash } from "node:crypto";
|
|
710
|
+
var GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
711
|
+
function acceptKey(key) {
|
|
712
|
+
return createHash("sha1").update(key + GUID).digest("base64");
|
|
713
|
+
}
|
|
714
|
+
function frame(opcode, payload) {
|
|
715
|
+
const len = payload.length;
|
|
716
|
+
let head;
|
|
717
|
+
if (len < 126)
|
|
718
|
+
head = Buffer.from([128 | opcode, len]);
|
|
719
|
+
else if (len < 65536) {
|
|
720
|
+
head = Buffer.alloc(4);
|
|
721
|
+
head[0] = 128 | opcode;
|
|
722
|
+
head[1] = 126;
|
|
723
|
+
head.writeUInt16BE(len, 2);
|
|
724
|
+
} else {
|
|
725
|
+
head = Buffer.alloc(10);
|
|
726
|
+
head[0] = 128 | opcode;
|
|
727
|
+
head[1] = 127;
|
|
728
|
+
head.writeBigUInt64BE(BigInt(len), 2);
|
|
729
|
+
}
|
|
730
|
+
return Buffer.concat([head, payload]);
|
|
731
|
+
}
|
|
732
|
+
var Socket = class {
|
|
733
|
+
sock;
|
|
734
|
+
onClose;
|
|
735
|
+
buf = Buffer.alloc(0);
|
|
736
|
+
closed = false;
|
|
737
|
+
constructor(sock, onClose) {
|
|
738
|
+
this.sock = sock;
|
|
739
|
+
this.onClose = onClose;
|
|
740
|
+
sock.on("data", (d) => this.read(d));
|
|
741
|
+
sock.on("close", () => this.end());
|
|
742
|
+
sock.on("error", () => this.end());
|
|
743
|
+
}
|
|
744
|
+
send(text) {
|
|
745
|
+
if (!this.closed)
|
|
746
|
+
this.sock.write(frame(1, Buffer.from(text, "utf8")));
|
|
747
|
+
}
|
|
748
|
+
close() {
|
|
749
|
+
if (this.closed)
|
|
750
|
+
return;
|
|
751
|
+
this.sock.write(frame(8, Buffer.alloc(0)));
|
|
752
|
+
this.sock.end();
|
|
753
|
+
this.end();
|
|
754
|
+
}
|
|
755
|
+
end() {
|
|
756
|
+
if (this.closed)
|
|
757
|
+
return;
|
|
758
|
+
this.closed = true;
|
|
759
|
+
this.onClose(this);
|
|
760
|
+
}
|
|
761
|
+
/** Client frames are masked; only control frames matter to us. */
|
|
762
|
+
read(d) {
|
|
763
|
+
this.buf = Buffer.concat([this.buf, d]);
|
|
764
|
+
while (this.buf.length >= 2) {
|
|
765
|
+
const opcode = this.buf[0] & 15;
|
|
766
|
+
const masked = (this.buf[1] & 128) !== 0;
|
|
767
|
+
let len = this.buf[1] & 127;
|
|
768
|
+
let off = 2;
|
|
769
|
+
if (len === 126) {
|
|
770
|
+
if (this.buf.length < 4)
|
|
771
|
+
return;
|
|
772
|
+
len = this.buf.readUInt16BE(2);
|
|
773
|
+
off = 4;
|
|
774
|
+
} else if (len === 127) {
|
|
775
|
+
if (this.buf.length < 10)
|
|
776
|
+
return;
|
|
777
|
+
len = Number(this.buf.readBigUInt64BE(2));
|
|
778
|
+
off = 10;
|
|
779
|
+
}
|
|
780
|
+
const maskOff = off;
|
|
781
|
+
if (masked)
|
|
782
|
+
off += 4;
|
|
783
|
+
if (this.buf.length < off + len)
|
|
784
|
+
return;
|
|
785
|
+
const payload = Buffer.from(this.buf.subarray(off, off + len));
|
|
786
|
+
if (masked)
|
|
787
|
+
for (let i = 0; i < payload.length; i++)
|
|
788
|
+
payload[i] ^= this.buf[maskOff + i % 4];
|
|
789
|
+
this.buf = this.buf.subarray(off + len);
|
|
790
|
+
if (opcode === 8)
|
|
791
|
+
return this.close();
|
|
792
|
+
if (opcode === 9)
|
|
793
|
+
this.sock.write(frame(10, payload));
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
function upgrade(req, sock, onClose) {
|
|
798
|
+
const key = req.headers["sec-websocket-key"];
|
|
799
|
+
if (typeof key !== "string" || req.headers["sec-websocket-version"] !== "13") {
|
|
800
|
+
sock.end("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n");
|
|
801
|
+
return void 0;
|
|
802
|
+
}
|
|
803
|
+
sock.write([
|
|
804
|
+
"HTTP/1.1 101 Switching Protocols",
|
|
805
|
+
"Upgrade: websocket",
|
|
806
|
+
"Connection: Upgrade",
|
|
807
|
+
`Sec-WebSocket-Accept: ${acceptKey(key)}`,
|
|
808
|
+
"",
|
|
809
|
+
""
|
|
810
|
+
].join("\r\n"));
|
|
811
|
+
return new Socket(sock, onClose);
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// packages/server/dist/server.js
|
|
815
|
+
var EventHub = class {
|
|
816
|
+
sockets = /* @__PURE__ */ new Set();
|
|
817
|
+
listeners = /* @__PURE__ */ new Set();
|
|
818
|
+
/** Hear every event in this process too (ADR 0119: a reader that keeps files in memory). */
|
|
819
|
+
listen(fn) {
|
|
820
|
+
this.listeners.add(fn);
|
|
821
|
+
return () => this.listeners.delete(fn);
|
|
822
|
+
}
|
|
823
|
+
add(s) {
|
|
824
|
+
this.sockets.add(s);
|
|
825
|
+
}
|
|
826
|
+
remove(s) {
|
|
827
|
+
this.sockets.delete(s);
|
|
828
|
+
}
|
|
829
|
+
get size() {
|
|
830
|
+
return this.sockets.size;
|
|
831
|
+
}
|
|
832
|
+
publish(e) {
|
|
833
|
+
for (const fn of this.listeners)
|
|
834
|
+
fn(e);
|
|
835
|
+
const text = JSON.stringify(e);
|
|
836
|
+
for (const s of this.sockets)
|
|
837
|
+
s.send(text);
|
|
838
|
+
}
|
|
839
|
+
closeAll() {
|
|
840
|
+
for (const s of [...this.sockets])
|
|
841
|
+
s.close();
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
var MAX_BODY = 4 * 1024 * 1024;
|
|
845
|
+
function sameToken(a, b) {
|
|
846
|
+
const x = Buffer.from(a);
|
|
847
|
+
const y = Buffer.from(b);
|
|
848
|
+
return x.length === y.length && timingSafeEqual(x, y);
|
|
849
|
+
}
|
|
850
|
+
async function readBody(req, max = MAX_BODY) {
|
|
851
|
+
const chunks = [];
|
|
852
|
+
let size = 0;
|
|
853
|
+
for await (const c of req) {
|
|
854
|
+
size += c.length;
|
|
855
|
+
if (size > max)
|
|
856
|
+
throw new HttpError(413, "The request body is too large");
|
|
857
|
+
chunks.push(c);
|
|
858
|
+
}
|
|
859
|
+
if (size === 0)
|
|
860
|
+
return void 0;
|
|
861
|
+
const type = req.headers["content-type"] ?? "";
|
|
862
|
+
if (!type.startsWith("application/json"))
|
|
863
|
+
throw new HttpError(415, "Send the body as application/json");
|
|
864
|
+
try {
|
|
865
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
866
|
+
} catch {
|
|
867
|
+
throw new HttpError(400, "The request isn't valid", "The body is not valid JSON.");
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
var HARDENING = {
|
|
871
|
+
"X-Content-Type-Options": "nosniff",
|
|
872
|
+
"X-Frame-Options": "DENY",
|
|
873
|
+
"Cross-Origin-Resource-Policy": "same-origin",
|
|
874
|
+
"Cross-Origin-Opener-Policy": "same-origin",
|
|
875
|
+
"Referrer-Policy": "no-referrer",
|
|
876
|
+
"Permissions-Policy": "camera=(), microphone=(), geolocation=(), usb=(), payment=()"
|
|
877
|
+
};
|
|
878
|
+
function send(res, status, body, type = "application/json") {
|
|
879
|
+
const text = body === void 0 ? "" : JSON.stringify(body);
|
|
880
|
+
res.writeHead(status, {
|
|
881
|
+
...HARDENING,
|
|
882
|
+
"Content-Type": `${type}; charset=utf-8`,
|
|
883
|
+
"Cache-Control": "no-store"
|
|
884
|
+
});
|
|
885
|
+
res.end(text);
|
|
886
|
+
}
|
|
887
|
+
async function startServer(o) {
|
|
888
|
+
const host = o.host ?? "127.0.0.1";
|
|
889
|
+
if (host !== "127.0.0.1")
|
|
890
|
+
throw new Error(`Atticus only listens on 127.0.0.1 (asked for ${host}).`);
|
|
891
|
+
const token = o.token && /^[A-Za-z0-9_-]{32,}$/.test(o.token) ? o.token : randomBytes(32).toString("base64url");
|
|
892
|
+
const events = new EventHub();
|
|
893
|
+
const jobs = new JobManager((e) => events.publish(e));
|
|
894
|
+
const person = o.user ? { handle: o.user, source: "given" } : await gitUser(o.root);
|
|
895
|
+
const ctx = {
|
|
896
|
+
root: o.root,
|
|
897
|
+
user: person.handle,
|
|
898
|
+
person,
|
|
899
|
+
version: o.version ?? "0.0.0",
|
|
900
|
+
full: o.full === true,
|
|
901
|
+
events,
|
|
902
|
+
jobs
|
|
903
|
+
};
|
|
904
|
+
const router = apiRoutes(new Router(), ctx).add("GET", "/api/jobs/{jobId}", ({ params }) => {
|
|
905
|
+
const j = jobs.get(params.jobId);
|
|
906
|
+
if (!j)
|
|
907
|
+
throw notFound(`There is no job ${params.jobId}.`);
|
|
908
|
+
return { status: 200, body: j };
|
|
909
|
+
}).add("POST", "/api/jobs/{jobId}/cancel", ({ params }) => {
|
|
910
|
+
const j = jobs.get(params.jobId);
|
|
911
|
+
if (!j)
|
|
912
|
+
throw notFound(`There is no job ${params.jobId}.`);
|
|
913
|
+
if (!jobs.cancel(j.id))
|
|
914
|
+
throw conflict(`Job ${j.id} already finished (${j.state}).`);
|
|
915
|
+
return { status: 200, body: j };
|
|
916
|
+
});
|
|
917
|
+
o.extend?.(router, ctx);
|
|
918
|
+
let port = 0;
|
|
919
|
+
const allowedHosts = () => /* @__PURE__ */ new Set([`127.0.0.1:${port}`, `localhost:${port}`]);
|
|
920
|
+
const guard = (req, url, tokenFromQuery) => {
|
|
921
|
+
if (!allowedHosts().has(req.headers.host ?? ""))
|
|
922
|
+
throw new HttpError(403, "Requests must be addressed to this server");
|
|
923
|
+
const origin = req.headers.origin;
|
|
924
|
+
if (origin && !allowedHosts().has(origin.replace(/^https?:\/\//, "")))
|
|
925
|
+
throw new HttpError(403, "Requests from other sites are not allowed");
|
|
926
|
+
const given = req.headers["x-atticus-token"] ?? (tokenFromQuery ? url.searchParams.get("token") ?? void 0 : void 0);
|
|
927
|
+
if (!given || !sameToken(given, token))
|
|
928
|
+
throw new HttpError(401, "Missing or wrong session token");
|
|
929
|
+
};
|
|
930
|
+
const server = createServer(async (req, res) => {
|
|
931
|
+
const t0 = Date.now();
|
|
932
|
+
const done = (status, error) => {
|
|
933
|
+
const path = (req.url ?? "/").split("?")[0];
|
|
934
|
+
if (path.startsWith("/api/"))
|
|
935
|
+
o.onRequest?.({
|
|
936
|
+
method: req.method ?? "GET",
|
|
937
|
+
path,
|
|
938
|
+
status,
|
|
939
|
+
ms: Date.now() - t0,
|
|
940
|
+
...error ? { error } : {}
|
|
941
|
+
});
|
|
942
|
+
};
|
|
943
|
+
try {
|
|
944
|
+
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
945
|
+
if (!url.pathname.startsWith("/api/")) {
|
|
946
|
+
if (!allowedHosts().has(req.headers.host ?? ""))
|
|
947
|
+
throw new HttpError(403, "Requests must be addressed to this server");
|
|
948
|
+
if (!o.staticDir || req.method !== "GET" && req.method !== "HEAD")
|
|
949
|
+
throw new HttpError(404, "Not found", `Nothing is served at ${url.pathname}.`);
|
|
950
|
+
const f = await staticFile(o.staticDir, url.pathname, token);
|
|
951
|
+
const { "X-Frame-Options": deny, ...rest } = HARDENING;
|
|
952
|
+
res.writeHead(f.status, {
|
|
953
|
+
...o.embed ? rest : { ...rest, "X-Frame-Options": deny },
|
|
954
|
+
"Content-Type": f.type,
|
|
955
|
+
"Cache-Control": f.cache,
|
|
956
|
+
"Content-Security-Policy": appCsp(port, o.embed)
|
|
957
|
+
});
|
|
958
|
+
res.end(req.method === "HEAD" ? void 0 : f.body);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
guard(req, url, false);
|
|
962
|
+
const m = router.match(req.method ?? "GET", url.pathname);
|
|
963
|
+
if ("allowed" in m) {
|
|
964
|
+
if (m.allowed.length === 0)
|
|
965
|
+
throw new HttpError(404, "Not found", `There is no API call ${url.pathname}.`);
|
|
966
|
+
throw new HttpError(405, "Method not allowed", `Use ${m.allowed.join(" or ")}.`);
|
|
967
|
+
}
|
|
968
|
+
const body = await readBody(req, m.maxBody);
|
|
969
|
+
const out = await m.handler({
|
|
970
|
+
method: req.method ?? "GET",
|
|
971
|
+
path: url.pathname,
|
|
972
|
+
params: m.params,
|
|
973
|
+
query: url.searchParams,
|
|
974
|
+
body
|
|
975
|
+
});
|
|
976
|
+
send(res, out.status, out.body);
|
|
977
|
+
done(out.status);
|
|
978
|
+
} catch (e) {
|
|
979
|
+
const err = e instanceof HttpError ? e : new HttpError(500, "Something went wrong", e instanceof Error ? e.message : String(e));
|
|
980
|
+
send(res, err.status, problem(err), "application/problem+json");
|
|
981
|
+
done(err.status, err.status >= 500 && e instanceof Error ? e : void 0);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
server.on("upgrade", (req, sock) => {
|
|
985
|
+
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
986
|
+
try {
|
|
987
|
+
if (url.pathname !== "/api/events")
|
|
988
|
+
throw new HttpError(404, "Not found");
|
|
989
|
+
guard(req, url, true);
|
|
990
|
+
} catch (e) {
|
|
991
|
+
const err = e instanceof HttpError ? e : new HttpError(400, "Bad request");
|
|
992
|
+
sock.end(`HTTP/1.1 ${err.status} ${err.title}\r
|
|
993
|
+
Connection: close\r
|
|
994
|
+
\r
|
|
995
|
+
`);
|
|
996
|
+
return;
|
|
997
|
+
}
|
|
998
|
+
const s = upgrade(req, sock, (x) => events.remove(x));
|
|
999
|
+
if (s)
|
|
1000
|
+
events.add(s);
|
|
1001
|
+
});
|
|
1002
|
+
await new Promise((resolve, reject) => {
|
|
1003
|
+
server.once("error", reject);
|
|
1004
|
+
server.listen(o.port ?? DEFAULT_PORT, host, () => resolve());
|
|
1005
|
+
});
|
|
1006
|
+
port = server.address().port;
|
|
1007
|
+
const watcher = o.watch === false ? void 0 : watchMetarepo({ root: o.root, publish: (e) => events.publish(e) });
|
|
1008
|
+
return {
|
|
1009
|
+
url: `http://127.0.0.1:${port}`,
|
|
1010
|
+
port,
|
|
1011
|
+
token,
|
|
1012
|
+
events,
|
|
1013
|
+
jobs,
|
|
1014
|
+
person,
|
|
1015
|
+
get following() {
|
|
1016
|
+
return watcher?.following ?? [];
|
|
1017
|
+
},
|
|
1018
|
+
close: () => new Promise((resolve) => {
|
|
1019
|
+
watcher?.close();
|
|
1020
|
+
events.closeAll();
|
|
1021
|
+
server.closeAllConnections?.();
|
|
1022
|
+
server.close(() => resolve());
|
|
1023
|
+
})
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// packages/cli/dist/ui-api-cites.js
|
|
1028
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
1029
|
+
async function fingerprint(dirs) {
|
|
1030
|
+
let count = 0;
|
|
1031
|
+
let newest = 0;
|
|
1032
|
+
const walk = async (d) => {
|
|
1033
|
+
const entries = await readdir(d, { withFileTypes: true }).catch(() => []);
|
|
1034
|
+
for (const e of entries) {
|
|
1035
|
+
const p = join4(d, e.name);
|
|
1036
|
+
if (e.isDirectory())
|
|
1037
|
+
await walk(p);
|
|
1038
|
+
else {
|
|
1039
|
+
count++;
|
|
1040
|
+
const s = await stat3(p).catch(() => void 0);
|
|
1041
|
+
if (s && s.mtimeMs > newest)
|
|
1042
|
+
newest = s.mtimeMs;
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
};
|
|
1046
|
+
for (const d of dirs)
|
|
1047
|
+
await walk(d);
|
|
1048
|
+
return `${count}:${newest}`;
|
|
1049
|
+
}
|
|
1050
|
+
async function build(root) {
|
|
1051
|
+
const index = /* @__PURE__ */ new Map();
|
|
1052
|
+
const lineOf = (repo, path, line) => {
|
|
1053
|
+
const files = index.get(repo) ?? /* @__PURE__ */ new Map();
|
|
1054
|
+
index.set(repo, files);
|
|
1055
|
+
const lines = files.get(path) ?? /* @__PURE__ */ new Map();
|
|
1056
|
+
files.set(path, lines);
|
|
1057
|
+
const l = lines.get(line) ?? { line, flows: [], records: [] };
|
|
1058
|
+
lines.set(line, l);
|
|
1059
|
+
return l;
|
|
1060
|
+
};
|
|
1061
|
+
for (const specRepo of await specRepos(root))
|
|
1062
|
+
for (const f of (await readRepoSpec(root, specRepo, { cacheRoot: root })).flows) {
|
|
1063
|
+
const parts = [
|
|
1064
|
+
{ step: 0, kind: f.trigger.kind, evidence: f.trigger.evidence },
|
|
1065
|
+
...f.steps.map((s, i) => ({
|
|
1066
|
+
step: i + 1,
|
|
1067
|
+
kind: s.kind,
|
|
1068
|
+
...s.confirmedBy ? { confirmedBy: s.confirmedBy } : {},
|
|
1069
|
+
evidence: s.evidence
|
|
1070
|
+
}))
|
|
1071
|
+
];
|
|
1072
|
+
for (const part of parts)
|
|
1073
|
+
for (const e of part.evidence) {
|
|
1074
|
+
if (!e.path || e.line === void 0)
|
|
1075
|
+
continue;
|
|
1076
|
+
const l = lineOf(e.repo ?? specRepo, e.path, e.line);
|
|
1077
|
+
if (l.flows.some((x) => x.flow === f.id && x.step === part.step))
|
|
1078
|
+
continue;
|
|
1079
|
+
l.flows.push({
|
|
1080
|
+
repo: specRepo,
|
|
1081
|
+
flow: f.id,
|
|
1082
|
+
name: f.name,
|
|
1083
|
+
step: part.step,
|
|
1084
|
+
kind: part.kind,
|
|
1085
|
+
...part.confirmedBy ? { confirmedBy: part.confirmedBy } : {}
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
for (const r of await catalogRecords(root)) {
|
|
1090
|
+
const name = r.name;
|
|
1091
|
+
for (const e of r.evidence) {
|
|
1092
|
+
if (!e.repo || !e.path || e.line === void 0)
|
|
1093
|
+
continue;
|
|
1094
|
+
const l = lineOf(e.repo, e.path, e.line);
|
|
1095
|
+
if (l.records.some((x) => x.kind === r.kind && x.id === r.id))
|
|
1096
|
+
continue;
|
|
1097
|
+
l.records.push({
|
|
1098
|
+
kind: r.kind,
|
|
1099
|
+
id: r.id,
|
|
1100
|
+
...typeof name === "string" && name !== r.id ? { name } : {},
|
|
1101
|
+
source: e.source
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
return index;
|
|
1106
|
+
}
|
|
1107
|
+
var DONE = /* @__PURE__ */ new Set(["released", "archived", "post-release-review"]);
|
|
1108
|
+
async function inFlight(root) {
|
|
1109
|
+
const out = /* @__PURE__ */ new Map();
|
|
1110
|
+
const dir = changesDirOf(root);
|
|
1111
|
+
for (const e of await readdir(dir, { withFileTypes: true }).catch(() => [])) {
|
|
1112
|
+
if (!e.isDirectory() || e.name === "archive")
|
|
1113
|
+
continue;
|
|
1114
|
+
const yaml = await readFile3(join4(dir, e.name, "change.yaml"), "utf8").catch(() => "");
|
|
1115
|
+
const state = (() => {
|
|
1116
|
+
try {
|
|
1117
|
+
return (0, import_yaml.parse)(yaml)?.state;
|
|
1118
|
+
} catch {
|
|
1119
|
+
return void 0;
|
|
1120
|
+
}
|
|
1121
|
+
})();
|
|
1122
|
+
if (!yaml || typeof state === "string" && DONE.has(state))
|
|
1123
|
+
continue;
|
|
1124
|
+
for (const f of await readdir(join4(dir, e.name, "target-flows")).catch(() => []))
|
|
1125
|
+
if (f.endsWith(".yaml")) {
|
|
1126
|
+
const flow = f.slice(0, -".yaml".length);
|
|
1127
|
+
out.set(flow, [...out.get(flow) ?? [], e.name]);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
return out;
|
|
1131
|
+
}
|
|
1132
|
+
async function citeList(root, index, repo, path) {
|
|
1133
|
+
const lines = [...index.get(repo)?.get(path)?.values() ?? []].sort((a, b) => a.line - b.line);
|
|
1134
|
+
const flying = await inFlight(root);
|
|
1135
|
+
const shown = lines.map((l) => ({
|
|
1136
|
+
...l,
|
|
1137
|
+
flows: [...l.flows].sort((a, b) => a.flow.localeCompare(b.flow) || a.step - b.step).map((f) => flying.get(f.flow)?.length ? { ...f, changes: flying.get(f.flow) } : f)
|
|
1138
|
+
}));
|
|
1139
|
+
return { repo, path, lines: shown };
|
|
1140
|
+
}
|
|
1141
|
+
function fileInRepo(root, file) {
|
|
1142
|
+
const rel = relative2(root, file);
|
|
1143
|
+
if (!rel || rel.startsWith("..") || isAbsolute(rel))
|
|
1144
|
+
return void 0;
|
|
1145
|
+
const parts = rel.split(sep3);
|
|
1146
|
+
if (parts[0] !== "workspace")
|
|
1147
|
+
return { path: parts.join("/") };
|
|
1148
|
+
const at = parts[1] === ".worktrees" ? 3 : parts[1] === ".branches" ? 2 : 1;
|
|
1149
|
+
const repo = parts[at];
|
|
1150
|
+
const rest = parts.slice(parts[1] === ".branches" ? 4 : at + 1);
|
|
1151
|
+
if (!repo || !rest.length || !RecordId.safeParse(repo).success)
|
|
1152
|
+
return void 0;
|
|
1153
|
+
return { repo, path: rest.join("/") };
|
|
1154
|
+
}
|
|
1155
|
+
async function citesCli(root, o, io) {
|
|
1156
|
+
let repo = o.repo;
|
|
1157
|
+
let path = o.path;
|
|
1158
|
+
const index = await build(root);
|
|
1159
|
+
if (o.file) {
|
|
1160
|
+
const at = fileInRepo(root, o.file);
|
|
1161
|
+
if (!at) {
|
|
1162
|
+
io.err(`${o.file} isn't in this metarepo or a repo's checkout in its workspace.`);
|
|
1163
|
+
return 1;
|
|
1164
|
+
}
|
|
1165
|
+
path = at.path;
|
|
1166
|
+
repo = at.repo ?? [...index.keys()].find((r) => index.get(r).has(at.path)) ?? void 0;
|
|
1167
|
+
if (!repo) {
|
|
1168
|
+
if (o.json)
|
|
1169
|
+
io.out(JSON.stringify({ repo: "", path, lines: [] }, null, 2));
|
|
1170
|
+
else
|
|
1171
|
+
io.out(`Nothing in the specs or the catalog cites ${path}.`);
|
|
1172
|
+
return 0;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
if (!repo || !path || !RecordId.safeParse(repo).success) {
|
|
1176
|
+
io.err("Say which file: atticus cites --repo <repo> --path <its path in the repo>, or --file <path on disk>.");
|
|
1177
|
+
return 2;
|
|
1178
|
+
}
|
|
1179
|
+
const v = await citeList(root, index, repo, path);
|
|
1180
|
+
if (o.json) {
|
|
1181
|
+
io.out(JSON.stringify(v, null, 2));
|
|
1182
|
+
return 0;
|
|
1183
|
+
}
|
|
1184
|
+
if (!v.lines.length) {
|
|
1185
|
+
io.out(`Nothing in the specs or the catalog cites ${repo}/${path}.`);
|
|
1186
|
+
return 0;
|
|
1187
|
+
}
|
|
1188
|
+
for (const l of v.lines) {
|
|
1189
|
+
const flows = l.flows.map((f) => `${f.name} (step ${f.step})${f.changes?.length ? `, changed by ${f.changes.join(", ")}` : ""}`);
|
|
1190
|
+
const records = l.records.map((r) => `${r.kind} ${r.name ?? r.id}`);
|
|
1191
|
+
io.out(`Line ${l.line}: ${[...flows, ...records].join("; ")}`);
|
|
1192
|
+
}
|
|
1193
|
+
return 0;
|
|
1194
|
+
}
|
|
1195
|
+
function uiCiteRoutes(r, ctx) {
|
|
1196
|
+
const root = ctx.root;
|
|
1197
|
+
let cached;
|
|
1198
|
+
const indexNow = async () => {
|
|
1199
|
+
const print = await fingerprint([specsDirOf(root), catalogDirOf(root)]);
|
|
1200
|
+
if (cached?.print !== print)
|
|
1201
|
+
cached = { print, index: build(root) };
|
|
1202
|
+
return cached.index;
|
|
1203
|
+
};
|
|
1204
|
+
void indexNow().catch(() => void 0);
|
|
1205
|
+
r.add("GET", "/api/cites", async ({ query }) => {
|
|
1206
|
+
const repo = query.get("repo");
|
|
1207
|
+
const path = query.get("path");
|
|
1208
|
+
if (!repo || !RecordId.safeParse(repo).success)
|
|
1209
|
+
throw badRequest("Say which repo: ?repo=<the repo's id>.");
|
|
1210
|
+
if (!path)
|
|
1211
|
+
throw badRequest("Say which file: ?path=<its path in the repo>.");
|
|
1212
|
+
return { status: 200, body: await citeList(root, await indexNow(), repo, path) };
|
|
1213
|
+
});
|
|
1214
|
+
return r;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
export {
|
|
1218
|
+
HttpError,
|
|
1219
|
+
badRequest,
|
|
1220
|
+
notFound,
|
|
1221
|
+
conflict,
|
|
1222
|
+
strParam,
|
|
1223
|
+
startServer,
|
|
1224
|
+
fileInRepo,
|
|
1225
|
+
citesCli,
|
|
1226
|
+
uiCiteRoutes
|
|
1227
|
+
};
|