Files
get-shit-done/tests/autonomous-ui-steps.test.cjs
Quang Do d4767ac2e0 fix: replace /gsd: slash command format with /gsd- skill format in all user-facing content (#1579)
* fix: replace /gsd: command format with /gsd- skill format in all suggestions

All next-step suggestions shown to users were still using the old colon
format (/gsd:xxx) which cannot be copy-pasted as skills. Migrated all
occurrences across agents/, commands/, get-shit-done/, docs/, README files,
bin/install.js (hardcoded defaults for claude runtime), and
get-shit-done/bin/lib/*.cjs (generate-claude-md templates and error messages).
Updated tests to assert new hyphen format instead of old colon format.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: migrate remaining /gsd: format to /gsd- in hooks, workflows, and sdk

Addresses remaining user-facing occurrences missed in the initial migration:

- hooks/: fix 4 user-facing messages (pause-work, update, fast, quick)
  and 2 comments in gsd-workflow-guard.js
- get-shit-done/workflows/: fix 21 Skill() literal calls that Claude
  executes directly (installer does not transform workflow content)
- sdk/prompt-sanitizer.ts: update regex to strip /gsd- format in addition
  to legacy /gsd: format; update JSDoc comment
- tests/: update autonomous-ui-steps, prompt-sanitizer to assert new format

Note: commands/gsd/*.md frontmatter (name: gsd:xxx) intentionally unchanged
— installer derives skillName from directory path, not the name field.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(plan-phase): preserve --chain flag in auto-advance sync and handle ui-phase gate in chain mode

Bug 1: step 15 sync-flag check only guarded against --auto, causing
_auto_chain_active to be cleared when plan-phase is invoked without
--auto in ARGUMENTS even though a --chain pipeline was active. Added
--chain to the guard condition, matching discuss-phase behaviour.

Bug 2: UI Design Contract gate (step 5.6) always exited the workflow
when UI-SPEC was missing, breaking the discuss --chain pipeline
silently. When _auto_chain_active is true, the gate now auto-invokes
gsd-ui-phase --auto via Skill() and continues to step 6 without
prompting. Manual invocations retain the existing AskUserQuestion flow.

* fix: remove <sub>/clear</sub> pattern and duplicate old-format command in discuss-phase.md

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 07:24:31 -04:00

144 lines
5.0 KiB
JavaScript

/**
* Tests that autonomous.md includes ui-phase and ui-review steps for frontend phases.
*
* Issue #1375: autonomous workflow skips ui-phase and ui-review for frontend phases.
* The per-phase execution loop should be: discuss -> ui-phase -> plan -> execute -> verify -> ui-review
* for phases with frontend indicators.
*/
const { describe, it, test, beforeEach } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('fs');
const path = require('path');
const WORKFLOW_PATH = path.join(__dirname, '..', 'get-shit-done', 'workflows', 'autonomous.md');
describe('autonomous workflow ui-phase and ui-review integration (#1375)', () => {
let content;
beforeEach(() => {
assert.ok(fs.existsSync(WORKFLOW_PATH), 'workflows/autonomous.md should exist');
content = fs.readFileSync(WORKFLOW_PATH, 'utf-8');
});
describe('step 3a.5 — UI design contract before planning', () => {
test('autonomous.md contains a UI design contract step between discuss and plan', () => {
assert.ok(
content.includes('3a.5'),
'should have step 3a.5 for UI design contract'
);
});
test('UI design contract step detects frontend indicators via grep pattern', () => {
// Same grep pattern as plan-phase step 5.6
assert.ok(
content.includes('grep -iE "UI|interface|frontend|component|layout|page|screen|view|form|dashboard|widget"'),
'should use the same frontend detection grep pattern as plan-phase step 5.6'
);
});
test('UI design contract step checks for existing UI-SPEC.md', () => {
assert.ok(
content.includes('UI-SPEC.md'),
'should check for existing UI-SPEC.md'
);
});
test('UI design contract step respects workflow.ui_phase config toggle', () => {
assert.ok(
content.includes('workflow.ui_phase'),
'should respect workflow.ui_phase config toggle'
);
});
test('UI design contract step invokes gsd:ui-phase skill', () => {
assert.ok(
content.includes('skill="gsd-ui-phase"'),
'should invoke gsd-ui-phase via Skill()'
);
});
test('UI design contract step appears before plan step (3b)', () => {
const uiPhasePos = content.indexOf('3a.5');
const planPos = content.indexOf('**3b. Plan**');
assert.ok(
uiPhasePos < planPos,
'step 3a.5 (UI design contract) should appear before step 3b (plan)'
);
});
});
describe('step 3d.5 — UI review after execution', () => {
test('autonomous.md contains a UI review step after execution', () => {
assert.ok(
content.includes('3d.5'),
'should have step 3d.5 for UI review'
);
});
test('UI review step checks for UI-SPEC existence before running', () => {
// The UI review should only run if a UI-SPEC was created/exists
const reviewSection = content.slice(content.indexOf('3d.5'));
assert.ok(
reviewSection.includes('UI_SPEC_FILE'),
'UI review step should check for UI-SPEC file existence'
);
});
test('UI review step respects workflow.ui_review config toggle', () => {
assert.ok(
content.includes('workflow.ui_review'),
'should respect workflow.ui_review config toggle'
);
});
test('UI review step invokes gsd:ui-review skill', () => {
assert.ok(
content.includes('skill="gsd-ui-review"'),
'should invoke gsd-ui-review via Skill()'
);
});
test('UI review is advisory (non-blocking)', () => {
const reviewSection = content.slice(content.indexOf('3d.5'));
assert.ok(
reviewSection.includes('advisory') || reviewSection.includes('non-blocking') || reviewSection.includes('regardless of score'),
'UI review should be advisory and not block phase progression'
);
});
test('UI review step appears after execution routing (3d)', () => {
const executeRouting = content.indexOf('**3d. Post-Execution Routing**');
const uiReviewPos = content.indexOf('3d.5');
assert.ok(
uiReviewPos > executeRouting,
'step 3d.5 (UI review) should appear after step 3d (post-execution routing)'
);
});
});
describe('success criteria updated', () => {
test('success criteria includes UI-aware flow', () => {
assert.ok(
content.includes('ui-phase') && content.includes('ui-review'),
'success criteria should reference ui-phase and ui-review'
);
});
test('success criteria mentions frontend phases get UI-SPEC before planning', () => {
assert.ok(
content.includes('Frontend phases') || content.includes('frontend phases'),
'success criteria should mention frontend phases'
);
});
test('success criteria notes UI review is advisory', () => {
const criteriaSection = content.slice(content.indexOf('<success_criteria>'));
assert.ok(
criteriaSection.includes('advisory') || criteriaSection.includes('non-blocking'),
'success criteria should note UI review is advisory/non-blocking'
);
});
});
});