@fluidgrids/cli 0.0.0-stage → 2026.1028.1

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.
Files changed (99) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +219 -2
  3. package/dist/auth/device-login.d.ts +31 -0
  4. package/dist/auth/device-login.d.ts.map +1 -0
  5. package/dist/auth/device-login.js +75 -0
  6. package/dist/auth/device-login.js.map +1 -0
  7. package/dist/auth/token-auth.d.ts +49 -0
  8. package/dist/auth/token-auth.d.ts.map +1 -0
  9. package/dist/auth/token-auth.js +279 -0
  10. package/dist/auth/token-auth.js.map +1 -0
  11. package/dist/cli.d.ts +10 -0
  12. package/dist/cli.d.ts.map +1 -0
  13. package/dist/cli.js +37 -0
  14. package/dist/cli.js.map +1 -0
  15. package/dist/code-first/api.d.ts +170 -0
  16. package/dist/code-first/api.d.ts.map +1 -0
  17. package/dist/code-first/api.js +166 -0
  18. package/dist/code-first/api.js.map +1 -0
  19. package/dist/code-first/commands/codegen.d.ts +20 -0
  20. package/dist/code-first/commands/codegen.d.ts.map +1 -0
  21. package/dist/code-first/commands/codegen.js +50 -0
  22. package/dist/code-first/commands/codegen.js.map +1 -0
  23. package/dist/code-first/commands/diff.d.ts +28 -0
  24. package/dist/code-first/commands/diff.d.ts.map +1 -0
  25. package/dist/code-first/commands/diff.js +73 -0
  26. package/dist/code-first/commands/diff.js.map +1 -0
  27. package/dist/code-first/commands/import.d.ts +40 -0
  28. package/dist/code-first/commands/import.d.ts.map +1 -0
  29. package/dist/code-first/commands/import.js +235 -0
  30. package/dist/code-first/commands/import.js.map +1 -0
  31. package/dist/code-first/commands/init.d.ts +33 -0
  32. package/dist/code-first/commands/init.d.ts.map +1 -0
  33. package/dist/code-first/commands/init.js +177 -0
  34. package/dist/code-first/commands/init.js.map +1 -0
  35. package/dist/code-first/commands/interface.d.ts +12 -0
  36. package/dist/code-first/commands/interface.d.ts.map +1 -0
  37. package/dist/code-first/commands/interface.js +21 -0
  38. package/dist/code-first/commands/interface.js.map +1 -0
  39. package/dist/code-first/commands/pull.d.ts +63 -0
  40. package/dist/code-first/commands/pull.d.ts.map +1 -0
  41. package/dist/code-first/commands/pull.js +266 -0
  42. package/dist/code-first/commands/pull.js.map +1 -0
  43. package/dist/code-first/commands/push.d.ts +51 -0
  44. package/dist/code-first/commands/push.d.ts.map +1 -0
  45. package/dist/code-first/commands/push.js +217 -0
  46. package/dist/code-first/commands/push.js.map +1 -0
  47. package/dist/code-first/commands/validate.d.ts +34 -0
  48. package/dist/code-first/commands/validate.d.ts.map +1 -0
  49. package/dist/code-first/commands/validate.js +115 -0
  50. package/dist/code-first/commands/validate.js.map +1 -0
  51. package/dist/code-first/connections.d.ts +55 -0
  52. package/dist/code-first/connections.d.ts.map +1 -0
  53. package/dist/code-first/connections.js +180 -0
  54. package/dist/code-first/connections.js.map +1 -0
  55. package/dist/code-first/index.d.ts +14 -0
  56. package/dist/code-first/index.d.ts.map +1 -0
  57. package/dist/code-first/index.js +31 -0
  58. package/dist/code-first/index.js.map +1 -0
  59. package/dist/code-first/lowering.d.ts +42 -0
  60. package/dist/code-first/lowering.d.ts.map +1 -0
  61. package/dist/code-first/lowering.js +128 -0
  62. package/dist/code-first/lowering.js.map +1 -0
  63. package/dist/code-first/operations.d.ts +57 -0
  64. package/dist/code-first/operations.d.ts.map +1 -0
  65. package/dist/code-first/operations.js +167 -0
  66. package/dist/code-first/operations.js.map +1 -0
  67. package/dist/code-first/project.d.ts +114 -0
  68. package/dist/code-first/project.d.ts.map +1 -0
  69. package/dist/code-first/project.js +279 -0
  70. package/dist/code-first/project.js.map +1 -0
  71. package/dist/code-first/python.d.ts +70 -0
  72. package/dist/code-first/python.d.ts.map +1 -0
  73. package/dist/code-first/python.js +219 -0
  74. package/dist/code-first/python.js.map +1 -0
  75. package/dist/code-first/register.d.ts +21 -0
  76. package/dist/code-first/register.d.ts.map +1 -0
  77. package/dist/code-first/register.js +126 -0
  78. package/dist/code-first/register.js.map +1 -0
  79. package/dist/code-first/remote.d.ts +58 -0
  80. package/dist/code-first/remote.d.ts.map +1 -0
  81. package/dist/code-first/remote.js +120 -0
  82. package/dist/code-first/remote.js.map +1 -0
  83. package/dist/code-first/shared.d.ts +39 -0
  84. package/dist/code-first/shared.d.ts.map +1 -0
  85. package/dist/code-first/shared.js +57 -0
  86. package/dist/code-first/shared.js.map +1 -0
  87. package/dist/modules.d.ts +15 -0
  88. package/dist/modules.d.ts.map +1 -0
  89. package/dist/modules.js +61 -0
  90. package/dist/modules.js.map +1 -0
  91. package/dist/product-defaults.d.ts +11 -0
  92. package/dist/product-defaults.d.ts.map +1 -0
  93. package/dist/product-defaults.js +25 -0
  94. package/dist/product-defaults.js.map +1 -0
  95. package/dist/program.d.ts +20 -0
  96. package/dist/program.d.ts.map +1 -0
  97. package/dist/program.js +43 -0
  98. package/dist/program.js.map +1 -0
  99. package/package.json +100 -4
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Lowering a Python project. The Python tier-1 builder lives in the
3
+ * `fluidgrids-workflows` package (module `fluidgrids_workflows`), so the CLI runs
4
+ * that package's command line in the project directory:
5
+ *
6
+ * <python> -m fluidgrids_workflows lower <project> --connections - --entry workflows/a.py …
7
+ *
8
+ * - stdin: a JSON object of connection name to `{ "connectionId", "adapter" }`;
9
+ * - stdout (exit status 0):
10
+ * `{ "format": "fluidgrids.python-lower-result", "sdkVersion", "sourceHash",
11
+ * "workflows": [{ "key", "module", "exportName", "irHash", "definition" }] }`;
12
+ * - stderr (exit status 1): `fluidgrids-workflows: <message>[ (<reason>)]` when the
13
+ * project cannot be lowered; exit status 2 for a usage problem.
14
+ *
15
+ * The Python package reads the project files itself, so the `sourceHash` it
16
+ * reports covers what it lowered. Its definitions must be byte-identical to
17
+ * what the TypeScript builder produces for the same graph (spec 03 §2), so the
18
+ * CLI recomputes each `irHash` with `@fluidgrids/workflows` and warns when the
19
+ * two SDKs disagree.
20
+ */
21
+ import { CliUserError } from '@burdenoff/cli-sdk/core';
22
+ import { type ConnectionRef } from '@fluidgrids/workflows/ir';
23
+ export declare const PYTHON_MODULE = "fluidgrids_workflows";
24
+ export declare const PYTHON_PACKAGE = "fluidgrids-workflows";
25
+ export declare const LOWER_RESULT_FORMAT = "fluidgrids.python-lower-result";
26
+ /** Largest stdout plus stderr the CLI reads from the lowering process. */
27
+ export declare const MAX_PYTHON_OUTPUT_BYTES: number;
28
+ export declare const DEFAULT_PYTHON_TIMEOUT_MS = 120000;
29
+ export interface PythonLoweredWorkflow {
30
+ key: string;
31
+ module: string;
32
+ exportName: string;
33
+ definition: Record<string, unknown>;
34
+ }
35
+ export interface PythonLowerResult {
36
+ sdkVersion: string;
37
+ sourceHash: string;
38
+ workflows: PythonLoweredWorkflow[];
39
+ /** Disagreements between the Python and TypeScript SDKs, one line each. */
40
+ warnings: string[];
41
+ }
42
+ /** Raised when the Python side reports connection names it could not resolve. */
43
+ export declare class PythonUnresolvedConnectionsError extends CliUserError {
44
+ readonly names: string[];
45
+ constructor(message: string, names: string[]);
46
+ }
47
+ export interface PythonLowerOptions {
48
+ /** Interpreter to run; see {@link resolvePythonInterpreter}. */
49
+ python: string;
50
+ /** The project root; also the working directory. */
51
+ root: string;
52
+ /** `workflows/*.py` modules to lower. */
53
+ entries: readonly string[];
54
+ connections: Readonly<Record<string, ConnectionRef>>;
55
+ timeoutMs?: number;
56
+ /** Largest stdout plus stderr to read; default {@link MAX_PYTHON_OUTPUT_BYTES}. */
57
+ maxOutputBytes?: number;
58
+ }
59
+ /**
60
+ * The interpreter for a Python project: `FLUIDGRIDS_PYTHON`, then the config's
61
+ * `python`, then the project's `.venv`, then `python3` (`python` on Windows).
62
+ */
63
+ export declare function resolvePythonInterpreter(root: string, configured: string | undefined, env?: Readonly<Record<string, string | undefined>>): string;
64
+ /** Parse the lowering result; `irHash` values are checked against this CLI's SDK. */
65
+ export declare function parseLowerResult(stdout: string): PythonLowerResult;
66
+ /** The connection names in an "unresolved connections" message, or null. */
67
+ export declare function unresolvedNames(message: string): string[] | null;
68
+ /** Run the Python lowering and return its workflows. */
69
+ export declare function lowerPython(options: PythonLowerOptions): Promise<PythonLowerResult>;
70
+ //# sourceMappingURL=python.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/code-first/python.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEtE,eAAO,MAAM,aAAa,yBAAyB,CAAC;AACpD,eAAO,MAAM,cAAc,yBAAyB,CAAC;AACrD,eAAO,MAAM,mBAAmB,mCAAmC,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB,QAAmB,CAAC;AACxD,eAAO,MAAM,yBAAyB,SAAU,CAAC;AAKjD,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,qBAAqB,EAAE,CAAC;IACnC,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,iFAAiF;AACjF,qBAAa,gCAAiC,SAAQ,YAAY;IAG9D,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE;gBADxB,OAAO,EAAE,MAAM,EACN,KAAK,EAAE,MAAM,EAAE;CAK3B;AAED,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAe,GAC9D,MAAM,CAUR;AAqBD,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CA2ClE;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAUhE;AA4CD,wDAAwD;AACxD,wBAAgB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAgFnF"}
@@ -0,0 +1,219 @@
1
+ /**
2
+ * Lowering a Python project. The Python tier-1 builder lives in the
3
+ * `fluidgrids-workflows` package (module `fluidgrids_workflows`), so the CLI runs
4
+ * that package's command line in the project directory:
5
+ *
6
+ * <python> -m fluidgrids_workflows lower <project> --connections - --entry workflows/a.py …
7
+ *
8
+ * - stdin: a JSON object of connection name to `{ "connectionId", "adapter" }`;
9
+ * - stdout (exit status 0):
10
+ * `{ "format": "fluidgrids.python-lower-result", "sdkVersion", "sourceHash",
11
+ * "workflows": [{ "key", "module", "exportName", "irHash", "definition" }] }`;
12
+ * - stderr (exit status 1): `fluidgrids-workflows: <message>[ (<reason>)]` when the
13
+ * project cannot be lowered; exit status 2 for a usage problem.
14
+ *
15
+ * The Python package reads the project files itself, so the `sourceHash` it
16
+ * reports covers what it lowered. Its definitions must be byte-identical to
17
+ * what the TypeScript builder produces for the same graph (spec 03 §2), so the
18
+ * CLI recomputes each `irHash` with `@fluidgrids/workflows` and warns when the
19
+ * two SDKs disagree.
20
+ */
21
+ import { spawn } from 'child_process';
22
+ import { existsSync } from 'fs';
23
+ import { join } from 'path';
24
+ import { CliUserError } from '@burdenoff/cli-sdk/core';
25
+ import { irHash } from '@fluidgrids/workflows/ir';
26
+ export const PYTHON_MODULE = 'fluidgrids_workflows';
27
+ export const PYTHON_PACKAGE = 'fluidgrids-workflows';
28
+ export const LOWER_RESULT_FORMAT = 'fluidgrids.python-lower-result';
29
+ /** Largest stdout plus stderr the CLI reads from the lowering process. */
30
+ export const MAX_PYTHON_OUTPUT_BYTES = 64 * 1024 * 1024;
31
+ export const DEFAULT_PYTHON_TIMEOUT_MS = 120_000;
32
+ /** The message prefix `fluidgrids_workflows` uses for connection names it cannot resolve. */
33
+ const UNRESOLVED_PREFIX = 'Create these connections in the workspace first: ';
34
+ /** Raised when the Python side reports connection names it could not resolve. */
35
+ export class PythonUnresolvedConnectionsError extends CliUserError {
36
+ names;
37
+ constructor(message, names) {
38
+ super(message);
39
+ this.names = names;
40
+ this.name = 'PythonUnresolvedConnectionsError';
41
+ }
42
+ }
43
+ /**
44
+ * The interpreter for a Python project: `FLUIDGRIDS_PYTHON`, then the config's
45
+ * `python`, then the project's `.venv`, then `python3` (`python` on Windows).
46
+ */
47
+ export function resolvePythonInterpreter(root, configured, env = process.env) {
48
+ const fromEnv = env['FLUIDGRIDS_PYTHON'];
49
+ if (fromEnv && fromEnv.trim() !== '')
50
+ return fromEnv.trim();
51
+ if (configured)
52
+ return configured;
53
+ const venv = process.platform === 'win32'
54
+ ? join(root, '.venv', 'Scripts', 'python.exe')
55
+ : join(root, '.venv', 'bin', 'python');
56
+ if (existsSync(venv))
57
+ return venv;
58
+ return process.platform === 'win32' ? 'python' : 'python3';
59
+ }
60
+ function isRecord(value) {
61
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
62
+ }
63
+ function parseJsonObject(text) {
64
+ try {
65
+ const value = JSON.parse(text);
66
+ return isRecord(value) ? value : null;
67
+ }
68
+ catch {
69
+ return null;
70
+ }
71
+ }
72
+ function lastLines(text, count) {
73
+ return text.trim().split(/\r?\n/).slice(-count).join('\n');
74
+ }
75
+ const UPGRADE_HINT = `Upgrade the ${PYTHON_PACKAGE} package to a version that matches this CLI.`;
76
+ /** Parse the lowering result; `irHash` values are checked against this CLI's SDK. */
77
+ export function parseLowerResult(stdout) {
78
+ const value = parseJsonObject(stdout);
79
+ if (!value ||
80
+ value['format'] !== LOWER_RESULT_FORMAT ||
81
+ typeof value['sourceHash'] !== 'string' ||
82
+ !Array.isArray(value['workflows'])) {
83
+ throw new CliUserError(`python -m ${PYTHON_MODULE} lower returned an unexpected result (expected ${LOWER_RESULT_FORMAT}).`, { hint: UPGRADE_HINT });
84
+ }
85
+ const sdkVersion = typeof value['sdkVersion'] === 'string' ? value['sdkVersion'] : 'unknown';
86
+ const warnings = [];
87
+ const workflows = value['workflows'].map((item, index) => {
88
+ if (!isRecord(item) ||
89
+ typeof item['key'] !== 'string' ||
90
+ typeof item['module'] !== 'string' ||
91
+ typeof item['exportName'] !== 'string' ||
92
+ !isRecord(item['definition'])) {
93
+ throw new CliUserError(`python -m ${PYTHON_MODULE} lower returned a malformed workflow at index ${index}.`, { hint: UPGRADE_HINT });
94
+ }
95
+ const reported = item['irHash'];
96
+ const computed = irHash(item['definition']);
97
+ if (typeof reported === 'string' && reported !== computed) {
98
+ warnings.push(`${item['key']}: ${PYTHON_PACKAGE} ${sdkVersion} reports irHash ${reported}, this CLI computes ${computed}; align the two SDK versions`);
99
+ }
100
+ return {
101
+ key: item['key'],
102
+ module: item['module'],
103
+ exportName: item['exportName'],
104
+ definition: item['definition'],
105
+ };
106
+ });
107
+ return { sdkVersion, sourceHash: value['sourceHash'], workflows, warnings };
108
+ }
109
+ /** The connection names in an "unresolved connections" message, or null. */
110
+ export function unresolvedNames(message) {
111
+ const at = message.indexOf(UNRESOLVED_PREFIX);
112
+ if (at < 0)
113
+ return null;
114
+ const names = message
115
+ .slice(at + UNRESOLVED_PREFIX.length)
116
+ .split(/\r?\n/)[0]
117
+ ?.split(',')
118
+ .map((name) => name.trim())
119
+ .filter((name) => name !== '');
120
+ return names && names.length > 0 ? names : null;
121
+ }
122
+ /** The message the package wrote, without its program-name prefix. */
123
+ function reportedMessage(stderr) {
124
+ const lines = stderr
125
+ .split(/\r?\n/)
126
+ .filter((line) => line.startsWith('fluidgrids-workflows: '))
127
+ .map((line) => line.slice('fluidgrids-workflows: '.length).trim());
128
+ return lines.length > 0 ? lines.join('\n') : null;
129
+ }
130
+ function failure(code, signal, stderr, python) {
131
+ if (/No module named '?fluidgrids_workflows'?/.test(stderr)) {
132
+ return new CliUserError(`The ${PYTHON_PACKAGE} Python package is not installed for ${python}.`, {
133
+ hint: `Install it with \`${python} -m pip install ${PYTHON_PACKAGE}\`, or point FLUIDGRIDS_PYTHON (or "python" in fluidgrids.config.json) at an interpreter that has it.`,
134
+ });
135
+ }
136
+ if (code === 2 && /invalid choice: 'lower'|unrecognized arguments/.test(stderr)) {
137
+ return new CliUserError(`The installed ${PYTHON_PACKAGE} package cannot lower projects.`, {
138
+ hint: UPGRADE_HINT,
139
+ });
140
+ }
141
+ const message = reportedMessage(stderr);
142
+ if (message) {
143
+ const names = unresolvedNames(message);
144
+ if (names)
145
+ return new PythonUnresolvedConnectionsError(message, names);
146
+ return new CliUserError(`Lowering the Python workflows failed: ${message}`);
147
+ }
148
+ const how = signal ? `was stopped by ${signal}` : `exited with status ${String(code)}`;
149
+ const detail = lastLines(stderr, 20);
150
+ return new CliUserError(`${python} -m ${PYTHON_MODULE} lower ${how}.`, detail ? { hint: detail } : undefined);
151
+ }
152
+ /** Run the Python lowering and return its workflows. */
153
+ export function lowerPython(options) {
154
+ const args = ['-m', PYTHON_MODULE, 'lower', options.root, '--connections', '-'];
155
+ for (const entry of options.entries)
156
+ args.push('--entry', entry);
157
+ return new Promise((resolve, reject) => {
158
+ const child = spawn(options.python, args, {
159
+ cwd: options.root,
160
+ stdio: ['pipe', 'pipe', 'pipe'],
161
+ env: { ...process.env, PYTHONDONTWRITEBYTECODE: '1', PYTHONIOENCODING: 'utf-8' },
162
+ });
163
+ const stdout = [];
164
+ const stderr = [];
165
+ let bytes = 0;
166
+ const maxOutputBytes = options.maxOutputBytes ?? MAX_PYTHON_OUTPUT_BYTES;
167
+ const timeoutMs = options.timeoutMs ?? DEFAULT_PYTHON_TIMEOUT_MS;
168
+ let settled = false;
169
+ const settle = (fn) => {
170
+ if (settled)
171
+ return;
172
+ settled = true;
173
+ clearTimeout(timer);
174
+ fn();
175
+ };
176
+ const timer = setTimeout(() => {
177
+ child.kill('SIGKILL');
178
+ settle(() => reject(new CliUserError(`python -m ${PYTHON_MODULE} lower did not finish within ${timeoutMs} ms.`)));
179
+ }, timeoutMs);
180
+ const collect = (into) => (chunk) => {
181
+ bytes += chunk.length;
182
+ if (bytes > maxOutputBytes) {
183
+ child.kill('SIGKILL');
184
+ settle(() => reject(new CliUserError(`python -m ${PYTHON_MODULE} lower wrote more than ${maxOutputBytes} bytes; stopped it.`)));
185
+ return;
186
+ }
187
+ into.push(chunk);
188
+ };
189
+ child.stdout.on('data', collect(stdout));
190
+ child.stderr.on('data', collect(stderr));
191
+ child.on('error', (error) => {
192
+ settle(() => reject(error.code === 'ENOENT'
193
+ ? new CliUserError(`Python interpreter "${options.python}" was not found.`, {
194
+ hint: `Install Python 3.11 or later with the ${PYTHON_PACKAGE} package, or set FLUIDGRIDS_PYTHON.`,
195
+ })
196
+ : new CliUserError(`Could not start ${options.python}: ${error.message}`)));
197
+ });
198
+ child.on('close', (code, signal) => {
199
+ const out = Buffer.concat(stdout).toString('utf8');
200
+ const err = Buffer.concat(stderr).toString('utf8');
201
+ settle(() => {
202
+ if (code !== 0) {
203
+ reject(failure(code, signal, err, options.python));
204
+ return;
205
+ }
206
+ try {
207
+ resolve(parseLowerResult(out));
208
+ }
209
+ catch (error) {
210
+ reject(error);
211
+ }
212
+ });
213
+ });
214
+ // A child that exits before reading stdin raises EPIPE here; the close handler reports it.
215
+ child.stdin.on('error', () => undefined);
216
+ child.stdin.end(JSON.stringify(options.connections), 'utf8');
217
+ });
218
+ }
219
+ //# sourceMappingURL=python.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/code-first/python.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,MAAM,EAAsB,MAAM,0BAA0B,CAAC;AAEtE,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,gCAAgC,CAAC;AAEpE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAEjD,6FAA6F;AAC7F,MAAM,iBAAiB,GAAG,mDAAmD,CAAC;AAiB9E,iFAAiF;AACjF,MAAM,OAAO,gCAAiC,SAAQ,YAAY;IAGrD;IAFX,YACE,OAAe,EACN,KAAe;QAExB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFN,UAAK,GAAL,KAAK,CAAU;QAGxB,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;IACjD,CAAC;CACF;AAeD;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,IAAY,EACZ,UAA8B,EAC9B,MAAoD,OAAO,CAAC,GAAG;IAE/D,MAAM,OAAO,GAAG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registrations of the code-first commands.
3
+ *
4
+ * The command implementations under `./commands/` load `@fluidgrids/workflows`
5
+ * (the IR library, esbuild, Prettier and QuickJS), which costs hundreds of
6
+ * milliseconds. Every action therefore imports its implementation on demand,
7
+ * so the rest of the CLI (`fluidgrids workflows list`, `fluidgrids runs wait`,
8
+ * …) starts as fast as it did before the code-first commands existed. Only
9
+ * types are imported statically here; keep it that way.
10
+ */
11
+ import type { Command } from 'commander';
12
+ import { type CommandEnv } from './shared.js';
13
+ export declare function registerInit(program: Command, env: CommandEnv): void;
14
+ export declare function registerCodegen(program: Command, env: CommandEnv): void;
15
+ export declare function registerPull(program: Command, env: CommandEnv): void;
16
+ export declare function registerPush(program: Command, env: CommandEnv): void;
17
+ export declare function registerDiff(program: Command, env: CommandEnv): void;
18
+ export declare function registerValidate(program: Command, env: CommandEnv): void;
19
+ export declare function registerImport(program: Command, env: CommandEnv): void;
20
+ export declare function registerInterface(program: Command, env: CommandEnv): void;
21
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/code-first/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,OAAO,EAAoB,KAAK,UAAU,EAAuB,MAAM,aAAa,CAAC;AAQrF,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAgBpE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAavE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAkBpE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAgBpE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAYpE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAgBxE;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAetE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI,CAUzE"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Commander registrations of the code-first commands.
3
+ *
4
+ * The command implementations under `./commands/` load `@fluidgrids/workflows`
5
+ * (the IR library, esbuild, Prettier and QuickJS), which costs hundreds of
6
+ * milliseconds. Every action therefore imports its implementation on demand,
7
+ * so the rest of the CLI (`fluidgrids workflows list`, `fluidgrids runs wait`,
8
+ * …) starts as fast as it did before the code-first commands existed. Only
9
+ * types are imported statically here; keep it that way.
10
+ */
11
+ import { withGlobalFormat } from './shared.js';
12
+ const PROJECT_OPTION = [
13
+ '--project <dir>',
14
+ 'Project directory (default: nearest fluidgrids.config.json)',
15
+ ];
16
+ const OUTPUT_OPTION = ['-f, --format <format>', 'Output format (json, table, yaml)'];
17
+ export function registerInit(program, env) {
18
+ program
19
+ .command('init [dir]')
20
+ .description('Scaffold a code-first workflow project (fluidgrids.config.json, workflows/, lock.json)')
21
+ .option('--lang <lang>', 'Project language: ts or py', 'ts')
22
+ .option('--workspace <id>', 'Workspace to sign in to and record in fluidgrids.config.json')
23
+ .option('--force', 'Overwrite existing scaffold files')
24
+ .option('--no-codegen', 'Do not generate the node clients now')
25
+ .option('--no-login', 'Do not start the device-code login when signed out')
26
+ .option(...OUTPUT_OPTION)
27
+ .action(async (dir, options, command) => {
28
+ const { runInit } = await import('./commands/init.js');
29
+ await runInit(env, dir, withGlobalFormat(options, command));
30
+ });
31
+ }
32
+ export function registerCodegen(program, env) {
33
+ program
34
+ .command('codegen')
35
+ .description('Regenerate the typed node clients (.fluidgrids/nodes.ts|py) from the workspace registry')
36
+ .option('--lang <lang>', 'Client language: ts or py (default: the project language)')
37
+ .option(...PROJECT_OPTION)
38
+ .option(...OUTPUT_OPTION)
39
+ .action(async (options, command) => {
40
+ const { runCodegen } = await import('./commands/codegen.js');
41
+ await runCodegen(env, withGlobalFormat(options, command));
42
+ });
43
+ }
44
+ export function registerPull(program, env) {
45
+ program
46
+ .command('pull [keys...]')
47
+ .description('Export workflows into the project as TypeScript, Python or JSON')
48
+ .option('--as <format>', 'Code format: ts, py or json (default: as tracked in lock.json, else the project language); `--format ts|py` also works')
49
+ .option('--check', 'Write nothing; print the fidelity report and fail when an export is lossy')
50
+ .option('--wf-version <version>', 'Pull this version instead of the latest (one key only)')
51
+ .option('--server', 'Render the code on the service instead of locally')
52
+ .option('--pinned-data', 'Also write pinned TEST data to workflows/<key>.pinned.json')
53
+ .option(...PROJECT_OPTION)
54
+ .option(...OUTPUT_OPTION)
55
+ .action(async (keys, options, command) => {
56
+ const { runPull } = await import('./commands/pull.js');
57
+ await runPull(env, keys, withGlobalFormat(options, command));
58
+ });
59
+ }
60
+ export function registerPush(program, env) {
61
+ program
62
+ .command('push [keys...]')
63
+ .description('Lower the project and create a version for every workflow that changed')
64
+ .option('--dry-run', 'Lower, validate and diff against the latest version; create nothing')
65
+ .option('-m, --message <text>', 'Description for the new versions')
66
+ .option('--force', 'Push even when the workspace has versions newer than the one the project pulled')
67
+ .option(...PROJECT_OPTION)
68
+ .option(...OUTPUT_OPTION)
69
+ .action(async (keys, options, command) => {
70
+ const { runPush } = await import('./commands/push.js');
71
+ await runPush(env, keys, withGlobalFormat(options, command));
72
+ });
73
+ }
74
+ export function registerDiff(program, env) {
75
+ program
76
+ .command('diff [keys...]')
77
+ .description('IR diff of the local workflows against a stored version')
78
+ .option('--against <version>', 'latest, active or a version such as v3', 'latest')
79
+ .option('--exit-code', 'Exit with status 1 when any workflow differs')
80
+ .option(...PROJECT_OPTION)
81
+ .option(...OUTPUT_OPTION)
82
+ .action(async (keys, options, command) => {
83
+ const { runDiff } = await import('./commands/diff.js');
84
+ await runDiff(env, keys, withGlobalFormat(options, command));
85
+ });
86
+ }
87
+ export function registerValidate(program, env) {
88
+ program
89
+ .command('validate [keys...]')
90
+ .description('Validate the local workflows as IR v2 (lowered from code where needed)')
91
+ .option('--strict', 'Also apply the strict rules: no legacy mirrors, no ${...} templates, slug node ids')
92
+ .option('--remote', 'Also validate on the service (task queues, installed nodes)')
93
+ .option('--offline', 'Do not contact the workspace; connection names are not resolved')
94
+ .option(...PROJECT_OPTION)
95
+ .option(...OUTPUT_OPTION)
96
+ .action(async (keys, options, command) => {
97
+ const { runValidate } = await import('./commands/validate.js');
98
+ await runValidate(env, keys, withGlobalFormat(options, command));
99
+ });
100
+ }
101
+ export function registerImport(program, env) {
102
+ program
103
+ .command('import <file>')
104
+ .description('Create a new workflow (DRAFT) from a .json, .ts or .py file; the service lowers TypeScript itself')
105
+ .option('--key <key>', 'Workflow key (default: the key the file declares)')
106
+ .option('--name <name>', 'Workflow name (default: the name the file declares, else the key)')
107
+ .option('--description <text>', 'Description of the new workflow')
108
+ .option('--allow-missing-nodes', 'Create it even when nodes it uses are not installed')
109
+ .option(...OUTPUT_OPTION)
110
+ .action(async (file, options, command) => {
111
+ const { runImport } = await import('./commands/import.js');
112
+ await runImport(env, file, withGlobalFormat(options, command));
113
+ });
114
+ }
115
+ export function registerInterface(program, env) {
116
+ program
117
+ .command('interface <key>')
118
+ .description("Print a stored workflow's interface (inputs, outputs, signals)")
119
+ .option('--wf-version <version>', 'Version (default: the ACTIVE version, else the newest)')
120
+ .option('-f, --format <format>', 'Output format (json, yaml)')
121
+ .action(async (key, options, command) => {
122
+ const { runInterface } = await import('./commands/interface.js');
123
+ await runInterface(env, key, withGlobalFormat(options, command));
124
+ });
125
+ }
126
+ //# sourceMappingURL=register.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/code-first/register.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,CAAC;QACjE,MAAM,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Comparing local workflows with stored versions.
3
+ *
4
+ * A stored canvas definition has no `key` (the key lives on the row), and code
5
+ * never carries pinned TEST data unless a `workflows/<key>.pinned.json` sidecar
6
+ * exists (spec 07 §3 rule 10). Both are therefore aligned before hashing, and
7
+ * a push keeps the stored pinned data instead of silently dropping it.
8
+ */
9
+ import type { NodeManifest } from '@fluidgrids/workflows/ir';
10
+ import type { CodeFirstApi, RemoteExport, RemoteVersion } from './api.js';
11
+ import { type Project } from './project.js';
12
+ import { type ConnectionIndex } from './connections.js';
13
+ /** Versions oldest first. */
14
+ export declare function sortVersions(versions: readonly RemoteVersion[]): RemoteVersion[];
15
+ /** `latest` (newest), `active` (the ACTIVE version) or an exact version string. */
16
+ export declare function pickVersion(versions: readonly RemoteVersion[], against: string): RemoteVersion | undefined;
17
+ /** The stored definition normalised, with its workflow key, as lowering would produce it. */
18
+ export declare function comparableRemote(definition: unknown, workflowKey: string): Record<string, unknown>;
19
+ /** The local definition as it would be stored: stored pinned data is kept when code has none. */
20
+ export declare function outgoingDefinition(local: Record<string, unknown>, remote: Record<string, unknown> | undefined): Record<string, unknown>;
21
+ export declare function sameContent(a: unknown, b: unknown): boolean;
22
+ /** One workflow key's stored state. */
23
+ export interface RemoteWorkflow {
24
+ key: string;
25
+ versions: RemoteVersion[];
26
+ /** The export of the compared version; undefined when the key does not exist. */
27
+ export?: RemoteExport;
28
+ }
29
+ /** Fetches each key's versions and the export of the requested version once. */
30
+ export declare class RemoteWorkflows {
31
+ private readonly api;
32
+ private readonly against;
33
+ private readonly cache;
34
+ constructor(api: CodeFirstApi, against?: string);
35
+ get(key: string): Promise<RemoteWorkflow>;
36
+ private load;
37
+ }
38
+ /**
39
+ * The workspace's connections indexed by name. The node registry is fetched
40
+ * only when some connection is not already bound by one of `remoteDefinitions`.
41
+ */
42
+ export declare function loadConnectionIndex(api: CodeFirstApi, remoteDefinitions: readonly unknown[], registry?: readonly NodeManifest[]): Promise<{
43
+ index: ConnectionIndex;
44
+ registry?: readonly NodeManifest[];
45
+ }>;
46
+ /**
47
+ * Keys the project probably defines, before lowering tells for sure: named
48
+ * keys, tracked keys and workflow file stems (a Python stem `lead_enrichment`
49
+ * also as `lead-enrichment`). Fetching a key that does not exist is harmless.
50
+ */
51
+ export declare function likelyKeys(project: Project, requested: readonly string[]): string[];
52
+ /**
53
+ * The connection index for lowering this project: the latest stored version of
54
+ * every key the project probably defines is read first, because those say
55
+ * which adapter each connection is bound to.
56
+ */
57
+ export declare function projectConnectionIndex(api: CodeFirstApi, project: Project, keys: readonly string[], latest?: RemoteWorkflows): Promise<ConnectionIndex>;
58
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/code-first/remote.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAkC,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAM1B,6BAA6B;AAC7B,wBAAgB,YAAY,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,aAAa,EAAE,CAIhF;AAED,mFAAmF;AACnF,wBAAgB,WAAW,CACzB,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,OAAO,EAAE,MAAM,GACd,aAAa,GAAG,SAAS,CAK3B;AAED,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,OAAO,EACnB,W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