daigram 0.0.0-stage → 0.1.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/LICENSE +661 -0
- package/LICENSE-MIT +21 -0
- package/NOTICE +11 -0
- package/README.md +788 -2
- package/assets/fonts/CascadiaCode-Regular.ttf +0 -0
- package/assets/fonts/Excalifont-Regular.ttf +0 -0
- package/assets/fonts/LICENSES.md +63 -0
- package/assets/fonts/LiberationSans-Regular.ttf +0 -0
- package/assets/fonts/Virgil-Regular.ttf +0 -0
- package/dist/ai/config.d.ts +11 -0
- package/dist/ai/config.d.ts.map +1 -0
- package/dist/ai/config.js +59 -0
- package/dist/ai/config.js.map +1 -0
- package/dist/ai/providers/anthropic.d.ts +3 -0
- package/dist/ai/providers/anthropic.d.ts.map +1 -0
- package/dist/ai/providers/anthropic.js +71 -0
- package/dist/ai/providers/anthropic.js.map +1 -0
- package/dist/ai/providers/openai-compatible.d.ts +3 -0
- package/dist/ai/providers/openai-compatible.d.ts.map +1 -0
- package/dist/ai/providers/openai-compatible.js +95 -0
- package/dist/ai/providers/openai-compatible.js.map +1 -0
- package/dist/ai/request-settings.d.ts +9 -0
- package/dist/ai/request-settings.d.ts.map +1 -0
- package/dist/ai/request-settings.js +56 -0
- package/dist/ai/request-settings.js.map +1 -0
- package/dist/ai/routes.d.ts +7 -0
- package/dist/ai/routes.d.ts.map +1 -0
- package/dist/ai/routes.js +192 -0
- package/dist/ai/routes.js.map +1 -0
- package/dist/ai/runner.d.ts +19 -0
- package/dist/ai/runner.d.ts.map +1 -0
- package/dist/ai/runner.js +77 -0
- package/dist/ai/runner.js.map +1 -0
- package/dist/ai/sse.d.ts +4 -0
- package/dist/ai/sse.d.ts.map +1 -0
- package/dist/ai/sse.js +53 -0
- package/dist/ai/sse.js.map +1 -0
- package/dist/ai/system.d.ts +2 -0
- package/dist/ai/system.d.ts.map +1 -0
- package/dist/ai/system.js +17 -0
- package/dist/ai/system.js.map +1 -0
- package/dist/ai/tools.d.ts +10 -0
- package/dist/ai/tools.d.ts.map +1 -0
- package/dist/ai/tools.js +134 -0
- package/dist/ai/tools.js.map +1 -0
- package/dist/ai/types.d.ts +72 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +52 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli/args.d.ts +15 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +78 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands/ai.d.ts +2 -0
- package/dist/cli/commands/ai.d.ts.map +1 -0
- package/dist/cli/commands/ai.js +45 -0
- package/dist/cli/commands/ai.js.map +1 -0
- package/dist/cli/commands/arrange.d.ts +2 -0
- package/dist/cli/commands/arrange.d.ts.map +1 -0
- package/dist/cli/commands/arrange.js +103 -0
- package/dist/cli/commands/arrange.js.map +1 -0
- package/dist/cli/commands/canvases.d.ts +2 -0
- package/dist/cli/commands/canvases.d.ts.map +1 -0
- package/dist/cli/commands/canvases.js +38 -0
- package/dist/cli/commands/canvases.js.map +1 -0
- package/dist/cli/commands/check.d.ts +2 -0
- package/dist/cli/commands/check.d.ts.map +1 -0
- package/dist/cli/commands/check.js +15 -0
- package/dist/cli/commands/check.js.map +1 -0
- package/dist/cli/commands/comment.d.ts +2 -0
- package/dist/cli/commands/comment.d.ts.map +1 -0
- package/dist/cli/commands/comment.js +76 -0
- package/dist/cli/commands/comment.js.map +1 -0
- package/dist/cli/commands/elements.d.ts +8 -0
- package/dist/cli/commands/elements.d.ts.map +1 -0
- package/dist/cli/commands/elements.js +285 -0
- package/dist/cli/commands/elements.js.map +1 -0
- package/dist/cli/commands/frame.d.ts +2 -0
- package/dist/cli/commands/frame.d.ts.map +1 -0
- package/dist/cli/commands/frame.js +58 -0
- package/dist/cli/commands/frame.js.map +1 -0
- package/dist/cli/commands/install-skill.d.ts +2 -0
- package/dist/cli/commands/install-skill.d.ts.map +1 -0
- package/dist/cli/commands/install-skill.js +108 -0
- package/dist/cli/commands/install-skill.js.map +1 -0
- package/dist/cli/commands/layout.d.ts +2 -0
- package/dist/cli/commands/layout.d.ts.map +1 -0
- package/dist/cli/commands/layout.js +15 -0
- package/dist/cli/commands/layout.js.map +1 -0
- package/dist/cli/commands/render.d.ts +2 -0
- package/dist/cli/commands/render.d.ts.map +1 -0
- package/dist/cli/commands/render.js +64 -0
- package/dist/cli/commands/render.js.map +1 -0
- package/dist/cli/commands/scene.d.ts +8 -0
- package/dist/cli/commands/scene.d.ts.map +1 -0
- package/dist/cli/commands/scene.js +147 -0
- package/dist/cli/commands/scene.js.map +1 -0
- package/dist/cli/commands/server.d.ts +4 -0
- package/dist/cli/commands/server.d.ts.map +1 -0
- package/dist/cli/commands/server.js +66 -0
- package/dist/cli/commands/server.js.map +1 -0
- package/dist/cli/commands/snapshot.d.ts +2 -0
- package/dist/cli/commands/snapshot.d.ts.map +1 -0
- package/dist/cli/commands/snapshot.js +41 -0
- package/dist/cli/commands/snapshot.js.map +1 -0
- package/dist/cli/image-options.d.ts +43 -0
- package/dist/cli/image-options.d.ts.map +1 -0
- package/dist/cli/image-options.js +71 -0
- package/dist/cli/image-options.js.map +1 -0
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +115 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/util.d.ts +5 -0
- package/dist/cli/util.d.ts.map +1 -0
- package/dist/cli/util.js +35 -0
- package/dist/cli/util.js.map +1 -0
- package/dist/core/arrow-routing.d.ts +31 -0
- package/dist/core/arrow-routing.d.ts.map +1 -0
- package/dist/core/arrow-routing.js +244 -0
- package/dist/core/arrow-routing.js.map +1 -0
- package/dist/core/bulk-ops.d.ts +55 -0
- package/dist/core/bulk-ops.d.ts.map +1 -0
- package/dist/core/bulk-ops.js +181 -0
- package/dist/core/bulk-ops.js.map +1 -0
- package/dist/core/canvas-client.d.ts +110 -0
- package/dist/core/canvas-client.d.ts.map +1 -0
- package/dist/core/canvas-client.js +416 -0
- package/dist/core/canvas-client.js.map +1 -0
- package/dist/core/canvas-id.d.ts +4 -0
- package/dist/core/canvas-id.d.ts.map +1 -0
- package/dist/core/canvas-id.js +5 -0
- package/dist/core/canvas-id.js.map +1 -0
- package/dist/core/canvas-persistence.d.ts +30 -0
- package/dist/core/canvas-persistence.d.ts.map +1 -0
- package/dist/core/canvas-persistence.js +854 -0
- package/dist/core/canvas-persistence.js.map +1 -0
- package/dist/core/canvas-registry.d.ts +36 -0
- package/dist/core/canvas-registry.d.ts.map +1 -0
- package/dist/core/canvas-registry.js +161 -0
- package/dist/core/canvas-registry.js.map +1 -0
- package/dist/core/canvas-routes.d.ts +5 -0
- package/dist/core/canvas-routes.d.ts.map +1 -0
- package/dist/core/canvas-routes.js +29 -0
- package/dist/core/canvas-routes.js.map +1 -0
- package/dist/core/canvas-state.d.ts +14 -0
- package/dist/core/canvas-state.d.ts.map +1 -0
- package/dist/core/canvas-state.js +20 -0
- package/dist/core/canvas-state.js.map +1 -0
- package/dist/core/canvas.d.ts +13 -0
- package/dist/core/canvas.d.ts.map +1 -0
- package/dist/core/canvas.js +4 -0
- package/dist/core/canvas.js.map +1 -0
- package/dist/core/comment-ops.d.ts +3 -0
- package/dist/core/comment-ops.d.ts.map +1 -0
- package/dist/core/comment-ops.js +36 -0
- package/dist/core/comment-ops.js.map +1 -0
- package/dist/core/comments.d.ts +5 -0
- package/dist/core/comments.d.ts.map +1 -0
- package/dist/core/comments.js +137 -0
- package/dist/core/comments.js.map +1 -0
- package/dist/core/compact.d.ts +13 -0
- package/dist/core/compact.d.ts.map +1 -0
- package/dist/core/compact.js +20 -0
- package/dist/core/compact.js.map +1 -0
- package/dist/core/config.d.ts +8 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +18 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/describe.d.ts +3 -0
- package/dist/core/describe.d.ts.map +1 -0
- package/dist/core/describe.js +94 -0
- package/dist/core/describe.js.map +1 -0
- package/dist/core/design-guide.d.ts +2 -0
- package/dist/core/design-guide.d.ts.map +1 -0
- package/dist/core/design-guide.js +115 -0
- package/dist/core/design-guide.js.map +1 -0
- package/dist/core/diagram-layout.d.ts +64 -0
- package/dist/core/diagram-layout.d.ts.map +1 -0
- package/dist/core/diagram-layout.js +238 -0
- package/dist/core/diagram-layout.js.map +1 -0
- package/dist/core/diagram-ops.d.ts +165 -0
- package/dist/core/diagram-ops.d.ts.map +1 -0
- package/dist/core/diagram-ops.js +46 -0
- package/dist/core/diagram-ops.js.map +1 -0
- package/dist/core/entry.d.ts +3 -0
- package/dist/core/entry.d.ts.map +1 -0
- package/dist/core/entry.js +35 -0
- package/dist/core/entry.js.map +1 -0
- package/dist/core/expand-elements.d.ts +9 -0
- package/dist/core/expand-elements.d.ts.map +1 -0
- package/dist/core/expand-elements.js +277 -0
- package/dist/core/expand-elements.js.map +1 -0
- package/dist/core/frame-ops.d.ts +60 -0
- package/dist/core/frame-ops.d.ts.map +1 -0
- package/dist/core/frame-ops.js +90 -0
- package/dist/core/frame-ops.js.map +1 -0
- package/dist/core/frames.d.ts +31 -0
- package/dist/core/frames.d.ts.map +1 -0
- package/dist/core/frames.js +95 -0
- package/dist/core/frames.js.map +1 -0
- package/dist/core/geometry.d.ts +30 -0
- package/dist/core/geometry.d.ts.map +1 -0
- package/dist/core/geometry.js +167 -0
- package/dist/core/geometry.js.map +1 -0
- package/dist/core/layout-check.d.ts +30 -0
- package/dist/core/layout-check.d.ts.map +1 -0
- package/dist/core/layout-check.js +181 -0
- package/dist/core/layout-check.js.map +1 -0
- package/dist/core/local-origin.d.ts +4 -0
- package/dist/core/local-origin.d.ts.map +1 -0
- package/dist/core/local-origin.js +27 -0
- package/dist/core/local-origin.js.map +1 -0
- package/dist/core/mcp-dispatch.d.ts +9 -0
- package/dist/core/mcp-dispatch.d.ts.map +1 -0
- package/dist/core/mcp-dispatch.js +741 -0
- package/dist/core/mcp-dispatch.js.map +1 -0
- package/dist/core/mcp-http.d.ts +3 -0
- package/dist/core/mcp-http.d.ts.map +1 -0
- package/dist/core/mcp-http.js +38 -0
- package/dist/core/mcp-http.js.map +1 -0
- package/dist/core/mcp-server.d.ts +19 -0
- package/dist/core/mcp-server.d.ts.map +1 -0
- package/dist/core/mcp-server.js +57 -0
- package/dist/core/mcp-server.js.map +1 -0
- package/dist/core/mcp-tools.d.ts +3 -0
- package/dist/core/mcp-tools.d.ts.map +1 -0
- package/dist/core/mcp-tools.js +723 -0
- package/dist/core/mcp-tools.js.map +1 -0
- package/dist/core/normalize.d.ts +26 -0
- package/dist/core/normalize.d.ts.map +1 -0
- package/dist/core/normalize.js +134 -0
- package/dist/core/normalize.js.map +1 -0
- package/dist/core/obsidian-md.d.ts +4 -0
- package/dist/core/obsidian-md.d.ts.map +1 -0
- package/dist/core/obsidian-md.js +227 -0
- package/dist/core/obsidian-md.js.map +1 -0
- package/dist/core/pidfile.d.ts +5 -0
- package/dist/core/pidfile.d.ts.map +1 -0
- package/dist/core/pidfile.js +51 -0
- package/dist/core/pidfile.js.map +1 -0
- package/dist/core/png-scene.d.ts +4 -0
- package/dist/core/png-scene.d.ts.map +1 -0
- package/dist/core/png-scene.js +176 -0
- package/dist/core/png-scene.js.map +1 -0
- package/dist/core/render/excalidraw-node/dom.d.ts +29 -0
- package/dist/core/render/excalidraw-node/dom.d.ts.map +1 -0
- package/dist/core/render/excalidraw-node/dom.js +132 -0
- package/dist/core/render/excalidraw-node/dom.js.map +1 -0
- package/dist/core/render/excalidraw-node/index.d.ts +11 -0
- package/dist/core/render/excalidraw-node/index.d.ts.map +1 -0
- package/dist/core/render/excalidraw-node/index.js +77 -0
- package/dist/core/render/excalidraw-node/index.js.map +1 -0
- package/dist/core/render/fonts.d.ts +34 -0
- package/dist/core/render/fonts.d.ts.map +1 -0
- package/dist/core/render/fonts.js +133 -0
- package/dist/core/render/fonts.js.map +1 -0
- package/dist/core/render/index.d.ts +40 -0
- package/dist/core/render/index.d.ts.map +1 -0
- package/dist/core/render/index.js +135 -0
- package/dist/core/render/index.js.map +1 -0
- package/dist/core/render/png-worker.d.ts +2 -0
- package/dist/core/render/png-worker.d.ts.map +1 -0
- package/dist/core/render/png-worker.js +65 -0
- package/dist/core/render/png-worker.js.map +1 -0
- package/dist/core/render/png.d.ts +15 -0
- package/dist/core/render/png.d.ts.map +1 -0
- package/dist/core/render/png.js +128 -0
- package/dist/core/render/png.js.map +1 -0
- package/dist/core/render/text-metrics.d.ts +2 -0
- package/dist/core/render/text-metrics.d.ts.map +1 -0
- package/dist/core/render/text-metrics.js +136 -0
- package/dist/core/render/text-metrics.js.map +1 -0
- package/dist/core/request-canvas.d.ts +9 -0
- package/dist/core/request-canvas.d.ts.map +1 -0
- package/dist/core/request-canvas.js +2 -0
- package/dist/core/request-canvas.js.map +1 -0
- package/dist/core/request-headers.d.ts +5 -0
- package/dist/core/request-headers.d.ts.map +1 -0
- package/dist/core/request-headers.js +80 -0
- package/dist/core/request-headers.js.map +1 -0
- package/dist/core/scene-input.d.ts +2 -0
- package/dist/core/scene-input.d.ts.map +1 -0
- package/dist/core/scene-input.js +11 -0
- package/dist/core/scene-input.js.map +1 -0
- package/dist/core/scene-io.d.ts +16 -0
- package/dist/core/scene-io.d.ts.map +1 -0
- package/dist/core/scene-io.js +95 -0
- package/dist/core/scene-io.js.map +1 -0
- package/dist/core/share-url.d.ts +3 -0
- package/dist/core/share-url.d.ts.map +1 -0
- package/dist/core/share-url.js +77 -0
- package/dist/core/share-url.js.map +1 -0
- package/dist/core/spawn.d.ts +41 -0
- package/dist/core/spawn.d.ts.map +1 -0
- package/dist/core/spawn.js +153 -0
- package/dist/core/spawn.js.map +1 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +14 -0
- package/dist/core/version.js.map +1 -0
- package/dist/frontend/assets/Assistant-Bold-gm-uSS1B.woff2 +0 -0
- package/dist/frontend/assets/Assistant-Medium-DrcxCXg3.woff2 +0 -0
- package/dist/frontend/assets/Assistant-Regular-DVxZuzxb.woff2 +0 -0
- package/dist/frontend/assets/Assistant-SemiBold-SCI4bEL9.woff2 +0 -0
- package/dist/frontend/assets/Tableau10-CvOaoHrI.js +1 -0
- package/dist/frontend/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
- package/dist/frontend/assets/abnfDiagram-VCTEODGH-CO_aNPe5.js +1 -0
- package/dist/frontend/assets/advancedFormat-DE2dNp0u.js +1 -0
- package/dist/frontend/assets/ar-SA-G6X2FPQ2-Bq4yiKbc.js +10 -0
- package/dist/frontend/assets/arc--vhPzIZC.js +1 -0
- package/dist/frontend/assets/architectureDiagram-5GKGNRK7-aHYJQElw.js +36 -0
- package/dist/frontend/assets/array-BKyUJesY.js +1 -0
- package/dist/frontend/assets/az-AZ-76LH7QW2-BB3yat67.js +1 -0
- package/dist/frontend/assets/band-dPffDWoQ.js +1 -0
- package/dist/frontend/assets/bg-BG-XCXSNQG7-DmC2FjQc.js +5 -0
- package/dist/frontend/assets/blockDiagram-68f4deed-Bn83vchM.js +118 -0
- package/dist/frontend/assets/blockDiagram-NRAW4CY4-CxaW-TzC.js +129 -0
- package/dist/frontend/assets/bn-BD-2XOGV67Q-DpCbZMS6.js +5 -0
- package/dist/frontend/assets/c4Diagram-15b5d702-Bq7Ko0Vs.js +10 -0
- package/dist/frontend/assets/c4Diagram-UCG6FXSJ-Dh883fAO.js +38 -0
- package/dist/frontend/assets/ca-ES-6MX7JW3Y-CBOshpbV.js +8 -0
- package/dist/frontend/assets/channel-DYvM7vRx.js +1 -0
- package/dist/frontend/assets/chunk-2Q5K7J3B-DaFhLtFc.js +1 -0
- package/dist/frontend/assets/chunk-5VM5RSS4-CyLfaWw7.js +15 -0
- package/dist/frontend/assets/chunk-F27PBJKO-BHNc-edD.js +1 -0
- package/dist/frontend/assets/chunk-G27WJ6UU-BBKiZxqf.js +231 -0
- package/dist/frontend/assets/chunk-JWPE2WC7-7twsn51D.js +1 -0
- package/dist/frontend/assets/chunk-LCL6LL3I-BTwZuXJ6.js +206 -0
- package/dist/frontend/assets/chunk-POPQ4Y6H-CaHDxqyV.js +1 -0
- package/dist/frontend/assets/chunk-SVP7TREG-B8-zByXy.js +88 -0
- package/dist/frontend/assets/chunk-XXDRQBXY-DQLro-7R.js +1 -0
- package/dist/frontend/assets/classDiagram-DTDB5LWJ-Dpwx6IJK.js +1 -0
- package/dist/frontend/assets/classDiagram-d40c83e7-BPxlcZuc.js +2 -0
- package/dist/frontend/assets/classDiagram-v2-JRS7N3AN-Dpwx6IJK.js +1 -0
- package/dist/frontend/assets/classDiagram-v2-d5a6b087-Cyz34qAK.js +2 -0
- package/dist/frontend/assets/clone-Iw0eB1Cb.js +1 -0
- package/dist/frontend/assets/cose-bilkent-JH36ORCC-C4ZX1Xvi.js +1 -0
- package/dist/frontend/assets/createText-d213de94-CDH1rzxH.js +7 -0
- package/dist/frontend/assets/cs-CZ-2BRQDIVT-CGAN69M4.js +11 -0
- package/dist/frontend/assets/cynefin-OW5HDTMX-B8XT9png.js +178 -0
- package/dist/frontend/assets/cynefinDiagram-5FMLGOSQ-COTZjqlj.js +62 -0
- package/dist/frontend/assets/cytoscape-cose-bilkent-D4yGolDn.js +1 -0
- package/dist/frontend/assets/cytoscape.esm-BjAbmLdb.js +331 -0
- package/dist/frontend/assets/da-DK-5WZEPLOC-FIDoeOAn.js +5 -0
- package/dist/frontend/assets/dagre-3AP2YEHR-v8EtxNwx.js +4 -0
- package/dist/frontend/assets/de-DE-XR44H4JA-Hquyrt1G.js +8 -0
- package/dist/frontend/assets/defaultLocale-C4B-KCzX.js +1 -0
- package/dist/frontend/assets/diagram-S7CK7UJ4-BiwOlZBI.js +30 -0
- package/dist/frontend/assets/diagram-UQ7AKVKN-DIfzNs7s.js +41 -0
- package/dist/frontend/assets/diagram-VSXAHHWV-kKkEHy5z.js +3 -0
- package/dist/frontend/assets/diagram-VX7I27RA-zTp2qGKo.js +24 -0
- package/dist/frontend/assets/diagram-Z3DM3KII-hUxSr-QT.js +24 -0
- package/dist/frontend/assets/directory-open-01563666-DWU9wJ6I.js +1 -0
- package/dist/frontend/assets/directory-open-4ed118d0-CunoC1EB.js +1 -0
- package/dist/frontend/assets/ebnfDiagram-PWID7BFC-CRwXBVzS.js +1 -0
- package/dist/frontend/assets/edges-332bd1c7-CbPhghy3.js +4 -0
- package/dist/frontend/assets/el-GR-BZB4AONW-CWRJJANX.js +10 -0
- package/dist/frontend/assets/erDiagram-880f2ed8-CY1dU-f9.js +51 -0
- package/dist/frontend/assets/erDiagram-SSCWMZ5O-BfDW8Lxf.js +99 -0
- package/dist/frontend/assets/es-ES-U4NZUMDT-BwZWIjT5.js +9 -0
- package/dist/frontend/assets/eu-ES-A7QVB2H4-B9suQ9BE.js +11 -0
- package/dist/frontend/assets/fa-IR-HGAKTJCU-tgrKvE4J.js +8 -0
- package/dist/frontend/assets/fi-FI-Z5N7JZ37-Ddoc7R-q.js +6 -0
- package/dist/frontend/assets/file-open-002ab408-DIuFHtCF.js +1 -0
- package/dist/frontend/assets/file-open-7c801643-684qeFg4.js +1 -0
- package/dist/frontend/assets/file-save-3189631c-C1wFhQhH.js +1 -0
- package/dist/frontend/assets/file-save-745eba88-Bb9F9Kg7.js +1 -0
- package/dist/frontend/assets/flowDb-7c981674-DkYacLUz.js +10 -0
- package/dist/frontend/assets/flowDiagram-A5DVABFB-CCBuG42p.js +168 -0
- package/dist/frontend/assets/flowDiagram-cbd28bf7-DhhBmCsw.js +4 -0
- package/dist/frontend/assets/flowDiagram-v2-ffc7f31a-BICbZ5-w.js +1 -0
- package/dist/frontend/assets/flowchart-elk-definition-36e2d292-BsyTsM2Q.js +139 -0
- package/dist/frontend/assets/fr-FR-RHASNOE6-Bzn_6dcd.js +9 -0
- package/dist/frontend/assets/ganttDiagram-04f9e578-CCKAlfpJ.js +257 -0
- package/dist/frontend/assets/ganttDiagram-EL5Y4UJY-B8CXkutd.js +292 -0
- package/dist/frontend/assets/gitGraphDiagram-21fc4d3e-DBAYEQql.js +70 -0
- package/dist/frontend/assets/gitGraphDiagram-WWUBYQGX-Ge5QWjv2.js +106 -0
- package/dist/frontend/assets/gl-ES-HMX3MZ6V-vcZHbFum.js +10 -0
- package/dist/frontend/assets/graph-87dI2d0Q.js +1 -0
- package/dist/frontend/assets/has-D7z5cd7K.js +1 -0
- package/dist/frontend/assets/he-IL-6SHJWFNN-CK07fY3l.js +10 -0
- package/dist/frontend/assets/hi-IN-IWLTKZ5I-CDZ0p7Jv.js +4 -0
- package/dist/frontend/assets/hu-HU-A5ZG7DT2-FH5SLnWy.js +7 -0
- package/dist/frontend/assets/id-ID-SAP4L64H-MjXIXb2f.js +10 -0
- package/dist/frontend/assets/image-blob-reduce.esm-HwCm7IZ0.js +7 -0
- package/dist/frontend/assets/index-6079d271-DiB2AL6F.js +1 -0
- package/dist/frontend/assets/index-BcAUh2Nm.css +1 -0
- package/dist/frontend/assets/index-Biw8Vgb3.js +320 -0
- package/dist/frontend/assets/index-fTyH8AV3.js +354 -0
- package/dist/frontend/assets/infoDiagram-4a4f5b27-BOdJmCUU.js +7 -0
- package/dist/frontend/assets/infoDiagram-RXCK75RN-CNm06Rxs.js +2 -0
- package/dist/frontend/assets/init-Gi6I4Gst.js +1 -0
- package/dist/frontend/assets/ishikawaDiagram-5VMMS53U-DoLWy3n2.js +70 -0
- package/dist/frontend/assets/it-IT-JPQ66NNP-D3n0iaPa.js +11 -0
- package/dist/frontend/assets/ja-JP-DBVTYXUO-ejSNO7M9.js +8 -0
- package/dist/frontend/assets/journeyDiagram-29694f62-Cm6qVjA9.js +139 -0
- package/dist/frontend/assets/journeyDiagram-EYS64GPL-ByZmvOcj.js +139 -0
- package/dist/frontend/assets/kaa-6HZHGXH3-D8l_gwno.js +1 -0
- package/dist/frontend/assets/kab-KAB-ZGHBKWFO-CCdAUgdW.js +8 -0
- package/dist/frontend/assets/kanban-definition-3QL26DDD-Y5ylzca9.js +89 -0
- package/dist/frontend/assets/katex-C5jXJg4s.js +257 -0
- package/dist/frontend/assets/kk-KZ-P5N5QNE5-DeuZqHeo.js +1 -0
- package/dist/frontend/assets/km-KH-HSX4SM5Z-CiG2k5fk.js +11 -0
- package/dist/frontend/assets/ko-KR-MTYHY66A-KQOGYf_l.js +9 -0
- package/dist/frontend/assets/ku-TR-6OUDTVRD-iPec9Wpx.js +9 -0
- package/dist/frontend/assets/layout-ChryVliD.js +1 -0
- package/dist/frontend/assets/layout-chXYHUIV.js +1 -0
- package/dist/frontend/assets/line-V0o6yOnB.js +1 -0
- package/dist/frontend/assets/linear-BvV3B0Vg.js +1 -0
- package/dist/frontend/assets/lt-LT-XHIRWOB4-CATjC2gQ.js +3 -0
- package/dist/frontend/assets/lv-LV-5QDEKY6T-BsDP-7Dd.js +7 -0
- package/dist/frontend/assets/mindmap-definition-FBJOCRG2-z4KcwRlx.js +96 -0
- package/dist/frontend/assets/mindmap-definition-ac74a2e8-C1QU2vBv.js +95 -0
- package/dist/frontend/assets/mr-IN-CRQNXWMA-DWJhwvxv.js +13 -0
- package/dist/frontend/assets/my-MM-5M5IBNSE-DckXEMN8.js +1 -0
- package/dist/frontend/assets/nb-NO-T6EIAALU-HaOR9ZeX.js +10 -0
- package/dist/frontend/assets/nl-NL-IS3SIHDZ-ef_ywpFu.js +8 -0
- package/dist/frontend/assets/nn-NO-6E72VCQL-Bg7QdVqf.js +8 -0
- package/dist/frontend/assets/oc-FR-POXYY2M6-D5HmBPnC.js +8 -0
- package/dist/frontend/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/frontend/assets/pa-IN-N4M65BXN-BHYM0tZp.js +4 -0
- package/dist/frontend/assets/path-CbwjOpE9.js +1 -0
- package/dist/frontend/assets/pegDiagram-XKGWAZYB-BL0-JiYs.js +1 -0
- package/dist/frontend/assets/pica-CHpl3DYP.js +7 -0
- package/dist/frontend/assets/pie-b97pL0mM.js +1 -0
- package/dist/frontend/assets/pieDiagram-421022e6-DiRybrxD.js +35 -0
- package/dist/frontend/assets/pieDiagram-E7YTZNPT-VybkpWmu.js +39 -0
- package/dist/frontend/assets/pl-PL-T2D74RX3-uZIVDHgu.js +9 -0
- package/dist/frontend/assets/pt-BR-5N22H2LF-dJVfhAeV.js +9 -0
- package/dist/frontend/assets/pt-PT-UZXXM6DQ-DjJzcznP.js +9 -0
- package/dist/frontend/assets/quadrantDiagram-0957ecba-BHJpECv1.js +7 -0
- package/dist/frontend/assets/quadrantDiagram-AXDQQJYC-RAG8nSkZ.js +7 -0
- package/dist/frontend/assets/railroadDiagram-O6MQD6OU-lCMtporN.js +1 -0
- package/dist/frontend/assets/requirementDiagram-23d650b8-mSFTWSrD.js +52 -0
- package/dist/frontend/assets/requirementDiagram-EFPCY7ZU-B8YnTqPO.js +84 -0
- package/dist/frontend/assets/ro-RO-JPDTUUEW-B5X8VOmp.js +11 -0
- package/dist/frontend/assets/roundRect-0PYZxl1G.js +1 -0
- package/dist/frontend/assets/ru-RU-B4JR7IUQ-Czv9kfuz.js +9 -0
- package/dist/frontend/assets/sankeyDiagram-23345273-B3g3P-D1.js +8 -0
- package/dist/frontend/assets/sankeyDiagram-P5KCCOFB-DRm9HHoQ.js +40 -0
- package/dist/frontend/assets/sankeyLinkHorizontal-CgO6js3K.js +1 -0
- package/dist/frontend/assets/sequenceDiagram-17ac3bff-DzZiSttS.js +122 -0
- package/dist/frontend/assets/sequenceDiagram-WJ2MYXX4-BrSDYDx-.js +162 -0
- package/dist/frontend/assets/si-LK-N5RQ5JYF-DFWOZdgD.js +1 -0
- package/dist/frontend/assets/sizeCapture-X5ZJPWSS-CbaN7yeQ.js +1 -0
- package/dist/frontend/assets/sk-SK-C5VTKIMK-B8VlFn2Z.js +6 -0
- package/dist/frontend/assets/sl-SI-NN7IZMDC-CJeSgLEg.js +6 -0
- package/dist/frontend/assets/stateDiagram-9c5f0230-Dzm1fyzw.js +1 -0
- package/dist/frontend/assets/stateDiagram-HBIQ2CUA-B5Nv-PBX.js +1 -0
- package/dist/frontend/assets/stateDiagram-v2-4QOOHH4V-B72hUL6s.js +1 -0
- package/dist/frontend/assets/stateDiagram-v2-51a3dcff-DvLAYBjA.js +1 -0
- package/dist/frontend/assets/styles-2ab5d517-D6473lhT.js +116 -0
- package/dist/frontend/assets/styles-5f03d8d2-CZ5U9u1n.js +160 -0
- package/dist/frontend/assets/styles-edf9a4b0-DzQC88FF.js +207 -0
- package/dist/frontend/assets/subset-shared.chunk.js +84 -0
- package/dist/frontend/assets/subset-worker.chunk.js +1 -0
- package/dist/frontend/assets/sv-SE-XGPEYMSR-BKMKxZWF.js +10 -0
- package/dist/frontend/assets/svgDrawCommon-3ba9043b-CQsuw6x4.js +1 -0
- package/dist/frontend/assets/swimlanes-XN3QIQJK-D6c81JTS.js +1 -0
- package/dist/frontend/assets/swimlanesDiagram-VK2B7HYN-SMIGSMWR.js +8 -0
- package/dist/frontend/assets/ta-IN-2NMHFXQM-BtPPl3RQ.js +9 -0
- package/dist/frontend/assets/th-TH-HPSO5L25-CSjFGi1j.js +2 -0
- package/dist/frontend/assets/timeline-definition-24CTP7MA-DTBgPsOR.js +120 -0
- package/dist/frontend/assets/timeline-definition-7e6b55e7-D44e8lHF.js +61 -0
- package/dist/frontend/assets/tr-TR-DEFEU3FU-BS1kZ0-G.js +7 -0
- package/dist/frontend/assets/uk-UA-QMV73CPH--ucRdDwc.js +6 -0
- package/dist/frontend/assets/union-DI_iry4-.js +1 -0
- package/dist/frontend/assets/vennDiagram-4TSXK5OY-DDIUJU_f.js +34 -0
- package/dist/frontend/assets/vi-VN-M7AON7JQ-BcGYkPOn.js +5 -0
- package/dist/frontend/assets/wardleyDiagram-VM6X3IG4-TfvrOirV.js +78 -0
- package/dist/frontend/assets/xychartDiagram-S5SC5T6Z-DaSdOJbv.js +7 -0
- package/dist/frontend/assets/xychartDiagram-b6496bcd-VIsyqEG1.js +7 -0
- package/dist/frontend/assets/zh-CN-LNUGB5OW-RL4CyEYU.js +10 -0
- package/dist/frontend/assets/zh-HK-E62DVLB3-DKGVR3J1.js +1 -0
- package/dist/frontend/assets/zh-TW-RAJ6MFWO-C7djgh-M.js +9 -0
- package/dist/frontend/assets/zipObject-Bl99JdSU.js +1 -0
- package/dist/frontend/index.html +569 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/render/excalidraw-node.mjs +540 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +1684 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +263 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +49 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +63 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +127 -4
- package/skills/excalidraw-skill/SKILL.md +331 -0
- package/skills/excalidraw-skill/evals/evals.json +35 -0
- package/skills/excalidraw-skill/references/cheatsheet.md +217 -0
- package/src/ai/config.ts +58 -0
- package/src/ai/providers/anthropic.ts +62 -0
- package/src/ai/providers/openai-compatible.ts +84 -0
- package/src/ai/request-settings.ts +50 -0
- package/src/ai/routes.ts +157 -0
- package/src/ai/runner.ts +80 -0
- package/src/ai/sse.ts +40 -0
- package/src/ai/system.ts +16 -0
- package/src/ai/tools.ts +130 -0
- package/src/ai/types.ts +48 -0
- package/src/bin.ts +56 -0
- package/src/cli/args.ts +97 -0
- package/src/cli/commands/ai.ts +40 -0
- package/src/cli/commands/arrange.ts +112 -0
- package/src/cli/commands/canvases.ts +37 -0
- package/src/cli/commands/check.ts +15 -0
- package/src/cli/commands/comment.ts +72 -0
- package/src/cli/commands/elements.ts +299 -0
- package/src/cli/commands/frame.ts +55 -0
- package/src/cli/commands/install-skill.ts +116 -0
- package/src/cli/commands/layout.ts +14 -0
- package/src/cli/commands/render.ts +68 -0
- package/src/cli/commands/scene.ts +168 -0
- package/src/cli/commands/server.ts +71 -0
- package/src/cli/commands/snapshot.ts +45 -0
- package/src/cli/image-options.ts +77 -0
- package/src/cli/run.ts +123 -0
- package/src/cli/util.ts +39 -0
- package/src/core/arrow-routing.ts +256 -0
- package/src/core/bulk-ops.ts +183 -0
- package/src/core/canvas-client.ts +525 -0
- package/src/core/canvas-id.ts +8 -0
- package/src/core/canvas-persistence.ts +1067 -0
- package/src/core/canvas-registry.ts +180 -0
- package/src/core/canvas-routes.ts +34 -0
- package/src/core/canvas-state.ts +37 -0
- package/src/core/canvas.ts +18 -0
- package/src/core/comment-ops.ts +36 -0
- package/src/core/comments.ts +142 -0
- package/src/core/compact.ts +21 -0
- package/src/core/config.ts +24 -0
- package/src/core/describe.ts +100 -0
- package/src/core/design-guide.ts +114 -0
- package/src/core/diagram-layout.ts +278 -0
- package/src/core/diagram-ops.ts +48 -0
- package/src/core/entry.ts +37 -0
- package/src/core/expand-elements.ts +316 -0
- package/src/core/frame-ops.ts +112 -0
- package/src/core/frames.ts +113 -0
- package/src/core/geometry.ts +213 -0
- package/src/core/layout-check.ts +200 -0
- package/src/core/local-origin.ts +27 -0
- package/src/core/mcp-dispatch.ts +858 -0
- package/src/core/mcp-http.ts +38 -0
- package/src/core/mcp-server.ts +72 -0
- package/src/core/mcp-tools.ts +725 -0
- package/src/core/normalize.ts +158 -0
- package/src/core/obsidian-md.ts +231 -0
- package/src/core/pidfile.ts +52 -0
- package/src/core/png-scene.ts +177 -0
- package/src/core/render/excalidraw-node/dom.ts +159 -0
- package/src/core/render/excalidraw-node/index.ts +100 -0
- package/src/core/render/fonts.ts +173 -0
- package/src/core/render/index.ts +198 -0
- package/src/core/render/png-worker.ts +75 -0
- package/src/core/render/png.ts +148 -0
- package/src/core/render/text-metrics.ts +141 -0
- package/src/core/request-canvas.ts +10 -0
- package/src/core/request-headers.ts +79 -0
- package/src/core/scene-input.ts +11 -0
- package/src/core/scene-io.ts +125 -0
- package/src/core/share-url.ts +99 -0
- package/src/core/spawn.ts +186 -0
- package/src/core/version.ts +13 -0
- package/src/index.ts +86 -0
- package/src/server.ts +1873 -0
- package/src/types.ts +384 -0
- package/src/utils/logger.ts +77 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { parseArgs } from '../args.js';
|
|
2
|
+
import { printJson } from '../util.js';
|
|
3
|
+
import { ensureCanvasRunning } from '../../core/spawn.js';
|
|
4
|
+
import { getElements } from '../../core/canvas-client.js';
|
|
5
|
+
import { frameScope } from '../../core/frame-ops.js';
|
|
6
|
+
import { checkLayout } from '../../core/layout-check.js';
|
|
7
|
+
|
|
8
|
+
// Reports what makes the diagram hard to read; the same check as the check_layout tool.
|
|
9
|
+
export async function check(argv: string[]): Promise<void> {
|
|
10
|
+
const { flags } = parseArgs(argv, { frame: { takesValue: true } });
|
|
11
|
+
await ensureCanvasRunning();
|
|
12
|
+
const all = await getElements();
|
|
13
|
+
const scope = typeof flags.frame === 'string' ? (await frameScope(flags.frame)).frame : undefined;
|
|
14
|
+
printJson(checkLayout(scope ? all.filter(e => e.id === scope.id || e.frameId === scope.id) : all));
|
|
15
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { parseArgs, CliUsageError } from '../args.js';
|
|
2
|
+
import { printJson } from '../util.js';
|
|
3
|
+
import { ensureCanvasRunning } from '../../core/spawn.js';
|
|
4
|
+
import { describeComments, resolveComments } from '../../core/comment-ops.js';
|
|
5
|
+
import { addComment, deleteComment, reopenComment, replyToComment } from '../../core/canvas-client.js';
|
|
6
|
+
|
|
7
|
+
const ACTIONS = new Set(['list', 'add', 'reply', 'resolve', 'reopen', 'delete']);
|
|
8
|
+
const USAGE = 'Usage: comment list|add|reply|resolve|reopen|delete (see `help comment`)';
|
|
9
|
+
|
|
10
|
+
export async function comment(argv: string[]): Promise<void> {
|
|
11
|
+
const { positionals, flags } = parseArgs(argv, {
|
|
12
|
+
open: { takesValue: false },
|
|
13
|
+
resolved: { takesValue: false },
|
|
14
|
+
element: { takesValue: true },
|
|
15
|
+
at: { takesValue: true },
|
|
16
|
+
note: { takesValue: true },
|
|
17
|
+
frame: { takesValue: true }
|
|
18
|
+
});
|
|
19
|
+
const [action, ...args] = positionals;
|
|
20
|
+
|
|
21
|
+
if (!action || !ACTIONS.has(action)) throw new CliUsageError(USAGE);
|
|
22
|
+
|
|
23
|
+
await ensureCanvasRunning();
|
|
24
|
+
|
|
25
|
+
switch (action) {
|
|
26
|
+
case 'list': {
|
|
27
|
+
if (flags.open && flags.resolved) throw new CliUsageError('Use only one of --open and --resolved');
|
|
28
|
+
printJson(await describeComments(flags.open ? 'open' : flags.resolved ? 'resolved' : undefined, typeof flags.frame === 'string' ? flags.frame : undefined));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
case 'add': {
|
|
32
|
+
const [text] = args;
|
|
33
|
+
if (!text) throw new CliUsageError('Usage: comment add <text> [--element <id>] [--at x,y]');
|
|
34
|
+
const body: Record<string, unknown> = { text, from: 'agent' };
|
|
35
|
+
if (flags.element) body.anchorElementId = flags.element;
|
|
36
|
+
if (flags.at) {
|
|
37
|
+
const parts = String(flags.at).split(',').map((part) => part.trim());
|
|
38
|
+
if (parts.length !== 2 || parts.some((part) => part === '' || !Number.isFinite(Number(part)))) {
|
|
39
|
+
throw new CliUsageError('--at needs x,y numbers');
|
|
40
|
+
}
|
|
41
|
+
Object.assign(body, { x: Number(parts[0]), y: Number(parts[1]) });
|
|
42
|
+
}
|
|
43
|
+
printJson(await addComment(body));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
case 'reply': {
|
|
47
|
+
const [id, text] = args;
|
|
48
|
+
if (!id || !text) throw new CliUsageError('Usage: comment reply <id> <text>');
|
|
49
|
+
printJson(await replyToComment(id, text));
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
case 'resolve': {
|
|
53
|
+
if (args.length === 0) throw new CliUsageError('Usage: comment resolve <id> [<id> ...] [--note <text>]');
|
|
54
|
+
const resolved = await resolveComments(args, typeof flags.note === 'string' ? flags.note : undefined);
|
|
55
|
+
printJson({ success: true, resolved });
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
case 'reopen': {
|
|
59
|
+
const [id] = args;
|
|
60
|
+
if (!id) throw new CliUsageError('Usage: comment reopen <id>');
|
|
61
|
+
printJson(await reopenComment(id));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
case 'delete': {
|
|
65
|
+
const [id] = args;
|
|
66
|
+
if (!id) throw new CliUsageError('Usage: comment delete <id>');
|
|
67
|
+
await deleteComment(id);
|
|
68
|
+
printJson({ success: true, deleted: id });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { parseArgs, CliUsageError } from '../args.js';
|
|
2
|
+
import { note, printJson, readJsonInput } from '../util.js';
|
|
3
|
+
import { prepareElement, prepareElementUpdate } from '../../core/normalize.js';
|
|
4
|
+
import {
|
|
5
|
+
batchCreateElementsStrict,
|
|
6
|
+
updateElementStrict,
|
|
7
|
+
deleteElementStrict,
|
|
8
|
+
getElementStrict,
|
|
9
|
+
getElements,
|
|
10
|
+
searchElements,
|
|
11
|
+
getCanvasSelection
|
|
12
|
+
} from '../../core/canvas-client.js';
|
|
13
|
+
import { ensureCanvasRunning } from '../../core/spawn.js';
|
|
14
|
+
import { pageOf } from '../../core/compact.js';
|
|
15
|
+
import { sceneSummary } from '../../core/bulk-ops.js';
|
|
16
|
+
import { fromFrameSpace, toFrameSpace } from '../../core/frames.js';
|
|
17
|
+
import type { FrameGrowth, FrameScope } from '../../core/frame-ops.js';
|
|
18
|
+
import { assertOnFrame, frameScope, growFrame as growFrameCore, intoFrame, overlapWarning } from '../../core/frame-ops.js';
|
|
19
|
+
import { ServerElement } from '../../types.js';
|
|
20
|
+
|
|
21
|
+
// apply: primary mutation command — {create:[], update:[], delete:[]} in one
|
|
22
|
+
// invocation; a bare JSON array is shorthand for {create: [...]}.
|
|
23
|
+
function normalizePatchUpdate(update: any): { id: string; updates: Record<string, unknown> } {
|
|
24
|
+
if (!update || typeof update !== 'object' || Array.isArray(update)) {
|
|
25
|
+
throw new CliUsageError('Every update entry must be an object with an "id"');
|
|
26
|
+
}
|
|
27
|
+
if (!update.id) throw new CliUsageError('Every update entry needs an "id"');
|
|
28
|
+
|
|
29
|
+
const { id, set, ...rest } = update;
|
|
30
|
+
if (set === undefined) {
|
|
31
|
+
return { id, updates: rest };
|
|
32
|
+
}
|
|
33
|
+
if (!set || typeof set !== 'object' || Array.isArray(set)) {
|
|
34
|
+
throw new CliUsageError('Update entry "set" must be an object');
|
|
35
|
+
}
|
|
36
|
+
if (Object.keys(rest).length > 0) {
|
|
37
|
+
throw new CliUsageError('Use either direct update fields or "set", not both');
|
|
38
|
+
}
|
|
39
|
+
return { id, updates: set };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const optionalFrameScope = async (ref: unknown): Promise<FrameScope | undefined> =>
|
|
44
|
+
typeof ref === 'string' ? frameScope(ref) : undefined;
|
|
45
|
+
|
|
46
|
+
async function growFrame(scope: FrameScope, shapes: ServerElement[]): Promise<FrameGrowth | undefined> {
|
|
47
|
+
const grew = await growFrameCore(scope, shapes);
|
|
48
|
+
if (grew?.overlaps) note(overlapWarning(grew.frame, grew.overlaps));
|
|
49
|
+
return grew;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function apply(argv: string[]): Promise<void> {
|
|
53
|
+
const { positionals, flags } = parseArgs(argv, { frame: { takesValue: true } });
|
|
54
|
+
const input = await readJsonInput(positionals[0], 'patch');
|
|
55
|
+
|
|
56
|
+
const patch: { create?: any[]; update?: any[]; delete?: string[] } =
|
|
57
|
+
Array.isArray(input) ? { create: input } : input;
|
|
58
|
+
|
|
59
|
+
if (!patch.create?.length && !patch.update?.length && !patch.delete?.length) {
|
|
60
|
+
throw new CliUsageError('Patch has no create/update/delete operations');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
await ensureCanvasRunning();
|
|
64
|
+
const scope = await optionalFrameScope(flags.frame);
|
|
65
|
+
|
|
66
|
+
// Resolve every update before the first write, so a bad one cannot leave the creates behind.
|
|
67
|
+
const known = new Map((await getElements()).map(element => [element.id, element]));
|
|
68
|
+
const creating = new Map<string, any>((patch.create ?? []).filter(el => el.id).map(el => [el.id, el]));
|
|
69
|
+
const prepared = (patch.update ?? []).map(update => {
|
|
70
|
+
const { id, updates } = normalizePatchUpdate(update);
|
|
71
|
+
const existing = known.get(id);
|
|
72
|
+
if (!existing && !creating.has(id)) throw new Error(`Element ${id} not found`);
|
|
73
|
+
if (existing && scope) assertOnFrame(existing, scope.frame);
|
|
74
|
+
return prepareElementUpdate(id, scope ? fromFrameSpace(updates, scope.frame) : updates, (existing ?? creating.get(id)).type);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (scope) for (const id of patch.delete ?? []) { const target = known.get(id); if (target) assertOnFrame(target, scope.frame); }
|
|
78
|
+
|
|
79
|
+
// An id both deleted and created is a replacement: the old element goes first, or the delete would remove the new one.
|
|
80
|
+
// If the create then fails the originals are put back, so a failed patch does not lose them.
|
|
81
|
+
const createIds = new Set((patch.create ?? []).map(el => el.id).filter(Boolean));
|
|
82
|
+
const replaced = (patch.delete ?? []).filter(id => createIds.has(id) && known.has(id));
|
|
83
|
+
const replacedSet = new Set(replaced);
|
|
84
|
+
const originals = replaced.map(id => known.get(id)!);
|
|
85
|
+
for (const id of replaced) await deleteElementStrict(id);
|
|
86
|
+
const toDelete = (patch.delete ?? []).filter(id => !replacedSet.has(id));
|
|
87
|
+
|
|
88
|
+
let created: ServerElement[] = [];
|
|
89
|
+
if (patch.create?.length) {
|
|
90
|
+
try {
|
|
91
|
+
created = await batchCreateElementsStrict(patch.create.map(el => prepareElement(scope ? intoFrame(el, scope) : el)));
|
|
92
|
+
} catch (error) {
|
|
93
|
+
if (originals.length) await batchCreateElementsStrict(originals).catch(() => undefined);
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const updated: ServerElement[] = [];
|
|
99
|
+
for (const update of prepared) updated.push(await updateElementStrict(update));
|
|
100
|
+
const frameGrew = scope && (created.length || updated.length) ? await growFrame(scope, [...created, ...updated]) : undefined;
|
|
101
|
+
|
|
102
|
+
const deleted: string[] = [];
|
|
103
|
+
for (const id of toDelete) {
|
|
104
|
+
await deleteElementStrict(id);
|
|
105
|
+
deleted.push(id);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
printJson({
|
|
109
|
+
success: true,
|
|
110
|
+
created: created.length,
|
|
111
|
+
updated: updated.length,
|
|
112
|
+
deleted: deleted.length,
|
|
113
|
+
...(replaced.length ? { replaced } : {}),
|
|
114
|
+
scene: await sceneSummary(),
|
|
115
|
+
...(frameGrew ? { frameGrew } : {}),
|
|
116
|
+
elements: created
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// add: batch create (alias for apply with a bare array); --one '<json>' for a
|
|
121
|
+
// single element without wrapping it in [].
|
|
122
|
+
export async function add(argv: string[]): Promise<void> {
|
|
123
|
+
const { positionals, flags } = parseArgs(argv, { one: { takesValue: true }, frame: { takesValue: true } });
|
|
124
|
+
|
|
125
|
+
let elements: any[];
|
|
126
|
+
if (typeof flags.one === 'string') {
|
|
127
|
+
try {
|
|
128
|
+
elements = [JSON.parse(flags.one)];
|
|
129
|
+
} catch (error) {
|
|
130
|
+
throw new CliUsageError(`Invalid JSON in --one: ${(error as Error).message}`);
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
const input = await readJsonInput(positionals[0], 'elements');
|
|
134
|
+
elements = Array.isArray(input) ? input : [input];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
await ensureCanvasRunning();
|
|
138
|
+
const scope = await optionalFrameScope(flags.frame);
|
|
139
|
+
const created = await batchCreateElementsStrict(elements.map(el => prepareElement(scope ? intoFrame(el, scope) : el)));
|
|
140
|
+
const frameGrew = scope ? await growFrame(scope, created) : undefined;
|
|
141
|
+
printJson({ success: true, count: created.length, ...(frameGrew ? { frameGrew } : {}), elements: created });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export async function update(argv: string[]): Promise<void> {
|
|
145
|
+
const { positionals, flags } = parseArgs(argv, { set: { takesValue: true }, frame: { takesValue: true } });
|
|
146
|
+
const id = positionals[0];
|
|
147
|
+
if (!id) throw new CliUsageError('Usage: update <id> --set \'{"backgroundColor": "#ffc9c9"}\'');
|
|
148
|
+
|
|
149
|
+
let updates: Record<string, unknown>;
|
|
150
|
+
if (typeof flags.set === 'string') {
|
|
151
|
+
try {
|
|
152
|
+
updates = JSON.parse(flags.set);
|
|
153
|
+
} catch (error) {
|
|
154
|
+
throw new CliUsageError(`Invalid JSON in --set: ${(error as Error).message}`);
|
|
155
|
+
}
|
|
156
|
+
} else {
|
|
157
|
+
updates = await readJsonInput(positionals[1], 'updates');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
await ensureCanvasRunning();
|
|
161
|
+
// Fetch the real type so text→label conversion skips text elements
|
|
162
|
+
const existing = await getElementStrict(id);
|
|
163
|
+
const scope = await optionalFrameScope(flags.frame);
|
|
164
|
+
if (scope) assertOnFrame(existing, scope.frame);
|
|
165
|
+
const element = await updateElementStrict(prepareElementUpdate(id, scope ? fromFrameSpace(updates, scope.frame) : updates, existing.type));
|
|
166
|
+
const frameGrew = scope ? await growFrame(scope, [element]) : undefined;
|
|
167
|
+
printJson({ success: true, ...(frameGrew ? { frameGrew } : {}), element: scope ? toFrameSpace(element, scope.frame) : element });
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export async function del(argv: string[]): Promise<void> {
|
|
171
|
+
const { positionals } = parseArgs(argv, {});
|
|
172
|
+
if (positionals.length === 0) throw new CliUsageError('Usage: delete <id> [<id> ...]');
|
|
173
|
+
|
|
174
|
+
await ensureCanvasRunning();
|
|
175
|
+
for (const id of positionals) {
|
|
176
|
+
await deleteElementStrict(id);
|
|
177
|
+
}
|
|
178
|
+
printJson({ success: true, deleted: positionals, count: positionals.length });
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export async function get(argv: string[]): Promise<void> {
|
|
182
|
+
const { positionals, flags } = parseArgs(argv, { frame: { takesValue: true } });
|
|
183
|
+
const id = positionals[0];
|
|
184
|
+
if (!id) throw new CliUsageError('Usage: get <id> [--frame <name|id>]');
|
|
185
|
+
|
|
186
|
+
await ensureCanvasRunning();
|
|
187
|
+
const element = await getElementStrict(id);
|
|
188
|
+
const scope = await optionalFrameScope(flags.frame);
|
|
189
|
+
if (scope) assertOnFrame(element, scope.frame);
|
|
190
|
+
printJson(scope ? toFrameSpace(element, scope.frame) : element);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export async function selection(_argv: string[]): Promise<void> {
|
|
194
|
+
await ensureCanvasRunning();
|
|
195
|
+
const selectedElementIds = await getCanvasSelection();
|
|
196
|
+
printJson({
|
|
197
|
+
success: true,
|
|
198
|
+
selectedElementIds,
|
|
199
|
+
count: selectedElementIds.length
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Coerce "true"/"false"/numeric strings so --filter locked=true works against
|
|
204
|
+
// real element values (the server search endpoint only compares raw strings).
|
|
205
|
+
function coerce(value: string): unknown {
|
|
206
|
+
if (value === 'true') return true;
|
|
207
|
+
if (value === 'false') return false;
|
|
208
|
+
if (value === 'null') return null;
|
|
209
|
+
if (value.trim() !== '' && !Number.isNaN(Number(value))) return Number(value);
|
|
210
|
+
return value;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function lookupPath(obj: any, dotPath: string): unknown {
|
|
214
|
+
return dotPath.split('.').reduce((acc, key) => (acc == null ? acc : acc[key]), obj);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export async function query(argv: string[]): Promise<void> {
|
|
218
|
+
const { flags } = parseArgs(argv, {
|
|
219
|
+
type: { takesValue: true },
|
|
220
|
+
bbox: { takesValue: true },
|
|
221
|
+
frame: { takesValue: true },
|
|
222
|
+
filter: { takesValue: true, repeatable: true },
|
|
223
|
+
'filter-json': { takesValue: true },
|
|
224
|
+
limit: { takesValue: true },
|
|
225
|
+
offset: { takesValue: true },
|
|
226
|
+
fields: { takesValue: true }
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
await ensureCanvasRunning();
|
|
230
|
+
const scope = await optionalFrameScope(flags.frame);
|
|
231
|
+
|
|
232
|
+
// type + bbox filter server-side via the search endpoint
|
|
233
|
+
const queryParams = new URLSearchParams();
|
|
234
|
+
if (typeof flags.type === 'string') queryParams.set('type', flags.type);
|
|
235
|
+
if (typeof flags.bbox === 'string') {
|
|
236
|
+
const parts = flags.bbox.split(',').map(s => Number(s.trim()));
|
|
237
|
+
if (parts.length !== 4 || parts.some(Number.isNaN)) {
|
|
238
|
+
throw new CliUsageError('--bbox expects "x_min,y_min,x_max,y_max"');
|
|
239
|
+
}
|
|
240
|
+
const [xMin, yMin, xMax, yMax] = parts as [number, number, number, number];
|
|
241
|
+
const [ox, oy] = scope ? [scope.frame.x, scope.frame.y] : [0, 0];
|
|
242
|
+
queryParams.set('x_min', String(xMin + ox));
|
|
243
|
+
queryParams.set('y_min', String(yMin + oy));
|
|
244
|
+
queryParams.set('x_max', String(xMax + ox));
|
|
245
|
+
queryParams.set('y_max', String(yMax + oy));
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
let results = queryParams.size > 0
|
|
249
|
+
? await searchElements(queryParams)
|
|
250
|
+
: await getElements();
|
|
251
|
+
|
|
252
|
+
// key=value / nested / typed predicates filter client-side. Each k=v pair
|
|
253
|
+
// matches on the coerced value (`locked=true` → boolean) OR the raw string
|
|
254
|
+
// (`id=123` must still find id: "123").
|
|
255
|
+
const predicates: Array<(el: ServerElement) => boolean> = [];
|
|
256
|
+
for (const pair of (flags.filter as string[] | undefined) || []) {
|
|
257
|
+
const eq = pair.indexOf('=');
|
|
258
|
+
if (eq === -1) throw new CliUsageError(`--filter expects key=value, got "${pair}"`);
|
|
259
|
+
const key = pair.slice(0, eq);
|
|
260
|
+
const raw = pair.slice(eq + 1);
|
|
261
|
+
const coerced = coerce(raw);
|
|
262
|
+
predicates.push(el => {
|
|
263
|
+
const actual = lookupPath(el, key);
|
|
264
|
+
if (Array.isArray(actual)) {
|
|
265
|
+
return actual.includes(raw) || actual.includes(coerced as never);
|
|
266
|
+
}
|
|
267
|
+
return actual === coerced || actual === raw;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
if (typeof flags['filter-json'] === 'string') {
|
|
271
|
+
let obj: Record<string, unknown>;
|
|
272
|
+
try {
|
|
273
|
+
obj = JSON.parse(flags['filter-json']);
|
|
274
|
+
} catch (error) {
|
|
275
|
+
throw new CliUsageError(`Invalid JSON in --filter-json: ${(error as Error).message}`);
|
|
276
|
+
}
|
|
277
|
+
for (const [key, expected] of Object.entries(obj)) {
|
|
278
|
+
predicates.push(el => {
|
|
279
|
+
const actual = lookupPath(el, key);
|
|
280
|
+
if (Array.isArray(actual)) return actual.includes(expected as never);
|
|
281
|
+
return actual === expected;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (scope) results = results.filter(el => el.frameId === scope.frame.id).map(el => toFrameSpace(el, scope.frame));
|
|
287
|
+
if (predicates.length > 0) {
|
|
288
|
+
results = results.filter(el => predicates.every(matches => matches(el)));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const whole = (name: string): number | undefined => {
|
|
292
|
+
const raw = flags[name];
|
|
293
|
+
if (raw === undefined) return undefined;
|
|
294
|
+
const value = Number(raw);
|
|
295
|
+
if (!Number.isInteger(value) || value < (name === 'limit' ? 1 : 0)) throw new CliUsageError(`--${name} must be a whole number`);
|
|
296
|
+
return value;
|
|
297
|
+
};
|
|
298
|
+
printJson(pageOf(results, { limit: whole('limit'), offset: whole('offset'), fields: typeof flags.fields === 'string' ? flags.fields.split(',').map(f => f.trim()).filter(Boolean) : undefined }));
|
|
299
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { parseArgs, CliUsageError } from '../args.js';
|
|
2
|
+
import { printJson } from '../util.js';
|
|
3
|
+
import { ensureCanvasRunning } from '../../core/spawn.js';
|
|
4
|
+
import { addFrame, deleteFrame, listFrameSummaries, reorderFrame } from '../../core/frame-ops.js';
|
|
5
|
+
import { addFrameAround, moveElementsToFrame } from '../../core/bulk-ops.js';
|
|
6
|
+
|
|
7
|
+
const USAGE = 'Usage: frame list | add <name> [--width N] [--height N | --around a,b,c [--padding N]] | adopt <name|id> --ids a,b,c | reorder <name|id> <position> | delete <name|id>\n reorder changes the tab order only (position 1 = first tab); no frame or shape moves.\n list and add report canvasX/canvasY in canvas coordinates; every --frame option uses coordinates relative to the frame instead.';
|
|
8
|
+
|
|
9
|
+
const size = (flags: Record<string, unknown>, name: string): number | undefined => {
|
|
10
|
+
const raw = flags[name];
|
|
11
|
+
if (raw === undefined) return undefined;
|
|
12
|
+
const value = Number(raw);
|
|
13
|
+
if (!Number.isFinite(value) || value <= 0) throw new CliUsageError(`--${name} must be a positive number`);
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const ids = (value: string): string[] => value.split(',').map(s => s.trim()).filter(Boolean);
|
|
18
|
+
|
|
19
|
+
export async function frame(argv: string[]): Promise<void> {
|
|
20
|
+
const { positionals, flags } = parseArgs(argv, { width: { takesValue: true }, height: { takesValue: true }, around: { takesValue: true }, padding: { takesValue: true }, ids: { takesValue: true } });
|
|
21
|
+
const [action, ref, position] = positionals;
|
|
22
|
+
if (action !== 'list' && action !== 'add' && action !== 'adopt' && action !== 'delete' && action !== 'reorder') throw new CliUsageError(USAGE);
|
|
23
|
+
|
|
24
|
+
await ensureCanvasRunning();
|
|
25
|
+
|
|
26
|
+
switch (action) {
|
|
27
|
+
case 'list':
|
|
28
|
+
printJson(await listFrameSummaries());
|
|
29
|
+
return;
|
|
30
|
+
case 'add':
|
|
31
|
+
if (!ref) throw new CliUsageError('Usage: frame add <name> [--width N] [--height N | --around a,b,c [--padding N]]');
|
|
32
|
+
if (typeof flags.around === 'string') {
|
|
33
|
+
const padding = flags.padding === undefined ? undefined : Number(flags.padding);
|
|
34
|
+
if (padding !== undefined && !(padding >= 0)) throw new CliUsageError('--padding must be a number of at least 0');
|
|
35
|
+
printJson({ success: true, ...(await addFrameAround(ref, ids(flags.around), padding)) });
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
printJson({ success: true, frame: await addFrame(ref, { width: size(flags, 'width'), height: size(flags, 'height') }) });
|
|
39
|
+
return;
|
|
40
|
+
case 'adopt':
|
|
41
|
+
if (!ref || typeof flags.ids !== 'string') throw new CliUsageError('Usage: frame adopt <name|id> --ids a,b,c (puts them on the frame without moving them)');
|
|
42
|
+
printJson({ success: true, ...(await moveElementsToFrame(ids(flags.ids), ref)) });
|
|
43
|
+
return;
|
|
44
|
+
case 'reorder': {
|
|
45
|
+
const slot = Number(position);
|
|
46
|
+
if (!ref || !Number.isInteger(slot) || slot < 1) throw new CliUsageError('Usage: frame reorder <name|id> <position> (1 = first tab; no frame moves)');
|
|
47
|
+
printJson({ success: true, order: await reorderFrame(ref, slot) });
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
case 'delete':
|
|
51
|
+
if (!ref) throw new CliUsageError('Usage: frame delete <name|id>');
|
|
52
|
+
printJson({ success: true, ...(await deleteFrame(ref)) });
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { parseArgs, CliUsageError } from '../args.js';
|
|
6
|
+
import { printJson, note } from '../util.js';
|
|
7
|
+
|
|
8
|
+
const SKILL_NAME = 'excalidraw-skill';
|
|
9
|
+
|
|
10
|
+
// The published package layout is <root>/{dist,skills,...}; this module
|
|
11
|
+
// compiles to dist/cli/commands/, so the package root is three levels up.
|
|
12
|
+
// Resolving relative to the module path keeps this working from the npx
|
|
13
|
+
// cache and global installs alike.
|
|
14
|
+
function findSkillSource(): string {
|
|
15
|
+
const packageRoot = fileURLToPath(new URL('../../..', import.meta.url));
|
|
16
|
+
const source = path.join(packageRoot, 'skills', SKILL_NAME);
|
|
17
|
+
if (!fs.existsSync(path.join(source, 'SKILL.md'))) {
|
|
18
|
+
throw new Error(`Bundled skill not found at ${source} (broken install?)`);
|
|
19
|
+
}
|
|
20
|
+
return source;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function expandHome(input: string): string {
|
|
24
|
+
if (input === '~') return os.homedir();
|
|
25
|
+
if (input.startsWith(`~${path.sep}`)) return path.join(os.homedir(), input.slice(2));
|
|
26
|
+
return input;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function resolveSkillsRoot(target: string): string {
|
|
30
|
+
if (target === 'claude') return path.join(os.homedir(), '.claude', 'skills');
|
|
31
|
+
if (target === 'codex') return path.join(os.homedir(), '.codex', 'skills');
|
|
32
|
+
return path.resolve(expandHome(target));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function resolveTarget(target: string): { root: string; target: string; mode: string } {
|
|
36
|
+
const root = resolveSkillsRoot(target);
|
|
37
|
+
return { root, target: path.join(root, SKILL_NAME), mode: `target:${target}` };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function countFiles(dir: string): number {
|
|
41
|
+
let count = 0;
|
|
42
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
43
|
+
if (entry.isDirectory()) count += countFiles(path.join(dir, entry.name));
|
|
44
|
+
else count++;
|
|
45
|
+
}
|
|
46
|
+
return count;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export async function installSkill(argv: string[]): Promise<void> {
|
|
50
|
+
const { flags } = parseArgs(argv, {
|
|
51
|
+
dir: { takesValue: true },
|
|
52
|
+
target: { takesValue: true },
|
|
53
|
+
'print-source': { takesValue: false }
|
|
54
|
+
});
|
|
55
|
+
const source = findSkillSource();
|
|
56
|
+
|
|
57
|
+
if (flags['print-source'] === true) {
|
|
58
|
+
printJson({
|
|
59
|
+
success: true,
|
|
60
|
+
skill: SKILL_NAME,
|
|
61
|
+
source,
|
|
62
|
+
files: countFiles(source)
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (flags.dir !== undefined && flags.target !== undefined) {
|
|
68
|
+
throw new CliUsageError('Use either --dir <skills-root> or --target <alias|skills-root>, not both');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const explicitDir = flags.dir as string | undefined;
|
|
72
|
+
const targetSpec = (flags.target as string | undefined) ?? 'claude';
|
|
73
|
+
const explicitRoot = explicitDir ? path.resolve(expandHome(explicitDir)) : undefined;
|
|
74
|
+
const resolved = explicitRoot
|
|
75
|
+
? { root: explicitRoot, target: path.join(explicitRoot, SKILL_NAME), mode: 'dir' }
|
|
76
|
+
: resolveTarget(targetSpec);
|
|
77
|
+
const { root, target, mode } = resolved;
|
|
78
|
+
|
|
79
|
+
// Replace, never overlay: stale files from older skill versions (e.g. the
|
|
80
|
+
// pre-1.1 scripts/*.cjs helpers) must not survive an upgrade.
|
|
81
|
+
let lstat: fs.Stats | undefined;
|
|
82
|
+
try {
|
|
83
|
+
lstat = fs.lstatSync(target);
|
|
84
|
+
} catch { /* target does not exist yet */ }
|
|
85
|
+
|
|
86
|
+
if (lstat?.isSymbolicLink()) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
`${target} is a symlink; refusing to replace it. Remove it manually if you want the CLI to manage this install.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Stage into a sibling temp dir, then swap
|
|
93
|
+
fs.mkdirSync(root, { recursive: true });
|
|
94
|
+
const staging = fs.mkdtempSync(path.join(root, `.${SKILL_NAME}-staging-`));
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
fs.cpSync(source, staging, { recursive: true });
|
|
98
|
+
if (lstat) {
|
|
99
|
+
fs.rmSync(target, { recursive: true, force: true });
|
|
100
|
+
note(`Replaced existing install at ${target}`);
|
|
101
|
+
}
|
|
102
|
+
fs.renameSync(staging, target);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
fs.rmSync(staging, { recursive: true, force: true });
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
printJson({
|
|
109
|
+
success: true,
|
|
110
|
+
skill: SKILL_NAME,
|
|
111
|
+
mode,
|
|
112
|
+
root,
|
|
113
|
+
target,
|
|
114
|
+
files: countFiles(target)
|
|
115
|
+
});
|
|
116
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { parseArgs, CliUsageError } from '../args.js';
|
|
2
|
+
import { printJson, readJsonInput } from '../util.js';
|
|
3
|
+
import { ensureCanvasRunning } from '../../core/spawn.js';
|
|
4
|
+
import { drawDiagram } from '../../core/diagram-ops.js';
|
|
5
|
+
|
|
6
|
+
// Draws a diagram from a description of its nodes and edges; the same as the layout_diagram tool.
|
|
7
|
+
export async function layout(argv: string[]): Promise<void> {
|
|
8
|
+
const { positionals, flags } = parseArgs(argv, { frame: { takesValue: true }, x: { takesValue: true }, y: { takesValue: true } });
|
|
9
|
+
const spec = await readJsonInput(positionals[0], 'diagram');
|
|
10
|
+
if (!spec || typeof spec !== 'object' || Array.isArray(spec)) throw new CliUsageError('A diagram is a JSON object with "nodes" (and optionally "edges", "groups", "direction")');
|
|
11
|
+
const number = (name: string): number | undefined => (flags[name] === undefined ? undefined : Number(flags[name]));
|
|
12
|
+
await ensureCanvasRunning();
|
|
13
|
+
printJson(await drawDiagram({ ...spec, ...(flags.frame ? { frame: flags.frame } : {}), ...(number('x') === undefined ? {} : { x: number('x') }), ...(number('y') === undefined ? {} : { y: number('y') }) }));
|
|
14
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { parseArgs, CliUsageError, readStdinBuffer } from '../args.js';
|
|
5
|
+
import { printJson, note } from '../util.js';
|
|
6
|
+
import { IMAGE_FLAG_SPEC, imageFormatFromFlags, imageOptionsFromFlags } from '../image-options.js';
|
|
7
|
+
import { decodeSceneInput } from '../../core/scene-input.js';
|
|
8
|
+
import { renderScene } from '../../core/render/index.js';
|
|
9
|
+
|
|
10
|
+
// Render a scene file to PNG/SVG without a canvas server — for CI pipelines
|
|
11
|
+
// that turn committed .excalidraw files into images, or for checking a file
|
|
12
|
+
// an agent just wrote. Accepts .excalidraw JSON, Obsidian .excalidraw.md, a
|
|
13
|
+
// PNG with an embedded scene, a bare element array, or `-` for stdin.
|
|
14
|
+
|
|
15
|
+
export async function render(argv: string[]): Promise<void> {
|
|
16
|
+
const { positionals, flags } = parseArgs(argv, IMAGE_FLAG_SPEC);
|
|
17
|
+
if ((flags.renderer as string | undefined) === 'browser') {
|
|
18
|
+
throw new CliUsageError('render works offline; use `screenshot --renderer browser` for tab rendering');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const input = positionals[0];
|
|
22
|
+
const raw = decodeSceneInput(input && input !== '-' ? fs.readFileSync(path.resolve(input)) : await readStdinBuffer());
|
|
23
|
+
if (!raw.trim()) {
|
|
24
|
+
throw new CliUsageError('No scene provided (pass a .excalidraw / .excalidraw.md / embedded-scene PNG file or pipe a scene to stdin)');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let sceneData: any;
|
|
28
|
+
try {
|
|
29
|
+
sceneData = JSON.parse(raw);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
throw new CliUsageError(`Invalid scene JSON: ${(error as Error).message}`);
|
|
32
|
+
}
|
|
33
|
+
const sourceElements = Array.isArray(sceneData) ? sceneData : sceneData?.elements;
|
|
34
|
+
if (!Array.isArray(sourceElements) || sourceElements.length === 0) {
|
|
35
|
+
throw new CliUsageError('No elements found in the scene');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const format = imageFormatFromFlags(flags);
|
|
39
|
+
const options = imageOptionsFromFlags(flags, format);
|
|
40
|
+
const scene = {
|
|
41
|
+
// Agent-format (label/start/end) and native elements are both accepted;
|
|
42
|
+
// the renderer prepares them the way the canvas tab does.
|
|
43
|
+
elements: sourceElements,
|
|
44
|
+
files: (sceneData && !Array.isArray(sceneData) && sceneData.files) || {},
|
|
45
|
+
appState: !Array.isArray(sceneData) ? sceneData?.appState : undefined
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const result = await renderScene(scene, options);
|
|
49
|
+
for (const warning of result.warnings) note(`warning: ${warning}`);
|
|
50
|
+
|
|
51
|
+
let outPath = flags.out as string | undefined;
|
|
52
|
+
if (!outPath && format === 'svg') {
|
|
53
|
+
process.stdout.write(result.data + '\n');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!outPath) {
|
|
57
|
+
const stem = input && input !== '-' ? path.basename(input).replace(/\.excalidraw(\.md|\.png)?$|\.json$|\.png$/i, '') : 'scene';
|
|
58
|
+
outPath = path.join(os.tmpdir(), `${stem}-${Date.now()}.png`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const resolved = path.resolve(outPath);
|
|
62
|
+
if (format === 'svg') {
|
|
63
|
+
fs.writeFileSync(resolved, result.data, 'utf-8');
|
|
64
|
+
} else {
|
|
65
|
+
fs.writeFileSync(resolved, Buffer.from(result.data, 'base64'));
|
|
66
|
+
}
|
|
67
|
+
printJson({ success: true, file: resolved, format, renderer: 'node', width: result.width, height: result.height, elements: scene.elements.length });
|
|
68
|
+
}
|