-
Notifications
You must be signed in to change notification settings - Fork 0
Add optional reason/message to .skipIf() for clearer skip output #5
Description
Per verbal request from @masonmark — a user of the .skipIf() feature (added in v0.1.3, commit f02d48e) has requested the ability to provide an optional reason message when a step is skipped.
Currently, when a step is skipped via .skipIf(), the output shows:
⏭️ Skipping: <step description> (skipIf condition met)
This is fine when the skip condition is self-evident from the step description or command, but in cases where the reason for skipping is non-obvious, it would be helpful to display a custom message explaining why the step was skipped.
Proposed API
The .skipIf() method should accept an optional reason string:
// Current (still works)
script.add('deploy to staging').skipIf(process.env.CI !== 'true');
// New: with reason
script.add('deploy to staging').skipIf(process.env.CI !== 'true', 'not running in CI');
// Also works with function conditions
script.add('release notes').skipIf(
() => runQuiet('git log -1 --format=%s').includes('[skip notes]'),
'commit message contains [skip notes]'
);When a reason is provided and the step is skipped, the output would show:
⏭️ Skipping: release notes (not running in CI)
When no reason is provided, the existing (skipIf condition met) message is shown as before.
Implementation notes
- Add an optional
skipReason?: stringfield toStepOptions - Update
.skipIf()signature to accept a secondreason?: stringparameter - Pass the reason through to the skip output in
Script.tsand toStepResult.skipReason - Update the plan display
(conditional)flag — could optionally show the reason there too
(Filed from Claude Code VSCode extension, model: Claude Opus 4.6)