@field/cascade 0.10.0 → 0.11.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/AGENTS.md +20 -3
- package/CHANGELOG.md +187 -0
- package/README.md +1 -2
- package/dist/assets/{CodeEditor-DSZBpzdy.js → CodeEditor-4O7FQ__R.js} +4 -4
- package/dist/assets/{CodePanel-sY6sZa7B.js → CodePanel-BU-autmq.js} +2 -2
- package/dist/assets/{CustomNodeDialog-BRKnqZhp.js → CustomNodeDialog-BRpDfOV5.js} +1 -1
- package/dist/assets/{OpenGraphDialog-ZsgL-iwr.js → OpenGraphDialog-BwbRlC0X.js} +1 -1
- package/dist/assets/{ProjectSettings-Cw17nNe3.js → ProjectSettings-DLOXLxcA.js} +1 -1
- package/dist/assets/{SettingsDialog-p25h3tj0.js → SettingsDialog-Bz8JxISH.js} +1 -1
- package/dist/assets/{VersionHistoryDialog-DzFLUotB.js → VersionHistoryDialog-D5Z0nJ5-.js} +1 -1
- package/dist/assets/{core-BICrEt0y.js → core-Yqi0Ni61.js} +1 -1
- package/dist/assets/{cssMode-D7TXw57I.js → cssMode-CxUzc4vp.js} +1 -1
- package/dist/assets/{definitions-DUww2Rt-.js → definitions-GreEMXLV.js} +1 -1
- package/dist/assets/{editor.api-DvkCO3ko.js → editor.api-BNFb25CX.js} +1 -1
- package/dist/assets/{freemarker2-BA2lxsF1.js → freemarker2-0ZDnWxeM.js} +1 -1
- package/dist/assets/geo-u0n_jOsD.js +1 -0
- package/dist/assets/{handlebars-BcDiyPd8.js → handlebars-Cy18MoaD.js} +1 -1
- package/dist/assets/{html-C7O4TyhX.js → html-B-2Dx7nq.js} +1 -1
- package/dist/assets/{htmlMode-WaDGF3Mj.js → htmlMode-DUAc9B_d.js} +1 -1
- package/dist/assets/{image-DR4oeyJB.js → image-cAa-Nu9O.js} +1 -1
- package/dist/assets/{index-DyvDC6pS.js → index-5ZtDAuy2.js} +42 -41
- package/dist/assets/{javascript-CpIEK7tz.js → javascript-DeQsDqP5.js} +1 -1
- package/dist/assets/{jsonMode-B2FltW0f.js → jsonMode-BiFwJVSk.js} +1 -1
- package/dist/assets/{liquid-CN6FFHZE.js → liquid-BLoHH68a.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-QhV9XtLp.js → lspLanguageFeatures-CNFgm1Kv.js} +1 -1
- package/dist/assets/math-DioIQOPJ.js +1 -0
- package/dist/assets/{mdx-DE89pafV.js → mdx-CFXQVNfs.js} +1 -1
- package/dist/assets/pop-DC_TQG9t.js +1 -0
- package/dist/assets/{python-ByTllTB9.js → python-Cf7S7p2E.js} +1 -1
- package/dist/assets/{razor-USYlRRCE.js → razor-CMHBcG-g.js} +1 -1
- package/dist/assets/{tsMode-BXpN8iUz.js → tsMode-BEih0GDj.js} +1 -1
- package/dist/assets/{typescript-DInBjGQQ.js → typescript-COEKYD_a.js} +1 -1
- package/dist/assets/{workers-C7Ye5B7D.js → workers-BNhAhMNn.js} +1 -1
- package/dist/assets/{xml-U0Uocqyo.js → xml-CPiMpnPl.js} +1 -1
- package/dist/assets/{yaml-CBw_PVYf.js → yaml-Bgp1ITLR.js} +1 -1
- package/dist/cli/Graph-ZJJTRQTM.js +2975 -0
- package/dist/cli/chunk-2KXB47FP.js +115 -0
- package/dist/cli/chunk-35D343DC.js +1447 -0
- package/dist/cli/chunk-36P5K3SD.js +631 -0
- package/dist/cli/chunk-3JTJHF7V.js +267 -0
- package/dist/cli/chunk-4UDFYF5G.js +132 -0
- package/dist/cli/chunk-53NMBJAO.js +35 -0
- package/dist/cli/chunk-A4OAMOZH.js +310 -0
- package/dist/cli/chunk-BIJO5OFS.js +71 -0
- package/dist/cli/chunk-BP7UKF36.js +376 -0
- package/dist/cli/chunk-CKS2FQWR.js +89 -0
- package/dist/cli/chunk-CO22XHNG.js +593 -0
- package/dist/cli/chunk-D6BUOHUG.js +634 -0
- package/dist/cli/chunk-DEQSEFFH.js +153 -0
- package/dist/cli/chunk-DUIUFVU2.js +241 -0
- package/dist/cli/chunk-EUIAC3U3.js +3006 -0
- package/dist/cli/chunk-FCDXJ6EK.js +2208 -0
- package/dist/cli/chunk-GFS6W3C5.js +308 -0
- package/dist/cli/chunk-HFHWYL55.js +139 -0
- package/dist/cli/chunk-HSNOBIVT.js +263 -0
- package/dist/cli/chunk-ICH7N5PN.js +26 -0
- package/dist/cli/chunk-J7VK7MNF.js +418 -0
- package/dist/cli/chunk-KH4MUBKF.js +1551 -0
- package/dist/cli/chunk-MIIEFUGG.js +623 -0
- package/dist/cli/chunk-OWWBYLHC.js +136 -0
- package/dist/cli/chunk-POMMNKZZ.js +672 -0
- package/dist/cli/chunk-QBBKRNGY.js +90 -0
- package/dist/cli/chunk-QQPA2ZHH.js +273 -0
- package/dist/cli/chunk-RLCAJBVR.js +224 -0
- package/dist/cli/chunk-RQZ4SX5R.js +1125 -0
- package/dist/cli/chunk-RUU3YWXU.js +99 -0
- package/dist/cli/chunk-RXDIMXN5.js +98 -0
- package/dist/cli/chunk-SGJAET2L.js +197 -0
- package/dist/cli/chunk-VVGSLVSF.js +151 -0
- package/dist/cli/chunk-WD62JIP6.js +118 -0
- package/dist/cli/chunk-WIH4TEIS.js +104 -0
- package/dist/cli/chunk-WKURDVYP.js +1119 -0
- package/dist/cli/chunk-WPUDGEFY.js +20 -0
- package/dist/cli/chunk-XWDSKG7N.js +1301 -0
- package/dist/cli/chunk-YAT5Y25U.js +121 -0
- package/dist/cli/chunk-ZL4JTG5Y.js +37 -0
- package/dist/cli/cliCommands-UQSFGEHF.js +3464 -0
- package/dist/cli/commands-Q23M26QM.js +1292 -0
- package/dist/cli/definitions-HF2FTHYU.js +32 -0
- package/dist/cli/doctorCommand-B7BPQMN6.js +76 -0
- package/dist/cli/edit-JHCPTQFT.js +28 -0
- package/dist/cli/editorCommands-UIF5YLUZ.js +33 -0
- package/dist/cli/encode-HAUZTYPT.js +17 -0
- package/dist/cli/frames-LSAUBZ7P.js +16 -0
- package/dist/cli/geo-4RNK3QVN.js +43 -0
- package/dist/cli/graphCommands-6BMAKGQE.js +184 -0
- package/dist/cli/graphFile-VPSQ6OF7.js +286 -0
- package/dist/cli/headlessCanvas-5XLDZT7M.js +15 -0
- package/dist/cli/helpCommand-3VRE3KVO.js +155 -0
- package/dist/cli/index.js +100 -30756
- package/dist/cli/math-ZRMLKU2D.js +16 -0
- package/dist/cli/mcp-ZLEEMYGF.js +164 -0
- package/dist/cli/parity-KINARCP2.js +328 -0
- package/dist/cli/pop-USDFXB7H.js +39 -0
- package/dist/cli/project-K3QIPGBB.js +12 -0
- package/dist/cli/projectDefinition-DMTZN2NE.js +27 -0
- package/dist/cli/projectRuntime-Z5PJOH47.js +48 -0
- package/dist/cli/registerStandardNodes-S2VLMF6J.js +3081 -0
- package/dist/cli/render-YURAPPUI.js +436 -0
- package/dist/cli/runCommand-PI764LEG.js +198 -0
- package/dist/cli/runner-RA6UKEPD.js +37 -0
- package/dist/cli/runtime/image.ts +277 -0
- package/dist/cli/runtime/stage.ts +4 -1
- package/dist/cli/stageRunner-KUNIMQKJ.js +10 -0
- package/dist/cli/verbs-RCE3K4VQ.js +19 -0
- package/dist/cli/webBuild-GT4PZT5D.js +37 -0
- package/dist/contracts/documentFormat.d.ts +18 -0
- package/dist/contracts/documentFormat.js +195 -0
- package/dist/contracts/editor.d.ts +17 -0
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +1 -0
- package/dist/image.d.ts +141 -0
- package/dist/image.js +127 -0
- package/dist/index.html +1 -1
- package/dist/player/editor.js +32 -7
- package/dist/runtime/builtins/headless.d.ts +19 -0
- package/dist/runtime/builtins/headless.js +25 -0
- package/dist/runtime/builtins/image/contactSheet.d.ts +226 -0
- package/dist/runtime/builtins/image/contactSheet.js +199 -0
- package/dist/runtime/builtins/image/index.d.ts +9 -0
- package/dist/runtime/builtins/image/index.js +9 -0
- package/dist/stage.js +4 -1
- package/doc/CLI_REFERENCE.md +73 -2
- package/doc/EDITOR_EXPORT.md +11 -2
- package/doc/MCP.md +17 -1
- package/doc/NODE_REFERENCE.md +142 -0
- package/doc/PROJECT_AUTHORING.md +127 -7
- package/package.json +16 -4
- package/dist/assets/ExportDialog-C7dVGua4.js +0 -358
- package/dist/assets/ExportDialog-DOq0flMV.css +0 -1
- package/dist/assets/geo-C2RHOVHC.js +0 -1
- package/dist/assets/math-DaDEgWKt.js +0 -1
- package/dist/assets/pop-pLH7L0PW.js +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
registerDefinitionNodes
|
|
3
|
+
} from "./chunk-SGJAET2L.js";
|
|
4
|
+
import "./chunk-FCDXJ6EK.js";
|
|
5
|
+
import "./chunk-RUU3YWXU.js";
|
|
6
|
+
import {
|
|
7
|
+
cameraRegistration,
|
|
8
|
+
feedbackRegistration,
|
|
9
|
+
frozenRegistration,
|
|
10
|
+
packRegistration,
|
|
11
|
+
pickRegistration,
|
|
12
|
+
previousRegistration,
|
|
13
|
+
timeRegistration
|
|
14
|
+
} from "./chunk-D6BUOHUG.js";
|
|
15
|
+
import "./chunk-RXDIMXN5.js";
|
|
16
|
+
import "./chunk-DEQSEFFH.js";
|
|
17
|
+
import "./chunk-GFS6W3C5.js";
|
|
18
|
+
import "./chunk-HFHWYL55.js";
|
|
19
|
+
import "./chunk-CO22XHNG.js";
|
|
20
|
+
import "./chunk-BIJO5OFS.js";
|
|
21
|
+
|
|
22
|
+
// src/nodes/core/definitions.ts
|
|
23
|
+
registerDefinitionNodes([
|
|
24
|
+
cameraRegistration,
|
|
25
|
+
timeRegistration,
|
|
26
|
+
feedbackRegistration,
|
|
27
|
+
previousRegistration,
|
|
28
|
+
pickRegistration,
|
|
29
|
+
packRegistration,
|
|
30
|
+
frozenRegistration
|
|
31
|
+
]);
|
|
32
|
+
//# sourceMappingURL=definitions-HF2FTHYU.js.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
provisionPythonEnv,
|
|
3
|
+
pythonEnvStatus
|
|
4
|
+
} from "./chunk-WD62JIP6.js";
|
|
5
|
+
|
|
6
|
+
// src/cli/doctorCommand.ts
|
|
7
|
+
import { execFile } from "node:child_process";
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
var DOCTOR_USAGE = "cascade doctor [project-directory] [--fix] [--json]";
|
|
11
|
+
async function runDoctorCommand(args) {
|
|
12
|
+
const fix = args.includes("--fix");
|
|
13
|
+
const json = args.includes("--json");
|
|
14
|
+
const root = path.resolve(args.slice(1).find((arg) => !arg.startsWith("-")) ?? ".");
|
|
15
|
+
if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) throw new Error(`${root} is not a directory`);
|
|
16
|
+
const checks = await doctor(root, { fix, log: (line) => {
|
|
17
|
+
if (!json) console.log(line);
|
|
18
|
+
} });
|
|
19
|
+
const ok = checks.every((check) => check.ok || check.optional);
|
|
20
|
+
if (json) process.stdout.write(`${JSON.stringify({ project: root, ok, checks })}
|
|
21
|
+
`);
|
|
22
|
+
else for (const check of checks) console.log(`${check.ok ? "ok " : check.optional ? "warn" : "FAIL"} ${check.name}: ${check.detail}`);
|
|
23
|
+
if (!ok) {
|
|
24
|
+
if (json) console.error(checks.filter((check) => !check.ok && !check.optional).map((check) => `${check.name}: ${check.detail}`).join("\n"));
|
|
25
|
+
process.exitCode = 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function doctor(root, options = {}) {
|
|
29
|
+
const checks = [];
|
|
30
|
+
let env;
|
|
31
|
+
try {
|
|
32
|
+
env = pythonEnvStatus(root);
|
|
33
|
+
if (env.declared && env.state !== "current" && options.fix) env = await provisionPythonEnv(root, options.log);
|
|
34
|
+
checks.push(env.state === "none" ? { name: "python environment", ok: true, detail: 'none declared (cascade.json "python": { "requirements": [...] } provisions one)' } : env.state === "current" ? { name: "python environment", ok: true, detail: `current, ${path.relative(root, env.directory)}` } : { name: "python environment", ok: false, detail: `${env.state}: ${env.reason}. Run cascade doctor --fix` });
|
|
35
|
+
} catch (error) {
|
|
36
|
+
checks.push({ name: "python environment", ok: false, detail: error instanceof Error ? error.message : String(error) });
|
|
37
|
+
}
|
|
38
|
+
if (hasStages(root)) {
|
|
39
|
+
try {
|
|
40
|
+
const { ProjectRoot } = await import("./project-K3QIPGBB.js");
|
|
41
|
+
const { readStageConfig } = await import("./stageRunner-KUNIMQKJ.js");
|
|
42
|
+
const { python } = readStageConfig(new ProjectRoot(root));
|
|
43
|
+
const version = await output(python, ["-c", "import sys; print(sys.version.split()[0], sys.executable)"], root);
|
|
44
|
+
checks.push({ name: "stage interpreter", ok: true, detail: `Python ${version}` });
|
|
45
|
+
} catch (error) {
|
|
46
|
+
checks.push({ name: "stage interpreter", ok: false, detail: error instanceof Error ? error.message : String(error) });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const { hasFfmpeg } = await import("./encode-HAUZTYPT.js");
|
|
50
|
+
checks.push(await hasFfmpeg() ? { name: "ffmpeg", ok: true, detail: "on the PATH" } : { name: "ffmpeg", ok: false, optional: true, detail: "not on the PATH: --mp4 and cascade render videos need it (brew install ffmpeg)" });
|
|
51
|
+
const { canvasAvailable, CANVAS_PACKAGE } = await import("./headlessCanvas-5XLDZT7M.js");
|
|
52
|
+
checks.push(await canvasAvailable() ? { name: "headless canvas", ok: true, detail: CANVAS_PACKAGE } : { name: "headless canvas", ok: false, optional: true, detail: `${CANVAS_PACKAGE} is not installed: drawing nodes cannot run headlessly (npm install ${CANVAS_PACKAGE})` });
|
|
53
|
+
return checks;
|
|
54
|
+
}
|
|
55
|
+
function hasStages(root) {
|
|
56
|
+
try {
|
|
57
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(root, "cascade.json"), "utf8"));
|
|
58
|
+
return Boolean(manifest?.exec?.stages);
|
|
59
|
+
} catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function output(command, args, cwd) {
|
|
64
|
+
return new Promise((resolve, reject) => {
|
|
65
|
+
execFile(command, args, { cwd, timeout: 3e4 }, (error, stdout, stderr) => {
|
|
66
|
+
if (error) reject(new Error(`${command} does not start: ${(stderr || error.message).trim().slice(-500)}`));
|
|
67
|
+
else resolve(stdout.trim());
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
DOCTOR_USAGE,
|
|
73
|
+
doctor,
|
|
74
|
+
runDoctorCommand
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=doctorCommand-B7BPQMN6.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GRAPH_EDIT_OPERATIONS,
|
|
3
|
+
GraphEditError,
|
|
4
|
+
GraphEditor,
|
|
5
|
+
applyOperation,
|
|
6
|
+
defaultIdFor,
|
|
7
|
+
flowStep,
|
|
8
|
+
placeNode,
|
|
9
|
+
readGraph,
|
|
10
|
+
readWire,
|
|
11
|
+
splitEndpoint,
|
|
12
|
+
wireLabel
|
|
13
|
+
} from "./chunk-XWDSKG7N.js";
|
|
14
|
+
import "./chunk-BIJO5OFS.js";
|
|
15
|
+
export {
|
|
16
|
+
GRAPH_EDIT_OPERATIONS,
|
|
17
|
+
GraphEditError,
|
|
18
|
+
GraphEditor,
|
|
19
|
+
applyOperation,
|
|
20
|
+
defaultIdFor,
|
|
21
|
+
flowStep,
|
|
22
|
+
placeNode,
|
|
23
|
+
readGraph,
|
|
24
|
+
readWire,
|
|
25
|
+
splitEndpoint,
|
|
26
|
+
wireLabel
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=edit-JHCPTQFT.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EDITOR_COMMANDS,
|
|
3
|
+
EDITOR_HELP,
|
|
4
|
+
runEditorCommand,
|
|
5
|
+
sceneDocument
|
|
6
|
+
} from "./chunk-WKURDVYP.js";
|
|
7
|
+
import "./chunk-3JTJHF7V.js";
|
|
8
|
+
import "./chunk-EUIAC3U3.js";
|
|
9
|
+
import "./chunk-36P5K3SD.js";
|
|
10
|
+
import "./chunk-D6BUOHUG.js";
|
|
11
|
+
import "./chunk-RXDIMXN5.js";
|
|
12
|
+
import "./chunk-QQPA2ZHH.js";
|
|
13
|
+
import "./chunk-KH4MUBKF.js";
|
|
14
|
+
import "./chunk-35D343DC.js";
|
|
15
|
+
import "./chunk-DEQSEFFH.js";
|
|
16
|
+
import "./chunk-HSNOBIVT.js";
|
|
17
|
+
import "./chunk-ICH7N5PN.js";
|
|
18
|
+
import "./chunk-GFS6W3C5.js";
|
|
19
|
+
import "./chunk-HFHWYL55.js";
|
|
20
|
+
import "./chunk-CO22XHNG.js";
|
|
21
|
+
import "./chunk-RQZ4SX5R.js";
|
|
22
|
+
import "./chunk-A4OAMOZH.js";
|
|
23
|
+
import "./chunk-J7VK7MNF.js";
|
|
24
|
+
import "./chunk-XWDSKG7N.js";
|
|
25
|
+
import "./chunk-BIJO5OFS.js";
|
|
26
|
+
import "./chunk-WIH4TEIS.js";
|
|
27
|
+
export {
|
|
28
|
+
EDITOR_COMMANDS,
|
|
29
|
+
EDITOR_HELP,
|
|
30
|
+
runEditorCommand,
|
|
31
|
+
sceneDocument
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=editorCommands-UIF5YLUZ.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_CRF,
|
|
3
|
+
encodeMp4,
|
|
4
|
+
encodeSequence,
|
|
5
|
+
frameSequences,
|
|
6
|
+
hasFfmpeg,
|
|
7
|
+
timelineFrameSpec
|
|
8
|
+
} from "./chunk-YAT5Y25U.js";
|
|
9
|
+
export {
|
|
10
|
+
DEFAULT_CRF,
|
|
11
|
+
encodeMp4,
|
|
12
|
+
encodeSequence,
|
|
13
|
+
frameSequences,
|
|
14
|
+
hasFfmpeg,
|
|
15
|
+
timelineFrameSpec
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=encode-HAUZTYPT.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cookUntilSettled,
|
|
3
|
+
outputPorts,
|
|
4
|
+
parseFrameSpec,
|
|
5
|
+
renderFrameRange
|
|
6
|
+
} from "./chunk-BP7UKF36.js";
|
|
7
|
+
import "./chunk-RUU3YWXU.js";
|
|
8
|
+
import "./chunk-ICH7N5PN.js";
|
|
9
|
+
import "./chunk-CO22XHNG.js";
|
|
10
|
+
export {
|
|
11
|
+
cookUntilSettled,
|
|
12
|
+
outputPorts,
|
|
13
|
+
parseFrameSpec,
|
|
14
|
+
renderFrameRange
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=frames-LSAUBZ7P.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
browserAssetCapability
|
|
3
|
+
} from "./chunk-53NMBJAO.js";
|
|
4
|
+
import {
|
|
5
|
+
registerDefinitionNodes
|
|
6
|
+
} from "./chunk-SGJAET2L.js";
|
|
7
|
+
import "./chunk-FCDXJ6EK.js";
|
|
8
|
+
import "./chunk-RUU3YWXU.js";
|
|
9
|
+
import {
|
|
10
|
+
geoNodeDefinitions,
|
|
11
|
+
geoNodeRegistrations
|
|
12
|
+
} from "./chunk-35D343DC.js";
|
|
13
|
+
import "./chunk-DEQSEFFH.js";
|
|
14
|
+
import "./chunk-HSNOBIVT.js";
|
|
15
|
+
import "./chunk-GFS6W3C5.js";
|
|
16
|
+
import "./chunk-HFHWYL55.js";
|
|
17
|
+
import "./chunk-CO22XHNG.js";
|
|
18
|
+
import "./chunk-J7VK7MNF.js";
|
|
19
|
+
import "./chunk-BIJO5OFS.js";
|
|
20
|
+
|
|
21
|
+
// src/nodes/geo/library.ts
|
|
22
|
+
var geoLibrary = {
|
|
23
|
+
id: "geo",
|
|
24
|
+
label: "Geometry",
|
|
25
|
+
icon: "Shapes",
|
|
26
|
+
categories: [{
|
|
27
|
+
id: "geometry",
|
|
28
|
+
label: "Geometry",
|
|
29
|
+
nodes: geoNodeDefinitions.map(([moduleId, definition]) => ({
|
|
30
|
+
name: definition.label ?? moduleId.split(".").pop(),
|
|
31
|
+
icon: definition.icon ?? "Shapes",
|
|
32
|
+
description: definition.description ?? "",
|
|
33
|
+
type: moduleId
|
|
34
|
+
}))
|
|
35
|
+
}]
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/nodes/geo/index.ts
|
|
39
|
+
registerDefinitionNodes(geoNodeRegistrations, { assets: browserAssetCapability });
|
|
40
|
+
export {
|
|
41
|
+
geoLibrary
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=geo-4RNK3QVN.js.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import {
|
|
2
|
+
VERBS,
|
|
3
|
+
graphOptions
|
|
4
|
+
} from "./chunk-POMMNKZZ.js";
|
|
5
|
+
|
|
6
|
+
// src/cli/graphCommands.ts
|
|
7
|
+
import fs from "node:fs/promises";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
var loadGraphFile = async () => (await import("./graphFile-VPSQ6OF7.js")).GraphFile;
|
|
10
|
+
async function runGraphCommand(args, options) {
|
|
11
|
+
const parsed = parseArguments(args);
|
|
12
|
+
const [command, ...rest] = parsed.positional;
|
|
13
|
+
const say = options.json ? () => {
|
|
14
|
+
} : (line) => console.log(line);
|
|
15
|
+
if (command === "graph") {
|
|
16
|
+
const [sub, file2] = rest;
|
|
17
|
+
if (sub === "create") {
|
|
18
|
+
const created = await (await loadGraphFile()).create(required(file2, "cascade graph create <graph>"), optional(parsed.values.name));
|
|
19
|
+
say(`created ${created}`);
|
|
20
|
+
return { file: created };
|
|
21
|
+
}
|
|
22
|
+
if (sub === "read") {
|
|
23
|
+
const graph = await (await loadGraphFile()).open(required(file2, "cascade graph read <graph>"));
|
|
24
|
+
const { readGraph } = await import("./edit-JHCPTQFT.js");
|
|
25
|
+
const read = readGraph(graph.document, optional(parsed.values.in, "in"));
|
|
26
|
+
if (!options.json) printGraph(read);
|
|
27
|
+
return { file: graph.file, ...read };
|
|
28
|
+
}
|
|
29
|
+
if (sub === "list") {
|
|
30
|
+
const listed = await listGraphs(file2 ?? ".");
|
|
31
|
+
for (const entry of listed) say(`${entry.file} ${entry.name ?? ""} (${entry.nodes} nodes, ${entry.wires} wires)`);
|
|
32
|
+
return { graphs: listed };
|
|
33
|
+
}
|
|
34
|
+
throw new Error("usage: cascade graph create|read|list ...");
|
|
35
|
+
}
|
|
36
|
+
const twoWords = command === "node" || command === "subnet";
|
|
37
|
+
const [file, ...operands] = twoWords ? rest.slice(1) : rest;
|
|
38
|
+
const graphFile = required(file, `cascade ${command} <graph> ...`);
|
|
39
|
+
const operations = command === "edit" ? await readOperations(required(operands[0], "cascade edit <graph> <operations.json | ->")) : [operationFor(twoWords ? `${command} ${rest[0]}` : command, operands, parsed)];
|
|
40
|
+
return applyEdits(graphFile, operations, { dryRun: parsed.flags.has("dry-run"), json: options.json });
|
|
41
|
+
}
|
|
42
|
+
function operationFor(name, operands, parsed) {
|
|
43
|
+
const verb = VERBS.find((candidate) => candidate.handler === "graph" && (candidate.name === name || candidate.aliases?.includes(name)));
|
|
44
|
+
if (!verb?.operation) throw new Error(`Unknown graph command: cascade ${name}. Run "cascade --help".`);
|
|
45
|
+
return verb.operation(operands, parsed);
|
|
46
|
+
}
|
|
47
|
+
async function applyEdits(file, operations, options = {}) {
|
|
48
|
+
const graph = await (await loadGraphFile()).open(file);
|
|
49
|
+
const outcome = await graph.applyAll(operations, { dryRun: options.dryRun === true });
|
|
50
|
+
if (!options.json) for (const result of outcome.results) console.log(describe(result));
|
|
51
|
+
for (const warning of outcome.warnings) console.warn(options.json ? warning : `warning: ${warning}`);
|
|
52
|
+
if (options.dryRun && !options.json) console.log("dry run: nothing written");
|
|
53
|
+
return { file: graph.file, changed: outcome.changed, dryRun: options.dryRun === true, results: outcome.results };
|
|
54
|
+
}
|
|
55
|
+
function describe(result) {
|
|
56
|
+
const node = result.node;
|
|
57
|
+
const at = (summary) => `${summary.position.x},${summary.position.y}`;
|
|
58
|
+
switch (result.op) {
|
|
59
|
+
case "node.add":
|
|
60
|
+
return `added ${node.id} (${node.module})${node.parent ? ` in ${node.parent}` : ""} at ${at(node)}`;
|
|
61
|
+
case "node.remove": {
|
|
62
|
+
const wires = result.wires;
|
|
63
|
+
return `removed ${result.removed.join(", ")}${wires.length ? `; unwired ${wires.join(", ")}` : ""}`;
|
|
64
|
+
}
|
|
65
|
+
case "connect": {
|
|
66
|
+
const moved = result.moved;
|
|
67
|
+
return `connected ${result.wire}${result.replaced ? ` (replaced ${result.replaced})` : ""}${moved ? `; placed ${moved.id} at ${at(moved)}` : ""}`;
|
|
68
|
+
}
|
|
69
|
+
case "disconnect":
|
|
70
|
+
return `disconnected ${result.removed.join(", ")}`;
|
|
71
|
+
case "set":
|
|
72
|
+
return `set ${result.node}.${result.param}: ${show(result.before)} -> ${show(result.after)}`;
|
|
73
|
+
case "subnet.create": {
|
|
74
|
+
const subnet = result.subnet;
|
|
75
|
+
const inputs = result.inputs;
|
|
76
|
+
const outputs = result.outputs;
|
|
77
|
+
return `created subnet ${subnet.id}${inputs.length ? `; inputs ${inputs.join(", ")}` : ""}${outputs.length ? `; outputs ${outputs.join(", ")}` : ""}`;
|
|
78
|
+
}
|
|
79
|
+
case "subnet.move":
|
|
80
|
+
return `moved ${result.moved.join(", ")} to ${result.to ?? "the top level"}`;
|
|
81
|
+
case "subnet.dissolve":
|
|
82
|
+
return `dissolved; lifted ${result.lifted.join(", ") || "nothing"}`;
|
|
83
|
+
default:
|
|
84
|
+
return JSON.stringify(result);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function show(value) {
|
|
88
|
+
return value === void 0 || value === null ? "(default)" : JSON.stringify(value);
|
|
89
|
+
}
|
|
90
|
+
function printGraph(read) {
|
|
91
|
+
console.log(`${read.name ?? "(untitled)"}: ${read.nodes.length} nodes, ${read.wires.length} wires`);
|
|
92
|
+
const byParent = /* @__PURE__ */ new Map();
|
|
93
|
+
for (const node of read.nodes) byParent.set(node.parent, [...byParent.get(node.parent) ?? [], node]);
|
|
94
|
+
const print = (parent, depth) => {
|
|
95
|
+
for (const node of byParent.get(parent) ?? []) {
|
|
96
|
+
const ports = node.ports ? ` in: ${node.ports.inputs.join(", ") || "-"} out: ${node.ports.outputs.join(", ") || "-"}` : "";
|
|
97
|
+
const props = node.props ? ` ${JSON.stringify(node.props)}` : "";
|
|
98
|
+
console.log(`${" ".repeat(depth)}${node.id} ${node.module}${ports}${props}`);
|
|
99
|
+
print(node.id, depth + 1);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
print(read.nodes.some((node) => node.parent === null) ? null : read.nodes[0]?.parent ?? null, 1);
|
|
103
|
+
if (read.wires.length) console.log("wires:");
|
|
104
|
+
for (const wire of read.wires) console.log(` ${wire}`);
|
|
105
|
+
}
|
|
106
|
+
async function listGraphs(directory) {
|
|
107
|
+
const skip = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".cascade-cache", ".cascade", "renders", "out"]);
|
|
108
|
+
const found = [];
|
|
109
|
+
const walk = async (dir, depth) => {
|
|
110
|
+
let entries;
|
|
111
|
+
try {
|
|
112
|
+
entries = await fs.readdir(dir, { withFileTypes: true });
|
|
113
|
+
} catch {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
117
|
+
if (entry.isDirectory() && depth < 3 && !skip.has(entry.name) && !entry.name.startsWith(".")) await walk(path.join(dir, entry.name), depth + 1);
|
|
118
|
+
else if (entry.isFile() && entry.name.endsWith(".cascade")) found.push(path.join(dir, entry.name));
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
await walk(path.resolve(directory), 0);
|
|
122
|
+
return Promise.all(found.map(async (file) => {
|
|
123
|
+
try {
|
|
124
|
+
const document = JSON.parse(await fs.readFile(file, "utf8"));
|
|
125
|
+
return {
|
|
126
|
+
file: path.relative(process.cwd(), file) || file,
|
|
127
|
+
name: typeof document.metadata?.name === "string" ? document.metadata.name : null,
|
|
128
|
+
nodes: Array.isArray(document.nodes) ? document.nodes.length : 0,
|
|
129
|
+
wires: Array.isArray(document.connections) ? document.connections.length : 0
|
|
130
|
+
};
|
|
131
|
+
} catch {
|
|
132
|
+
return { file: path.relative(process.cwd(), file) || file, name: null, nodes: 0, wires: 0 };
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
async function readOperations(source) {
|
|
137
|
+
const text = source === "-" ? await readStdin() : await fs.readFile(source, "utf8");
|
|
138
|
+
const parsed = JSON.parse(text);
|
|
139
|
+
const operations = Array.isArray(parsed) ? parsed : parsed?.operations;
|
|
140
|
+
if (!Array.isArray(operations)) throw new Error('cascade edit expects a JSON array of operations, or { "operations": [...] }');
|
|
141
|
+
return operations;
|
|
142
|
+
}
|
|
143
|
+
async function readStdin() {
|
|
144
|
+
const chunks = [];
|
|
145
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
146
|
+
return Buffer.concat(chunks).toString("utf8");
|
|
147
|
+
}
|
|
148
|
+
var OPTIONS = graphOptions();
|
|
149
|
+
function parseArguments(args) {
|
|
150
|
+
const positional = [];
|
|
151
|
+
const values = {};
|
|
152
|
+
const lists = {};
|
|
153
|
+
const flags = /* @__PURE__ */ new Set();
|
|
154
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
155
|
+
const argument = args[index];
|
|
156
|
+
if (!argument.startsWith("--")) {
|
|
157
|
+
positional.push(argument);
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
const [name, inline] = argument.slice(2).split(/=(.*)/s, 2);
|
|
161
|
+
if (OPTIONS.flag.has(name)) {
|
|
162
|
+
flags.add(name);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (!OPTIONS.value.has(name) && !OPTIONS.list.has(name)) throw new Error(`Unknown option --${name}`);
|
|
166
|
+
const value = inline ?? args[++index];
|
|
167
|
+
if (value === void 0) throw new Error(`--${name} needs a value`);
|
|
168
|
+
if (OPTIONS.list.has(name)) (lists[name] ??= []).push(value);
|
|
169
|
+
else values[name] = value;
|
|
170
|
+
}
|
|
171
|
+
return { positional, values, lists, flags };
|
|
172
|
+
}
|
|
173
|
+
function required(value, usage) {
|
|
174
|
+
if (!value) throw new Error(`usage: ${usage}`);
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
function optional(value, key = "name") {
|
|
178
|
+
return value === void 0 ? {} : { [key]: value };
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
applyEdits,
|
|
182
|
+
runGraphCommand
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=graphCommands-6BMAKGQE.js.map
|