trellis 3.1.35 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -5
- package/README.md +19 -2
- package/bin/trellis.mjs +2 -75
- package/dist/better-sqlite-backend-2P4F6AOJ.js +209 -0
- package/dist/{better-sqlite-backend-ahx5p0br.js → better-sqlite-backend-PII64VE6.js} +37 -25
- package/dist/better-sqlite-backend-VUBVQ7SN.js +209 -0
- package/dist/better-sqlite-backend-Y3AQN65E.js +159 -0
- package/dist/better-sqlite-backend-Y3M7DXOX.js +159 -0
- package/dist/boot-middleware-FJDGVUM4.js +9 -0
- package/dist/boot-middleware-MHLHFCUC.js +9 -0
- package/dist/boot-middleware-MLJUTLUM.js +9 -0
- package/dist/boot-middleware-ZZPDZNYR.js +9 -0
- package/dist/{index-wncptktd.js → chunk-276LKLZR.js} +126 -59
- package/dist/chunk-2BRTCEHB.js +143 -0
- package/dist/chunk-2CX5UCRV.js +111 -0
- package/dist/chunk-2ESYSVXG.js +48 -0
- package/dist/{index-yp88he8n.js → chunk-2I5JU73Y.js} +88 -64
- package/dist/{index-w5wccer3.js → chunk-2UNSRRNB.js} +10 -5
- package/dist/{index-4wxa8xz4.js → chunk-335UEHQR.js} +158 -22
- package/dist/chunk-36VSSTL7.js +357 -0
- package/dist/chunk-3ETIIPPB.js +1077 -0
- package/dist/chunk-3GDRZTAW.js +45 -0
- package/dist/chunk-44FFQKQX.js +142 -0
- package/dist/chunk-4CF2L46N.js +29 -0
- package/dist/chunk-4HYPLFJD.js +150 -0
- package/dist/chunk-4XIVMVHC.js +361 -0
- package/dist/chunk-5CINODKT.js +41 -0
- package/dist/chunk-5ESGWJ5L.js +45 -0
- package/dist/chunk-5FGLQGMF.js +1676 -0
- package/dist/chunk-5IQZFITY.js +357 -0
- package/dist/{index-wt8rz4gn.js → chunk-5JWFAQDW.js} +41 -23
- package/dist/{index-7pjz3tsy.js → chunk-62UHTVU3.js} +50 -16
- package/dist/{index-h32txmxe.js → chunk-66UJQT2I.js} +6 -13
- package/dist/chunk-6CTA6MCE.js +340 -0
- package/dist/{index-4cdr7x2x.js → chunk-6RNNVOAS.js} +178 -109
- package/dist/chunk-6X23PZ6H.js +969 -0
- package/dist/chunk-7C7LL6MB.js +315 -0
- package/dist/chunk-7F4HM3JG.js +394 -0
- package/dist/chunk-7KJ7T4D3.js +910 -0
- package/dist/chunk-7QQQNUB5.js +92 -0
- package/dist/{index-53f3b8p8.js → chunk-7QWJBS72.js} +210 -165
- package/dist/chunk-7R36OZK3.js +957 -0
- package/dist/chunk-7UPKCOHE.js +946 -0
- package/dist/chunk-7WQGTFVJ.js +7434 -0
- package/dist/chunk-A3BONW34.js +35 -0
- package/dist/chunk-AHMDVHBL.js +141 -0
- package/dist/chunk-AW6A4OZY.js +171 -0
- package/dist/chunk-B3ZIFA2O.js +2240 -0
- package/dist/chunk-BJ5EKCJ5.js +458 -0
- package/dist/chunk-BJ7EZ7FP.js +145 -0
- package/dist/chunk-BQBUVMRN.js +171 -0
- package/dist/chunk-BRGYDO7D.js +223 -0
- package/dist/chunk-BXSTJVE3.js +67 -0
- package/dist/chunk-C5KPSEDN.js +359 -0
- package/dist/chunk-CCTNYTUC.js +940 -0
- package/dist/chunk-CYQ2OVD2.js +35 -0
- package/dist/chunk-DDAK7YOE.js +299 -0
- package/dist/chunk-DRILKBY6.js +965 -0
- package/dist/chunk-DXE24HNN.js +45 -0
- package/dist/chunk-E7ICUNW7.js +945 -0
- package/dist/chunk-EAL2PUOE.js +10022 -0
- package/dist/chunk-ELT7MLZB.js +109 -0
- package/dist/chunk-EO3J7GRP.js +0 -0
- package/dist/chunk-EWEIRF6G.js +171 -0
- package/dist/chunk-F5VDGQJC.js +120 -0
- package/dist/chunk-FCPL3IEQ.js +98 -0
- package/dist/{index-nq520y6k.js → chunk-FDPKYSV7.js} +43 -31
- package/dist/chunk-FES3TC24.js +171 -0
- package/dist/chunk-FF36CQHZ.js +61 -0
- package/dist/chunk-FKQO5A3H.js +35 -0
- package/dist/chunk-FOWKR5TW.js +129 -0
- package/dist/chunk-FZVCXDYW.js +150 -0
- package/dist/chunk-G3XIHPSQ.js +361 -0
- package/dist/chunk-GD5QJXSS.js +98 -0
- package/dist/chunk-GFZCJ4EH.js +108 -0
- package/dist/chunk-GKJLYLVU.js +359 -0
- package/dist/chunk-GLM4HGN4.js +55 -0
- package/dist/chunk-GNXHXNVQ.js +113 -0
- package/dist/chunk-GSR6ILTM.js +277 -0
- package/dist/chunk-GWRIMRSX.js +45 -0
- package/dist/chunk-H72UW2HJ.js +45 -0
- package/dist/chunk-HGI74PXB.js +7417 -0
- package/dist/chunk-HGRA37LO.js +145 -0
- package/dist/chunk-HO4TURXW.js +1078 -0
- package/dist/chunk-HXSRQO3L.js +145 -0
- package/dist/chunk-IG2X2BVO.js +373 -0
- package/dist/chunk-IIJVDD54.js +373 -0
- package/dist/chunk-IUWVEEOX.js +145 -0
- package/dist/chunk-IX4BBOIT.js +394 -0
- package/dist/{index-yhwjgfvj.js → chunk-IXU4RMQM.js} +67 -60
- package/dist/chunk-J3WYZO3Q.js +211 -0
- package/dist/{index-vkpkfwhq.js → chunk-J6OUIION.js} +234 -194
- package/dist/{index-xzym9w0m.js → chunk-JA7AIHRK.js} +12 -7
- package/dist/chunk-JUEMDWLU.js +233 -0
- package/dist/chunk-K46RNFDE.js +171 -0
- package/dist/chunk-KAGU2XMY.js +359 -0
- package/dist/chunk-KCVYJNVX.js +394 -0
- package/dist/chunk-KFQGP6VL.js +33 -0
- package/dist/chunk-KKDRMIV6.js +419 -0
- package/dist/chunk-KQ4A2D2P.js +910 -0
- package/dist/chunk-KSU2GW22.js +958 -0
- package/dist/chunk-KYLIQ3YI.js +399 -0
- package/dist/chunk-KZYJJIRN.js +946 -0
- package/dist/chunk-LFOX744K.js +96 -0
- package/dist/{index-rv1p47gp.js → chunk-LHOVJEWR.js} +2756 -2307
- package/dist/{index-h9e2efx4.js → chunk-LNUIGRDZ.js} +71 -55
- package/dist/chunk-LOPXTPF3.js +120 -0
- package/dist/chunk-LZR3VIFU.js +907 -0
- package/dist/chunk-MBNBTJCR.js +394 -0
- package/dist/chunk-MCKGQKYU.js +15 -0
- package/dist/{index-skhn0agf.js → chunk-MLC5BUYO.js} +19 -20
- package/dist/chunk-MPXUVGT3.js +104 -0
- package/dist/chunk-MU6EOS6F.js +0 -0
- package/dist/chunk-MWRQ2TXT.js +357 -0
- package/dist/{index-nzb3am4f.js → chunk-NO73OK2I.js} +43 -21
- package/dist/chunk-NPE2YJHK.js +394 -0
- package/dist/{index-xhcp6xrn.js → chunk-NSDXU6QX.js} +654 -500
- package/dist/chunk-NXIRDSZ6.js +145 -0
- package/dist/chunk-NZWFNHCS.js +407 -0
- package/dist/chunk-O2AV5WMN.js +48 -0
- package/dist/{index-h7zxhhhh.js → chunk-OB4CMMX6.js} +46 -38
- package/dist/chunk-OBKU74FU.js +7411 -0
- package/dist/chunk-OQNDWRDE.js +145 -0
- package/dist/chunk-OVWAJMB6.js +394 -0
- package/dist/chunk-PDHLBTTD.js +45 -0
- package/dist/chunk-PEQNRKLG.js +210 -0
- package/dist/chunk-QERIS7QY.js +7403 -0
- package/dist/chunk-QHA2DM3C.js +373 -0
- package/dist/chunk-QLM4HSYC.js +45 -0
- package/dist/chunk-RSWUFTO2.js +857 -0
- package/dist/chunk-S2OT3TQJ.js +283 -0
- package/dist/chunk-S5PHSN5K.js +907 -0
- package/dist/chunk-SIAA4J6H.js +21 -0
- package/dist/chunk-SPSPV5BC.js +390 -0
- package/dist/chunk-SQBNLUIA.js +171 -0
- package/dist/chunk-STLN6A6B.js +355 -0
- package/dist/chunk-TCKXSOBP.js +123 -0
- package/dist/chunk-U7HV7GU2.js +17 -0
- package/dist/chunk-UBGUDMUV.js +59 -0
- package/dist/chunk-UGZHOGRA.js +39 -0
- package/dist/chunk-UICF66FS.js +359 -0
- package/dist/chunk-UK3EQREE.js +1078 -0
- package/dist/chunk-UPKPURVY.js +394 -0
- package/dist/chunk-URC74VCN.js +959 -0
- package/dist/chunk-USEINYUL.js +12 -0
- package/dist/{index-bmyt7k8n.js → chunk-UZRUP7QW.js} +12 -4
- package/dist/chunk-V3G7Q3QQ.js +102 -0
- package/dist/chunk-VDAKEOML.js +857 -0
- package/dist/chunk-VUJ6SA55.js +303 -0
- package/dist/chunk-VUJQLIML.js +141 -0
- package/dist/chunk-VWKLKLYB.js +267 -0
- package/dist/chunk-VYC3RZMK.js +277 -0
- package/dist/chunk-WMERMSWI.js +154 -0
- package/dist/chunk-WMR777PO.js +2213 -0
- package/dist/{index-n9f2qyh5.js → chunk-X46IECAC.js} +55 -33
- package/dist/chunk-X5FLTRUB.js +517 -0
- package/dist/chunk-X762XWVC.js +419 -0
- package/dist/chunk-XEN3OEYY.js +2234 -0
- package/dist/chunk-XMQ7G77X.js +260 -0
- package/dist/chunk-XZQ66K7A.js +124 -0
- package/dist/{index-w7ng765c.js → chunk-YCM7ZYEZ.js} +102 -49
- package/dist/chunk-YY3GF7DH.js +7411 -0
- package/dist/chunk-ZE5R3H4C.js +907 -0
- package/dist/chunk-ZHVI7BQN.js +1077 -0
- package/dist/chunk-ZMN5LUB7.js +7411 -0
- package/dist/chunk-ZUV4MD5U.js +94 -0
- package/dist/cli/errors.d.ts +6 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/examples.d.ts +23 -0
- package/dist/cli/examples.d.ts.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +2338 -6190
- package/dist/client/index.d.ts +6 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +41 -21
- package/dist/client/live.d.ts +67 -0
- package/dist/client/live.d.ts.map +1 -0
- package/dist/client/reactive.d.ts +31 -0
- package/dist/client/reactive.d.ts.map +1 -0
- package/dist/client/sdk.d.ts +26 -2
- package/dist/client/sdk.d.ts.map +1 -1
- package/dist/client/sdk.js +9 -0
- package/dist/client/vcs-client.d.ts +129 -0
- package/dist/client/vcs-client.d.ts.map +1 -0
- package/dist/cms/index.js +171 -163
- package/dist/{config-8hczw0rs.js → config-KMY6RRK3.js} +8 -9
- package/dist/config-PFTP67TR.js +19 -0
- package/dist/config-VDMK2DUJ.js +19 -0
- package/dist/core/computation/index.d.ts +5 -0
- package/dist/core/computation/index.d.ts.map +1 -0
- package/dist/core/computation/rollup.d.ts +18 -0
- package/dist/core/computation/rollup.d.ts.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +168 -101
- package/dist/core/kernel/boot-middleware.d.ts +10 -0
- package/dist/core/kernel/boot-middleware.d.ts.map +1 -0
- package/dist/core/kernel/logic-middleware.d.ts +7 -1
- package/dist/core/kernel/logic-middleware.d.ts.map +1 -1
- package/dist/core/kernel/trellis-kernel.d.ts.map +1 -1
- package/dist/core/ontology/types.d.ts +5 -0
- package/dist/core/ontology/types.d.ts.map +1 -1
- package/dist/core/persist/better-sqlite-backend.d.ts +9 -2
- package/dist/core/persist/better-sqlite-backend.d.ts.map +1 -1
- package/dist/core/persist/factory.d.ts +6 -7
- package/dist/core/persist/factory.d.ts.map +1 -1
- package/dist/core/persist/factory.js +2 -3
- package/dist/core/persist/sqljs-backend.js +2 -3
- package/dist/db/index.d.ts +4 -1
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +69 -56
- package/dist/db/inspector.js +11 -19
- package/dist/decisions/index.js +9 -10
- package/dist/deploy-66EC752W.js +9 -0
- package/dist/deploy-SO7AFK6L.js +9 -0
- package/dist/embeddings/auto-embed.d.ts +2 -2
- package/dist/embeddings/auto-embed.d.ts.map +1 -1
- package/dist/embeddings/index.js +20 -22
- package/dist/embeddings/search.d.ts +2 -1
- package/dist/embeddings/search.d.ts.map +1 -1
- package/dist/embeddings/store.d.ts +25 -4
- package/dist/embeddings/store.d.ts.map +1 -1
- package/dist/engine-7GXBM4IT.js +7 -0
- package/dist/engine-NSR6BIF7.js +7 -0
- package/dist/engine.d.ts +32 -12
- package/dist/engine.d.ts.map +1 -1
- package/dist/factory-2P64OC7M.js +34 -0
- package/dist/factory-YP4ZZK5K.js +34 -0
- package/dist/import-AJLYHFIA.js +10 -0
- package/dist/import-UZEKXU3B.js +10 -0
- package/dist/index.js +102 -93
- package/dist/launch-explorer-AI6L2AWJ.js +91 -0
- package/dist/launch-explorer-HZ4ZJA4X.js +95 -0
- package/dist/links/index.js +24 -26
- package/dist/plugins/agent-memory/index.js +316 -0
- package/dist/plugins/idea-garden/index.js +165 -0
- package/dist/plugins/plan-approval/index.js +579 -0
- package/dist/plugins/proactive-watcher/index.js +194 -0
- package/dist/{index-2r4jxwnb.js → query-GJL3CVGN.js} +14 -15
- package/dist/query-MBJSK3EB.js +31 -0
- package/dist/query-TJHEVSKL.js +31 -0
- package/dist/query-WUIKOHPE.js +524 -0
- package/dist/query-XYLTJYSA.js +31 -0
- package/dist/react/index.js +39 -70
- package/dist/react/realtime.js +11 -0
- package/dist/react/schema-hooks.js +87 -0
- package/dist/realtime/broadcast-channel-transport.d.ts +43 -0
- package/dist/realtime/broadcast-channel-transport.d.ts.map +1 -0
- package/dist/realtime/durable-object-relay-transport.d.ts +96 -0
- package/dist/realtime/durable-object-relay-transport.d.ts.map +1 -0
- package/dist/realtime/index.d.ts +44 -0
- package/dist/realtime/index.d.ts.map +1 -0
- package/dist/realtime/index.js +40 -0
- package/dist/realtime/memory-hub.d.ts +32 -0
- package/dist/realtime/memory-hub.d.ts.map +1 -0
- package/dist/realtime/persistent-channel.d.ts +105 -0
- package/dist/realtime/persistent-channel.d.ts.map +1 -0
- package/dist/realtime/presence.d.ts +73 -0
- package/dist/realtime/presence.d.ts.map +1 -0
- package/dist/realtime/relay-persistence.d.ts +37 -0
- package/dist/realtime/relay-persistence.d.ts.map +1 -0
- package/dist/realtime/relay-persistence.js +107 -0
- package/dist/realtime/relay-server.d.ts +103 -0
- package/dist/realtime/relay-server.d.ts.map +1 -0
- package/dist/realtime/room.d.ts +98 -0
- package/dist/realtime/room.d.ts.map +1 -0
- package/dist/realtime/text.d.ts +73 -0
- package/dist/realtime/text.d.ts.map +1 -0
- package/dist/realtime/types.d.ts +89 -0
- package/dist/realtime/types.d.ts.map +1 -0
- package/dist/realtime/websocket-relay-transport.d.ts +28 -0
- package/dist/realtime/websocket-relay-transport.d.ts.map +1 -0
- package/dist/realtime.bundle.js +1100 -0
- package/dist/remote-manager-BLJZ6KF6.js +224 -0
- package/dist/{remote-manager-xvbg4230.js → remote-manager-BPYE46SI.js} +24 -15
- package/dist/remote-manager-FMESEAFA.js +224 -0
- package/dist/remote-manager-K2WZ5RHY.js +223 -0
- package/dist/remote-manager-SG545WNY.js +224 -0
- package/dist/remote-manager-SG5PQKCH.js +224 -0
- package/dist/remote-manager-WGP6MIQZ.js +224 -0
- package/dist/scaffold/write.d.ts.map +1 -1
- package/dist/schema/define.d.ts +137 -0
- package/dist/schema/define.d.ts.map +1 -0
- package/dist/schema/entity-projection.d.ts +34 -0
- package/dist/schema/entity-projection.d.ts.map +1 -0
- package/dist/schema/eql.d.ts +46 -0
- package/dist/schema/eql.d.ts.map +1 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +45 -0
- package/dist/schema/kernel-resolve.d.ts +21 -0
- package/dist/schema/kernel-resolve.d.ts.map +1 -0
- package/dist/schema/mutations.d.ts +20 -0
- package/dist/schema/mutations.d.ts.map +1 -0
- package/dist/schema/resolve.d.ts +21 -0
- package/dist/schema/resolve.d.ts.map +1 -0
- package/dist/sdk-3KBB3E6V.js +16 -0
- package/dist/sdk-4ZQO6UTU.js +16 -0
- package/dist/sdk-6JA6GV3G.js +16 -0
- package/dist/sdk-6VTP5UTZ.js +16 -0
- package/dist/sdk-7VS6TYCD.js +16 -0
- package/dist/sdk-HQ3FTLRT.js +16 -0
- package/dist/sdk-HZ7NU3XE.js +15 -0
- package/dist/sdk-KBQE2OXT.js +16 -0
- package/dist/sdk-LZ7W3EEY.js +9 -0
- package/dist/sdk-MSCDZ7JU.js +15 -0
- package/dist/sdk-WNZOGO3S.js +15 -0
- package/dist/sdk-YLV33ZCW.js +9 -0
- package/dist/sdk-ZSUD2LLJ.js +16 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +69 -61
- package/dist/server/node-adapter.js +5 -104
- package/dist/server/realtime.d.ts +10 -2
- package/dist/server/realtime.d.ts.map +1 -1
- package/dist/server/server.d.ts +7 -16
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/sprites.d.ts.map +1 -1
- package/dist/server/tenancy.d.ts.map +1 -1
- package/dist/server-AFXFFBWA.js +11 -0
- package/dist/server-AGHC4VUL.js +11 -0
- package/dist/server-BOH7M4TT.js +13 -0
- package/dist/server-DBUY2KY5.js +11 -0
- package/dist/server-GWBQJPRG.js +11 -0
- package/dist/server-IGBIIJSF.js +13 -0
- package/dist/server-JZZFULVU.js +11 -0
- package/dist/server-L5XAF4M5.js +11 -0
- package/dist/server-NYFUHANA.js +12 -0
- package/dist/server-OABUB2LO.js +12 -0
- package/dist/server-P2CKZWWV.js +12 -0
- package/dist/{sprites-vc4qbrp1.js → sprites-RU3E4XQN.js} +6 -7
- package/dist/sprites-XVSMQLSI.js +15 -0
- package/dist/sql-wasm-FORCZFHZ.js +2148 -0
- package/dist/sql-wasm-JZH76RLO.js +2148 -0
- package/dist/sqljs-backend-CJQOIQYE.js +266 -0
- package/dist/sqljs-backend-KWXBUDUO.js +266 -0
- package/dist/state-demo.bundle.js +1033 -0
- package/dist/svelte/index.d.ts +17 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +51 -0
- package/dist/svelte/schema-hooks.d.ts +45 -0
- package/dist/svelte/schema-hooks.d.ts.map +1 -0
- package/dist/svelte/schema-hooks.js +71 -0
- package/dist/svelte/stores.d.ts +78 -0
- package/dist/svelte/stores.d.ts.map +1 -0
- package/dist/sync/http-transport.d.ts +3 -3
- package/dist/sync/http-transport.d.ts.map +1 -1
- package/dist/sync/index.d.ts +15 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +617 -0
- package/dist/sync/memory-room.d.ts +37 -0
- package/dist/sync/memory-room.d.ts.map +1 -0
- package/dist/sync/memory-transport.d.ts +3 -3
- package/dist/sync/memory-transport.d.ts.map +1 -1
- package/dist/sync/partykit-room.d.ts +40 -0
- package/dist/sync/partykit-room.d.ts.map +1 -0
- package/dist/sync/partykit-transport.d.ts +84 -0
- package/dist/sync/partykit-transport.d.ts.map +1 -0
- package/dist/sync/room-core.d.ts +53 -0
- package/dist/sync/room-core.d.ts.map +1 -0
- package/dist/sync/sync-engine.d.ts +40 -2
- package/dist/sync/sync-engine.d.ts.map +1 -1
- package/dist/sync/sync-room-server.d.ts +39 -0
- package/dist/sync/sync-room-server.d.ts.map +1 -0
- package/dist/sync/types.d.ts +70 -3
- package/dist/sync/types.d.ts.map +1 -1
- package/dist/sync/vcs-sync-peer.d.ts +63 -0
- package/dist/sync/vcs-sync-peer.d.ts.map +1 -0
- package/dist/sync/ws-transport.d.ts +2 -2
- package/dist/sync/ws-transport.d.ts.map +1 -1
- package/dist/tenancy-CBWYEVUB.js +11 -0
- package/dist/tenancy-FO6WVYFN.js +13 -0
- package/dist/tenancy-FWDBESMX.js +14 -0
- package/dist/tenancy-HGPIS5QA.js +13 -0
- package/dist/tenancy-HXFALA37.js +14 -0
- package/dist/tenancy-OP34NFFS.js +14 -0
- package/dist/tenancy-S676GLID.js +14 -0
- package/dist/tenancy-V7ARWNNV.js +14 -0
- package/dist/tenancy-ZDN4GXK5.js +13 -0
- package/dist/tenancy-ZT5VMY7B.js +14 -0
- package/dist/ui/client.html +355 -67
- package/dist/ui/launch-explorer.d.ts +22 -0
- package/dist/ui/launch-explorer.d.ts.map +1 -0
- package/dist/ui/server.d.ts +1 -1
- package/dist/ui/server.d.ts.map +1 -1
- package/dist/vcs/blob-store.d.ts.map +1 -1
- package/dist/vcs/idb-op-log.d.ts +67 -0
- package/dist/vcs/idb-op-log.d.ts.map +1 -0
- package/dist/vcs/index.d.ts +1 -0
- package/dist/vcs/index.d.ts.map +1 -1
- package/dist/vcs/index.js +81 -72
- package/dist/vcs/issue.d.ts +22 -5
- package/dist/vcs/issue.d.ts.map +1 -1
- package/dist/vcs/lane-materialize.d.ts +5 -0
- package/dist/vcs/lane-materialize.d.ts.map +1 -1
- package/dist/vcs/op-log.d.ts +28 -2
- package/dist/vcs/op-log.d.ts.map +1 -1
- package/dist/vcs/ops.d.ts +10 -0
- package/dist/vcs/ops.d.ts.map +1 -1
- package/dist/{vm-config-6xhsj6b3.js → vm-config-JI4OXKDQ.js} +9 -10
- package/dist/vm-config-YZRJ3KUB.js +21 -0
- package/dist/vue/hooks.d.ts +64 -0
- package/dist/vue/hooks.d.ts.map +1 -0
- package/dist/vue/index.d.ts +19 -0
- package/dist/vue/index.d.ts.map +1 -0
- package/dist/vue/index.js +59 -0
- package/dist/vue/schema-hooks.d.ts +41 -0
- package/dist/vue/schema-hooks.d.ts.map +1 -0
- package/dist/vue/schema-hooks.js +64 -0
- package/package.json +118 -16
- package/dist/deploy-999q207z.js +0 -10
- package/dist/engine-y0724kjq.js +0 -8
- package/dist/import-s2b8e0ft.js +0 -11
- package/dist/index-a76rekgs.js +0 -67
- package/dist/index-c9h37r6h.js +0 -1
- package/dist/index-hr9qvv77.js +0 -860
- package/dist/index-k5b0xskw.js +0 -1
- package/dist/index-y6a4kj0p.js +0 -43
- package/dist/sdk-bepky0xs.js +0 -16
- package/dist/server-szdjx0nt.js +0 -13
- package/dist/sqlite-backend-0vsmc6qj.js +0 -8
- package/dist/tenancy-pjm32b4v.js +0 -14
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @bun
|
|
2
1
|
import {
|
|
3
2
|
createVcsOp,
|
|
4
3
|
criterionEntityId,
|
|
@@ -9,25 +8,23 @@ import {
|
|
|
9
8
|
init_types,
|
|
10
9
|
issueEntityId,
|
|
11
10
|
laneEntityId
|
|
12
|
-
} from "./
|
|
11
|
+
} from "./chunk-V3G7Q3QQ.js";
|
|
13
12
|
import {
|
|
14
13
|
__esm,
|
|
15
14
|
__require
|
|
16
|
-
} from "./
|
|
15
|
+
} from "./chunk-2ESYSVXG.js";
|
|
17
16
|
|
|
18
17
|
// src/vcs/decompose.ts
|
|
19
18
|
import { dirname } from "path";
|
|
20
19
|
function pickFacts(input) {
|
|
21
|
-
if (!Array.isArray(input))
|
|
22
|
-
return [];
|
|
20
|
+
if (!Array.isArray(input)) return [];
|
|
23
21
|
return input.filter((item) => {
|
|
24
22
|
const fact = item;
|
|
25
23
|
return typeof fact.e === "string" && typeof fact.a === "string" && (typeof fact.v === "string" || typeof fact.v === "number" || typeof fact.v === "boolean");
|
|
26
24
|
});
|
|
27
25
|
}
|
|
28
26
|
function pickLinks(input) {
|
|
29
|
-
if (!Array.isArray(input))
|
|
30
|
-
return [];
|
|
27
|
+
if (!Array.isArray(input)) return [];
|
|
31
28
|
return input.filter((item) => {
|
|
32
29
|
const link = item;
|
|
33
30
|
return typeof link.e1 === "string" && typeof link.a === "string" && typeof link.e2 === "string";
|
|
@@ -41,8 +38,7 @@ function decompose(op) {
|
|
|
41
38
|
deleteLinks: []
|
|
42
39
|
};
|
|
43
40
|
const vcs = op.vcs;
|
|
44
|
-
if (!vcs)
|
|
45
|
-
return result;
|
|
41
|
+
if (!vcs) return result;
|
|
46
42
|
if (vcs.issueId && vcs.oldIssueStatus) {
|
|
47
43
|
result.deleteFacts.push({
|
|
48
44
|
e: issueEntityId(vcs.issueId),
|
|
@@ -52,29 +48,33 @@ function decompose(op) {
|
|
|
52
48
|
}
|
|
53
49
|
switch (op.kind) {
|
|
54
50
|
case "vcs:fileAdd": {
|
|
55
|
-
if (!vcs.filePath)
|
|
56
|
-
break;
|
|
51
|
+
if (!vcs.filePath) break;
|
|
57
52
|
const eid = fileEntityId(vcs.filePath);
|
|
58
53
|
const dir = dirname(vcs.filePath);
|
|
59
54
|
const did = dirEntityId(dir === "." ? "" : dir);
|
|
60
|
-
result.addFacts.push(
|
|
55
|
+
result.addFacts.push(
|
|
56
|
+
{ e: eid, a: "type", v: "FileNode" },
|
|
57
|
+
{ e: eid, a: "path", v: vcs.filePath }
|
|
58
|
+
);
|
|
61
59
|
if (vcs.contentHash) {
|
|
62
60
|
result.addFacts.push({ e: eid, a: "contentHash", v: vcs.contentHash });
|
|
63
61
|
}
|
|
64
|
-
if (vcs.size !==
|
|
62
|
+
if (vcs.size !== void 0) {
|
|
65
63
|
result.addFacts.push({ e: eid, a: "size", v: vcs.size });
|
|
66
64
|
}
|
|
67
65
|
if (vcs.language) {
|
|
68
66
|
result.addFacts.push({ e: eid, a: "language", v: vcs.language });
|
|
69
67
|
}
|
|
70
68
|
result.addFacts.push({ e: eid, a: "lastModified", v: op.timestamp });
|
|
71
|
-
result.addFacts.push(
|
|
69
|
+
result.addFacts.push(
|
|
70
|
+
{ e: did, a: "type", v: "DirectoryNode" },
|
|
71
|
+
{ e: did, a: "path", v: dir === "." ? "" : dir }
|
|
72
|
+
);
|
|
72
73
|
result.addLinks.push({ e1: did, a: "contains", e2: eid });
|
|
73
74
|
break;
|
|
74
75
|
}
|
|
75
76
|
case "vcs:fileModify": {
|
|
76
|
-
if (!vcs.filePath)
|
|
77
|
-
break;
|
|
77
|
+
if (!vcs.filePath) break;
|
|
78
78
|
const eid = fileEntityId(vcs.filePath);
|
|
79
79
|
if (vcs.oldContentHash) {
|
|
80
80
|
result.deleteFacts.push({
|
|
@@ -86,19 +86,21 @@ function decompose(op) {
|
|
|
86
86
|
if (vcs.contentHash) {
|
|
87
87
|
result.addFacts.push({ e: eid, a: "contentHash", v: vcs.contentHash });
|
|
88
88
|
}
|
|
89
|
-
if (vcs.size !==
|
|
89
|
+
if (vcs.size !== void 0) {
|
|
90
90
|
result.addFacts.push({ e: eid, a: "size", v: vcs.size });
|
|
91
91
|
}
|
|
92
92
|
result.addFacts.push({ e: eid, a: "lastModified", v: op.timestamp });
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
case "vcs:fileDelete": {
|
|
96
|
-
if (!vcs.filePath)
|
|
97
|
-
break;
|
|
96
|
+
if (!vcs.filePath) break;
|
|
98
97
|
const eid = fileEntityId(vcs.filePath);
|
|
99
98
|
const dir = dirname(vcs.filePath);
|
|
100
99
|
const did = dirEntityId(dir === "." ? "" : dir);
|
|
101
|
-
result.deleteFacts.push(
|
|
100
|
+
result.deleteFacts.push(
|
|
101
|
+
{ e: eid, a: "type", v: "FileNode" },
|
|
102
|
+
{ e: eid, a: "path", v: vcs.filePath }
|
|
103
|
+
);
|
|
102
104
|
if (vcs.contentHash) {
|
|
103
105
|
result.deleteFacts.push({
|
|
104
106
|
e: eid,
|
|
@@ -110,8 +112,7 @@ function decompose(op) {
|
|
|
110
112
|
break;
|
|
111
113
|
}
|
|
112
114
|
case "vcs:fileRename": {
|
|
113
|
-
if (!vcs.filePath || !vcs.oldFilePath)
|
|
114
|
-
break;
|
|
115
|
+
if (!vcs.filePath || !vcs.oldFilePath) break;
|
|
115
116
|
const eid = fileEntityId(vcs.oldFilePath);
|
|
116
117
|
const oldDir = dirname(vcs.oldFilePath);
|
|
117
118
|
const newDir = dirname(vcs.filePath);
|
|
@@ -121,15 +122,22 @@ function decompose(op) {
|
|
|
121
122
|
result.addFacts.push({ e: eid, a: "path", v: vcs.filePath });
|
|
122
123
|
result.addFacts.push({ e: eid, a: "lastModified", v: op.timestamp });
|
|
123
124
|
result.deleteLinks.push({ e1: oldDid, a: "contains", e2: eid });
|
|
124
|
-
result.addFacts.push(
|
|
125
|
+
result.addFacts.push(
|
|
126
|
+
{ e: newDid, a: "type", v: "DirectoryNode" },
|
|
127
|
+
{ e: newDid, a: "path", v: newDir === "." ? "" : newDir }
|
|
128
|
+
);
|
|
125
129
|
result.addLinks.push({ e1: newDid, a: "contains", e2: eid });
|
|
126
130
|
break;
|
|
127
131
|
}
|
|
128
132
|
case "vcs:branchCreate": {
|
|
129
|
-
if (!vcs.branchName)
|
|
130
|
-
break;
|
|
133
|
+
if (!vcs.branchName) break;
|
|
131
134
|
const bid = `branch:${vcs.branchName}`;
|
|
132
|
-
result.addFacts.push(
|
|
135
|
+
result.addFacts.push(
|
|
136
|
+
{ e: bid, a: "type", v: "Branch" },
|
|
137
|
+
{ e: bid, a: "name", v: vcs.branchName },
|
|
138
|
+
{ e: bid, a: "createdAt", v: op.timestamp },
|
|
139
|
+
{ e: bid, a: "createdBy", v: op.agentId }
|
|
140
|
+
);
|
|
133
141
|
if (vcs.targetOpHash) {
|
|
134
142
|
result.addFacts.push({ e: bid, a: "headOpHash", v: vcs.targetOpHash });
|
|
135
143
|
}
|
|
@@ -143,24 +151,28 @@ function decompose(op) {
|
|
|
143
151
|
break;
|
|
144
152
|
}
|
|
145
153
|
case "vcs:branchDelete": {
|
|
146
|
-
if (!vcs.branchName)
|
|
147
|
-
break;
|
|
154
|
+
if (!vcs.branchName) break;
|
|
148
155
|
const bid = `branch:${vcs.branchName}`;
|
|
149
|
-
result.deleteFacts.push(
|
|
156
|
+
result.deleteFacts.push(
|
|
157
|
+
{ e: bid, a: "type", v: "Branch" },
|
|
158
|
+
{ e: bid, a: "name", v: vcs.branchName }
|
|
159
|
+
);
|
|
150
160
|
break;
|
|
151
161
|
}
|
|
152
162
|
case "vcs:branchAdvance": {
|
|
153
|
-
if (!vcs.branchName || !vcs.targetOpHash)
|
|
154
|
-
break;
|
|
163
|
+
if (!vcs.branchName || !vcs.targetOpHash) break;
|
|
155
164
|
const bid = `branch:${vcs.branchName}`;
|
|
156
165
|
result.addFacts.push({ e: bid, a: "headOpHash", v: vcs.targetOpHash });
|
|
157
166
|
break;
|
|
158
167
|
}
|
|
159
168
|
case "vcs:milestoneCreate": {
|
|
160
|
-
if (!vcs.milestoneId)
|
|
161
|
-
break;
|
|
169
|
+
if (!vcs.milestoneId) break;
|
|
162
170
|
const mid = vcs.milestoneId;
|
|
163
|
-
result.addFacts.push(
|
|
171
|
+
result.addFacts.push(
|
|
172
|
+
{ e: mid, a: "type", v: "Milestone" },
|
|
173
|
+
{ e: mid, a: "createdAt", v: op.timestamp },
|
|
174
|
+
{ e: mid, a: "createdBy", v: op.agentId }
|
|
175
|
+
);
|
|
164
176
|
if (vcs.message) {
|
|
165
177
|
result.addFacts.push({ e: mid, a: "message", v: vcs.message });
|
|
166
178
|
}
|
|
@@ -174,17 +186,26 @@ function decompose(op) {
|
|
|
174
186
|
}
|
|
175
187
|
case "vcs:checkpointCreate": {
|
|
176
188
|
const cid = `checkpoint:${op.hash}`;
|
|
177
|
-
result.addFacts.push(
|
|
189
|
+
result.addFacts.push(
|
|
190
|
+
{ e: cid, a: "type", v: "Checkpoint" },
|
|
191
|
+
{ e: cid, a: "createdAt", v: op.timestamp },
|
|
192
|
+
{ e: cid, a: "atOpHash", v: op.hash }
|
|
193
|
+
);
|
|
178
194
|
if (vcs.trigger) {
|
|
179
195
|
result.addFacts.push({ e: cid, a: "trigger", v: vcs.trigger });
|
|
180
196
|
}
|
|
181
197
|
break;
|
|
182
198
|
}
|
|
199
|
+
// ----- Issue tracking -----
|
|
183
200
|
case "vcs:issueCreate": {
|
|
184
|
-
if (!vcs.issueId)
|
|
185
|
-
break;
|
|
201
|
+
if (!vcs.issueId) break;
|
|
186
202
|
const eid = issueEntityId(vcs.issueId);
|
|
187
|
-
result.addFacts.push(
|
|
203
|
+
result.addFacts.push(
|
|
204
|
+
{ e: eid, a: "type", v: "Issue" },
|
|
205
|
+
{ e: eid, a: "status", v: vcs.issueStatus ?? "backlog" },
|
|
206
|
+
{ e: eid, a: "createdAt", v: op.timestamp },
|
|
207
|
+
{ e: eid, a: "createdBy", v: op.agentId }
|
|
208
|
+
);
|
|
188
209
|
if (vcs.issueTitle) {
|
|
189
210
|
result.addFacts.push({ e: eid, a: "title", v: vcs.issueTitle });
|
|
190
211
|
}
|
|
@@ -218,8 +239,7 @@ function decompose(op) {
|
|
|
218
239
|
break;
|
|
219
240
|
}
|
|
220
241
|
case "vcs:issueUpdate": {
|
|
221
|
-
if (!vcs.issueId)
|
|
222
|
-
break;
|
|
242
|
+
if (!vcs.issueId) break;
|
|
223
243
|
const eid = issueEntityId(vcs.issueId);
|
|
224
244
|
if (vcs.issueStatus) {
|
|
225
245
|
result.addFacts.push({ e: eid, a: "status", v: vcs.issueStatus });
|
|
@@ -240,7 +260,7 @@ function decompose(op) {
|
|
|
240
260
|
if (vcs.issueAssignee) {
|
|
241
261
|
result.addFacts.push({ e: eid, a: "assignee", v: vcs.issueAssignee });
|
|
242
262
|
}
|
|
243
|
-
if (vcs.issueDescription !==
|
|
263
|
+
if (vcs.issueDescription !== void 0) {
|
|
244
264
|
result.addFacts.push({
|
|
245
265
|
e: eid,
|
|
246
266
|
a: "description",
|
|
@@ -264,10 +284,12 @@ function decompose(op) {
|
|
|
264
284
|
break;
|
|
265
285
|
}
|
|
266
286
|
case "vcs:issueStart": {
|
|
267
|
-
if (!vcs.issueId)
|
|
268
|
-
break;
|
|
287
|
+
if (!vcs.issueId) break;
|
|
269
288
|
const eid = issueEntityId(vcs.issueId);
|
|
270
|
-
result.addFacts.push(
|
|
289
|
+
result.addFacts.push(
|
|
290
|
+
{ e: eid, a: "status", v: "in_progress" },
|
|
291
|
+
{ e: eid, a: "startedAt", v: op.timestamp }
|
|
292
|
+
);
|
|
271
293
|
if (vcs.issueAssignee) {
|
|
272
294
|
result.addFacts.push({ e: eid, a: "assignee", v: vcs.issueAssignee });
|
|
273
295
|
}
|
|
@@ -281,41 +303,50 @@ function decompose(op) {
|
|
|
281
303
|
break;
|
|
282
304
|
}
|
|
283
305
|
case "vcs:issuePause": {
|
|
284
|
-
if (!vcs.issueId)
|
|
285
|
-
break;
|
|
306
|
+
if (!vcs.issueId) break;
|
|
286
307
|
const eid = issueEntityId(vcs.issueId);
|
|
287
|
-
result.addFacts.push(
|
|
308
|
+
result.addFacts.push(
|
|
309
|
+
{ e: eid, a: "status", v: "paused" },
|
|
310
|
+
{ e: eid, a: "pausedAt", v: op.timestamp }
|
|
311
|
+
);
|
|
288
312
|
if (vcs.pauseNote) {
|
|
289
313
|
result.addFacts.push({ e: eid, a: "pauseNote", v: vcs.pauseNote });
|
|
290
314
|
}
|
|
291
315
|
break;
|
|
292
316
|
}
|
|
293
317
|
case "vcs:issueResume": {
|
|
294
|
-
if (!vcs.issueId)
|
|
295
|
-
break;
|
|
318
|
+
if (!vcs.issueId) break;
|
|
296
319
|
const eid = issueEntityId(vcs.issueId);
|
|
297
|
-
result.addFacts.push(
|
|
320
|
+
result.addFacts.push(
|
|
321
|
+
{ e: eid, a: "status", v: "in_progress" },
|
|
322
|
+
{ e: eid, a: "resumedAt", v: op.timestamp },
|
|
323
|
+
{ e: eid, a: "pauseNote", v: "" }
|
|
324
|
+
);
|
|
298
325
|
break;
|
|
299
326
|
}
|
|
300
327
|
case "vcs:issueClose": {
|
|
301
|
-
if (!vcs.issueId)
|
|
302
|
-
break;
|
|
328
|
+
if (!vcs.issueId) break;
|
|
303
329
|
const eid = issueEntityId(vcs.issueId);
|
|
304
|
-
result.addFacts.push(
|
|
330
|
+
result.addFacts.push(
|
|
331
|
+
{ e: eid, a: "status", v: "closed" },
|
|
332
|
+
{ e: eid, a: "closedAt", v: op.timestamp }
|
|
333
|
+
);
|
|
305
334
|
break;
|
|
306
335
|
}
|
|
307
336
|
case "vcs:issueReopen": {
|
|
308
|
-
if (!vcs.issueId)
|
|
309
|
-
break;
|
|
337
|
+
if (!vcs.issueId) break;
|
|
310
338
|
const eid = issueEntityId(vcs.issueId);
|
|
311
339
|
result.addFacts.push({ e: eid, a: "status", v: "queue" });
|
|
312
340
|
break;
|
|
313
341
|
}
|
|
314
342
|
case "vcs:criterionAdd": {
|
|
315
|
-
if (!vcs.criterionId || !vcs.issueId)
|
|
316
|
-
break;
|
|
343
|
+
if (!vcs.criterionId || !vcs.issueId) break;
|
|
317
344
|
const ceid = vcs.criterionId;
|
|
318
|
-
result.addFacts.push(
|
|
345
|
+
result.addFacts.push(
|
|
346
|
+
{ e: ceid, a: "type", v: "Criterion" },
|
|
347
|
+
{ e: ceid, a: "status", v: "pending" },
|
|
348
|
+
{ e: ceid, a: "createdAt", v: op.timestamp }
|
|
349
|
+
);
|
|
319
350
|
if (vcs.criterionDescription) {
|
|
320
351
|
result.addFacts.push({
|
|
321
352
|
e: ceid,
|
|
@@ -338,8 +369,7 @@ function decompose(op) {
|
|
|
338
369
|
break;
|
|
339
370
|
}
|
|
340
371
|
case "vcs:criterionUpdate": {
|
|
341
|
-
if (!vcs.criterionId)
|
|
342
|
-
break;
|
|
372
|
+
if (!vcs.criterionId) break;
|
|
343
373
|
const ceid = vcs.criterionId;
|
|
344
374
|
if (vcs.criterionStatus) {
|
|
345
375
|
result.addFacts.push({ e: ceid, a: "status", v: vcs.criterionStatus });
|
|
@@ -354,27 +384,30 @@ function decompose(op) {
|
|
|
354
384
|
result.addFacts.push({ e: ceid, a: "lastRunAt", v: op.timestamp });
|
|
355
385
|
break;
|
|
356
386
|
}
|
|
387
|
+
// ----- Issue blocking -----
|
|
357
388
|
case "vcs:issueBlock": {
|
|
358
|
-
if (!vcs.issueId || !vcs.blockedByIssueId)
|
|
359
|
-
break;
|
|
389
|
+
if (!vcs.issueId || !vcs.blockedByIssueId) break;
|
|
360
390
|
const eid = issueEntityId(vcs.issueId);
|
|
361
391
|
const blockerEid = issueEntityId(vcs.blockedByIssueId);
|
|
362
392
|
result.addLinks.push({ e1: eid, a: "blockedBy", e2: blockerEid });
|
|
363
393
|
break;
|
|
364
394
|
}
|
|
365
395
|
case "vcs:issueUnblock": {
|
|
366
|
-
if (!vcs.issueId || !vcs.blockedByIssueId)
|
|
367
|
-
break;
|
|
396
|
+
if (!vcs.issueId || !vcs.blockedByIssueId) break;
|
|
368
397
|
const eid = issueEntityId(vcs.issueId);
|
|
369
398
|
const blockerEid = issueEntityId(vcs.blockedByIssueId);
|
|
370
399
|
result.deleteLinks.push({ e1: eid, a: "blockedBy", e2: blockerEid });
|
|
371
400
|
break;
|
|
372
401
|
}
|
|
402
|
+
// ----- Decision traces -----
|
|
373
403
|
case "vcs:decisionRecord": {
|
|
374
|
-
if (!vcs.decisionId)
|
|
375
|
-
break;
|
|
404
|
+
if (!vcs.decisionId) break;
|
|
376
405
|
const did = decisionEntityId(vcs.decisionId);
|
|
377
|
-
result.addFacts.push(
|
|
406
|
+
result.addFacts.push(
|
|
407
|
+
{ e: did, a: "type", v: "Decision" },
|
|
408
|
+
{ e: did, a: "createdAt", v: op.timestamp },
|
|
409
|
+
{ e: did, a: "createdBy", v: op.agentId }
|
|
410
|
+
);
|
|
378
411
|
if (vcs.decisionToolName) {
|
|
379
412
|
result.addFacts.push({
|
|
380
413
|
e: did,
|
|
@@ -416,10 +449,14 @@ function decompose(op) {
|
|
|
416
449
|
break;
|
|
417
450
|
}
|
|
418
451
|
case "vcs:laneCreate": {
|
|
419
|
-
if (!vcs.laneId)
|
|
420
|
-
break;
|
|
452
|
+
if (!vcs.laneId) break;
|
|
421
453
|
const lid = laneEntityId(vcs.laneId);
|
|
422
|
-
result.addFacts.push(
|
|
454
|
+
result.addFacts.push(
|
|
455
|
+
{ e: lid, a: "type", v: "AgentLane" },
|
|
456
|
+
{ e: lid, a: "status", v: "active" },
|
|
457
|
+
{ e: lid, a: "createdAt", v: op.timestamp },
|
|
458
|
+
{ e: lid, a: "createdBy", v: op.agentId }
|
|
459
|
+
);
|
|
423
460
|
if (vcs.baseBranch) {
|
|
424
461
|
result.addFacts.push({ e: lid, a: "baseBranch", v: vcs.baseBranch });
|
|
425
462
|
}
|
|
@@ -459,8 +496,7 @@ function decompose(op) {
|
|
|
459
496
|
break;
|
|
460
497
|
}
|
|
461
498
|
case "vcs:laneDrop": {
|
|
462
|
-
if (!vcs.laneId)
|
|
463
|
-
break;
|
|
499
|
+
if (!vcs.laneId) break;
|
|
464
500
|
const lid = laneEntityId(vcs.laneId);
|
|
465
501
|
if (vcs.laneStatus) {
|
|
466
502
|
result.deleteFacts.push({ e: lid, a: "status", v: "active" });
|
|
@@ -469,16 +505,14 @@ function decompose(op) {
|
|
|
469
505
|
break;
|
|
470
506
|
}
|
|
471
507
|
case "vcs:lanePromoteStart": {
|
|
472
|
-
if (!vcs.laneId)
|
|
473
|
-
break;
|
|
508
|
+
if (!vcs.laneId) break;
|
|
474
509
|
const lid = laneEntityId(vcs.laneId);
|
|
475
510
|
result.deleteFacts.push({ e: lid, a: "status", v: "active" });
|
|
476
511
|
result.addFacts.push({ e: lid, a: "status", v: "promoting" });
|
|
477
512
|
break;
|
|
478
513
|
}
|
|
479
514
|
case "vcs:lanePromoteComplete": {
|
|
480
|
-
if (!vcs.laneId)
|
|
481
|
-
break;
|
|
515
|
+
if (!vcs.laneId) break;
|
|
482
516
|
const lid = laneEntityId(vcs.laneId);
|
|
483
517
|
result.deleteFacts.push({ e: lid, a: "status", v: "promoting" });
|
|
484
518
|
result.addFacts.push({ e: lid, a: "status", v: "promoted" });
|
|
@@ -488,13 +522,13 @@ function decompose(op) {
|
|
|
488
522
|
break;
|
|
489
523
|
}
|
|
490
524
|
case "vcs:lanePromoteAbort": {
|
|
491
|
-
if (!vcs.laneId)
|
|
492
|
-
break;
|
|
525
|
+
if (!vcs.laneId) break;
|
|
493
526
|
const lid = laneEntityId(vcs.laneId);
|
|
494
527
|
result.deleteFacts.push({ e: lid, a: "status", v: "promoting" });
|
|
495
528
|
result.addFacts.push({ e: lid, a: "status", v: "active" });
|
|
496
529
|
break;
|
|
497
530
|
}
|
|
531
|
+
// ----- EAV store (CMS / knowledge graph) -----
|
|
498
532
|
case "vcs:storeAssert": {
|
|
499
533
|
result.addFacts.push(...pickFacts(vcs.facts));
|
|
500
534
|
break;
|
|
@@ -514,89 +548,120 @@ function decompose(op) {
|
|
|
514
548
|
}
|
|
515
549
|
return result;
|
|
516
550
|
}
|
|
517
|
-
var init_decompose = __esm(
|
|
518
|
-
|
|
551
|
+
var init_decompose = __esm({
|
|
552
|
+
"src/vcs/decompose.ts"() {
|
|
553
|
+
"use strict";
|
|
554
|
+
init_types();
|
|
555
|
+
}
|
|
519
556
|
});
|
|
520
557
|
|
|
521
558
|
// src/vcs/blob-store.ts
|
|
522
559
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
523
560
|
import { join } from "path";
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
561
|
+
var BlobStore;
|
|
562
|
+
var init_blob_store = __esm({
|
|
563
|
+
"src/vcs/blob-store.ts"() {
|
|
564
|
+
"use strict";
|
|
565
|
+
BlobStore = class {
|
|
566
|
+
blobDir;
|
|
567
|
+
constructor(trellisDir) {
|
|
568
|
+
this.blobDir = join(trellisDir, "blobs");
|
|
569
|
+
if (!existsSync(this.blobDir)) {
|
|
570
|
+
mkdirSync(this.blobDir, { recursive: true });
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Store content and return its SHA-256 hash.
|
|
575
|
+
* Idempotent — storing the same content twice is a no-op.
|
|
576
|
+
*/
|
|
577
|
+
async put(content) {
|
|
578
|
+
const hash = await this.hash(content);
|
|
579
|
+
const blobPath = join(this.blobDir, hash);
|
|
580
|
+
if (!existsSync(blobPath)) {
|
|
581
|
+
writeFileSync(blobPath, content);
|
|
582
|
+
}
|
|
583
|
+
return hash;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* Synchronous put — uses Bun's sync crypto if available.
|
|
587
|
+
*/
|
|
588
|
+
putSync(content) {
|
|
589
|
+
const hash = this.hashSync(content);
|
|
590
|
+
const blobPath = join(this.blobDir, hash);
|
|
591
|
+
if (!existsSync(blobPath)) {
|
|
592
|
+
writeFileSync(blobPath, content);
|
|
593
|
+
}
|
|
594
|
+
return hash;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Retrieve content by hash. Returns null if not found.
|
|
598
|
+
*/
|
|
599
|
+
get(hash) {
|
|
600
|
+
const blobPath = join(this.blobDir, hash);
|
|
601
|
+
if (!existsSync(blobPath)) {
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
return readFileSync(blobPath);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Check if a blob exists.
|
|
608
|
+
*/
|
|
609
|
+
has(hash) {
|
|
610
|
+
return existsSync(join(this.blobDir, hash));
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Compute SHA-256 hash of content (async).
|
|
614
|
+
*/
|
|
615
|
+
async hash(content) {
|
|
616
|
+
const hashBuffer = await crypto.subtle.digest(
|
|
617
|
+
"SHA-256",
|
|
618
|
+
content
|
|
619
|
+
);
|
|
620
|
+
return this.hexFromBuffer(hashBuffer);
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Compute SHA-256 hash of content (sync).
|
|
624
|
+
* Uses Bun.CryptoHasher when running under Bun, else node:crypto.
|
|
625
|
+
*/
|
|
626
|
+
hashSync(content) {
|
|
627
|
+
const { createHash } = __require("crypto");
|
|
628
|
+
return createHash("sha256").update(content).digest("hex");
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Returns the number of blobs stored.
|
|
632
|
+
*/
|
|
633
|
+
count() {
|
|
585
634
|
try {
|
|
586
|
-
|
|
635
|
+
const { readdirSync: readdirSync2 } = __require("fs");
|
|
636
|
+
return readdirSync2(this.blobDir).length;
|
|
587
637
|
} catch {
|
|
588
|
-
return
|
|
638
|
+
return 0;
|
|
589
639
|
}
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Returns the total size of all blobs in bytes.
|
|
643
|
+
*/
|
|
644
|
+
totalSize() {
|
|
645
|
+
try {
|
|
646
|
+
const { readdirSync: readdirSync2, statSync } = __require("fs");
|
|
647
|
+
const files = readdirSync2(this.blobDir);
|
|
648
|
+
return files.reduce((sum, f) => {
|
|
649
|
+
try {
|
|
650
|
+
return sum + statSync(join(this.blobDir, f)).size;
|
|
651
|
+
} catch {
|
|
652
|
+
return sum;
|
|
653
|
+
}
|
|
654
|
+
}, 0);
|
|
655
|
+
} catch {
|
|
656
|
+
return 0;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
hexFromBuffer(buffer) {
|
|
660
|
+
return Array.from(new Uint8Array(buffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
661
|
+
}
|
|
662
|
+
};
|
|
597
663
|
}
|
|
598
|
-
}
|
|
599
|
-
var init_blob_store = () => {};
|
|
664
|
+
});
|
|
600
665
|
|
|
601
666
|
// src/vcs/branch.ts
|
|
602
667
|
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
@@ -676,19 +741,23 @@ function loadBranchState(rootPath) {
|
|
|
676
741
|
activeLaneId: state.activeLaneId
|
|
677
742
|
};
|
|
678
743
|
}
|
|
679
|
-
} catch {
|
|
744
|
+
} catch {
|
|
745
|
+
}
|
|
680
746
|
}
|
|
681
747
|
return { currentBranch: "main" };
|
|
682
748
|
}
|
|
683
749
|
var BRANCH_ADVANCE_SKIP_KINDS;
|
|
684
|
-
var init_branch = __esm(
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
750
|
+
var init_branch = __esm({
|
|
751
|
+
"src/vcs/branch.ts"() {
|
|
752
|
+
"use strict";
|
|
753
|
+
init_ops();
|
|
754
|
+
BRANCH_ADVANCE_SKIP_KINDS = /* @__PURE__ */ new Set([
|
|
755
|
+
"vcs:branchAdvance",
|
|
756
|
+
"vcs:branchCreate",
|
|
757
|
+
"vcs:branchDelete",
|
|
758
|
+
"vcs:checkpointCreate"
|
|
759
|
+
]);
|
|
760
|
+
}
|
|
692
761
|
});
|
|
693
762
|
|
|
694
763
|
// src/vcs/milestone.ts
|
|
@@ -715,7 +784,9 @@ async function createMilestone(ctx, message, opts) {
|
|
|
715
784
|
const toIdx = ops.findIndex((o) => o.hash === toOpHash);
|
|
716
785
|
const rangeOps = fromIdx >= 0 && toIdx >= 0 ? ops.slice(fromIdx, toIdx + 1) : ops;
|
|
717
786
|
const affectedFiles = [
|
|
718
|
-
...new Set(
|
|
787
|
+
...new Set(
|
|
788
|
+
rangeOps.filter((o) => o.vcs?.filePath).map((o) => o.vcs.filePath)
|
|
789
|
+
)
|
|
719
790
|
];
|
|
720
791
|
const op = await createVcsOp("vcs:milestoneCreate", {
|
|
721
792
|
agentId: ctx.agentId,
|
|
@@ -750,8 +821,11 @@ function listMilestones(ctx) {
|
|
|
750
821
|
};
|
|
751
822
|
});
|
|
752
823
|
}
|
|
753
|
-
var init_milestone = __esm(
|
|
754
|
-
|
|
824
|
+
var init_milestone = __esm({
|
|
825
|
+
"src/vcs/milestone.ts"() {
|
|
826
|
+
"use strict";
|
|
827
|
+
init_ops();
|
|
828
|
+
}
|
|
755
829
|
});
|
|
756
830
|
|
|
757
831
|
// src/vcs/checkpoint.ts
|
|
@@ -777,16 +851,18 @@ function listCheckpoints(ctx) {
|
|
|
777
851
|
};
|
|
778
852
|
});
|
|
779
853
|
}
|
|
780
|
-
var init_checkpoint = __esm(
|
|
781
|
-
|
|
854
|
+
var init_checkpoint = __esm({
|
|
855
|
+
"src/vcs/checkpoint.ts"() {
|
|
856
|
+
"use strict";
|
|
857
|
+
init_ops();
|
|
858
|
+
}
|
|
782
859
|
});
|
|
783
860
|
|
|
784
861
|
// src/vcs/diff.ts
|
|
785
862
|
function diffFileStates(stateA, stateB, blobStore) {
|
|
786
863
|
const diffs = [];
|
|
787
864
|
for (const [path, bState] of stateB) {
|
|
788
|
-
if (bState.deleted)
|
|
789
|
-
continue;
|
|
865
|
+
if (bState.deleted) continue;
|
|
790
866
|
const aState = stateA.get(path);
|
|
791
867
|
if (!aState || aState.deleted) {
|
|
792
868
|
diffs.push({
|
|
@@ -805,15 +881,18 @@ function diffFileStates(stateA, stateB, blobStore) {
|
|
|
805
881
|
const oldContent = blobStore.get(aState.contentHash);
|
|
806
882
|
const newContent = blobStore.get(bState.contentHash);
|
|
807
883
|
if (oldContent && newContent) {
|
|
808
|
-
diff.unifiedDiff = generateUnifiedDiff(
|
|
884
|
+
diff.unifiedDiff = generateUnifiedDiff(
|
|
885
|
+
path,
|
|
886
|
+
oldContent.toString("utf-8"),
|
|
887
|
+
newContent.toString("utf-8")
|
|
888
|
+
);
|
|
809
889
|
}
|
|
810
890
|
}
|
|
811
891
|
diffs.push(diff);
|
|
812
892
|
}
|
|
813
893
|
}
|
|
814
894
|
for (const [path, aState] of stateA) {
|
|
815
|
-
if (aState.deleted)
|
|
816
|
-
continue;
|
|
895
|
+
if (aState.deleted) continue;
|
|
817
896
|
const bState = stateB.get(path);
|
|
818
897
|
if (!bState || bState.deleted) {
|
|
819
898
|
diffs.push({
|
|
@@ -836,7 +915,7 @@ function diffFileStates(stateA, stateB, blobStore) {
|
|
|
836
915
|
};
|
|
837
916
|
}
|
|
838
917
|
function buildFileStateAtOp(ops, atOpHash) {
|
|
839
|
-
const state = new Map;
|
|
918
|
+
const state = /* @__PURE__ */ new Map();
|
|
840
919
|
for (const op of ops) {
|
|
841
920
|
if (op.vcs?.filePath) {
|
|
842
921
|
switch (op.kind) {
|
|
@@ -855,8 +934,7 @@ function buildFileStateAtOp(ops, atOpHash) {
|
|
|
855
934
|
break;
|
|
856
935
|
}
|
|
857
936
|
}
|
|
858
|
-
if (atOpHash && op.hash === atOpHash)
|
|
859
|
-
break;
|
|
937
|
+
if (atOpHash && op.hash === atOpHash) break;
|
|
860
938
|
}
|
|
861
939
|
return state;
|
|
862
940
|
}
|
|
@@ -866,17 +944,16 @@ function diffOpRange(ops, fromHash, toHash, blobStore) {
|
|
|
866
944
|
return diffFileStates(stateA, stateB, blobStore);
|
|
867
945
|
}
|
|
868
946
|
function generateUnifiedDiff(filePath, oldText, newText, contextLines = 3) {
|
|
869
|
-
const oldLines = oldText.split(
|
|
870
|
-
|
|
871
|
-
const newLines = newText.split(`
|
|
872
|
-
`);
|
|
947
|
+
const oldLines = oldText.split("\n");
|
|
948
|
+
const newLines = newText.split("\n");
|
|
873
949
|
const edits = myersDiff(oldLines, newLines);
|
|
874
950
|
const hunks = buildHunks(edits, contextLines);
|
|
875
|
-
if (hunks.length === 0)
|
|
876
|
-
return "";
|
|
951
|
+
if (hunks.length === 0) return "";
|
|
877
952
|
const lines = [`--- a/${filePath}`, `+++ b/${filePath}`];
|
|
878
953
|
for (const hunk of hunks) {
|
|
879
|
-
lines.push(
|
|
954
|
+
lines.push(
|
|
955
|
+
`@@ -${hunk.oldStart},${hunk.oldCount} +${hunk.newStart},${hunk.newCount} @@`
|
|
956
|
+
);
|
|
880
957
|
for (const edit of hunk.edits) {
|
|
881
958
|
switch (edit.kind) {
|
|
882
959
|
case "equal":
|
|
@@ -891,14 +968,12 @@ function generateUnifiedDiff(filePath, oldText, newText, contextLines = 3) {
|
|
|
891
968
|
}
|
|
892
969
|
}
|
|
893
970
|
}
|
|
894
|
-
return lines.join(
|
|
895
|
-
`);
|
|
971
|
+
return lines.join("\n");
|
|
896
972
|
}
|
|
897
973
|
function myersDiff(oldLines, newLines) {
|
|
898
974
|
const n = oldLines.length;
|
|
899
975
|
const m = newLines.length;
|
|
900
|
-
if (n === 0 && m === 0)
|
|
901
|
-
return [];
|
|
976
|
+
if (n === 0 && m === 0) return [];
|
|
902
977
|
if (n === 0)
|
|
903
978
|
return newLines.map((line) => ({ kind: "insert", line }));
|
|
904
979
|
if (m === 0)
|
|
@@ -908,30 +983,28 @@ function myersDiff(oldLines, newLines) {
|
|
|
908
983
|
const v = new Int32Array(size);
|
|
909
984
|
const trace = [];
|
|
910
985
|
const off = max;
|
|
911
|
-
outer:
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
x2 = v[k - 1 + off] + 1;
|
|
920
|
-
}
|
|
921
|
-
let y2 = x2 - k;
|
|
922
|
-
while (x2 < n && y2 < m && oldLines[x2] === newLines[y2]) {
|
|
923
|
-
x2++;
|
|
924
|
-
y2++;
|
|
925
|
-
}
|
|
926
|
-
v[k + off] = x2;
|
|
927
|
-
if (x2 >= n && y2 >= m)
|
|
928
|
-
break outer;
|
|
986
|
+
outer: for (let d = 0; d <= max; d++) {
|
|
987
|
+
trace.push(v.slice());
|
|
988
|
+
for (let k = -d; k <= d; k += 2) {
|
|
989
|
+
let x2;
|
|
990
|
+
if (k === -d || k !== d && v[k - 1 + off] < v[k + 1 + off]) {
|
|
991
|
+
x2 = v[k + 1 + off];
|
|
992
|
+
} else {
|
|
993
|
+
x2 = v[k - 1 + off] + 1;
|
|
929
994
|
}
|
|
995
|
+
let y2 = x2 - k;
|
|
996
|
+
while (x2 < n && y2 < m && oldLines[x2] === newLines[y2]) {
|
|
997
|
+
x2++;
|
|
998
|
+
y2++;
|
|
999
|
+
}
|
|
1000
|
+
v[k + off] = x2;
|
|
1001
|
+
if (x2 >= n && y2 >= m) break outer;
|
|
930
1002
|
}
|
|
1003
|
+
}
|
|
931
1004
|
let x = n;
|
|
932
1005
|
let y = m;
|
|
933
1006
|
const edits = [];
|
|
934
|
-
for (let d = trace.length - 1;d >= 0; d--) {
|
|
1007
|
+
for (let d = trace.length - 1; d >= 0; d--) {
|
|
935
1008
|
const tv = trace[d];
|
|
936
1009
|
const k = x - y;
|
|
937
1010
|
let prevK;
|
|
@@ -967,22 +1040,23 @@ function myersDiff(oldLines, newLines) {
|
|
|
967
1040
|
return edits;
|
|
968
1041
|
}
|
|
969
1042
|
function buildHunks(edits, contextLines) {
|
|
970
|
-
if (edits.length === 0)
|
|
971
|
-
return [];
|
|
1043
|
+
if (edits.length === 0) return [];
|
|
972
1044
|
const changeIndices = [];
|
|
973
|
-
for (let i = 0;i < edits.length; i++) {
|
|
1045
|
+
for (let i = 0; i < edits.length; i++) {
|
|
974
1046
|
if (edits[i].kind !== "equal") {
|
|
975
1047
|
changeIndices.push(i);
|
|
976
1048
|
}
|
|
977
1049
|
}
|
|
978
|
-
if (changeIndices.length === 0)
|
|
979
|
-
return [];
|
|
1050
|
+
if (changeIndices.length === 0) return [];
|
|
980
1051
|
const hunks = [];
|
|
981
1052
|
let hunkStart = Math.max(0, changeIndices[0] - contextLines);
|
|
982
1053
|
let hunkEnd = Math.min(edits.length - 1, changeIndices[0] + contextLines);
|
|
983
|
-
for (let i = 1;i < changeIndices.length; i++) {
|
|
1054
|
+
for (let i = 1; i < changeIndices.length; i++) {
|
|
984
1055
|
const changeStart = changeIndices[i] - contextLines;
|
|
985
|
-
const changeEnd = Math.min(
|
|
1056
|
+
const changeEnd = Math.min(
|
|
1057
|
+
edits.length - 1,
|
|
1058
|
+
changeIndices[i] + contextLines
|
|
1059
|
+
);
|
|
986
1060
|
if (changeStart <= hunkEnd + 1) {
|
|
987
1061
|
hunkEnd = changeEnd;
|
|
988
1062
|
} else {
|
|
@@ -998,19 +1072,15 @@ function createHunk(edits, start, end) {
|
|
|
998
1072
|
const hunkEdits = edits.slice(start, end + 1);
|
|
999
1073
|
let oldLine = 1;
|
|
1000
1074
|
let newLine = 1;
|
|
1001
|
-
for (let i = 0;i < start; i++) {
|
|
1002
|
-
if (edits[i].kind === "equal" || edits[i].kind === "delete")
|
|
1003
|
-
|
|
1004
|
-
if (edits[i].kind === "equal" || edits[i].kind === "insert")
|
|
1005
|
-
newLine++;
|
|
1075
|
+
for (let i = 0; i < start; i++) {
|
|
1076
|
+
if (edits[i].kind === "equal" || edits[i].kind === "delete") oldLine++;
|
|
1077
|
+
if (edits[i].kind === "equal" || edits[i].kind === "insert") newLine++;
|
|
1006
1078
|
}
|
|
1007
1079
|
let oldCount = 0;
|
|
1008
1080
|
let newCount = 0;
|
|
1009
1081
|
for (const edit of hunkEdits) {
|
|
1010
|
-
if (edit.kind === "equal" || edit.kind === "delete")
|
|
1011
|
-
|
|
1012
|
-
if (edit.kind === "equal" || edit.kind === "insert")
|
|
1013
|
-
newCount++;
|
|
1082
|
+
if (edit.kind === "equal" || edit.kind === "delete") oldCount++;
|
|
1083
|
+
if (edit.kind === "equal" || edit.kind === "insert") newCount++;
|
|
1014
1084
|
}
|
|
1015
1085
|
return {
|
|
1016
1086
|
oldStart: oldLine,
|
|
@@ -1020,28 +1090,22 @@ function createHunk(edits, start, end) {
|
|
|
1020
1090
|
edits: hunkEdits
|
|
1021
1091
|
};
|
|
1022
1092
|
}
|
|
1023
|
-
var init_diff = (
|
|
1093
|
+
var init_diff = __esm({
|
|
1094
|
+
"src/vcs/diff.ts"() {
|
|
1095
|
+
"use strict";
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1024
1098
|
|
|
1025
1099
|
// src/vcs/merge.ts
|
|
1026
1100
|
function threeWayMerge(base, ours, theirs, blobStore) {
|
|
1027
|
-
const mergedFiles = new Map;
|
|
1101
|
+
const mergedFiles = /* @__PURE__ */ new Map();
|
|
1028
1102
|
const conflicts = [];
|
|
1029
|
-
const allPaths = new Set;
|
|
1030
|
-
for (const [p, s] of base)
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
for (const [p, s] of ours)
|
|
1034
|
-
|
|
1035
|
-
allPaths.add(p);
|
|
1036
|
-
for (const [p, s] of theirs)
|
|
1037
|
-
if (!s.deleted)
|
|
1038
|
-
allPaths.add(p);
|
|
1039
|
-
for (const [p, s] of ours)
|
|
1040
|
-
if (s.deleted)
|
|
1041
|
-
allPaths.add(p);
|
|
1042
|
-
for (const [p, s] of theirs)
|
|
1043
|
-
if (s.deleted)
|
|
1044
|
-
allPaths.add(p);
|
|
1103
|
+
const allPaths = /* @__PURE__ */ new Set();
|
|
1104
|
+
for (const [p, s] of base) if (!s.deleted) allPaths.add(p);
|
|
1105
|
+
for (const [p, s] of ours) if (!s.deleted) allPaths.add(p);
|
|
1106
|
+
for (const [p, s] of theirs) if (!s.deleted) allPaths.add(p);
|
|
1107
|
+
for (const [p, s] of ours) if (s.deleted) allPaths.add(p);
|
|
1108
|
+
for (const [p, s] of theirs) if (s.deleted) allPaths.add(p);
|
|
1045
1109
|
for (const path of allPaths) {
|
|
1046
1110
|
const b = base.get(path);
|
|
1047
1111
|
const o = ours.get(path);
|
|
@@ -1049,9 +1113,9 @@ function threeWayMerge(base, ours, theirs, blobStore) {
|
|
|
1049
1113
|
const baseExists = b && !b.deleted;
|
|
1050
1114
|
const oursExists = o && !o.deleted;
|
|
1051
1115
|
const theirsExists = t && !t.deleted;
|
|
1052
|
-
const baseHash = baseExists ? b.contentHash :
|
|
1053
|
-
const oursHash = oursExists ? o.contentHash :
|
|
1054
|
-
const theirsHash = theirsExists ? t.contentHash :
|
|
1116
|
+
const baseHash = baseExists ? b.contentHash : void 0;
|
|
1117
|
+
const oursHash = oursExists ? o.contentHash : void 0;
|
|
1118
|
+
const theirsHash = theirsExists ? t.contentHash : void 0;
|
|
1055
1119
|
if (oursHash === theirsHash) {
|
|
1056
1120
|
continue;
|
|
1057
1121
|
}
|
|
@@ -1076,9 +1140,9 @@ function threeWayMerge(base, ours, theirs, blobStore) {
|
|
|
1076
1140
|
if (oursHash === theirsHash) {
|
|
1077
1141
|
continue;
|
|
1078
1142
|
}
|
|
1079
|
-
const oursContent = oursHash && blobStore ? blobStore.get(oursHash)?.toString("utf-8") :
|
|
1080
|
-
const theirsContent = theirsHash && blobStore ? blobStore.get(theirsHash)?.toString("utf-8") :
|
|
1081
|
-
if (oursContent !==
|
|
1143
|
+
const oursContent = oursHash && blobStore ? blobStore.get(oursHash)?.toString("utf-8") : void 0;
|
|
1144
|
+
const theirsContent = theirsHash && blobStore ? blobStore.get(theirsHash)?.toString("utf-8") : void 0;
|
|
1145
|
+
if (oursContent !== void 0 && theirsContent !== void 0) {
|
|
1082
1146
|
const textResult = threeWayTextMerge("", oursContent, theirsContent);
|
|
1083
1147
|
if (textResult.clean) {
|
|
1084
1148
|
mergedFiles.set(path, textResult.merged);
|
|
@@ -1100,7 +1164,7 @@ function threeWayMerge(base, ours, theirs, blobStore) {
|
|
|
1100
1164
|
conflicts.push({
|
|
1101
1165
|
path,
|
|
1102
1166
|
kind: "modify-delete",
|
|
1103
|
-
ours: oursHash && blobStore ? blobStore.get(oursHash)?.toString("utf-8") :
|
|
1167
|
+
ours: oursHash && blobStore ? blobStore.get(oursHash)?.toString("utf-8") : void 0
|
|
1104
1168
|
});
|
|
1105
1169
|
continue;
|
|
1106
1170
|
}
|
|
@@ -1108,15 +1172,15 @@ function threeWayMerge(base, ours, theirs, blobStore) {
|
|
|
1108
1172
|
conflicts.push({
|
|
1109
1173
|
path,
|
|
1110
1174
|
kind: "modify-delete",
|
|
1111
|
-
theirs: theirsHash && blobStore ? blobStore.get(theirsHash)?.toString("utf-8") :
|
|
1175
|
+
theirs: theirsHash && blobStore ? blobStore.get(theirsHash)?.toString("utf-8") : void 0
|
|
1112
1176
|
});
|
|
1113
1177
|
continue;
|
|
1114
1178
|
}
|
|
1115
1179
|
if (oursExists && theirsExists && oursHash !== theirsHash) {
|
|
1116
|
-
const baseContent = baseHash && blobStore ? blobStore.get(baseHash)?.toString("utf-8") :
|
|
1117
|
-
const oursContent = oursHash && blobStore ? blobStore.get(oursHash)?.toString("utf-8") :
|
|
1118
|
-
const theirsContent = theirsHash && blobStore ? blobStore.get(theirsHash)?.toString("utf-8") :
|
|
1119
|
-
if (baseContent !==
|
|
1180
|
+
const baseContent = baseHash && blobStore ? blobStore.get(baseHash)?.toString("utf-8") : void 0;
|
|
1181
|
+
const oursContent = oursHash && blobStore ? blobStore.get(oursHash)?.toString("utf-8") : void 0;
|
|
1182
|
+
const theirsContent = theirsHash && blobStore ? blobStore.get(theirsHash)?.toString("utf-8") : void 0;
|
|
1183
|
+
if (baseContent !== void 0 && oursContent !== void 0 && theirsContent !== void 0) {
|
|
1120
1184
|
const textResult = threeWayTextMerge(baseContent, oursContent, theirsContent);
|
|
1121
1185
|
if (textResult.clean) {
|
|
1122
1186
|
mergedFiles.set(path, textResult.merged);
|
|
@@ -1151,18 +1215,16 @@ function threeWayMerge(base, ours, theirs, blobStore) {
|
|
|
1151
1215
|
stats: {
|
|
1152
1216
|
added,
|
|
1153
1217
|
modified: added,
|
|
1218
|
+
// in a merge context, additions from theirs are "modified"
|
|
1154
1219
|
deleted,
|
|
1155
1220
|
conflicted: conflicts.length
|
|
1156
1221
|
}
|
|
1157
1222
|
};
|
|
1158
1223
|
}
|
|
1159
1224
|
function threeWayTextMerge(baseText, oursText, theirsText) {
|
|
1160
|
-
const baseLines = baseText.split(
|
|
1161
|
-
|
|
1162
|
-
const
|
|
1163
|
-
`);
|
|
1164
|
-
const theirsLines = theirsText.split(`
|
|
1165
|
-
`);
|
|
1225
|
+
const baseLines = baseText.split("\n");
|
|
1226
|
+
const oursLines = oursText.split("\n");
|
|
1227
|
+
const theirsLines = theirsText.split("\n");
|
|
1166
1228
|
const oursChanges = computeLineChanges(baseLines, oursLines);
|
|
1167
1229
|
const theirsChanges = computeLineChanges(baseLines, theirsLines);
|
|
1168
1230
|
const result = [];
|
|
@@ -1198,9 +1260,7 @@ function threeWayTextMerge(baseText, oursText, theirsText) {
|
|
|
1198
1260
|
oursIdx += theirsChange.baseCount;
|
|
1199
1261
|
theirsIdx += theirsChange.newCount;
|
|
1200
1262
|
} else if (oursChange && theirsChange) {
|
|
1201
|
-
if (oursChange.baseCount === theirsChange.baseCount && oursChange.newLines.join(
|
|
1202
|
-
`) === theirsChange.newLines.join(`
|
|
1203
|
-
`)) {
|
|
1263
|
+
if (oursChange.baseCount === theirsChange.baseCount && oursChange.newLines.join("\n") === theirsChange.newLines.join("\n")) {
|
|
1204
1264
|
applyChange(oursChange, result);
|
|
1205
1265
|
baseIdx += oursChange.baseCount;
|
|
1206
1266
|
oursIdx += oursChange.newCount;
|
|
@@ -1208,11 +1268,9 @@ function threeWayTextMerge(baseText, oursText, theirsText) {
|
|
|
1208
1268
|
} else {
|
|
1209
1269
|
clean = false;
|
|
1210
1270
|
result.push("<<<<<<< ours");
|
|
1211
|
-
for (const line of oursChange.newLines)
|
|
1212
|
-
result.push(line);
|
|
1271
|
+
for (const line of oursChange.newLines) result.push(line);
|
|
1213
1272
|
result.push("=======");
|
|
1214
|
-
for (const line of theirsChange.newLines)
|
|
1215
|
-
result.push(line);
|
|
1273
|
+
for (const line of theirsChange.newLines) result.push(line);
|
|
1216
1274
|
result.push(">>>>>>> theirs");
|
|
1217
1275
|
baseIdx += Math.max(oursChange.baseCount, theirsChange.baseCount);
|
|
1218
1276
|
oursIdx += oursChange.newCount;
|
|
@@ -1220,8 +1278,7 @@ function threeWayTextMerge(baseText, oursText, theirsText) {
|
|
|
1220
1278
|
}
|
|
1221
1279
|
}
|
|
1222
1280
|
}
|
|
1223
|
-
return { clean, merged: result.join(
|
|
1224
|
-
`) };
|
|
1281
|
+
return { clean, merged: result.join("\n") };
|
|
1225
1282
|
}
|
|
1226
1283
|
function applyChange(change, result) {
|
|
1227
1284
|
for (const line of change.newLines) {
|
|
@@ -1229,7 +1286,7 @@ function applyChange(change, result) {
|
|
|
1229
1286
|
}
|
|
1230
1287
|
}
|
|
1231
1288
|
function computeLineChanges(baseLines, newLines) {
|
|
1232
|
-
const changes = new Map;
|
|
1289
|
+
const changes = /* @__PURE__ */ new Map();
|
|
1233
1290
|
const matches = lcsMatch(baseLines, newLines);
|
|
1234
1291
|
let baseIdx = 0;
|
|
1235
1292
|
let newIdx = 0;
|
|
@@ -1266,11 +1323,13 @@ function computeLineChanges(baseLines, newLines) {
|
|
|
1266
1323
|
function lcsMatch(a, b) {
|
|
1267
1324
|
const n = a.length;
|
|
1268
1325
|
const m = b.length;
|
|
1269
|
-
if (n === 0 || m === 0)
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1326
|
+
if (n === 0 || m === 0) return [];
|
|
1327
|
+
const dp = Array.from(
|
|
1328
|
+
{ length: n + 1 },
|
|
1329
|
+
() => new Array(m + 1).fill(0)
|
|
1330
|
+
);
|
|
1331
|
+
for (let i2 = 1; i2 <= n; i2++) {
|
|
1332
|
+
for (let j2 = 1; j2 <= m; j2++) {
|
|
1274
1333
|
if (a[i2 - 1] === b[j2 - 1]) {
|
|
1275
1334
|
dp[i2][j2] = dp[i2 - 1][j2 - 1] + 1;
|
|
1276
1335
|
} else {
|
|
@@ -1294,7 +1353,11 @@ function lcsMatch(a, b) {
|
|
|
1294
1353
|
}
|
|
1295
1354
|
return matches;
|
|
1296
1355
|
}
|
|
1297
|
-
var init_merge = (
|
|
1356
|
+
var init_merge = __esm({
|
|
1357
|
+
"src/vcs/merge.ts"() {
|
|
1358
|
+
"use strict";
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1298
1361
|
|
|
1299
1362
|
// src/vcs/issue.ts
|
|
1300
1363
|
import { exec } from "child_process";
|
|
@@ -1315,10 +1378,9 @@ function getIssueCounterPath(rootPath) {
|
|
|
1315
1378
|
function nextIssueId(rootPath) {
|
|
1316
1379
|
const counterPath = getIssueCounterPath(rootPath);
|
|
1317
1380
|
const dir = dirname2(counterPath);
|
|
1318
|
-
if (!existsSync3(dir))
|
|
1319
|
-
mkdirSync2(dir, { recursive: true });
|
|
1381
|
+
if (!existsSync3(dir)) mkdirSync2(dir, { recursive: true });
|
|
1320
1382
|
const lockPath = `${counterPath}.lock`;
|
|
1321
|
-
const deadline = Date.now() +
|
|
1383
|
+
const deadline = Date.now() + 5e3;
|
|
1322
1384
|
let lockFd;
|
|
1323
1385
|
while (Date.now() < deadline) {
|
|
1324
1386
|
try {
|
|
@@ -1330,15 +1392,18 @@ function nextIssueId(rootPath) {
|
|
|
1330
1392
|
}
|
|
1331
1393
|
}
|
|
1332
1394
|
}
|
|
1333
|
-
if (lockFd ===
|
|
1334
|
-
throw new Error(
|
|
1395
|
+
if (lockFd === void 0) {
|
|
1396
|
+
throw new Error(
|
|
1397
|
+
`Timed out waiting for issue counter lock: ${lockPath}. Another Trellis process may be stalled.`
|
|
1398
|
+
);
|
|
1335
1399
|
}
|
|
1336
1400
|
try {
|
|
1337
1401
|
let counter = 0;
|
|
1338
1402
|
if (existsSync3(counterPath)) {
|
|
1339
1403
|
try {
|
|
1340
1404
|
counter = JSON.parse(readFileSync3(counterPath, "utf-8")).counter ?? 0;
|
|
1341
|
-
} catch {
|
|
1405
|
+
} catch {
|
|
1406
|
+
}
|
|
1342
1407
|
}
|
|
1343
1408
|
counter++;
|
|
1344
1409
|
writeFileSync3(counterPath, JSON.stringify({ counter }, null, 2));
|
|
@@ -1347,13 +1412,14 @@ function nextIssueId(rootPath) {
|
|
|
1347
1412
|
closeSync(lockFd);
|
|
1348
1413
|
try {
|
|
1349
1414
|
unlinkSync(lockPath);
|
|
1350
|
-
} catch {
|
|
1415
|
+
} catch {
|
|
1416
|
+
}
|
|
1351
1417
|
}
|
|
1352
1418
|
}
|
|
1353
1419
|
function getIssueFact(ctx, entityId, attr) {
|
|
1354
1420
|
const facts = ctx.store.getFactsByEntity(entityId);
|
|
1355
1421
|
const matches = facts.filter((f) => f.a === attr);
|
|
1356
|
-
return matches.length > 0 ? matches[matches.length - 1].v :
|
|
1422
|
+
return matches.length > 0 ? matches[matches.length - 1].v : void 0;
|
|
1357
1423
|
}
|
|
1358
1424
|
function getIssueLinks(ctx, entityId, attr) {
|
|
1359
1425
|
const links = ctx.store.getLinksByEntity(entityId);
|
|
@@ -1367,7 +1433,7 @@ function getCriteriaForIssue(ctx, issueId) {
|
|
|
1367
1433
|
const facts = ctx.store.getFactsByEntity(ceid);
|
|
1368
1434
|
const getLast = (a) => {
|
|
1369
1435
|
const matches = facts.filter((f) => f.a === a);
|
|
1370
|
-
return matches.length > 0 ? matches[matches.length - 1].v :
|
|
1436
|
+
return matches.length > 0 ? matches[matches.length - 1].v : void 0;
|
|
1371
1437
|
};
|
|
1372
1438
|
return {
|
|
1373
1439
|
id: ceid,
|
|
@@ -1383,14 +1449,14 @@ function buildIssueInfo(ctx, entityId) {
|
|
|
1383
1449
|
const facts = ctx.store.getFactsByEntity(entityId);
|
|
1384
1450
|
const get = (a) => {
|
|
1385
1451
|
const matches = facts.filter((f) => f.a === a);
|
|
1386
|
-
return matches.length > 0 ? matches[matches.length - 1].v :
|
|
1452
|
+
return matches.length > 0 ? matches[matches.length - 1].v : void 0;
|
|
1387
1453
|
};
|
|
1388
1454
|
const labelsStr = get("labels");
|
|
1389
1455
|
const labels = labelsStr ? labelsStr.split(",").filter(Boolean) : [];
|
|
1390
1456
|
const trackedOnLinks = getIssueLinks(ctx, entityId, "trackedOn");
|
|
1391
|
-
const branchName = trackedOnLinks.length > 0 ? trackedOnLinks[0].replace(/^branch:/, "") :
|
|
1457
|
+
const branchName = trackedOnLinks.length > 0 ? trackedOnLinks[0].replace(/^branch:/, "") : void 0;
|
|
1392
1458
|
const childOfLinks = getIssueLinks(ctx, entityId, "childOf");
|
|
1393
|
-
const parentId = childOfLinks.length > 0 ? childOfLinks[0].replace(/^issue:/, "") :
|
|
1459
|
+
const parentId = childOfLinks.length > 0 ? childOfLinks[0].replace(/^issue:/, "") : void 0;
|
|
1394
1460
|
const bareId = entityId.replace(/^issue:/, "");
|
|
1395
1461
|
const blockedByLinks = getIssueLinks(ctx, entityId, "blockedBy");
|
|
1396
1462
|
const blockedBy = blockedByLinks.map((e) => e.replace(/^issue:/, ""));
|
|
@@ -1412,7 +1478,7 @@ function buildIssueInfo(ctx, entityId) {
|
|
|
1412
1478
|
createdBy: get("createdBy"),
|
|
1413
1479
|
startedAt: get("startedAt"),
|
|
1414
1480
|
pausedAt: get("pausedAt"),
|
|
1415
|
-
pauseNote: get("pauseNote") ||
|
|
1481
|
+
pauseNote: get("pauseNote") || void 0,
|
|
1416
1482
|
closedAt: get("closedAt"),
|
|
1417
1483
|
parentId,
|
|
1418
1484
|
branchName,
|
|
@@ -1440,8 +1506,13 @@ async function createIssue(ctx, rootPath, title, opts) {
|
|
|
1440
1506
|
});
|
|
1441
1507
|
await ctx.applyOp(op);
|
|
1442
1508
|
if (opts?.criteria) {
|
|
1443
|
-
for (let i = 0;i < opts.criteria.length; i++) {
|
|
1444
|
-
await addCriterion(
|
|
1509
|
+
for (let i = 0; i < opts.criteria.length; i++) {
|
|
1510
|
+
await addCriterion(
|
|
1511
|
+
ctx,
|
|
1512
|
+
id,
|
|
1513
|
+
opts.criteria[i].description,
|
|
1514
|
+
opts.criteria[i].command
|
|
1515
|
+
);
|
|
1445
1516
|
}
|
|
1446
1517
|
}
|
|
1447
1518
|
return op;
|
|
@@ -1452,21 +1523,16 @@ async function updateIssue(ctx, id, updates) {
|
|
|
1452
1523
|
throw new Error(`Issue ${id} not found.`);
|
|
1453
1524
|
}
|
|
1454
1525
|
const vcs = { issueId: id };
|
|
1455
|
-
if (updates.title !==
|
|
1456
|
-
|
|
1457
|
-
if (updates.
|
|
1458
|
-
vcs.issueDescription = updates.description;
|
|
1459
|
-
if (updates.status !== undefined) {
|
|
1526
|
+
if (updates.title !== void 0) vcs.issueTitle = updates.title;
|
|
1527
|
+
if (updates.description !== void 0) vcs.issueDescription = updates.description;
|
|
1528
|
+
if (updates.status !== void 0) {
|
|
1460
1529
|
vcs.oldIssueStatus = getIssueFact(ctx, issueEntityId(id), "status");
|
|
1461
1530
|
vcs.issueStatus = updates.status;
|
|
1462
1531
|
}
|
|
1463
|
-
if (updates.priority !==
|
|
1464
|
-
|
|
1465
|
-
if (updates.
|
|
1466
|
-
|
|
1467
|
-
if (updates.assignee !== undefined)
|
|
1468
|
-
vcs.issueAssignee = updates.assignee;
|
|
1469
|
-
if (updates.parentId !== undefined) {
|
|
1532
|
+
if (updates.priority !== void 0) vcs.issuePriority = updates.priority;
|
|
1533
|
+
if (updates.labels !== void 0) vcs.issueLabels = updates.labels;
|
|
1534
|
+
if (updates.assignee !== void 0) vcs.issueAssignee = updates.assignee;
|
|
1535
|
+
if (updates.parentId !== void 0) {
|
|
1470
1536
|
const newParent = updates.parentId;
|
|
1471
1537
|
if (newParent === id) {
|
|
1472
1538
|
throw new Error(`Issue ${id} cannot be its own parent.`);
|
|
@@ -1479,10 +1545,8 @@ async function updateIssue(ctx, id, updates) {
|
|
|
1479
1545
|
}
|
|
1480
1546
|
const currentParent = issue.parentId;
|
|
1481
1547
|
if (newParent !== currentParent) {
|
|
1482
|
-
if (currentParent)
|
|
1483
|
-
|
|
1484
|
-
if (newParent)
|
|
1485
|
-
vcs.parentIssueId = newParent;
|
|
1548
|
+
if (currentParent) vcs.oldParentIssueId = currentParent;
|
|
1549
|
+
if (newParent) vcs.parentIssueId = newParent;
|
|
1486
1550
|
}
|
|
1487
1551
|
}
|
|
1488
1552
|
const op = await createVcsOp("vcs:issueUpdate", {
|
|
@@ -1517,12 +1581,16 @@ async function startIssue(ctx, id, branchName) {
|
|
|
1517
1581
|
}
|
|
1518
1582
|
async function pauseIssue(ctx, id, note) {
|
|
1519
1583
|
if (!note || !note.trim()) {
|
|
1520
|
-
throw new Error(
|
|
1584
|
+
throw new Error(
|
|
1585
|
+
`A pause note is required. Explain why the issue is paused and what must happen before resuming.`
|
|
1586
|
+
);
|
|
1521
1587
|
}
|
|
1522
1588
|
const eid = issueEntityId(id);
|
|
1523
1589
|
const status = getIssueFact(ctx, eid, "status");
|
|
1524
1590
|
if (status !== "in_progress") {
|
|
1525
|
-
throw new Error(
|
|
1591
|
+
throw new Error(
|
|
1592
|
+
`Cannot pause issue ${id} \u2014 status is '${status}', expected 'in_progress'.`
|
|
1593
|
+
);
|
|
1526
1594
|
}
|
|
1527
1595
|
const op = await createVcsOp("vcs:issuePause", {
|
|
1528
1596
|
agentId: ctx.agentId,
|
|
@@ -1540,7 +1608,9 @@ async function resumeIssue(ctx, id) {
|
|
|
1540
1608
|
const eid = issueEntityId(id);
|
|
1541
1609
|
const status = getIssueFact(ctx, eid, "status");
|
|
1542
1610
|
if (status !== "paused") {
|
|
1543
|
-
throw new Error(
|
|
1611
|
+
throw new Error(
|
|
1612
|
+
`Cannot resume issue ${id} \u2014 status is '${status}', expected 'paused'.`
|
|
1613
|
+
);
|
|
1544
1614
|
}
|
|
1545
1615
|
const op = await createVcsOp("vcs:issueResume", {
|
|
1546
1616
|
agentId: ctx.agentId,
|
|
@@ -1566,9 +1636,10 @@ async function closeIssue(ctx, id, opts) {
|
|
|
1566
1636
|
const allPassed = results.length === 0 || results.every((r) => r.status === "passed");
|
|
1567
1637
|
if (!allPassed) {
|
|
1568
1638
|
const failing = results.filter((r) => r.status !== "passed");
|
|
1569
|
-
throw new Error(
|
|
1570
|
-
`
|
|
1571
|
-
`))
|
|
1639
|
+
throw new Error(
|
|
1640
|
+
`Cannot close issue ${id}: ${failing.length} criteria not passing:
|
|
1641
|
+
` + failing.map((f) => ` - ${f.description ?? f.id} (${f.status})`).join("\n")
|
|
1642
|
+
);
|
|
1572
1643
|
}
|
|
1573
1644
|
if (!opts?.confirm) {
|
|
1574
1645
|
return { criteriaResults: results };
|
|
@@ -1590,7 +1661,9 @@ async function triageIssue(ctx, id) {
|
|
|
1590
1661
|
const eid = issueEntityId(id);
|
|
1591
1662
|
const status = getIssueFact(ctx, eid, "status");
|
|
1592
1663
|
if (status !== "backlog") {
|
|
1593
|
-
throw new Error(
|
|
1664
|
+
throw new Error(
|
|
1665
|
+
`Cannot triage issue ${id} \u2014 status is '${status}', expected 'backlog'.`
|
|
1666
|
+
);
|
|
1594
1667
|
}
|
|
1595
1668
|
const op = await createVcsOp("vcs:issueUpdate", {
|
|
1596
1669
|
agentId: ctx.agentId,
|
|
@@ -1608,7 +1681,9 @@ async function reopenIssue(ctx, id) {
|
|
|
1608
1681
|
const eid = issueEntityId(id);
|
|
1609
1682
|
const status = getIssueFact(ctx, eid, "status");
|
|
1610
1683
|
if (status !== "closed") {
|
|
1611
|
-
throw new Error(
|
|
1684
|
+
throw new Error(
|
|
1685
|
+
`Cannot reopen issue ${id} \u2014 status is '${status}', expected 'closed'.`
|
|
1686
|
+
);
|
|
1612
1687
|
}
|
|
1613
1688
|
const op = await createVcsOp("vcs:issueReopen", {
|
|
1614
1689
|
agentId: ctx.agentId,
|
|
@@ -1670,7 +1745,9 @@ async function addCriterion(ctx, issueId, description, command) {
|
|
|
1670
1745
|
async function setCriterionStatus(ctx, issueId, criterionIndex, status) {
|
|
1671
1746
|
const criteria = getCriteriaForIssue(ctx, issueId);
|
|
1672
1747
|
if (criterionIndex < 1 || criterionIndex > criteria.length) {
|
|
1673
|
-
throw new Error(
|
|
1748
|
+
throw new Error(
|
|
1749
|
+
`Criterion index ${criterionIndex} out of range (1\u2013${criteria.length})`
|
|
1750
|
+
);
|
|
1674
1751
|
}
|
|
1675
1752
|
const c = criteria[criterionIndex - 1];
|
|
1676
1753
|
const op = await createVcsOp("vcs:criterionUpdate", {
|
|
@@ -1703,15 +1780,13 @@ async function runCriteria(ctx, issueId, rootPath) {
|
|
|
1703
1780
|
try {
|
|
1704
1781
|
const result = await execAsync(c.command, {
|
|
1705
1782
|
cwd: rootPath,
|
|
1706
|
-
timeout:
|
|
1783
|
+
timeout: 12e4
|
|
1707
1784
|
});
|
|
1708
|
-
output = (result.stdout +
|
|
1709
|
-
` + result.stderr).trim();
|
|
1785
|
+
output = (result.stdout + "\n" + result.stderr).trim();
|
|
1710
1786
|
exitCode = 0;
|
|
1711
1787
|
status = "passed";
|
|
1712
1788
|
} catch (err) {
|
|
1713
|
-
output = (err.stdout ?? "") +
|
|
1714
|
-
` + (err.stderr ?? err.message ?? "");
|
|
1789
|
+
output = (err.stdout ?? "") + "\n" + (err.stderr ?? err.message ?? "");
|
|
1715
1790
|
output = output.trim();
|
|
1716
1791
|
exitCode = err.code ?? 1;
|
|
1717
1792
|
status = "failed";
|
|
@@ -1752,7 +1827,7 @@ function listIssues(ctx, filters) {
|
|
|
1752
1827
|
if (filters?.parentId) {
|
|
1753
1828
|
issues = issues.filter((i) => i.parentId === filters.parentId);
|
|
1754
1829
|
}
|
|
1755
|
-
if (filters?.blocked !==
|
|
1830
|
+
if (filters?.blocked !== void 0) {
|
|
1756
1831
|
issues = issues.filter((i) => i.isBlocked === filters.blocked);
|
|
1757
1832
|
}
|
|
1758
1833
|
return issues;
|
|
@@ -1760,8 +1835,7 @@ function listIssues(ctx, filters) {
|
|
|
1760
1835
|
function getIssue(ctx, id) {
|
|
1761
1836
|
const eid = issueEntityId(id);
|
|
1762
1837
|
const typeFact = ctx.store.getFactsByEntity(eid).find((f) => f.a === "type" && f.v === "Issue");
|
|
1763
|
-
if (!typeFact)
|
|
1764
|
-
return null;
|
|
1838
|
+
if (!typeFact) return null;
|
|
1765
1839
|
return buildIssueInfo(ctx, eid);
|
|
1766
1840
|
}
|
|
1767
1841
|
function getActiveIssues(ctx) {
|
|
@@ -1779,23 +1853,31 @@ function checkCompletionReadiness(ctx) {
|
|
|
1779
1853
|
} else {
|
|
1780
1854
|
parts.push("\u2717 Not ready for completion:");
|
|
1781
1855
|
if (queue.length > 0) {
|
|
1782
|
-
parts.push(
|
|
1856
|
+
parts.push(
|
|
1857
|
+
` Queue (${queue.length}): ${queue.map((i) => i.id).join(", ")}`
|
|
1858
|
+
);
|
|
1783
1859
|
}
|
|
1784
1860
|
if (inProgress.length > 0) {
|
|
1785
|
-
parts.push(
|
|
1861
|
+
parts.push(
|
|
1862
|
+
` In progress (${inProgress.length}): ${inProgress.map((i) => i.id).join(", ")}`
|
|
1863
|
+
);
|
|
1786
1864
|
}
|
|
1787
1865
|
if (paused.length > 0) {
|
|
1788
|
-
parts.push(
|
|
1866
|
+
parts.push(
|
|
1867
|
+
` Paused (${paused.length}): ${paused.map((i) => `${i.id}${i.pauseNote ? ` \u2014 ${i.pauseNote}` : ""}`).join(", ")}`
|
|
1868
|
+
);
|
|
1789
1869
|
}
|
|
1790
1870
|
}
|
|
1791
|
-
return { ready, queue, paused, inProgress, summary: parts.join(
|
|
1792
|
-
`) };
|
|
1871
|
+
return { ready, queue, paused, inProgress, summary: parts.join("\n") };
|
|
1793
1872
|
}
|
|
1794
1873
|
var execAsync;
|
|
1795
|
-
var init_issue = __esm(
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1874
|
+
var init_issue = __esm({
|
|
1875
|
+
"src/vcs/issue.ts"() {
|
|
1876
|
+
"use strict";
|
|
1877
|
+
init_ops();
|
|
1878
|
+
init_types();
|
|
1879
|
+
execAsync = promisify(exec);
|
|
1880
|
+
}
|
|
1799
1881
|
});
|
|
1800
1882
|
|
|
1801
1883
|
// src/vcs/op-log.ts
|
|
@@ -1813,172 +1895,179 @@ import {
|
|
|
1813
1895
|
import { dirname as dirname3 } from "path";
|
|
1814
1896
|
function lockTimeoutMs() {
|
|
1815
1897
|
const raw = process.env.TRELLIS_OPLOG_LOCK_MS;
|
|
1816
|
-
if (!raw)
|
|
1817
|
-
return 5000;
|
|
1898
|
+
if (!raw) return 5e3;
|
|
1818
1899
|
const parsed = Number(raw);
|
|
1819
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed :
|
|
1820
|
-
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
this.
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1900
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 5e3;
|
|
1901
|
+
}
|
|
1902
|
+
var JsonOpLog, LaneOpLog;
|
|
1903
|
+
var init_op_log = __esm({
|
|
1904
|
+
"src/vcs/op-log.ts"() {
|
|
1905
|
+
"use strict";
|
|
1906
|
+
JsonOpLog = class {
|
|
1907
|
+
ops = [];
|
|
1908
|
+
filePath;
|
|
1909
|
+
lockPath;
|
|
1910
|
+
constructor(filePath) {
|
|
1911
|
+
this.filePath = filePath;
|
|
1912
|
+
this.lockPath = `${filePath}.lock`;
|
|
1913
|
+
}
|
|
1914
|
+
get path() {
|
|
1915
|
+
return this.filePath;
|
|
1916
|
+
}
|
|
1917
|
+
load() {
|
|
1918
|
+
if (existsSync4(this.filePath)) {
|
|
1919
|
+
const raw = readFileSync4(this.filePath, "utf-8");
|
|
1920
|
+
try {
|
|
1921
|
+
this.ops = JSON.parse(raw);
|
|
1922
|
+
} catch {
|
|
1923
|
+
const backupPath = this.filePath + ".bak";
|
|
1924
|
+
if (existsSync4(backupPath)) {
|
|
1925
|
+
const backupRaw = readFileSync4(backupPath, "utf-8");
|
|
1926
|
+
this.ops = JSON.parse(backupRaw);
|
|
1927
|
+
writeFileSync4(this.filePath, backupRaw);
|
|
1928
|
+
} else {
|
|
1929
|
+
throw new Error(
|
|
1930
|
+
`Corrupted ops log at ${this.filePath} and no backup found. Run \`trellis repair\` to attempt recovery.`
|
|
1931
|
+
);
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1846
1934
|
}
|
|
1847
1935
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1936
|
+
append(op) {
|
|
1937
|
+
this.withLock(() => {
|
|
1938
|
+
const diskOps = this.readOpsFromDisk();
|
|
1939
|
+
this.ops = diskOps;
|
|
1940
|
+
if (this.ops.some((existing) => existing.hash === op.hash)) {
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
this.ops.push(op);
|
|
1944
|
+
this.flush();
|
|
1945
|
+
});
|
|
1856
1946
|
}
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
const backupPath = this.filePath + ".bak";
|
|
1876
|
-
try {
|
|
1877
|
-
copyFileSync(this.filePath, backupPath);
|
|
1878
|
-
} catch {}
|
|
1879
|
-
}
|
|
1880
|
-
const tempPath = `${this.filePath}.tmp`;
|
|
1881
|
-
writeFileSync4(tempPath, JSON.stringify(this.ops, null, 2));
|
|
1882
|
-
renameSync(tempPath, this.filePath);
|
|
1883
|
-
}
|
|
1884
|
-
readOpsFromDisk() {
|
|
1885
|
-
if (!existsSync4(this.filePath)) {
|
|
1886
|
-
return [];
|
|
1887
|
-
}
|
|
1888
|
-
const raw = readFileSync4(this.filePath, "utf-8");
|
|
1889
|
-
try {
|
|
1890
|
-
const parsed = JSON.parse(raw);
|
|
1891
|
-
return Array.isArray(parsed) ? parsed : [];
|
|
1892
|
-
} catch {
|
|
1893
|
-
const backupPath = this.filePath + ".bak";
|
|
1894
|
-
if (existsSync4(backupPath)) {
|
|
1895
|
-
const backupRaw = readFileSync4(backupPath, "utf-8");
|
|
1896
|
-
const parsedBackup = JSON.parse(backupRaw);
|
|
1897
|
-
writeFileSync4(this.filePath, backupRaw);
|
|
1898
|
-
return Array.isArray(parsedBackup) ? parsedBackup : [];
|
|
1899
|
-
}
|
|
1900
|
-
throw new Error(`Corrupted ops log at ${this.filePath} and no backup found. Run \`trellis repair\` to attempt recovery.`);
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
withLock(fn) {
|
|
1904
|
-
const dir = dirname3(this.filePath);
|
|
1905
|
-
if (!existsSync4(dir))
|
|
1906
|
-
mkdirSync3(dir, { recursive: true });
|
|
1907
|
-
const deadline = Date.now() + lockTimeoutMs();
|
|
1908
|
-
let lockFd;
|
|
1909
|
-
while (Date.now() < deadline) {
|
|
1910
|
-
try {
|
|
1911
|
-
lockFd = openSync2(this.lockPath, "wx");
|
|
1912
|
-
break;
|
|
1913
|
-
} catch (err) {
|
|
1914
|
-
if (err?.code !== "EEXIST") {
|
|
1915
|
-
throw err;
|
|
1947
|
+
readAll() {
|
|
1948
|
+
return [...this.ops];
|
|
1949
|
+
}
|
|
1950
|
+
getLastOp() {
|
|
1951
|
+
return this.ops.length > 0 ? this.ops[this.ops.length - 1] : void 0;
|
|
1952
|
+
}
|
|
1953
|
+
count() {
|
|
1954
|
+
return this.ops.length;
|
|
1955
|
+
}
|
|
1956
|
+
flush() {
|
|
1957
|
+
const dir = dirname3(this.filePath);
|
|
1958
|
+
if (!existsSync4(dir)) mkdirSync3(dir, { recursive: true });
|
|
1959
|
+
if (existsSync4(this.filePath)) {
|
|
1960
|
+
const backupPath = this.filePath + ".bak";
|
|
1961
|
+
try {
|
|
1962
|
+
copyFileSync(this.filePath, backupPath);
|
|
1963
|
+
} catch {
|
|
1964
|
+
}
|
|
1916
1965
|
}
|
|
1966
|
+
const tempPath = `${this.filePath}.tmp`;
|
|
1967
|
+
writeFileSync4(tempPath, JSON.stringify(this.ops, null, 2));
|
|
1968
|
+
renameSync(tempPath, this.filePath);
|
|
1917
1969
|
}
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
fn();
|
|
1924
|
-
} finally {
|
|
1925
|
-
closeSync2(lockFd);
|
|
1926
|
-
try {
|
|
1927
|
-
unlinkSync2(this.lockPath);
|
|
1928
|
-
} catch {}
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
static repair(filePath) {
|
|
1932
|
-
if (!existsSync4(filePath)) {
|
|
1933
|
-
return { recovered: 0, lost: 0 };
|
|
1934
|
-
}
|
|
1935
|
-
const raw = readFileSync4(filePath, "utf-8");
|
|
1936
|
-
try {
|
|
1937
|
-
const ops = JSON.parse(raw);
|
|
1938
|
-
return { recovered: ops.length, lost: 0 };
|
|
1939
|
-
} catch {}
|
|
1940
|
-
const lastHash = raw.lastIndexOf('"hash": "trellis:op:');
|
|
1941
|
-
if (lastHash === -1) {
|
|
1942
|
-
const bakPath = filePath + ".bak";
|
|
1943
|
-
if (existsSync4(bakPath)) {
|
|
1944
|
-
const bakRaw = readFileSync4(bakPath, "utf-8");
|
|
1970
|
+
readOpsFromDisk() {
|
|
1971
|
+
if (!existsSync4(this.filePath)) {
|
|
1972
|
+
return [];
|
|
1973
|
+
}
|
|
1974
|
+
const raw = readFileSync4(this.filePath, "utf-8");
|
|
1945
1975
|
try {
|
|
1946
|
-
const
|
|
1947
|
-
|
|
1976
|
+
const parsed = JSON.parse(raw);
|
|
1977
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
1978
|
+
} catch {
|
|
1979
|
+
const backupPath = this.filePath + ".bak";
|
|
1980
|
+
if (existsSync4(backupPath)) {
|
|
1981
|
+
const backupRaw = readFileSync4(backupPath, "utf-8");
|
|
1982
|
+
const parsedBackup = JSON.parse(backupRaw);
|
|
1983
|
+
writeFileSync4(this.filePath, backupRaw);
|
|
1984
|
+
return Array.isArray(parsedBackup) ? parsedBackup : [];
|
|
1985
|
+
}
|
|
1986
|
+
throw new Error(
|
|
1987
|
+
`Corrupted ops log at ${this.filePath} and no backup found. Run \`trellis repair\` to attempt recovery.`
|
|
1988
|
+
);
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
withLock(fn) {
|
|
1992
|
+
const dir = dirname3(this.filePath);
|
|
1993
|
+
if (!existsSync4(dir)) mkdirSync3(dir, { recursive: true });
|
|
1994
|
+
const deadline = Date.now() + lockTimeoutMs();
|
|
1995
|
+
let lockFd;
|
|
1996
|
+
while (Date.now() < deadline) {
|
|
1997
|
+
try {
|
|
1998
|
+
lockFd = openSync2(this.lockPath, "wx");
|
|
1999
|
+
break;
|
|
2000
|
+
} catch (err) {
|
|
2001
|
+
if (err?.code !== "EEXIST") {
|
|
2002
|
+
throw err;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
if (lockFd === void 0) {
|
|
2007
|
+
throw new Error(
|
|
2008
|
+
`Timed out waiting for ops log lock: ${this.lockPath}. Another Trellis process may be stalled.`
|
|
2009
|
+
);
|
|
2010
|
+
}
|
|
2011
|
+
try {
|
|
2012
|
+
fn();
|
|
2013
|
+
} finally {
|
|
2014
|
+
closeSync2(lockFd);
|
|
2015
|
+
try {
|
|
2016
|
+
unlinkSync2(this.lockPath);
|
|
2017
|
+
} catch {
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
static repair(filePath) {
|
|
2022
|
+
if (!existsSync4(filePath)) {
|
|
2023
|
+
return { recovered: 0, lost: 0 };
|
|
2024
|
+
}
|
|
2025
|
+
const raw = readFileSync4(filePath, "utf-8");
|
|
2026
|
+
try {
|
|
2027
|
+
const ops = JSON.parse(raw);
|
|
2028
|
+
return { recovered: ops.length, lost: 0 };
|
|
2029
|
+
} catch {
|
|
2030
|
+
}
|
|
2031
|
+
const lastHash = raw.lastIndexOf('"hash": "trellis:op:');
|
|
2032
|
+
if (lastHash === -1) {
|
|
2033
|
+
const bakPath = filePath + ".bak";
|
|
2034
|
+
if (existsSync4(bakPath)) {
|
|
2035
|
+
const bakRaw = readFileSync4(bakPath, "utf-8");
|
|
2036
|
+
try {
|
|
2037
|
+
const ops = JSON.parse(bakRaw);
|
|
2038
|
+
writeFileSync4(filePath, bakRaw);
|
|
2039
|
+
return { recovered: ops.length, lost: 0 };
|
|
2040
|
+
} catch {
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
writeFileSync4(filePath, "[]");
|
|
2044
|
+
return { recovered: 0, lost: -1 };
|
|
2045
|
+
}
|
|
2046
|
+
const endOfLine = raw.indexOf("\n", lastHash);
|
|
2047
|
+
const closingBrace = raw.indexOf(" }", endOfLine);
|
|
2048
|
+
if (closingBrace === -1) {
|
|
2049
|
+
writeFileSync4(filePath, "[]");
|
|
2050
|
+
return { recovered: 0, lost: -1 };
|
|
2051
|
+
}
|
|
2052
|
+
const fixed = raw.slice(0, closingBrace + 3) + "\n]";
|
|
2053
|
+
try {
|
|
2054
|
+
const ops = JSON.parse(fixed);
|
|
2055
|
+
writeFileSync4(filePath + ".corrupted", raw);
|
|
2056
|
+
writeFileSync4(filePath, fixed);
|
|
1948
2057
|
return { recovered: ops.length, lost: 0 };
|
|
1949
|
-
} catch {
|
|
2058
|
+
} catch {
|
|
2059
|
+
writeFileSync4(filePath + ".corrupted", raw);
|
|
2060
|
+
writeFileSync4(filePath, "[]");
|
|
2061
|
+
return { recovered: 0, lost: -1 };
|
|
2062
|
+
}
|
|
1950
2063
|
}
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
if (closingBrace === -1) {
|
|
1958
|
-
writeFileSync4(filePath, "[]");
|
|
1959
|
-
return { recovered: 0, lost: -1 };
|
|
1960
|
-
}
|
|
1961
|
-
const fixed = raw.slice(0, closingBrace + 3) + `
|
|
1962
|
-
]`;
|
|
1963
|
-
try {
|
|
1964
|
-
const ops = JSON.parse(fixed);
|
|
1965
|
-
writeFileSync4(filePath + ".corrupted", raw);
|
|
1966
|
-
writeFileSync4(filePath, fixed);
|
|
1967
|
-
return { recovered: ops.length, lost: 0 };
|
|
1968
|
-
} catch {
|
|
1969
|
-
writeFileSync4(filePath + ".corrupted", raw);
|
|
1970
|
-
writeFileSync4(filePath, "[]");
|
|
1971
|
-
return { recovered: 0, lost: -1 };
|
|
1972
|
-
}
|
|
2064
|
+
};
|
|
2065
|
+
LaneOpLog = class extends JsonOpLog {
|
|
2066
|
+
constructor(laneDir2) {
|
|
2067
|
+
super(`${laneDir2}/ops.json`);
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
1973
2070
|
}
|
|
1974
|
-
}
|
|
1975
|
-
var LaneOpLog;
|
|
1976
|
-
var init_op_log = __esm(() => {
|
|
1977
|
-
LaneOpLog = class LaneOpLog extends JsonOpLog {
|
|
1978
|
-
constructor(laneDir) {
|
|
1979
|
-
super(`${laneDir}/ops.json`);
|
|
1980
|
-
}
|
|
1981
|
-
};
|
|
1982
2071
|
});
|
|
1983
2072
|
|
|
1984
2073
|
// src/vcs/lane.ts
|
|
@@ -1999,28 +2088,27 @@ function newLaneId() {
|
|
|
1999
2088
|
}
|
|
2000
2089
|
function loadLaneMeta(trellisDir, laneId) {
|
|
2001
2090
|
const path = laneMetaPath(trellisDir, laneId);
|
|
2002
|
-
if (!existsSync5(path))
|
|
2003
|
-
return;
|
|
2091
|
+
if (!existsSync5(path)) return void 0;
|
|
2004
2092
|
return JSON.parse(readFileSync5(path, "utf-8"));
|
|
2005
2093
|
}
|
|
2006
2094
|
function saveLaneMeta(trellisDir, meta) {
|
|
2007
2095
|
const dir = laneDir(trellisDir, meta.id);
|
|
2008
|
-
if (!existsSync5(dir))
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2096
|
+
if (!existsSync5(dir)) mkdirSync4(dir, { recursive: true });
|
|
2097
|
+
writeFileSync5(
|
|
2098
|
+
laneMetaPath(trellisDir, meta.id),
|
|
2099
|
+
JSON.stringify(meta, null, 2) + "\n"
|
|
2100
|
+
);
|
|
2012
2101
|
}
|
|
2013
2102
|
function listLaneIds(trellisDir) {
|
|
2014
2103
|
const root = lanesRoot(trellisDir);
|
|
2015
|
-
if (!existsSync5(root))
|
|
2016
|
-
return [];
|
|
2104
|
+
if (!existsSync5(root)) return [];
|
|
2017
2105
|
return readdirSync(root, { withFileTypes: true }).filter((d) => d.isDirectory() && d.name.startsWith("lane-")).map((d) => d.name);
|
|
2018
2106
|
}
|
|
2019
2107
|
function resolveLaneHeadFromJournal(meta, laneOps) {
|
|
2020
2108
|
return laneOps.at(-1)?.hash ?? meta.headOpHash ?? meta.baseOpHash;
|
|
2021
2109
|
}
|
|
2022
2110
|
function createLaneMeta(trellisDir, params) {
|
|
2023
|
-
const now = new Date().toISOString();
|
|
2111
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2024
2112
|
const meta = {
|
|
2025
2113
|
id: newLaneId(),
|
|
2026
2114
|
status: "active",
|
|
@@ -2045,15 +2133,81 @@ function createLaneMeta(trellisDir, params) {
|
|
|
2045
2133
|
}
|
|
2046
2134
|
function updateLaneHead(trellisDir, laneId, headOpHash) {
|
|
2047
2135
|
const meta = loadLaneMeta(trellisDir, laneId);
|
|
2048
|
-
if (!meta)
|
|
2049
|
-
return;
|
|
2136
|
+
if (!meta) return;
|
|
2050
2137
|
meta.headOpHash = headOpHash;
|
|
2051
|
-
meta.updatedAt = new Date().toISOString();
|
|
2138
|
+
meta.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2052
2139
|
saveLaneMeta(trellisDir, meta);
|
|
2053
2140
|
}
|
|
2054
2141
|
function listLaneMetas(trellisDir) {
|
|
2055
|
-
return listLaneIds(trellisDir).map((id) => loadLaneMeta(trellisDir, id)).filter((m) => m !==
|
|
2142
|
+
return listLaneIds(trellisDir).map((id) => loadLaneMeta(trellisDir, id)).filter((m) => m !== void 0);
|
|
2056
2143
|
}
|
|
2057
|
-
var init_lane = (
|
|
2144
|
+
var init_lane = __esm({
|
|
2145
|
+
"src/vcs/lane.ts"() {
|
|
2146
|
+
"use strict";
|
|
2147
|
+
}
|
|
2148
|
+
});
|
|
2058
2149
|
|
|
2059
|
-
export {
|
|
2150
|
+
export {
|
|
2151
|
+
decompose,
|
|
2152
|
+
init_decompose,
|
|
2153
|
+
BlobStore,
|
|
2154
|
+
init_blob_store,
|
|
2155
|
+
shouldAdvanceBranchHead,
|
|
2156
|
+
getBranchHeadOpHash,
|
|
2157
|
+
createBranch,
|
|
2158
|
+
switchBranch,
|
|
2159
|
+
listBranches,
|
|
2160
|
+
deleteBranch,
|
|
2161
|
+
saveBranchState,
|
|
2162
|
+
loadBranchState,
|
|
2163
|
+
init_branch,
|
|
2164
|
+
createMilestone,
|
|
2165
|
+
listMilestones,
|
|
2166
|
+
init_milestone,
|
|
2167
|
+
createCheckpoint,
|
|
2168
|
+
listCheckpoints,
|
|
2169
|
+
init_checkpoint,
|
|
2170
|
+
diffFileStates,
|
|
2171
|
+
buildFileStateAtOp,
|
|
2172
|
+
diffOpRange,
|
|
2173
|
+
generateUnifiedDiff,
|
|
2174
|
+
myersDiff,
|
|
2175
|
+
init_diff,
|
|
2176
|
+
threeWayMerge,
|
|
2177
|
+
threeWayTextMerge,
|
|
2178
|
+
init_merge,
|
|
2179
|
+
createIssue,
|
|
2180
|
+
updateIssue,
|
|
2181
|
+
startIssue,
|
|
2182
|
+
pauseIssue,
|
|
2183
|
+
resumeIssue,
|
|
2184
|
+
closeIssue,
|
|
2185
|
+
triageIssue,
|
|
2186
|
+
reopenIssue,
|
|
2187
|
+
assignIssue,
|
|
2188
|
+
blockIssue,
|
|
2189
|
+
unblockIssue,
|
|
2190
|
+
addCriterion,
|
|
2191
|
+
setCriterionStatus,
|
|
2192
|
+
runCriteria,
|
|
2193
|
+
listIssues,
|
|
2194
|
+
getIssue,
|
|
2195
|
+
getActiveIssues,
|
|
2196
|
+
checkCompletionReadiness,
|
|
2197
|
+
init_issue,
|
|
2198
|
+
JsonOpLog,
|
|
2199
|
+
LaneOpLog,
|
|
2200
|
+
init_op_log,
|
|
2201
|
+
lanesRoot,
|
|
2202
|
+
laneDir,
|
|
2203
|
+
laneMetaPath,
|
|
2204
|
+
newLaneId,
|
|
2205
|
+
loadLaneMeta,
|
|
2206
|
+
saveLaneMeta,
|
|
2207
|
+
listLaneIds,
|
|
2208
|
+
resolveLaneHeadFromJournal,
|
|
2209
|
+
createLaneMeta,
|
|
2210
|
+
updateLaneHead,
|
|
2211
|
+
listLaneMetas,
|
|
2212
|
+
init_lane
|
|
2213
|
+
};
|