@formigio/fazemos-cli 0.10.1 → 0.10.4
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.d.ts +3 -1
- package/dist/index.js +45 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4212,7 +4212,8 @@ step
|
|
|
4212
4212
|
.option('--callback-token <token>', 'Callback token')
|
|
4213
4213
|
.action(async (instanceId, stepId, opts) => {
|
|
4214
4214
|
try {
|
|
4215
|
-
|
|
4215
|
+
// I19: API expects `append` not `text`. Flag stays --text (operator muscle memory).
|
|
4216
|
+
const body = { append: opts.text };
|
|
4216
4217
|
if (opts.callbackToken)
|
|
4217
4218
|
body.callbackToken = opts.callbackToken;
|
|
4218
4219
|
await api('PATCH', `/api/pipeline-instances/${instanceId}/steps/${stepId}/output`, body);
|
|
@@ -4368,12 +4369,16 @@ step
|
|
|
4368
4369
|
.argument('<stepId>', 'Step instance ID')
|
|
4369
4370
|
.requiredOption('-f, --feedback <text>', 'What the step got wrong and what to fix (required)')
|
|
4370
4371
|
.option('--no-cascade', 'Skip resetting downstream steps')
|
|
4372
|
+
.option('--cascade-through-skipped', 'Include skipped steps in the reset cascade. By default, cascade stops when it reaches a skipped step. ' +
|
|
4373
|
+
'Use this flag when the skipped step was pre-skipped incorrectly and should be treated as blocked pending new output.')
|
|
4371
4374
|
.action(async (instanceId, stepId, opts) => {
|
|
4372
4375
|
try {
|
|
4373
|
-
const
|
|
4376
|
+
const body = {
|
|
4374
4377
|
feedback: opts.feedback,
|
|
4375
4378
|
cascade: opts.cascade,
|
|
4376
|
-
|
|
4379
|
+
cascade_through_skipped: opts.cascadeThroughSkipped === true,
|
|
4380
|
+
};
|
|
4381
|
+
const data = await api('POST', `/api/pipeline-instances/${instanceId}/steps/${stepId}/reset`, body);
|
|
4377
4382
|
const stepName = data.step?.step_name || stepId;
|
|
4378
4383
|
const status = data.step?.status || 'unknown';
|
|
4379
4384
|
console.log(chalk.green(`Step reset: "${stepName}" (${status})`));
|
|
@@ -4387,18 +4392,45 @@ step
|
|
|
4387
4392
|
}
|
|
4388
4393
|
else if (!cascadeResult || cascadeResult.blocked_count === 0) {
|
|
4389
4394
|
console.log(` Cascade: no downstream steps to block`);
|
|
4395
|
+
// I13: inform operator when flag was used but no skipped steps were found
|
|
4396
|
+
if (opts.cascadeThroughSkipped) {
|
|
4397
|
+
console.log(` (No skipped steps in cascade path)`);
|
|
4398
|
+
}
|
|
4390
4399
|
}
|
|
4391
4400
|
else {
|
|
4392
4401
|
console.log(` Cascade: ${cascadeResult.blocked_count} downstream step${cascadeResult.blocked_count === 1 ? '' : 's'} blocked`);
|
|
4393
4402
|
if (cascadeResult.blocked_steps?.length) {
|
|
4394
4403
|
for (const bs of cascadeResult.blocked_steps) {
|
|
4395
|
-
|
|
4404
|
+
// I13: annotate cascade-blocked skipped steps
|
|
4405
|
+
const skippedNote = bs.previous_status === 'skipped' ? ' ← cascade-through-skipped' : '';
|
|
4406
|
+
console.log(` - ${bs.step_name} (was: ${bs.previous_status})${skippedNote}`);
|
|
4407
|
+
}
|
|
4408
|
+
}
|
|
4409
|
+
// I13: inform operator when flag was used but no skipped steps were encountered
|
|
4410
|
+
if (opts.cascadeThroughSkipped) {
|
|
4411
|
+
const hasSkippedSteps = cascadeResult.blocked_steps?.some((bs) => bs.previous_status === 'skipped');
|
|
4412
|
+
if (!hasSkippedSteps) {
|
|
4413
|
+
console.log(` (No skipped steps in cascade path)`);
|
|
4396
4414
|
}
|
|
4397
4415
|
}
|
|
4398
4416
|
}
|
|
4399
4417
|
}
|
|
4400
4418
|
catch (err) {
|
|
4401
|
-
|
|
4419
|
+
if (err.code === 'DOWNSTREAM_RUNNING') {
|
|
4420
|
+
console.error(chalk.red(err.message));
|
|
4421
|
+
console.error('');
|
|
4422
|
+
console.error(`Cancel the running step first, then retry:`);
|
|
4423
|
+
// I13: echo --cascade-through-skipped in retry suggestion when flag was used
|
|
4424
|
+
const cascadeFlag = opts.cascadeThroughSkipped ? ' --cascade-through-skipped' : '';
|
|
4425
|
+
console.error(` fazemos pl step reset ${instanceId} ${stepId} --feedback "..."${cascadeFlag}`);
|
|
4426
|
+
}
|
|
4427
|
+
else if (err.code === 'INVALID_STATE') {
|
|
4428
|
+
console.error(chalk.red(`Error: ${err.message}`));
|
|
4429
|
+
console.error(`Reset only works on completed steps. Use 'retry' for failed steps.`);
|
|
4430
|
+
}
|
|
4431
|
+
else {
|
|
4432
|
+
console.error(chalk.red(err.message));
|
|
4433
|
+
}
|
|
4402
4434
|
process.exit(1);
|
|
4403
4435
|
}
|
|
4404
4436
|
});
|
|
@@ -7201,5 +7233,12 @@ docs
|
|
|
7201
7233
|
handleScopedError(err);
|
|
7202
7234
|
}
|
|
7203
7235
|
});
|
|
7204
|
-
|
|
7236
|
+
// Only auto-parse when invoked as the entry point (i.e. `node dist/index.js ...`
|
|
7237
|
+
// or `npx tsx src/index.ts ...`). When imported as a module — by tests using
|
|
7238
|
+
// `vi.mock` to intercept `api()` and asserting on `program.parseAsync(...)` —
|
|
7239
|
+
// skip auto-parse so the test controls invocation.
|
|
7240
|
+
const isMainModule = import.meta.url === `file://${process.argv[1]}`;
|
|
7241
|
+
if (isMainModule)
|
|
7242
|
+
program.parse();
|
|
7243
|
+
export { program };
|
|
7205
7244
|
//# sourceMappingURL=index.js.map
|