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
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {
|
|
2
|
+
inferProjectContext,
|
|
3
|
+
init_infer,
|
|
4
|
+
init_profile,
|
|
5
|
+
init_write,
|
|
6
|
+
loadProfile
|
|
7
|
+
} from "./chunk-LHOVJEWR.js";
|
|
8
|
+
|
|
9
|
+
// src/scaffold/seed.ts
|
|
10
|
+
init_profile();
|
|
11
|
+
init_infer();
|
|
12
|
+
import { existsSync, writeFileSync } from "fs";
|
|
13
|
+
import { join } from "path";
|
|
14
|
+
async function seedContext(opts) {
|
|
15
|
+
const { rootPath, ide = "none", force = false } = opts;
|
|
16
|
+
const filesUpdated = [];
|
|
17
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
18
|
+
const profile = loadProfile();
|
|
19
|
+
const context = await inferProjectContext(rootPath);
|
|
20
|
+
const agentsDir = join(rootPath, ".trellis", "agents");
|
|
21
|
+
if (existsSync(agentsDir)) {
|
|
22
|
+
const agentsMdPath = join(agentsDir, "AGENTS.md");
|
|
23
|
+
if (existsSync(agentsMdPath) || force) {
|
|
24
|
+
const content = renderSeedAgentsMd(profile, context, timestamp);
|
|
25
|
+
writeFileSync(agentsMdPath, content, "utf-8");
|
|
26
|
+
filesUpdated.push(".trellis/agents/AGENTS.md");
|
|
27
|
+
}
|
|
28
|
+
const agentContextPath = join(agentsDir, "agent-context.json");
|
|
29
|
+
if (existsSync(agentContextPath) || force) {
|
|
30
|
+
const config = {
|
|
31
|
+
domain: context.domain,
|
|
32
|
+
ecosystem: context.ecosystem,
|
|
33
|
+
tools: [],
|
|
34
|
+
ontologies: [],
|
|
35
|
+
generatedAt: timestamp,
|
|
36
|
+
confidence: context.confidence,
|
|
37
|
+
lastSeed: timestamp
|
|
38
|
+
};
|
|
39
|
+
writeFileSync(
|
|
40
|
+
agentContextPath,
|
|
41
|
+
JSON.stringify(config, null, 2),
|
|
42
|
+
"utf-8"
|
|
43
|
+
);
|
|
44
|
+
filesUpdated.push(".trellis/agents/agent-context.json");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
switch (ide) {
|
|
48
|
+
case "cursor": {
|
|
49
|
+
const cursorRulesPath = join(rootPath, ".cursor", "rules.md");
|
|
50
|
+
if (existsSync(cursorRulesPath) || force) {
|
|
51
|
+
const content = renderSeedIdeRules(profile, context, "cursor", timestamp);
|
|
52
|
+
writeFileSync(cursorRulesPath, content, "utf-8");
|
|
53
|
+
filesUpdated.push(".cursor/rules.md");
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case "windsurf": {
|
|
58
|
+
const windsurfRulesPath = join(rootPath, ".windsurf", "rules.md");
|
|
59
|
+
if (existsSync(windsurfRulesPath) || force) {
|
|
60
|
+
const content = renderSeedIdeRules(profile, context, "windsurf", timestamp);
|
|
61
|
+
writeFileSync(windsurfRulesPath, content, "utf-8");
|
|
62
|
+
filesUpdated.push(".windsurf/rules.md");
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "claude": {
|
|
67
|
+
const claudeSettingsPath = join(rootPath, ".claude", "settings.md");
|
|
68
|
+
if (existsSync(claudeSettingsPath) || force) {
|
|
69
|
+
const content = renderSeedIdeRules(profile, context, "claude", timestamp);
|
|
70
|
+
writeFileSync(claudeSettingsPath, content, "utf-8");
|
|
71
|
+
filesUpdated.push(".claude/settings.md");
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case "none":
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
success: true,
|
|
80
|
+
filesUpdated,
|
|
81
|
+
timestamp
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function renderSeedAgentsMd(profile, context, timestamp) {
|
|
85
|
+
const userName = profile?.name ?? "the user";
|
|
86
|
+
const userBio = profile?.bio ?? "(not provided)";
|
|
87
|
+
const userSkills = profile?.skills?.length ? profile.skills.join(", ") : "(not specified)";
|
|
88
|
+
return `# Trellis Agent Context
|
|
89
|
+
|
|
90
|
+
> This file was seeded by \`trellis seed\` on ${timestamp}
|
|
91
|
+
> Inference confidence: **${context.confidence}**
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## About the User
|
|
96
|
+
|
|
97
|
+
| Field | Value |
|
|
98
|
+
|-------|-------|
|
|
99
|
+
| **Name** | ${userName} |
|
|
100
|
+
| **Bio** | ${userBio} |
|
|
101
|
+
| **Skills** | ${userSkills} |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## About This Project
|
|
106
|
+
|
|
107
|
+
| Field | Value |
|
|
108
|
+
|-------|-------|
|
|
109
|
+
| **Name** | ${context.name ?? "(unnamed)"} |
|
|
110
|
+
| **Domain** | ${context.domain ?? "(not determined)"} |
|
|
111
|
+
| **Description** | ${context.description ?? "(no description found)"} |
|
|
112
|
+
| **Ecosystem** | ${context.ecosystem ?? "unknown"} |
|
|
113
|
+
| **File count** | ~${context.fileCount} |
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Agent Instructions
|
|
118
|
+
|
|
119
|
+
You are operating in a Trellis-tracked repository. Follow these guidelines:
|
|
120
|
+
|
|
121
|
+
1. **Read \`agent-context.json\`** in this directory for registered tools, ontologies, and domain settings.
|
|
122
|
+
2. **Check \`skills/\`** for domain-specific operating instructions relevant to this project.
|
|
123
|
+
3. **Check \`workflows/\`** for repeatable task procedures.
|
|
124
|
+
4. **Run \`trellis seed\`** to refresh this context file when the project evolves.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Quick Reference
|
|
129
|
+
|
|
130
|
+
\`\`\`bash
|
|
131
|
+
trellis status # Current repo state
|
|
132
|
+
trellis log # Causal operation history
|
|
133
|
+
trellis seed # Refresh this context
|
|
134
|
+
trellis milestone # Create narrative checkpoints
|
|
135
|
+
\`\`\`
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
function renderSeedIdeRules(profile, context, ide, timestamp) {
|
|
139
|
+
const ideName = ide.charAt(0).toUpperCase() + ide.slice(1);
|
|
140
|
+
const projectName = context.name ?? "this project";
|
|
141
|
+
return `# ${ideName} Rules for ${projectName}
|
|
142
|
+
|
|
143
|
+
> Generated by \`trellis seed\` on ${timestamp}
|
|
144
|
+
|
|
145
|
+
## Project Context
|
|
146
|
+
- **Domain**: ${context.domain ?? "(not determined)"}
|
|
147
|
+
- **Ecosystem**: ${context.ecosystem ?? "unknown"}
|
|
148
|
+
- **File count**: ~${context.fileCount}
|
|
149
|
+
- **Confidence**: ${context.confidence}
|
|
150
|
+
|
|
151
|
+
## Agent Instructions
|
|
152
|
+
You are working in a Trellis-tracked repository. See \`.trellis/agents/AGENTS.md\` for full context.
|
|
153
|
+
|
|
154
|
+
## Commands
|
|
155
|
+
- \`trellis status\` \u2014 Check repo state
|
|
156
|
+
- \`trellis seed\` \u2014 Refresh this context file
|
|
157
|
+
- \`trellis log\` \u2014 View causal history
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
*Auto-generated by Trellis. Run \`trellis seed\` to refresh context.*
|
|
161
|
+
`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// src/scaffold/index.ts
|
|
165
|
+
init_infer();
|
|
166
|
+
init_profile();
|
|
167
|
+
init_write();
|
|
168
|
+
|
|
169
|
+
export {
|
|
170
|
+
seedContext
|
|
171
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/server/sprites.ts
|
|
2
|
+
import { execFile, spawn } from "child_process";
|
|
3
|
+
import { promisify } from "util";
|
|
4
|
+
var execFileAsync = promisify(execFile);
|
|
5
|
+
async function runSpriteCmd(args) {
|
|
6
|
+
try {
|
|
7
|
+
const { stdout } = await execFileAsync("sprite", args);
|
|
8
|
+
return stdout.trim();
|
|
9
|
+
} catch (err) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
`sprite ${args[0]} failed (exit ${err.code ?? "?"}): ${err.stderr ?? err.message}`
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
async function runSpriteCopy(localPath, spriteName, remotePath) {
|
|
16
|
+
try {
|
|
17
|
+
await execFileAsync("sprite", [
|
|
18
|
+
"cp",
|
|
19
|
+
localPath,
|
|
20
|
+
`${spriteName}:${remotePath}`
|
|
21
|
+
]);
|
|
22
|
+
} catch (err) {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`sprite cp failed (exit ${err.code ?? "?"}): ${err.stderr ?? err.message}`
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function runSpriteInteractive(args) {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
const proc = spawn("sprite", args, { stdio: "inherit" });
|
|
31
|
+
proc.on("close", (code) => {
|
|
32
|
+
if (code !== 0)
|
|
33
|
+
reject(new Error(`sprite ${args[0]} failed (exit ${code})`));
|
|
34
|
+
else resolve();
|
|
35
|
+
});
|
|
36
|
+
proc.on("error", reject);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function assertSpriteCli() {
|
|
40
|
+
await runSpriteCmd(["--version"]).catch(() => {
|
|
41
|
+
throw new Error(
|
|
42
|
+
"`sprite` CLI not found. Install it from https://docs.sprites.dev and authenticate."
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function resolveSprite(explicitName) {
|
|
47
|
+
if (explicitName) {
|
|
48
|
+
return explicitName;
|
|
49
|
+
}
|
|
50
|
+
throw new Error(
|
|
51
|
+
"No sprite specified. Use --sprite <name> or set an active sprite with `trellis vm use <name>`"
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
runSpriteCmd,
|
|
57
|
+
runSpriteCopy,
|
|
58
|
+
runSpriteInteractive,
|
|
59
|
+
assertSpriteCli,
|
|
60
|
+
resolveSprite
|
|
61
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "./chunk-KFQGP6VL.js";
|
|
4
|
+
|
|
5
|
+
// src/core/persist/factory.ts
|
|
6
|
+
async function createKernelBackend(dbPath, opts = {}) {
|
|
7
|
+
const choice = opts.backend ?? detectBackend();
|
|
8
|
+
if (choice === "better-sqlite") {
|
|
9
|
+
const { BetterSqliteKernelBackend } = await import("./better-sqlite-backend-2P4F6AOJ.js");
|
|
10
|
+
const backend2 = new BetterSqliteKernelBackend(dbPath);
|
|
11
|
+
backend2.init();
|
|
12
|
+
return backend2;
|
|
13
|
+
}
|
|
14
|
+
const { SqlJsKernelBackend } = await import("./core/persist/sqljs-backend.js");
|
|
15
|
+
const backend = await SqlJsKernelBackend.create({
|
|
16
|
+
dbPath,
|
|
17
|
+
autoFlushEvery: opts.sqljs?.autoFlushEvery
|
|
18
|
+
});
|
|
19
|
+
backend.init();
|
|
20
|
+
return backend;
|
|
21
|
+
}
|
|
22
|
+
function detectBackend() {
|
|
23
|
+
try {
|
|
24
|
+
const { createRequire } = __require("module");
|
|
25
|
+
const req = createRequire(import.meta.url);
|
|
26
|
+
req("better-sqlite3");
|
|
27
|
+
return "better-sqlite";
|
|
28
|
+
} catch {
|
|
29
|
+
return "sqljs";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
createKernelBackend
|
|
35
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
bindingEntityId
|
|
3
|
+
} from "./chunk-5CINODKT.js";
|
|
4
|
+
|
|
5
|
+
// src/schema/eql.ts
|
|
6
|
+
function escapeValue(v) {
|
|
7
|
+
return v.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
8
|
+
}
|
|
9
|
+
function entitiesQuery(type, where) {
|
|
10
|
+
const conds = [`type = "${escapeValue(type)}"`];
|
|
11
|
+
for (const [k, v] of Object.entries(where ?? {})) {
|
|
12
|
+
if (v === void 0 || v === null) continue;
|
|
13
|
+
conds.push(`${k} = "${escapeValue(String(v))}"`);
|
|
14
|
+
}
|
|
15
|
+
return `find ?e where ${conds.join(" and ")}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/schema/resolve.ts
|
|
19
|
+
function isNestedResolveSpec(v) {
|
|
20
|
+
return typeof v === "object" && v !== null;
|
|
21
|
+
}
|
|
22
|
+
function relationTargetName(r) {
|
|
23
|
+
return typeof r.target === "string" ? r.target : r.target().type;
|
|
24
|
+
}
|
|
25
|
+
function relationTargetSchema(r) {
|
|
26
|
+
return typeof r.target === "string" ? null : r.target();
|
|
27
|
+
}
|
|
28
|
+
function inverseForeignKey(parent, relationName, child) {
|
|
29
|
+
for (const [key, r] of Object.entries(child.relations)) {
|
|
30
|
+
if (relationTargetName(r) === parent.type) return key;
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
async function loadByIds(client, ids, cache) {
|
|
35
|
+
const missing = ids.filter((id) => !cache.has(id));
|
|
36
|
+
if (missing.length === 0) return;
|
|
37
|
+
await Promise.all(
|
|
38
|
+
missing.map(async (id) => {
|
|
39
|
+
cache.set(id, await client.read(id));
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
async function resolveReverseMany(client, parent, relationName, parents, cache) {
|
|
44
|
+
const rel = parent.relations[relationName];
|
|
45
|
+
if (!rel || rel.cardinality !== "many") return;
|
|
46
|
+
const childSchema = relationTargetSchema(rel);
|
|
47
|
+
if (!childSchema) return;
|
|
48
|
+
const foreignKey = inverseForeignKey(parent, relationName, childSchema);
|
|
49
|
+
if (!foreignKey) return;
|
|
50
|
+
const parentIds = new Set(parents.map((p) => p.id));
|
|
51
|
+
const qr = await client.query(entitiesQuery(childSchema.type));
|
|
52
|
+
const childIds = qr.bindings.map((b) => bindingEntityId(b)).filter((id) => Boolean(id));
|
|
53
|
+
await loadByIds(client, childIds, cache);
|
|
54
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
55
|
+
for (const id of childIds) {
|
|
56
|
+
const child = cache.get(id);
|
|
57
|
+
if (!child) continue;
|
|
58
|
+
const fk = child[foreignKey];
|
|
59
|
+
if (typeof fk !== "string" || !parentIds.has(fk)) continue;
|
|
60
|
+
if (!grouped.has(fk)) grouped.set(fk, []);
|
|
61
|
+
grouped.get(fk).push(child);
|
|
62
|
+
}
|
|
63
|
+
for (const row of parents) {
|
|
64
|
+
row[relationName] = grouped.get(row.id) ?? [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async function resolveForwardOne(client, parents, relationName, cache) {
|
|
68
|
+
const ids = parents.map((p) => p[relationName]).filter((v) => typeof v === "string" && v.length > 0);
|
|
69
|
+
await loadByIds(client, ids, cache);
|
|
70
|
+
for (const row of parents) {
|
|
71
|
+
const ref = row[relationName];
|
|
72
|
+
if (typeof ref !== "string") continue;
|
|
73
|
+
const loaded = cache.get(ref);
|
|
74
|
+
if (loaded) row[relationName] = loaded;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function resolveRelations(client, schema, entities, spec, opts) {
|
|
78
|
+
if (entities.length === 0 || Object.keys(spec).length === 0) return entities;
|
|
79
|
+
const cache = /* @__PURE__ */ new Map();
|
|
80
|
+
const rows = opts?.copy === false ? entities : entities.map((e) => ({ ...e }));
|
|
81
|
+
for (const [name, enabled] of Object.entries(spec)) {
|
|
82
|
+
if (!enabled) continue;
|
|
83
|
+
const rel = schema.relations[name];
|
|
84
|
+
if (!rel) continue;
|
|
85
|
+
if (rel.cardinality === "many") {
|
|
86
|
+
await resolveReverseMany(client, schema, name, rows, cache);
|
|
87
|
+
if (isNestedResolveSpec(enabled)) {
|
|
88
|
+
const childSchema = relationTargetSchema(rel);
|
|
89
|
+
if (childSchema) {
|
|
90
|
+
for (const row of rows) {
|
|
91
|
+
const kids = row[name];
|
|
92
|
+
if (kids?.length) {
|
|
93
|
+
await resolveRelations(client, childSchema, kids, enabled, {
|
|
94
|
+
copy: false
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
} else if (isNestedResolveSpec(enabled)) {
|
|
101
|
+
await resolveForwardOne(client, rows, name, cache);
|
|
102
|
+
const childSchema = relationTargetSchema(rel);
|
|
103
|
+
if (childSchema) {
|
|
104
|
+
const nested = [];
|
|
105
|
+
for (const row of rows) {
|
|
106
|
+
const loaded = row[name];
|
|
107
|
+
if (loaded && typeof loaded === "object" && "id" in loaded) {
|
|
108
|
+
nested.push(loaded);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (nested.length) {
|
|
112
|
+
await resolveRelations(client, childSchema, nested, enabled, {
|
|
113
|
+
copy: false
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
await resolveForwardOne(client, rows, name, cache);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return rows;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
escapeValue,
|
|
126
|
+
entitiesQuery,
|
|
127
|
+
inverseForeignKey,
|
|
128
|
+
resolveRelations
|
|
129
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runSpriteCmd,
|
|
3
|
+
runSpriteCopy
|
|
4
|
+
} from "./chunk-FF36CQHZ.js";
|
|
5
|
+
import {
|
|
6
|
+
updateConfig
|
|
7
|
+
} from "./chunk-JA7AIHRK.js";
|
|
8
|
+
import {
|
|
9
|
+
__require
|
|
10
|
+
} from "./chunk-KFQGP6VL.js";
|
|
11
|
+
|
|
12
|
+
// src/server/deploy.ts
|
|
13
|
+
import { existsSync, writeFileSync, mkdirSync } from "fs";
|
|
14
|
+
import { join, resolve } from "path";
|
|
15
|
+
async function deploy(opts) {
|
|
16
|
+
const { name, port = 3e3, configDir = ".", onProgress = () => {
|
|
17
|
+
} } = opts;
|
|
18
|
+
const apiKey = opts.apiKey ?? generateSecret("spk_");
|
|
19
|
+
const jwtSecret = opts.jwtSecret ?? generateSecret("jws_");
|
|
20
|
+
const url = `https://${name}.sprites.app`;
|
|
21
|
+
onProgress("Checking Sprites CLI...");
|
|
22
|
+
await runSpriteCmd(["--version"]).catch(() => {
|
|
23
|
+
throw new Error(
|
|
24
|
+
"`sprite` CLI not found. Install it from https://docs.sprites.dev and authenticate."
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
onProgress("Writing server entrypoint...");
|
|
28
|
+
const tmpDir = resolve(configDir, ".trellis-deploy");
|
|
29
|
+
if (!existsSync(tmpDir)) mkdirSync(tmpDir, { recursive: true });
|
|
30
|
+
const entrypoint = join(tmpDir, "server-entry.ts");
|
|
31
|
+
writeFileSync(
|
|
32
|
+
entrypoint,
|
|
33
|
+
generateServerEntrypoint({ port, apiKey, jwtSecret })
|
|
34
|
+
);
|
|
35
|
+
onProgress("Bundling server with Bun...");
|
|
36
|
+
const bundlePath = join(tmpDir, "server.js");
|
|
37
|
+
await runBun([
|
|
38
|
+
"build",
|
|
39
|
+
entrypoint,
|
|
40
|
+
"--outfile",
|
|
41
|
+
bundlePath,
|
|
42
|
+
"--target",
|
|
43
|
+
"bun",
|
|
44
|
+
"--format",
|
|
45
|
+
"esm"
|
|
46
|
+
]);
|
|
47
|
+
onProgress(`Uploading to Sprite: ${name}...`);
|
|
48
|
+
await runSpriteCmd([
|
|
49
|
+
"exec",
|
|
50
|
+
"--sprite",
|
|
51
|
+
name,
|
|
52
|
+
"mkdir",
|
|
53
|
+
"-p",
|
|
54
|
+
"/home/sprite/trellis-db"
|
|
55
|
+
]);
|
|
56
|
+
await runSpriteCopy(bundlePath, name, "/home/sprite/trellis-db/server.js");
|
|
57
|
+
onProgress("Ensuring Bun is installed...");
|
|
58
|
+
await runSpriteCmd([
|
|
59
|
+
"exec",
|
|
60
|
+
"--sprite",
|
|
61
|
+
name,
|
|
62
|
+
"bash",
|
|
63
|
+
"-c",
|
|
64
|
+
"which bun || curl -fsSL https://bun.sh/install | bash"
|
|
65
|
+
]).catch(() => {
|
|
66
|
+
});
|
|
67
|
+
onProgress("Starting server...");
|
|
68
|
+
await runSpriteCmd([
|
|
69
|
+
"exec",
|
|
70
|
+
"--sprite",
|
|
71
|
+
name,
|
|
72
|
+
"bash",
|
|
73
|
+
"-c",
|
|
74
|
+
"sprite sessions list 2>/dev/null | grep trellis-db | awk '{print $1}' | xargs -r sprite sessions kill"
|
|
75
|
+
]).catch(() => {
|
|
76
|
+
});
|
|
77
|
+
await runSpriteCmd([
|
|
78
|
+
"exec",
|
|
79
|
+
"--sprite",
|
|
80
|
+
name,
|
|
81
|
+
"-tty",
|
|
82
|
+
"--detach",
|
|
83
|
+
"--session-name",
|
|
84
|
+
"trellis-db",
|
|
85
|
+
"bash",
|
|
86
|
+
"-c",
|
|
87
|
+
`cd /home/sprite/trellis-db && ~/.bun/bin/bun run server.js`
|
|
88
|
+
]);
|
|
89
|
+
onProgress("Writing .trellis-db.json...");
|
|
90
|
+
updateConfig(
|
|
91
|
+
{
|
|
92
|
+
mode: "remote",
|
|
93
|
+
url,
|
|
94
|
+
apiKey,
|
|
95
|
+
spriteName: name,
|
|
96
|
+
deployedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
97
|
+
},
|
|
98
|
+
configDir
|
|
99
|
+
);
|
|
100
|
+
return { url, name, apiKey };
|
|
101
|
+
}
|
|
102
|
+
function generateSecret(prefix) {
|
|
103
|
+
const bytes = new Uint8Array(24);
|
|
104
|
+
crypto.getRandomValues(bytes);
|
|
105
|
+
const b64 = btoa(String.fromCharCode(...bytes)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
106
|
+
return `${prefix}${b64}`;
|
|
107
|
+
}
|
|
108
|
+
async function runBun(args) {
|
|
109
|
+
const { execFile } = __require("child_process");
|
|
110
|
+
const { promisify } = __require("util");
|
|
111
|
+
const execFileAsync = promisify(execFile);
|
|
112
|
+
try {
|
|
113
|
+
await execFileAsync("bun", args);
|
|
114
|
+
} catch (err) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`bun ${args[0]} failed (exit ${err.code ?? "?"}): ${err.stderr ?? err.message}`
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function generateServerEntrypoint(opts) {
|
|
121
|
+
return `
|
|
122
|
+
import { TenantPool, startServer } from 'trellis/server';
|
|
123
|
+
import { readConfig, defaultLocalConfig, writeConfig } from 'trellis/client';
|
|
124
|
+
import { join } from 'path';
|
|
125
|
+
import { existsSync } from 'fs';
|
|
126
|
+
|
|
127
|
+
const dbPath = '/home/sprite/trellis-db/data';
|
|
128
|
+
const configDir = '/home/sprite/trellis-db';
|
|
129
|
+
|
|
130
|
+
if (!existsSync(join(configDir, '.trellis-db.json'))) {
|
|
131
|
+
writeConfig(defaultLocalConfig(dbPath, {
|
|
132
|
+
apiKey: '${opts.apiKey}',
|
|
133
|
+
jwtSecret: '${opts.jwtSecret}',
|
|
134
|
+
port: ${opts.port},
|
|
135
|
+
}), configDir);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const config = readConfig(configDir)!;
|
|
139
|
+
const pool = new TenantPool(dbPath);
|
|
140
|
+
|
|
141
|
+
const server = startServer({ port: ${opts.port}, config, pool });
|
|
142
|
+
|
|
143
|
+
console.log('Trellis DB running on port ${opts.port}');
|
|
144
|
+
console.log('URL: https://\${process.env.SPRITE_NAME ?? 'localhost'}.sprites.app');
|
|
145
|
+
`;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export {
|
|
149
|
+
deploy
|
|
150
|
+
};
|