fix(workflow): offer recommendation instead of hard redirect for missing UI-SPEC.md (#2039)
* fix(workflow): offer recommendation instead of hard redirect when UI-SPEC.md missing When plan-phase detects frontend indicators but no UI-SPEC.md, replace the AskUserQuestion hard-exit block with an offer_next-style recommendation that displays /gsd-ui-phase as the primary next step and /gsd-plan-phase --skip-ui as the bypass option. Also registers --skip-ui as a parsed flag so it silently bypasses the UI gate. Closes #2011 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: retrigger CI — resolve stale macOS check --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
51
tests/plan-phase-ui-redirect.test.cjs
Normal file
51
tests/plan-phase-ui-redirect.test.cjs
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
const { describe, test } = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
describe('plan-phase UI-SPEC missing behavior', () => {
|
||||
const workflowPath = path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'get-shit-done',
|
||||
'workflows',
|
||||
'plan-phase.md'
|
||||
);
|
||||
|
||||
test('workflow file exists', () => {
|
||||
assert.ok(fs.existsSync(workflowPath), `Expected workflow file at ${workflowPath}`);
|
||||
});
|
||||
|
||||
test('does NOT contain hard-blocking exit redirect to /gsd-ui-phase', () => {
|
||||
const text = fs.readFileSync(workflowPath, 'utf8');
|
||||
// The hard redirect pattern: AskUserQuestion option exits with "Run /gsd-ui-phase... Exit workflow."
|
||||
// This is the pattern from line ~503 in the original file
|
||||
const hardExitPattern = /Generate UI-SPEC first.*Exit workflow/s;
|
||||
assert.ok(
|
||||
!hardExitPattern.test(text),
|
||||
'plan-phase.md must NOT contain a hard "Generate UI-SPEC first → Exit workflow" redirect. ' +
|
||||
'It should offer a primary recommendation with --skip-ui bypass option instead.'
|
||||
);
|
||||
});
|
||||
|
||||
test('contains --skip-ui bypass option when UI-SPEC.md is missing', () => {
|
||||
const text = fs.readFileSync(workflowPath, 'utf8');
|
||||
assert.ok(
|
||||
text.includes('--skip-ui'),
|
||||
'plan-phase.md must include --skip-ui as a bypass option when UI-SPEC.md is missing'
|
||||
);
|
||||
});
|
||||
|
||||
test('contains a primary recommendation block for missing UI-SPEC', () => {
|
||||
const text = fs.readFileSync(workflowPath, 'utf8');
|
||||
const hasRecommendationPattern =
|
||||
text.includes('Recommended next step') &&
|
||||
text.includes('gsd-ui-phase');
|
||||
assert.ok(
|
||||
hasRecommendationPattern,
|
||||
'plan-phase.md must include a "Recommended next step" recommendation for /gsd-ui-phase when UI-SPEC.md is missing'
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user