@fluidgrids/cli 2026.1108.1 → 2026.1109.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.
- package/README.md +1 -1
- package/dist/cli.js +9705 -33
- package/package.json +36 -32
- package/dist/auth/device-login.d.ts +0 -31
- package/dist/auth/device-login.d.ts.map +0 -1
- package/dist/auth/device-login.js +0 -75
- package/dist/auth/device-login.js.map +0 -1
- package/dist/auth/token-auth.d.ts +0 -49
- package/dist/auth/token-auth.d.ts.map +0 -1
- package/dist/auth/token-auth.js +0 -279
- package/dist/auth/token-auth.js.map +0 -1
- package/dist/cli.d.ts +0 -10
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/code-first/api.d.ts +0 -607
- package/dist/code-first/api.d.ts.map +0 -1
- package/dist/code-first/api.js +0 -438
- package/dist/code-first/api.js.map +0 -1
- package/dist/code-first/code-upload.d.ts +0 -68
- package/dist/code-first/code-upload.d.ts.map +0 -1
- package/dist/code-first/code-upload.js +0 -223
- package/dist/code-first/code-upload.js.map +0 -1
- package/dist/code-first/commands/codegen.d.ts +0 -20
- package/dist/code-first/commands/codegen.d.ts.map +0 -1
- package/dist/code-first/commands/codegen.js +0 -50
- package/dist/code-first/commands/codegen.js.map +0 -1
- package/dist/code-first/commands/diff.d.ts +0 -28
- package/dist/code-first/commands/diff.d.ts.map +0 -1
- package/dist/code-first/commands/diff.js +0 -73
- package/dist/code-first/commands/diff.js.map +0 -1
- package/dist/code-first/commands/hotfix.d.ts +0 -55
- package/dist/code-first/commands/hotfix.d.ts.map +0 -1
- package/dist/code-first/commands/hotfix.js +0 -231
- package/dist/code-first/commands/hotfix.js.map +0 -1
- package/dist/code-first/commands/import.d.ts +0 -40
- package/dist/code-first/commands/import.d.ts.map +0 -1
- package/dist/code-first/commands/import.js +0 -235
- package/dist/code-first/commands/import.js.map +0 -1
- package/dist/code-first/commands/init.d.ts +0 -33
- package/dist/code-first/commands/init.d.ts.map +0 -1
- package/dist/code-first/commands/init.js +0 -177
- package/dist/code-first/commands/init.js.map +0 -1
- package/dist/code-first/commands/interface.d.ts +0 -12
- package/dist/code-first/commands/interface.d.ts.map +0 -1
- package/dist/code-first/commands/interface.js +0 -21
- package/dist/code-first/commands/interface.js.map +0 -1
- package/dist/code-first/commands/pull.d.ts +0 -63
- package/dist/code-first/commands/pull.d.ts.map +0 -1
- package/dist/code-first/commands/pull.js +0 -266
- package/dist/code-first/commands/pull.js.map +0 -1
- package/dist/code-first/commands/push.d.ts +0 -104
- package/dist/code-first/commands/push.d.ts.map +0 -1
- package/dist/code-first/commands/push.js +0 -320
- package/dist/code-first/commands/push.js.map +0 -1
- package/dist/code-first/commands/replay.d.ts +0 -44
- package/dist/code-first/commands/replay.d.ts.map +0 -1
- package/dist/code-first/commands/replay.js +0 -271
- package/dist/code-first/commands/replay.js.map +0 -1
- package/dist/code-first/commands/runs.d.ts +0 -168
- package/dist/code-first/commands/runs.d.ts.map +0 -1
- package/dist/code-first/commands/runs.js +0 -598
- package/dist/code-first/commands/runs.js.map +0 -1
- package/dist/code-first/commands/suite.d.ts +0 -57
- package/dist/code-first/commands/suite.d.ts.map +0 -1
- package/dist/code-first/commands/suite.js +0 -197
- package/dist/code-first/commands/suite.js.map +0 -1
- package/dist/code-first/commands/validate.d.ts +0 -38
- package/dist/code-first/commands/validate.d.ts.map +0 -1
- package/dist/code-first/commands/validate.js +0 -140
- package/dist/code-first/commands/validate.js.map +0 -1
- package/dist/code-first/commands/versions.d.ts +0 -63
- package/dist/code-first/commands/versions.d.ts.map +0 -1
- package/dist/code-first/commands/versions.js +0 -204
- package/dist/code-first/commands/versions.js.map +0 -1
- package/dist/code-first/connections.d.ts +0 -55
- package/dist/code-first/connections.d.ts.map +0 -1
- package/dist/code-first/connections.js +0 -180
- package/dist/code-first/connections.js.map +0 -1
- package/dist/code-first/durable-operations.d.ts +0 -41
- package/dist/code-first/durable-operations.d.ts.map +0 -1
- package/dist/code-first/durable-operations.js +0 -135
- package/dist/code-first/durable-operations.js.map +0 -1
- package/dist/code-first/history.d.ts +0 -30
- package/dist/code-first/history.d.ts.map +0 -1
- package/dist/code-first/history.js +0 -139
- package/dist/code-first/history.js.map +0 -1
- package/dist/code-first/imports.d.ts +0 -22
- package/dist/code-first/imports.d.ts.map +0 -1
- package/dist/code-first/imports.js +0 -67
- package/dist/code-first/imports.js.map +0 -1
- package/dist/code-first/index.d.ts +0 -18
- package/dist/code-first/index.d.ts.map +0 -1
- package/dist/code-first/index.js +0 -36
- package/dist/code-first/index.js.map +0 -1
- package/dist/code-first/junit.d.ts +0 -24
- package/dist/code-first/junit.d.ts.map +0 -1
- package/dist/code-first/junit.js +0 -163
- package/dist/code-first/junit.js.map +0 -1
- package/dist/code-first/lowering.d.ts +0 -104
- package/dist/code-first/lowering.d.ts.map +0 -1
- package/dist/code-first/lowering.js +0 -254
- package/dist/code-first/lowering.js.map +0 -1
- package/dist/code-first/operations.d.ts +0 -55
- package/dist/code-first/operations.d.ts.map +0 -1
- package/dist/code-first/operations.js +0 -165
- package/dist/code-first/operations.js.map +0 -1
- package/dist/code-first/parity-operations.d.ts +0 -44
- package/dist/code-first/parity-operations.d.ts.map +0 -1
- package/dist/code-first/parity-operations.js +0 -211
- package/dist/code-first/parity-operations.js.map +0 -1
- package/dist/code-first/parity.d.ts +0 -83
- package/dist/code-first/parity.d.ts.map +0 -1
- package/dist/code-first/parity.js +0 -301
- package/dist/code-first/parity.js.map +0 -1
- package/dist/code-first/presigned.d.ts +0 -21
- package/dist/code-first/presigned.d.ts.map +0 -1
- package/dist/code-first/presigned.js +0 -85
- package/dist/code-first/presigned.js.map +0 -1
- package/dist/code-first/project.d.ts +0 -130
- package/dist/code-first/project.d.ts.map +0 -1
- package/dist/code-first/project.js +0 -308
- package/dist/code-first/project.js.map +0 -1
- package/dist/code-first/python-build.d.ts +0 -78
- package/dist/code-first/python-build.d.ts.map +0 -1
- package/dist/code-first/python-build.js +0 -268
- package/dist/code-first/python-build.js.map +0 -1
- package/dist/code-first/python.d.ts +0 -103
- package/dist/code-first/python.d.ts.map +0 -1
- package/dist/code-first/python.js +0 -260
- package/dist/code-first/python.js.map +0 -1
- package/dist/code-first/redact.d.ts +0 -31
- package/dist/code-first/redact.d.ts.map +0 -1
- package/dist/code-first/redact.js +0 -159
- package/dist/code-first/redact.js.map +0 -1
- package/dist/code-first/register.d.ts +0 -35
- package/dist/code-first/register.d.ts.map +0 -1
- package/dist/code-first/register.js +0 -420
- package/dist/code-first/register.js.map +0 -1
- package/dist/code-first/remote.d.ts +0 -58
- package/dist/code-first/remote.d.ts.map +0 -1
- package/dist/code-first/remote.js +0 -126
- package/dist/code-first/remote.js.map +0 -1
- package/dist/code-first/replay.d.ts +0 -36
- package/dist/code-first/replay.d.ts.map +0 -1
- package/dist/code-first/replay.js +0 -52
- package/dist/code-first/replay.js.map +0 -1
- package/dist/code-first/shared.d.ts +0 -53
- package/dist/code-first/shared.d.ts.map +0 -1
- package/dist/code-first/shared.js +0 -94
- package/dist/code-first/shared.js.map +0 -1
- package/dist/code-first/test-suite-operations.d.ts +0 -16
- package/dist/code-first/test-suite-operations.d.ts.map +0 -1
- package/dist/code-first/test-suite-operations.js +0 -44
- package/dist/code-first/test-suite-operations.js.map +0 -1
- package/dist/config/apply.d.ts +0 -51
- package/dist/config/apply.d.ts.map +0 -1
- package/dist/config/apply.js +0 -121
- package/dist/config/apply.js.map +0 -1
- package/dist/config/commands.d.ts +0 -58
- package/dist/config/commands.d.ts.map +0 -1
- package/dist/config/commands.js +0 -252
- package/dist/config/commands.js.map +0 -1
- package/dist/config/profiles.d.ts +0 -108
- package/dist/config/profiles.d.ts.map +0 -1
- package/dist/config/profiles.js +0 -339
- package/dist/config/profiles.js.map +0 -1
- package/dist/flag-hint.d.ts +0 -46
- package/dist/flag-hint.d.ts.map +0 -1
- package/dist/flag-hint.js +0 -114
- package/dist/flag-hint.js.map +0 -1
- package/dist/modules.d.ts +0 -17
- package/dist/modules.d.ts.map +0 -1
- package/dist/modules.js +0 -65
- package/dist/modules.js.map +0 -1
- package/dist/phase-c/api.d.ts +0 -433
- package/dist/phase-c/api.d.ts.map +0 -1
- package/dist/phase-c/api.js +0 -334
- package/dist/phase-c/api.js.map +0 -1
- package/dist/phase-c/commands/activities.d.ts +0 -119
- package/dist/phase-c/commands/activities.d.ts.map +0 -1
- package/dist/phase-c/commands/activities.js +0 -287
- package/dist/phase-c/commands/activities.js.map +0 -1
- package/dist/phase-c/commands/batch.d.ts +0 -90
- package/dist/phase-c/commands/batch.d.ts.map +0 -1
- package/dist/phase-c/commands/batch.js +0 -296
- package/dist/phase-c/commands/batch.js.map +0 -1
- package/dist/phase-c/commands/queues.d.ts +0 -67
- package/dist/phase-c/commands/queues.d.ts.map +0 -1
- package/dist/phase-c/commands/queues.js +0 -183
- package/dist/phase-c/commands/queues.js.map +0 -1
- package/dist/phase-c/commands/run-control.d.ts +0 -76
- package/dist/phase-c/commands/run-control.d.ts.map +0 -1
- package/dist/phase-c/commands/run-control.js +0 -245
- package/dist/phase-c/commands/run-control.js.map +0 -1
- package/dist/phase-c/commands/schedules.d.ts +0 -63
- package/dist/phase-c/commands/schedules.d.ts.map +0 -1
- package/dist/phase-c/commands/schedules.js +0 -198
- package/dist/phase-c/commands/schedules.js.map +0 -1
- package/dist/phase-c/commands/search-attributes.d.ts +0 -30
- package/dist/phase-c/commands/search-attributes.d.ts.map +0 -1
- package/dist/phase-c/commands/search-attributes.js +0 -70
- package/dist/phase-c/commands/search-attributes.js.map +0 -1
- package/dist/phase-c/commands/signal-tokens.d.ts +0 -27
- package/dist/phase-c/commands/signal-tokens.d.ts.map +0 -1
- package/dist/phase-c/commands/signal-tokens.js +0 -68
- package/dist/phase-c/commands/signal-tokens.js.map +0 -1
- package/dist/phase-c/commands/worker-run.d.ts +0 -109
- package/dist/phase-c/commands/worker-run.d.ts.map +0 -1
- package/dist/phase-c/commands/worker-run.js +0 -484
- package/dist/phase-c/commands/worker-run.js.map +0 -1
- package/dist/phase-c/commands/workers.d.ts +0 -46
- package/dist/phase-c/commands/workers.d.ts.map +0 -1
- package/dist/phase-c/commands/workers.js +0 -140
- package/dist/phase-c/commands/workers.js.map +0 -1
- package/dist/phase-c/index.d.ts +0 -16
- package/dist/phase-c/index.d.ts.map +0 -1
- package/dist/phase-c/index.js +0 -25
- package/dist/phase-c/index.js.map +0 -1
- package/dist/phase-c/operations.d.ts +0 -67
- package/dist/phase-c/operations.d.ts.map +0 -1
- package/dist/phase-c/operations.js +0 -559
- package/dist/phase-c/operations.js.map +0 -1
- package/dist/phase-c/register.d.ts +0 -39
- package/dist/phase-c/register.d.ts.map +0 -1
- package/dist/phase-c/register.js +0 -678
- package/dist/phase-c/register.js.map +0 -1
- package/dist/phase-c/shared.d.ts +0 -44
- package/dist/phase-c/shared.d.ts.map +0 -1
- package/dist/phase-c/shared.js +0 -146
- package/dist/phase-c/shared.js.map +0 -1
- package/dist/product-defaults.d.ts +0 -11
- package/dist/product-defaults.d.ts.map +0 -1
- package/dist/product-defaults.js +0 -25
- package/dist/product-defaults.js.map +0 -1
- package/dist/program.d.ts +0 -25
- package/dist/program.d.ts.map +0 -1
- package/dist/program.js +0 -60
- package/dist/program.js.map +0 -1
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The code-first project on disk (spec 06 §7, 07 §7):
|
|
3
|
-
*
|
|
4
|
-
* ```
|
|
5
|
-
* fluidgrids.config.json language, workspace, default task queue, Python interpreter
|
|
6
|
-
* workflows/<key>.ts|.py tier-1 source (with <key>.layout.json / <key>.pinned.json sidecars)
|
|
7
|
-
* workflows/<key>.json canvas-authored workflows kept as the JSON export envelope
|
|
8
|
-
* activities/ code imported by workflows
|
|
9
|
-
* .fluidgrids/nodes.ts|.py generated node clients (`fluidgrids codegen`)
|
|
10
|
-
* .fluidgrids/build/ the code bundle `push` uploaded (Phase C; not a source)
|
|
11
|
-
* lock.json registry snapshot, node versions, SDK version, pulled versions
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* The `workflows/` and `.fluidgrids/` names are fixed: the lift and lower in
|
|
15
|
-
* `@fluidgrids/workflows` read and write sidecars at `workflows/<key>.*`.
|
|
16
|
-
*/
|
|
17
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'fs';
|
|
18
|
-
import { dirname, isAbsolute, join, posix, resolve, sep } from 'path';
|
|
19
|
-
import { CliUserError } from '@burdenoff/cli-sdk/core';
|
|
20
|
-
import { SDK_VERSION } from '@fluidgrids/workflows';
|
|
21
|
-
import { stableStringify } from '@fluidgrids/workflows/ir';
|
|
22
|
-
export const CONFIG_FILE = 'fluidgrids.config.json';
|
|
23
|
-
export const LOCK_FILE = 'lock.json';
|
|
24
|
-
export const WORKFLOWS_DIR = 'workflows';
|
|
25
|
-
export const ACTIVITIES_DIR = 'activities';
|
|
26
|
-
export const GENERATED_DIR = '.fluidgrids';
|
|
27
|
-
/**
|
|
28
|
-
* Build output (Phase C, CWD8): `push` writes the code bundle it uploads here
|
|
29
|
-
* (`bundle.mjs`, or `bundle.pyz` for Python), so `fluidgrids worker run` serves
|
|
30
|
-
* the same bytes and `buildId`. Never read as a source.
|
|
31
|
-
*/
|
|
32
|
-
export const BUILD_DIR = `${GENERATED_DIR}/build`;
|
|
33
|
-
export const CONFIG_FORMAT_VERSION = 1;
|
|
34
|
-
export const LOCK_FORMAT_VERSION = 1;
|
|
35
|
-
export const PROJECT_LANGUAGES = ['ts', 'py'];
|
|
36
|
-
export const WORKFLOW_FORMATS = ['ts', 'py', 'json'];
|
|
37
|
-
function isRecord(value) {
|
|
38
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
39
|
-
}
|
|
40
|
-
function readJson(path) {
|
|
41
|
-
let text;
|
|
42
|
-
try {
|
|
43
|
-
text = readFileSync(path, 'utf8');
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
47
|
-
throw new CliUserError(`Cannot read ${path}: ${reason}`);
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
return JSON.parse(text);
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
throw new CliUserError(`${path} is not valid JSON.`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function optionalString(record, key, where) {
|
|
57
|
-
const value = record[key];
|
|
58
|
-
if (value === undefined)
|
|
59
|
-
return undefined;
|
|
60
|
-
if (typeof value !== 'string' || value.trim() === '') {
|
|
61
|
-
throw new CliUserError(`${where}: "${key}" must be a non-empty string.`);
|
|
62
|
-
}
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
export function parseConfig(value, where) {
|
|
66
|
-
if (!isRecord(value))
|
|
67
|
-
throw new CliUserError(`${where} must be a JSON object.`);
|
|
68
|
-
if (value['formatVersion'] !== CONFIG_FORMAT_VERSION) {
|
|
69
|
-
throw new CliUserError(`${where}: "formatVersion" must be ${CONFIG_FORMAT_VERSION}.`);
|
|
70
|
-
}
|
|
71
|
-
const language = value['language'];
|
|
72
|
-
if (language !== 'ts' && language !== 'py') {
|
|
73
|
-
throw new CliUserError(`${where}: "language" must be "ts" or "py".`);
|
|
74
|
-
}
|
|
75
|
-
const config = {
|
|
76
|
-
formatVersion: CONFIG_FORMAT_VERSION,
|
|
77
|
-
language,
|
|
78
|
-
defaultTaskQueue: optionalString(value, 'defaultTaskQueue', where) ?? 'managed',
|
|
79
|
-
};
|
|
80
|
-
const workspaceId = optionalString(value, 'workspaceId', where);
|
|
81
|
-
if (workspaceId)
|
|
82
|
-
config.workspaceId = workspaceId;
|
|
83
|
-
const python = optionalString(value, 'python', where);
|
|
84
|
-
if (python)
|
|
85
|
-
config.python = python;
|
|
86
|
-
return config;
|
|
87
|
-
}
|
|
88
|
-
export function emptyLock() {
|
|
89
|
-
return {
|
|
90
|
-
formatVersion: LOCK_FORMAT_VERSION,
|
|
91
|
-
sdkVersion: SDK_VERSION,
|
|
92
|
-
registrySnapshot: null,
|
|
93
|
-
nodes: [],
|
|
94
|
-
workflows: {},
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function parseLockedWorkflow(value, key, where) {
|
|
98
|
-
if (!isRecord(value) ||
|
|
99
|
-
typeof value['version'] !== 'string' ||
|
|
100
|
-
typeof value['irHash'] !== 'string' ||
|
|
101
|
-
typeof value['path'] !== 'string' ||
|
|
102
|
-
!WORKFLOW_FORMATS.includes(value['format'])) {
|
|
103
|
-
throw new CliUserError(`${where}: workflows["${key}"] is not a valid entry.`);
|
|
104
|
-
}
|
|
105
|
-
const buildId = value['buildId'];
|
|
106
|
-
if (buildId !== undefined && typeof buildId !== 'string') {
|
|
107
|
-
throw new CliUserError(`${where}: workflows["${key}"].buildId must be a string.`);
|
|
108
|
-
}
|
|
109
|
-
return {
|
|
110
|
-
version: value['version'],
|
|
111
|
-
irHash: value['irHash'],
|
|
112
|
-
format: value['format'],
|
|
113
|
-
path: safeRelativePath(value['path'], where),
|
|
114
|
-
...(buildId !== undefined ? { buildId } : {}),
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function parseLockedBundle(value, where) {
|
|
118
|
-
if (value === undefined)
|
|
119
|
-
return undefined;
|
|
120
|
-
if (!isRecord(value) ||
|
|
121
|
-
typeof value['buildId'] !== 'string' ||
|
|
122
|
-
typeof value['sourceHash'] !== 'string' ||
|
|
123
|
-
typeof value['sdkVersion'] !== 'string') {
|
|
124
|
-
throw new CliUserError(`${where}: "bundle" must be { buildId, sourceHash, sdkVersion }.`);
|
|
125
|
-
}
|
|
126
|
-
return {
|
|
127
|
-
buildId: value['buildId'],
|
|
128
|
-
sourceHash: value['sourceHash'],
|
|
129
|
-
sdkVersion: value['sdkVersion'],
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
export function parseLock(value, where) {
|
|
133
|
-
if (!isRecord(value) || value['formatVersion'] !== LOCK_FORMAT_VERSION) {
|
|
134
|
-
throw new CliUserError(`${where}: "formatVersion" must be ${LOCK_FORMAT_VERSION}.`);
|
|
135
|
-
}
|
|
136
|
-
const snapshot = value['registrySnapshot'];
|
|
137
|
-
if (snapshot !== null && typeof snapshot !== 'string') {
|
|
138
|
-
throw new CliUserError(`${where}: "registrySnapshot" must be a string or null.`);
|
|
139
|
-
}
|
|
140
|
-
const nodesValue = value['nodes'];
|
|
141
|
-
if (!Array.isArray(nodesValue))
|
|
142
|
-
throw new CliUserError(`${where}: "nodes" must be an array.`);
|
|
143
|
-
const nodes = nodesValue.map((node, index) => {
|
|
144
|
-
if (!isRecord(node) ||
|
|
145
|
-
typeof node['nodeType'] !== 'string' ||
|
|
146
|
-
(node['nodeVersion'] !== null && typeof node['nodeVersion'] !== 'string')) {
|
|
147
|
-
throw new CliUserError(`${where}: nodes[${index}] is not a valid entry.`);
|
|
148
|
-
}
|
|
149
|
-
return { nodeType: node['nodeType'], nodeVersion: node['nodeVersion'] };
|
|
150
|
-
});
|
|
151
|
-
const workflowsValue = value['workflows'];
|
|
152
|
-
if (!isRecord(workflowsValue)) {
|
|
153
|
-
throw new CliUserError(`${where}: "workflows" must be an object.`);
|
|
154
|
-
}
|
|
155
|
-
const workflows = {};
|
|
156
|
-
for (const [key, entry] of Object.entries(workflowsValue)) {
|
|
157
|
-
Object.defineProperty(workflows, key, {
|
|
158
|
-
value: parseLockedWorkflow(entry, key, where),
|
|
159
|
-
enumerable: true,
|
|
160
|
-
writable: true,
|
|
161
|
-
configurable: true,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
const bundle = parseLockedBundle(value['bundle'], where);
|
|
165
|
-
return {
|
|
166
|
-
formatVersion: LOCK_FORMAT_VERSION,
|
|
167
|
-
sdkVersion: typeof value['sdkVersion'] === 'string' ? value['sdkVersion'] : SDK_VERSION,
|
|
168
|
-
registrySnapshot: snapshot,
|
|
169
|
-
nodes,
|
|
170
|
-
workflows,
|
|
171
|
-
...(bundle ? { bundle } : {}),
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
/** The nearest directory at or above `start` that holds `fluidgrids.config.json`. */
|
|
175
|
-
export function findProjectRoot(start) {
|
|
176
|
-
let dir = resolve(start);
|
|
177
|
-
for (;;) {
|
|
178
|
-
if (existsSync(join(dir, CONFIG_FILE)))
|
|
179
|
-
return dir;
|
|
180
|
-
const parent = dirname(dir);
|
|
181
|
-
if (parent === dir)
|
|
182
|
-
return null;
|
|
183
|
-
dir = parent;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/** Load the project at `projectDir`, or the nearest one above the working directory. */
|
|
187
|
-
export function loadProject(projectDir, cwd = process.cwd()) {
|
|
188
|
-
const root = projectDir ? resolve(cwd, projectDir) : findProjectRoot(cwd);
|
|
189
|
-
if (!root || !existsSync(join(root, CONFIG_FILE))) {
|
|
190
|
-
throw new CliUserError(`No ${CONFIG_FILE} found.`, {
|
|
191
|
-
hint: 'Run `fluidgrids init` to create a project, or pass --project <dir>.',
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
const config = parseConfig(readJson(join(root, CONFIG_FILE)), CONFIG_FILE);
|
|
195
|
-
const lockPath = join(root, LOCK_FILE);
|
|
196
|
-
const lock = existsSync(lockPath) ? parseLock(readJson(lockPath), LOCK_FILE) : emptyLock();
|
|
197
|
-
return { root, config, lock };
|
|
198
|
-
}
|
|
199
|
-
/** Deterministic JSON text for a file the CLI owns: sorted keys, two spaces, final newline. */
|
|
200
|
-
export function jsonText(value) {
|
|
201
|
-
return stableStringify(value);
|
|
202
|
-
}
|
|
203
|
-
export function writeLock(project) {
|
|
204
|
-
writeProjectFile(project.root, LOCK_FILE, jsonText({ ...project.lock, sdkVersion: SDK_VERSION }));
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* A project-relative path with `/` separators. Absolute paths, `..` segments,
|
|
208
|
-
* empty segments and backslashes are refused, so a path from a server response
|
|
209
|
-
* or a lock file can never point outside the project.
|
|
210
|
-
*/
|
|
211
|
-
export function safeRelativePath(path, where) {
|
|
212
|
-
const refuse = () => {
|
|
213
|
-
throw new CliUserError(`${where}: refusing the path "${path}".`);
|
|
214
|
-
};
|
|
215
|
-
if (path === '' || path.includes('\\') || path.includes('\0') || isAbsolute(path))
|
|
216
|
-
refuse();
|
|
217
|
-
const segments = path.split('/');
|
|
218
|
-
if (segments.some((segment) => segment === '' || segment === '.' || segment === '..'))
|
|
219
|
-
refuse();
|
|
220
|
-
return posix.normalize(path);
|
|
221
|
-
}
|
|
222
|
-
/** Write a file inside the project, creating its directory. */
|
|
223
|
-
export function writeProjectFile(root, path, content) {
|
|
224
|
-
const relative = safeRelativePath(path, 'write');
|
|
225
|
-
const target = join(root, ...relative.split('/'));
|
|
226
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
227
|
-
writeFileSync(target, content, 'utf8');
|
|
228
|
-
}
|
|
229
|
-
export function readProjectFile(root, path) {
|
|
230
|
-
const target = join(root, ...safeRelativePath(path, 'read').split('/'));
|
|
231
|
-
return existsSync(target) ? readFileSync(target, 'utf8') : null;
|
|
232
|
-
}
|
|
233
|
-
const SKIPPED_DIRS = new Set(['node_modules', '__pycache__', '.venv', 'venv', '.git']);
|
|
234
|
-
function walk(root, dir, out) {
|
|
235
|
-
const absolute = join(root, ...dir.split('/'));
|
|
236
|
-
if (!existsSync(absolute) || !statSync(absolute).isDirectory())
|
|
237
|
-
return;
|
|
238
|
-
for (const entry of readdirSync(absolute, { withFileTypes: true })) {
|
|
239
|
-
const relative = `${dir}/${entry.name}`;
|
|
240
|
-
if (entry.isDirectory()) {
|
|
241
|
-
if (!SKIPPED_DIRS.has(entry.name) && relative !== BUILD_DIR)
|
|
242
|
-
walk(root, relative, out);
|
|
243
|
-
}
|
|
244
|
-
else if (entry.isFile()) {
|
|
245
|
-
out.push(relative);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/** Every file under the project's source directories, sorted. */
|
|
250
|
-
export function listSourcePaths(root) {
|
|
251
|
-
const out = [];
|
|
252
|
-
for (const dir of [WORKFLOWS_DIR, ACTIVITIES_DIR, GENERATED_DIR])
|
|
253
|
-
walk(root, dir, out);
|
|
254
|
-
return out.sort();
|
|
255
|
-
}
|
|
256
|
-
export function isSidecar(path) {
|
|
257
|
-
return path.endsWith('.layout.json') || path.endsWith('.pinned.json');
|
|
258
|
-
}
|
|
259
|
-
/** A canvas workflow kept as JSON: `workflows/**.json` that is not a sidecar. */
|
|
260
|
-
export function isJsonWorkflow(path) {
|
|
261
|
-
return path.startsWith(`${WORKFLOWS_DIR}/`) && path.endsWith('.json') && !isSidecar(path);
|
|
262
|
-
}
|
|
263
|
-
/** Source modules of the given language that may define workflows (tests and declarations excluded). */
|
|
264
|
-
export function isWorkflowModule(path, language) {
|
|
265
|
-
if (!path.startsWith(`${WORKFLOWS_DIR}/`))
|
|
266
|
-
return false;
|
|
267
|
-
if (language === 'ts') {
|
|
268
|
-
return path.endsWith('.ts') && !path.endsWith('.d.ts') && !/\.(test|spec)\.ts$/.test(path);
|
|
269
|
-
}
|
|
270
|
-
const name = posix.basename(path);
|
|
271
|
-
return path.endsWith('.py') && !name.startsWith('test_') && !name.endsWith('_test.py');
|
|
272
|
-
}
|
|
273
|
-
/** Files of the given language that lowering reads: modules plus sidecars. */
|
|
274
|
-
export function isLoweringInput(path, language) {
|
|
275
|
-
if (isSidecar(path))
|
|
276
|
-
return path.startsWith(`${WORKFLOWS_DIR}/`);
|
|
277
|
-
return language === 'ts' ? path.endsWith('.ts') : path.endsWith('.py');
|
|
278
|
-
}
|
|
279
|
-
export function readProjectFiles(root, paths) {
|
|
280
|
-
return paths.map((path) => ({
|
|
281
|
-
path,
|
|
282
|
-
content: readFileSync(join(root, ...path.split('/')), 'utf8'),
|
|
283
|
-
}));
|
|
284
|
-
}
|
|
285
|
-
/** The OS-specific form of a project-relative path, for messages. */
|
|
286
|
-
export function displayPath(path) {
|
|
287
|
-
return path.split('/').join(sep);
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Refuse to work against a workspace other than the one the project records in
|
|
291
|
-
* `fluidgrids.config.json` (`workspaceId`), so a `push` or `pull` never lands in
|
|
292
|
-
* the wrong workspace after `fluidgrids workspace set` switched the CLI. A
|
|
293
|
-
* project without `workspaceId` works against any workspace, and so does a
|
|
294
|
-
* session whose workspace is not known (token mode with only
|
|
295
|
-
* `FLUIDGRIDS_WORKSPACE_TOKEN`).
|
|
296
|
-
*/
|
|
297
|
-
export function assertProjectWorkspace(env, project) {
|
|
298
|
-
const expected = project.config.workspaceId;
|
|
299
|
-
if (!expected || !env.ctx.auth.isAuthenticated())
|
|
300
|
-
return;
|
|
301
|
-
const current = env.ctx.auth.read()?.workspaceId;
|
|
302
|
-
if (!current || current === expected)
|
|
303
|
-
return;
|
|
304
|
-
throw new CliUserError(`This project targets workspace ${expected}, but the CLI is using workspace ${current}.`, {
|
|
305
|
-
hint: `Run \`${env.ctx.productName} workspace set ${expected}\` (or set FLUIDGRIDS_WORKSPACE_ID=${expected}), or remove "workspaceId" from ${CONFIG_FILE} to use the project with any workspace.`,
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
//# sourceMappingURL=project.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/code-first/project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAmB,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,CAAC,MAAM,WAA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;IAC/E,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC;IAC5C,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE;QAAE,OAAO;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,WAAW,CAAC;IACjD,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO;IAC7C,MAAM,IAAI,YAAY,CACpB,kCAAkC,QAAQ,oCAAoC,OAAO,GAAG,EACxF;QACE,IAAI,EAAE,SAAS,GAAG,CAAC,GAAG,CAAC,WAAW,kBAAkB,QAAQ,sCAAsC,QAAQ,mCAAmC,WAAW,yCAAyC;KAClM,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Python durable functions in the CLI (Phase C release C-S6, plan C-CLI and
|
|
3
|
-
* C-PYBUNDLE): building the bundle a push uploads, the source archive the
|
|
4
|
-
* service keeps, and replays against the local Python code.
|
|
5
|
-
*
|
|
6
|
-
* - Build: `<python> -m fluidgrids_workflows build <root> --out
|
|
7
|
-
* .fluidgrids/build/bundle.pyz --connections -` runs the Python SDK's
|
|
8
|
-
* `build_project`, the same function the service's build VM runs, so the
|
|
9
|
-
* `buildId` (the sha256 of the deterministic `.pyz`) is the one the service
|
|
10
|
-
* would build. The CLI checks the bytes against it.
|
|
11
|
-
* - Source archive (D-S6-4): the gzipped JSON `{files}` of the files the
|
|
12
|
-
* Python SDK hashes (`workflows/**` `.py`/`.json` outside `__pycache__`,
|
|
13
|
-
* and `.fluidgrids/nodes.py`), so the service recomputes the same
|
|
14
|
-
* `sourceHash`. The CLI vendors no packages for Python.
|
|
15
|
-
* - Replay: `<python> -m fluidgrids_workflows replay <history> --project
|
|
16
|
-
* <root>` replays one history with the project's tier-2 functions.
|
|
17
|
-
*/
|
|
18
|
-
import { type HistoryFile } from '@fluidgrids/workflows/history';
|
|
19
|
-
import type { ConnectionRef } from '@fluidgrids/workflows/ir';
|
|
20
|
-
import { type PythonLoweredWorkflow } from './python.js';
|
|
21
|
-
import type { ReplayOutcome, Replayer } from './replay.js';
|
|
22
|
-
export declare const BUILD_RESULT_FORMAT = "fluidgrids.python-build-result";
|
|
23
|
-
/** Where `push` writes the Python bundle (CWD8). */
|
|
24
|
-
export declare const PYTHON_BUNDLE_PATH = ".fluidgrids/build/bundle.pyz";
|
|
25
|
-
/** A build lowers, imports and lints the project; it may take longer than a lowering. */
|
|
26
|
-
export declare const DEFAULT_PYTHON_BUILD_TIMEOUT_MS = 300000;
|
|
27
|
-
export interface PythonBuildDiagnostic {
|
|
28
|
-
path: string;
|
|
29
|
-
code: string | null;
|
|
30
|
-
message: string;
|
|
31
|
-
severity: string;
|
|
32
|
-
line?: number;
|
|
33
|
-
column?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface PythonBuildResult {
|
|
36
|
-
sdkVersion: string;
|
|
37
|
-
sourceHash: string;
|
|
38
|
-
buildId: string;
|
|
39
|
-
/** The `.pyz` bytes (read back from the `--out` file and checked against `buildId`). */
|
|
40
|
-
bundle: Uint8Array;
|
|
41
|
-
entries: string[];
|
|
42
|
-
workflows: PythonLoweredWorkflow[];
|
|
43
|
-
issues: Array<{
|
|
44
|
-
code: string;
|
|
45
|
-
message: string;
|
|
46
|
-
module: string;
|
|
47
|
-
key?: string;
|
|
48
|
-
}>;
|
|
49
|
-
diagnostics: PythonBuildDiagnostic[];
|
|
50
|
-
}
|
|
51
|
-
export interface PythonBuildOptions {
|
|
52
|
-
python: string;
|
|
53
|
-
root: string;
|
|
54
|
-
entries: readonly string[];
|
|
55
|
-
connections: Readonly<Record<string, ConnectionRef>>;
|
|
56
|
-
timeoutMs?: number;
|
|
57
|
-
}
|
|
58
|
-
/** Parse a `fluidgrids.python-build-result` (printed without `bundleBytes` because of `--out`). */
|
|
59
|
-
export declare function parseBuildResult(stdout: string): Omit<PythonBuildResult, 'bundle'> & {
|
|
60
|
-
bundleSize: number;
|
|
61
|
-
};
|
|
62
|
-
export declare function sha256Id(bytes: Uint8Array): string;
|
|
63
|
-
/** Build the Python bundle into `.fluidgrids/build/bundle.pyz` and return it with its IR. */
|
|
64
|
-
export declare function buildPython(options: PythonBuildOptions): Promise<PythonBuildResult>;
|
|
65
|
-
/**
|
|
66
|
-
* The files the Python SDK hashes into `sourceHash` (and the service checks):
|
|
67
|
-
* `.py` and `.json` files under `workflows/` outside `__pycache__` (Python's
|
|
68
|
-
* `Path.suffix` rule: a name whose only dot is its first character has no
|
|
69
|
-
* suffix), plus `.fluidgrids/nodes.py`.
|
|
70
|
-
*/
|
|
71
|
-
export declare function isPythonSourcePath(path: string): boolean;
|
|
72
|
-
/** The source archive's `files` of a Python project. */
|
|
73
|
-
export declare function pythonSourceFiles(root: string): Record<string, string>;
|
|
74
|
-
/** Parse `fluidgrids_workflows replay` output into a replay outcome. */
|
|
75
|
-
export declare function pythonReplayOutcome(stdout: string, file: HistoryFile, name: string): ReplayOutcome;
|
|
76
|
-
/** Replays histories with the project's Python code, one process per history. */
|
|
77
|
-
export declare function createPythonReplayer(python: string, root: string, timeoutMs?: number): Replayer;
|
|
78
|
-
//# sourceMappingURL=python-build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"python-build.d.ts","sourceRoot":"","sources":["../../src/code-first/python-build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAQH,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3D,eAAO,MAAM,mBAAmB,mCAAmC,CAA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