@formigio/fazemos-cli 0.10.0 → 0.10.2

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 CHANGED
@@ -4298,7 +4298,7 @@ step
4298
4298
  .action(async (instanceId, stepId, opts) => {
4299
4299
  try {
4300
4300
  const data = await api('POST', `/api/pipeline-instances/${instanceId}/steps/${stepId}/revise`, {
4301
- reason: opts.reason,
4301
+ feedback: opts.reason,
4302
4302
  });
4303
4303
  console.log(chalk.green(`Revision requested: ${data.step?.step_name || stepId}`));
4304
4304
  console.log(` Status: ${data.step?.status}`);
@@ -4368,12 +4368,16 @@ step
4368
4368
  .argument('<stepId>', 'Step instance ID')
4369
4369
  .requiredOption('-f, --feedback <text>', 'What the step got wrong and what to fix (required)')
4370
4370
  .option('--no-cascade', 'Skip resetting downstream steps')
4371
+ .option('--cascade-through-skipped', 'Include skipped steps in the reset cascade. By default, cascade stops when it reaches a skipped step. ' +
4372
+ 'Use this flag when the skipped step was pre-skipped incorrectly and should be treated as blocked pending new output.')
4371
4373
  .action(async (instanceId, stepId, opts) => {
4372
4374
  try {
4373
- const data = await api('POST', `/api/pipeline-instances/${instanceId}/steps/${stepId}/reset`, {
4375
+ const body = {
4374
4376
  feedback: opts.feedback,
4375
4377
  cascade: opts.cascade,
4376
- });
4378
+ cascade_through_skipped: opts.cascadeThroughSkipped === true,
4379
+ };
4380
+ const data = await api('POST', `/api/pipeline-instances/${instanceId}/steps/${stepId}/reset`, body);
4377
4381
  const stepName = data.step?.step_name || stepId;
4378
4382
  const status = data.step?.status || 'unknown';
4379
4383
  console.log(chalk.green(`Step reset: "${stepName}" (${status})`));
@@ -4387,18 +4391,45 @@ step
4387
4391
  }
4388
4392
  else if (!cascadeResult || cascadeResult.blocked_count === 0) {
4389
4393
  console.log(` Cascade: no downstream steps to block`);
4394
+ // I13: inform operator when flag was used but no skipped steps were found
4395
+ if (opts.cascadeThroughSkipped) {
4396
+ console.log(` (No skipped steps in cascade path)`);
4397
+ }
4390
4398
  }
4391
4399
  else {
4392
4400
  console.log(` Cascade: ${cascadeResult.blocked_count} downstream step${cascadeResult.blocked_count === 1 ? '' : 's'} blocked`);
4393
4401
  if (cascadeResult.blocked_steps?.length) {
4394
4402
  for (const bs of cascadeResult.blocked_steps) {
4395
- console.log(` - ${bs.step_name} (was: ${bs.previous_status})`);
4403
+ // I13: annotate cascade-blocked skipped steps
4404
+ const skippedNote = bs.previous_status === 'skipped' ? ' ← cascade-through-skipped' : '';
4405
+ console.log(` - ${bs.step_name} (was: ${bs.previous_status})${skippedNote}`);
4406
+ }
4407
+ }
4408
+ // I13: inform operator when flag was used but no skipped steps were encountered
4409
+ if (opts.cascadeThroughSkipped) {
4410
+ const hasSkippedSteps = cascadeResult.blocked_steps?.some((bs) => bs.previous_status === 'skipped');
4411
+ if (!hasSkippedSteps) {
4412
+ console.log(` (No skipped steps in cascade path)`);
4396
4413
  }
4397
4414
  }
4398
4415
  }
4399
4416
  }
4400
4417
  catch (err) {
4401
- console.error(chalk.red(err.message));
4418
+ if (err.code === 'DOWNSTREAM_RUNNING') {
4419
+ console.error(chalk.red(err.message));
4420
+ console.error('');
4421
+ console.error(`Cancel the running step first, then retry:`);
4422
+ // I13: echo --cascade-through-skipped in retry suggestion when flag was used
4423
+ const cascadeFlag = opts.cascadeThroughSkipped ? ' --cascade-through-skipped' : '';
4424
+ console.error(` fazemos pl step reset ${instanceId} ${stepId} --feedback "..."${cascadeFlag}`);
4425
+ }
4426
+ else if (err.code === 'INVALID_STATE') {
4427
+ console.error(chalk.red(`Error: ${err.message}`));
4428
+ console.error(`Reset only works on completed steps. Use 'retry' for failed steps.`);
4429
+ }
4430
+ else {
4431
+ console.error(chalk.red(err.message));
4432
+ }
4402
4433
  process.exit(1);
4403
4434
  }
4404
4435
  });