@withone/cli 1.47.2 → 1.47.3
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/dist/index.js +13 -2
- package/package.json +1 -1
- package/skills/one/references/flows.md +1 -1
package/dist/index.js
CHANGED
|
@@ -3323,7 +3323,7 @@ function validateStepIds(flow2) {
|
|
|
3323
3323
|
collectIds(flow2.steps, "steps");
|
|
3324
3324
|
return errors;
|
|
3325
3325
|
}
|
|
3326
|
-
function validateSelectorReferences(flow2) {
|
|
3326
|
+
function validateSelectorReferences(flow2, rootDir) {
|
|
3327
3327
|
const errors = [];
|
|
3328
3328
|
const inputNames = new Set(Object.keys(flow2.inputs));
|
|
3329
3329
|
const nestedKeys = getNestedStepsKeys();
|
|
@@ -3441,6 +3441,17 @@ function validateSelectorReferences(flow2) {
|
|
|
3441
3441
|
const fieldName = step.type === "code" ? "source" : "expression";
|
|
3442
3442
|
checkSelectors(extractSelectors(text5), `${pathPrefix}.${descriptor.configKey}.${fieldName}`, preceding2);
|
|
3443
3443
|
}
|
|
3444
|
+
const modulePath = step.type === "code" ? c.module : void 0;
|
|
3445
|
+
if (rootDir && typeof modulePath === "string" && modulePath.length > 0) {
|
|
3446
|
+
const abs = path4.resolve(rootDir, modulePath);
|
|
3447
|
+
if (fs4.existsSync(abs)) {
|
|
3448
|
+
try {
|
|
3449
|
+
const moduleText = fs4.readFileSync(abs, "utf-8");
|
|
3450
|
+
checkSelectors(extractSelectors(moduleText), `${pathPrefix}.${descriptor.configKey}.module`, preceding2);
|
|
3451
|
+
} catch {
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
}
|
|
3444
3455
|
}
|
|
3445
3456
|
}
|
|
3446
3457
|
for (const { configKey, fieldName } of nestedKeys) {
|
|
@@ -3608,7 +3619,7 @@ function validateFlow(flow2, rootDir) {
|
|
|
3608
3619
|
const f = flow2;
|
|
3609
3620
|
return [
|
|
3610
3621
|
...validateStepIds(f),
|
|
3611
|
-
...validateSelectorReferences(f),
|
|
3622
|
+
...validateSelectorReferences(f, rootDir),
|
|
3612
3623
|
...validateOutputSchemas(f),
|
|
3613
3624
|
...rootDir ? validateCodeModules(f, rootDir) : []
|
|
3614
3625
|
];
|
package/package.json
CHANGED
|
@@ -145,7 +145,7 @@ Two rules: (1) prepend the stdin-read line, (2) replace `return X` with `process
|
|
|
145
145
|
one --agent flow validate <key>
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
`flow validate` parses every inline `code.source` and runs `node --check` on every `code.module` file, so syntax errors (brace/paren mismatches, duplicate `let`, etc.) surface here instead of after upstream steps have already run. It also extracts `$.steps.X` and `$.input.X` references from inside `code.source` and `
|
|
148
|
+
`flow validate` parses every inline `code.source` and runs `node --check` on every `code.module` file, so syntax errors (brace/paren mismatches, duplicate `let`, etc.) surface here instead of after upstream steps have already run. It also extracts `$.steps.X` and `$.input.X` references from inside `code.source`, `transform.expression`, **and external `code.module` `.mjs` files**, and reports any reference to an undefined step/input or to a step declared **after** the current one (forward references resolve to `undefined` at runtime — silent data loss). The same checks run automatically at the start of `flow execute` so a broken step in position 15 fails the run immediately rather than 15 minutes in.
|
|
149
149
|
|
|
150
150
|
### Step 6: Execute
|
|
151
151
|
|