mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-13 02:41:50 +08:00
docs(command-guide): sync reference docs and rebuild indexes
- Sync latest agent files (action-planning-agent, ui-design-agent) - Sync latest UI design workflow commands (11 files) - Sync latest test workflow commands (8 files) - Rebuild all 5 index files with updated metadata Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -409,8 +409,8 @@
|
|||||||
{
|
{
|
||||||
"name": "plan",
|
"name": "plan",
|
||||||
"command": "/workflow:plan",
|
"command": "/workflow:plan",
|
||||||
"description": "5-phase planning workflow with Gemini analysis and action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
"description": "5-phase planning workflow with action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
||||||
"arguments": "[--agent] [--cli-execute] \\\"text description\\\"|file.md",
|
"arguments": "[--cli-execute] \\\"text description\\\"|file.md",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": null,
|
"subcategory": null,
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -498,7 +498,7 @@
|
|||||||
"name": "tdd-plan",
|
"name": "tdd-plan",
|
||||||
"command": "/workflow:tdd-plan",
|
"command": "/workflow:tdd-plan",
|
||||||
"description": "TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking",
|
"description": "TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking",
|
||||||
"arguments": "[--agent] \\\"feature description\\\"|file.md",
|
"arguments": "[--cli-execute] \\\"feature description\\\"|file.md",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": null,
|
"subcategory": null,
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -585,8 +585,8 @@
|
|||||||
{
|
{
|
||||||
"name": "task-generate-tdd",
|
"name": "task-generate-tdd",
|
||||||
"command": "/workflow:tools:task-generate-tdd",
|
"command": "/workflow:tools:task-generate-tdd",
|
||||||
"description": "Generate TDD task chains with Red-Green-Refactor dependencies, test-first structure, and cycle validation",
|
"description": "Autonomous TDD task generation using action-planning-agent with Red-Green-Refactor cycles, test-first structure, and cycle validation",
|
||||||
"arguments": "--session WFS-session-id [--agent]",
|
"arguments": "--session WFS-session-id [--cli-execute]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "tools",
|
"subcategory": "tools",
|
||||||
"usage_scenario": "implementation",
|
"usage_scenario": "implementation",
|
||||||
@@ -640,7 +640,7 @@
|
|||||||
{
|
{
|
||||||
"name": "test-task-generate",
|
"name": "test-task-generate",
|
||||||
"command": "/workflow:tools:test-task-generate",
|
"command": "/workflow:tools:test-task-generate",
|
||||||
"description": "Generate test-fix task JSON with iterative test-fix-retest cycle specification using Gemini/Qwen/Codex",
|
"description": "Autonomous test-fix task generation using action-planning-agent with test-fix-retest cycle specification and discovery phase",
|
||||||
"arguments": "[--use-codex] [--cli-execute] --session WFS-test-session-id",
|
"arguments": "[--use-codex] [--cli-execute] --session WFS-test-session-id",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "tools",
|
"subcategory": "tools",
|
||||||
@@ -729,7 +729,7 @@
|
|||||||
"name": "workflow:ui-design:import-from-code",
|
"name": "workflow:ui-design:import-from-code",
|
||||||
"command": "/workflow:ui-design:import-from-code",
|
"command": "/workflow:ui-design:import-from-code",
|
||||||
"description": "Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis",
|
"description": "Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis",
|
||||||
"arguments": "[--base-path <path>] [--css \\\"<glob>\\\"] [--js \\\"<glob>\\\"] [--scss \\\"<glob>\\\"] [--html \\\"<glob>\\\"] [--style-files \\\"<glob>\\\"] [--session <id>]",
|
"arguments": "[--source-path <path>] [--output-path <path>] [--css \\\"<glob>\\\"] [--js \\\"<glob>\\\"] [--scss \\\"<glob>\\\"] [--html \\\"<glob>\\\"] [--style-files \\\"<glob>\\\"] [--session <id>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -740,7 +740,7 @@
|
|||||||
"name": "layout-extract",
|
"name": "layout-extract",
|
||||||
"command": "/workflow:ui-design:layout-extract",
|
"command": "/workflow:ui-design:layout-extract",
|
||||||
"description": "Extract structural layout information from reference images, URLs, or text prompts using Claude analysis",
|
"description": "Extract structural layout information from reference images, URLs, or text prompts using Claude analysis",
|
||||||
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--targets \"<list>\"] [--mode <imitate|explore>] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]",
|
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--targets \"<list>\"] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "general",
|
"usage_scenario": "general",
|
||||||
@@ -751,7 +751,7 @@
|
|||||||
"name": "style-extract",
|
"name": "style-extract",
|
||||||
"command": "/workflow:ui-design:style-extract",
|
"command": "/workflow:ui-design:style-extract",
|
||||||
"description": "Extract design style from reference images or text prompts using Claude analysis with variant generation",
|
"description": "Extract design style from reference images or text prompts using Claude analysis with variant generation",
|
||||||
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--mode <imitate|explore>] [--variants <count>]",
|
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--variants <count>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "general",
|
"usage_scenario": "general",
|
||||||
|
|||||||
@@ -297,8 +297,8 @@
|
|||||||
{
|
{
|
||||||
"name": "plan",
|
"name": "plan",
|
||||||
"command": "/workflow:plan",
|
"command": "/workflow:plan",
|
||||||
"description": "5-phase planning workflow with Gemini analysis and action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
"description": "5-phase planning workflow with action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
||||||
"arguments": "[--agent] [--cli-execute] \\\"text description\\\"|file.md",
|
"arguments": "[--cli-execute] \\\"text description\\\"|file.md",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": null,
|
"subcategory": null,
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -342,7 +342,7 @@
|
|||||||
"name": "tdd-plan",
|
"name": "tdd-plan",
|
||||||
"command": "/workflow:tdd-plan",
|
"command": "/workflow:tdd-plan",
|
||||||
"description": "TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking",
|
"description": "TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking",
|
||||||
"arguments": "[--agent] \\\"feature description\\\"|file.md",
|
"arguments": "[--cli-execute] \\\"feature description\\\"|file.md",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": null,
|
"subcategory": null,
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -611,8 +611,8 @@
|
|||||||
{
|
{
|
||||||
"name": "task-generate-tdd",
|
"name": "task-generate-tdd",
|
||||||
"command": "/workflow:tools:task-generate-tdd",
|
"command": "/workflow:tools:task-generate-tdd",
|
||||||
"description": "Generate TDD task chains with Red-Green-Refactor dependencies, test-first structure, and cycle validation",
|
"description": "Autonomous TDD task generation using action-planning-agent with Red-Green-Refactor cycles, test-first structure, and cycle validation",
|
||||||
"arguments": "--session WFS-session-id [--agent]",
|
"arguments": "--session WFS-session-id [--cli-execute]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "tools",
|
"subcategory": "tools",
|
||||||
"usage_scenario": "implementation",
|
"usage_scenario": "implementation",
|
||||||
@@ -666,7 +666,7 @@
|
|||||||
{
|
{
|
||||||
"name": "test-task-generate",
|
"name": "test-task-generate",
|
||||||
"command": "/workflow:tools:test-task-generate",
|
"command": "/workflow:tools:test-task-generate",
|
||||||
"description": "Generate test-fix task JSON with iterative test-fix-retest cycle specification using Gemini/Qwen/Codex",
|
"description": "Autonomous test-fix task generation using action-planning-agent with test-fix-retest cycle specification and discovery phase",
|
||||||
"arguments": "[--use-codex] [--cli-execute] --session WFS-test-session-id",
|
"arguments": "[--use-codex] [--cli-execute] --session WFS-test-session-id",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "tools",
|
"subcategory": "tools",
|
||||||
@@ -757,7 +757,7 @@
|
|||||||
"name": "workflow:ui-design:import-from-code",
|
"name": "workflow:ui-design:import-from-code",
|
||||||
"command": "/workflow:ui-design:import-from-code",
|
"command": "/workflow:ui-design:import-from-code",
|
||||||
"description": "Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis",
|
"description": "Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis",
|
||||||
"arguments": "[--base-path <path>] [--css \\\"<glob>\\\"] [--js \\\"<glob>\\\"] [--scss \\\"<glob>\\\"] [--html \\\"<glob>\\\"] [--style-files \\\"<glob>\\\"] [--session <id>]",
|
"arguments": "[--source-path <path>] [--output-path <path>] [--css \\\"<glob>\\\"] [--js \\\"<glob>\\\"] [--scss \\\"<glob>\\\"] [--html \\\"<glob>\\\"] [--style-files \\\"<glob>\\\"] [--session <id>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -768,7 +768,7 @@
|
|||||||
"name": "layout-extract",
|
"name": "layout-extract",
|
||||||
"command": "/workflow:ui-design:layout-extract",
|
"command": "/workflow:ui-design:layout-extract",
|
||||||
"description": "Extract structural layout information from reference images, URLs, or text prompts using Claude analysis",
|
"description": "Extract structural layout information from reference images, URLs, or text prompts using Claude analysis",
|
||||||
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--targets \"<list>\"] [--mode <imitate|explore>] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]",
|
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--targets \"<list>\"] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "general",
|
"usage_scenario": "general",
|
||||||
@@ -779,7 +779,7 @@
|
|||||||
"name": "style-extract",
|
"name": "style-extract",
|
||||||
"command": "/workflow:ui-design:style-extract",
|
"command": "/workflow:ui-design:style-extract",
|
||||||
"description": "Extract design style from reference images or text prompts using Claude analysis with variant generation",
|
"description": "Extract design style from reference images or text prompts using Claude analysis with variant generation",
|
||||||
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--mode <imitate|explore>] [--variants <count>]",
|
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--variants <count>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "general",
|
"usage_scenario": "general",
|
||||||
|
|||||||
@@ -347,7 +347,7 @@
|
|||||||
"name": "layout-extract",
|
"name": "layout-extract",
|
||||||
"command": "/workflow:ui-design:layout-extract",
|
"command": "/workflow:ui-design:layout-extract",
|
||||||
"description": "Extract structural layout information from reference images, URLs, or text prompts using Claude analysis",
|
"description": "Extract structural layout information from reference images, URLs, or text prompts using Claude analysis",
|
||||||
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--targets \"<list>\"] [--mode <imitate|explore>] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]",
|
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--targets \"<list>\"] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "general",
|
"usage_scenario": "general",
|
||||||
@@ -358,7 +358,7 @@
|
|||||||
"name": "style-extract",
|
"name": "style-extract",
|
||||||
"command": "/workflow:ui-design:style-extract",
|
"command": "/workflow:ui-design:style-extract",
|
||||||
"description": "Extract design style from reference images or text prompts using Claude analysis with variant generation",
|
"description": "Extract design style from reference images or text prompts using Claude analysis with variant generation",
|
||||||
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--mode <imitate|explore>] [--variants <count>]",
|
"arguments": "[--base-path <path>] [--session <id>] [--images \"<glob>\"] [--urls \"<list>\"] [--prompt \"<desc>\"] [--variants <count>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "general",
|
"usage_scenario": "general",
|
||||||
@@ -458,8 +458,8 @@
|
|||||||
{
|
{
|
||||||
"name": "task-generate-tdd",
|
"name": "task-generate-tdd",
|
||||||
"command": "/workflow:tools:task-generate-tdd",
|
"command": "/workflow:tools:task-generate-tdd",
|
||||||
"description": "Generate TDD task chains with Red-Green-Refactor dependencies, test-first structure, and cycle validation",
|
"description": "Autonomous TDD task generation using action-planning-agent with Red-Green-Refactor cycles, test-first structure, and cycle validation",
|
||||||
"arguments": "--session WFS-session-id [--agent]",
|
"arguments": "--session WFS-session-id [--cli-execute]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "tools",
|
"subcategory": "tools",
|
||||||
"usage_scenario": "implementation",
|
"usage_scenario": "implementation",
|
||||||
@@ -480,7 +480,7 @@
|
|||||||
{
|
{
|
||||||
"name": "test-task-generate",
|
"name": "test-task-generate",
|
||||||
"command": "/workflow:tools:test-task-generate",
|
"command": "/workflow:tools:test-task-generate",
|
||||||
"description": "Generate test-fix task JSON with iterative test-fix-retest cycle specification using Gemini/Qwen/Codex",
|
"description": "Autonomous test-fix task generation using action-planning-agent with test-fix-retest cycle specification and discovery phase",
|
||||||
"arguments": "[--use-codex] [--cli-execute] --session WFS-test-session-id",
|
"arguments": "[--use-codex] [--cli-execute] --session WFS-test-session-id",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "tools",
|
"subcategory": "tools",
|
||||||
@@ -592,8 +592,8 @@
|
|||||||
{
|
{
|
||||||
"name": "plan",
|
"name": "plan",
|
||||||
"command": "/workflow:plan",
|
"command": "/workflow:plan",
|
||||||
"description": "5-phase planning workflow with Gemini analysis and action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
"description": "5-phase planning workflow with action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
||||||
"arguments": "[--agent] [--cli-execute] \\\"text description\\\"|file.md",
|
"arguments": "[--cli-execute] \\\"text description\\\"|file.md",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": null,
|
"subcategory": null,
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -604,7 +604,7 @@
|
|||||||
"name": "tdd-plan",
|
"name": "tdd-plan",
|
||||||
"command": "/workflow:tdd-plan",
|
"command": "/workflow:tdd-plan",
|
||||||
"description": "TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking",
|
"description": "TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking",
|
||||||
"arguments": "[--agent] \\\"feature description\\\"|file.md",
|
"arguments": "[--cli-execute] \\\"feature description\\\"|file.md",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": null,
|
"subcategory": null,
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
@@ -615,7 +615,7 @@
|
|||||||
"name": "workflow:ui-design:import-from-code",
|
"name": "workflow:ui-design:import-from-code",
|
||||||
"command": "/workflow:ui-design:import-from-code",
|
"command": "/workflow:ui-design:import-from-code",
|
||||||
"description": "Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis",
|
"description": "Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis",
|
||||||
"arguments": "[--base-path <path>] [--css \\\"<glob>\\\"] [--js \\\"<glob>\\\"] [--scss \\\"<glob>\\\"] [--html \\\"<glob>\\\"] [--style-files \\\"<glob>\\\"] [--session <id>]",
|
"arguments": "[--source-path <path>] [--output-path <path>] [--css \\\"<glob>\\\"] [--js \\\"<glob>\\\"] [--scss \\\"<glob>\\\"] [--html \\\"<glob>\\\"] [--style-files \\\"<glob>\\\"] [--session <id>]",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": "ui-design",
|
"subcategory": "ui-design",
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
"name": "plan",
|
"name": "plan",
|
||||||
"command": "/workflow:plan",
|
"command": "/workflow:plan",
|
||||||
"description": "5-phase planning workflow with Gemini analysis and action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
"description": "5-phase planning workflow with action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution",
|
||||||
"arguments": "[--agent] [--cli-execute] \\\"text description\\\"|file.md",
|
"arguments": "[--cli-execute] \\\"text description\\\"|file.md",
|
||||||
"category": "workflow",
|
"category": "workflow",
|
||||||
"subcategory": null,
|
"subcategory": null,
|
||||||
"usage_scenario": "planning",
|
"usage_scenario": "planning",
|
||||||
|
|||||||
@@ -151,9 +151,17 @@ Generate individual `.task/IMPL-*.json` files with:
|
|||||||
"agent": "@code-developer"
|
"agent": "@code-developer"
|
||||||
},
|
},
|
||||||
"context": {
|
"context": {
|
||||||
"requirements": ["from analysis_results"],
|
"requirements": [
|
||||||
"focus_paths": ["src/paths"],
|
"Implement 3 features: [authentication, authorization, session management]",
|
||||||
"acceptance": ["measurable criteria"],
|
"Create 5 files: [auth.service.ts, auth.controller.ts, auth.middleware.ts, auth.types.ts, auth.test.ts]",
|
||||||
|
"Modify 2 existing functions: [validateUser() in users.service.ts lines 45-60, hashPassword() in utils.ts lines 120-135]"
|
||||||
|
],
|
||||||
|
"focus_paths": ["src/auth", "tests/auth"],
|
||||||
|
"acceptance": [
|
||||||
|
"3 features implemented: verify by npm test -- auth (exit code 0)",
|
||||||
|
"5 files created: verify by ls src/auth/*.ts | wc -l = 5",
|
||||||
|
"Test coverage >=80%: verify by npm test -- --coverage | grep auth"
|
||||||
|
],
|
||||||
"depends_on": ["IMPL-N"],
|
"depends_on": ["IMPL-N"],
|
||||||
"artifacts": [
|
"artifacts": [
|
||||||
{
|
{
|
||||||
@@ -181,23 +189,50 @@ Generate individual `.task/IMPL-*.json` files with:
|
|||||||
{
|
{
|
||||||
"step": 1,
|
"step": 1,
|
||||||
"title": "Load and analyze role analyses",
|
"title": "Load and analyze role analyses",
|
||||||
"description": "Load role analyses from artifacts and extract requirements",
|
"description": "Load 3 role analysis files and extract quantified requirements",
|
||||||
"modification_points": ["Load role analyses", "Extract requirements and design patterns"],
|
"modification_points": [
|
||||||
"logic_flow": ["Read role analyses from artifacts", "Parse architecture decisions", "Extract implementation requirements"],
|
"Load 3 role analysis files: [system-architect/analysis.md, product-manager/analysis.md, ui-designer/analysis.md]",
|
||||||
|
"Extract 15 requirements from role analyses",
|
||||||
|
"Parse 8 architecture decisions from system-architect analysis"
|
||||||
|
],
|
||||||
|
"logic_flow": [
|
||||||
|
"Read 3 role analyses from artifacts inventory",
|
||||||
|
"Parse architecture decisions (8 total)",
|
||||||
|
"Extract implementation requirements (15 total)",
|
||||||
|
"Build consolidated requirements list"
|
||||||
|
],
|
||||||
"depends_on": [],
|
"depends_on": [],
|
||||||
"output": "synthesis_requirements"
|
"output": "synthesis_requirements"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"step": 2,
|
"step": 2,
|
||||||
"title": "Implement following specification",
|
"title": "Implement following specification",
|
||||||
"description": "Implement task requirements following consolidated role analyses",
|
"description": "Implement 3 features across 5 files following consolidated role analyses",
|
||||||
"modification_points": ["Apply requirements from [synthesis_requirements]", "Modify target files", "Integrate with existing code"],
|
"modification_points": [
|
||||||
"logic_flow": ["Apply changes based on [synthesis_requirements]", "Implement core logic", "Validate against acceptance criteria"],
|
"Create 5 new files in src/auth/: [auth.service.ts (180 lines), auth.controller.ts (120 lines), auth.middleware.ts (60 lines), auth.types.ts (40 lines), auth.test.ts (200 lines)]",
|
||||||
|
"Modify 2 functions: [validateUser() in users.service.ts lines 45-60, hashPassword() in utils.ts lines 120-135]",
|
||||||
|
"Implement 3 core features: [JWT authentication, role-based authorization, session management]"
|
||||||
|
],
|
||||||
|
"logic_flow": [
|
||||||
|
"Apply 15 requirements from [synthesis_requirements]",
|
||||||
|
"Implement 3 features across 5 new files (600 total lines)",
|
||||||
|
"Modify 2 existing functions (30 lines total)",
|
||||||
|
"Write 25 test cases covering all features",
|
||||||
|
"Validate against 3 acceptance criteria"
|
||||||
|
],
|
||||||
"depends_on": [1],
|
"depends_on": [1],
|
||||||
"output": "implementation"
|
"output": "implementation"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"target_files": ["file:function:lines", "path/to/NewFile.ts"]
|
"target_files": [
|
||||||
|
"src/auth/auth.service.ts",
|
||||||
|
"src/auth/auth.controller.ts",
|
||||||
|
"src/auth/auth.middleware.ts",
|
||||||
|
"src/auth/auth.types.ts",
|
||||||
|
"tests/auth/auth.test.ts",
|
||||||
|
"src/users/users.service.ts:validateUser:45-60",
|
||||||
|
"src/utils/utils.ts:hashPassword:120-135"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -285,6 +320,35 @@ Use `analysis_results.complexity` or task count to determine structure:
|
|||||||
- **Re-scope required**: Maximum 10 tasks hard limit
|
- **Re-scope required**: Maximum 10 tasks hard limit
|
||||||
- If analysis_results contains >10 tasks, consolidate or request re-scoping
|
- If analysis_results contains >10 tasks, consolidate or request re-scoping
|
||||||
|
|
||||||
|
## Quantification Requirements (MANDATORY)
|
||||||
|
|
||||||
|
**Purpose**: Eliminate ambiguity by enforcing explicit counts and enumerations in all task specifications.
|
||||||
|
|
||||||
|
**Core Rules**:
|
||||||
|
1. **Extract Counts from Analysis**: Search for HOW MANY items and list them explicitly
|
||||||
|
2. **Enforce Explicit Lists**: Every deliverable uses format `{count} {type}: [{explicit_list}]`
|
||||||
|
3. **Make Acceptance Measurable**: Include verification commands (e.g., `ls ... | wc -l = N`)
|
||||||
|
4. **Quantify Modification Points**: Specify exact targets (files, functions with line numbers)
|
||||||
|
5. **Avoid Vague Language**: Replace "complete", "comprehensive", "reorganize" with quantified statements
|
||||||
|
|
||||||
|
**Standard Formats**:
|
||||||
|
- **Requirements**: `"Implement N items: [item1, item2, ...]"` or `"Modify N files: [file1:func:lines, ...]"`
|
||||||
|
- **Acceptance**: `"N items exist: verify by [command]"` or `"Coverage >= X%: verify by [test command]"`
|
||||||
|
- **Modification Points**: `"Create N files: [list]"` or `"Modify N functions: [func() in file lines X-Y]"`
|
||||||
|
|
||||||
|
**Validation Checklist** (Apply to every generated task JSON):
|
||||||
|
- [ ] Every requirement contains explicit count or enumerated list
|
||||||
|
- [ ] Every acceptance criterion is measurable with verification command
|
||||||
|
- [ ] Every modification_point specifies exact targets (files/functions/lines)
|
||||||
|
- [ ] No vague language ("complete", "comprehensive", "reorganize" without counts)
|
||||||
|
- [ ] Each implementation step has its own acceptance criteria
|
||||||
|
|
||||||
|
**Examples**:
|
||||||
|
- ✅ GOOD: `"Implement 5 commands: [cmd1, cmd2, cmd3, cmd4, cmd5]"`
|
||||||
|
- ❌ BAD: `"Implement new commands"`
|
||||||
|
- ✅ GOOD: `"5 files created: verify by ls .claude/commands/*.md | wc -l = 5"`
|
||||||
|
- ❌ BAD: `"All commands implemented successfully"`
|
||||||
|
|
||||||
## Quality Standards
|
## Quality Standards
|
||||||
|
|
||||||
**Planning Principles:**
|
**Planning Principles:**
|
||||||
@@ -305,6 +369,7 @@ Use `analysis_results.complexity` or task count to determine structure:
|
|||||||
## Key Reminders
|
## Key Reminders
|
||||||
|
|
||||||
**ALWAYS:**
|
**ALWAYS:**
|
||||||
|
- **Apply Quantification Requirements**: All requirements, acceptance criteria, and modification points MUST include explicit counts and enumerations
|
||||||
- **Use provided context package**: Extract all information from structured context
|
- **Use provided context package**: Extract all information from structured context
|
||||||
- **Respect memory-first rule**: Use provided content (already loaded from memory/file)
|
- **Respect memory-first rule**: Use provided content (already loaded from memory/file)
|
||||||
- **Follow 5-field schema**: All task JSONs must have id, title, status, meta, context, flow_control
|
- **Follow 5-field schema**: All task JSONs must have id, title, status, meta, context, flow_control
|
||||||
@@ -313,6 +378,7 @@ Use `analysis_results.complexity` or task count to determine structure:
|
|||||||
- **Validate task count**: Maximum 10 tasks hard limit, request re-scope if exceeded
|
- **Validate task count**: Maximum 10 tasks hard limit, request re-scope if exceeded
|
||||||
- **Use session paths**: Construct all paths using provided session_id
|
- **Use session paths**: Construct all paths using provided session_id
|
||||||
- **Link documents properly**: Use correct linking format (📋 for JSON, ✅ for summaries)
|
- **Link documents properly**: Use correct linking format (📋 for JSON, ✅ for summaries)
|
||||||
|
- **Run validation checklist**: Verify all quantification requirements before finalizing task JSONs
|
||||||
|
|
||||||
**NEVER:**
|
**NEVER:**
|
||||||
- Load files directly (use provided context package instead)
|
- Load files directly (use provided context package instead)
|
||||||
|
|||||||
@@ -16,89 +16,131 @@ description: |
|
|||||||
color: orange
|
color: orange
|
||||||
---
|
---
|
||||||
|
|
||||||
You are a specialized **UI Design Agent** that executes design generation tasks autonomously. You are invoked by orchestrator commands (e.g., `consolidate.md`, `generate.md`) to produce production-ready design systems and prototypes.
|
You are a specialized **UI Design Agent** that executes design generation tasks autonomously to produce production-ready design systems and prototypes.
|
||||||
|
|
||||||
## Core Capabilities
|
## Task Patterns
|
||||||
|
|
||||||
### 1. Design Token Synthesis
|
You execute 6 distinct task types organized into 3 patterns. Each task includes `[TASK_TYPE_IDENTIFIER]` in its prompt.
|
||||||
|
|
||||||
**Invoked by**: `consolidate.md`
|
### Pattern 1: Option Generation
|
||||||
**Input**: Style variants with proposed_tokens from extraction phase
|
|
||||||
**Task**: Generate production-ready design token systems
|
|
||||||
|
|
||||||
**Deliverables**:
|
**Purpose**: Generate multiple design/layout options for user selection (exploration phase)
|
||||||
- `design-tokens.json`: W3C-compliant token definitions using OKLCH colors
|
|
||||||
- `style-guide.md`: Comprehensive design system documentation
|
|
||||||
- `layout-strategies.json`: MCP-researched layout variant definitions
|
|
||||||
- `tokens.css`: CSS custom properties with Google Fonts imports
|
|
||||||
|
|
||||||
### 2. Layout Strategy Generation
|
**Task Types**:
|
||||||
|
- `[DESIGN_DIRECTION_GENERATION_TASK]` - Generate design direction options
|
||||||
|
- `[LAYOUT_CONCEPT_GENERATION_TASK]` - Generate layout concept options
|
||||||
|
|
||||||
**Invoked by**: `consolidate.md` Phase 2.5
|
**Common Process**:
|
||||||
**Input**: Project context from role analysis documents
|
1. **Analyze Input**: User prompt, visual references, project context
|
||||||
**Task**: Research and generate adaptive layout strategies via Exa MCP (2024-2025 trends)
|
2. **Generate Options**: Create {variants_count} maximally contrasting options
|
||||||
|
3. **Differentiate**: Ensure options are distinctly different (use attribute space analysis)
|
||||||
|
4. **Write File**: Single JSON file `analysis-options.json` with all options
|
||||||
|
|
||||||
**Output**: layout-strategies.json with strategy definitions and rationale
|
**Design Direction Generation**:
|
||||||
|
- **Input**: Prompt guidance, visual references (images/URLs), project context
|
||||||
|
- **Output**: `{base_path}/.intermediates/style-analysis/analysis-options.json`
|
||||||
|
- **Content**: Design philosophies with 6D attributes (color saturation, visual weight, formality, organic/geometric, innovation, density), search keywords, visual previews (colors, fonts, border radius)
|
||||||
|
- **Goal**: Maximum contrast between options for clear user choice
|
||||||
|
|
||||||
### 3. UI Prototype Generation
|
**Layout Concept Generation**:
|
||||||
|
- **Input**: Target specifications, device type, layout inspirations, visual references, DOM structure (if available)
|
||||||
|
- **Output**: `{base_path}/.intermediates/layout-analysis/analysis-options.json`
|
||||||
|
- **Content**: Layout concepts with structural patterns (grid-3col, flex-row, etc.), component arrangements, ASCII wireframes
|
||||||
|
- **Goal**: Structurally different layouts for same target
|
||||||
|
|
||||||
**Invoked by**: `generate.md` Phase 2a
|
**Key Principles**:
|
||||||
**Input**: Design tokens, layout strategies, target specifications
|
- ✅ Creative exploration with high autonomy
|
||||||
**Task**: Generate style-agnostic HTML/CSS templates
|
- ✅ Generate diverse, contrasting options
|
||||||
|
- ✅ Include visual/structural previews for user understanding
|
||||||
|
- ❌ NO user interaction during generation
|
||||||
|
|
||||||
|
### Pattern 2: System Generation
|
||||||
|
|
||||||
|
**Purpose**: Generate complete design system components (execution phase)
|
||||||
|
|
||||||
|
**Task Types**:
|
||||||
|
- `[DESIGN_SYSTEM_GENERATION_TASK]` - Generate design tokens + style guide
|
||||||
|
- `[LAYOUT_TEMPLATE_GENERATION_TASK]` - Generate layout templates with DOM structure
|
||||||
|
- `[ANIMATION_TOKEN_GENERATION_TASK]` - Generate animation tokens + guide
|
||||||
|
|
||||||
|
**Common Process**:
|
||||||
|
1. **Load Context**: User selections (from Pattern 1) OR reference materials OR computed styles
|
||||||
|
2. **Apply Standards**: WCAG AA, OKLCH, semantic naming, accessibility
|
||||||
|
3. **MCP Research**: Query Exa for modern patterns and best practices (when applicable)
|
||||||
|
4. **Generate System**: Complete token/template system following specifications
|
||||||
|
5. **Write Files Immediately**: JSON + Markdown documentation
|
||||||
|
|
||||||
|
**Design System Generation**:
|
||||||
|
- **Input**: Selected design direction OR visual references, computed styles (if available), user refinements
|
||||||
|
- **Output**:
|
||||||
|
- `{base_path}/style-extraction/style-{id}/design-tokens.json` (W3C format, OKLCH colors)
|
||||||
|
- `{base_path}/style-extraction/style-{id}/style-guide.md`
|
||||||
|
- **Content**: Complete token system (colors, typography, spacing, opacity, shadows, border_radius, breakpoints, component_styles, typography.combinations)
|
||||||
|
- **MCP Use**: Research modern color palettes, typography trends, design system patterns
|
||||||
|
|
||||||
|
**Layout Template Generation**:
|
||||||
|
- **Input**: Selected layout concepts OR visual references, device type, DOM structure data (if available)
|
||||||
|
- **Output**: `{base_path}/layout-extraction/layout-templates.json`
|
||||||
|
- **Content**: For each target - semantic DOM structure (HTML5 + ARIA), CSS layout rules using var() placeholders, device optimizations, responsive breakpoints
|
||||||
|
- **Focus**: Structure ONLY - no visual styling (colors, fonts belong in design tokens)
|
||||||
|
|
||||||
|
**Animation Token Generation**:
|
||||||
|
- **Input**: Extracted CSS animations, user specification (if available), design tokens context
|
||||||
|
- **Output**:
|
||||||
|
- `{base_path}/animation-extraction/animation-tokens.json`
|
||||||
|
- `{base_path}/animation-extraction/animation-guide.md`
|
||||||
|
- **Content**: Duration scales, easing functions, keyframes, interaction patterns, transition utilities
|
||||||
|
- **Synthesis**: Normalize CSS extractions into semantic token system
|
||||||
|
|
||||||
|
**Key Principles**:
|
||||||
|
- ✅ Follow user selections from Pattern 1 (when in explore mode)
|
||||||
|
- ✅ Apply all design standards automatically
|
||||||
|
- ✅ Use MCP research to inform decisions
|
||||||
|
- ✅ Generate complete, production-ready systems
|
||||||
|
- ❌ NO user interaction during generation
|
||||||
|
|
||||||
|
### Pattern 3: Assembly
|
||||||
|
|
||||||
|
**Purpose**: Combine pre-defined components into final prototypes (pure assembly, no design decisions)
|
||||||
|
|
||||||
|
**Task Type**:
|
||||||
|
- `[LAYOUT_STYLE_ASSEMBLY]` - Combine layout template + design tokens → HTML/CSS prototype
|
||||||
|
|
||||||
**Process**:
|
**Process**:
|
||||||
- Research implementation patterns via Exa MCP (components, responsive design, accessibility, HTML semantics, CSS architecture)
|
1. **Load Inputs** (Read-Only):
|
||||||
- Extract exact token variable names from design-tokens.json
|
- Layout template from `layout-templates.json` (dom_structure, css_layout_rules with var())
|
||||||
- Generate semantic HTML5 structure with ARIA attributes
|
- Design tokens from `design-tokens.json` (complete token system)
|
||||||
- Create structural CSS using 100% CSS custom properties
|
- Animation tokens from `animation-tokens.json` (optional)
|
||||||
- Implement mobile-first responsive design
|
- Reference image (optional, for placeholder content context)
|
||||||
|
|
||||||
**Deliverables**:
|
2. **Build HTML**:
|
||||||
- `{target}-layout-{id}.html`: Style-agnostic HTML structure
|
- Recursively construct from `dom_structure`
|
||||||
- `{target}-layout-{id}.css`: Token-driven structural CSS
|
- Add HTML boilerplate: `<!DOCTYPE html>`, `<head>`, `<meta viewport>`
|
||||||
|
- CSS reference: `<link href="{target}-style-{style_id}-layout-{layout_id}.css">`
|
||||||
|
- Inject placeholder content (Lorem ipsum OR contextually appropriate if reference image available)
|
||||||
|
- Preserve all attributes from dom_structure
|
||||||
|
|
||||||
**⚠️ CRITICAL: CSS Placeholder Links**
|
3. **Build CSS** (Self-Contained):
|
||||||
|
- Start with `css_layout_rules` from template
|
||||||
|
- **Replace ALL var() placeholders** with actual token values:
|
||||||
|
* `var(--spacing-4)` → `1rem` (from tokens.spacing.4)
|
||||||
|
* `var(--breakpoint-md)` → `768px` (from tokens.breakpoints.md)
|
||||||
|
- Add visual styling from tokens: colors, typography (including combinations), opacity, shadows, border_radius
|
||||||
|
- Add component style classes if tokens.component_styles exists
|
||||||
|
- Add animation CSS if animation tokens provided (keyframes, interactions, transitions, prefers-reduced-motion)
|
||||||
|
- Device-optimized for template.device_type
|
||||||
|
|
||||||
When generating HTML templates, you MUST include these EXACT placeholder links in the `<head>` section:
|
4. **Write Files Immediately**:
|
||||||
|
- `{base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.html`
|
||||||
|
- `{base_path}/prototypes/{target}-style-{style_id}-layout-{layout_id}.css`
|
||||||
|
|
||||||
```html
|
**Key Principles**:
|
||||||
<link rel="stylesheet" href="{{STRUCTURAL_CSS}}">
|
- ✅ Pure assembly: Combine existing structure + existing tokens
|
||||||
<link rel="stylesheet" href="{{TOKEN_CSS}}">
|
- ✅ Self-contained CSS: All var() resolved to actual values
|
||||||
```
|
- ❌ NO layout design decisions (structure pre-defined)
|
||||||
|
- ❌ NO style design decisions (tokens pre-defined)
|
||||||
**Placeholder Rules**:
|
- ❌ NO CSS placeholders - use direct CSS file reference
|
||||||
1. Use EXACTLY `{{STRUCTURAL_CSS}}` and `{{TOKEN_CSS}}` with double curly braces
|
- ✅ Low autonomy: follow specifications exactly
|
||||||
2. Place in `<head>` AFTER `<meta>` tags, BEFORE `</head>` closing tag
|
|
||||||
3. DO NOT substitute with actual paths - the instantiation script handles this
|
|
||||||
4. DO NOT add any other CSS `<link>` tags
|
|
||||||
5. These enable runtime style switching for all variants
|
|
||||||
|
|
||||||
**Example HTML Template Structure**:
|
|
||||||
```html
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>{target} - Layout {id}</title>
|
|
||||||
<link rel="stylesheet" href="{{STRUCTURAL_CSS}}">
|
|
||||||
<link rel="stylesheet" href="{{TOKEN_CSS}}">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<!-- Content here -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Quality Gates**: 🎯 ADAPTIVE (multi-device), 🔄 STYLE-SWITCHABLE (runtime theme switching), 🏗️ SEMANTIC (HTML5), ♿ ACCESSIBLE (WCAG AA), 📱 MOBILE-FIRST, 🎨 TOKEN-DRIVEN (zero hardcoded values)
|
|
||||||
|
|
||||||
### 4. Consistency Validation
|
|
||||||
|
|
||||||
**Invoked by**: `generate.md` Phase 3.5
|
|
||||||
**Input**: Multiple target prototypes for same style/layout combination
|
|
||||||
**Task**: Validate cross-target design consistency
|
|
||||||
|
|
||||||
**Deliverables**: Consistency reports, token usage verification, accessibility compliance checks, layout strategy adherence validation
|
|
||||||
|
|
||||||
## Design Standards
|
## Design Standards
|
||||||
|
|
||||||
@@ -276,135 +318,84 @@ h1, h2, h3, h4, h5, h6 {
|
|||||||
|
|
||||||
## Agent Operation
|
## Agent Operation
|
||||||
|
|
||||||
### Execution Process
|
### Execution Flow
|
||||||
|
|
||||||
When invoked by orchestrator command (e.g., `[DESIGN_TOKEN_GENERATION_TASK]`):
|
All tasks follow this standard flow with pattern-specific variations:
|
||||||
|
|
||||||
```
|
```
|
||||||
STEP 1: Parse Task Identifier
|
STEP 1: Identify Task Pattern
|
||||||
→ Identify task type from [TASK_TYPE_IDENTIFIER]
|
→ Parse [TASK_TYPE_IDENTIFIER] from prompt
|
||||||
→ Load task-specific execution template
|
→ Determine pattern: Option Generation | System Generation | Assembly
|
||||||
→ Validate required parameters present
|
→ Load pattern-specific execution rules
|
||||||
|
|
||||||
STEP 2: Load Input Context
|
STEP 2: Load Context
|
||||||
→ Read variant data from orchestrator prompt
|
→ Read input data specified in task prompt
|
||||||
→ Parse proposed_tokens, design_space_analysis
|
→ Validate BASE_PATH and output directory structure
|
||||||
→ Extract MCP research keywords if provided
|
→ Extract parameters: targets, variants_count, device_type, etc.
|
||||||
→ Verify BASE_PATH and output directory structure
|
|
||||||
|
|
||||||
STEP 3: Execute MCP Research (if applicable)
|
STEP 3: Execute Pattern-Specific Generation
|
||||||
FOR each variant:
|
→ Pattern 1 (Option Generation):
|
||||||
→ Build variant-specific queries
|
• Generate {variants_count} contrasting options
|
||||||
→ Execute mcp__exa__web_search_exa() calls
|
• Apply differentiation algorithms
|
||||||
→ Accumulate research results in memory
|
• Create visual/structural previews
|
||||||
→ (DO NOT write research results to files)
|
• Output: Single analysis-options.json
|
||||||
|
|
||||||
STEP 4: Generate Content
|
→ Pattern 2 (System Generation):
|
||||||
FOR each variant:
|
• Execute MCP research if design_space_analysis provided
|
||||||
→ Refine tokens using proposed_tokens + MCP research
|
• Apply design standards (WCAG AA, OKLCH, semantic naming)
|
||||||
→ Generate design-tokens.json content
|
• Generate complete system (tokens/templates/animations)
|
||||||
→ Generate style-guide.md content
|
• Output: JSON + Markdown documentation
|
||||||
→ Keep content in memory (DO NOT accumulate in text)
|
|
||||||
|
|
||||||
STEP 5: WRITE FILES (CRITICAL)
|
→ Pattern 3 (Assembly):
|
||||||
FOR each variant:
|
• Load pre-defined inputs (templates + tokens)
|
||||||
→ EXECUTE: Write("{path}/design-tokens.json", tokens_json)
|
• Combine components without design decisions
|
||||||
→ VERIFY: File exists and size > 1KB
|
• Resolve all var() placeholders to actual values
|
||||||
→ EXECUTE: Write("{path}/style-guide.md", guide_content)
|
• Output: Self-contained HTML + CSS
|
||||||
→ VERIFY: File exists and size > 1KB
|
|
||||||
→ Report completion for this variant
|
|
||||||
→ (DO NOT wait to write all variants at once)
|
|
||||||
|
|
||||||
STEP 6: Final Verification
|
STEP 4: WRITE FILES IMMEDIATELY
|
||||||
→ Verify all {variants_count} × 2 files written
|
→ Use Write() tool for each output file
|
||||||
→ Report total files written with sizes
|
→ Verify file creation (size > 1KB for substantial files)
|
||||||
|
→ Report file path and size
|
||||||
|
→ DO NOT accumulate content - write incrementally
|
||||||
|
|
||||||
|
STEP 5: Final Verification
|
||||||
|
→ Verify all expected files written
|
||||||
|
→ Report completion with file count and sizes
|
||||||
→ Report MCP query count if research performed
|
→ Report MCP query count if research performed
|
||||||
```
|
```
|
||||||
|
|
||||||
**Key Execution Principle**: **WRITE FILES IMMEDIATELY** after generating content for each variant. DO NOT accumulate all content and try to output at the end.
|
**Critical Execution Principles**:
|
||||||
|
- ✅ **Pattern Recognition**: Identify pattern from task identifier first
|
||||||
|
- ✅ **Immediate File Writing**: Write files as soon as content is generated
|
||||||
|
- ✅ **No Content Accumulation**: Never batch all content before writing
|
||||||
|
- ✅ **Incremental Progress**: Process variants/targets one at a time
|
||||||
|
- ❌ **No User Interaction**: Execute autonomously without questions
|
||||||
|
|
||||||
### Invocation Model
|
### Core Execution Principles
|
||||||
|
|
||||||
You are invoked by orchestrator commands to execute specific generation tasks:
|
**Autonomous & Complete**:
|
||||||
|
- Execute task fully without user interaction
|
||||||
**Token Generation** (by `consolidate.md`):
|
- Receive all parameters from task prompt
|
||||||
- Synthesize design tokens from style variants
|
|
||||||
- Generate layout strategies based on MCP research
|
|
||||||
- Produce design-tokens.json, style-guide.md, layout-strategies.json
|
|
||||||
|
|
||||||
**Prototype Generation** (by `generate.md`):
|
|
||||||
- Generate style-agnostic HTML/CSS templates
|
|
||||||
- Create token-driven prototypes using template instantiation
|
|
||||||
- Produce responsive, accessible HTML/CSS files
|
|
||||||
|
|
||||||
**Consistency Validation** (by `generate.md` Phase 3.5):
|
|
||||||
- Validate cross-target design consistency
|
|
||||||
- Generate consistency reports for multi-page workflows
|
|
||||||
|
|
||||||
### Execution Principles
|
|
||||||
|
|
||||||
**Autonomous Operation**:
|
|
||||||
- Receive all parameters from orchestrator command
|
|
||||||
- Execute task without user interaction
|
|
||||||
- Return results through file system outputs
|
- Return results through file system outputs
|
||||||
|
- Generate all required files and documentation
|
||||||
|
|
||||||
**Target Independence** (CRITICAL):
|
**Target Independence** (CRITICAL):
|
||||||
- Each invocation processes EXACTLY ONE target (page or component)
|
- Each task processes EXACTLY ONE target (page or component) at a time
|
||||||
- Do NOT combine multiple targets into a single template
|
- Do NOT combine multiple targets into a single output
|
||||||
- Even if targets will coexist in final application, generate them independently
|
- Even if targets coexist in final application, generate them independently
|
||||||
- **Example Scenario**:
|
- **Example**: Task for "login" page should NOT include "sidebar" (separate target)
|
||||||
- Task: Generate template for "login" (workflow has: ["login", "sidebar"])
|
- **Verification**: Confirm output includes ONLY the specified target
|
||||||
- ❌ WRONG: Generate login page WITH sidebar included
|
|
||||||
- ✅ CORRECT: Generate login page WITHOUT sidebar (sidebar is separate target)
|
|
||||||
- **Verification Before Output**:
|
|
||||||
- Confirm template includes ONLY the specified target
|
|
||||||
- Check no cross-contamination from other targets in workflow
|
|
||||||
- Each target must be standalone and reusable
|
|
||||||
|
|
||||||
**Quality-First**:
|
**Quality-First**:
|
||||||
- Apply all design standards automatically
|
- Apply all design standards automatically (WCAG AA, OKLCH, semantic naming)
|
||||||
- Validate outputs against quality gates before completion
|
- Validate outputs against quality gates before completion
|
||||||
|
- Use MCP research for modern patterns and best practices (Pattern 1 & 2)
|
||||||
- Document any deviations or warnings in output files
|
- Document any deviations or warnings in output files
|
||||||
|
|
||||||
**Research-Informed**:
|
**Pattern-Specific Autonomy Levels**:
|
||||||
- Use MCP tools for trend research and pattern discovery
|
- **Pattern 1** (Option Generation): High autonomy - creative exploration
|
||||||
- Integrate modern best practices into generation decisions
|
- **Pattern 2** (System Generation): Medium autonomy - follow selections + standards
|
||||||
- Cache research results for session reuse
|
- **Pattern 3** (Assembly): Low autonomy - pure combination, no design decisions
|
||||||
|
|
||||||
**Complete Outputs**:
|
|
||||||
- Generate all required files and documentation
|
|
||||||
- Include metadata and implementation notes
|
|
||||||
- Validate file format and completeness
|
|
||||||
|
|
||||||
### Performance Optimization
|
|
||||||
|
|
||||||
**Two-Layer Generation Architecture**:
|
|
||||||
- **Layer 1 (Your Responsibility)**: Generate style-agnostic layout templates (creative work)
|
|
||||||
- HTML structure with semantic markup
|
|
||||||
- Structural CSS with CSS custom property references
|
|
||||||
- One template per layout variant per target
|
|
||||||
- **Layer 2 (Orchestrator Responsibility)**: Instantiate style-specific prototypes
|
|
||||||
- Token conversion (JSON → CSS)
|
|
||||||
- Template instantiation (L×T templates → S×L×T prototypes)
|
|
||||||
- Performance: S× faster than generating all combinations individually
|
|
||||||
|
|
||||||
**Your Focus**: Generate high-quality, reusable templates. Orchestrator handles file operations and instantiation.
|
|
||||||
|
|
||||||
### Scope & Boundaries
|
|
||||||
|
|
||||||
**Your Responsibilities**:
|
|
||||||
- Execute assigned generation task completely
|
|
||||||
- Apply all quality standards automatically
|
|
||||||
- Research when parameters require trend-informed decisions
|
|
||||||
- Validate outputs against quality gates
|
|
||||||
- Generate complete documentation
|
|
||||||
|
|
||||||
**NOT Your Responsibilities**:
|
|
||||||
- User interaction or confirmation
|
|
||||||
- Workflow orchestration or sequencing
|
|
||||||
- Parameter collection or validation
|
|
||||||
- Strategic design decisions (provided by brainstorming phase)
|
|
||||||
- Task scheduling or dependency management
|
|
||||||
|
|
||||||
## Technical Integration
|
## Technical Integration
|
||||||
|
|
||||||
@@ -457,10 +448,10 @@ layout_results = mcp__exa__web_search_exa(
|
|||||||
- **Edit**: Update token definitions, refine layout strategies when files already exist
|
- **Edit**: Update token definitions, refine layout strategies when files already exist
|
||||||
|
|
||||||
**Path Handling**:
|
**Path Handling**:
|
||||||
- Orchestrator provides complete absolute paths in prompts
|
- Task prompts provide complete absolute paths
|
||||||
- Agent uses provided paths exactly as given without modification
|
- Use provided paths exactly as given without modification
|
||||||
- If path contains variables (e.g., `{base_path}`), they will be pre-resolved by orchestrator
|
- Path variables (e.g., `{base_path}`) will be pre-resolved in prompts
|
||||||
- Agent verifies directory structure exists before writing
|
- Verify directory structure exists before writing
|
||||||
- Example: `Write("/absolute/path/to/style-1/design-tokens.json", content)`
|
- Example: `Write("/absolute/path/to/style-1/design-tokens.json", content)`
|
||||||
|
|
||||||
**File Write Verification**:
|
**File Write Verification**:
|
||||||
@@ -543,46 +534,50 @@ layout_results = mcp__exa__web_search_exa(
|
|||||||
|
|
||||||
### ALWAYS:
|
### ALWAYS:
|
||||||
|
|
||||||
**File Writing**:
|
**Pattern Recognition & Execution**:
|
||||||
- ✅ Use Write() tool for EVERY output file - this is your PRIMARY responsibility
|
- ✅ Identify task pattern from [TASK_TYPE_IDENTIFIER] first
|
||||||
- ✅ Write files IMMEDIATELY after generating content for each variant/target
|
- ✅ Apply pattern-specific execution rules (Option Gen | System Gen | Assembly)
|
||||||
- ✅ Verify each Write() operation succeeds before proceeding to next file
|
- ✅ Follow appropriate autonomy level for the pattern
|
||||||
- ✅ Use EXACT paths provided by orchestrator without modification
|
- ✅ Validate outputs against pattern-specific quality gates
|
||||||
- ✅ Report completion with file paths and sizes after each write
|
|
||||||
|
|
||||||
**Task Execution**:
|
**File Writing** (PRIMARY RESPONSIBILITY):
|
||||||
- ✅ Parse task identifier ([DESIGN_TOKEN_GENERATION_TASK], etc.) first
|
- ✅ Use Write() tool for EVERY output file immediately after generation
|
||||||
- ✅ Execute MCP research when design_space_analysis is provided
|
- ✅ Write files incrementally - one variant/target at a time
|
||||||
- ✅ Follow the 6-step execution process sequentially
|
- ✅ Verify each Write() operation succeeds before proceeding
|
||||||
- ✅ Maintain variant independence - research and write separately for each
|
- ✅ Use EXACT paths from task prompt without modification
|
||||||
- ✅ Validate outputs against quality gates (WCAG AA, token completeness, OKLCH format)
|
- ✅ Report completion with file paths and sizes
|
||||||
|
|
||||||
**Quality Standards**:
|
**Quality Standards** (All Patterns):
|
||||||
- ✅ Apply all design standards automatically (WCAG AA, OKLCH, semantic naming)
|
- ✅ Apply design standards automatically (WCAG AA, OKLCH colors, semantic naming)
|
||||||
- ✅ Include Google Fonts imports in CSS with fallback stacks
|
- ✅ Include Google Fonts imports with fallback stacks (Pattern 2 & 3)
|
||||||
- ✅ Generate complete token coverage (colors, typography, spacing, radius, shadows, breakpoints)
|
|
||||||
- ✅ Use mobile-first responsive design with token-based breakpoints
|
- ✅ Use mobile-first responsive design with token-based breakpoints
|
||||||
- ✅ Implement semantic HTML5 with ARIA attributes
|
- ✅ Implement semantic HTML5 with ARIA attributes (Pattern 2 & 3)
|
||||||
|
- ✅ Execute MCP research for modern patterns (Pattern 1 & 2 when applicable)
|
||||||
|
|
||||||
|
**Target Independence**:
|
||||||
|
- ✅ Process EXACTLY ONE target per task
|
||||||
|
- ✅ Keep targets standalone and reusable
|
||||||
|
- ✅ Verify no cross-contamination between targets
|
||||||
|
|
||||||
### NEVER:
|
### NEVER:
|
||||||
|
|
||||||
**File Writing**:
|
**File Writing**:
|
||||||
- ❌ Return file contents as text with labeled sections (e.g., "## File 1: design-tokens.json\n{content}")
|
- ❌ Return file contents as text (e.g., "## File: design-tokens.json\n{content}")
|
||||||
- ❌ Accumulate all variant content and try to output at once
|
- ❌ Accumulate all content before writing (write incrementally)
|
||||||
- ❌ Skip Write() operations and expect orchestrator to write files
|
- ❌ Skip Write() operations expecting external writes
|
||||||
- ❌ Modify provided paths or use relative paths
|
- ❌ Modify provided paths or use relative paths
|
||||||
- ❌ Continue to next variant before completing current variant's file writes
|
- ❌ Continue to next item before completing current item's writes
|
||||||
|
|
||||||
**Task Execution**:
|
**Task Execution**:
|
||||||
- ❌ Mix multiple targets into a single template (respect target independence)
|
- ❌ Mix multiple targets into single output (violates target independence)
|
||||||
- ❌ Skip MCP research when design_space_analysis is provided
|
- ❌ Make design decisions in Pattern 3 (Assembly is pure combination)
|
||||||
- ❌ Generate variant N+1 before variant N's files are written
|
- ❌ Skip pattern identification step
|
||||||
- ❌ Return research results as files (keep in memory for token refinement)
|
- ❌ Interact with user during execution
|
||||||
- ❌ Assume default values without checking orchestrator prompt
|
- ❌ Return MCP research as files (keep in memory for generation)
|
||||||
|
|
||||||
**Quality Violations**:
|
**Quality Violations**:
|
||||||
- ❌ Use hardcoded colors/fonts/spacing instead of tokens
|
- ❌ Use hardcoded values instead of tokens (Pattern 2 & 3)
|
||||||
- ❌ Generate tokens without OKLCH format for colors
|
- ❌ Generate colors without OKLCH format (Pattern 2)
|
||||||
- ❌ Skip WCAG AA contrast validation
|
- ❌ Skip WCAG AA contrast validation (Pattern 2)
|
||||||
- ❌ Omit Google Fonts imports or fallback stacks
|
- ❌ Omit Google Fonts imports or fallback stacks (Pattern 2 & 3)
|
||||||
- ❌ Create incomplete token categories
|
- ❌ Create incomplete token/template systems (Pattern 2)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: plan
|
name: plan
|
||||||
description: 5-phase planning workflow with Gemini analysis and action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution
|
description: 5-phase planning workflow with action-planning-agent task generation, outputs IMPL_PLAN.md and task JSONs with optional CLI auto-execution
|
||||||
argument-hint: "[--agent] [--cli-execute] \"text description\"|file.md"
|
argument-hint: "[--cli-execute] \"text description\"|file.md"
|
||||||
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ This workflow runs **fully autonomously** once triggered. Phase 3 (conflict reso
|
|||||||
2. **Phase 1 executes** → Session discovery → Auto-continues
|
2. **Phase 1 executes** → Session discovery → Auto-continues
|
||||||
3. **Phase 2 executes** → Context gathering → Auto-continues
|
3. **Phase 2 executes** → Context gathering → Auto-continues
|
||||||
4. **Phase 3 executes** (optional, if conflict_risk ≥ medium) → Conflict resolution → Auto-continues
|
4. **Phase 3 executes** (optional, if conflict_risk ≥ medium) → Conflict resolution → Auto-continues
|
||||||
5. **Phase 4 executes** (task-generate-agent if --agent) → Task generation → Reports final summary
|
5. **Phase 4 executes** → Task generation (task-generate-agent) → Reports final summary
|
||||||
|
|
||||||
**Auto-Continue Mechanism**:
|
**Auto-Continue Mechanism**:
|
||||||
- TodoList tracks current phase status
|
- TodoList tracks current phase status
|
||||||
@@ -28,11 +28,6 @@ This workflow runs **fully autonomously** once triggered. Phase 3 (conflict reso
|
|||||||
- All phases run autonomously without user interaction (clarification handled in brainstorm phase)
|
- All phases run autonomously without user interaction (clarification handled in brainstorm phase)
|
||||||
- Progress updates shown at each phase for visibility
|
- Progress updates shown at each phase for visibility
|
||||||
|
|
||||||
**Execution Modes**:
|
|
||||||
- **Manual Mode** (default): Use `/workflow:tools:task-generate`
|
|
||||||
- **Agent Mode** (`--agent`): Use `/workflow:tools:task-generate-agent`
|
|
||||||
- **CLI Execute Mode** (`--cli-execute`): Generate tasks with Codex execution commands
|
|
||||||
|
|
||||||
## Core Rules
|
## Core Rules
|
||||||
|
|
||||||
1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 command execution
|
1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 command execution
|
||||||
@@ -159,24 +154,18 @@ CONTEXT: Existing user database schema, REST API endpoints
|
|||||||
- Task generation translates high-level role analyses into concrete, actionable work items
|
- Task generation translates high-level role analyses into concrete, actionable work items
|
||||||
- **Intent priority**: Current user prompt > role analysis.md files > guidance-specification.md
|
- **Intent priority**: Current user prompt > role analysis.md files > guidance-specification.md
|
||||||
|
|
||||||
**Command Selection**:
|
**Command**:
|
||||||
- Manual: `SlashCommand(command="/workflow:tools:task-generate --session [sessionId]")`
|
|
||||||
- Agent: `SlashCommand(command="/workflow:tools:task-generate-agent --session [sessionId]")`
|
|
||||||
- CLI Execute: Add `--cli-execute` flag to either command
|
|
||||||
|
|
||||||
**Flag Combination**:
|
|
||||||
- `--cli-execute` alone: Manual task generation with CLI execution
|
|
||||||
- `--agent --cli-execute`: Agent task generation with CLI execution
|
|
||||||
|
|
||||||
**Command Examples**:
|
|
||||||
```bash
|
```bash
|
||||||
# Manual with CLI execution
|
# Default (agent mode)
|
||||||
/workflow:tools:task-generate --session WFS-auth --cli-execute
|
SlashCommand(command="/workflow:tools:task-generate-agent --session [sessionId]")
|
||||||
|
|
||||||
# Agent with CLI execution
|
# With CLI execution
|
||||||
/workflow:tools:task-generate-agent --session WFS-auth --cli-execute
|
SlashCommand(command="/workflow:tools:task-generate-agent --session [sessionId] --cli-execute")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Flag**:
|
||||||
|
- `--cli-execute`: Generate tasks with Codex execution commands
|
||||||
|
|
||||||
**Input**: `sessionId` from Phase 1
|
**Input**: `sessionId` from Phase 1
|
||||||
|
|
||||||
**Validation**:
|
**Validation**:
|
||||||
@@ -296,7 +285,7 @@ Phase 3: conflict-resolution [AUTO-TRIGGERED if conflict_risk ≥ medium]
|
|||||||
↓ Output: Modified brainstorm artifacts (NO report file)
|
↓ Output: Modified brainstorm artifacts (NO report file)
|
||||||
↓ Skip if conflict_risk is none/low → proceed directly to Phase 4
|
↓ Skip if conflict_risk is none/low → proceed directly to Phase 4
|
||||||
↓
|
↓
|
||||||
Phase 4: task-generate[--agent] --session sessionId
|
Phase 4: task-generate-agent --session sessionId [--cli-execute]
|
||||||
↓ Input: sessionId + resolved brainstorm artifacts + session memory
|
↓ Input: sessionId + resolved brainstorm artifacts + session memory
|
||||||
↓ Output: IMPL_PLAN.md, task JSONs, TODO_LIST.md
|
↓ Output: IMPL_PLAN.md, task JSONs, TODO_LIST.md
|
||||||
↓
|
↓
|
||||||
@@ -333,9 +322,8 @@ Return summary to user
|
|||||||
- **If conflict_risk ≥ medium**: Launch Phase 3 conflict-resolution with sessionId and contextPath
|
- **If conflict_risk ≥ medium**: Launch Phase 3 conflict-resolution with sessionId and contextPath
|
||||||
- Wait for Phase 3 completion (if executed), verify CONFLICT_RESOLUTION.md created
|
- Wait for Phase 3 completion (if executed), verify CONFLICT_RESOLUTION.md created
|
||||||
- **If conflict_risk is none/low**: Skip Phase 3, proceed directly to Phase 4
|
- **If conflict_risk is none/low**: Skip Phase 3, proceed directly to Phase 4
|
||||||
- **Build Phase 4 command** based on flags:
|
- **Build Phase 4 command**:
|
||||||
- Base command: `/workflow:tools:task-generate` (or `-agent` if `--agent` flag)
|
- Base command: `/workflow:tools:task-generate-agent --session [sessionId]`
|
||||||
- Add `--session [sessionId]`
|
|
||||||
- Add `--cli-execute` if flag present
|
- Add `--cli-execute` if flag present
|
||||||
- Pass session ID to Phase 4 command
|
- Pass session ID to Phase 4 command
|
||||||
- Verify all Phase 4 outputs
|
- Verify all Phase 4 outputs
|
||||||
@@ -380,8 +368,7 @@ CONSTRAINTS: [Limitations or boundaries]
|
|||||||
- `/workflow:tools:context-gather` - Phase 2: Gather project context and analyze codebase
|
- `/workflow:tools:context-gather` - Phase 2: Gather project context and analyze codebase
|
||||||
- `/workflow:tools:conflict-resolution` - Phase 3: Detect and resolve conflicts (auto-triggered if conflict_risk ≥ medium)
|
- `/workflow:tools:conflict-resolution` - Phase 3: Detect and resolve conflicts (auto-triggered if conflict_risk ≥ medium)
|
||||||
- `/compact` - Phase 3: Memory optimization (if context approaching limits)
|
- `/compact` - Phase 3: Memory optimization (if context approaching limits)
|
||||||
- `/workflow:tools:task-generate` - Phase 4: Generate task JSON files with manual approach
|
- `/workflow:tools:task-generate-agent` - Phase 4: Generate task JSON files with agent-driven approach
|
||||||
- `/workflow:tools:task-generate-agent` - Phase 4: Generate task JSON files with agent-driven approach (when `--agent` flag used)
|
|
||||||
|
|
||||||
**Follow-up Commands**:
|
**Follow-up Commands**:
|
||||||
- `/workflow:action-plan-verify` - Recommended: Verify plan quality and catch issues before execution
|
- `/workflow:action-plan-verify` - Recommended: Verify plan quality and catch issues before execution
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: tdd-plan
|
name: tdd-plan
|
||||||
description: TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking
|
description: TDD workflow planning with Red-Green-Refactor task chain generation, test-first development structure, and cycle tracking
|
||||||
argument-hint: "[--agent] \"feature description\"|file.md"
|
argument-hint: "[--cli-execute] \"feature description\"|file.md"
|
||||||
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -12,8 +12,8 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Bash(*)
|
|||||||
**This command is a pure orchestrator**: Execute 5 slash commands in sequence, parse outputs, pass context, and ensure complete TDD workflow creation.
|
**This command is a pure orchestrator**: Execute 5 slash commands in sequence, parse outputs, pass context, and ensure complete TDD workflow creation.
|
||||||
|
|
||||||
**Execution Modes**:
|
**Execution Modes**:
|
||||||
- **Manual Mode** (default): Use `/workflow:tools:task-generate-tdd`
|
- **Agent Mode** (default): Use `/workflow:tools:task-generate-tdd` (autonomous agent-driven)
|
||||||
- **Agent Mode** (`--agent`): Use `/workflow:tools:task-generate-tdd --agent`
|
- **CLI Mode** (`--cli-execute`): Use `/workflow:tools:task-generate-tdd --cli-execute` (Gemini/Qwen)
|
||||||
|
|
||||||
## Core Rules
|
## Core Rules
|
||||||
|
|
||||||
@@ -129,8 +129,8 @@ TEST_FOCUS: [Test scenarios]
|
|||||||
|
|
||||||
### Phase 5: TDD Task Generation
|
### Phase 5: TDD Task Generation
|
||||||
**Command**:
|
**Command**:
|
||||||
- Manual: `/workflow:tools:task-generate-tdd --session [sessionId]`
|
- Agent Mode (default): `/workflow:tools:task-generate-tdd --session [sessionId]`
|
||||||
- Agent: `/workflow:tools:task-generate-tdd --session [sessionId] --agent`
|
- CLI Mode (`--cli-execute`): `/workflow:tools:task-generate-tdd --session [sessionId] --cli-execute`
|
||||||
|
|
||||||
**Parse**: Extract feature count, task count (not chain count - tasks now contain internal TDD cycles)
|
**Parse**: Extract feature count, task count (not chain count - tasks now contain internal TDD cycles)
|
||||||
|
|
||||||
@@ -373,8 +373,8 @@ Supports action-planning-agent for more autonomous TDD planning with:
|
|||||||
- `/workflow:tools:test-context-gather` - Phase 3: Analyze existing test patterns and coverage
|
- `/workflow:tools:test-context-gather` - Phase 3: Analyze existing test patterns and coverage
|
||||||
- `/workflow:tools:conflict-resolution` - Phase 4: Detect and resolve conflicts (auto-triggered if conflict_risk ≥ medium)
|
- `/workflow:tools:conflict-resolution` - Phase 4: Detect and resolve conflicts (auto-triggered if conflict_risk ≥ medium)
|
||||||
- `/compact` - Phase 4: Memory optimization (if context approaching limits)
|
- `/compact` - Phase 4: Memory optimization (if context approaching limits)
|
||||||
- `/workflow:tools:task-generate-tdd` - Phase 5: Generate TDD task chains with Red-Green-Refactor cycles
|
- `/workflow:tools:task-generate-tdd` - Phase 5: Generate TDD tasks with agent-driven approach (default, autonomous)
|
||||||
- `/workflow:tools:task-generate-tdd --agent` - Phase 5: Generate TDD tasks with agent-driven approach (when `--agent` flag used)
|
- `/workflow:tools:task-generate-tdd --cli-execute` - Phase 5: Generate TDD tasks with CLI tools (Gemini/Qwen, when `--cli-execute` flag used)
|
||||||
|
|
||||||
**Follow-up Commands**:
|
**Follow-up Commands**:
|
||||||
- `/workflow:action-plan-verify` - Recommended: Verify TDD plan quality and structure before execution
|
- `/workflow:action-plan-verify` - Recommended: Verify TDD plan quality and structure before execution
|
||||||
|
|||||||
@@ -473,9 +473,9 @@ WFS-test-[session]/
|
|||||||
- `/workflow:tools:test-context-gather` - Phase 2 (Session Mode): Gather source session context
|
- `/workflow:tools:test-context-gather` - Phase 2 (Session Mode): Gather source session context
|
||||||
- `/workflow:tools:context-gather` - Phase 2 (Prompt Mode): Analyze codebase directly
|
- `/workflow:tools:context-gather` - Phase 2 (Prompt Mode): Analyze codebase directly
|
||||||
- `/workflow:tools:test-concept-enhanced` - Phase 3: Generate test requirements using Gemini
|
- `/workflow:tools:test-concept-enhanced` - Phase 3: Generate test requirements using Gemini
|
||||||
- `/workflow:tools:test-task-generate` - Phase 4: Generate test task JSONs with fix cycle specification
|
- `/workflow:tools:test-task-generate` - Phase 4: Generate test task JSONs using action-planning-agent (autonomous, default)
|
||||||
- `/workflow:tools:test-task-generate --use-codex` - Phase 4: With automated Codex fixes (when `--use-codex` flag used)
|
- `/workflow:tools:test-task-generate --use-codex` - Phase 4: With automated Codex fixes for IMPL-002 (when `--use-codex` flag used)
|
||||||
- `/workflow:tools:test-task-generate --cli-execute` - Phase 4: With CLI execution mode (when `--cli-execute` flag used)
|
- `/workflow:tools:test-task-generate --cli-execute` - Phase 4: With CLI execution mode for IMPL-001 test generation (when `--cli-execute` flag used)
|
||||||
|
|
||||||
**Follow-up Commands**:
|
**Follow-up Commands**:
|
||||||
- `/workflow:status` - Review generated test tasks
|
- `/workflow:status` - Review generated test tasks
|
||||||
|
|||||||
@@ -337,9 +337,9 @@ See `/workflow:tools:test-task-generate` for complete JSON schemas.
|
|||||||
- `/workflow:session:start` - Phase 1: Create independent test workflow session
|
- `/workflow:session:start` - Phase 1: Create independent test workflow session
|
||||||
- `/workflow:tools:test-context-gather` - Phase 2: Analyze test coverage and gather source session context
|
- `/workflow:tools:test-context-gather` - Phase 2: Analyze test coverage and gather source session context
|
||||||
- `/workflow:tools:test-concept-enhanced` - Phase 3: Generate test requirements and strategy using Gemini
|
- `/workflow:tools:test-concept-enhanced` - Phase 3: Generate test requirements and strategy using Gemini
|
||||||
- `/workflow:tools:test-task-generate` - Phase 4: Generate test generation and execution task JSONs
|
- `/workflow:tools:test-task-generate` - Phase 4: Generate test task JSONs using action-planning-agent (autonomous, default)
|
||||||
- `/workflow:tools:test-task-generate --use-codex` - Phase 4: With automated Codex fixes (when `--use-codex` flag used)
|
- `/workflow:tools:test-task-generate --use-codex` - Phase 4: With automated Codex fixes for IMPL-002 (when `--use-codex` flag used)
|
||||||
- `/workflow:tools:test-task-generate --cli-execute` - Phase 4: With CLI execution mode (when `--cli-execute` flag used)
|
- `/workflow:tools:test-task-generate --cli-execute` - Phase 4: With CLI execution mode for IMPL-001 test generation (when `--cli-execute` flag used)
|
||||||
|
|
||||||
**Follow-up Commands**:
|
**Follow-up Commands**:
|
||||||
- `/workflow:status` - Review generated test tasks
|
- `/workflow:status` - Review generated test tasks
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ Analyzes conflicts between implementation plans and existing codebase, generatin
|
|||||||
| **Generate Strategies** | Provide 2-4 resolution options per conflict |
|
| **Generate Strategies** | Provide 2-4 resolution options per conflict |
|
||||||
| **CLI Analysis** | Use Gemini/Qwen (Claude fallback) |
|
| **CLI Analysis** | Use Gemini/Qwen (Claude fallback) |
|
||||||
| **User Decision** | Present options, never auto-apply |
|
| **User Decision** | Present options, never auto-apply |
|
||||||
|
| **Direct Text Output** | Output questions via text directly, NEVER use bash echo/printf |
|
||||||
| **Single Output** | `CONFLICT_RESOLUTION.md` with findings |
|
| **Single Output** | `CONFLICT_RESOLUTION.md` with findings |
|
||||||
|
|
||||||
## Conflict Categories
|
## Conflict Categories
|
||||||
@@ -462,10 +463,3 @@ If Edit tool fails mid-application:
|
|||||||
✓ Error handling robust (validate/retry/degrade)
|
✓ Error handling robust (validate/retry/degrade)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Related Commands
|
|
||||||
| Command | Relationship |
|
|
||||||
|---------|--------------|
|
|
||||||
| `/workflow:tools:context-gather` | Generates input conflict_detection data |
|
|
||||||
| `/workflow:plan` | Auto-triggers this when risk ≥ medium |
|
|
||||||
| `/workflow:tools:task-generate` | Uses resolved conflicts from updated brainstorm files |
|
|
||||||
| `/workflow:brainstorm:artifacts` | Generates guidance-specification.md (modified by this command) |
|
|
||||||
|
|||||||
@@ -163,155 +163,50 @@ If conflict_risk was medium/high, modifications have been applied to:
|
|||||||
|
|
||||||
## Phase 2: Document Generation Task
|
## Phase 2: Document Generation Task
|
||||||
|
|
||||||
### Task Decomposition Standards
|
**Agent Configuration Reference**: All task generation rules, quantification requirements, quality standards, and execution details are defined in action-planning-agent.
|
||||||
**Core Principle**: Task Merging Over Decomposition
|
|
||||||
- **Merge Rule**: Execute together when possible
|
|
||||||
- **Decompose Only When**:
|
|
||||||
- Excessive workload (>2500 lines or >6 files)
|
|
||||||
- Different tech stacks or domains
|
|
||||||
- Sequential dependency blocking
|
|
||||||
- Parallel execution needed
|
|
||||||
|
|
||||||
**Task Limits**:
|
Refer to: @.claude/agents/action-planning-agent.md for:
|
||||||
- **Maximum 10 tasks** (hard limit)
|
- Task Decomposition Standards
|
||||||
- **Function-based**: Complete units (logic + UI + tests + config)
|
- Quantification Requirements (MANDATORY)
|
||||||
- **Hierarchy**: Flat (≤5) | Two-level (6-10) | Re-scope (>10)
|
- 5-Field Task JSON Schema
|
||||||
|
- IMPL_PLAN.md Structure
|
||||||
|
- TODO_LIST.md Format
|
||||||
|
- Execution Flow & Quality Validation
|
||||||
|
|
||||||
### Required Outputs
|
### Required Outputs Summary
|
||||||
|
|
||||||
#### 1. Task JSON Files (.task/IMPL-*.json)
|
#### 1. Task JSON Files (.task/IMPL-*.json)
|
||||||
**Location**: .workflow/{session-id}/.task/
|
- **Location**: `.workflow/{session-id}/.task/`
|
||||||
**Template**: Read from the template path provided above
|
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
|
||||||
|
- **Schema**: 5-field structure (id, title, status, meta, context, flow_control) with artifacts integration
|
||||||
**Task JSON Template Loading**:
|
- **Details**: See action-planning-agent.md § Task JSON Generation
|
||||||
\`\`\`
|
|
||||||
Read({template_path})
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
**Important**:
|
|
||||||
- Read the template from the path provided in context
|
|
||||||
- Use the template structure exactly as written
|
|
||||||
- Replace placeholder variables ({synthesis_spec_path}, {role_analysis_path}, etc.) with actual session-specific paths
|
|
||||||
- Include MCP tool integration in pre_analysis steps
|
|
||||||
- Map artifacts based on task domain (UI → ui-designer, Backend → system-architect)
|
|
||||||
|
|
||||||
#### 2. IMPL_PLAN.md
|
#### 2. IMPL_PLAN.md
|
||||||
**Location**: .workflow/{session-id}/IMPL_PLAN.md
|
- **Location**: `.workflow/{session-id}/IMPL_PLAN.md`
|
||||||
|
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
|
||||||
**IMPL_PLAN Template**:
|
- **Details**: See action-planning-agent.md § Implementation Plan Creation
|
||||||
\`\`\`
|
|
||||||
$(cat ~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt)
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
**Important**:
|
|
||||||
- Use the template above for IMPL_PLAN.md generation
|
|
||||||
- Replace all {placeholder} variables with actual session-specific values
|
|
||||||
- Populate CCW Workflow Context based on actual phase progression
|
|
||||||
- Extract content from role analyses and context-package.json
|
|
||||||
- List all detected brainstorming artifacts with correct paths (role analyses, guidance-specification.md)
|
|
||||||
- Include conflict resolution status if CONFLICT_RESOLUTION.md exists
|
|
||||||
|
|
||||||
#### 3. TODO_LIST.md
|
#### 3. TODO_LIST.md
|
||||||
**Location**: .workflow/{session-id}/TODO_LIST.md
|
- **Location**: `.workflow/{session-id}/TODO_LIST.md`
|
||||||
**Structure**:
|
- **Format**: Hierarchical task list with status indicators (▸, [ ], [x]) and JSON links
|
||||||
\`\`\`markdown
|
- **Details**: See action-planning-agent.md § TODO List Generation
|
||||||
# Tasks: {Session Topic}
|
|
||||||
|
|
||||||
## Task Progress
|
### Agent Execution Summary
|
||||||
▸ **IMPL-001**: [Main Task Group] → [📋](./.task/IMPL-001.json)
|
|
||||||
- [ ] **IMPL-001.1**: [Subtask] → [📋](./.task/IMPL-001.1.json)
|
|
||||||
- [ ] **IMPL-001.2**: [Subtask] → [📋](./.task/IMPL-001.2.json)
|
|
||||||
|
|
||||||
- [ ] **IMPL-002**: [Simple Task] → [📋](./.task/IMPL-002.json)
|
**Key Steps** (Detailed instructions in action-planning-agent.md):
|
||||||
|
1. Load task JSON template from provided path
|
||||||
|
2. Extract and decompose tasks with quantification
|
||||||
|
3. Generate task JSON files enforcing quantification requirements
|
||||||
|
4. Create IMPL_PLAN.md using template
|
||||||
|
5. Generate TODO_LIST.md matching task JSONs
|
||||||
|
6. Update session state
|
||||||
|
|
||||||
## Status Legend
|
**Quality Gates** (Full checklist in action-planning-agent.md):
|
||||||
- \`▸\` = Container task (has subtasks)
|
- ✓ Quantification requirements enforced (explicit counts, measurable acceptance, exact targets)
|
||||||
- \`- [ ]\` = Pending leaf task
|
- ✓ Task count ≤10 (hard limit)
|
||||||
- \`- [x]\` = Completed leaf task
|
- ✓ Artifact references mapped correctly
|
||||||
\`\`\`
|
- ✓ MCP tool integration added
|
||||||
|
- ✓ Documents follow template structure
|
||||||
### Execution Instructions for Agent
|
|
||||||
|
|
||||||
**Agent Task**: Generate task JSON files, IMPL_PLAN.md, and TODO_LIST.md based on analysis results
|
|
||||||
|
|
||||||
**Note**: The correct task JSON template path has been pre-selected by the command based on the `--cli-execute` flag and is provided in the context as `{template_path}`.
|
|
||||||
|
|
||||||
**Step 1: Load Task JSON Template**
|
|
||||||
- Read template from the provided path: `Read({template_path})`
|
|
||||||
- This template is already the correct one based on execution mode
|
|
||||||
|
|
||||||
**Step 2: Extract and Decompose Tasks**
|
|
||||||
- Parse role analysis.md files for requirements, design specs, and task recommendations
|
|
||||||
- Review synthesis enhancements and clarifications in role analyses
|
|
||||||
- Apply conflict resolution strategies (if CONFLICT_RESOLUTION.md exists)
|
|
||||||
- Apply task merging rules (merge when possible, decompose only when necessary)
|
|
||||||
- Map artifacts to tasks based on domain (UI → ui-designer, Backend → system-architect, Data → data-architect)
|
|
||||||
- Ensure task count ≤10
|
|
||||||
|
|
||||||
**Step 3: Generate Task JSON Files**
|
|
||||||
- Use the template structure from Step 1
|
|
||||||
- Create .task/IMPL-*.json files with proper structure
|
|
||||||
- Replace all {placeholder} variables with actual session paths
|
|
||||||
- Embed artifacts array with brainstorming outputs
|
|
||||||
- Include MCP tool integration in pre_analysis steps
|
|
||||||
|
|
||||||
**Step 4: Create IMPL_PLAN.md**
|
|
||||||
- Use IMPL_PLAN template
|
|
||||||
- Populate all sections with session-specific content
|
|
||||||
- List artifacts with priorities and usage guidelines
|
|
||||||
- Document execution strategy and dependencies
|
|
||||||
|
|
||||||
**Step 5: Generate TODO_LIST.md**
|
|
||||||
- Create task progress checklist matching generated JSONs
|
|
||||||
- Use proper status indicators (▸, [ ], [x])
|
|
||||||
- Link to task JSON files
|
|
||||||
|
|
||||||
**Step 6: Update Session State**
|
|
||||||
- Update workflow-session.json with task count and artifact inventory
|
|
||||||
- Mark session ready for execution
|
|
||||||
|
|
||||||
### MCP Enhancement Examples
|
|
||||||
|
|
||||||
**Code Index Usage**:
|
|
||||||
\`\`\`javascript
|
|
||||||
// Discover authentication-related files
|
|
||||||
bash(find . -name "*auth*" -type f)
|
|
||||||
|
|
||||||
// Search for OAuth patterns
|
|
||||||
bash(rg "oauth|jwt|authentication" -g "*.{ts,js}")
|
|
||||||
|
|
||||||
// Get file summary for key components
|
|
||||||
bash(rg "^(class|function|export|interface)" src/auth/index.ts)
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
**Exa Research Usage**:
|
|
||||||
\`\`\`javascript
|
|
||||||
// Get best practices for task implementation
|
|
||||||
mcp__exa__get_code_context_exa(
|
|
||||||
query="TypeScript OAuth2 implementation patterns",
|
|
||||||
tokensNum="dynamic"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Research specific API usage
|
|
||||||
mcp__exa__get_code_context_exa(
|
|
||||||
query="Express.js JWT middleware examples",
|
|
||||||
tokensNum=5000
|
|
||||||
)
|
|
||||||
\`\`\`
|
|
||||||
|
|
||||||
### Quality Validation
|
|
||||||
|
|
||||||
Before completion, verify:
|
|
||||||
- [ ] All task JSON files created in .task/ directory
|
|
||||||
- [ ] Each task JSON has 5 required fields
|
|
||||||
- [ ] Artifact references correctly mapped
|
|
||||||
- [ ] Flow control includes artifact loading steps
|
|
||||||
- [ ] MCP tool integration added where appropriate
|
|
||||||
- [ ] IMPL_PLAN.md follows required structure
|
|
||||||
- [ ] TODO_LIST.md matches task JSONs
|
|
||||||
- [ ] Dependency graph is acyclic
|
|
||||||
- [ ] Task count within limits (≤10)
|
|
||||||
- [ ] Session state updated
|
|
||||||
|
|
||||||
## Output
|
## Output
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,28 @@
|
|||||||
---
|
---
|
||||||
name: task-generate-tdd
|
name: task-generate-tdd
|
||||||
description: Generate TDD task chains with Red-Green-Refactor dependencies, test-first structure, and cycle validation
|
description: Autonomous TDD task generation using action-planning-agent with Red-Green-Refactor cycles, test-first structure, and cycle validation
|
||||||
argument-hint: "--session WFS-session-id [--agent]"
|
argument-hint: "--session WFS-session-id [--cli-execute]"
|
||||||
allowed-tools: Read(*), Write(*), Bash(gemini:*), TodoWrite(*)
|
examples:
|
||||||
|
- /workflow:tools:task-generate-tdd --session WFS-auth
|
||||||
|
- /workflow:tools:task-generate-tdd --session WFS-auth --cli-execute
|
||||||
---
|
---
|
||||||
|
|
||||||
# TDD Task Generation Command
|
# Autonomous TDD Task Generation Command
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
Generate TDD-specific tasks from analysis results with complete Red-Green-Refactor cycles contained within each task.
|
Autonomous TDD task JSON and IMPL_PLAN.md generation using action-planning-agent with two-phase execution: discovery and document generation. Supports both agent-driven execution (default) and CLI tool execution modes. Generates complete Red-Green-Refactor cycles contained within each task.
|
||||||
|
|
||||||
|
## Core Philosophy
|
||||||
|
- **Agent-Driven**: Delegate execution to action-planning-agent for autonomous operation
|
||||||
|
- **Two-Phase Flow**: Discovery (context gathering) → Output (document generation)
|
||||||
|
- **Memory-First**: Reuse loaded documents from conversation memory
|
||||||
|
- **MCP-Enhanced**: Use MCP tools for advanced code analysis and research
|
||||||
|
- **Pre-Selected Templates**: Command selects correct TDD template based on `--cli-execute` flag **before** invoking agent
|
||||||
|
- **Agent Simplicity**: Agent receives pre-selected template and focuses only on content generation
|
||||||
|
- **Path Clarity**: All `focus_paths` prefer absolute paths (e.g., `D:\\project\\src\\module`), or clear relative paths from project root (e.g., `./src/module`)
|
||||||
|
- **TDD-First**: Every feature starts with a failing test (Red phase)
|
||||||
|
- **Feature-Complete Tasks**: Each task contains complete Red-Green-Refactor cycle
|
||||||
|
- **Quantification-Enforced**: All test cases, coverage requirements, and implementation scope MUST include explicit counts and enumerations
|
||||||
|
|
||||||
## Task Strategy & Philosophy
|
## Task Strategy & Philosophy
|
||||||
|
|
||||||
@@ -44,359 +58,329 @@ Generate TDD-specific tasks from analysis results with complete Red-Green-Refact
|
|||||||
- **Current approach**: 1 feature = 1 task (IMPL-N with internal Red-Green-Refactor phases)
|
- **Current approach**: 1 feature = 1 task (IMPL-N with internal Red-Green-Refactor phases)
|
||||||
- **Complex features**: 1 container (IMPL-N) + subtasks (IMPL-N.M) when necessary
|
- **Complex features**: 1 container (IMPL-N) + subtasks (IMPL-N.M) when necessary
|
||||||
|
|
||||||
### Core Principles
|
|
||||||
- **TDD-First**: Every feature starts with a failing test (Red phase)
|
|
||||||
- **Feature-Complete Tasks**: Each task contains complete Red-Green-Refactor cycle
|
|
||||||
- **Phase-Explicit**: Internal phases clearly marked in flow_control.implementation_approach
|
|
||||||
- **Task Merging**: Prefer single task per feature over decomposition
|
|
||||||
- **Path Clarity**: All `focus_paths` prefer absolute paths (e.g., `D:\\project\\src\\module`), or clear relative paths from project root (e.g., `./src/module`)
|
|
||||||
- **Artifact-Aware**: Integrates brainstorming outputs
|
|
||||||
- **Memory-First**: Reuse loaded documents from memory
|
|
||||||
- **Context-Aware**: Analyzes existing codebase and test patterns
|
|
||||||
- **Iterative Green Phase**: Auto-diagnose and fix test failures with Gemini + optional Codex
|
|
||||||
- **Safety-First**: Auto-revert on max iterations to prevent broken state
|
|
||||||
|
|
||||||
## Core Responsibilities
|
|
||||||
- Parse analysis results and identify testable features
|
|
||||||
- Generate feature-complete tasks with internal TDD cycles (1 task per simple feature)
|
|
||||||
- Apply task merging strategy by default, create subtasks only when complexity requires
|
|
||||||
- Generate IMPL_PLAN.md with TDD Implementation Tasks section
|
|
||||||
- Generate TODO_LIST.md with internal TDD phase indicators
|
|
||||||
- Update session state for TDD execution with task count compliance
|
|
||||||
|
|
||||||
## Execution Lifecycle
|
## Execution Lifecycle
|
||||||
|
|
||||||
### Phase 1: Input Validation & Discovery
|
### Phase 1: Discovery & Context Loading
|
||||||
**Memory-First Rule**: Skip file loading if documents already in conversation memory
|
**⚡ Memory-First Rule**: Skip file loading if documents already in conversation memory
|
||||||
|
|
||||||
1. **Session Validation**
|
**Agent Context Package**:
|
||||||
- If session metadata in memory → Skip loading
|
```javascript
|
||||||
- Else: Load `.workflow/{session_id}/workflow-session.json`
|
|
||||||
|
|
||||||
2. **Conflict Resolution Check** (NEW - Priority Input)
|
|
||||||
- If CONFLICT_RESOLUTION.md exists → Load selected strategies
|
|
||||||
- Else: Skip to brainstorming artifacts
|
|
||||||
- Path: `.workflow/{session_id}/.process/CONFLICT_RESOLUTION.md`
|
|
||||||
|
|
||||||
3. **Artifact Discovery**
|
|
||||||
- If artifact inventory in memory → Skip scanning
|
|
||||||
- Else: Scan `.workflow/{session_id}/.brainstorming/` directory
|
|
||||||
- Detect: role analysis documents, guidance-specification.md, role analyses
|
|
||||||
|
|
||||||
4. **Context Package Loading**
|
|
||||||
- Load `.workflow/{session_id}/.process/context-package.json`
|
|
||||||
- Load `.workflow/{session_id}/.process/test-context-package.json` (if exists)
|
|
||||||
|
|
||||||
### Phase 2: TDD Task JSON Generation
|
|
||||||
|
|
||||||
**Input Sources** (priority order):
|
|
||||||
1. **Conflict Resolution** (if exists): `.process/CONFLICT_RESOLUTION.md` - Selected resolution strategies
|
|
||||||
2. **Brainstorming Artifacts**: Role analysis documents (system-architect, product-owner, etc.)
|
|
||||||
3. **Context Package**: `.process/context-package.json` - Project structure and requirements
|
|
||||||
4. **Test Context**: `.process/test-context-package.json` - Existing test patterns
|
|
||||||
|
|
||||||
**TDD Task Structure includes**:
|
|
||||||
- Feature list with testable requirements
|
|
||||||
- Test cases for Red phase
|
|
||||||
- Implementation requirements for Green phase (with test-fix cycle)
|
|
||||||
- Refactoring opportunities
|
|
||||||
- Task dependencies and execution order
|
|
||||||
- Conflict resolution decisions (if applicable)
|
|
||||||
|
|
||||||
### Phase 3: Task JSON & IMPL_PLAN.md Generation
|
|
||||||
|
|
||||||
#### Task Structure (Feature-Complete with Internal TDD)
|
|
||||||
For each feature, generate task(s) with ID format:
|
|
||||||
- **IMPL-N** - Single task containing complete TDD cycle (Red-Green-Refactor)
|
|
||||||
- **IMPL-N.M** - Sub-tasks only when feature is complex (>2500 lines or technical blocking)
|
|
||||||
|
|
||||||
**Task Dependency Rules**:
|
|
||||||
- **Sequential features**: IMPL-2 depends_on ["IMPL-1"] if Feature 2 needs Feature 1
|
|
||||||
- **Independent features**: No dependencies, can execute in parallel
|
|
||||||
- **Complex features**: IMPL-N.2 depends_on ["IMPL-N.1"] for subtask ordering
|
|
||||||
|
|
||||||
**Agent Assignment**:
|
|
||||||
- **All IMPL tasks** → `@code-developer` (handles full TDD cycle)
|
|
||||||
- Agent executes Red, Green, Refactor phases sequentially within task
|
|
||||||
|
|
||||||
**Meta Fields**:
|
|
||||||
- `meta.type`: "feature" (TDD-driven feature implementation)
|
|
||||||
- `meta.agent`: "@code-developer"
|
|
||||||
- `meta.tdd_workflow`: true (enables TDD-specific flow)
|
|
||||||
- `meta.tdd_phase`: Not used (phases are in flow_control.implementation_approach)
|
|
||||||
- `meta.max_iterations`: 3 (for Green phase test-fix cycle)
|
|
||||||
- `meta.use_codex`: false (manual fixes by default)
|
|
||||||
|
|
||||||
#### Task JSON Structure Reference
|
|
||||||
|
|
||||||
**Simple Feature Task (IMPL-N.json)** - Recommended for most features:
|
|
||||||
```json
|
|
||||||
{
|
{
|
||||||
"id": "IMPL-N", // Task identifier
|
"session_id": "WFS-[session-id]",
|
||||||
"title": "Feature description with TDD", // Human-readable title
|
"execution_mode": "agent-mode" | "cli-execute-mode", // Determined by flag
|
||||||
"status": "pending", // pending | in_progress | completed | container
|
"task_json_template_path": "~/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt"
|
||||||
"context_package_path": ".workflow/{session-id}/.process/context-package.json", // Path to smart context package
|
| "~/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt",
|
||||||
"meta": {
|
// Path selected by command based on --cli-execute flag, agent reads it
|
||||||
"type": "feature", // Task type
|
"workflow_type": "tdd",
|
||||||
"agent": "@code-developer", // Assigned agent
|
"session_metadata": {
|
||||||
"tdd_workflow": true, // REQUIRED: Enables TDD flow
|
// If in memory: use cached content
|
||||||
"max_iterations": 3, // Green phase test-fix cycle limit
|
// Else: Load from .workflow/{session-id}/workflow-session.json
|
||||||
"use_codex": false // false=manual fixes, true=Codex automated fixes
|
|
||||||
},
|
},
|
||||||
"context": {
|
"brainstorm_artifacts": {
|
||||||
"requirements": [ // Feature requirements with TDD phases
|
// Loaded from context-package.json → brainstorm_artifacts section
|
||||||
"Feature description",
|
"role_analyses": [
|
||||||
"Red: Test scenarios to write",
|
|
||||||
"Green: Implementation approach with test-fix cycle",
|
|
||||||
"Refactor: Code quality improvements"
|
|
||||||
],
|
|
||||||
"tdd_cycles": [ // OPTIONAL: Detailed test cycles
|
|
||||||
{
|
{
|
||||||
"cycle": 1,
|
"role": "system-architect",
|
||||||
"feature": "Specific functionality",
|
"files": [{"path": "...", "type": "primary|supplementary"}]
|
||||||
"test_focus": "What to test",
|
|
||||||
"expected_failure": "Why test should fail initially"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"focus_paths": ["D:\\project\\src\\path", "./tests/path"], // Absolute or clear relative paths from project root
|
"guidance_specification": {"path": "...", "exists": true},
|
||||||
"acceptance": [ // Success criteria
|
"synthesis_output": {"path": "...", "exists": true},
|
||||||
"All tests pass (Red → Green)",
|
"conflict_resolution": {"path": "...", "exists": true} // if conflict_risk >= medium
|
||||||
"Code refactored (Refactor complete)",
|
|
||||||
"Test coverage ≥80%"
|
|
||||||
],
|
|
||||||
"depends_on": [] // Task dependencies
|
|
||||||
},
|
},
|
||||||
"flow_control": {
|
"context_package_path": ".workflow/{session-id}/.process/context-package.json",
|
||||||
"pre_analysis": [ // OPTIONAL: Pre-execution checks
|
"context_package": {
|
||||||
{
|
// If in memory: use cached content
|
||||||
"step": "check_test_framework",
|
// Else: Load from .workflow/{session-id}/.process/context-package.json
|
||||||
"action": "Verify test framework",
|
},
|
||||||
"command": "bash(npm list jest)",
|
"test_context_package_path": ".workflow/{session-id}/.process/test-context-package.json",
|
||||||
"output_to": "test_framework_info",
|
"test_context_package": {
|
||||||
"on_error": "warn"
|
// Existing test patterns and coverage analysis
|
||||||
}
|
},
|
||||||
],
|
"mcp_capabilities": {
|
||||||
"implementation_approach": [ // REQUIRED: 3 TDD phases
|
"code_index": true,
|
||||||
{
|
"exa_code": true,
|
||||||
"step": 1,
|
"exa_web": true
|
||||||
"title": "RED Phase: Write failing tests",
|
|
||||||
"tdd_phase": "red", // REQUIRED: Phase identifier
|
|
||||||
"description": "Write comprehensive failing tests",
|
|
||||||
"modification_points": ["Files/changes to make"],
|
|
||||||
"logic_flow": ["Step-by-step process"],
|
|
||||||
"acceptance": ["Phase success criteria"],
|
|
||||||
"depends_on": [],
|
|
||||||
"output": "failing_tests"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"title": "GREEN Phase: Implement to pass tests",
|
|
||||||
"tdd_phase": "green", // REQUIRED: Phase identifier
|
|
||||||
"description": "Minimal implementation with test-fix cycle",
|
|
||||||
"modification_points": ["Implementation files"],
|
|
||||||
"logic_flow": [
|
|
||||||
"Implement minimal code",
|
|
||||||
"Run tests",
|
|
||||||
"If fail → Enter iteration loop (max 3):",
|
|
||||||
" 1. Extract failure messages",
|
|
||||||
" 2. Gemini bug-fix diagnosis",
|
|
||||||
" 3. Apply fixes",
|
|
||||||
" 4. Rerun tests",
|
|
||||||
"If max_iterations → Auto-revert"
|
|
||||||
],
|
|
||||||
"acceptance": ["All tests pass"],
|
|
||||||
"command": "bash(npm test -- tests/path/)",
|
|
||||||
"depends_on": [1],
|
|
||||||
"output": "passing_implementation"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"title": "REFACTOR Phase: Improve code quality",
|
|
||||||
"tdd_phase": "refactor", // REQUIRED: Phase identifier
|
|
||||||
"description": "Refactor while keeping tests green",
|
|
||||||
"modification_points": ["Quality improvements"],
|
|
||||||
"logic_flow": ["Incremental refactoring with test verification"],
|
|
||||||
"acceptance": ["Tests still pass", "Code quality improved"],
|
|
||||||
"command": "bash(npm run lint && npm test)",
|
|
||||||
"depends_on": [2],
|
|
||||||
"output": "refactored_implementation"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"post_completion": [ // OPTIONAL: Final verification
|
|
||||||
{
|
|
||||||
"step": "verify_full_tdd_cycle",
|
|
||||||
"action": "Confirm complete TDD cycle",
|
|
||||||
"command": "bash(npm test && echo 'TDD complete')",
|
|
||||||
"output_to": "final_validation",
|
|
||||||
"on_error": "fail"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"error_handling": { // OPTIONAL: Error recovery
|
|
||||||
"green_phase_max_iterations": {
|
|
||||||
"action": "revert_all_changes",
|
|
||||||
"commands": ["bash(git reset --hard HEAD)"],
|
|
||||||
"report": "Generate failure report"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Key JSON Fields Summary**:
|
**Discovery Actions**:
|
||||||
- `meta.tdd_workflow`: Must be `true`
|
1. **Load Session Context** (if not in memory)
|
||||||
- `meta.max_iterations`: Green phase fix cycle limit (default: 3)
|
```javascript
|
||||||
- `meta.use_codex`: Automated fixes (false=manual, true=Codex)
|
if (!memory.has("workflow-session.json")) {
|
||||||
- `flow_control.implementation_approach`: Exactly 3 steps with `tdd_phase`: "red", "green", "refactor"
|
Read(.workflow/{session-id}/workflow-session.json)
|
||||||
- `context.tdd_cycles`: Optional detailed test cycle specifications
|
}
|
||||||
- `context.parent`: Required for subtasks (IMPL-N.M)
|
```
|
||||||
|
|
||||||
#### IMPL_PLAN.md Structure
|
2. **Load Context Package** (if not in memory)
|
||||||
|
```javascript
|
||||||
|
if (!memory.has("context-package.json")) {
|
||||||
|
Read(.workflow/{session-id}/.process/context-package.json)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Generate IMPL_PLAN.md with 8-section structure:
|
3. **Load Test Context Package** (if not in memory)
|
||||||
|
```javascript
|
||||||
|
if (!memory.has("test-context-package.json")) {
|
||||||
|
Read(.workflow/{session-id}/.process/test-context-package.json)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
**Frontmatter** (required fields):
|
4. **Extract & Load Role Analyses** (from context-package.json)
|
||||||
```yaml
|
```javascript
|
||||||
---
|
// Extract role analysis paths from context package
|
||||||
identifier: WFS-{session-id}
|
const roleAnalysisPaths = contextPackage.brainstorm_artifacts.role_analyses
|
||||||
source: "User requirements" | "File: path"
|
.flatMap(role => role.files.map(f => f.path));
|
||||||
conflict_resolution: .workflow/{session-id}/.process/CONFLICT_RESOLUTION.md # if exists
|
|
||||||
context_package: .workflow/{session-id}/.process/context-package.json
|
// Load each role analysis file
|
||||||
context_package_path: .workflow/{session-id}/.process/context-package.json
|
roleAnalysisPaths.forEach(path => Read(path));
|
||||||
test_context: .workflow/{session-id}/.process/test-context-package.json # if exists
|
```
|
||||||
workflow_type: "tdd"
|
|
||||||
verification_history:
|
5. **Load Conflict Resolution** (from context-package.json, if exists)
|
||||||
conflict_resolution: "executed | skipped" # based on conflict_risk
|
```javascript
|
||||||
action_plan_verify: "pending"
|
if (contextPackage.brainstorm_artifacts.conflict_resolution?.exists) {
|
||||||
phase_progression: "brainstorm → context → test_context → conflict_resolution → tdd_planning"
|
Read(contextPackage.brainstorm_artifacts.conflict_resolution.path)
|
||||||
feature_count: N
|
}
|
||||||
task_count: N # ≤10 total
|
```
|
||||||
task_breakdown:
|
|
||||||
simple_features: K
|
6. **Code Analysis with Native Tools** (optional - enhance understanding)
|
||||||
complex_features: L
|
```bash
|
||||||
total_subtasks: M
|
# Find relevant test files and patterns
|
||||||
tdd_workflow: true
|
find . -name "*test*" -type f
|
||||||
---
|
rg "describe|it\(|test\(" -g "*.ts"
|
||||||
|
```
|
||||||
|
|
||||||
|
7. **MCP External Research** (optional - gather TDD best practices)
|
||||||
|
```javascript
|
||||||
|
// Get external TDD examples and patterns
|
||||||
|
mcp__exa__get_code_context_exa(
|
||||||
|
query="TypeScript TDD best practices Red-Green-Refactor",
|
||||||
|
tokensNum="dynamic"
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Phase 2: Agent Execution (Document Generation)
|
||||||
|
|
||||||
|
**Pre-Agent Template Selection** (Command decides path before invoking agent):
|
||||||
|
```javascript
|
||||||
|
// Command checks flag and selects template PATH (not content)
|
||||||
|
const templatePath = hasCliExecuteFlag
|
||||||
|
? "~/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt"
|
||||||
|
: "~/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt";
|
||||||
```
|
```
|
||||||
|
|
||||||
**8 Sections Structure**:
|
**Agent Invocation**:
|
||||||
|
```javascript
|
||||||
|
Task(
|
||||||
|
subagent_type="action-planning-agent",
|
||||||
|
description="Generate TDD task JSON and implementation plan",
|
||||||
|
prompt=`
|
||||||
|
## Execution Context
|
||||||
|
|
||||||
```markdown
|
**Session ID**: WFS-{session-id}
|
||||||
# Implementation Plan: {Project Title}
|
**Workflow Type**: TDD
|
||||||
|
**Execution Mode**: {agent-mode | cli-execute-mode}
|
||||||
|
**Task JSON Template Path**: {template_path}
|
||||||
|
|
||||||
## 1. Summary
|
## Phase 1: Discovery Results (Provided Context)
|
||||||
- Core requirements and objectives (2-3 paragraphs)
|
|
||||||
- TDD-specific technical approach
|
|
||||||
|
|
||||||
## 2. Context Analysis
|
### Session Metadata
|
||||||
- CCW Workflow Context (Phase progression, Quality gates)
|
{session_metadata_content}
|
||||||
- Context Package Summary (Focus paths, Test context)
|
|
||||||
- Project Profile (Type, Scale, Tech Stack, Timeline)
|
|
||||||
- Module Structure (Directory tree)
|
|
||||||
- Dependencies (Primary, Testing, Development)
|
|
||||||
- Patterns & Conventions
|
|
||||||
|
|
||||||
## 3. Brainstorming Artifacts Reference
|
### Role Analyses (Enhanced by Synthesis)
|
||||||
- Artifact Usage Strategy
|
{role_analyses_content}
|
||||||
- CONFLICT_RESOLUTION.md (if exists - selected resolution strategies)
|
- Includes requirements, design specs, enhancements, and clarifications from synthesis phase
|
||||||
- role analysis documents (primary reference)
|
|
||||||
- test-context-package.json (test patterns)
|
|
||||||
- context-package.json (smart context)
|
|
||||||
- Artifact Priority in Development
|
|
||||||
|
|
||||||
## 4. Implementation Strategy
|
### Artifacts Inventory
|
||||||
- Execution Strategy (TDD Cycles: Red-Green-Refactor)
|
- **Guidance Specification**: {guidance_spec_path}
|
||||||
- Architectural Approach
|
- **Role Analyses**: {role_analyses_list}
|
||||||
- Key Dependencies (Task dependency graph)
|
|
||||||
- Testing Strategy (Coverage targets, Quality gates)
|
|
||||||
|
|
||||||
## 5. TDD Implementation Tasks
|
### Context Package
|
||||||
- Feature-by-Feature TDD Tasks
|
{context_package_summary}
|
||||||
- Each task: IMPL-N with internal Red → Green → Refactor
|
- Includes conflict_risk assessment
|
||||||
- Dependencies and complexity metrics
|
|
||||||
- Complex Feature Examples (when subtasks needed)
|
|
||||||
- TDD Task Breakdown Summary
|
|
||||||
|
|
||||||
## 6. Implementation Plan (Detailed Phased Breakdown)
|
### Test Context Package
|
||||||
- Execution Strategy (feature-by-feature sequential)
|
{test_context_package_summary}
|
||||||
- Phase breakdown (Phase 1, Phase 2, etc.)
|
- Existing test patterns, framework config, coverage analysis
|
||||||
- Resource Requirements (Team, Dependencies, Infrastructure)
|
|
||||||
|
|
||||||
## 7. Risk Assessment & Mitigation
|
### Conflict Resolution (Conditional)
|
||||||
- Risk table (Risk, Impact, Probability, Mitigation, Owner)
|
If conflict_risk was medium/high, modifications have been applied to:
|
||||||
- Critical Risks (TDD-specific)
|
- **guidance-specification.md**: Design decisions updated to resolve conflicts
|
||||||
- Monitoring Strategy
|
- **Role analyses (*.md)**: Recommendations adjusted for compatibility
|
||||||
|
- **context-package.json**: Marked as "resolved" with conflict IDs
|
||||||
|
- NO separate CONFLICT_RESOLUTION.md file (conflicts resolved in-place)
|
||||||
|
|
||||||
## 8. Success Criteria
|
### MCP Analysis Results (Optional)
|
||||||
- Functional Completeness
|
**Code Structure**: {mcp_code_index_results}
|
||||||
- Technical Quality (Test coverage ≥80%)
|
**External Research**: {mcp_exa_research_results}
|
||||||
- Operational Readiness
|
|
||||||
- TDD Compliance
|
## Phase 2: TDD Document Generation Task
|
||||||
|
|
||||||
|
**Agent Configuration Reference**: All TDD task generation rules, quantification requirements, Red-Green-Refactor cycle structure, quality standards, and execution details are defined in action-planning-agent.
|
||||||
|
|
||||||
|
Refer to: @.claude/agents/action-planning-agent.md for:
|
||||||
|
- TDD Task Decomposition Standards
|
||||||
|
- Red-Green-Refactor Cycle Requirements
|
||||||
|
- Quantification Requirements (MANDATORY)
|
||||||
|
- 5-Field Task JSON Schema
|
||||||
|
- IMPL_PLAN.md Structure (TDD variant)
|
||||||
|
- TODO_LIST.md Format
|
||||||
|
- TDD Execution Flow & Quality Validation
|
||||||
|
|
||||||
|
### TDD-Specific Requirements Summary
|
||||||
|
|
||||||
|
#### Task Structure Philosophy
|
||||||
|
- **1 feature = 1 task** containing complete TDD cycle internally
|
||||||
|
- Each task executes Red-Green-Refactor phases sequentially
|
||||||
|
- Task count = Feature count (typically 5 features = 5 tasks)
|
||||||
|
- Subtasks only when complexity >2500 lines or >6 files per cycle
|
||||||
|
- **Maximum 10 tasks** (hard limit for TDD workflows)
|
||||||
|
|
||||||
|
#### TDD Cycle Mapping
|
||||||
|
- **Simple features**: IMPL-N with internal Red-Green-Refactor phases
|
||||||
|
- **Complex features**: IMPL-N (container) + IMPL-N.M (subtasks)
|
||||||
|
- Each cycle includes: test_count, test_cases array, implementation_scope, expected_coverage
|
||||||
|
|
||||||
|
#### Required Outputs Summary
|
||||||
|
|
||||||
|
##### 1. TDD Task JSON Files (.task/IMPL-*.json)
|
||||||
|
- **Location**: `.workflow/{session-id}/.task/`
|
||||||
|
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
|
||||||
|
- **Schema**: 5-field structure with TDD-specific metadata
|
||||||
|
- `meta.tdd_workflow`: true (REQUIRED)
|
||||||
|
- `meta.max_iterations`: 3 (Green phase test-fix cycle limit)
|
||||||
|
- `meta.use_codex`: false (manual fixes by default)
|
||||||
|
- `context.tdd_cycles`: Array with quantified test cases and coverage
|
||||||
|
- `flow_control.implementation_approach`: Exactly 3 steps with `tdd_phase` field
|
||||||
|
1. Red Phase (`tdd_phase: "red"`): Write failing tests
|
||||||
|
2. Green Phase (`tdd_phase: "green"`): Implement to pass tests
|
||||||
|
3. Refactor Phase (`tdd_phase: "refactor"`): Improve code quality
|
||||||
|
- **Details**: See action-planning-agent.md § TDD Task JSON Generation
|
||||||
|
|
||||||
|
##### 2. IMPL_PLAN.md (TDD Variant)
|
||||||
|
- **Location**: `.workflow/{session-id}/IMPL_PLAN.md`
|
||||||
|
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
|
||||||
|
- **TDD-Specific Frontmatter**: workflow_type="tdd", tdd_workflow=true, feature_count, task_breakdown
|
||||||
|
- **TDD Implementation Tasks Section**: Feature-by-feature with internal Red-Green-Refactor cycles
|
||||||
|
- **Details**: See action-planning-agent.md § TDD Implementation Plan Creation
|
||||||
|
|
||||||
|
##### 3. TODO_LIST.md
|
||||||
|
- **Location**: `.workflow/{session-id}/TODO_LIST.md`
|
||||||
|
- **Format**: Hierarchical task list with internal TDD phase indicators (Red → Green → Refactor)
|
||||||
|
- **Status**: ▸ (container), [ ] (pending), [x] (completed)
|
||||||
|
- **Details**: See action-planning-agent.md § TODO List Generation
|
||||||
|
|
||||||
|
### Quantification Requirements (MANDATORY)
|
||||||
|
|
||||||
|
**Core Rules**:
|
||||||
|
1. **Explicit Test Case Counts**: Red phase specifies exact number with enumerated list
|
||||||
|
2. **Quantified Coverage**: Acceptance includes measurable percentage (e.g., ">=85%")
|
||||||
|
3. **Detailed Implementation Scope**: Green phase enumerates files, functions, line counts
|
||||||
|
4. **Enumerated Refactoring Targets**: Refactor phase lists specific improvements with counts
|
||||||
|
|
||||||
|
**TDD Phase Formats**:
|
||||||
|
- **Red Phase**: "Write N test cases: [test1, test2, ...]"
|
||||||
|
- **Green Phase**: "Implement N functions in file lines X-Y: [func1() X1-Y1, func2() X2-Y2, ...]"
|
||||||
|
- **Refactor Phase**: "Apply N refactorings: [improvement1 (details), improvement2 (details), ...]"
|
||||||
|
- **Acceptance**: "All N tests pass with >=X% coverage: verify by [test command]"
|
||||||
|
|
||||||
|
**Validation Checklist**:
|
||||||
|
- [ ] Every Red phase specifies exact test case count with enumerated list
|
||||||
|
- [ ] Every Green phase enumerates files, functions, and estimated line counts
|
||||||
|
- [ ] Every Refactor phase lists specific improvements with counts
|
||||||
|
- [ ] Every acceptance criterion includes measurable coverage percentage
|
||||||
|
- [ ] tdd_cycles array contains test_count and test_cases for each cycle
|
||||||
|
- [ ] No vague language ("comprehensive", "complete", "thorough")
|
||||||
|
|
||||||
|
### Agent Execution Summary
|
||||||
|
|
||||||
|
**Key Steps** (Detailed instructions in action-planning-agent.md):
|
||||||
|
1. Load task JSON template from provided path
|
||||||
|
2. Extract and decompose features with TDD cycles
|
||||||
|
3. Generate TDD task JSON files enforcing quantification requirements
|
||||||
|
4. Create IMPL_PLAN.md using TDD template variant
|
||||||
|
5. Generate TODO_LIST.md with TDD phase indicators
|
||||||
|
6. Update session state with TDD metadata
|
||||||
|
|
||||||
|
**Quality Gates** (Full checklist in action-planning-agent.md):
|
||||||
|
- ✓ Quantification requirements enforced (explicit counts, measurable acceptance, exact targets)
|
||||||
|
- ✓ Task count ≤10 (hard limit)
|
||||||
|
- ✓ Each task has meta.tdd_workflow: true
|
||||||
|
- ✓ Each task has exactly 3 implementation steps with tdd_phase field
|
||||||
|
- ✓ Green phase includes test-fix cycle logic
|
||||||
|
- ✓ Artifact references mapped correctly
|
||||||
|
- ✓ MCP tool integration added
|
||||||
|
- ✓ Documents follow TDD template structure
|
||||||
|
|
||||||
|
## Output
|
||||||
|
|
||||||
|
Generate all three documents and report completion status:
|
||||||
|
- TDD task JSON files created: N files (IMPL-*.json)
|
||||||
|
- TDD cycles configured: N cycles with quantified test cases
|
||||||
|
- Artifacts integrated: synthesis-spec, guidance-specification, N role analyses
|
||||||
|
- Test context integrated: existing patterns and coverage
|
||||||
|
- MCP enhancements: code-index, exa-research
|
||||||
|
- Session ready for TDD execution: /workflow:execute
|
||||||
|
`
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Phase 4: TODO_LIST.md Generation
|
### Agent Context Passing
|
||||||
|
|
||||||
Generate task list with internal TDD phase indicators:
|
**Memory-Aware Context Assembly**:
|
||||||
|
```javascript
|
||||||
|
// Assemble context package for agent
|
||||||
|
const agentContext = {
|
||||||
|
session_id: "WFS-[id]",
|
||||||
|
workflow_type: "tdd",
|
||||||
|
|
||||||
**For Simple Features (1 task per feature)**:
|
// Use memory if available, else load
|
||||||
```markdown
|
session_metadata: memory.has("workflow-session.json")
|
||||||
## TDD Implementation Tasks
|
? memory.get("workflow-session.json")
|
||||||
|
: Read(.workflow/WFS-[id]/workflow-session.json),
|
||||||
|
|
||||||
### Feature 1: {Feature Name}
|
context_package_path: ".workflow/WFS-[id]/.process/context-package.json",
|
||||||
- [ ] **IMPL-1**: Implement {feature} with TDD → [Task](./.task/IMPL-1.json)
|
|
||||||
- Internal phases: Red → Green → Refactor
|
|
||||||
- Dependencies: None
|
|
||||||
|
|
||||||
### Feature 2: {Feature Name}
|
context_package: memory.has("context-package.json")
|
||||||
- [ ] **IMPL-2**: Implement {feature} with TDD → [Task](./.task/IMPL-2.json)
|
? memory.get("context-package.json")
|
||||||
- Internal phases: Red → Green → Refactor
|
: Read(".workflow/WFS-[id]/.process/context-package.json"),
|
||||||
- Dependencies: IMPL-1
|
|
||||||
```
|
|
||||||
|
|
||||||
**For Complex Features (with subtasks)**:
|
test_context_package_path: ".workflow/WFS-[id]/.process/test-context-package.json",
|
||||||
```markdown
|
|
||||||
### Feature 3: {Complex Feature Name}
|
|
||||||
▸ **IMPL-3**: Implement {complex feature} with TDD → [Task](./.task/IMPL-3.json)
|
|
||||||
- [ ] **IMPL-3.1**: {Sub-feature A} with TDD → [Task](./.task/IMPL-3.1.json)
|
|
||||||
- Internal phases: Red → Green → Refactor
|
|
||||||
- [ ] **IMPL-3.2**: {Sub-feature B} with TDD → [Task](./.task/IMPL-3.2.json)
|
|
||||||
- Internal phases: Red → Green → Refactor
|
|
||||||
- Dependencies: IMPL-3.1
|
|
||||||
```
|
|
||||||
|
|
||||||
**Status Legend**:
|
test_context_package: memory.has("test-context-package.json")
|
||||||
```markdown
|
? memory.get("test-context-package.json")
|
||||||
## Status Legend
|
: Read(".workflow/WFS-[id]/.process/test-context-package.json"),
|
||||||
- ▸ = Container task (has subtasks)
|
|
||||||
- [ ] = Pending task
|
|
||||||
- [x] = Completed task
|
|
||||||
- Red = Write failing tests
|
|
||||||
- Green = Implement to pass tests (with test-fix cycle)
|
|
||||||
- Refactor = Improve code quality
|
|
||||||
```
|
|
||||||
|
|
||||||
### Phase 5: Session State Update
|
// Extract brainstorm artifacts from context package
|
||||||
|
brainstorm_artifacts: extractBrainstormArtifacts(context_package),
|
||||||
|
|
||||||
Update workflow-session.json with TDD metadata:
|
// Load role analyses using paths from context package
|
||||||
```json
|
role_analyses: brainstorm_artifacts.role_analyses
|
||||||
{
|
.flatMap(role => role.files)
|
||||||
"workflow_type": "tdd",
|
.map(file => Read(file.path)),
|
||||||
"feature_count": 5,
|
|
||||||
"task_count": 5,
|
// Load conflict resolution if exists (from context package)
|
||||||
"task_breakdown": {
|
conflict_resolution: brainstorm_artifacts.conflict_resolution?.exists
|
||||||
"simple_features": 4,
|
? Read(brainstorm_artifacts.conflict_resolution.path)
|
||||||
"complex_features": 1,
|
: null,
|
||||||
"total_subtasks": 2
|
|
||||||
},
|
// Optional MCP enhancements
|
||||||
"tdd_workflow": true,
|
mcp_analysis: executeMcpDiscovery()
|
||||||
"task_limit_compliance": true
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Task Count Calculation**:
|
## TDD Task Structure Reference
|
||||||
- **Simple features**: 1 task each (IMPL-N with internal TDD cycle)
|
|
||||||
- **Complex features**: 1 container + M subtasks (IMPL-N + IMPL-N.M)
|
This section provides quick reference for TDD task JSON structure. For complete implementation details, see the agent invocation prompt in Phase 2 above.
|
||||||
- **Total**: Simple feature count + Complex feature subtask count
|
|
||||||
- **Example**: 4 simple + 1 complex (with 2 subtasks) = 6 total tasks (not 15)
|
**Quick Reference**:
|
||||||
|
- Each TDD task contains complete Red-Green-Refactor cycle
|
||||||
|
- Task ID format: `IMPL-N` (simple) or `IMPL-N.M` (complex subtasks)
|
||||||
|
- Required metadata: `meta.tdd_workflow: true`, `meta.max_iterations: 3`
|
||||||
|
- Flow control: Exactly 3 steps with `tdd_phase` field (red, green, refactor)
|
||||||
|
- Context: `tdd_cycles` array with quantified test cases and coverage
|
||||||
|
- See Phase 2 agent prompt for full schema and requirements
|
||||||
|
|
||||||
## Output Files Structure
|
## Output Files Structure
|
||||||
```
|
```
|
||||||
@@ -465,52 +449,30 @@ Update workflow-session.json with TDD metadata:
|
|||||||
|
|
||||||
## Integration & Usage
|
## Integration & Usage
|
||||||
|
|
||||||
### Command Chain
|
**Command Chain**:
|
||||||
- **Called By**: `/workflow:tdd-plan` (Phase 4)
|
- Called by: `/workflow:tdd-plan` (Phase 4)
|
||||||
- **Calls**: Gemini CLI for TDD breakdown
|
- Invokes: `action-planning-agent` for autonomous task generation
|
||||||
- **Followed By**: `/workflow:execute`, `/workflow:tdd-verify`
|
- Followed by: `/workflow:execute`, `/workflow:tdd-verify`
|
||||||
|
|
||||||
### Basic Usage
|
**Basic Usage**:
|
||||||
```bash
|
```bash
|
||||||
# Manual mode (default)
|
# Agent mode (default, autonomous execution)
|
||||||
/workflow:tools:task-generate-tdd --session WFS-auth
|
/workflow:tools:task-generate-tdd --session WFS-auth
|
||||||
|
|
||||||
# Agent mode (autonomous task generation)
|
# CLI tool mode (use Gemini/Qwen for generation)
|
||||||
/workflow:tools:task-generate-tdd --session WFS-auth --agent
|
/workflow:tools:task-generate-tdd --session WFS-auth --cli-execute
|
||||||
```
|
```
|
||||||
|
|
||||||
### Expected Output
|
**Execution Modes**:
|
||||||
```
|
- **Agent mode** (default): Uses `action-planning-agent` with agent-mode task template
|
||||||
TDD task generation complete for session: WFS-auth
|
- **CLI mode** (`--cli-execute`): Uses Gemini/Qwen with cli-mode task template
|
||||||
|
|
||||||
Features analyzed: 5
|
**Output**:
|
||||||
Total tasks: 5 (1 task per feature with internal TDD cycles)
|
- TDD task JSON files in `.task/` directory (IMPL-N.json format)
|
||||||
|
- IMPL_PLAN.md with TDD Implementation Tasks section
|
||||||
Task breakdown:
|
- TODO_LIST.md with internal TDD phase indicators
|
||||||
- Simple features: 4 tasks (IMPL-1 to IMPL-4)
|
- Session state updated with task count and TDD metadata
|
||||||
- Complex features: 1 task with 2 subtasks (IMPL-5, IMPL-5.1, IMPL-5.2)
|
- MCP enhancements integrated (if available)
|
||||||
- Total task count: 6 (within 10-task limit)
|
|
||||||
|
|
||||||
Structure:
|
|
||||||
- IMPL-1: User Authentication (Internal: Red → Green → Refactor)
|
|
||||||
- IMPL-2: Password Reset (Internal: Red → Green → Refactor)
|
|
||||||
- IMPL-3: Email Verification (Internal: Red → Green → Refactor)
|
|
||||||
- IMPL-4: Role Management (Internal: Red → Green → Refactor)
|
|
||||||
- IMPL-5: Payment System (Container)
|
|
||||||
- IMPL-5.1: Gateway Integration (Internal: Red → Green → Refactor)
|
|
||||||
- IMPL-5.2: Transaction Management (Internal: Red → Green → Refactor)
|
|
||||||
|
|
||||||
Plans generated:
|
|
||||||
- Unified Plan: .workflow/WFS-auth/IMPL_PLAN.md (includes TDD Implementation Tasks section)
|
|
||||||
- Task List: .workflow/WFS-auth/TODO_LIST.md (with internal TDD phase indicators)
|
|
||||||
|
|
||||||
TDD Configuration:
|
|
||||||
- Each task contains complete Red-Green-Refactor cycle
|
|
||||||
- Green phase includes test-fix cycle (max 3 iterations)
|
|
||||||
- Auto-revert on max iterations reached
|
|
||||||
|
|
||||||
Next: /workflow:action-plan-verify --session WFS-auth (recommended) or /workflow:execute --session WFS-auth
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Coverage Analysis Integration
|
## Test Coverage Analysis Integration
|
||||||
|
|
||||||
@@ -547,9 +509,3 @@ IMPL (Green phase) tasks include automatic test-fix cycle:
|
|||||||
- **meta.max_iterations**: Number of fix attempts (default: 3 for TDD, 5 for test-gen)
|
- **meta.max_iterations**: Number of fix attempts (default: 3 for TDD, 5 for test-gen)
|
||||||
- **meta.use_codex**: Enable Codex automated fixes (default: false, manual)
|
- **meta.use_codex**: Enable Codex automated fixes (default: false, manual)
|
||||||
|
|
||||||
## Related Commands
|
|
||||||
- `/workflow:tdd-plan` - Orchestrates TDD workflow planning (6 phases)
|
|
||||||
- `/workflow:tools:test-context-gather` - Analyzes test coverage
|
|
||||||
- `/workflow:execute` - Executes TDD tasks in order
|
|
||||||
- `/workflow:tdd-verify` - Verifies TDD compliance
|
|
||||||
- `/workflow:test-gen` - Post-implementation test generation
|
|
||||||
|
|||||||
@@ -45,8 +45,33 @@ This command is built on a set of core principles to ensure efficient and reliab
|
|||||||
- **Memory-First**: Prioritizes using documents already loaded in conversation memory to avoid redundant file operations
|
- **Memory-First**: Prioritizes using documents already loaded in conversation memory to avoid redundant file operations
|
||||||
- **Mode-Flexible**: Supports both agent-driven execution (default) and CLI tool execution (with `--cli-execute` flag)
|
- **Mode-Flexible**: Supports both agent-driven execution (default) and CLI tool execution (with `--cli-execute` flag)
|
||||||
- **Multi-Step Support**: Complex tasks can use multiple sequential steps in `implementation_approach` with codex resume mechanism
|
- **Multi-Step Support**: Complex tasks can use multiple sequential steps in `implementation_approach` with codex resume mechanism
|
||||||
|
- **Quantification-Enforced**: **NEW** - All requirements, acceptance criteria, and modification points MUST include explicit counts and enumerations to prevent ambiguity (e.g., "17 commands: [list]" not "implement commands")
|
||||||
- **Responsibility**: Parses analysis, detects artifacts, generates enhanced task JSONs, creates `IMPL_PLAN.md` and `TODO_LIST.md`, updates session state
|
- **Responsibility**: Parses analysis, detects artifacts, generates enhanced task JSONs, creates `IMPL_PLAN.md` and `TODO_LIST.md`, updates session state
|
||||||
|
|
||||||
|
## 3.5. Quantification Requirements (MANDATORY)
|
||||||
|
|
||||||
|
**Purpose**: Eliminate ambiguity by enforcing explicit counts and enumerations in all task specifications.
|
||||||
|
|
||||||
|
**Core Rules**:
|
||||||
|
1. **Extract Counts from Analysis**: Search for HOW MANY items and list them explicitly
|
||||||
|
2. **Enforce Explicit Lists**: Every deliverable uses format `{count} {type}: [{explicit_list}]`
|
||||||
|
3. **Make Acceptance Measurable**: Include verification commands (e.g., `ls ... | wc -l = N`)
|
||||||
|
4. **Quantify Modification Points**: Specify exact targets (files, functions with line numbers)
|
||||||
|
5. **Avoid Vague Language**: Replace "complete", "comprehensive", "reorganize" with quantified statements
|
||||||
|
|
||||||
|
**Standard Formats**:
|
||||||
|
|
||||||
|
- **Requirements**: `"Implement N items: [item1, item2, ...]"` or `"Modify N files: [file1:func:lines, ...]"`
|
||||||
|
- **Acceptance**: `"N items exist: verify by [command]"` or `"Coverage >= X%: verify by [test command]"`
|
||||||
|
- **Modification Points**: `"Create N files: [list]"` or `"Modify N functions: [func() in file lines X-Y]"`
|
||||||
|
|
||||||
|
**Validation Checklist**:
|
||||||
|
- [ ] Every requirement contains explicit count or enumerated list
|
||||||
|
- [ ] Every acceptance criterion is measurable with verification command
|
||||||
|
- [ ] Every modification_point specifies exact targets (files/functions/lines)
|
||||||
|
- [ ] No vague language ("complete", "comprehensive", "reorganize" without counts)
|
||||||
|
- [ ] Each implementation step has its own acceptance criteria
|
||||||
|
|
||||||
## 4. Execution Flow
|
## 4. Execution Flow
|
||||||
The command follows a streamlined, three-step process to convert analysis into executable tasks.
|
The command follows a streamlined, three-step process to convert analysis into executable tasks.
|
||||||
|
|
||||||
@@ -59,13 +84,39 @@ The process begins by gathering all necessary inputs. It follows a **Memory-Firs
|
|||||||
|
|
||||||
### Step 2: Task Decomposition & Grouping
|
### Step 2: Task Decomposition & Grouping
|
||||||
Once all inputs are loaded, the command analyzes the tasks defined in the analysis results and groups them based on shared context.
|
Once all inputs are loaded, the command analyzes the tasks defined in the analysis results and groups them based on shared context.
|
||||||
1. **Task Definition Parsing**: Extracts task definitions, requirements, and dependencies.
|
|
||||||
2. **Context Signature Analysis**: Computes a unique hash (`context_signature`) for each task based on its `focus_paths` and referenced `artifacts`.
|
**Phase 2.1: Quantification Extraction (NEW - CRITICAL)**
|
||||||
|
1. **Count Extraction**: Scan analysis documents for quantifiable information:
|
||||||
|
- Search for numbers + nouns (e.g., "5 files", "17 commands", "3 features")
|
||||||
|
- Identify enumerated lists (bullet points, numbered lists, comma-separated items)
|
||||||
|
- Extract explicit counts from tables, diagrams, or structured data
|
||||||
|
- Store extracted counts with their context (what is being counted)
|
||||||
|
|
||||||
|
2. **List Enumeration**: Build explicit lists for each deliverable:
|
||||||
|
- If analysis says "implement session commands", enumerate ALL commands: [start, resume, list, complete, archive]
|
||||||
|
- If analysis mentions "create categories", list ALL categories: [literature, experiment, data-analysis, visualization, context]
|
||||||
|
- If analysis describes "modify functions", list ALL functions with line numbers
|
||||||
|
- Maintain full enumerations (no "..." unless list exceeds 20 items)
|
||||||
|
|
||||||
|
3. **Verification Method Assignment**: For each deliverable, determine verification approach:
|
||||||
|
- File count: `ls {path}/*.{ext} | wc -l = {count}`
|
||||||
|
- Directory existence: `ls {parent}/ | grep -E '(name1|name2|...)' | wc -l = {count}`
|
||||||
|
- Test coverage: `pytest --cov={module} --cov-report=term | grep TOTAL | awk '{print $4}' >= {percentage}`
|
||||||
|
- Function existence: `grep -E '(func1|func2|...)' {file} | wc -l = {count}`
|
||||||
|
|
||||||
|
4. **Ambiguity Detection**: Flag vague language for replacement:
|
||||||
|
- Detect words: "complete", "comprehensive", "reorganize", "refactor", "implement", "create" without counts
|
||||||
|
- Require quantification: "implement" → "implement {N} {items}: [{list}]"
|
||||||
|
- Reject unquantified deliverables
|
||||||
|
|
||||||
|
**Phase 2.2: Task Definition & Grouping**
|
||||||
|
1. **Task Definition Parsing**: Extracts task definitions, requirements, and dependencies from quantified analysis
|
||||||
|
2. **Context Signature Analysis**: Computes a unique hash (`context_signature`) for each task based on its `focus_paths` and referenced `artifacts`
|
||||||
3. **Task Grouping**:
|
3. **Task Grouping**:
|
||||||
* Tasks with the **same signature** are candidates for merging, as they operate on the same context.
|
* Tasks with the **same signature** are candidates for merging, as they operate on the same context
|
||||||
* Tasks with **different signatures** and no dependencies are grouped for parallel execution.
|
* Tasks with **different signatures** and no dependencies are grouped for parallel execution
|
||||||
* Tasks with `depends_on` relationships are marked for sequential execution.
|
* Tasks with `depends_on` relationships are marked for sequential execution
|
||||||
4. **Modification Target Determination**: Extracts specific code locations (`file:function:lines`) from the analysis to populate the `target_files` field.
|
4. **Modification Target Determination**: Extracts specific code locations (`file:function:lines`) from the analysis to populate the `target_files` field
|
||||||
|
|
||||||
### Step 3: Output Generation
|
### Step 3: Output Generation
|
||||||
Finally, the command generates all the necessary output files.
|
Finally, the command generates all the necessary output files.
|
||||||
@@ -167,38 +218,82 @@ function assignExecutionGroups(tasks) {
|
|||||||
The command produces three key documents and a directory of task files.
|
The command produces three key documents and a directory of task files.
|
||||||
|
|
||||||
### 6.1. Task JSON Schema (`.task/IMPL-*.json`)
|
### 6.1. Task JSON Schema (`.task/IMPL-*.json`)
|
||||||
This enhanced 5-field schema embeds all necessary context, artifacts, and execution steps.
|
Each task JSON embeds all necessary context, artifacts, and execution steps using this schema:
|
||||||
|
|
||||||
|
**Top-Level Fields**:
|
||||||
|
- `id`: Task identifier (format: `IMPL-N` or `IMPL-N.M` for subtasks)
|
||||||
|
- `title`: Descriptive task name
|
||||||
|
- `status`: Task state (`pending|active|completed|blocked|container`)
|
||||||
|
- `context_package_path`: Path to context package (`.workflow/WFS-[session]/.process/context-package.json`)
|
||||||
|
- `meta`: Task metadata
|
||||||
|
- `context`: Task-specific context and requirements
|
||||||
|
- `flow_control`: Execution steps and workflow
|
||||||
|
|
||||||
|
**Meta Object**:
|
||||||
|
- `type`: Task category (`feature|bugfix|refactor|test-gen|test-fix|docs`)
|
||||||
|
- `agent`: Assigned agent (`@code-developer|@test-fix-agent|@universal-executor`)
|
||||||
|
- `execution_group`: Parallelization group ID or null
|
||||||
|
- `context_signature`: Hash for context-based grouping
|
||||||
|
|
||||||
|
**Context Object**:
|
||||||
|
- `requirements`: Quantified implementation requirements (with counts and explicit lists)
|
||||||
|
- `focus_paths`: Target directories/files (absolute or relative paths)
|
||||||
|
- `acceptance`: Measurable acceptance criteria (with verification commands)
|
||||||
|
- `parent`: Parent task ID for subtasks
|
||||||
|
- `depends_on`: Prerequisite task IDs
|
||||||
|
- `inherited`: Shared patterns and dependencies from parent
|
||||||
|
- `shared_context`: Tech stack and conventions
|
||||||
|
- `artifacts`: Referenced brainstorm artifacts with paths, priority, and usage
|
||||||
|
|
||||||
|
**Flow Control Object**:
|
||||||
|
- `pre_analysis`: Context loading and preparation steps
|
||||||
|
- `load_context_package`: Load smart context and artifact catalog
|
||||||
|
- `load_role_analysis_artifacts`: Load role analyses dynamically from context package
|
||||||
|
- `load_planning_context`: Load finalized decisions with resolved conflicts
|
||||||
|
- `codebase_exploration`: Discover existing patterns
|
||||||
|
- `analyze_task_patterns`: Identify modification targets
|
||||||
|
- `implementation_approach`: Execution steps
|
||||||
|
- **Agent Mode**: Steps contain `modification_points` and `logic_flow` (agent executes autonomously)
|
||||||
|
- **CLI Mode**: Steps include `command` field with CLI tool invocation
|
||||||
|
- `target_files`: Specific files/functions/lines to modify
|
||||||
|
|
||||||
|
**Key Characteristics**:
|
||||||
|
- **Quantification**: All requirements/acceptance use explicit counts and enumerations
|
||||||
|
- **Mode Flexibility**: Supports both agent execution (default) and CLI tool execution (`--cli-execute`)
|
||||||
|
- **Context Intelligence**: References context-package.json for smart context and artifact paths
|
||||||
|
- **Artifact Integration**: Dynamically loads role analyses and brainstorm artifacts
|
||||||
|
|
||||||
|
**Example Task JSON**:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"id": "IMPL-N[.M]",
|
"id": "IMPL-1",
|
||||||
"title": "Descriptive task name",
|
"title": "Implement feature X with Y components",
|
||||||
"status": "pending|active|completed|blocked|container",
|
"status": "pending",
|
||||||
"context_package_path": ".workflow/WFS-[session]/.process/context-package.json",
|
"context_package_path": ".workflow/WFS-session/.process/context-package.json",
|
||||||
"meta": {
|
"meta": {
|
||||||
"type": "feature|bugfix|refactor|test-gen|test-fix|docs",
|
"type": "feature",
|
||||||
"agent": "@code-developer|@test-fix-agent|@universal-executor",
|
"agent": "@code-developer",
|
||||||
"execution_group": "group-id|null",
|
"execution_group": "parallel-abc123",
|
||||||
"context_signature": "hash-of-focus_paths-and-artifacts"
|
"context_signature": "hash-value"
|
||||||
},
|
},
|
||||||
"context": {
|
"context": {
|
||||||
"requirements": ["Clear requirement from analysis"],
|
"requirements": [
|
||||||
"focus_paths": ["D:\\project\\src\\module\\path", "./tests/module/path"],
|
"Implement 5 commands: [cmd1, cmd2, cmd3, cmd4, cmd5]",
|
||||||
"acceptance": ["Measurable acceptance criterion"],
|
"Create 3 directories: [dir1/, dir2/, dir3/]",
|
||||||
"parent": "IMPL-N",
|
"Modify 2 functions: [funcA() in file1.ts lines 10-25, funcB() in file2.ts lines 40-60]"
|
||||||
"depends_on": ["IMPL-N.M"],
|
],
|
||||||
"inherited": {"shared_patterns": [], "common_dependencies": []},
|
"focus_paths": ["D:\\project\\src\\module", "./tests/module"],
|
||||||
"shared_context": {"tech_stack": [], "conventions": []},
|
"acceptance": [
|
||||||
|
"5 command files created: verify by ls .claude/commands/*/*.md | wc -l = 5",
|
||||||
|
"3 directories exist: verify by ls -d dir*/ | wc -l = 3",
|
||||||
|
"All tests pass: pytest tests/ --cov=src/module (>=80% coverage)"
|
||||||
|
],
|
||||||
|
"depends_on": [],
|
||||||
"artifacts": [
|
"artifacts": [
|
||||||
{
|
{
|
||||||
"path": "{{from context-package.json → brainstorm_artifacts.role_analyses[].files[].path}}",
|
"path": ".workflow/WFS-session/.brainstorming/system-architect/analysis.md",
|
||||||
"priority": "highest",
|
"priority": "highest",
|
||||||
"usage": "Role-specific requirements, design specs, enhanced by synthesis. Paths loaded dynamically from context-package.json (supports multiple files per role: analysis.md, analysis-01.md, analysis-api.md, etc.). Common roles: product-manager, system-architect, ui-designer, data-architect, ux-expert."
|
"usage": "Architecture decisions and API specifications"
|
||||||
},
|
|
||||||
{
|
|
||||||
"path": ".workflow/WFS-[session]/.brainstorming/guidance-specification.md",
|
|
||||||
"priority": "high",
|
|
||||||
"usage": "Finalized design decisions (potentially modified by conflict resolution if conflict_risk was medium/high). Use for: understanding resolved requirements, design choices, conflict resolutions applied in-place"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -206,18 +301,14 @@ This enhanced 5-field schema embeds all necessary context, artifacts, and execut
|
|||||||
"pre_analysis": [
|
"pre_analysis": [
|
||||||
{
|
{
|
||||||
"step": "load_context_package",
|
"step": "load_context_package",
|
||||||
"action": "Load context package for artifact paths",
|
"action": "Load context package for artifact paths and smart context",
|
||||||
"note": "Context package path is now at top-level field: context_package_path",
|
"commands": ["Read({{context_package_path}})"],
|
||||||
"commands": [
|
|
||||||
"Read({{context_package_path}})"
|
|
||||||
],
|
|
||||||
"output_to": "context_package",
|
"output_to": "context_package",
|
||||||
"on_error": "fail"
|
"on_error": "fail"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"step": "load_role_analysis_artifacts",
|
"step": "load_role_analysis_artifacts",
|
||||||
"action": "Load role analyses from context-package.json (supports multiple files per role)",
|
"action": "Load role analyses from context-package.json",
|
||||||
"note": "Paths loaded from context-package.json → brainstorm_artifacts.role_analyses[]. Supports analysis*.md automatically.",
|
|
||||||
"commands": [
|
"commands": [
|
||||||
"Read({{context_package_path}})",
|
"Read({{context_package_path}})",
|
||||||
"Extract(brainstorm_artifacts.role_analyses[].files[].path)",
|
"Extract(brainstorm_artifacts.role_analyses[].files[].path)",
|
||||||
@@ -225,73 +316,36 @@ This enhanced 5-field schema embeds all necessary context, artifacts, and execut
|
|||||||
],
|
],
|
||||||
"output_to": "role_analysis_artifacts",
|
"output_to": "role_analysis_artifacts",
|
||||||
"on_error": "skip_optional"
|
"on_error": "skip_optional"
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": "load_planning_context",
|
|
||||||
"action": "Load plan-generated context intelligence with resolved conflicts",
|
|
||||||
"note": "CRITICAL: context-package.json (from context_package_path) provides smart context (focus paths, dependencies, patterns) and conflict resolution status. If conflict_risk was medium/high, conflicts have been resolved in guidance-specification.md and role analyses.",
|
|
||||||
"commands": [
|
|
||||||
"Read({{context_package_path}})",
|
|
||||||
"Read(.workflow/WFS-[session]/.brainstorming/guidance-specification.md)"
|
|
||||||
],
|
|
||||||
"output_to": "planning_context",
|
|
||||||
"on_error": "fail",
|
|
||||||
"usage_guidance": {
|
|
||||||
"context-package.json": "Use for focus_paths validation, dependency resolution, existing pattern discovery, module structure understanding, conflict_risk status (resolved/none/low)",
|
|
||||||
"guidance-specification.md": "Use for finalized design decisions (includes applied conflict resolutions if any)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": "codebase_exploration",
|
|
||||||
"action": "Explore codebase using native tools",
|
|
||||||
"command": "bash(find . -name \"[patterns]\" -type f && rg \"[patterns]\")",
|
|
||||||
"output_to": "codebase_structure"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": "analyze_task_patterns",
|
|
||||||
"action": "Analyze existing code patterns and identify modification targets",
|
|
||||||
"commands": [
|
|
||||||
"bash(cd \"[focus_paths]\")",
|
|
||||||
"bash(gemini \"PURPOSE: Identify modification targets TASK: Analyze '[title]' and locate specific files/functions/lines to modify CONTEXT: [role_analyses] [individual_artifacts] EXPECTED: Code locations in format 'file:function:lines' RULES: Consult role analyses for requirements, identify exact modification points\")"
|
|
||||||
],
|
|
||||||
"output_to": "task_context_with_targets",
|
|
||||||
"on_error": "fail"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"implementation_approach": [
|
"implementation_approach": [
|
||||||
{
|
{
|
||||||
"step": 1,
|
"step": 1,
|
||||||
"title": "Implement task following role analyses and context",
|
"title": "Implement feature following role analyses",
|
||||||
"description": "Implement '[title]' following this priority: 1) role analysis.md files (requirements, design specs, enhancements from synthesis), 2) guidance-specification.md (finalized decisions with resolved conflicts), 3) context-package.json (smart context, focus paths, patterns). Role analyses are enhanced by synthesis phase with concept improvements and clarifications. If conflict_risk was medium/high, conflict resolutions are already applied in-place.",
|
"description": "Implement feature X using requirements from role analyses and context package",
|
||||||
"modification_points": [
|
"modification_points": [
|
||||||
"Apply requirements and design specs from role analysis documents",
|
"Create 5 command files: [cmd1.md, cmd2.md, cmd3.md, cmd4.md, cmd5.md]",
|
||||||
"Use enhancements and clarifications from synthesis phase",
|
"Modify funcA() in file1.ts lines 10-25: add validation logic",
|
||||||
"Use finalized decisions from guidance-specification.md (includes resolved conflicts)",
|
"Modify funcB() in file2.ts lines 40-60: integrate with new API"
|
||||||
"Use context-package.json for focus paths and dependency resolution",
|
|
||||||
"Consult specific role artifacts for implementation details when needed",
|
|
||||||
"Integrate with existing patterns"
|
|
||||||
],
|
],
|
||||||
"logic_flow": [
|
"logic_flow": [
|
||||||
"Load role analyses (requirements, design, enhancements from synthesis)",
|
"Load role analyses and context package",
|
||||||
"Load guidance-specification.md (finalized decisions with resolved conflicts if any)",
|
"Extract requirements and design decisions",
|
||||||
"Load context-package.json (smart context: focus paths, dependencies, patterns, conflict_risk status)",
|
"Implement commands following existing patterns",
|
||||||
"Extract requirements and design decisions from role documents",
|
"Update functions with new logic",
|
||||||
"Review synthesis enhancements and clarifications",
|
|
||||||
"Use finalized decisions (conflicts already resolved if applicable)",
|
|
||||||
"Identify modification targets using context package",
|
|
||||||
"Implement following role requirements and design specs",
|
|
||||||
"Consult role artifacts for detailed specifications when needed",
|
|
||||||
"Validate against acceptance criteria"
|
"Validate against acceptance criteria"
|
||||||
],
|
],
|
||||||
"depends_on": [],
|
"depends_on": [],
|
||||||
"output": "implementation"
|
"output": "implementation"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"target_files": ["file:function:lines"]
|
"target_files": ["file1.ts:funcA:10-25", "file2.ts:funcB:40-60"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Note**: In CLI Execute Mode (`--cli-execute`), `implementation_approach` steps include a `command` field with the CLI tool invocation (e.g., `bash(codex ...)`).
|
||||||
|
|
||||||
### 6.2. IMPL_PLAN.md Structure
|
### 6.2. IMPL_PLAN.md Structure
|
||||||
This document provides a high-level overview of the entire implementation plan.
|
This document provides a high-level overview of the entire implementation plan.
|
||||||
|
|
||||||
@@ -585,194 +639,7 @@ Artifacts are mapped to tasks based on their relevance to the task's domain.
|
|||||||
|
|
||||||
This ensures that each task has access to the most relevant and detailed specifications from role-specific analyses.
|
This ensures that each task has access to the most relevant and detailed specifications from role-specific analyses.
|
||||||
|
|
||||||
## 8. CLI Execute Mode Details
|
## 8. Error Handling
|
||||||
When using `--cli-execute`, each step in `implementation_approach` includes a `command` field with the execution command.
|
|
||||||
|
|
||||||
**Key Points**:
|
|
||||||
- **Sequential Steps**: Steps execute in order defined in `implementation_approach` array
|
|
||||||
- **Context Delivery**: Each codex command receives context via CONTEXT field: `@{context_package_path}` (role analyses loaded dynamically from context package)- **Multi-Step Tasks**: First step provides full context, subsequent steps use `resume --last` to maintain session continuity
|
|
||||||
- **Step Dependencies**: Later steps reference outputs from earlier steps via `depends_on` field
|
|
||||||
|
|
||||||
### Example 1: Agent Mode - Simple Task (Default, No Command)
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"id": "IMPL-001",
|
|
||||||
"title": "Implement user authentication module",
|
|
||||||
"context_package_path": ".workflow/WFS-session/.process/context-package.json",
|
|
||||||
"context": {
|
|
||||||
"depends_on": [],
|
|
||||||
"focus_paths": ["src/auth"],
|
|
||||||
"requirements": ["JWT-based authentication", "Login and registration endpoints"],
|
|
||||||
"acceptance": [
|
|
||||||
"JWT token generation working",
|
|
||||||
"Login and registration endpoints implemented",
|
|
||||||
"Tests passing with >70% coverage"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"flow_control": {
|
|
||||||
"pre_analysis": [
|
|
||||||
{
|
|
||||||
"step": "load_role_analyses",
|
|
||||||
"action": "Load role analyses from context-package.json",
|
|
||||||
"commands": [
|
|
||||||
"Read({{context_package_path}})",
|
|
||||||
"Extract(brainstorm_artifacts.role_analyses[].files[].path)",
|
|
||||||
"Read(each extracted path)"
|
|
||||||
],
|
|
||||||
"output_to": "role_analyses",
|
|
||||||
"on_error": "fail"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": "load_context",
|
|
||||||
"action": "Load context package for project structure",
|
|
||||||
"commands": ["Read({{context_package_path}})"],
|
|
||||||
"output_to": "context_pkg",
|
|
||||||
"on_error": "fail"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation_approach": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"title": "Implement JWT-based authentication",
|
|
||||||
"description": "Create authentication module using JWT following [role_analyses] requirements and [context_pkg] patterns",
|
|
||||||
"modification_points": [
|
|
||||||
"Create auth service with JWT generation",
|
|
||||||
"Implement login endpoint with credential validation",
|
|
||||||
"Implement registration endpoint with user creation",
|
|
||||||
"Add JWT middleware for route protection"
|
|
||||||
],
|
|
||||||
"logic_flow": [
|
|
||||||
"User registers → validate input → hash password → create user",
|
|
||||||
"User logs in → validate credentials → generate JWT → return token",
|
|
||||||
"Protected routes → validate JWT → extract user → allow access"
|
|
||||||
],
|
|
||||||
"depends_on": [],
|
|
||||||
"output": "auth_implementation"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"target_files": ["src/auth/service.ts", "src/auth/middleware.ts", "src/routes/auth.ts"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 2: CLI Execute Mode - Single Codex Step
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"id": "IMPL-002",
|
|
||||||
"title": "Implement user authentication module",
|
|
||||||
"context_package_path": ".workflow/WFS-session/.process/context-package.json",
|
|
||||||
"context": {
|
|
||||||
"depends_on": [],
|
|
||||||
"focus_paths": ["src/auth"],
|
|
||||||
"requirements": ["JWT-based authentication", "Login and registration endpoints"],
|
|
||||||
"acceptance": ["JWT generation working", "Endpoints implemented", "Tests passing"]
|
|
||||||
},
|
|
||||||
"flow_control": {
|
|
||||||
"pre_analysis": [
|
|
||||||
{
|
|
||||||
"step": "load_role_analyses",
|
|
||||||
"action": "Load role analyses from context-package.json",
|
|
||||||
"commands": [
|
|
||||||
"Read({{context_package_path}})",
|
|
||||||
"Extract(brainstorm_artifacts.role_analyses[].files[].path)",
|
|
||||||
"Read(each extracted path)"
|
|
||||||
],
|
|
||||||
"output_to": "role_analyses",
|
|
||||||
"on_error": "fail"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation_approach": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"title": "Implement authentication with Codex",
|
|
||||||
"description": "Create JWT-based authentication module",
|
|
||||||
"command": "bash(codex -C src/auth --full-auto exec \"PURPOSE: Implement user authentication TASK: JWT-based auth with login/registration MODE: auto CONTEXT: @{{context_package_path}} EXPECTED: Complete auth module with tests RULES: Load role analyses from context-package.json → brainstorm_artifacts\" --skip-git-repo-check -s danger-full-access)",
|
|
||||||
"modification_points": ["Create auth service", "Implement endpoints", "Add JWT middleware"],
|
|
||||||
"logic_flow": ["Validate credentials", "Generate JWT", "Return token"],
|
|
||||||
"depends_on": [],
|
|
||||||
"output": "auth_implementation"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"target_files": ["src/auth/service.ts", "src/auth/middleware.ts"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example 3: CLI Execute Mode - Multi-Step with Resume
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"id": "IMPL-003",
|
|
||||||
"title": "Implement role-based access control",
|
|
||||||
"context_package_path": ".workflow/WFS-session/.process/context-package.json",
|
|
||||||
"context": {
|
|
||||||
"depends_on": ["IMPL-002"],
|
|
||||||
"focus_paths": ["src/auth", "src/middleware"],
|
|
||||||
"requirements": ["User roles and permissions", "Route protection middleware"],
|
|
||||||
"acceptance": ["RBAC models created", "Middleware working", "Management API complete"]
|
|
||||||
},
|
|
||||||
"flow_control": {
|
|
||||||
"pre_analysis": [
|
|
||||||
{
|
|
||||||
"step": "load_context",
|
|
||||||
"action": "Load context and role analyses from context-package.json",
|
|
||||||
"commands": [
|
|
||||||
"Read({{context_package_path}})",
|
|
||||||
"Extract(brainstorm_artifacts.role_analyses[].files[].path)",
|
|
||||||
"Read(each extracted path)"
|
|
||||||
],
|
|
||||||
"output_to": "full_context",
|
|
||||||
"on_error": "fail"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"implementation_approach": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"title": "Create RBAC models",
|
|
||||||
"description": "Define role and permission data models",
|
|
||||||
"command": "bash(codex -C src/auth --full-auto exec \"PURPOSE: Create RBAC models TASK: Role and permission models MODE: auto CONTEXT: @{{context_package_path}} EXPECTED: Models with migrations RULES: Load role analyses from context-package.json → brainstorm_artifacts\" --skip-git-repo-check -s danger-full-access)",
|
|
||||||
"modification_points": ["Define role model", "Define permission model", "Create migrations"],
|
|
||||||
"logic_flow": ["Design schema", "Implement models", "Generate migrations"],
|
|
||||||
"depends_on": [],
|
|
||||||
"output": "rbac_models"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 2,
|
|
||||||
"title": "Implement RBAC middleware",
|
|
||||||
"description": "Create route protection middleware using models from step 1",
|
|
||||||
"command": "bash(codex --full-auto exec \"PURPOSE: Create RBAC middleware TASK: Route protection middleware MODE: auto CONTEXT: RBAC models from step 1 EXPECTED: Middleware for route protection RULES: Use session patterns\" resume --last --skip-git-repo-check -s danger-full-access)",
|
|
||||||
"modification_points": ["Create permission checker", "Add route decorators", "Integrate with auth"],
|
|
||||||
"logic_flow": ["Check user role", "Validate permissions", "Allow/deny access"],
|
|
||||||
"depends_on": [1],
|
|
||||||
"output": "rbac_middleware"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": 3,
|
|
||||||
"title": "Add role management API",
|
|
||||||
"description": "Create CRUD endpoints for roles and permissions",
|
|
||||||
"command": "bash(codex --full-auto exec \"PURPOSE: Role management API TASK: CRUD endpoints for roles/permissions MODE: auto CONTEXT: Models and middleware from previous steps EXPECTED: Complete API with validation RULES: Maintain consistency\" resume --last --skip-git-repo-check -s danger-full-access)",
|
|
||||||
"modification_points": ["Create role endpoints", "Create permission endpoints", "Add validation"],
|
|
||||||
"logic_flow": ["Define routes", "Implement controllers", "Add authorization"],
|
|
||||||
"depends_on": [2],
|
|
||||||
"output": "role_management_api"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"target_files": [
|
|
||||||
"src/models/Role.ts",
|
|
||||||
"src/models/Permission.ts",
|
|
||||||
"src/middleware/rbac.ts",
|
|
||||||
"src/routes/roles.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Pattern Summary**:
|
|
||||||
- **Agent Mode (Example 1)**: No `command` field - agent executes via `modification_points` and `logic_flow`
|
|
||||||
- **CLI Mode Single-Step (Example 2)**: One `command` field with full context package
|
|
||||||
- **CLI Mode Multi-Step (Example 3)**: First step uses full context, subsequent steps use `resume --last`
|
|
||||||
- **Context Delivery**: Context package provided via `@{...}` references in CONTEXT field
|
|
||||||
|
|
||||||
## 9. Error Handling
|
|
||||||
|
|
||||||
### Input Validation Errors
|
### Input Validation Errors
|
||||||
| Error | Cause | Resolution |
|
| Error | Cause | Resolution |
|
||||||
@@ -795,21 +662,19 @@ When using `--cli-execute`, each step in `implementation_approach` includes a `c
|
|||||||
| Invalid format | Corrupted file | Skip artifact loading |
|
| Invalid format | Corrupted file | Skip artifact loading |
|
||||||
| Path invalid | Moved/deleted | Update references |
|
| Path invalid | Moved/deleted | Update references |
|
||||||
|
|
||||||
## 10. Integration & Usage
|
## 10. Usage & Related Commands
|
||||||
|
|
||||||
### Command Chain
|
**Basic Usage**:
|
||||||
- **Called By**: `/workflow:plan` (Phase 4)
|
|
||||||
- **Calls**: None (terminal command)
|
|
||||||
- **Followed By**: `/workflow:execute`, `/workflow:status`
|
|
||||||
|
|
||||||
### Basic Usage
|
|
||||||
```bash
|
```bash
|
||||||
/workflow:tools:task-generate --session WFS-auth
|
/workflow:tools:task-generate --session WFS-auth [--cli-execute]
|
||||||
```
|
```
|
||||||
|
|
||||||
## 11. Related Commands
|
**Workflow Integration**:
|
||||||
- `/workflow:plan` - Orchestrates entire planning
|
- Called by: `/workflow:plan` (task generation phase)
|
||||||
- `/workflow:plan --cli-execute` - Planning with CLI execution mode
|
- Followed by: `/workflow:execute`, `/workflow:status`
|
||||||
- `/workflow:tools:context-gather` - Provides context package
|
|
||||||
- `/workflow:tools:conflict-resolution` - Provides conflict resolution strategies (optional)
|
**Related Commands**:
|
||||||
|
- `/workflow:plan` - Orchestrates entire planning workflow
|
||||||
|
- `/workflow:tools:context-gather` - Provides context package input
|
||||||
|
- `/workflow:tools:conflict-resolution` - Provides conflict resolution (if needed)
|
||||||
- `/workflow:execute` - Executes generated tasks
|
- `/workflow:execute` - Executes generated tasks
|
||||||
|
|||||||
@@ -275,7 +275,3 @@ Overall Compliance: 93/100
|
|||||||
Detailed report: .workflow/WFS-auth/.process/tdd-cycle-report.md
|
Detailed report: .workflow/WFS-auth/.process/tdd-cycle-report.md
|
||||||
```
|
```
|
||||||
|
|
||||||
## Related Commands
|
|
||||||
- `/workflow:tdd-verify` - Uses this tool for verification
|
|
||||||
- `/workflow:tools:task-generate-tdd` - Generates tasks this tool analyzes
|
|
||||||
- `/workflow:execute` - Executes tasks before analysis
|
|
||||||
|
|||||||
@@ -460,8 +460,3 @@ Synthesize Gemini analysis into standardized format:
|
|||||||
- ✅ Execution time < 20 minutes
|
- ✅ Execution time < 20 minutes
|
||||||
- ✅ Output follows existing test conventions
|
- ✅ Output follows existing test conventions
|
||||||
|
|
||||||
## Related Commands
|
|
||||||
|
|
||||||
- `/workflow:tools:test-context-gather` - Provides input context
|
|
||||||
- `/workflow:tools:test-task-generate` - Consumes analysis results
|
|
||||||
- `/workflow:test-gen` - Main test generation workflow
|
|
||||||
|
|||||||
@@ -203,8 +203,3 @@ Refer to `test-context-search-agent.md` Phase 3.2 for complete `test-context-pac
|
|||||||
- **Framework agnostic**: Supports Jest, Mocha, pytest, RSpec, Go testing, etc.
|
- **Framework agnostic**: Supports Jest, Mocha, pytest, RSpec, Go testing, etc.
|
||||||
- **Coverage focus**: Primary goal is identifying implementation files without tests
|
- **Coverage focus**: Primary goal is identifying implementation files without tests
|
||||||
|
|
||||||
## Related Commands
|
|
||||||
|
|
||||||
- `/workflow:test-gen` - Main test generation workflow
|
|
||||||
- `/workflow:tools:test-concept-enhanced` - Test generation analysis
|
|
||||||
- `/workflow:tools:test-task-generate` - Test task JSON generation
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: test-task-generate
|
name: test-task-generate
|
||||||
description: Generate test-fix task JSON with iterative test-fix-retest cycle specification using Gemini/Qwen/Codex
|
description: Autonomous test-fix task generation using action-planning-agent with test-fix-retest cycle specification and discovery phase
|
||||||
argument-hint: "[--use-codex] [--cli-execute] --session WFS-test-session-id"
|
argument-hint: "[--use-codex] [--cli-execute] --session WFS-test-session-id"
|
||||||
examples:
|
examples:
|
||||||
- /workflow:tools:test-task-generate --session WFS-test-auth
|
- /workflow:tools:test-task-generate --session WFS-test-auth
|
||||||
@@ -9,10 +9,23 @@ examples:
|
|||||||
- /workflow:tools:test-task-generate --cli-execute --use-codex --session WFS-test-auth
|
- /workflow:tools:test-task-generate --cli-execute --use-codex --session WFS-test-auth
|
||||||
---
|
---
|
||||||
|
|
||||||
# Test Task Generation Command
|
# Autonomous Test Task Generation Command
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
Generate specialized test-fix task JSON with comprehensive test-fix-retest cycle specification, including Gemini diagnosis (using bug-fix template) and manual fix workflow (Codex automation only when explicitly requested).
|
Autonomous test-fix task JSON generation using action-planning-agent with two-phase execution: discovery and document generation. Supports both agent-driven execution (default) and CLI tool execution modes. Generates specialized test-fix tasks with comprehensive test-fix-retest cycle specification.
|
||||||
|
|
||||||
|
## Core Philosophy
|
||||||
|
- **Agent-Driven**: Delegate execution to action-planning-agent for autonomous operation
|
||||||
|
- **Two-Phase Flow**: Discovery (context gathering) → Output (document generation)
|
||||||
|
- **Memory-First**: Reuse loaded documents from conversation memory
|
||||||
|
- **MCP-Enhanced**: Use MCP tools for advanced code analysis and test research
|
||||||
|
- **Pre-Selected Templates**: Command selects correct test template based on `--cli-execute` flag **before** invoking agent
|
||||||
|
- **Agent Simplicity**: Agent receives pre-selected template and focuses only on content generation
|
||||||
|
- **Path Clarity**: All `focus_paths` prefer absolute paths (e.g., `D:\\project\\src\\module`), or clear relative paths from project root
|
||||||
|
- **Test-First**: Generate comprehensive test coverage before execution
|
||||||
|
- **Iterative Refinement**: Test-fix-retest cycle until all tests pass
|
||||||
|
- **Surgical Fixes**: Minimal code changes, no refactoring during test fixes
|
||||||
|
- **Auto-Revert**: Rollback all changes if max iterations reached
|
||||||
|
|
||||||
## Execution Modes
|
## Execution Modes
|
||||||
|
|
||||||
@@ -24,583 +37,278 @@ Generate specialized test-fix task JSON with comprehensive test-fix-retest cycle
|
|||||||
- **Manual Mode (Default)**: Gemini diagnosis → user applies fixes
|
- **Manual Mode (Default)**: Gemini diagnosis → user applies fixes
|
||||||
- **Codex Mode (`--use-codex`)**: Gemini diagnosis → Codex applies fixes with resume mechanism
|
- **Codex Mode (`--use-codex`)**: Gemini diagnosis → Codex applies fixes with resume mechanism
|
||||||
|
|
||||||
## Core Philosophy
|
|
||||||
- **Analysis-Driven Test Generation**: Use TEST_ANALYSIS_RESULTS.md from test-concept-enhanced
|
|
||||||
- **Agent-Based Test Creation**: Call @code-developer agent for comprehensive test generation
|
|
||||||
- **Coverage-First**: Generate all missing tests before execution
|
|
||||||
- **Test Execution**: Execute complete test suite after generation
|
|
||||||
- **Gemini Diagnosis**: Use Gemini for root cause analysis and fix suggestions (references bug-fix template)
|
|
||||||
- **Manual Fixes First**: Apply fixes manually by default, codex only when explicitly needed
|
|
||||||
- **Iterative Refinement**: Repeat test-analyze-fix-retest cycle until all tests pass
|
|
||||||
- **Surgical Fixes**: Minimal code changes, no refactoring during test fixes
|
|
||||||
- **Auto-Revert**: Rollback all changes if max iterations reached
|
|
||||||
|
|
||||||
## Core Responsibilities
|
|
||||||
- Parse TEST_ANALYSIS_RESULTS.md from test-concept-enhanced
|
|
||||||
- Extract test requirements and generation strategy
|
|
||||||
- Parse `--use-codex` flag to determine fix mode (manual vs automated)
|
|
||||||
- Generate test generation subtask calling @code-developer
|
|
||||||
- Generate test execution and fix cycle task JSON with appropriate fix mode
|
|
||||||
- Configure Gemini diagnosis workflow (bug-fix template) and manual/Codex fix application
|
|
||||||
- Create test-oriented IMPL_PLAN.md and TODO_LIST.md with test generation phase
|
|
||||||
|
|
||||||
## Execution Lifecycle
|
## Execution Lifecycle
|
||||||
|
|
||||||
### Phase 1: Input Validation & Discovery
|
### Phase 1: Discovery & Context Loading
|
||||||
|
**⚡ Memory-First Rule**: Skip file loading if documents already in conversation memory
|
||||||
|
|
||||||
1. **Parameter Parsing**
|
**Agent Context Package**:
|
||||||
- Parse `--use-codex` flag from command arguments → Controls IMPL-002 fix mode
|
```javascript
|
||||||
- Parse `--cli-execute` flag from command arguments → Controls IMPL-001 generation mode
|
|
||||||
- Store flag values for task JSON generation
|
|
||||||
|
|
||||||
2. **Test Session Validation**
|
|
||||||
- Load `.workflow/{test-session-id}/workflow-session.json`
|
|
||||||
- Verify `workflow_type: "test_session"`
|
|
||||||
- Extract `source_session_id` from metadata
|
|
||||||
|
|
||||||
3. **Test Analysis Results Loading**
|
|
||||||
- **REQUIRED**: Load `.workflow/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md`
|
|
||||||
- Parse test requirements by file
|
|
||||||
- Extract test generation strategy
|
|
||||||
- Identify test files to create with specifications
|
|
||||||
|
|
||||||
4. **Test Context Package Loading**
|
|
||||||
- Load `.workflow/{test-session-id}/.process/test-context-package.json`
|
|
||||||
- Extract test framework configuration
|
|
||||||
- Extract coverage gaps and priorities
|
|
||||||
- Load source session implementation summaries
|
|
||||||
|
|
||||||
### Phase 2: Task JSON Generation
|
|
||||||
|
|
||||||
Generate **TWO task JSON files**:
|
|
||||||
1. **IMPL-001.json** - Test Generation (calls @code-developer)
|
|
||||||
2. **IMPL-002.json** - Test Execution and Fix Cycle (calls @test-fix-agent)
|
|
||||||
|
|
||||||
#### IMPL-001.json - Test Generation Task
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
{
|
||||||
"id": "IMPL-001",
|
"session_id": "WFS-test-[session-id]",
|
||||||
"title": "Generate comprehensive tests for [sourceSessionId]",
|
"execution_mode": "agent-mode" | "cli-execute-mode", // Determined by flag
|
||||||
"status": "pending",
|
"task_json_template_path": "~/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt"
|
||||||
"meta": {
|
| "~/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt",
|
||||||
"type": "test-gen",
|
// Path selected by command based on --cli-execute flag, agent reads it
|
||||||
"agent": "@code-developer",
|
"workflow_type": "test_session",
|
||||||
"source_session": "[sourceSessionId]",
|
"use_codex": true | false, // Determined by --use-codex flag
|
||||||
"test_framework": "jest|pytest|cargo|detected"
|
"session_metadata": {
|
||||||
|
// If in memory: use cached content
|
||||||
|
// Else: Load from .workflow/{test-session-id}/workflow-session.json
|
||||||
},
|
},
|
||||||
"context": {
|
"test_analysis_results_path": ".workflow/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md",
|
||||||
"requirements": [
|
"test_analysis_results": {
|
||||||
"Generate comprehensive test files based on TEST_ANALYSIS_RESULTS.md",
|
// If in memory: use cached content
|
||||||
"Follow existing test patterns and conventions from test framework",
|
// Else: Load from TEST_ANALYSIS_RESULTS.md
|
||||||
"Create tests for all missing coverage identified in analysis",
|
|
||||||
"Include happy path, error handling, edge cases, and integration tests",
|
|
||||||
"Use test data and mocks as specified in analysis",
|
|
||||||
"Ensure tests follow project coding standards"
|
|
||||||
],
|
|
||||||
"focus_paths": [
|
|
||||||
"tests/**/*",
|
|
||||||
"src/**/*.test.*",
|
|
||||||
"{paths_from_analysis}"
|
|
||||||
],
|
|
||||||
"acceptance": [
|
|
||||||
"All test files from TEST_ANALYSIS_RESULTS.md section 5 are created",
|
|
||||||
"Tests follow existing test patterns and conventions",
|
|
||||||
"Test scenarios cover happy path, errors, edge cases, integration",
|
|
||||||
"All dependencies are properly mocked",
|
|
||||||
"Test files are syntactically valid and can be executed",
|
|
||||||
"Test coverage meets analysis requirements"
|
|
||||||
],
|
|
||||||
"depends_on": [],
|
|
||||||
"source_context": {
|
|
||||||
"session_id": "[sourceSessionId]",
|
|
||||||
"test_analysis": ".workflow/[testSessionId]/.process/TEST_ANALYSIS_RESULTS.md",
|
|
||||||
"test_context": ".workflow/[testSessionId]/.process/test-context-package.json",
|
|
||||||
"implementation_summaries": [
|
|
||||||
".workflow/[sourceSessionId]/.summaries/IMPL-001-summary.md"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"flow_control": {
|
"test_context_package_path": ".workflow/{test-session-id}/.process/test-context-package.json",
|
||||||
"pre_analysis": [
|
"test_context_package": {
|
||||||
{
|
// Existing test patterns and coverage analysis
|
||||||
"step": "load_test_analysis",
|
},
|
||||||
"action": "Load test generation requirements and strategy",
|
"source_session_id": "[source-session-id]", // if exists
|
||||||
"commands": [
|
"source_session_summaries": {
|
||||||
"Read(.workflow/[testSessionId]/.process/TEST_ANALYSIS_RESULTS.md)",
|
// Implementation context from source session
|
||||||
"Read(.workflow/[testSessionId]/.process/test-context-package.json)"
|
},
|
||||||
],
|
"mcp_capabilities": {
|
||||||
"output_to": "test_generation_requirements",
|
"code_index": true,
|
||||||
"on_error": "fail"
|
"exa_code": true,
|
||||||
},
|
"exa_web": true
|
||||||
{
|
|
||||||
"step": "load_implementation_context",
|
|
||||||
"action": "Load source implementation for test generation context",
|
|
||||||
"commands": [
|
|
||||||
"bash(for f in .workflow/[sourceSessionId]/.summaries/IMPL-*-summary.md; do echo \"=== $(basename $f) ===\"&& cat \"$f\"; done)"
|
|
||||||
],
|
|
||||||
"output_to": "implementation_context",
|
|
||||||
"on_error": "skip_optional"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"step": "load_existing_test_patterns",
|
|
||||||
"action": "Study existing tests for pattern reference",
|
|
||||||
"commands": [
|
|
||||||
"bash(find . -name \"*.test.*\" -type f)",
|
|
||||||
"bash(# Read first 2 existing test files as examples)",
|
|
||||||
"bash(test_files=$(find . -name \"*.test.*\" -type f | head -2))",
|
|
||||||
"bash(for f in $test_files; do echo \"=== $f ===\"&& cat \"$f\"; done)"
|
|
||||||
],
|
|
||||||
"output_to": "existing_test_patterns",
|
|
||||||
"on_error": "skip_optional"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// Agent Mode (Default): Agent implements tests
|
|
||||||
"implementation_approach": [
|
|
||||||
{
|
|
||||||
"step": 1,
|
|
||||||
"title": "Generate comprehensive test suite",
|
|
||||||
"description": "Generate comprehensive test suite based on TEST_ANALYSIS_RESULTS.md. Follow test generation strategy and create all test files listed in section 5 (Implementation Targets).",
|
|
||||||
"modification_points": [
|
|
||||||
"Read TEST_ANALYSIS_RESULTS.md sections 3 and 4",
|
|
||||||
"Study existing test patterns",
|
|
||||||
"Create test files with all required scenarios",
|
|
||||||
"Implement happy path, error handling, edge case, and integration tests",
|
|
||||||
"Add required mocks and fixtures"
|
|
||||||
],
|
|
||||||
"logic_flow": [
|
|
||||||
"Read TEST_ANALYSIS_RESULTS.md section 3 (Test Requirements by File)",
|
|
||||||
"Read TEST_ANALYSIS_RESULTS.md section 4 (Test Generation Strategy)",
|
|
||||||
"Study existing test patterns from test_context.test_framework.conventions",
|
|
||||||
"For each test file in section 5 (Implementation Targets): Create test file with specified scenarios, Implement happy path tests, Implement error handling tests, Implement edge case tests, Implement integration tests (if specified), Add required mocks and fixtures",
|
|
||||||
"Follow test framework conventions and project standards",
|
|
||||||
"Ensure all tests are executable and syntactically valid"
|
|
||||||
],
|
|
||||||
"depends_on": [],
|
|
||||||
"output": "test_suite"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
// CLI Execute Mode (--cli-execute): Use Codex command (alternative format shown below)
|
|
||||||
"implementation_approach": [{
|
|
||||||
"step": 1,
|
|
||||||
"title": "Generate tests using Codex",
|
|
||||||
"description": "Use Codex CLI to autonomously generate comprehensive test suite based on TEST_ANALYSIS_RESULTS.md",
|
|
||||||
"modification_points": [
|
|
||||||
"Codex loads TEST_ANALYSIS_RESULTS.md and existing test patterns",
|
|
||||||
"Codex generates all test files listed in analysis section 5",
|
|
||||||
"Codex ensures tests follow framework conventions"
|
|
||||||
],
|
|
||||||
"logic_flow": [
|
|
||||||
"Start new Codex session",
|
|
||||||
"Pass TEST_ANALYSIS_RESULTS.md to Codex",
|
|
||||||
"Codex studies existing test patterns",
|
|
||||||
"Codex generates comprehensive test suite",
|
|
||||||
"Codex validates test syntax and executability"
|
|
||||||
],
|
|
||||||
"command": "bash(codex -C [focus_paths] --full-auto exec \"PURPOSE: Generate comprehensive test suite TASK: Create test files based on TEST_ANALYSIS_RESULTS.md section 5 MODE: write CONTEXT: @.workflow/WFS-test-[session]/.process/TEST_ANALYSIS_RESULTS.md @.workflow/WFS-test-[session]/.process/test-context-package.json EXPECTED: All test files with happy path, error handling, edge cases, integration tests RULES: Follow test framework conventions, ensure tests are executable\" --skip-git-repo-check -s danger-full-access)",
|
|
||||||
"depends_on": [],
|
|
||||||
"output": "test_generation"
|
|
||||||
}],
|
|
||||||
"target_files": [
|
|
||||||
"{test_file_1 from TEST_ANALYSIS_RESULTS.md section 5}",
|
|
||||||
"{test_file_2 from TEST_ANALYSIS_RESULTS.md section 5}",
|
|
||||||
"{test_file_N from TEST_ANALYSIS_RESULTS.md section 5}"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### IMPL-002.json - Test Execution & Fix Cycle Task
|
**Discovery Actions**:
|
||||||
|
1. **Load Test Session Context** (if not in memory)
|
||||||
|
```javascript
|
||||||
|
if (!memory.has("workflow-session.json")) {
|
||||||
|
Read(.workflow/{test-session-id}/workflow-session.json)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
```json
|
2. **Load TEST_ANALYSIS_RESULTS.md** (if not in memory, REQUIRED)
|
||||||
{
|
```javascript
|
||||||
"id": "IMPL-002",
|
if (!memory.has("TEST_ANALYSIS_RESULTS.md")) {
|
||||||
"title": "Execute and fix tests for [sourceSessionId]",
|
Read(.workflow/{test-session-id}/.process/TEST_ANALYSIS_RESULTS.md)
|
||||||
"status": "pending",
|
}
|
||||||
"meta": {
|
```
|
||||||
"type": "test-fix",
|
|
||||||
"agent": "@test-fix-agent",
|
3. **Load Test Context Package** (if not in memory)
|
||||||
"source_session": "[sourceSessionId]",
|
```javascript
|
||||||
"test_framework": "jest|pytest|cargo|detected",
|
if (!memory.has("test-context-package.json")) {
|
||||||
"max_iterations": 5,
|
Read(.workflow/{test-session-id}/.process/test-context-package.json)
|
||||||
"use_codex": false // Set to true if --use-codex flag present
|
}
|
||||||
},
|
```
|
||||||
"context": {
|
|
||||||
"requirements": [
|
4. **Load Source Session Summaries** (if source_session_id exists)
|
||||||
"Execute complete test suite (generated in IMPL-001)",
|
```javascript
|
||||||
"Diagnose test failures using Gemini analysis with bug-fix template",
|
if (sessionMetadata.source_session_id) {
|
||||||
"Present fixes to user for manual application (default)",
|
const summaryFiles = Bash("find .workflow/{source-session-id}/.summaries/ -name 'IMPL-*-summary.md'")
|
||||||
"Use Codex ONLY if user explicitly requests automation",
|
summaryFiles.forEach(file => Read(file))
|
||||||
"Iterate until all tests pass or max iterations reached",
|
}
|
||||||
"Revert changes if unable to fix within iteration limit"
|
```
|
||||||
],
|
|
||||||
"focus_paths": [
|
5. **Code Analysis with Native Tools** (optional - enhance understanding)
|
||||||
"tests/**/*",
|
```bash
|
||||||
"src/**/*.test.*",
|
# Find test files and patterns
|
||||||
"{implementation_files_from_source_session}"
|
find . -name "*test*" -type f
|
||||||
],
|
rg "describe|it\(|test\(" -g "*.ts"
|
||||||
"acceptance": [
|
```
|
||||||
"All tests pass successfully (100% pass rate)",
|
|
||||||
"No test failures or errors in final run",
|
6. **MCP External Research** (optional - gather test best practices)
|
||||||
"Code changes are minimal and surgical",
|
```javascript
|
||||||
"All fixes are verified through retest",
|
// Get external test examples and patterns
|
||||||
"Iteration logs document fix progression"
|
mcp__exa__get_code_context_exa(
|
||||||
],
|
query="TypeScript test generation best practices jest",
|
||||||
"depends_on": ["IMPL-001"],
|
tokensNum="dynamic"
|
||||||
"source_context": {
|
)
|
||||||
"session_id": "[sourceSessionId]",
|
```
|
||||||
"test_generation_summary": ".workflow/[testSessionId]/.summaries/IMPL-001-summary.md",
|
|
||||||
"implementation_summaries": [
|
### Phase 2: Agent Execution (Document Generation)
|
||||||
".workflow/[sourceSessionId]/.summaries/IMPL-001-summary.md"
|
|
||||||
]
|
**Pre-Agent Template Selection** (Command decides path before invoking agent):
|
||||||
}
|
```javascript
|
||||||
},
|
// Command checks flag and selects template PATH (not content)
|
||||||
"flow_control": {
|
const templatePath = hasCliExecuteFlag
|
||||||
"pre_analysis": [
|
? "~/.claude/workflows/cli-templates/prompts/workflow/task-json-cli-mode.txt"
|
||||||
{
|
: "~/.claude/workflows/cli-templates/prompts/workflow/task-json-agent-mode.txt";
|
||||||
"step": "load_source_session_summaries",
|
```
|
||||||
"action": "Load implementation context from source session",
|
|
||||||
"commands": [
|
**Agent Invocation**:
|
||||||
"bash(find .workflow/[sourceSessionId]/.summaries/ -name 'IMPL-*-summary.md' 2>/dev/null)",
|
```javascript
|
||||||
"bash(for f in .workflow/[sourceSessionId]/.summaries/IMPL-*-summary.md; do echo \"=== $(basename $f) ===\"&& cat \"$f\"; done)"
|
Task(
|
||||||
],
|
subagent_type="action-planning-agent",
|
||||||
"output_to": "implementation_context",
|
description="Generate test-fix task JSON and implementation plan",
|
||||||
"on_error": "skip_optional"
|
prompt=`
|
||||||
},
|
## Execution Context
|
||||||
{
|
|
||||||
"step": "discover_test_framework",
|
**Session ID**: WFS-test-{session-id}
|
||||||
"action": "Identify test framework and test command",
|
**Workflow Type**: Test Session
|
||||||
"commands": [
|
**Execution Mode**: {agent-mode | cli-execute-mode}
|
||||||
"bash(jq -r '.scripts.test // \"npm test\"' package.json 2>/dev/null || echo 'pytest' || echo 'cargo test')",
|
**Task JSON Template Path**: {template_path}
|
||||||
"bash([ -f 'package.json' ] && echo 'jest/npm' || [ -f 'pytest.ini' ] && echo 'pytest' || [ -f 'Cargo.toml' ] && echo 'cargo' || echo 'unknown')"
|
**Use Codex**: {true | false}
|
||||||
],
|
|
||||||
"output_to": "test_command",
|
## Phase 1: Discovery Results (Provided Context)
|
||||||
"on_error": "fail"
|
|
||||||
},
|
### Test Session Metadata
|
||||||
{
|
{session_metadata_content}
|
||||||
"step": "analyze_test_coverage",
|
- source_session_id: {source_session_id} (if exists)
|
||||||
"action": "Analyze test coverage and identify missing tests",
|
- workflow_type: "test_session"
|
||||||
"commands": [
|
|
||||||
"bash(find . -name \"*.test.*\" -type f)",
|
### TEST_ANALYSIS_RESULTS.md (REQUIRED)
|
||||||
"bash(rg \"test|describe|it|def test_\" -g \"*.test.*\")",
|
{test_analysis_results_content}
|
||||||
"bash(# Count implementation files vs test files)",
|
- Coverage Assessment
|
||||||
"bash(impl_count=$(find [changed_files_dirs] -type f \\( -name '*.ts' -o -name '*.js' -o -name '*.py' \\) ! -name '*.test.*' 2>/dev/null | wc -l))",
|
- Test Framework & Conventions
|
||||||
"bash(test_count=$(find . -name \"*.test.*\" -type f | wc -l))",
|
- Test Requirements by File
|
||||||
"bash(echo \"Implementation files: $impl_count, Test files: $test_count\")"
|
- Test Generation Strategy
|
||||||
],
|
- Implementation Targets
|
||||||
"output_to": "test_coverage_analysis",
|
- Success Criteria
|
||||||
"on_error": "skip_optional"
|
|
||||||
},
|
### Test Context Package
|
||||||
{
|
{test_context_package_summary}
|
||||||
"step": "identify_files_without_tests",
|
- Existing test patterns, framework config, coverage analysis
|
||||||
"action": "List implementation files that lack corresponding test files",
|
|
||||||
"commands": [
|
### Source Session Implementation Context (Optional)
|
||||||
"bash(# For each changed file from source session, check if test exists)",
|
{source_session_summaries}
|
||||||
"bash(for file in [changed_files]; do test_file=$(echo $file | sed 's/\\(.*\\)\\.\\(ts\\|js\\|py\\)$/\\1.test.\\2/'); [ ! -f \"$test_file\" ] && echo \"$file\"; done)"
|
- Implementation context from completed session
|
||||||
],
|
|
||||||
"output_to": "files_without_tests",
|
### MCP Analysis Results (Optional)
|
||||||
"on_error": "skip_optional"
|
**Code Structure**: {mcp_code_index_results}
|
||||||
},
|
**External Research**: {mcp_exa_research_results}
|
||||||
{
|
|
||||||
"step": "prepare_test_environment",
|
## Phase 2: Test Task Document Generation
|
||||||
"action": "Ensure test environment is ready",
|
|
||||||
"commands": [
|
**Agent Configuration Reference**: All test task generation rules, test-fix cycle structure, quality standards, and execution details are defined in action-planning-agent.
|
||||||
"bash([ -f 'package.json' ] && npm install 2>/dev/null || true)",
|
|
||||||
"bash([ -f 'requirements.txt' ] && pip install -q -r requirements.txt 2>/dev/null || true)"
|
Refer to: @.claude/agents/action-planning-agent.md for:
|
||||||
],
|
- Test Task Decomposition Standards
|
||||||
"output_to": "environment_status",
|
- Test-Fix-Retest Cycle Requirements
|
||||||
"on_error": "skip_optional"
|
- 5-Field Task JSON Schema
|
||||||
}
|
- IMPL_PLAN.md Structure (Test variant)
|
||||||
],
|
- TODO_LIST.md Format
|
||||||
"implementation_approach": [
|
- Test Execution Flow & Quality Validation
|
||||||
{
|
|
||||||
"step": 1,
|
### Test-Specific Requirements Summary
|
||||||
"title": "Execute iterative test-fix-retest cycle",
|
|
||||||
"description": "Execute iterative test-fix-retest cycle using Gemini diagnosis (bug-fix template) and manual fixes (Codex only if meta.use_codex=true). Max 5 iterations with automatic revert on failure.",
|
#### Task Structure Philosophy
|
||||||
"test_fix_cycle": {
|
- **Minimum 2 tasks**: IMPL-001 (test generation) + IMPL-002 (test execution & fix)
|
||||||
"max_iterations": 5,
|
- **Expandable**: Add IMPL-003+ for complex projects (per-module, integration, etc.)
|
||||||
"cycle_pattern": "test → gemini_diagnose → manual_fix (or codex if needed) → retest",
|
- IMPL-001: Uses @code-developer or CLI execution
|
||||||
"tools": {
|
- IMPL-002: Uses @test-fix-agent with iterative fix cycle
|
||||||
"test_execution": "bash(test_command)",
|
|
||||||
"diagnosis": "gemini (MODE: analysis, uses bug-fix template)",
|
#### Test-Fix Cycle Configuration
|
||||||
"fix_application": "manual (default) or codex exec resume --last (if explicitly needed)",
|
- **Max Iterations**: 5 (for IMPL-002)
|
||||||
"verification": "bash(test_command) + regression_check"
|
- **Diagnosis Tool**: Gemini with bug-fix template
|
||||||
},
|
- **Fix Application**: Manual (default) or Codex (if --use-codex flag)
|
||||||
"exit_conditions": {
|
- **Cycle Pattern**: test → gemini_diagnose → manual_fix (or codex) → retest
|
||||||
"success": "all_tests_pass",
|
- **Exit Conditions**: All tests pass OR max iterations reached (auto-revert)
|
||||||
"failure": "max_iterations_reached",
|
|
||||||
"error": "test_command_not_found"
|
#### Required Outputs Summary
|
||||||
}
|
|
||||||
},
|
##### 1. Test Task JSON Files (.task/IMPL-*.json)
|
||||||
"modification_points": [
|
- **Location**: `.workflow/{test-session-id}/.task/`
|
||||||
"PHASE 1: Initial Test Execution",
|
- **Template**: Read from `{template_path}` (pre-selected by command based on `--cli-execute` flag)
|
||||||
" 1.1. Discover test command from framework detection",
|
- **Schema**: 5-field structure with test-specific metadata
|
||||||
" 1.2. Execute initial test run: bash([test_command])",
|
- IMPL-001: `meta.type: "test-gen"`, `meta.agent: "@code-developer"`
|
||||||
" 1.3. Parse test output and count failures",
|
- IMPL-002: `meta.type: "test-fix"`, `meta.agent: "@test-fix-agent"`, `meta.use_codex: {use_codex}`
|
||||||
" 1.4. If all pass → Skip to PHASE 3 (success)",
|
- `flow_control`: Test generation approach (IMPL-001) or test-fix cycle (IMPL-002)
|
||||||
" 1.5. If failures → Store failure output, proceed to PHASE 2",
|
- **Details**: See action-planning-agent.md § Test Task JSON Generation
|
||||||
"",
|
|
||||||
"PHASE 2: Iterative Test-Fix-Retest Cycle (max 5 iterations)",
|
##### 2. IMPL_PLAN.md (Test Variant)
|
||||||
" Note: This phase handles test failures, NOT test generation failures",
|
- **Location**: `.workflow/{test-session-id}/IMPL_PLAN.md`
|
||||||
" Initialize: max_iterations=5, current_iteration=0",
|
- **Template**: `~/.claude/workflows/cli-templates/prompts/workflow/impl-plan-template.txt`
|
||||||
" ",
|
- **Test-Specific Frontmatter**: workflow_type="test_session", test_framework, source_session_id
|
||||||
" WHILE (tests failing AND current_iteration < max_iterations):",
|
- **Test-Fix-Retest Cycle Section**: Iterative fix cycle with Gemini diagnosis
|
||||||
" current_iteration++",
|
- **Details**: See action-planning-agent.md § Test Implementation Plan Creation
|
||||||
" ",
|
|
||||||
" STEP 2.1: Gemini Diagnosis (using bug-fix template)",
|
##### 3. TODO_LIST.md
|
||||||
" - Prepare diagnosis context:",
|
- **Location**: `.workflow/{test-session-id}/TODO_LIST.md`
|
||||||
" * Test failure output from previous run",
|
- **Format**: Task list with test generation and execution phases
|
||||||
" * Source files from focus_paths",
|
- **Status**: [ ] (pending), [x] (completed)
|
||||||
" * Implementation summaries from source session",
|
- **Details**: See action-planning-agent.md § TODO List Generation
|
||||||
" - Execute Gemini analysis with bug-fix template:",
|
|
||||||
" bash(cd .workflow/WFS-test-[session]/.process && gemini \"",
|
### Agent Execution Summary
|
||||||
" PURPOSE: Diagnose test failure iteration [N] and propose minimal fix",
|
|
||||||
" TASK: Systematic bug analysis and fix recommendations for test failure",
|
**Key Steps** (Detailed instructions in action-planning-agent.md):
|
||||||
" MODE: analysis",
|
1. Load task JSON template from provided path
|
||||||
" CONTEXT: @CLAUDE.md,**/*CLAUDE.md",
|
2. Parse TEST_ANALYSIS_RESULTS.md for test requirements
|
||||||
" Test output: [test_failures]",
|
3. Generate IMPL-001 (test generation) task JSON
|
||||||
" Source files: [focus_paths]",
|
4. Generate IMPL-002 (test execution & fix) task JSON with use_codex flag
|
||||||
" Implementation: [implementation_context]",
|
5. Generate additional IMPL-*.json if project complexity requires
|
||||||
" EXPECTED: Root cause analysis, code path tracing, targeted fixes",
|
6. Create IMPL_PLAN.md using test template variant
|
||||||
" RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/01-diagnose-bug-root-cause.txt) | Bug: [test_failure_description]",
|
7. Generate TODO_LIST.md with test task indicators
|
||||||
" Minimal surgical fixes only - no refactoring",
|
8. Update session state with test metadata
|
||||||
" \" > fix-iteration-[N]-diagnosis.md)",
|
|
||||||
" - Parse diagnosis → extract fix_suggestion and target_files",
|
**Quality Gates** (Full checklist in action-planning-agent.md):
|
||||||
" - Present fix to user for manual application (default)",
|
- ✓ Minimum 2 tasks created (IMPL-001 + IMPL-002)
|
||||||
" ",
|
- ✓ IMPL-001 has test generation approach from TEST_ANALYSIS_RESULTS.md
|
||||||
" STEP 2.2: Apply Fix (Based on meta.use_codex Flag)",
|
- ✓ IMPL-002 has test-fix cycle with correct use_codex flag
|
||||||
" ",
|
- ✓ Test framework configuration integrated
|
||||||
" IF meta.use_codex = false (DEFAULT):",
|
- ✓ Source session context referenced (if exists)
|
||||||
" - Present Gemini diagnosis to user for manual fix",
|
- ✓ MCP tool integration added
|
||||||
" - User applies fix based on diagnosis recommendations",
|
- ✓ Documents follow test template structure
|
||||||
" - Stage changes: bash(git add -A)",
|
|
||||||
" - Store fix log: .process/fix-iteration-[N]-changes.log",
|
## Output
|
||||||
" ",
|
|
||||||
" IF meta.use_codex = true (--use-codex flag present):",
|
Generate all three documents and report completion status:
|
||||||
" - Stage current changes (if valid git repo): bash(git add -A)",
|
- Test task JSON files created: N files (minimum 2)
|
||||||
" - First iteration: Start new Codex session",
|
- Test requirements integrated: TEST_ANALYSIS_RESULTS.md
|
||||||
" codex -C [project_root] --full-auto exec \"",
|
- Test context integrated: existing patterns and coverage
|
||||||
" PURPOSE: Fix test failure iteration 1",
|
- Source session context: {source_session_id} summaries (if exists)
|
||||||
" TASK: [fix_suggestion from Gemini]",
|
- MCP enhancements: code-index, exa-research
|
||||||
" MODE: write",
|
- Session ready for test execution: /workflow:execute or /workflow:test-cycle-execute
|
||||||
" CONTEXT: Diagnosis: .workflow/.process/fix-iteration-1-diagnosis.md",
|
`
|
||||||
" Target files: [target_files]",
|
)
|
||||||
" Implementation context: [implementation_context]",
|
```
|
||||||
" EXPECTED: Minimal code changes to resolve test failure",
|
|
||||||
" RULES: Apply ONLY suggested changes, no refactoring",
|
### Agent Context Passing
|
||||||
" Preserve existing code style",
|
|
||||||
" \" --skip-git-repo-check -s danger-full-access",
|
**Memory-Aware Context Assembly**:
|
||||||
" - Subsequent iterations: Resume session for context continuity",
|
```javascript
|
||||||
" codex exec \"",
|
// Assemble context package for agent
|
||||||
" CONTINUE TO NEXT FIX:",
|
const agentContext = {
|
||||||
" Iteration [N] of 5: Fix test failure",
|
session_id: "WFS-test-[id]",
|
||||||
" ",
|
workflow_type: "test_session",
|
||||||
" PURPOSE: Fix remaining test failures",
|
use_codex: hasUseCodexFlag,
|
||||||
" TASK: [fix_suggestion from Gemini iteration N]",
|
|
||||||
" CONTEXT: Previous fixes applied, diagnosis: .process/fix-iteration-[N]-diagnosis.md",
|
// Use memory if available, else load
|
||||||
" EXPECTED: Surgical fix for current failure",
|
session_metadata: memory.has("workflow-session.json")
|
||||||
" RULES: Build on previous fixes, maintain consistency",
|
? memory.get("workflow-session.json")
|
||||||
" \" resume --last --skip-git-repo-check -s danger-full-access",
|
: Read(.workflow/WFS-test-[id]/workflow-session.json),
|
||||||
" - Store fix log: .process/fix-iteration-[N]-changes.log",
|
|
||||||
" ",
|
test_analysis_results_path: ".workflow/WFS-test-[id]/.process/TEST_ANALYSIS_RESULTS.md",
|
||||||
" STEP 2.3: Retest and Verification",
|
|
||||||
" - Re-execute test suite: bash([test_command])",
|
test_analysis_results: memory.has("TEST_ANALYSIS_RESULTS.md")
|
||||||
" - Capture output: .process/fix-iteration-[N]-retest.log",
|
? memory.get("TEST_ANALYSIS_RESULTS.md")
|
||||||
" - Count failures: bash(grep -c 'FAIL\\|ERROR' .process/fix-iteration-[N]-retest.log)",
|
: Read(".workflow/WFS-test-[id]/.process/TEST_ANALYSIS_RESULTS.md"),
|
||||||
" - Check for regression:",
|
|
||||||
" IF new_failures > previous_failures:",
|
test_context_package_path: ".workflow/WFS-test-[id]/.process/test-context-package.json",
|
||||||
" WARN: Regression detected",
|
|
||||||
" Include in next Gemini diagnosis context",
|
test_context_package: memory.has("test-context-package.json")
|
||||||
" - Analyze results:",
|
? memory.get("test-context-package.json")
|
||||||
" IF all_tests_pass:",
|
: Read(".workflow/WFS-test-[id]/.process/test-context-package.json"),
|
||||||
" BREAK loop → Proceed to PHASE 3",
|
|
||||||
" ELSE:",
|
// Load source session summaries if exists
|
||||||
" Update test_failures context",
|
source_session_id: session_metadata.source_session_id || null,
|
||||||
" CONTINUE loop",
|
|
||||||
" ",
|
source_session_summaries: session_metadata.source_session_id
|
||||||
" IF max_iterations reached AND tests still failing:",
|
? loadSourceSummaries(session_metadata.source_session_id)
|
||||||
" EXECUTE: git reset --hard HEAD (revert all changes)",
|
: null,
|
||||||
" MARK: Task status = blocked",
|
|
||||||
" GENERATE: Detailed failure report with iteration logs",
|
// Optional MCP enhancements
|
||||||
" EXIT: Require manual intervention",
|
mcp_analysis: executeMcpDiscovery()
|
||||||
"",
|
|
||||||
"PHASE 3: Final Validation and Certification",
|
|
||||||
" 3.1. Execute final confirmation test run",
|
|
||||||
" 3.2. Generate success summary:",
|
|
||||||
" - Iterations required: [current_iteration]",
|
|
||||||
" - Fixes applied: [summary from iteration logs]",
|
|
||||||
" - Test results: All passing ✅",
|
|
||||||
" 3.3. Mark task status: completed",
|
|
||||||
" 3.4. Update TODO_LIST.md: Mark as ✅",
|
|
||||||
" 3.5. Certify code: APPROVED for deployment"
|
|
||||||
],
|
|
||||||
"logic_flow": [
|
|
||||||
"Load source session implementation context",
|
|
||||||
"Discover test framework and command",
|
|
||||||
"PHASE 0: Test Coverage Check",
|
|
||||||
" Analyze existing test files",
|
|
||||||
" Identify files without tests",
|
|
||||||
" IF tests missing:",
|
|
||||||
" Report to user (no automatic generation)",
|
|
||||||
" Wait for user to generate tests or request automation",
|
|
||||||
" ELSE:",
|
|
||||||
" Skip to Phase 1",
|
|
||||||
"PHASE 1: Initial Test Execution",
|
|
||||||
" Execute test suite",
|
|
||||||
" IF all pass → Success (Phase 3)",
|
|
||||||
" ELSE → Store failures, proceed to Phase 2",
|
|
||||||
"PHASE 2: Iterative Fix Cycle (max 5 iterations)",
|
|
||||||
" LOOP (max 5 times):",
|
|
||||||
" 1. Gemini diagnoses failure with bug-fix template → fix suggestion",
|
|
||||||
" 2. Check meta.use_codex flag:",
|
|
||||||
" - IF false (default): Present fix to user for manual application",
|
|
||||||
" - IF true (--use-codex): Codex applies fix with resume for continuity",
|
|
||||||
" 3. Retest and check results",
|
|
||||||
" 4. IF pass → Exit loop to Phase 3",
|
|
||||||
" 5. ELSE → Continue with updated context",
|
|
||||||
" IF max iterations → Revert + report failure",
|
|
||||||
"PHASE 3: Final Validation",
|
|
||||||
" Confirm all tests pass",
|
|
||||||
" Generate summary (include test generation info)",
|
|
||||||
" Certify code APPROVED"
|
|
||||||
],
|
|
||||||
"error_handling": {
|
|
||||||
"max_iterations_reached": {
|
|
||||||
"action": "revert_all_changes",
|
|
||||||
"commands": [
|
|
||||||
"bash(git reset --hard HEAD)",
|
|
||||||
"bash(jq '.status = \"blocked\"' .workflow/[session]/.task/IMPL-001.json > temp.json && mv temp.json .workflow/[session]/.task/IMPL-001.json)"
|
|
||||||
],
|
|
||||||
"report": "Generate failure report with iteration logs in .summaries/IMPL-001-failure-report.md"
|
|
||||||
},
|
|
||||||
"test_command_fails": {
|
|
||||||
"action": "treat_as_test_failure",
|
|
||||||
"context": "Use stderr as failure context for Gemini diagnosis"
|
|
||||||
},
|
|
||||||
"codex_apply_fails": {
|
|
||||||
"action": "retry_once_then_skip",
|
|
||||||
"fallback": "Mark iteration as skipped, continue to next"
|
|
||||||
},
|
|
||||||
"gemini_diagnosis_fails": {
|
|
||||||
"action": "retry_with_simplified_context",
|
|
||||||
"fallback": "Use previous diagnosis, continue"
|
|
||||||
},
|
|
||||||
"regression_detected": {
|
|
||||||
"action": "log_warning_continue",
|
|
||||||
"context": "Include regression info in next Gemini diagnosis"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"depends_on": [],
|
|
||||||
"output": "test_fix_results"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"target_files": [
|
|
||||||
"Auto-discovered from test failures",
|
|
||||||
"Extracted from Gemini diagnosis each iteration",
|
|
||||||
"Format: file:function:lines or file (for new files)"
|
|
||||||
],
|
|
||||||
"codex_session": {
|
|
||||||
"strategy": "resume_for_continuity",
|
|
||||||
"first_iteration": "codex exec \"fix iteration 1\" --full-auto",
|
|
||||||
"subsequent_iterations": "codex exec \"fix iteration N\" resume --last",
|
|
||||||
"benefits": [
|
|
||||||
"Maintains conversation context across fixes",
|
|
||||||
"Remembers previous decisions and patterns",
|
|
||||||
"Ensures consistency in fix approach",
|
|
||||||
"Reduces redundant context injection"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Phase 3: IMPL_PLAN.md Generation
|
## Test Task Structure Reference
|
||||||
|
|
||||||
#### Document Structure
|
This section provides quick reference for test task JSON structure. For complete implementation details, see the agent invocation prompt in Phase 2 above.
|
||||||
```markdown
|
|
||||||
---
|
|
||||||
identifier: WFS-test-[session-id]
|
|
||||||
source_session: WFS-[source-session-id]
|
|
||||||
workflow_type: test_session
|
|
||||||
test_framework: jest|pytest|cargo|detected
|
|
||||||
---
|
|
||||||
|
|
||||||
# Test Validation Plan: [Source Session Topic]
|
**Quick Reference**:
|
||||||
|
- Minimum 2 tasks: IMPL-001 (test-gen) + IMPL-002 (test-fix)
|
||||||
## Summary
|
- Expandable for complex projects (IMPL-003+)
|
||||||
Execute comprehensive test suite for implementation from session WFS-[source-session-id].
|
- IMPL-001: `meta.agent: "@code-developer"`, test generation approach
|
||||||
Diagnose and fix all test failures using iterative Gemini analysis and Codex execution.
|
- IMPL-002: `meta.agent: "@test-fix-agent"`, `meta.use_codex: {flag}`, test-fix cycle
|
||||||
|
- See Phase 2 agent prompt for full schema and requirements
|
||||||
## Source Session Context
|
|
||||||
- **Implementation Session**: WFS-[source-session-id]
|
|
||||||
- **Completed Tasks**: IMPL-001, IMPL-002, ...
|
|
||||||
- **Changed Files**: [list from git log]
|
|
||||||
- **Implementation Summaries**: [references to source session summaries]
|
|
||||||
|
|
||||||
## Test Framework
|
|
||||||
- **Detected Framework**: jest|pytest|cargo|other
|
|
||||||
- **Test Command**: npm test|pytest|cargo test
|
|
||||||
- **Test Files**: [discovered test files]
|
|
||||||
- **Coverage**: [estimated test coverage]
|
|
||||||
|
|
||||||
## Test-Fix-Retest Cycle
|
|
||||||
- **Max Iterations**: 5
|
|
||||||
- **Diagnosis Tool**: Gemini (analysis mode with bug-fix template from bug-index.md)
|
|
||||||
- **Fix Tool**: Manual (default, meta.use_codex=false) or Codex (if --use-codex flag, meta.use_codex=true)
|
|
||||||
- **Verification**: Bash test execution + regression check
|
|
||||||
|
|
||||||
### Cycle Workflow
|
|
||||||
1. **Initial Test**: Execute full suite, capture failures
|
|
||||||
2. **Iterative Fix Loop** (max 5 times):
|
|
||||||
- Gemini diagnoses failure using bug-fix template → surgical fix suggestion
|
|
||||||
- Check meta.use_codex flag:
|
|
||||||
- If false (default): Present fix to user for manual application
|
|
||||||
- If true (--use-codex): Codex applies fix with resume for context continuity
|
|
||||||
- Retest and verify (check for regressions)
|
|
||||||
- Continue until all pass or max iterations reached
|
|
||||||
3. **Final Validation**: Confirm all tests pass, certify code
|
|
||||||
|
|
||||||
### Error Recovery
|
|
||||||
- **Max iterations reached**: Revert all changes, report failure
|
|
||||||
- **Test command fails**: Treat as test failure, diagnose with Gemini
|
|
||||||
- **Codex fails**: Retry once, skip iteration if still failing
|
|
||||||
- **Regression detected**: Log warning, include in next diagnosis
|
|
||||||
|
|
||||||
## Task Breakdown
|
|
||||||
- **IMPL-001**: Execute and validate tests with iterative fix cycle
|
|
||||||
|
|
||||||
## Implementation Strategy
|
|
||||||
- **Phase 1**: Initial test execution and failure capture
|
|
||||||
- **Phase 2**: Iterative Gemini diagnosis + Codex fix + retest
|
|
||||||
- **Phase 3**: Final validation and code certification
|
|
||||||
|
|
||||||
## Success Criteria
|
|
||||||
- All tests pass (100% pass rate)
|
|
||||||
- No test failures or errors in final run
|
|
||||||
- Minimal, surgical code changes
|
|
||||||
- Iteration logs document fix progression
|
|
||||||
- Code certified APPROVED for deployment
|
|
||||||
```
|
|
||||||
|
|
||||||
### Phase 4: TODO_LIST.md Generation
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
# Tasks: Test Validation for [Source Session]
|
|
||||||
|
|
||||||
## Task Progress
|
|
||||||
- [ ] **IMPL-001**: Execute and validate tests with iterative fix cycle → [📋](./.task/IMPL-001.json)
|
|
||||||
|
|
||||||
## Execution Details
|
|
||||||
- **Source Session**: WFS-[source-session-id]
|
|
||||||
- **Test Framework**: jest|pytest|cargo
|
|
||||||
- **Max Iterations**: 5
|
|
||||||
- **Tools**: Gemini diagnosis + Codex resume fixes
|
|
||||||
|
|
||||||
## Status Legend
|
|
||||||
- `- [ ]` = Pending
|
|
||||||
- `- [x]` = Completed
|
|
||||||
```
|
|
||||||
|
|
||||||
## Output Files Structure
|
## Output Files Structure
|
||||||
```
|
```
|
||||||
@@ -648,29 +356,42 @@ Diagnose and fix all test failures using iterative Gemini analysis and Codex exe
|
|||||||
## Integration & Usage
|
## Integration & Usage
|
||||||
|
|
||||||
### Command Chain
|
### Command Chain
|
||||||
- **Called By**: `/workflow:test-gen` (Phase 4)
|
- **Called By**: `/workflow:test-gen` (Phase 4), `/workflow:test-fix-gen` (Phase 4)
|
||||||
- **Calls**: None (terminal command)
|
- **Invokes**: `action-planning-agent` for autonomous task generation
|
||||||
- **Followed By**: `/workflow:execute` (user-triggered)
|
- **Followed By**: `/workflow:execute` or `/workflow:test-cycle-execute` (user-triggered)
|
||||||
|
|
||||||
### Basic Usage
|
### Basic Usage
|
||||||
```bash
|
```bash
|
||||||
# Manual fix mode (default)
|
# Agent mode (default, autonomous execution)
|
||||||
/workflow:tools:test-task-generate --session WFS-test-auth
|
/workflow:tools:test-task-generate --session WFS-test-auth
|
||||||
|
|
||||||
# Automated Codex fix mode
|
# With automated Codex fixes for IMPL-002
|
||||||
/workflow:tools:test-task-generate --use-codex --session WFS-test-auth
|
/workflow:tools:test-task-generate --use-codex --session WFS-test-auth
|
||||||
|
|
||||||
|
# CLI execution mode for IMPL-001 test generation
|
||||||
|
/workflow:tools:test-task-generate --cli-execute --session WFS-test-auth
|
||||||
|
|
||||||
|
# Both flags combined
|
||||||
|
/workflow:tools:test-task-generate --cli-execute --use-codex --session WFS-test-auth
|
||||||
```
|
```
|
||||||
|
|
||||||
### Flag Behavior
|
### Execution Modes
|
||||||
- **No flag**: `meta.use_codex=false`, manual fixes presented to user
|
- **Agent mode** (default): Uses `action-planning-agent` with agent-mode task template
|
||||||
- **--use-codex**: `meta.use_codex=true`, Codex automatically applies fixes with resume mechanism
|
- **CLI mode** (`--cli-execute`): Uses Gemini/Qwen/Codex with cli-mode task template for IMPL-001
|
||||||
|
- **Codex fixes** (`--use-codex`): Enables automated fixes in IMPL-002 task
|
||||||
|
|
||||||
## Related Commands
|
### Flag Behavior
|
||||||
- `/workflow:test-gen` - Creates test session and calls this tool
|
- **No flags**: `meta.use_codex=false` (manual fixes), agent-mode generation
|
||||||
- `/workflow:tools:context-gather` - Provides cross-session context
|
- **--use-codex**: `meta.use_codex=true` (Codex automated fixes with resume mechanism in IMPL-002)
|
||||||
- `/workflow:tools:concept-enhanced` - Provides test strategy analysis
|
- **--cli-execute**: Uses CLI tool execution mode for IMPL-001 test generation
|
||||||
- `/workflow:execute` - Executes the generated test-fix task
|
- **Both flags**: CLI generation + automated Codex fixes
|
||||||
- `@test-fix-agent` - Agent that executes the iterative test-fix cycle
|
|
||||||
|
### Output
|
||||||
|
- Test task JSON files in `.task/` directory (minimum 2: IMPL-001.json + IMPL-002.json)
|
||||||
|
- IMPL_PLAN.md with test generation and fix cycle strategy
|
||||||
|
- TODO_LIST.md with test task indicators
|
||||||
|
- Session state updated with test metadata
|
||||||
|
- MCP enhancements integrated (if available)
|
||||||
|
|
||||||
## Agent Execution Notes
|
## Agent Execution Notes
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,10 @@ IF --focus:
|
|||||||
ELSE:
|
ELSE:
|
||||||
focus_types = ["all"] # Extract all animation types
|
focus_types = ["all"] # Extract all animation types
|
||||||
|
|
||||||
# Determine base path
|
# Determine base path (auto-detect and convert to absolute)
|
||||||
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
|
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
|
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
|
||||||
# OR use --base-path / --session parameters
|
# OR use --base-path / --session parameters
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -777,7 +779,7 @@ Next: Animation tokens ready for integration
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Find design directory
|
# Find design directory
|
||||||
bash(find .workflow -type d -name "design-*" | head -1)
|
bash(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
|
||||||
# Create output directories
|
# Create output directories
|
||||||
bash(mkdir -p {base_path}/animation-extraction)
|
bash(mkdir -p {base_path}/animation-extraction)
|
||||||
|
|||||||
@@ -42,9 +42,14 @@ target_type = --target-type OR detect_target_type(target_list)
|
|||||||
IF --base-path:
|
IF --base-path:
|
||||||
base_path = --base-path
|
base_path = --base-path
|
||||||
ELSE IF --session:
|
ELSE IF --session:
|
||||||
bash(find .workflow/WFS-{session} -type d -name "design-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
|
relative_path=$(find .workflow/WFS-{session} -type d -name "design-run-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
|
||||||
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
ELSE:
|
ELSE:
|
||||||
bash(find .workflow -type d -name "design-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
|
relative_path=$(find .workflow -type d -name "design-run-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
|
||||||
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
|
|
||||||
|
# Verify absolute path
|
||||||
|
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
|
||||||
|
|
||||||
# Get variant counts
|
# Get variant counts
|
||||||
style_variants = --style-variants OR bash(ls {base_path}/style-extraction/style-* -d | wc -l)
|
style_variants = --style-variants OR bash(ls {base_path}/style-extraction/style-* -d | wc -l)
|
||||||
@@ -65,31 +70,24 @@ IF exists({base_path}/.intermediates/style-analysis/design-space-analysis.json):
|
|||||||
|
|
||||||
**Output**: `design_tokens_valid`, `design_space_analysis`
|
**Output**: `design_tokens_valid`, `design_space_analysis`
|
||||||
|
|
||||||
### Step 3: Gather Layout Inspiration (Reuse or Create)
|
### Step 3: Gather Layout Inspiration (Direct MCP Search)
|
||||||
```bash
|
```bash
|
||||||
# Check if layout inspirations already exist from layout-extract phase
|
# Gather layout inspiration via MCP for each target
|
||||||
inspiration_source = "{base_path}/.intermediates/layout-analysis/inspirations"
|
layout_inspiration_map = {}
|
||||||
|
|
||||||
FOR target IN target_list:
|
FOR target IN target_list:
|
||||||
# Priority 1: Reuse existing inspiration from layout-extract
|
search_query = "{target} {target_type} layout patterns variations"
|
||||||
IF exists({inspiration_source}/{target}-layout-ideas.txt):
|
search_results = mcp__exa__web_search_exa(query=search_query, numResults=5)
|
||||||
# Reuse existing inspiration (no action needed)
|
|
||||||
REPORT: "Using existing layout inspiration for {target}"
|
|
||||||
ELSE:
|
|
||||||
# Priority 2: Generate new inspiration via MCP
|
|
||||||
bash(mkdir -p {inspiration_source})
|
|
||||||
search_query = "{target} {target_type} layout patterns variations"
|
|
||||||
mcp__exa__web_search_exa(query=search_query, numResults=5)
|
|
||||||
|
|
||||||
# Extract context from prompt for this target
|
# Extract context from prompt for this target
|
||||||
target_requirements = extract_relevant_context_from_prompt(prompt_text, target)
|
target_requirements = extract_relevant_context_from_prompt(prompt_text, target)
|
||||||
|
|
||||||
# Write inspiration file to centralized location
|
# Store inspiration in memory (no file write needed)
|
||||||
Write({inspiration_source}/{target}-layout-ideas.txt, inspiration_content)
|
layout_inspiration_map[target] = format_inspiration_from_search(search_results, target_requirements)
|
||||||
REPORT: "Created new layout inspiration for {target}"
|
REPORT: "Gathered layout inspiration for {target}"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**: `T` inspiration text files (reused or created in `.intermediates/layout-analysis/inspirations/`)
|
**Output**: `layout_inspiration_map` (in-memory, passed to agents)
|
||||||
|
|
||||||
## Phase 2: Target-Style-Centric Batch Generation (Agent)
|
## Phase 2: Target-Style-Centric Batch Generation (Agent)
|
||||||
|
|
||||||
@@ -127,7 +125,7 @@ Task(ui-design-agent): `
|
|||||||
${design_attributes ? "DESIGN_ATTRIBUTES: " + JSON.stringify(design_attributes) : ""}
|
${design_attributes ? "DESIGN_ATTRIBUTES: " + JSON.stringify(design_attributes) : ""}
|
||||||
|
|
||||||
## Reference
|
## Reference
|
||||||
- Layout inspiration: Read("{base_path}/.intermediates/layout-analysis/inspirations/{target}-layout-ideas.txt")
|
- Layout inspiration: {layout_inspiration_map[target]}
|
||||||
- Design tokens: Read("{base_path}/style-extraction/style-{style_id}/design-tokens.json")
|
- Design tokens: Read("{base_path}/style-extraction/style-{style_id}/design-tokens.json")
|
||||||
Parse ALL token values including:
|
Parse ALL token values including:
|
||||||
* colors, typography (with combinations), spacing, opacity
|
* colors, typography (with combinations), spacing, opacity
|
||||||
@@ -274,7 +272,7 @@ Next: /workflow:ui-design:update
|
|||||||
### Path Operations
|
### Path Operations
|
||||||
```bash
|
```bash
|
||||||
# Find design directory
|
# Find design directory
|
||||||
bash(find .workflow -type d -name "design-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
|
bash(find .workflow -type d -name "design-run-*" -printf "%T@ %p\n" | sort -nr | head -1 | cut -d' ' -f2)
|
||||||
|
|
||||||
# Count style variants
|
# Count style variants
|
||||||
bash(ls {base_path}/style-extraction/style-* -d | wc -l)
|
bash(ls {base_path}/style-extraction/style-* -d | wc -l)
|
||||||
@@ -310,8 +308,6 @@ bash(~/.claude/scripts/ui-generate-preview.sh "{base_path}/prototypes")
|
|||||||
{base_path}/
|
{base_path}/
|
||||||
├── .intermediates/
|
├── .intermediates/
|
||||||
│ └── layout-analysis/
|
│ └── layout-analysis/
|
||||||
│ └── inspirations/
|
|
||||||
│ └── {target}-layout-ideas.txt # Layout inspiration (reused or created)
|
|
||||||
├── prototypes/
|
├── prototypes/
|
||||||
│ ├── {target}-style-{s}-layout-{l}.html # Final prototypes
|
│ ├── {target}-style-{s}-layout-{l}.html # Final prototypes
|
||||||
│ ├── {target}-style-{s}-layout-{l}.css
|
│ ├── {target}-style-{s}-layout-{l}.css
|
||||||
|
|||||||
@@ -18,16 +18,18 @@ Batch screenshot tool with MCP-first strategy and multi-tier fallback. Processes
|
|||||||
### Step 1: Determine Base Path
|
### Step 1: Determine Base Path
|
||||||
```bash
|
```bash
|
||||||
# Priority: --base-path > session > standalone
|
# Priority: --base-path > session > standalone
|
||||||
bash(if [ -n "$BASE_PATH" ]; then
|
relative_path=$(if [ -n "$BASE_PATH" ]; then
|
||||||
echo "$BASE_PATH"
|
echo "$BASE_PATH"
|
||||||
elif [ -n "$SESSION_ID" ]; then
|
elif [ -n "$SESSION_ID" ]; then
|
||||||
find .workflow/WFS-$SESSION_ID/design-* -type d | head -1 || \
|
find .workflow/WFS-$SESSION_ID/design-* -type d | head -1 || \
|
||||||
echo ".workflow/WFS-$SESSION_ID/design-run-$(date +%Y%m%d-%H%M%S)"
|
echo ".workflow/WFS-$SESSION_ID/design-run-$(date +%Y%m%d)-$RANDOM"
|
||||||
else
|
else
|
||||||
echo ".workflow/.design/run-$(date +%Y%m%d-%H%M%S)"
|
echo ".workflow/.design/design-run-$(date +%Y%m%d)-$RANDOM"
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
bash(mkdir -p $BASE_PATH/screenshots)
|
# Create directory and convert to absolute path
|
||||||
|
bash(mkdir -p "$relative_path"/screenshots)
|
||||||
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: Parse URL Map
|
### Step 2: Parse URL Map
|
||||||
@@ -187,7 +189,7 @@ bash($chrome --headless --screenshot="$output_file" --window-size=1920,1080 "$ur
|
|||||||
|
|
||||||
Failed URLs:
|
Failed URLs:
|
||||||
home: https://linear.app
|
home: https://linear.app
|
||||||
Save to: .workflow/.design/run-20250110/screenshots/home.png
|
Save to: .workflow/.design/design-run-20250110/screenshots/home.png
|
||||||
|
|
||||||
Steps:
|
Steps:
|
||||||
1. Visit URL in browser
|
1. Visit URL in browser
|
||||||
@@ -270,7 +272,7 @@ Next: /workflow:ui-design:extract --images "screenshots/*.png"
|
|||||||
### Path Operations
|
### Path Operations
|
||||||
```bash
|
```bash
|
||||||
# Find design directory
|
# Find design directory
|
||||||
bash(find .workflow -type d -name "design-*" | head -1)
|
bash(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
|
||||||
# Create screenshot directory
|
# Create screenshot directory
|
||||||
bash(mkdir -p $BASE_PATH/screenshots)
|
bash(mkdir -p $BASE_PATH/screenshots)
|
||||||
|
|||||||
@@ -203,10 +203,13 @@ STORE: device_type, device_source
|
|||||||
|
|
||||||
### Phase 0b: Run Initialization & Directory Setup
|
### Phase 0b: Run Initialization & Directory Setup
|
||||||
```bash
|
```bash
|
||||||
run_id = "run-$(date +%Y%m%d-%H%M%S)"
|
run_id = "run-$(date +%Y%m%d)-$RANDOM"
|
||||||
base_path = --session ? ".workflow/WFS-{session}/design-${run_id}" : ".workflow/.design/${run_id}"
|
relative_base_path = --session ? ".workflow/WFS-{session}/design-${run_id}" : ".workflow/.design/design-${run_id}"
|
||||||
|
|
||||||
Bash(mkdir -p "${base_path}/{style-extraction,style-consolidation,prototypes}")
|
# Create directory and convert to absolute path
|
||||||
|
Bash(mkdir -p "${relative_base_path}/style-extraction")
|
||||||
|
Bash(mkdir -p "${relative_base_path}/prototypes")
|
||||||
|
base_path=$(cd "${relative_base_path}" && pwd)
|
||||||
|
|
||||||
Write({base_path}/.run-metadata.json): {
|
Write({base_path}/.run-metadata.json): {
|
||||||
"run_id": "${run_id}", "session_id": "${session_id}", "timestamp": "...",
|
"run_id": "${run_id}", "session_id": "${session_id}", "timestamp": "...",
|
||||||
@@ -313,7 +316,8 @@ IF design_source IN ["code_only", "hybrid"]:
|
|||||||
# Check file existence and assess completeness
|
# Check file existence and assess completeness
|
||||||
style_exists = exists("{base_path}/style-extraction/style-1/design-tokens.json")
|
style_exists = exists("{base_path}/style-extraction/style-1/design-tokens.json")
|
||||||
animation_exists = exists("{base_path}/animation-extraction/animation-tokens.json")
|
animation_exists = exists("{base_path}/animation-extraction/animation-tokens.json")
|
||||||
layout_exists = exists("{base_path}/layout-extraction/layout-templates.json")
|
layout_count = bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null | wc -l)
|
||||||
|
layout_exists = (layout_count > 0)
|
||||||
|
|
||||||
style_complete = false
|
style_complete = false
|
||||||
animation_complete = false
|
animation_complete = false
|
||||||
@@ -349,14 +353,16 @@ IF design_source IN ["code_only", "hybrid"]:
|
|||||||
|
|
||||||
# Layout completeness check
|
# Layout completeness check
|
||||||
IF layout_exists:
|
IF layout_exists:
|
||||||
layouts = Read("{base_path}/layout-extraction/layout-templates.json")
|
# Read first layout file to verify structure
|
||||||
|
first_layout = bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null | head -1)
|
||||||
|
layout_data = Read(first_layout)
|
||||||
layout_complete = (
|
layout_complete = (
|
||||||
layouts.layout_templates?.length >= 3 &&
|
layout_count >= 1 &&
|
||||||
layouts.extraction_metadata?.layout_system?.type &&
|
layout_data.template?.dom_structure &&
|
||||||
layouts.extraction_metadata?.responsive?.breakpoints
|
layout_data.template?.css_layout_rules
|
||||||
)
|
)
|
||||||
IF NOT layout_complete AND layouts.extraction_metadata?.completeness?.missing_items:
|
IF NOT layout_complete:
|
||||||
missing_categories.extend(layouts.extraction_metadata.completeness.missing_items)
|
missing_categories.push("complete layout structure")
|
||||||
ELSE:
|
ELSE:
|
||||||
missing_categories.push("layout templates")
|
missing_categories.push("layout templates")
|
||||||
|
|
||||||
@@ -384,7 +390,7 @@ IF design_source == "visual_only" OR needs_visual_supplement:
|
|||||||
command = "/workflow:ui-design:style-extract --base-path \"{base_path}\" " +
|
command = "/workflow:ui-design:style-extract --base-path \"{base_path}\" " +
|
||||||
(--images ? "--images \"{images}\" " : "") +
|
(--images ? "--images \"{images}\" " : "") +
|
||||||
(--prompt ? "--prompt \"{prompt}\" " : "") +
|
(--prompt ? "--prompt \"{prompt}\" " : "") +
|
||||||
"--mode explore --variants {style_variants}"
|
"--variants {style_variants}"
|
||||||
SlashCommand(command)
|
SlashCommand(command)
|
||||||
ELSE:
|
ELSE:
|
||||||
REPORT: "✅ Phase 1: Style (Using Code Import)"
|
REPORT: "✅ Phase 1: Style (Using Code Import)"
|
||||||
@@ -413,7 +419,7 @@ IF (design_source == "visual_only" OR needs_visual_supplement) OR (NOT layout_co
|
|||||||
command = "/workflow:ui-design:layout-extract --base-path \"{base_path}\" " +
|
command = "/workflow:ui-design:layout-extract --base-path \"{base_path}\" " +
|
||||||
(--images ? "--images \"{images}\" " : "") +
|
(--images ? "--images \"{images}\" " : "") +
|
||||||
(--prompt ? "--prompt \"{prompt}\" " : "") +
|
(--prompt ? "--prompt \"{prompt}\" " : "") +
|
||||||
"--targets \"{targets_string}\" --mode explore --variants {layout_variants} --device-type \"{device_type}\""
|
"--targets \"{targets_string}\" --variants {layout_variants} --device-type \"{device_type}\""
|
||||||
SlashCommand(command)
|
SlashCommand(command)
|
||||||
ELSE:
|
ELSE:
|
||||||
REPORT: "✅ Phase 2.5: Layout (Using Code Import)"
|
REPORT: "✅ Phase 2.5: Layout (Using Code Import)"
|
||||||
@@ -547,10 +553,11 @@ Architecture: Style-Centric Batch Generation
|
|||||||
Run ID: {run_id} | Session: {session_id or "standalone"}
|
Run ID: {run_id} | Session: {session_id or "standalone"}
|
||||||
Type: {icon} {target_type} | Device: {device_type} | Matrix: {s}×{l}×{n} = {total} prototypes
|
Type: {icon} {target_type} | Device: {device_type} | Matrix: {s}×{l}×{n} = {total} prototypes
|
||||||
|
|
||||||
Phase 1: {s} complete design systems (style-extract)
|
Phase 1: {s} complete design systems (style-extract with multi-select)
|
||||||
Phase 2: {n×l} layout templates (layout-extract explore mode)
|
Phase 2: {n×l} layout templates (layout-extract with multi-select)
|
||||||
- Device: {device_type} layouts
|
- Device: {device_type} layouts
|
||||||
- {n} targets × {l} layout variants = {n×l} structural templates
|
- {n} targets × {l} layout variants = {n×l} structural templates
|
||||||
|
- User-selected concepts generated in parallel
|
||||||
Phase 3: UI Assembly (generate)
|
Phase 3: UI Assembly (generate)
|
||||||
- Pure assembly: layout templates + design tokens
|
- Pure assembly: layout templates + design tokens
|
||||||
- {s}×{l}×{n} = {total} final prototypes
|
- {s}×{l}×{n} = {total} final prototypes
|
||||||
@@ -560,21 +567,22 @@ Phase 4: Brainstorming artifacts updated
|
|||||||
Assembly Process:
|
Assembly Process:
|
||||||
✅ Separation of Concerns: Layout (structure) + Style (tokens) kept separate
|
✅ Separation of Concerns: Layout (structure) + Style (tokens) kept separate
|
||||||
✅ Layout Extraction: {n×l} reusable structural templates
|
✅ Layout Extraction: {n×l} reusable structural templates
|
||||||
|
✅ Multi-Selection Workflow: User selects multiple variants from generated options
|
||||||
✅ Pure Assembly: No design decisions in generate phase
|
✅ Pure Assembly: No design decisions in generate phase
|
||||||
✅ Device-Optimized: Layouts designed for {device_type}
|
✅ Device-Optimized: Layouts designed for {device_type}
|
||||||
|
|
||||||
Design Quality:
|
Design Quality:
|
||||||
✅ Token-Driven Styling: 100% var() usage
|
✅ Token-Driven Styling: 100% var() usage
|
||||||
✅ Structural Variety: {l} distinct layouts per target
|
✅ Structural Variety: {l} distinct layouts per target (user-selected)
|
||||||
✅ Style Variety: {s} independent design systems
|
✅ Style Variety: {s} independent design systems (user-selected)
|
||||||
✅ Device-Optimized: Layouts designed for {device_type}
|
✅ Device-Optimized: Layouts designed for {device_type}
|
||||||
|
|
||||||
📂 {base_path}/
|
📂 {base_path}/
|
||||||
├── .intermediates/ (Intermediate analysis files)
|
├── .intermediates/ (Intermediate analysis files)
|
||||||
│ ├── style-analysis/ (computed-styles.json, design-space-analysis.json)
|
│ ├── style-analysis/ (computed-styles.json, design-space-analysis.json)
|
||||||
│ └── layout-analysis/ (dom-structure-*.json, inspirations/*.txt)
|
│ └── layout-analysis/ (analysis-options.json, user-selection.json, dom-structure-*.json)
|
||||||
├── style-extraction/ ({s} complete design systems)
|
├── style-extraction/ ({s} complete design systems)
|
||||||
├── layout-extraction/ ({n×l} layout templates + layout-space-analysis.json)
|
├── layout-extraction/ ({n×l} layout template files: layout-{target}-{variant}.json)
|
||||||
├── prototypes/ ({total} assembled prototypes)
|
├── prototypes/ ({total} assembled prototypes)
|
||||||
└── .run-metadata.json (includes device type)
|
└── .run-metadata.json (includes device type)
|
||||||
|
|
||||||
|
|||||||
@@ -38,17 +38,21 @@ IF depth NOT IN [1, 2, 3, 4, 5]:
|
|||||||
|
|
||||||
### Step 2: Determine Base Path
|
### Step 2: Determine Base Path
|
||||||
```bash
|
```bash
|
||||||
bash(if [ -n "$BASE_PATH" ]; then
|
relative_path=$(if [ -n "$BASE_PATH" ]; then
|
||||||
echo "$BASE_PATH"
|
echo "$BASE_PATH"
|
||||||
elif [ -n "$SESSION_ID" ]; then
|
elif [ -n "$SESSION_ID" ]; then
|
||||||
find .workflow/WFS-$SESSION_ID/design-* -type d | head -1 || \
|
find .workflow/WFS-$SESSION_ID/design-* -type d | head -1 || \
|
||||||
echo ".workflow/WFS-$SESSION_ID/design-layers-$(date +%Y%m%d-%H%M%S)"
|
echo ".workflow/WFS-$SESSION_ID/design-run-$(date +%Y%m%d)-$RANDOM"
|
||||||
else
|
else
|
||||||
echo ".workflow/.design/layers-$(date +%Y%m%d-%H%M%S)"
|
echo ".workflow/.design/design-run-$(date +%Y%m%d)-$RANDOM"
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
|
# Create directory structure and convert to absolute path
|
||||||
|
bash(mkdir -p "$relative_path")
|
||||||
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
|
|
||||||
# Create depth directories
|
# Create depth directories
|
||||||
bash(for i in $(seq 1 $depth); do mkdir -p $BASE_PATH/screenshots/depth-$i; done)
|
bash(for i in $(seq 1 $depth); do mkdir -p "$base_path"/screenshots/depth-$i; done)
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**: `url`, `depth`, `base_path`
|
**Output**: `url`, `depth`, `base_path`
|
||||||
|
|||||||
@@ -25,11 +25,17 @@ Pure assembler that combines pre-extracted layout templates with design tokens t
|
|||||||
|
|
||||||
### Step 1: Resolve Base Path & Parse Configuration
|
### Step 1: Resolve Base Path & Parse Configuration
|
||||||
```bash
|
```bash
|
||||||
# Determine working directory
|
# Determine working directory (relative path)
|
||||||
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
|
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
|
||||||
|
# Convert to absolute path
|
||||||
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
|
|
||||||
|
# Verify absolute path
|
||||||
|
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
|
||||||
|
|
||||||
# Get style count
|
# Get style count
|
||||||
bash(ls {base_path}/style-extraction/style-* -d | wc -l)
|
bash(ls "$base_path"/style-extraction/style-* -d | wc -l)
|
||||||
|
|
||||||
# Image reference auto-detected from layout template source_image_path
|
# Image reference auto-detected from layout template source_image_path
|
||||||
```
|
```
|
||||||
@@ -263,7 +269,7 @@ Next: /workflow:ui-design:update
|
|||||||
### Path Operations
|
### Path Operations
|
||||||
```bash
|
```bash
|
||||||
# Find design directory
|
# Find design directory
|
||||||
bash(find .workflow -type d -name "design-*" | head -1)
|
bash(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
|
||||||
# Count style variants
|
# Count style variants
|
||||||
bash(ls {base_path}/style-extraction/style-* -d | wc -l)
|
bash(ls {base_path}/style-extraction/style-* -d | wc -l)
|
||||||
|
|||||||
@@ -100,20 +100,21 @@ allowed-tools: SlashCommand(*), TodoWrite(*), Read(*), Write(*), Bash(*)
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Generate run ID
|
# Generate run ID
|
||||||
run_id = "run-$(date +%Y%m%d-%H%M%S)"
|
run_id = "run-$(date +%Y%m%d)-$RANDOM"
|
||||||
|
|
||||||
# Determine base path and session mode
|
# Determine base path and session mode
|
||||||
IF --session:
|
IF --session:
|
||||||
session_id = {provided_session}
|
session_id = {provided_session}
|
||||||
base_path = ".workflow/WFS-{session_id}/design-{run_id}"
|
relative_base_path = ".workflow/WFS-{session_id}/design-{run_id}"
|
||||||
session_mode = "integrated"
|
session_mode = "integrated"
|
||||||
ELSE:
|
ELSE:
|
||||||
session_id = null
|
session_id = null
|
||||||
base_path = ".workflow/.design/{run_id}"
|
relative_base_path = ".workflow/.design/design-{run_id}"
|
||||||
session_mode = "standalone"
|
session_mode = "standalone"
|
||||||
|
|
||||||
# Create base directory
|
# Create base directory and convert to absolute path
|
||||||
Bash(mkdir -p "{base_path}")
|
Bash(mkdir -p "{relative_base_path}")
|
||||||
|
base_path=$(cd "{relative_base_path}" && pwd)
|
||||||
|
|
||||||
# Step 0.1: Intelligent Path Detection
|
# Step 0.1: Intelligent Path Detection
|
||||||
code_files_detected = false
|
code_files_detected = false
|
||||||
@@ -224,8 +225,8 @@ IF design_source == "hybrid":
|
|||||||
REPORT: " → Source: {code_base_path}"
|
REPORT: " → Source: {code_base_path}"
|
||||||
REPORT: " → Mode: Hybrid (Web + Code)"
|
REPORT: " → Mode: Hybrid (Web + Code)"
|
||||||
|
|
||||||
command = "/workflow:ui-design:import-from-code --base-path \"{base_path}\" " +
|
command = "/workflow:ui-design:import-from-code --output-path \"{base_path}\" " +
|
||||||
"--base-path \"{code_base_path}\""
|
"--source-path \"{code_base_path}\""
|
||||||
|
|
||||||
TRY:
|
TRY:
|
||||||
SlashCommand(command)
|
SlashCommand(command)
|
||||||
@@ -238,7 +239,8 @@ IF design_source == "hybrid":
|
|||||||
# Check file existence and assess completeness
|
# Check file existence and assess completeness
|
||||||
style_exists = exists("{base_path}/style-extraction/style-1/design-tokens.json")
|
style_exists = exists("{base_path}/style-extraction/style-1/design-tokens.json")
|
||||||
animation_exists = exists("{base_path}/animation-extraction/animation-tokens.json")
|
animation_exists = exists("{base_path}/animation-extraction/animation-tokens.json")
|
||||||
layout_exists = exists("{base_path}/layout-extraction/layout-templates.json")
|
layout_count = bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null | wc -l)
|
||||||
|
layout_exists = (layout_count > 0)
|
||||||
|
|
||||||
style_complete = false
|
style_complete = false
|
||||||
animation_complete = false
|
animation_complete = false
|
||||||
@@ -274,14 +276,16 @@ IF design_source == "hybrid":
|
|||||||
|
|
||||||
# Layout completeness check
|
# Layout completeness check
|
||||||
IF layout_exists:
|
IF layout_exists:
|
||||||
layouts = Read("{base_path}/layout-extraction/layout-templates.json")
|
# Read first layout file to verify structure
|
||||||
|
first_layout = bash(ls {base_path}/layout-extraction/layout-*.json 2>/dev/null | head -1)
|
||||||
|
layout_data = Read(first_layout)
|
||||||
layout_complete = (
|
layout_complete = (
|
||||||
layouts.layout_templates?.length >= 3 &&
|
layout_count >= 1 &&
|
||||||
layouts.extraction_metadata?.layout_system?.type &&
|
layout_data.template?.dom_structure &&
|
||||||
layouts.extraction_metadata?.responsive?.breakpoints
|
layout_data.template?.css_layout_rules
|
||||||
)
|
)
|
||||||
IF NOT layout_complete AND layouts.extraction_metadata?.completeness?.missing_items:
|
IF NOT layout_complete:
|
||||||
missing_categories.extend(layouts.extraction_metadata.completeness.missing_items)
|
missing_categories.push("complete layout structure")
|
||||||
ELSE:
|
ELSE:
|
||||||
missing_categories.push("layout templates")
|
missing_categories.push("layout templates")
|
||||||
|
|
||||||
@@ -404,7 +408,7 @@ ELSE:
|
|||||||
extraction_prompt = f"Extract visual style tokens from '{primary_target}' with consistency across all pages."
|
extraction_prompt = f"Extract visual style tokens from '{primary_target}' with consistency across all pages."
|
||||||
|
|
||||||
url_map_for_extract = ",".join([f"{name}:{url}" for name, url in url_map.items()])
|
url_map_for_extract = ",".join([f"{name}:{url}" for name, url in url_map.items()])
|
||||||
extract_command = f"/workflow:ui-design:style-extract --base-path \"{base_path}\" --images \"{images_glob}\" --urls \"{url_map_for_extract}\" --prompt \"{extraction_prompt}\" --mode imitate"
|
extract_command = f"/workflow:ui-design:style-extract --base-path \"{base_path}\" --images \"{images_glob}\" --urls \"{url_map_for_extract}\" --prompt \"{extraction_prompt}\" --variants 1"
|
||||||
SlashCommand(extract_command)
|
SlashCommand(extract_command)
|
||||||
|
|
||||||
TodoWrite(mark_completed: "Extract style", mark_in_progress: "Extract animation")
|
TodoWrite(mark_completed: "Extract style", mark_in_progress: "Extract animation")
|
||||||
@@ -435,7 +439,7 @@ IF skip_layout:
|
|||||||
ELSE:
|
ELSE:
|
||||||
REPORT: "🚀 Phase 2.5: Layout Extraction"
|
REPORT: "🚀 Phase 2.5: Layout Extraction"
|
||||||
url_map_for_layout = ",".join([f"{target}:{url}" for target, url in url_map.items()])
|
url_map_for_layout = ",".join([f"{target}:{url}" for target, url in url_map.items()])
|
||||||
layout_extract_command = f"/workflow:ui-design:layout-extract --base-path \"{base_path}\" --images \"{images_glob}\" --urls \"{url_map_for_layout}\" --targets \"{','.join(target_names)}\" --mode imitate"
|
layout_extract_command = f"/workflow:ui-design:layout-extract --base-path \"{base_path}\" --images \"{images_glob}\" --urls \"{url_map_for_layout}\" --targets \"{','.join(target_names)}\" --variants 1"
|
||||||
SlashCommand(layout_extract_command)
|
SlashCommand(layout_extract_command)
|
||||||
|
|
||||||
TodoWrite(mark_completed: "Extract layout", mark_in_progress: "Assemble UI")
|
TodoWrite(mark_completed: "Extract layout", mark_in_progress: "Assemble UI")
|
||||||
@@ -545,7 +549,7 @@ ELSE:
|
|||||||
│ ├── animation-tokens.json
|
│ ├── animation-tokens.json
|
||||||
│ └── animation-guide.md
|
│ └── animation-guide.md
|
||||||
├── layout-extraction/ # Structure templates
|
├── layout-extraction/ # Structure templates
|
||||||
│ └── layout-templates.json
|
│ └── layout-{target}-1.json # One file per target
|
||||||
└── prototypes/ # {generated_count} HTML/CSS files
|
└── prototypes/ # {generated_count} HTML/CSS files
|
||||||
├── {target1}-style-1-layout-1.html + .css
|
├── {target1}-style-1-layout-1.html + .css
|
||||||
├── {target2}-style-1-layout-1.html + .css
|
├── {target2}-style-1-layout-1.html + .css
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: workflow:ui-design:import-from-code
|
name: workflow:ui-design:import-from-code
|
||||||
description: Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis
|
description: Import design system from code files (CSS/JS/HTML/SCSS) using parallel agent analysis with final synthesis
|
||||||
argument-hint: "[--base-path <path>] [--css \"<glob>\"] [--js \"<glob>\"] [--scss \"<glob>\"] [--html \"<glob>\"] [--style-files \"<glob>\"] [--session <id>]"
|
argument-hint: "[--source-path <path>] [--output-path <path>] [--css \"<glob>\"] [--js \"<glob>\"] [--scss \"<glob>\"] [--html \"<glob>\"] [--style-files \"<glob>\"] [--session <id>]"
|
||||||
allowed-tools: Read,Write,Bash,Glob,Grep,Task,TodoWrite
|
allowed-tools: Read,Write,Bash,Glob,Grep,Task,TodoWrite
|
||||||
auto-continue: true
|
auto-continue: true
|
||||||
---
|
---
|
||||||
@@ -34,7 +34,8 @@ Extract design system tokens from source code files (CSS/SCSS/JS/TS/HTML) using
|
|||||||
/workflow:ui-design:import-from-code [FLAGS]
|
/workflow:ui-design:import-from-code [FLAGS]
|
||||||
|
|
||||||
# Flags
|
# Flags
|
||||||
--base-path <path> Base directory for analysis (default: current directory)
|
--source-path <path> Source code directory to analyze (default: current directory)
|
||||||
|
--output-path <path> Output directory for extracted design tokens (default: current directory)
|
||||||
--css "<glob>" CSS file glob pattern (e.g., "theme/*.css")
|
--css "<glob>" CSS file glob pattern (e.g., "theme/*.css")
|
||||||
--scss "<glob>" SCSS file glob pattern (e.g., "styles/*.scss")
|
--scss "<glob>" SCSS file glob pattern (e.g., "styles/*.scss")
|
||||||
--js "<glob>" JavaScript file glob pattern (e.g., "theme/*.js")
|
--js "<glob>" JavaScript file glob pattern (e.g., "theme/*.js")
|
||||||
@@ -47,19 +48,19 @@ Extract design system tokens from source code files (CSS/SCSS/JS/TS/HTML) using
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Basic usage - auto-discover all files
|
# Basic usage - auto-discover all files
|
||||||
/workflow:ui-design:import-from-code --base-path ./
|
/workflow:ui-design:import-from-code --source-path ./src --output-path ./design-system
|
||||||
|
|
||||||
# Target specific directories
|
# Target specific directories
|
||||||
/workflow:ui-design:import-from-code --base-path ./src --css "theme/*.css" --js "theme/*.js"
|
/workflow:ui-design:import-from-code --source-path ./src --output-path ./design-system --css "theme/*.css" --js "theme/*.js"
|
||||||
|
|
||||||
# Tailwind config only
|
# Tailwind config only (output to current directory)
|
||||||
/workflow:ui-design:import-from-code --js "tailwind.config.js"
|
/workflow:ui-design:import-from-code --source-path ./ --js "tailwind.config.js"
|
||||||
|
|
||||||
# CSS framework import
|
# CSS framework import
|
||||||
/workflow:ui-design:import-from-code --css "styles/**/*.scss" --html "components/**/*.html"
|
/workflow:ui-design:import-from-code --source-path ./src --output-path ./design-system --css "styles/**/*.scss" --html "components/**/*.html"
|
||||||
|
|
||||||
# Universal style files
|
# Universal style files
|
||||||
/workflow:ui-design:import-from-code --style-files "**/theme.*"
|
/workflow:ui-design:import-from-code --source-path ./src --output-path ./design-system --style-files "**/theme.*"
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -74,11 +75,12 @@ Extract design system tokens from source code files (CSS/SCSS/JS/TS/HTML) using
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Initialize directories
|
# 1. Initialize directories
|
||||||
base_path="${base_path:-.}"
|
source_path="${source_path:-.}"
|
||||||
intermediates_dir="${base_path}/.intermediates/import-analysis"
|
output_path="${output_path:-.}"
|
||||||
|
intermediates_dir="${output_path}/.intermediates/import-analysis"
|
||||||
mkdir -p "$intermediates_dir"
|
mkdir -p "$intermediates_dir"
|
||||||
|
|
||||||
echo "[Phase 0] File Discovery Started"
|
echo "[Phase 0] File Discovery Started (source: $source_path, output: $output_path)"
|
||||||
```
|
```
|
||||||
|
|
||||||
<!-- TodoWrite: Initialize todo list -->
|
<!-- TodoWrite: Initialize todo list -->
|
||||||
@@ -95,7 +97,7 @@ echo "[Phase 0] File Discovery Started"
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 2. Discover files by type
|
# 2. Discover files by type
|
||||||
cd "$base_path" || exit 1
|
cd "$source_path" || exit 1
|
||||||
|
|
||||||
# CSS files
|
# CSS files
|
||||||
if [ -n "$css" ]; then
|
if [ -n "$css" ]; then
|
||||||
@@ -181,7 +183,7 @@ Task(ui-design-agent): `
|
|||||||
[STYLE_TOKENS_EXTRACTION]
|
[STYLE_TOKENS_EXTRACTION]
|
||||||
Extract visual design tokens (colors, typography, spacing, shadows, borders) from ALL file types
|
Extract visual design tokens (colors, typography, spacing, shadows, borders) from ALL file types
|
||||||
|
|
||||||
MODE: style-extraction | BASE_PATH: ${base_path}
|
MODE: style-extraction | SOURCE_PATH: ${source_path} | OUTPUT_PATH: ${output_path}
|
||||||
|
|
||||||
## Input Files (Can reference ANY file type)
|
## Input Files (Can reference ANY file type)
|
||||||
|
|
||||||
@@ -208,7 +210,7 @@ Task(ui-design-agent): `
|
|||||||
|
|
||||||
## Output Requirements
|
## Output Requirements
|
||||||
|
|
||||||
Generate 2 files in ${base_path}/style-extraction/style-1/:
|
Generate 2 files in ${output_path}/style-extraction/style-1/:
|
||||||
1. design-tokens.json (production-ready design tokens)
|
1. design-tokens.json (production-ready design tokens)
|
||||||
2. style-guide.md (design philosophy and usage guide)
|
2. style-guide.md (design philosophy and usage guide)
|
||||||
|
|
||||||
@@ -357,13 +359,13 @@ Task(ui-design-agent): `
|
|||||||
|
|
||||||
## Critical Requirements
|
## Critical Requirements
|
||||||
- ✅ Can read ANY file type (CSS/SCSS/JS/TS/HTML) - not restricted to CSS only
|
- ✅ Can read ANY file type (CSS/SCSS/JS/TS/HTML) - not restricted to CSS only
|
||||||
- ✅ Use Read() tool for each file you want to analyze
|
- ✅ Use Read() tool for each file you want to analyze (files are in SOURCE_PATH: ${source_path})
|
||||||
- ✅ Cross-reference between file types for better extraction
|
- ✅ Cross-reference between file types for better extraction
|
||||||
- ✅ Extract all visual token types systematically
|
- ✅ Extract all visual token types systematically
|
||||||
- ✅ Create style-extraction/style-1/ directory first: Bash(mkdir -p "${base_path}/style-extraction/style-1")
|
- ✅ Create style-extraction/style-1/ directory first: Bash(mkdir -p "${output_path}/style-extraction/style-1")
|
||||||
- ✅ Use Write() to save both files:
|
- ✅ Use Write() to save both files:
|
||||||
- ${base_path}/style-extraction/style-1/design-tokens.json
|
- ${output_path}/style-extraction/style-1/design-tokens.json
|
||||||
- ${base_path}/style-extraction/style-1/style-guide.md
|
- ${output_path}/style-extraction/style-1/style-guide.md
|
||||||
- ✅ Include _metadata.completeness field to track missing content
|
- ✅ Include _metadata.completeness field to track missing content
|
||||||
- ❌ NO external research or MCP calls
|
- ❌ NO external research or MCP calls
|
||||||
`
|
`
|
||||||
@@ -378,7 +380,7 @@ Task(ui-design-agent): `
|
|||||||
[ANIMATION_TOKENS_EXTRACTION]
|
[ANIMATION_TOKENS_EXTRACTION]
|
||||||
Extract animation/transition tokens from ALL file types
|
Extract animation/transition tokens from ALL file types
|
||||||
|
|
||||||
MODE: animation-extraction | BASE_PATH: ${base_path}
|
MODE: animation-extraction | SOURCE_PATH: ${source_path} | OUTPUT_PATH: ${output_path}
|
||||||
|
|
||||||
## Input Files (Can reference ANY file type)
|
## Input Files (Can reference ANY file type)
|
||||||
|
|
||||||
@@ -405,7 +407,7 @@ Task(ui-design-agent): `
|
|||||||
|
|
||||||
## Output Requirements
|
## Output Requirements
|
||||||
|
|
||||||
Generate 2 files in ${base_path}/animation-extraction/:
|
Generate 2 files in ${output_path}/animation-extraction/:
|
||||||
1. animation-tokens.json (production-ready animation tokens)
|
1. animation-tokens.json (production-ready animation tokens)
|
||||||
2. animation-guide.md (animation usage guide)
|
2. animation-guide.md (animation usage guide)
|
||||||
|
|
||||||
@@ -530,13 +532,13 @@ Task(ui-design-agent): `
|
|||||||
|
|
||||||
## Critical Requirements
|
## Critical Requirements
|
||||||
- ✅ Can read ANY file type (CSS/SCSS/JS/TS/HTML)
|
- ✅ Can read ANY file type (CSS/SCSS/JS/TS/HTML)
|
||||||
- ✅ Use Read() tool for each file you want to analyze
|
- ✅ Use Read() tool for each file you want to analyze (files are in SOURCE_PATH: ${source_path})
|
||||||
- ✅ Detect animation framework if used
|
- ✅ Detect animation framework if used
|
||||||
- ✅ Extract all animation-related tokens
|
- ✅ Extract all animation-related tokens
|
||||||
- ✅ Create animation-extraction/ directory first: Bash(mkdir -p "${base_path}/animation-extraction")
|
- ✅ Create animation-extraction/ directory first: Bash(mkdir -p "${output_path}/animation-extraction")
|
||||||
- ✅ Use Write() to save both files:
|
- ✅ Use Write() to save both files:
|
||||||
- ${base_path}/animation-extraction/animation-tokens.json
|
- ${output_path}/animation-extraction/animation-tokens.json
|
||||||
- ${base_path}/animation-extraction/animation-guide.md
|
- ${output_path}/animation-extraction/animation-guide.md
|
||||||
- ✅ Include _metadata.completeness field to track missing content
|
- ✅ Include _metadata.completeness field to track missing content
|
||||||
- ❌ NO external research or MCP calls
|
- ❌ NO external research or MCP calls
|
||||||
`
|
`
|
||||||
@@ -551,7 +553,7 @@ Task(ui-design-agent): `
|
|||||||
[LAYOUT_PATTERNS_EXTRACTION]
|
[LAYOUT_PATTERNS_EXTRACTION]
|
||||||
Extract layout patterns and component structures from ALL file types
|
Extract layout patterns and component structures from ALL file types
|
||||||
|
|
||||||
MODE: layout-extraction | BASE_PATH: ${base_path}
|
MODE: layout-extraction | SOURCE_PATH: ${source_path} | OUTPUT_PATH: ${output_path}
|
||||||
|
|
||||||
## Input Files (Can reference ANY file type)
|
## Input Files (Can reference ANY file type)
|
||||||
|
|
||||||
@@ -578,7 +580,7 @@ Task(ui-design-agent): `
|
|||||||
|
|
||||||
## Output Requirements
|
## Output Requirements
|
||||||
|
|
||||||
Generate 1 file: ${base_path}/layout-extraction/layout-templates.json
|
Generate 1 file: ${output_path}/layout-extraction/layout-templates.json
|
||||||
|
|
||||||
### layout-templates.json Structure:
|
### layout-templates.json Structure:
|
||||||
{
|
{
|
||||||
@@ -675,11 +677,11 @@ Task(ui-design-agent): `
|
|||||||
|
|
||||||
## Critical Requirements
|
## Critical Requirements
|
||||||
- ✅ Can read ANY file type (CSS/SCSS/JS/TS/HTML)
|
- ✅ Can read ANY file type (CSS/SCSS/JS/TS/HTML)
|
||||||
- ✅ Use Read() tool for each file you want to analyze
|
- ✅ Use Read() tool for each file you want to analyze (files are in SOURCE_PATH: ${source_path})
|
||||||
- ✅ Identify naming conventions and layout systems
|
- ✅ Identify naming conventions and layout systems
|
||||||
- ✅ Extract component patterns with variants and states
|
- ✅ Extract component patterns with variants and states
|
||||||
- ✅ Create layout-extraction/ directory first: Bash(mkdir -p "${base_path}/layout-extraction")
|
- ✅ Create layout-extraction/ directory first: Bash(mkdir -p "${output_path}/layout-extraction")
|
||||||
- ✅ Use Write() to save: ${base_path}/layout-extraction/layout-templates.json
|
- ✅ Use Write() to save: ${output_path}/layout-extraction/layout-templates.json
|
||||||
- ✅ Include extraction_metadata.completeness field to track missing content
|
- ✅ Include extraction_metadata.completeness field to track missing content
|
||||||
- ❌ NO external research or MCP calls
|
- ❌ NO external research or MCP calls
|
||||||
`
|
`
|
||||||
@@ -710,11 +712,11 @@ echo "[Phase 1] Parallel agent analysis complete"
|
|||||||
|
|
||||||
### Generated Files
|
### Generated Files
|
||||||
|
|
||||||
**Location**: `${base_path}/`
|
**Location**: `${output_path}/`
|
||||||
|
|
||||||
**Directory Structure**:
|
**Directory Structure**:
|
||||||
```
|
```
|
||||||
${base_path}/
|
${output_path}/
|
||||||
├── style-extraction/
|
├── style-extraction/
|
||||||
│ └── style-1/
|
│ └── style-1/
|
||||||
│ ├── design-tokens.json # Production-ready design tokens
|
│ ├── design-tokens.json # Production-ready design tokens
|
||||||
@@ -769,7 +771,7 @@ ${base_path}/
|
|||||||
|
|
||||||
| Error | Cause | Resolution |
|
| Error | Cause | Resolution |
|
||||||
|-------|-------|------------|
|
|-------|-------|------------|
|
||||||
| No files discovered | Glob patterns too restrictive or wrong base-path | Check glob patterns and base-path, verify file locations |
|
| No files discovered | Glob patterns too restrictive or wrong source-path | Check glob patterns and source-path, verify file locations |
|
||||||
| Agent reports "failed" status | No tokens found in any file | Review file content, check if files contain design tokens |
|
| Agent reports "failed" status | No tokens found in any file | Review file content, check if files contain design tokens |
|
||||||
| Empty completeness reports | Files exist but contain no extractable tokens | Manually verify token definitions in source files |
|
| Empty completeness reports | Files exist but contain no extractable tokens | Manually verify token definitions in source files |
|
||||||
| Missing file type | Specific file type not discovered | Use explicit glob flags (--css, --js, --html, --scss) |
|
| Missing file type | Specific file type not discovered | Use explicit glob flags (--css, --js, --html, --scss) |
|
||||||
@@ -779,7 +781,8 @@ ${base_path}/
|
|||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
1. **Use auto-discovery for full projects**: Omit glob flags to discover all files automatically
|
1. **Use auto-discovery for full projects**: Omit glob flags to discover all files automatically
|
||||||
2. **Target specific directories for speed**: Use `--base-path` + specific globs for focused analysis
|
2. **Target specific directories for speed**: Use `--source-path` to target source code and `--output-path` for extracted tokens, combined with specific globs for focused analysis
|
||||||
3. **Cross-reference agent reports**: Compare all three completeness reports to identify gaps
|
3. **Separate source and output**: Always use distinct `--source-path` (where source code lives) and `--output-path` (where design tokens are generated) to avoid polluting source code directory
|
||||||
4. **Review missing content**: Check `missing` field in reports for actionable improvements
|
4. **Cross-reference agent reports**: Compare all three completeness reports to identify gaps
|
||||||
5. **Verify file discovery**: Check `.intermediates/import-analysis/*-files.txt` if agents report no data
|
5. **Review missing content**: Check `missing` field in reports for actionable improvements
|
||||||
|
6. **Verify file discovery**: Check `${output_path}/.intermediates/import-analysis/*-files.txt` if agents report no data
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: layout-extract
|
name: layout-extract
|
||||||
description: Extract structural layout information from reference images, URLs, or text prompts using Claude analysis
|
description: Extract structural layout information from reference images, URLs, or text prompts using Claude analysis
|
||||||
argument-hint: [--base-path <path>] [--session <id>] [--images "<glob>"] [--urls "<list>"] [--prompt "<desc>"] [--targets "<list>"] [--mode <imitate|explore>] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]
|
argument-hint: [--base-path <path>] [--session <id>] [--images "<glob>"] [--urls "<list>"] [--prompt "<desc>"] [--targets "<list>"] [--variants <count>] [--device-type <desktop|mobile|tablet|responsive>]
|
||||||
allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), Bash(*), Task(ui-design-agent), mcp__exa__web_search_exa(*)
|
allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), Bash(*), Task(ui-design-agent), mcp__exa__web_search_exa(*)
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -14,10 +14,8 @@ Extract structural layout information from reference images, URLs, or text promp
|
|||||||
**Strategy**: AI-Driven Structural Analysis
|
**Strategy**: AI-Driven Structural Analysis
|
||||||
|
|
||||||
- **Agent-Powered**: Uses `ui-design-agent` for deep structural analysis
|
- **Agent-Powered**: Uses `ui-design-agent` for deep structural analysis
|
||||||
- **Dual-Mode**:
|
- **Behavior**: Generate N layout concepts → User multi-select → Generate selected templates
|
||||||
- `imitate`: High-fidelity replication of single layout structure
|
- **Output**: `layout-templates.json` with DOM structure, component hierarchy, and CSS layout rules
|
||||||
- `explore`: Multiple structurally distinct layout variations
|
|
||||||
- **Single Output**: `layout-templates.json` with DOM structure, component hierarchy, and CSS layout rules
|
|
||||||
- **Device-Aware**: Optimized for specific device types (desktop, mobile, tablet, responsive)
|
- **Device-Aware**: Optimized for specific device types (desktop, mobile, tablet, responsive)
|
||||||
- **Token-Based**: CSS uses `var()` placeholders for spacing and breakpoints
|
- **Token-Based**: CSS uses `var()` placeholders for spacing and breakpoints
|
||||||
|
|
||||||
@@ -45,15 +43,10 @@ ELSE:
|
|||||||
has_urls = false
|
has_urls = false
|
||||||
url_list = []
|
url_list = []
|
||||||
|
|
||||||
# Determine extraction mode
|
# Set variants count (default: 3, range: 1-5)
|
||||||
extraction_mode = --mode OR "imitate" # "imitate" or "explore"
|
# Behavior: Generate N layout concepts per target → User multi-select → Generate selected templates
|
||||||
|
variants_count = --variants OR 3
|
||||||
# Set variants count based on mode
|
VALIDATE: 1 <= variants_count <= 5
|
||||||
IF extraction_mode == "imitate":
|
|
||||||
variants_count = 1 # Force single variant (ignore --variants)
|
|
||||||
ELSE IF extraction_mode == "explore":
|
|
||||||
variants_count = --variants OR 3 # Default to 3
|
|
||||||
VALIDATE: 1 <= variants_count <= 5
|
|
||||||
|
|
||||||
# Resolve targets
|
# Resolve targets
|
||||||
# Priority: --targets → url_list targets → prompt analysis → default ["page"]
|
# Priority: --targets → url_list targets → prompt analysis → default ["page"]
|
||||||
@@ -62,6 +55,9 @@ IF --targets:
|
|||||||
ELSE IF has_urls:
|
ELSE IF has_urls:
|
||||||
targets = [url_info.target for url_info in url_list]
|
targets = [url_info.target for url_info in url_list]
|
||||||
ELSE IF --prompt:
|
ELSE IF --prompt:
|
||||||
|
# Extract targets from prompt using pattern matching
|
||||||
|
# Looks for keywords: "page names", target descriptors (login, dashboard, etc.)
|
||||||
|
# Returns lowercase, hyphenated strings (e.g., ["login", "dashboard"])
|
||||||
targets = extract_from_prompt(--prompt)
|
targets = extract_from_prompt(--prompt)
|
||||||
ELSE:
|
ELSE:
|
||||||
targets = ["page"]
|
targets = ["page"]
|
||||||
@@ -69,8 +65,10 @@ ELSE:
|
|||||||
# Resolve device type
|
# Resolve device type
|
||||||
device_type = --device-type OR "responsive" # desktop|mobile|tablet|responsive
|
device_type = --device-type OR "responsive" # desktop|mobile|tablet|responsive
|
||||||
|
|
||||||
# Determine base path
|
# Determine base path (auto-detect and convert to absolute)
|
||||||
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
|
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
|
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
|
||||||
# OR use --base-path / --session parameters
|
# OR use --base-path / --session parameters
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -188,36 +186,17 @@ IF result.exploration?.triggered:
|
|||||||
IF session_has_inputs: SKIP Step 2 file reading
|
IF session_has_inputs: SKIP Step 2 file reading
|
||||||
|
|
||||||
# 2. Check if output already exists
|
# 2. Check if output already exists
|
||||||
bash(test -f {base_path}/layout-extraction/layout-templates.json && echo "exists")
|
bash(find {base_path}/layout-extraction -name "layout-*.json" -print -quit | grep -q . && echo "exists")
|
||||||
IF exists: SKIP to completion
|
IF exists: SKIP to completion
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Phase 0 Output**: `input_mode`, `base_path`, `extraction_mode`, `variants_count`, `targets[]`, `device_type`, loaded inputs
|
**Phase 0 Output**: `input_mode`, `base_path`, `variants_count`, `targets[]`, `device_type`, loaded inputs
|
||||||
|
|
||||||
## Phase 1: Layout Concept Generation (Explore Mode Only)
|
## Phase 1: Layout Concept Generation
|
||||||
|
|
||||||
### Step 1: Check Extraction Mode
|
### Step 1: Generate Layout Concept Options (Agent Task 1)
|
||||||
```bash
|
|
||||||
# extraction_mode == "imitate" → skip this phase
|
|
||||||
# extraction_mode == "explore" → execute this phase
|
|
||||||
```
|
|
||||||
|
|
||||||
**If imitate mode**: Skip to Phase 2
|
|
||||||
|
|
||||||
### Step 2: Gather Layout Inspiration (Explore Mode)
|
|
||||||
```bash
|
|
||||||
bash(mkdir -p {base_path}/.intermediates/layout-analysis/inspirations)
|
|
||||||
|
|
||||||
# For each target: Research via MCP
|
|
||||||
# mcp__exa__web_search_exa(query="{target} layout patterns {device_type}", numResults=5)
|
|
||||||
|
|
||||||
# Write inspiration file
|
|
||||||
Write({base_path}/.intermediates/layout-analysis/inspirations/{target}-layout-ideas.txt, inspiration_content)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 3: Generate Layout Concept Options (Agent Task 1)
|
|
||||||
**Executor**: `Task(ui-design-agent)`
|
**Executor**: `Task(ui-design-agent)`
|
||||||
|
|
||||||
Launch agent to generate `variants_count` layout concept options for each target:
|
Launch agent to generate `variants_count` layout concept options for each target:
|
||||||
@@ -233,7 +212,6 @@ Task(ui-design-agent): `
|
|||||||
## Input Analysis
|
## Input Analysis
|
||||||
- Targets: {targets.join(", ")}
|
- Targets: {targets.join(", ")}
|
||||||
- Device type: {device_type}
|
- Device type: {device_type}
|
||||||
- Layout inspiration: Read inspirations from {base_path}/.intermediates/layout-analysis/inspirations/
|
|
||||||
- Visual references: {loaded_images if available}
|
- Visual references: {loaded_images if available}
|
||||||
${dom_structure_available ? "- DOM Structure: Read from .intermediates/layout-analysis/dom-structure-*.json" : ""}
|
${dom_structure_available ? "- DOM Structure: Read from .intermediates/layout-analysis/dom-structure-*.json" : ""}
|
||||||
|
|
||||||
@@ -270,7 +248,7 @@ Task(ui-design-agent): `
|
|||||||
`
|
`
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Verify Options File Created
|
### Step 2: Verify Options File Created
|
||||||
```bash
|
```bash
|
||||||
bash(test -f {base_path}/.intermediates/layout-analysis/analysis-options.json && echo "created")
|
bash(test -f {base_path}/.intermediates/layout-analysis/analysis-options.json && echo "created")
|
||||||
|
|
||||||
@@ -331,13 +309,13 @@ Please select your preferred concept for this target.
|
|||||||
|
|
||||||
### Step 3: Capture User Selection (Per Target)
|
### Step 3: Capture User Selection (Per Target)
|
||||||
```javascript
|
```javascript
|
||||||
// Use AskUserQuestion tool for each target
|
// Use AskUserQuestion tool for each target (multi-select enabled)
|
||||||
FOR each target:
|
FOR each target:
|
||||||
AskUserQuestion({
|
AskUserQuestion({
|
||||||
questions: [{
|
questions: [{
|
||||||
question: "Which layout concept do you prefer for '{target}'?",
|
question: "Which layout concept(s) do you prefer for '{target}'?",
|
||||||
header: "Layout for " + target,
|
header: "Layout for " + target,
|
||||||
multiSelect: false,
|
multiSelect: true, // Multi-selection enabled (default behavior)
|
||||||
options: [
|
options: [
|
||||||
{FOR each concept in layout_concepts[target]:
|
{FOR each concept in layout_concepts[target]:
|
||||||
label: "Concept {concept.index}: {concept.concept_name}",
|
label: "Concept {concept.index}: {concept.concept_name}",
|
||||||
@@ -347,39 +325,47 @@ FOR each target:
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
// Parse user response
|
// Parse user response (array of selections)
|
||||||
selected_option_text = user_answer
|
selected_options = user_answer
|
||||||
|
|
||||||
// Check for user cancellation
|
// Check for user cancellation
|
||||||
IF selected_option_text == null OR selected_option_text == "":
|
IF selected_options == null OR selected_options.length == 0:
|
||||||
REPORT: "⚠️ User canceled selection. Workflow terminated."
|
REPORT: "⚠️ User canceled selection. Workflow terminated."
|
||||||
EXIT workflow
|
EXIT workflow
|
||||||
|
|
||||||
// Extract concept index from response format "Concept N: Name"
|
// Extract concept indices from array
|
||||||
match = selected_option_text.match(/Concept (\d+):/)
|
selected_indices = []
|
||||||
IF match:
|
FOR each selected_option_text IN selected_options:
|
||||||
selected_index = parseInt(match[1])
|
match = selected_option_text.match(/Concept (\d+):/)
|
||||||
ELSE:
|
IF match:
|
||||||
ERROR: "Invalid selection format. Expected 'Concept N: ...' format"
|
selected_indices.push(parseInt(match[1]))
|
||||||
EXIT workflow
|
ELSE:
|
||||||
|
ERROR: "Invalid selection format. Expected 'Concept N: ...' format"
|
||||||
|
EXIT workflow
|
||||||
|
|
||||||
// Store selection for this target
|
// Store selections for this target (array of indices)
|
||||||
selections[target] = {
|
selections[target] = {
|
||||||
selected_index: selected_index,
|
selected_indices: selected_indices, // Array of selected indices
|
||||||
concept_name: layout_concepts[target][selected_index-1].concept_name
|
concept_names: selected_indices.map(i => layout_concepts[target][i-1].concept_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
REPORT: "✅ Selected {selected_indices.length} layout(s) for {target}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Write User Selection File
|
### Step 4: Write User Selection File
|
||||||
```bash
|
```bash
|
||||||
|
# Calculate total selections across all targets
|
||||||
|
total_selections = sum([len(selections[t].selected_indices) for t in targets])
|
||||||
|
|
||||||
# Create user selection JSON
|
# Create user selection JSON
|
||||||
selection_data = {
|
selection_data = {
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"selected_at": "{current_timestamp}",
|
"selected_at": "{current_timestamp}",
|
||||||
"selection_type": "per_target",
|
"selection_type": "per_target_multi",
|
||||||
"session_id": "{session_id}"
|
"session_id": "{session_id}",
|
||||||
|
"total_selections": total_selections
|
||||||
},
|
},
|
||||||
"selections": selections // {target: {selected_index, concept_name}}
|
"selections": selections // {target: {selected_indices: [...], concept_names: [...]}}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Write to file
|
# Write to file
|
||||||
@@ -391,149 +377,155 @@ bash(test -f {base_path}/.intermediates/layout-analysis/user-selection.json && e
|
|||||||
|
|
||||||
### Step 5: Confirmation Message
|
### Step 5: Confirmation Message
|
||||||
```
|
```
|
||||||
✅ Selections recorded!
|
✅ Selections recorded! Total: {total_selections} layout(s)
|
||||||
|
|
||||||
{FOR each target, selection in selections:
|
{FOR each target, selection in selections:
|
||||||
• {target}: Concept {selection.selected_index} - {selection.concept_name}
|
• {target}: {selection.selected_indices.length} layout(s) selected
|
||||||
|
{FOR each index IN selection.selected_indices:
|
||||||
|
- Concept {index}: {layout_concepts[target][index-1].concept_name}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Proceeding to generate detailed layout templates based on your selections...
|
Proceeding to generate {total_selections} detailed layout template(s)...
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**: `user-selection.json` with user's choices for all targets
|
**Output**: `user-selection.json` with user's multi-selections for all targets
|
||||||
|
|
||||||
## Phase 2: Layout Template Generation (Agent Task 2)
|
## Phase 2: Layout Template Generation (Agent Task 2)
|
||||||
|
|
||||||
**Executor**: `Task(ui-design-agent)` for selected concept(s)
|
**Executor**: `Task(ui-design-agent)` × `Total_Selected_Templates` in **parallel**
|
||||||
|
|
||||||
### Step 1: Load User Selection (Explore Mode)
|
### Step 1: Load User Selections and Build Task List
|
||||||
```bash
|
```bash
|
||||||
# For explore mode, read user selection
|
# Read user selections
|
||||||
IF extraction_mode == "explore":
|
selection = Read({base_path}/.intermediates/layout-analysis/user-selection.json)
|
||||||
selection = Read({base_path}/.intermediates/layout-analysis/user-selection.json)
|
selections_per_target = selection.selections
|
||||||
selections_per_target = selection.selections
|
|
||||||
|
|
||||||
# Also read the selected concept details from options
|
# Read concept details
|
||||||
options = Read({base_path}/.intermediates/layout-analysis/analysis-options.json)
|
options = Read({base_path}/.intermediates/layout-analysis/analysis-options.json)
|
||||||
layout_concepts = options.layout_concepts
|
layout_concepts = options.layout_concepts
|
||||||
|
|
||||||
# Build selected concepts map
|
# Build task list for all selected concepts across all targets
|
||||||
selected_concepts = {}
|
task_list = []
|
||||||
FOR each target in targets:
|
FOR each target in targets:
|
||||||
selected_index = selections_per_target[target].selected_index
|
selected_indices = selections_per_target[target].selected_indices # Array
|
||||||
selected_concepts[target] = layout_concepts[target][selected_index-1] # 0-indexed
|
concept_names = selections_per_target[target].concept_names # Array
|
||||||
ELSE:
|
|
||||||
# Imitate mode - no selection needed
|
FOR i in range(len(selected_indices)):
|
||||||
selected_concepts = null
|
idx = selected_indices[i]
|
||||||
|
concept = layout_concepts[target][idx - 1] # 0-indexed array
|
||||||
|
variant_id = i + 1 # 1-based variant numbering
|
||||||
|
|
||||||
|
task_list.push({
|
||||||
|
target: target,
|
||||||
|
variant_id: variant_id,
|
||||||
|
concept: concept,
|
||||||
|
output_file: "{base_path}/layout-extraction/layout-{target}-{variant_id}.json"
|
||||||
|
})
|
||||||
|
|
||||||
|
total_tasks = task_list.length
|
||||||
|
REPORT: "Generating {total_tasks} layout templates across {targets.length} targets"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: Launch Agent Task
|
### Step 2: Launch Parallel Agent Tasks
|
||||||
Generate layout templates for selected concepts:
|
Generate layout templates for ALL selected concepts in parallel:
|
||||||
```javascript
|
```javascript
|
||||||
Task(ui-design-agent): `
|
FOR each task in task_list:
|
||||||
[LAYOUT_TEMPLATE_GENERATION_TASK]
|
Task(ui-design-agent): `
|
||||||
Generate detailed layout templates based on user-selected concepts.
|
[LAYOUT_TEMPLATE_GENERATION_TASK #{task.variant_id} for {task.target}]
|
||||||
Focus ONLY on structure and layout. DO NOT concern with visual style (colors, fonts, etc.).
|
Generate detailed layout template based on user-selected concept.
|
||||||
|
Focus ONLY on structure and layout. DO NOT concern with visual style (colors, fonts, etc.).
|
||||||
|
|
||||||
SESSION: {session_id} | MODE: {extraction_mode} | BASE_PATH: {base_path}
|
SESSION: {session_id} | BASE_PATH: {base_path}
|
||||||
DEVICE_TYPE: {device_type}
|
TARGET: {task.target} | VARIANT: {task.variant_id}
|
||||||
|
DEVICE_TYPE: {device_type}
|
||||||
|
|
||||||
${extraction_mode == "explore" ? `
|
USER SELECTION:
|
||||||
USER SELECTIONS:
|
- Selected Concept: {task.concept.concept_name}
|
||||||
${targets.map(target => `
|
- Philosophy: {task.concept.design_philosophy}
|
||||||
Target: ${target}
|
- Pattern: {task.concept.layout_pattern}
|
||||||
- Selected Concept: ${selected_concepts[target].concept_name}
|
- Key Components: {task.concept.key_components.join(", ")}
|
||||||
- Philosophy: ${selected_concepts[target].design_philosophy}
|
- Structural Features: {task.concept.structural_features.join(", ")}
|
||||||
- Pattern: ${selected_concepts[target].layout_pattern}
|
|
||||||
- Key Components: ${selected_concepts[target].key_components.join(", ")}
|
|
||||||
- Structural Features: ${selected_concepts[target].structural_features.join(", ")}
|
|
||||||
`).join("\n")}
|
|
||||||
` : `
|
|
||||||
MODE: Imitate - High-fidelity replication of reference layout structure
|
|
||||||
TARGETS: ${targets.join(", ")}
|
|
||||||
`}
|
|
||||||
|
|
||||||
## Input Analysis
|
## Input Analysis
|
||||||
- Targets: {targets.join(", ")}
|
- Target: {task.target}
|
||||||
- Device type: {device_type}
|
- Device type: {device_type}
|
||||||
- Visual references: {loaded_images if available}
|
- Visual references: {loaded_images if available}
|
||||||
${dom_structure_available ? "- DOM Structure Data: Read from .intermediates/layout-analysis/dom-structure-*.json - USE THIS for accurate layout properties" : ""}
|
${dom_structure_available ? "- DOM Structure Data: Read from .intermediates/layout-analysis/dom-structure-{task.target}.json - USE THIS for accurate layout properties" : ""}
|
||||||
|
|
||||||
## Generation Rules
|
## Generation Rules
|
||||||
${extraction_mode == "explore" ? `
|
- Develop the user-selected layout concept into a detailed template
|
||||||
- **Explore Mode**: Develop each user-selected layout concept into a detailed template
|
- Use the selected concept's key_components as foundation
|
||||||
- Use the selected concept's key_components as foundation
|
- Apply the selected layout_pattern (grid-3col, flex-row, etc.)
|
||||||
- Apply the selected layout_pattern (grid-3col, flex-row, etc.)
|
- Honor the structural_features defined in the concept
|
||||||
- Honor the structural_features defined in the concept
|
- Expand the concept with complete DOM structure and CSS layout rules
|
||||||
- Expand the concept with complete DOM structure and CSS layout rules
|
${dom_structure_available ? `
|
||||||
` : `
|
- IMPORTANT: You have access to real DOM structure data with accurate flex/grid properties
|
||||||
- **Imitate Mode**: High-fidelity replication of reference layout structure
|
- Use DOM data as primary source for layout properties
|
||||||
${dom_structure_available ? "- Use DOM structure data as ground truth" : "- Use visual inference"}
|
- Extract real flex/grid configurations (display, flexDirection, justifyContent, alignItems, gap)
|
||||||
`}
|
- Use actual element bounds for responsive breakpoint decisions
|
||||||
${dom_structure_available ? `
|
- Preserve identified patterns from DOM structure
|
||||||
- IMPORTANT: You have access to real DOM structure data with accurate flex/grid properties
|
` : ""}
|
||||||
- Use DOM data as primary source for layout properties
|
|
||||||
- Extract real flex/grid configurations (display, flexDirection, justifyContent, alignItems, gap)
|
|
||||||
- Use actual element bounds for responsive breakpoint decisions
|
|
||||||
- Preserve identified patterns from DOM structure
|
|
||||||
` : ""}
|
|
||||||
|
|
||||||
## Generate for EACH Target
|
## Template Generation
|
||||||
For target in {targets}:
|
|
||||||
${extraction_mode == "explore" ? "Based on user-selected concept:" : "Based on reference:"}
|
|
||||||
|
|
||||||
1. **DOM Structure**:
|
1. **DOM Structure**:
|
||||||
- Semantic HTML5 tags: <header>, <nav>, <main>, <aside>, <section>, <footer>
|
- Semantic HTML5 tags: <header>, <nav>, <main>, <aside>, <section>, <footer>
|
||||||
- ARIA roles and accessibility attributes
|
- ARIA roles and accessibility attributes
|
||||||
${extraction_mode == "explore" ? "- Use key_components from selected concept" : ""}
|
- Use key_components from selected concept
|
||||||
${dom_structure_available ? "- Base on extracted DOM tree from .intermediates" : "- Infer from visual analysis"}
|
${dom_structure_available ? "- Base on extracted DOM tree from .intermediates" : "- Infer from visual analysis"}
|
||||||
- Device-specific optimizations for {device_type}
|
- Device-specific optimizations for {device_type}
|
||||||
|
|
||||||
2. **Component Hierarchy**:
|
2. **Component Hierarchy**:
|
||||||
- Array of main layout regions
|
- Array of main layout regions
|
||||||
${extraction_mode == "explore" ? "- Derived from selected concept's key_components" : ""}
|
- Derived from selected concept's key_components
|
||||||
|
|
||||||
3. **CSS Layout Rules**:
|
3. **CSS Layout Rules**:
|
||||||
${extraction_mode == "explore" ? "- Implement selected layout_pattern" : ""}
|
- Implement selected layout_pattern
|
||||||
${dom_structure_available ? "- Use real layout properties from DOM structure data" : "- Focus on Grid, Flexbox, position, alignment"}
|
${dom_structure_available ? "- Use real layout properties from DOM structure data" : "- Focus on Grid, Flexbox, position, alignment"}
|
||||||
- Use CSS Custom Properties: var(--spacing-*), var(--breakpoint-*)
|
- Use CSS Custom Properties: var(--spacing-*), var(--breakpoint-*)
|
||||||
- Device-specific styles (mobile-first @media for responsive)
|
- Device-specific styles (mobile-first @media for responsive)
|
||||||
- NO colors, NO fonts, NO shadows - layout structure only
|
- NO colors, NO fonts, NO shadows - layout structure only
|
||||||
|
|
||||||
## Output Format
|
## Output Format
|
||||||
Write complete layout-templates.json with layout_templates array.
|
Write single-template JSON object with:
|
||||||
Each template must include:
|
- target: "{task.target}"
|
||||||
- target (string)
|
- variant_id: "layout-{task.variant_id}"
|
||||||
- variant_id: "layout-1" (always 1 since only selected concept is generated)
|
- source_image_path (string): Reference image path
|
||||||
- source_image_path (string): Reference image path
|
- device_type: "{device_type}"
|
||||||
- device_type (string)
|
- design_philosophy (string from selected concept)
|
||||||
- design_philosophy (string ${extraction_mode == "explore" ? "- from selected concept" : ""})
|
- dom_structure (JSON object)
|
||||||
- dom_structure (JSON object)
|
- component_hierarchy (array of strings)
|
||||||
- component_hierarchy (array of strings)
|
- css_layout_rules (string)
|
||||||
- css_layout_rules (string)
|
|
||||||
|
|
||||||
## Critical Requirements
|
## Critical Requirements
|
||||||
- ✅ Use Write() tool for layout-templates.json
|
- ✅ Use Write() tool for {task.output_file}
|
||||||
- ✅ One template per target (only selected concept)
|
- ✅ Single template for {task.target} variant {task.variant_id}
|
||||||
- ✅ Structure only, no visual styling
|
- ✅ Structure only, no visual styling
|
||||||
- ✅ Token-based CSS (var())
|
- ✅ Token-based CSS (var())
|
||||||
${extraction_mode == "explore" ? "- ✅ Maintain consistency with selected concepts" : ""}
|
- ✅ Maintain consistency with selected concept
|
||||||
`
|
`
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**: Agent generates `layout-templates.json` with one template per target
|
**Output**: Agent generates multiple layout template files (one per selected concept)
|
||||||
|
|
||||||
### Step 2: Write Output File
|
### Step 3: Verify Output Files
|
||||||
```bash
|
```bash
|
||||||
# Take JSON output from agent
|
# Count generated files
|
||||||
bash(echo '{agent_json_output}' > {base_path}/layout-extraction/layout-templates.json)
|
expected_count = total_tasks
|
||||||
|
actual_count = bash(ls {base_path}/layout-extraction/layout-*.json | wc -l)
|
||||||
|
|
||||||
# Verify output
|
# Verify all files were created
|
||||||
bash(test -f {base_path}/layout-extraction/layout-templates.json && echo "exists")
|
IF actual_count == expected_count:
|
||||||
bash(cat {base_path}/layout-extraction/layout-templates.json | grep -q "layout_templates" && echo "valid")
|
REPORT: "✓ All {expected_count} layout template files generated"
|
||||||
|
ELSE:
|
||||||
|
ERROR: "Expected {expected_count} files, found {actual_count}"
|
||||||
|
|
||||||
|
# Verify file structure (sample check)
|
||||||
|
bash(cat {base_path}/layout-extraction/layout-{first_target}-1.json | grep -q "variant_id" && echo "valid structure")
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**: `layout-templates.json` created and verified
|
**Output**: All layout template files created and verified (one file per selected concept)
|
||||||
|
|
||||||
## Completion
|
## Completion
|
||||||
|
|
||||||
@@ -541,9 +533,10 @@ bash(cat {base_path}/layout-extraction/layout-templates.json | grep -q "layout_t
|
|||||||
```javascript
|
```javascript
|
||||||
TodoWrite({todos: [
|
TodoWrite({todos: [
|
||||||
{content: "Setup and input validation", status: "completed", activeForm: "Validating inputs"},
|
{content: "Setup and input validation", status: "completed", activeForm: "Validating inputs"},
|
||||||
{content: "Layout research (explore mode)", status: "completed", activeForm: "Researching layout patterns"},
|
{content: "Layout concept analysis (agent)", status: "completed", activeForm: "Analyzing layout patterns"},
|
||||||
{content: "Layout analysis and synthesis (agent)", status: "completed", activeForm: "Generating layout templates"},
|
{content: "User selection confirmation", status: "completed", activeForm: "Confirming selections"},
|
||||||
{content: "Write layout-templates.json", status: "completed", activeForm: "Saving templates"}
|
{content: "Generate layout templates (parallel)", status: "completed", activeForm: "Generating templates"},
|
||||||
|
{content: "Verify output files", status: "completed", activeForm: "Verifying files"}
|
||||||
]});
|
]});
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -553,11 +546,9 @@ TodoWrite({todos: [
|
|||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
- Session: {session_id}
|
- Session: {session_id}
|
||||||
- Extraction Mode: {extraction_mode} (imitate/explore)
|
|
||||||
- Device Type: {device_type}
|
- Device Type: {device_type}
|
||||||
- Targets: {targets}
|
- Targets: {targets.join(", ")}
|
||||||
- Variants per Target: {variants_count}
|
- Total Templates: {total_tasks} ({targets.length} targets with multi-selection)
|
||||||
- Total Templates: {targets.length × variants_count}
|
|
||||||
{IF has_urls AND dom_structure_available:
|
{IF has_urls AND dom_structure_available:
|
||||||
- 🔍 URL Mode: DOM structure extracted from {len(url_list)} URL(s)
|
- 🔍 URL Mode: DOM structure extracted from {len(url_list)} URL(s)
|
||||||
- Accuracy: Real flex/grid properties from live pages
|
- Accuracy: Real flex/grid properties from live pages
|
||||||
@@ -566,22 +557,28 @@ Configuration:
|
|||||||
- ⚠️ URL Mode: Chrome DevTools unavailable, used visual analysis fallback
|
- ⚠️ URL Mode: Chrome DevTools unavailable, used visual analysis fallback
|
||||||
}
|
}
|
||||||
|
|
||||||
{IF extraction_mode == "explore":
|
User Selections:
|
||||||
Layout Research:
|
{FOR each target in targets:
|
||||||
- {targets.length} inspiration files generated
|
- {target}: {selections_per_target[target].concept_names.join(", ")} ({selections_per_target[target].selected_indices.length} variants)
|
||||||
- Pattern search focused on {device_type} layouts
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Generated Templates:
|
Generated Templates:
|
||||||
{FOR each template: - Target: {template.target} | Variant: {template.variant_id} | Philosophy: {template.design_philosophy}}
|
{base_path}/layout-extraction/
|
||||||
|
{FOR each target in targets:
|
||||||
Output File:
|
{FOR each variant_id in range(1, selections_per_target[target].selected_indices.length + 1):
|
||||||
- {base_path}/layout-extraction/layout-templates.json
|
├── layout-{target}-{variant_id}.json
|
||||||
{IF dom_structure_available:
|
}
|
||||||
- {base_path}/.intermediates/layout-analysis/dom-structure-*.json ({len(url_list)} files)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Next: /workflow:ui-design:generate will combine these structural templates with style systems to produce final prototypes.
|
Intermediate Files:
|
||||||
|
- {base_path}/.intermediates/layout-analysis/
|
||||||
|
├── analysis-options.json (concept proposals)
|
||||||
|
├── user-selection.json (multi-selections per target)
|
||||||
|
{IF dom_structure_available:
|
||||||
|
├── dom-structure-*.json ({len(url_list)} DOM extracts)
|
||||||
|
}
|
||||||
|
|
||||||
|
Next: /workflow:ui-design:generate or /workflow:ui-design:batch-generate will combine these structural templates with design systems to produce final prototypes.
|
||||||
```
|
```
|
||||||
|
|
||||||
## Simple Bash Commands
|
## Simple Bash Commands
|
||||||
@@ -589,23 +586,22 @@ Next: /workflow:ui-design:generate will combine these structural templates with
|
|||||||
### Path Operations
|
### Path Operations
|
||||||
```bash
|
```bash
|
||||||
# Find design directory
|
# Find design directory
|
||||||
bash(find .workflow -type d -name "design-*" | head -1)
|
bash(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
|
||||||
# Create output directories
|
# Create output directories
|
||||||
bash(mkdir -p {base_path}/layout-extraction)
|
bash(mkdir -p {base_path}/layout-extraction)
|
||||||
bash(mkdir -p {base_path}/.intermediates/layout-analysis/inspirations) # explore mode only
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Validation Commands
|
### Validation Commands
|
||||||
```bash
|
```bash
|
||||||
# Check if already extracted
|
# Check if already extracted
|
||||||
bash(test -f {base_path}/layout-extraction/layout-templates.json && echo "exists")
|
bash(find {base_path}/layout-extraction -name "layout-*.json" -print -quit | grep -q . && echo "exists")
|
||||||
|
|
||||||
# Validate JSON structure
|
# Count generated files
|
||||||
bash(cat layout-templates.json | grep -q "layout_templates" && echo "valid")
|
bash(ls {base_path}/layout-extraction/layout-*.json | wc -l)
|
||||||
|
|
||||||
# Count templates
|
# Validate JSON structure (sample check)
|
||||||
bash(cat layout-templates.json | grep -c "\"target\":")
|
bash(cat {base_path}/layout-extraction/layout-{first_target}-1.json | grep -q "variant_id" && echo "valid")
|
||||||
```
|
```
|
||||||
|
|
||||||
### File Operations
|
### File Operations
|
||||||
@@ -614,9 +610,6 @@ bash(cat layout-templates.json | grep -c "\"target\":")
|
|||||||
bash(ls {images_pattern})
|
bash(ls {images_pattern})
|
||||||
Read({image_path})
|
Read({image_path})
|
||||||
|
|
||||||
# Write inspiration files (explore mode)
|
|
||||||
Write({base_path}/.intermediates/layout-analysis/inspirations/{target}-layout-ideas.txt, content)
|
|
||||||
|
|
||||||
# Write layout templates
|
# Write layout templates
|
||||||
bash(echo '{json}' > {base_path}/layout-extraction/layout-templates.json)
|
bash(echo '{json}' > {base_path}/layout-extraction/layout-templates.json)
|
||||||
```
|
```
|
||||||
@@ -627,28 +620,28 @@ bash(echo '{json}' > {base_path}/layout-extraction/layout-templates.json)
|
|||||||
{base_path}/
|
{base_path}/
|
||||||
├── .intermediates/ # Intermediate analysis files
|
├── .intermediates/ # Intermediate analysis files
|
||||||
│ └── layout-analysis/
|
│ └── layout-analysis/
|
||||||
│ ├── dom-structure-{target}.json # Extracted DOM structure (URL mode only)
|
│ ├── analysis-options.json # Generated layout concepts
|
||||||
│ └── inspirations/ # Explore mode only
|
│ ├── user-selection.json # User's multi-selections per target
|
||||||
│ └── {target}-layout-ideas.txt # Layout inspiration research
|
│ └── dom-structure-{target}.json # Extracted DOM structure (URL mode only)
|
||||||
└── layout-extraction/ # Final layout templates
|
└── layout-extraction/ # Final layout templates
|
||||||
├── layout-templates.json # Structural layout templates
|
└── layout-{target}-{variant}.json # Structural layout templates (one per selected concept)
|
||||||
└── layout-space-analysis.json # Layout directions (explore mode only)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## layout-templates.json Format
|
## Layout Template File Format
|
||||||
|
|
||||||
|
Each `layout-{target}-{variant}.json` file contains a single template:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"extraction_metadata": {
|
"extraction_metadata": {
|
||||||
"session_id": "...",
|
"session_id": "...",
|
||||||
"input_mode": "image|url|prompt|hybrid",
|
"input_mode": "image|url|prompt|hybrid",
|
||||||
"extraction_mode": "imitate|explore",
|
|
||||||
"device_type": "desktop|mobile|tablet|responsive",
|
"device_type": "desktop|mobile|tablet|responsive",
|
||||||
"timestamp": "...",
|
"timestamp": "...",
|
||||||
"variants_count": 3,
|
"target": "home",
|
||||||
"targets": ["home", "dashboard"]
|
"variant_id": "layout-1"
|
||||||
},
|
},
|
||||||
"layout_templates": [
|
"template":
|
||||||
{
|
{
|
||||||
"target": "home",
|
"target": "home",
|
||||||
"variant_id": "layout-1",
|
"variant_id": "layout-1",
|
||||||
@@ -703,8 +696,8 @@ ERROR: Invalid target name
|
|||||||
ERROR: Agent task failed
|
ERROR: Agent task failed
|
||||||
→ Check agent output, retry with simplified prompt
|
→ Check agent output, retry with simplified prompt
|
||||||
|
|
||||||
ERROR: MCP search failed (explore mode)
|
ERROR: MCP search failed
|
||||||
→ Check network, retry
|
→ Check network connection, retry command
|
||||||
```
|
```
|
||||||
|
|
||||||
### Recovery Strategies
|
### Recovery Strategies
|
||||||
@@ -718,11 +711,12 @@ ERROR: MCP search failed (explore mode)
|
|||||||
- **Hybrid Extraction Strategy** - Combines real DOM structure data with AI visual analysis
|
- **Hybrid Extraction Strategy** - Combines real DOM structure data with AI visual analysis
|
||||||
- **Accurate Layout Properties** - Chrome DevTools extracts real flex/grid configurations, bounds, and hierarchy
|
- **Accurate Layout Properties** - Chrome DevTools extracts real flex/grid configurations, bounds, and hierarchy
|
||||||
- **Separation of Concerns** - Decouples layout (structure) from style (visuals)
|
- **Separation of Concerns** - Decouples layout (structure) from style (visuals)
|
||||||
- **Structural Exploration** - Explore mode enables A/B testing of different layouts
|
- **Multi-Selection Workflow** - Generate N concepts → User selects multiple → Parallel template generation
|
||||||
|
- **Structural Exploration** - Enables A/B testing of different layouts through multi-selection
|
||||||
- **Token-Based Layout** - CSS uses `var()` placeholders for instant design system adaptation
|
- **Token-Based Layout** - CSS uses `var()` placeholders for instant design system adaptation
|
||||||
- **Device-Specific** - Tailored structures for different screen sizes
|
- **Device-Specific** - Tailored structures for different screen sizes
|
||||||
- **Graceful Fallback** - Falls back to visual analysis if Chrome DevTools unavailable
|
- **Graceful Fallback** - Falls back to visual analysis if Chrome DevTools unavailable
|
||||||
- **Foundation for Assembly** - Provides structural blueprint for refactored `generate` command
|
- **Foundation for Assembly** - Provides structural blueprint for prototype generation
|
||||||
- **Agent-Powered** - Deep structural analysis with AI
|
- **Agent-Powered** - Deep structural analysis with AI
|
||||||
|
|
||||||
## Integration
|
## Integration
|
||||||
@@ -730,17 +724,17 @@ ERROR: MCP search failed (explore mode)
|
|||||||
**Workflow Position**: Between style extraction and prototype generation
|
**Workflow Position**: Between style extraction and prototype generation
|
||||||
|
|
||||||
**New Workflow**:
|
**New Workflow**:
|
||||||
1. `/workflow:ui-design:style-extract` → `design-tokens.json` + `style-guide.md` (Complete design systems)
|
1. `/workflow:ui-design:style-extract` → Multiple `style-N/design-tokens.json` files (Complete design systems)
|
||||||
2. `/workflow:ui-design:layout-extract` → `layout-templates.json` (Structural templates)
|
2. `/workflow:ui-design:layout-extract` → Multiple `layout-{target}-{variant}.json` files (Structural templates)
|
||||||
3. `/workflow:ui-design:generate` (Pure assembler):
|
3. `/workflow:ui-design:generate` or `/workflow:ui-design:batch-generate` (Assembler):
|
||||||
- **Reads**: `design-tokens.json` + `layout-templates.json`
|
- **Reads**: All `design-tokens.json` files + all `layout-{target}-{variant}.json` files
|
||||||
- **Action**: For each style × layout combination:
|
- **Action**: For each style × layout combination:
|
||||||
1. Build HTML from `dom_structure`
|
1. Build HTML from `dom_structure`
|
||||||
2. Create layout CSS from `css_layout_rules`
|
2. Create layout CSS from `css_layout_rules`
|
||||||
3. Link design tokens CSS
|
3. Apply design tokens to CSS
|
||||||
4. Inject placeholder content
|
4. Generate complete prototypes
|
||||||
- **Output**: Complete token-driven HTML/CSS prototypes
|
- **Output**: Complete token-driven HTML/CSS prototypes
|
||||||
|
|
||||||
**Input**: Reference images, URLs, or text prompts
|
**Input**: Reference images, URLs, or text prompts
|
||||||
**Output**: `layout-templates.json` for `/workflow:ui-design:generate`
|
**Output**: `layout-{target}-{variant}.json` files for downstream generation commands
|
||||||
**Next**: `/workflow:ui-design:generate --session {session_id}`
|
**Next**: `/workflow:ui-design:generate` or `/workflow:ui-design:batch-generate`
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: style-extract
|
name: style-extract
|
||||||
description: Extract design style from reference images or text prompts using Claude analysis with variant generation
|
description: Extract design style from reference images or text prompts using Claude analysis with variant generation
|
||||||
argument-hint: "[--base-path <path>] [--session <id>] [--images "<glob>"] [--urls "<list>"] [--prompt "<desc>"] [--mode <imitate|explore>] [--variants <count>]"
|
argument-hint: "[--base-path <path>] [--session <id>] [--images "<glob>"] [--urls "<list>"] [--prompt "<desc>"] [--variants <count>]"
|
||||||
allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), mcp__chrome-devtools__navigate_page(*), mcp__chrome-devtools__evaluate_script(*)
|
allowed-tools: TodoWrite(*), Read(*), Write(*), Glob(*), mcp__chrome-devtools__navigate_page(*), mcp__chrome-devtools__evaluate_script(*)
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -40,19 +40,15 @@ IF --urls:
|
|||||||
ELSE:
|
ELSE:
|
||||||
has_urls = false
|
has_urls = false
|
||||||
|
|
||||||
# Determine extraction mode
|
# Set variants count (default: 3, range: 1-5)
|
||||||
# Priority: --mode parameter → default "imitate"
|
# Behavior: Generate N design directions → User multi-select → Generate selected variants
|
||||||
extraction_mode = --mode OR "imitate" # "imitate" or "explore"
|
variants_count = --variants OR 3
|
||||||
|
VALIDATE: 1 <= variants_count <= 5
|
||||||
|
|
||||||
# Set variants count based on mode
|
# Determine base path (auto-detect and convert to absolute)
|
||||||
IF extraction_mode == "imitate":
|
relative_path=$(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
variants_count = 1 # Force single variant for imitate mode (ignore --variants)
|
base_path=$(cd "$relative_path" && pwd)
|
||||||
ELSE IF extraction_mode == "explore":
|
bash(test -d "$base_path" && echo "✓ Base path: $base_path" || echo "✗ Path not found")
|
||||||
variants_count = --variants OR 3 # Default to 3 for explore mode
|
|
||||||
VALIDATE: 1 <= variants_count <= 5
|
|
||||||
|
|
||||||
# Determine base path
|
|
||||||
bash(find .workflow -type d -name "design-*" | head -1) # Auto-detect
|
|
||||||
# OR use --base-path / --session parameters
|
# OR use --base-path / --session parameters
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -140,24 +136,15 @@ IF exists: SKIP to completion
|
|||||||
|
|
||||||
**Phase 0 Output**: `input_mode`, `base_path`, `extraction_mode`, `variants_count`, `loaded_images[]` or `prompt_guidance`, `has_urls`, `url_list[]`, `computed_styles_available`
|
**Phase 0 Output**: `input_mode`, `base_path`, `extraction_mode`, `variants_count`, `loaded_images[]` or `prompt_guidance`, `has_urls`, `url_list[]`, `computed_styles_available`
|
||||||
|
|
||||||
## Phase 1: Design Direction Generation (Explore Mode Only)
|
## Phase 1: Design Direction Generation
|
||||||
|
|
||||||
### Step 1: Check Extraction Mode
|
### Step 1: Load Project Context
|
||||||
```bash
|
|
||||||
# Check extraction mode
|
|
||||||
# extraction_mode == "imitate" → skip this phase
|
|
||||||
# extraction_mode == "explore" → execute this phase
|
|
||||||
```
|
|
||||||
|
|
||||||
**If imitate mode**: Skip to Phase 2
|
|
||||||
|
|
||||||
### Step 2: Load Project Context (Explore Mode)
|
|
||||||
```bash
|
```bash
|
||||||
# Load brainstorming context if available
|
# Load brainstorming context if available
|
||||||
bash(test -f {base_path}/.brainstorming/role analysis documents && cat it)
|
bash(test -f {base_path}/.brainstorming/role analysis documents && cat it)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 3: Generate Design Direction Options (Agent Task 1)
|
### Step 2: Generate Design Direction Options (Agent Task 1)
|
||||||
**Executor**: `Task(ui-design-agent)`
|
**Executor**: `Task(ui-design-agent)`
|
||||||
|
|
||||||
Launch agent to generate `variants_count` design direction options with previews:
|
Launch agent to generate `variants_count` design direction options with previews:
|
||||||
@@ -205,7 +192,7 @@ Task(ui-design-agent): `
|
|||||||
`
|
`
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Verify Options File Created
|
### Step 3: Verify Options File Created
|
||||||
```bash
|
```bash
|
||||||
bash(test -f {base_path}/.intermediates/style-analysis/analysis-options.json && echo "created")
|
bash(test -f {base_path}/.intermediates/style-analysis/analysis-options.json && echo "created")
|
||||||
|
|
||||||
@@ -265,12 +252,12 @@ Please select the direction(s) you'd like to develop into complete design system
|
|||||||
|
|
||||||
### Step 3: Capture User Selection
|
### Step 3: Capture User Selection
|
||||||
```javascript
|
```javascript
|
||||||
// Use AskUserQuestion tool for selection
|
// Use AskUserQuestion tool for multi-selection
|
||||||
AskUserQuestion({
|
AskUserQuestion({
|
||||||
questions: [{
|
questions: [{
|
||||||
question: "Which design direction would you like to develop into a complete design system?",
|
question: "Which design direction(s) would you like to develop into complete design systems?",
|
||||||
header: "Style Choice",
|
header: "Style Choice",
|
||||||
multiSelect: false, // Single selection for Phase 1
|
multiSelect: true, // Multi-selection enabled (default behavior)
|
||||||
options: [
|
options: [
|
||||||
{FOR each direction:
|
{FOR each direction:
|
||||||
label: "Option {direction.index}: {direction.philosophy_name}",
|
label: "Option {direction.index}: {direction.philosophy_name}",
|
||||||
@@ -280,21 +267,25 @@ AskUserQuestion({
|
|||||||
}]
|
}]
|
||||||
})
|
})
|
||||||
|
|
||||||
// Parse user response (e.g., "Option 1: Minimalist & Airy")
|
// Parse user response (array of selections, e.g., ["Option 1: ...", "Option 3: ..."])
|
||||||
selected_option_text = user_answer
|
selected_options = user_answer
|
||||||
|
|
||||||
// Check for user cancellation
|
// Check for user cancellation
|
||||||
IF selected_option_text == null OR selected_option_text == "":
|
IF selected_options == null OR selected_options.length == 0:
|
||||||
REPORT: "⚠️ User canceled selection. Workflow terminated."
|
REPORT: "⚠️ User canceled selection. Workflow terminated."
|
||||||
EXIT workflow
|
EXIT workflow
|
||||||
|
|
||||||
// Extract option index from response format "Option N: Name"
|
// Extract option indices from array
|
||||||
match = selected_option_text.match(/Option (\d+):/)
|
selected_indices = []
|
||||||
IF match:
|
FOR each selected_option_text IN selected_options:
|
||||||
selected_index = parseInt(match[1])
|
match = selected_option_text.match(/Option (\d+):/)
|
||||||
ELSE:
|
IF match:
|
||||||
ERROR: "Invalid selection format. Expected 'Option N: ...' format"
|
selected_indices.push(parseInt(match[1]))
|
||||||
EXIT workflow
|
ELSE:
|
||||||
|
ERROR: "Invalid selection format. Expected 'Option N: ...' format"
|
||||||
|
EXIT workflow
|
||||||
|
|
||||||
|
REPORT: "✅ Selected {selected_indices.length} design direction(s)"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Write User Selection File
|
### Step 4: Write User Selection File
|
||||||
@@ -303,10 +294,11 @@ ELSE:
|
|||||||
selection_data = {
|
selection_data = {
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"selected_at": "{current_timestamp}",
|
"selected_at": "{current_timestamp}",
|
||||||
"selection_type": "single",
|
"selection_type": "multi",
|
||||||
"session_id": "{session_id}"
|
"session_id": "{session_id}",
|
||||||
|
"selection_count": selected_indices.length
|
||||||
},
|
},
|
||||||
"selected_indices": [selected_index],
|
"selected_indices": selected_indices, // Array of selected indices
|
||||||
"refinements": {
|
"refinements": {
|
||||||
"enabled": false
|
"enabled": false
|
||||||
}
|
}
|
||||||
@@ -323,99 +315,87 @@ bash(test -f {base_path}/.intermediates/style-analysis/user-selection.json && ec
|
|||||||
```
|
```
|
||||||
✅ Selection recorded!
|
✅ Selection recorded!
|
||||||
|
|
||||||
You selected: Option {selected_index} - {selected_direction.philosophy_name}
|
You selected {selected_indices.length} design direction(s):
|
||||||
|
{FOR each index IN selected_indices:
|
||||||
|
• Option {index} - {design_directions[index-1].philosophy_name}
|
||||||
|
}
|
||||||
|
|
||||||
Proceeding to generate complete design system based on your selection...
|
Proceeding to generate {selected_indices.length} complete design system(s)...
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**: `user-selection.json` with user's choice
|
**Output**: `user-selection.json` with user's multi-selection
|
||||||
|
|
||||||
## Phase 2: Design System Generation (Agent Task 2)
|
## Phase 2: Design System Generation (Agent Task 2)
|
||||||
|
|
||||||
**Executor**: `Task(ui-design-agent)` for selected variant(s)
|
**Executor**: `Task(ui-design-agent)` for selected variant(s)
|
||||||
|
|
||||||
### Step 1: Load User Selection (Explore Mode)
|
### Step 1: Load User Selection
|
||||||
```bash
|
```bash
|
||||||
# For explore mode, read user selection
|
# Read user selection
|
||||||
IF extraction_mode == "explore":
|
selection = Read({base_path}/.intermediates/style-analysis/user-selection.json)
|
||||||
selection = Read({base_path}/.intermediates/style-analysis/user-selection.json)
|
selected_indices = selection.selected_indices # Array of selected indices
|
||||||
selected_indices = selection.selected_indices
|
|
||||||
refinements = selection.refinements
|
|
||||||
|
|
||||||
# Also read the selected direction details from options
|
# Read the selected direction details from options
|
||||||
options = Read({base_path}/.intermediates/style-analysis/analysis-options.json)
|
options = Read({base_path}/.intermediates/style-analysis/analysis-options.json)
|
||||||
selected_directions = [options.design_directions[i-1] for i in selected_indices] # 0-indexed
|
selected_directions = [options.design_directions[i-1] for i in selected_indices] # 0-indexed array
|
||||||
|
|
||||||
# For Phase 1, we only allow single selection
|
actual_variants_count = selected_indices.length
|
||||||
selected_direction = selected_directions[0]
|
REPORT: "📦 Generating {actual_variants_count} design system(s)..."
|
||||||
actual_variants_count = 1
|
|
||||||
ELSE:
|
|
||||||
# Imitate mode - generate single variant without selection
|
|
||||||
selected_direction = null
|
|
||||||
actual_variants_count = 1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: Create Output Directory
|
### Step 2: Create Output Directories
|
||||||
```bash
|
```bash
|
||||||
# Create directory for selected variant only
|
# Create directories for each selected variant
|
||||||
bash(mkdir -p {base_path}/style-extraction/style-1)
|
FOR index IN 1..actual_variants_count:
|
||||||
|
bash(mkdir -p {base_path}/style-extraction/style-{index})
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 3: Launch Agent Task
|
### Step 3: Launch Agent Tasks (Parallel)
|
||||||
Generate design system for selected direction:
|
Generate design systems for ALL selected directions in parallel (max 5 concurrent):
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
Task(ui-design-agent): `
|
// Launch parallel tasks, one for each selected direction
|
||||||
[DESIGN_SYSTEM_GENERATION_TASK]
|
FOR variant_index IN 1..actual_variants_count:
|
||||||
Generate production-ready design system based on user-selected direction
|
selected_direction = selected_directions[variant_index - 1] // 0-indexed
|
||||||
|
|
||||||
SESSION: {session_id} | MODE: {extraction_mode} | BASE_PATH: {base_path}
|
Task(ui-design-agent): `
|
||||||
|
[DESIGN_SYSTEM_GENERATION_TASK #{variant_index}/{actual_variants_count}]
|
||||||
|
Generate production-ready design system based on user-selected direction
|
||||||
|
|
||||||
${extraction_mode == "explore" ? `
|
SESSION: {session_id} | VARIANT: {variant_index}/{actual_variants_count} | BASE_PATH: {base_path}
|
||||||
USER SELECTION:
|
|
||||||
- Selected Direction: ${selected_direction.philosophy_name}
|
|
||||||
- Design Attributes: ${JSON.stringify(selected_direction.design_attributes)}
|
|
||||||
- Search Keywords: ${selected_direction.search_keywords.join(", ")}
|
|
||||||
- Anti-keywords: ${selected_direction.anti_keywords.join(", ")}
|
|
||||||
- Rationale: ${selected_direction.rationale}
|
|
||||||
- Preview Colors: Primary=${selected_direction.preview.primary_color}, Accent=${selected_direction.preview.accent_color}
|
|
||||||
- Preview Typography: Heading=${selected_direction.preview.font_family_heading}, Body=${selected_direction.preview.font_family_body}
|
|
||||||
- Preview Border Radius: ${selected_direction.preview.border_radius_base}
|
|
||||||
|
|
||||||
${refinements.enabled ? `
|
USER SELECTION:
|
||||||
USER REFINEMENTS:
|
- Selected Direction: ${selected_direction.philosophy_name}
|
||||||
${refinements.primary_color ? "- Primary Color Override: " + refinements.primary_color : ""}
|
- Design Attributes: ${JSON.stringify(selected_direction.design_attributes)}
|
||||||
${refinements.font_family_heading ? "- Heading Font Override: " + refinements.font_family_heading : ""}
|
- Search Keywords: ${selected_direction.search_keywords.join(", ")}
|
||||||
${refinements.font_family_body ? "- Body Font Override: " + refinements.font_family_body : ""}
|
- Anti-keywords: ${selected_direction.anti_keywords.join(", ")}
|
||||||
` : ""}
|
- Rationale: ${selected_direction.rationale}
|
||||||
` : ""}
|
- Preview Colors: Primary=${selected_direction.preview.primary_color}, Accent=${selected_direction.preview.accent_color}
|
||||||
|
- Preview Typography: Heading=${selected_direction.preview.font_family_heading}, Body=${selected_direction.preview.font_family_body}
|
||||||
|
- Preview Border Radius: ${selected_direction.preview.border_radius_base}
|
||||||
|
|
||||||
## Input Analysis
|
## Input Analysis
|
||||||
- Input mode: {input_mode} (image/text/hybrid${has_urls ? "/url" : ""})
|
- Input mode: {input_mode} (image/text/hybrid${has_urls ? "/url" : ""})
|
||||||
- Visual references: {loaded_images OR prompt_guidance}
|
- Visual references: {loaded_images OR prompt_guidance}
|
||||||
${computed_styles_available ? "- Computed styles: Use as ground truth (Read from .intermediates/style-analysis/computed-styles.json)" : ""}
|
${computed_styles_available ? "- Computed styles: Use as ground truth (Read from .intermediates/style-analysis/computed-styles.json)" : ""}
|
||||||
|
|
||||||
## Generation Rules
|
## Generation Rules
|
||||||
${extraction_mode == "explore" ? `
|
- Develop the selected design direction into a complete design system
|
||||||
- **Explore Mode**: Develop the selected design direction into a complete design system
|
- Use preview elements as foundation and expand with full token coverage
|
||||||
- Use preview elements as foundation and expand with full token coverage
|
- Apply design_attributes to all token values:
|
||||||
- Apply design_attributes to all token values:
|
* color_saturation → OKLCH chroma values
|
||||||
* color_saturation → OKLCH chroma values
|
* visual_weight → font weights, shadow depths
|
||||||
* visual_weight → font weights, shadow depths
|
* density → spacing scale compression/expansion
|
||||||
* density → spacing scale compression/expansion
|
* formality → typography choices, border radius
|
||||||
* formality → typography choices, border radius
|
* organic_geometric → border radius, shape patterns
|
||||||
* organic_geometric → border radius, shape patterns
|
* innovation → token naming, experimental values
|
||||||
* innovation → token naming, experimental values
|
- Honor search_keywords for design inspiration
|
||||||
- Honor search_keywords for design inspiration
|
- Avoid anti_keywords patterns
|
||||||
- Avoid anti_keywords patterns
|
- All colors in OKLCH format ${computed_styles_available ? "(convert from computed RGB)" : ""}
|
||||||
` : `
|
- WCAG AA compliance: 4.5:1 text contrast, 3:1 UI contrast
|
||||||
- **Imitate Mode**: High-fidelity replication of reference design
|
|
||||||
${computed_styles_available ? "- Use computed styles as ground truth for all measurements" : "- Use visual inference for measurements"}
|
|
||||||
`}
|
|
||||||
- All colors in OKLCH format ${computed_styles_available ? "(convert from computed RGB)" : ""}
|
|
||||||
- WCAG AA compliance: 4.5:1 text contrast, 3:1 UI contrast
|
|
||||||
|
|
||||||
## Generate
|
## Generate
|
||||||
Create complete design system in {base_path}/style-extraction/style-1/
|
Create complete design system in {base_path}/style-extraction/style-{variant_index}/
|
||||||
|
|
||||||
1. **design-tokens.json**:
|
1. **design-tokens.json**:
|
||||||
- Complete token structure with ALL fields:
|
- Complete token structure with ALL fields:
|
||||||
@@ -448,14 +428,13 @@ Task(ui-design-agent): `
|
|||||||
|
|
||||||
## Critical Requirements
|
## Critical Requirements
|
||||||
- ✅ Use Write() tool immediately for each file
|
- ✅ Use Write() tool immediately for each file
|
||||||
- ✅ Write to style-1/ directory (single output)
|
- ✅ Write to style-{variant_index}/ directory
|
||||||
- ❌ NO external research or MCP calls (pure AI generation)
|
- ❌ NO external research or MCP calls (pure AI generation)
|
||||||
- ✅ Maintain consistency with user-selected direction
|
- ✅ Maintain consistency with user-selected direction
|
||||||
${refinements.enabled ? "- ✅ Apply user refinements precisely" : ""}
|
`
|
||||||
`
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Output**: Agent generates 2 files (design-tokens.json, style-guide.md) for selected direction
|
**Output**: {actual_variants_count} parallel agent tasks generate 2 files each (design-tokens.json, style-guide.md)
|
||||||
|
|
||||||
## Phase 3: Verify Output
|
## Phase 3: Verify Output
|
||||||
|
|
||||||
@@ -533,7 +512,7 @@ Next: /workflow:ui-design:layout-extract --session {session_id} --targets "..."
|
|||||||
### Path Operations
|
### Path Operations
|
||||||
```bash
|
```bash
|
||||||
# Find design directory
|
# Find design directory
|
||||||
bash(find .workflow -type d -name "design-*" | head -1)
|
bash(find .workflow -type d -name "design-run-*" | head -1)
|
||||||
|
|
||||||
# Expand image pattern
|
# Expand image pattern
|
||||||
bash(ls {images_pattern})
|
bash(ls {images_pattern})
|
||||||
@@ -559,8 +538,10 @@ bash(cat {base_path}/style-extraction/style-1/design-tokens.json | grep -q "colo
|
|||||||
# Load brainstorming context
|
# Load brainstorming context
|
||||||
bash(test -f .brainstorming/role analysis documents && cat it)
|
bash(test -f .brainstorming/role analysis documents && cat it)
|
||||||
|
|
||||||
# Create directories
|
# Create directories (example for multiple variants)
|
||||||
bash(mkdir -p {base_path}/style-extraction/style-{{1..3}})
|
bash(mkdir -p {base_path}/style-extraction/style-1)
|
||||||
|
bash(mkdir -p {base_path}/style-extraction/style-2)
|
||||||
|
bash(mkdir -p {base_path}/style-extraction/style-3)
|
||||||
|
|
||||||
# Verify output
|
# Verify output
|
||||||
bash(ls {base_path}/style-extraction/style-1/)
|
bash(ls {base_path}/style-extraction/style-1/)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ Synchronize finalized design system references to brainstorming artifacts, prepa
|
|||||||
CHECK: .workflow/.active-* marker files; VALIDATE: session_id matches active session
|
CHECK: .workflow/.active-* marker files; VALIDATE: session_id matches active session
|
||||||
|
|
||||||
# Verify design artifacts in latest design run
|
# Verify design artifacts in latest design run
|
||||||
latest_design = find_latest_path_matching(".workflow/WFS-{session}/design-*")
|
latest_design = find_latest_path_matching(".workflow/WFS-{session}/design-run-*")
|
||||||
|
|
||||||
# Detect design system structure
|
# Detect design system structure
|
||||||
IF exists({latest_design}/style-extraction/style-1/design-tokens.json):
|
IF exists({latest_design}/style-extraction/style-1/design-tokens.json):
|
||||||
|
|||||||
Reference in New Issue
Block a user