ssd-ql-workflow 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/cli.js CHANGED
@@ -21,9 +21,11 @@ program
21
21
  .option('-f, --force', 'Overwrite existing files', false)
22
22
  .option('--skip-commands', 'Skip copying command files', false)
23
23
  .option('--skip-schema', 'Skip copying schema files', false)
24
+ .option('--schema <name>', 'Schema to use: trinity-workflow | hybrid-workflow', 'hybrid-workflow')
24
25
  .action(async (options) => {
25
26
  const cwd = process.cwd();
26
27
  console.log(chalk.blue('\n🚀 Initializing SDD workflow...\n'));
28
+ console.log(chalk.gray(`Schema: ${options.schema}\n`));
27
29
 
28
30
  try {
29
31
  // 1. Copy openspec config and schema
@@ -31,7 +33,7 @@ program
31
33
  const openspecDir = path.join(cwd, 'openspec');
32
34
 
33
35
  // Create openspec directory structure
34
- await fs.ensureDir(path.join(openspecDir, 'schemas', 'trinity-workflow'));
36
+ await fs.ensureDir(path.join(openspecDir, 'schemas', options.schema));
35
37
  await fs.ensureDir(path.join(openspecDir, 'specs'));
36
38
  await fs.ensureDir(path.join(openspecDir, 'changes'));
37
39
 
@@ -42,28 +44,31 @@ program
42
44
  if (await fs.exists(configDest) && !options.force) {
43
45
  console.log(chalk.yellow('⚠ config.yaml already exists, use --force to overwrite'));
44
46
  } else {
45
- await fs.copy(configSrc, configDest);
47
+ // Update config.yaml with selected schema
48
+ let configContent = await fs.readFile(configSrc, 'utf8');
49
+ configContent = configContent.replace(/schema: .*/, `schema: ${options.schema}`);
50
+ await fs.writeFile(configDest, configContent);
46
51
  console.log(chalk.green('✓ Created openspec/config.yaml'));
47
52
  }
48
53
 
49
- // Copy trinity-workflow schema
50
- const schemaSrc = path.join(TEMPLATES_DIR, 'openspec', 'schemas', 'trinity-workflow', 'schema.yaml');
51
- const schemaDest = path.join(openspecDir, 'schemas', 'trinity-workflow', 'schema.yaml');
54
+ // Copy selected schema
55
+ const schemaSrc = path.join(TEMPLATES_DIR, 'openspec', 'schemas', options.schema, 'schema.yaml');
56
+ const schemaDest = path.join(openspecDir, 'schemas', options.schema, 'schema.yaml');
52
57
 
53
58
  if (await fs.exists(schemaDest) && !options.force) {
54
- console.log(chalk.yellow('⚠ trinity-workflow/schema.yaml already exists, use --force to overwrite'));
59
+ console.log(chalk.yellow(`⚠ ${options.schema}/schema.yaml already exists, use --force to overwrite`));
55
60
  } else {
56
61
  await fs.copy(schemaSrc, schemaDest);
57
- console.log(chalk.green('✓ Created openspec/schemas/trinity-workflow/schema.yaml'));
62
+ console.log(chalk.green(`✓ Created openspec/schemas/${options.schema}/schema.yaml`));
58
63
  }
59
64
 
60
- // Copy trinity-workflow templates
61
- const templatesSrcDir = path.join(TEMPLATES_DIR, 'openspec', 'schemas', 'trinity-workflow', 'templates');
62
- const templatesDestDir = path.join(openspecDir, 'schemas', 'trinity-workflow', 'templates');
65
+ // Copy schema templates if exist
66
+ const templatesSrcDir = path.join(TEMPLATES_DIR, 'openspec', 'schemas', options.schema, 'templates');
67
+ const templatesDestDir = path.join(openspecDir, 'schemas', options.schema, 'templates');
63
68
 
64
69
  if (await fs.pathExists(templatesSrcDir)) {
65
70
  await fs.copy(templatesSrcDir, templatesDestDir, { overwrite: options.force });
66
- console.log(chalk.green('✓ Created openspec/schemas/trinity-workflow/templates/'));
71
+ console.log(chalk.green(`✓ Created openspec/schemas/${options.schema}/templates/`));
67
72
  }
68
73
 
69
74
  // Create .active file
@@ -99,11 +104,22 @@ program
99
104
  }
100
105
 
101
106
  console.log('\n' + chalk.green.bold('✅ SDD workflow initialized successfully!'));
102
- console.log('\n📚 Next steps:');
103
- console.log(chalk.cyan(' /sdd-new <change-name>') + ' - Start a new SDD workflow');
104
- console.log(chalk.cyan(' /sdd-continue') + ' - Continue to next artifact');
105
- console.log(chalk.cyan(' /sdd-apply') + ' - Execute tasks');
106
- console.log(chalk.cyan(' /sdd-status') + ' - View workflow status\n');
107
+
108
+ // Show mode-specific next steps
109
+ if (options.schema === 'hybrid-workflow') {
110
+ console.log('\n📚 Hybrid Workflow Commands:');
111
+ console.log(chalk.cyan(' /hybrid-new <name>') + ' - Start hybrid workflow');
112
+ console.log(chalk.cyan(' /hybrid-explore') + ' - Explore problem space');
113
+ console.log(chalk.cyan(' /hybrid-ff') + ' - Fast-forward all docs');
114
+ console.log(chalk.cyan(' /hybrid-apply') + ' - Execute with 3-Strike');
115
+ console.log(chalk.cyan(' /hybrid-status') + ' - View status\n');
116
+ } else {
117
+ console.log('\n📚 Trinity Workflow Commands:');
118
+ console.log(chalk.cyan(' /sdd-new <change-name>') + ' - Start a new workflow');
119
+ console.log(chalk.cyan(' /sdd-continue') + ' - Continue to next artifact');
120
+ console.log(chalk.cyan(' /sdd-apply') + ' - Execute tasks');
121
+ console.log(chalk.cyan(' /sdd-status') + ' - View status\n');
122
+ }
107
123
 
108
124
  } catch (error) {
109
125
  console.error(chalk.red('\n❌ Initialization failed:'), error.message);
@@ -115,14 +131,25 @@ program
115
131
  .command('list')
116
132
  .description('List available commands and schemas')
117
133
  .action(() => {
118
- console.log(chalk.bold('\n📚 Available SDD Commands:'));
134
+ console.log(chalk.bold('\n📚 SDD Commands (Trinity):'));
119
135
  console.log(' /sdd-new - Start a new SDD workflow');
120
136
  console.log(' /sdd-continue - Continue to next artifact');
121
137
  console.log(' /sdd-apply - Execute tasks from workflow');
122
138
  console.log(' /sdd-status - View workflow status');
123
139
 
140
+ console.log(chalk.bold('\n🔀 Hybrid Commands:'));
141
+ console.log(' /hybrid-new - Start hybrid workflow');
142
+ console.log(' /hybrid-explore - Explore problem space');
143
+ console.log(' /hybrid-ff - Fast-forward all docs');
144
+ console.log(' /hybrid-continue - Continue to next artifact');
145
+ console.log(' /hybrid-apply - Execute with 3-Strike');
146
+ console.log(' /hybrid-verify - Verify implementation');
147
+ console.log(' /hybrid-status - View status');
148
+ console.log(' /hybrid-archive - Archive change');
149
+
124
150
  console.log(chalk.bold('\n📦 Available Schemas:'));
125
- console.log(' trinity-workflow - 三位一体架构工作流\n');
151
+ console.log(' trinity-workflow - 三位一体架构工作流');
152
+ console.log(' hybrid-workflow - 融合工作流 (推荐)\n');
126
153
  });
127
154
 
128
155
  program.parse();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ssd-ql-workflow",
3
- "version": "0.2.2",
4
- "description": "SDD (Skill-Driven Development) CLI - Initialize trinity-workflow schema and commands",
3
+ "version": "0.4.0",
4
+ "description": "SDD (Skill-Driven Development) CLI - Hybrid workflow with OpenSpec flexibility + Trinity tracking",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "sdd": "bin/cli.js"
@@ -0,0 +1,65 @@
1
+ ---
2
+ description: Execute tasks with 3-Strike error protocol
3
+ ---
4
+
5
+ Execute implementation tasks with systematic error handling.
6
+
7
+ ## Input
8
+ - Optional: Change name (defaults to active)
9
+ - Optional: Batch number to start from
10
+
11
+ ## Prerequisites
12
+ - tasks.md must exist with unchecked tasks
13
+ - task_plan.md must exist
14
+
15
+ ## Execution Flow
16
+
17
+ 1. Load change and verify prerequisites
18
+
19
+ 2. Read tasks.md for task list
20
+
21
+ 3. Read task_plan.md for current state
22
+
23
+ 4. Execute tasks by batch:
24
+ ```markdown
25
+ ## Batch 1: Foundation
26
+ - [x] 1.1 Setup (complete)
27
+ - [ ] 1.2 Create model ← CURRENT
28
+ - [ ] 1.3 Add validation
29
+ ```
30
+
31
+ 5. After each task:
32
+ - Update checkbox: `- [ ]` → `- [x]`
33
+ - Update task_plan.md Progress
34
+ - Log to progress.md
35
+
36
+ ## 3-Strike Error Protocol
37
+
38
+ When a task fails:
39
+
40
+ | Attempt | Action |
41
+ |---------|--------|
42
+ | 1 | Diagnose and fix |
43
+ | 2 | Try alternative approach |
44
+ | 3 | Rethink the problem |
45
+ | 3 fails | Escalate to user |
46
+
47
+ Log all attempts in task_plan.md:
48
+ ```markdown
49
+ | Error | Attempt | Solution |
50
+ |-------|---------|----------|
51
+ | TypeError: x is null | 1 | Added null check |
52
+ | TypeError: x is null | 2 | Used optional chaining |
53
+ | TypeError: x is null | 3 | Refactored data flow |
54
+ ```
55
+
56
+ ## Completion Criteria
57
+
58
+ - All checkboxes in tasks.md checked
59
+ - task_plan.md Progress: 100%
60
+ - All verification steps passed
61
+
62
+ ## Output
63
+ - All tasks implemented
64
+ - Progress at 100%
65
+ - Ready for /hybrid-verify
@@ -0,0 +1,59 @@
1
+ ---
2
+ description: Archive completed hybrid workflow change
3
+ ---
4
+
5
+ Archive a completed hybrid workflow change.
6
+
7
+ ## Prerequisites
8
+ - All tasks complete (or explicitly waived)
9
+ - Verification passed (recommended)
10
+
11
+ ## Steps
12
+
13
+ 1. Load active change
14
+
15
+ 2. Check artifact status:
16
+ - proposal.md exists?
17
+ - design.md exists?
18
+ - specs/ exists?
19
+ - tasks.md complete?
20
+
21
+ 3. Sync delta specs (if applicable):
22
+ - Prompt user to confirm
23
+ - Merge to main specs
24
+
25
+ 4. Archive:
26
+ - Move to openspec/changes/archive/YYYY-MM-DD-<name>/
27
+ - Update project status
28
+
29
+ 5. Update findings.md:
30
+ - Mark change as archived
31
+ - Add lessons learned
32
+
33
+ ## Output
34
+
35
+ ```
36
+ You: /hybrid-archive
37
+
38
+ AI: 📦 Archiving add-dark-mode...
39
+
40
+ Artifact status:
41
+ ✓ proposal.md
42
+ ✓ design.md
43
+ ✓ specs/ (2 files)
44
+ ✓ tasks.md (10/10 complete)
45
+
46
+ Delta specs: 2 files not synced
47
+ → Sync now? [Yes/No]
48
+
49
+ You: Yes
50
+
51
+ AI: ✓ Synced specs to openspec/specs/ui/dark-mode.md
52
+ ✓ Moved to openspec/changes/archive/2026-03-03-add-dark-mode/
53
+
54
+ Change archived successfully.
55
+
56
+ Lessons learned (add to findings.md?):
57
+ 1. CSS variables work well for theming
58
+ 2. Consider system preference detection for v2
59
+ ```
@@ -0,0 +1,55 @@
1
+ ---
2
+ description: Continue to next artifact in hybrid workflow
3
+ ---
4
+
5
+ Continue creating the next artifact in the hybrid workflow.
6
+
7
+ ## Steps
8
+
9
+ 1. Load active change
10
+
11
+ 2. Check current phase from task_plan.md
12
+
13
+ 3. Determine next artifact:
14
+ | Current | Next |
15
+ |---------|------|
16
+ | init | proposal |
17
+ | proposal | design |
18
+ | design | specs |
19
+ | specs | tasks |
20
+ | tasks | apply |
21
+
22
+ 4. Create next artifact using template
23
+
24
+ 5. Update task_plan.md:
25
+ - Phase: <new-phase>
26
+ - Status: complete
27
+ - Progress: <percentage>
28
+
29
+ 6. Update progress.md with action log
30
+
31
+ ## Output
32
+ - Next artifact created
33
+ - Progress updated
34
+ - Clear next step
35
+
36
+ ## Example
37
+
38
+ ```
39
+ You: /hybrid-continue
40
+
41
+ AI: Current phase: proposal (complete)
42
+ Next phase: design
43
+
44
+ Creating design.md...
45
+
46
+ ✓ Architecture overview
47
+ ✓ Data models
48
+ ✓ API design
49
+ ✓ Component design
50
+ ✓ Risks & mitigations
51
+
52
+ Progress: 40%
53
+
54
+ Next: /hybrid-continue (to create specs)
55
+ ```
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Explore problem space before committing to a change
3
+ ---
4
+
5
+ Explore the problem space before creating a change.
6
+
7
+ ## When to Use
8
+ - Requirements are unclear
9
+ - Need to investigate options
10
+ - Complex problem with multiple solutions
11
+ - Performance optimization
12
+ - Architecture decisions
13
+
14
+ ## Steps
15
+
16
+ 1. Ask user what they want to explore
17
+
18
+ 2. Investigate:
19
+ - Read relevant code
20
+ - Search for patterns
21
+ - Identify bottlenecks
22
+ - Research solutions
23
+
24
+ 3. Present findings:
25
+ - Problem analysis
26
+ - Options with pros/cons
27
+ - Recommendations
28
+ - Next steps
29
+
30
+ 4. Optionally create change:
31
+ ```
32
+ /hybrid-new <name> --mode structured
33
+ ```
34
+
35
+ ## Output
36
+ - Exploration report
37
+ - Clear understanding of problem
38
+ - Recommended approach
39
+ - Ready to create structured change
@@ -0,0 +1,60 @@
1
+ ---
2
+ description: Fast-forward - generate all planning documents at once
3
+ ---
4
+
5
+ Fast-forward through planning: generate all documents in one command.
6
+
7
+ ## Input
8
+ - Optional: Change name (defaults to active change)
9
+
10
+ ## What it Creates
11
+
12
+ 1. **proposal.md** - Requirements and options
13
+ 2. **design.md** - Technical architecture
14
+ 3. **specs/**/*.md** - Feature specifications
15
+ 4. **tasks.md** - Implementation tasks
16
+
17
+ ## Prerequisites
18
+ - Change must exist (use `/hybrid-new` first)
19
+ - Tracking layer initialized
20
+
21
+ ## Steps
22
+
23
+ 1. Load active change or specified change
24
+
25
+ 2. Verify tracking layer exists (MUST):
26
+ - If missing, call planning-with-files skill
27
+
28
+ 3. Generate all artifacts sequentially:
29
+ ```
30
+ proposal → design → specs → tasks
31
+ ```
32
+
33
+ 4. Update task_plan.md:
34
+ - Phase: tasks
35
+ - Status: complete
36
+ - Progress: 80%
37
+
38
+ 5. Show summary and next step (/hybrid-apply)
39
+
40
+ ## Output
41
+ - All planning documents created
42
+ - Ready for implementation
43
+ - Clear task breakdown
44
+
45
+ ## Example
46
+
47
+ ```
48
+ You: /hybrid-ff add-dark-mode
49
+
50
+ AI: 🚀 Fast-forwarding add-dark-mode...
51
+
52
+ ✓ Created proposal.md (3 options)
53
+ ✓ Created design.md (architecture + diagram)
54
+ ✓ Created specs/ui/dark-mode.md (5 scenarios)
55
+ ✓ Created tasks.md (12 tasks in 4 batches)
56
+
57
+ Progress: 80%
58
+
59
+ Next: /hybrid-apply
60
+ ```
@@ -0,0 +1,52 @@
1
+ ---
2
+ description: Start a new Hybrid workflow change
3
+ ---
4
+
5
+ Start a new Hybrid workflow change with flexible mode selection.
6
+
7
+ ## Input
8
+ - Change name (kebab-case) or description
9
+ - Optional: `--mode` flag (quick | explore | structured)
10
+
11
+ ## Modes
12
+
13
+ ### Quick Mode (default)
14
+ For clear requirements, fast execution:
15
+ ```
16
+ /hybrid-new add-login --mode quick
17
+ ```
18
+ Flow: init → ff → apply → archive
19
+
20
+ ### Explore Mode
21
+ For unclear requirements:
22
+ ```
23
+ /hybrid-new optimize-performance --mode explore
24
+ ```
25
+ Flow: explore → init → continue → apply → archive
26
+
27
+ ### Structured Mode
28
+ For large features:
29
+ ```
30
+ /hybrid-new redesign-checkout --mode structured
31
+ ```
32
+ Flow: init → proposal → design → specs → tasks → apply → archive
33
+
34
+ ## Steps
35
+
36
+ 1. If no input, ask what to build using AskUserQuestion
37
+
38
+ 2. Create change with hybrid-workflow schema:
39
+ ```bash
40
+ openspec new change "<name>" --schema hybrid-workflow
41
+ ```
42
+
43
+ 3. Initialize tracking layer (MUST):
44
+ - Use Skill tool with skill: "planning-with-files"
45
+ - Creates: task_plan.md, findings.md, progress.md
46
+
47
+ 4. Show mode-specific next steps
48
+
49
+ ## Output
50
+ - Change created with hybrid-workflow schema
51
+ - Tracking layer initialized
52
+ - Ready for next phase based on mode
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: Show hybrid workflow status
3
+ ---
4
+
5
+ Show current hybrid workflow status and progress.
6
+
7
+ ## Output
8
+
9
+ ### Change Overview
10
+ - Change name
11
+ - Current phase
12
+ - Progress percentage
13
+ - Created date
14
+
15
+ ### Tracking Layer
16
+ - task_plan.md status
17
+ - findings.md entries
18
+ - progress.md entries
19
+
20
+ ### Artifacts Status
21
+ | Artifact | Status | Size |
22
+ |----------|--------|------|
23
+ | proposal.md | ✓ | 2.1k |
24
+ | design.md | ✓ | 4.3k |
25
+ | specs/ | ✓ | 3 files |
26
+ | tasks.md | ✓ | 12/12 |
27
+
28
+ ### Recent Activity
29
+ Last 5 entries from progress.md
30
+
31
+ ## Example
32
+
33
+ ```
34
+ You: /hybrid-status
35
+
36
+ AI: 📊 Hybrid Workflow Status
37
+
38
+ Change: add-dark-mode
39
+ Phase: apply
40
+ Progress: 85%
41
+
42
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
43
+ Artifacts
44
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
45
+ ✓ proposal.md (1.2k)
46
+ ✓ design.md (3.4k)
47
+ ✓ specs/ (2 files)
48
+ ✓ tasks.md (10/12 complete)
49
+
50
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
51
+ Recent Activity
52
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
53
+ 10:45 ✓ Batch 3.1: Added theme context
54
+ 10:42 ✓ Batch 2.3: Updated button styles
55
+ 10:40 ✓ Batch 2.2: Added CSS variables
56
+
57
+ Next: Continue /hybrid-apply
58
+ ```
@@ -0,0 +1,57 @@
1
+ ---
2
+ description: Verify implementation matches artifacts
3
+ ---
4
+
5
+ Verify implementation matches artifacts across three dimensions.
6
+
7
+ ## Dimensions
8
+
9
+ ### 1. Completeness
10
+ - All tasks in tasks.md are checked
11
+ - All requirements in specs have corresponding code
12
+ - All scenarios covered
13
+
14
+ ### 2. Correctness
15
+ - Implementation matches spec intent
16
+ - Edge cases from scenarios handled
17
+ - Error states match spec definitions
18
+
19
+ ### 3. Coherence
20
+ - Design decisions reflected in code structure
21
+ - Naming conventions consistent with design.md
22
+ - Patterns consistent across implementation
23
+
24
+ ## Output Format
25
+
26
+ ```
27
+ Verifying <change-name>...
28
+
29
+ COMPLETENESS
30
+ ✓ All 12 tasks in tasks.md are checked
31
+ ✓ All requirements in specs have corresponding code
32
+ ⚠ Scenario "X" not tested
33
+
34
+ CORRECTNESS
35
+ ✓ Implementation matches spec intent
36
+ ✓ Edge cases handled
37
+ ✓ Error states correct
38
+
39
+ COHERENCE
40
+ ✓ Design decisions reflected
41
+ ✓ Naming conventions consistent
42
+ ⚠ Design mentions "X" but code does "Y"
43
+
44
+ ─────────────────────────────
45
+ Critical issues: 0
46
+ Warnings: 2
47
+ Ready to archive: Yes (with warnings)
48
+
49
+ Recommendations:
50
+ 1. Add test for scenario X
51
+ 2. Update design.md or code for Y
52
+ ```
53
+
54
+ ## Exit Codes
55
+ - 0: All checks pass
56
+ - 1: Warnings only
57
+ - 2: Critical issues found
@@ -0,0 +1,61 @@
1
+ ---
2
+ description: Hybrid workflow - combines OpenSpec flexibility with Trinity tracking
3
+ ---
4
+
5
+ Hybrid workflow combining OpenSpec flexibility with Trinity tracking.
6
+
7
+ ## Usage
8
+
9
+ ```bash
10
+ # Quick mode (clear requirements)
11
+ /hybrid-new <name> --mode quick
12
+ /hybrid-ff # Generate all planning docs
13
+ /hybrid-apply # Execute with 3-Strike protocol
14
+ /hybrid-archive # Archive change
15
+
16
+ # Explore mode (unclear requirements)
17
+ /hybrid-explore # Explore problem space first
18
+ /hybrid-new <name> --mode explore
19
+ /hybrid-continue # Step-by-step artifact creation
20
+ /hybrid-apply
21
+ /hybrid-archive
22
+
23
+ # Structured mode (large features)
24
+ /hybrid-new <name> --mode structured
25
+ /hybrid-continue # Create proposal
26
+ /hybrid-continue # Create design
27
+ /hybrid-continue # Create specs
28
+ /hybrid-continue # Create tasks
29
+ /hybrid-apply
30
+ /hybrid-verify
31
+ /hybrid-archive
32
+ ```
33
+
34
+ ## Modes
35
+
36
+ | Mode | Flow | Best For |
37
+ |------|------|----------|
38
+ | quick | init → ff → apply → archive | Clear requirements, fast delivery |
39
+ | explore | explore → init → continue → apply → archive | Unclear requirements, investigation |
40
+ | structured | init → proposal → design → specs → tasks → apply → archive | Large features, formal process |
41
+
42
+ ## Key Features
43
+
44
+ 1. **Flexible Start** - Optional exploration phase
45
+ 2. **Mandatory Tracking** - Planning-with-Files initialization
46
+ 3. **Fast-Forward** - One-command planning generation
47
+ 4. **3-Strike Protocol** - Systematic error handling
48
+ 5. **Verification** - Completeness, correctness, coherence checks
49
+
50
+ ## Commands
51
+
52
+ | Command | Description |
53
+ |---------|-------------|
54
+ | `/hybrid-new` | Create new hybrid workflow change |
55
+ | `/hybrid-explore` | Explore problem space |
56
+ | `/hybrid-ff` | Fast-forward: generate all planning docs |
57
+ | `/hybrid-continue` | Create next artifact |
58
+ | `/hybrid-apply` | Execute tasks with 3-Strike protocol |
59
+ | `/hybrid-verify` | Verify implementation |
60
+ | `/hybrid-status` | Show workflow status |
61
+ | `/hybrid-archive` | Archive completed change |
@@ -0,0 +1,286 @@
1
+ name: hybrid-workflow
2
+ version: 1
3
+ description: |
4
+ 融合工作流 - 结合 OpenSpec 灵活性与 Trinity 追踪能力
5
+
6
+ 核心理念:
7
+ - 灵活启动:可选探索阶段
8
+ - 强制追踪:必须初始化 Planning-with-Files
9
+ - 快速执行:支持 ff 模式一键生成
10
+ - 系统化错误处理:3-Strike 协议
11
+
12
+ # ================================================
13
+ # 工作流模式
14
+ # ================================================
15
+ modes:
16
+ quick:
17
+ description: 快速模式 - 明确需求时使用
18
+ flow: ["init", "ff", "apply", "archive"]
19
+
20
+ explore:
21
+ description: 探索模式 - 需求不明确时使用
22
+ flow: ["explore", "init", "continue", "apply", "archive"]
23
+
24
+ structured:
25
+ description: 结构化模式 - 大型功能开发
26
+ flow: ["init", "proposal", "design", "specs", "tasks", "apply", "archive"]
27
+
28
+ # ================================================
29
+ # 追踪层 (强制)
30
+ # ================================================
31
+ tracking:
32
+ required: true
33
+ skill: planning-with-files
34
+ files:
35
+ - task_plan.md
36
+ - findings.md
37
+ - progress.md
38
+ instruction: |
39
+ [MUST] 执行任何工作流前,调用 planning-with-files 技能初始化追踪。
40
+
41
+ 自动创建:
42
+ - task_plan.md: 阶段、目标、决策、错误日志
43
+ - findings.md: 技术发现、架构决策 (ADR)
44
+ - progress.md: 会话进度日志
45
+
46
+ # ================================================
47
+ # Workflow Artifacts 定义
48
+ # ================================================
49
+ artifacts:
50
+ # ----------------------------------------------
51
+ # Phase 0: 探索 (可选)
52
+ # ----------------------------------------------
53
+ - id: exploration
54
+ generates: exploration.md
55
+ description: 问题空间探索
56
+ optional: true
57
+ instruction: |
58
+ 在需求不明确时进行探索。
59
+
60
+ 探索内容:
61
+ 1. 问题定义
62
+ 2. 现状分析
63
+ 3. 可能方案
64
+ 4. 技术调研
65
+ 5. 风险识别
66
+
67
+ 输出:探索报告,指导后续 proposal
68
+ requires: []
69
+
70
+ # ----------------------------------------------
71
+ # Phase 1: 需求提案
72
+ # ----------------------------------------------
73
+ - id: proposal
74
+ generates: proposal.md
75
+ description: 需求探索与方案设计
76
+ template: proposal.md
77
+ instruction: |
78
+ ## 快速创建
79
+
80
+ 触发词: @brainstorming 或 /brainstorming
81
+
82
+ ## 追踪初始化 [MUST]
83
+ 执行前调用:Use the Skill tool with skill: "planning-with-files"
84
+
85
+ 创建需求提案文档,聚焦于 WHY 和 WHAT。
86
+
87
+ 关键点:
88
+ 1. 问题陈述
89
+ 2. 方案选项
90
+ 3. 成功指标
91
+ 4. 非目标
92
+ 5. 影响评估
93
+
94
+ 完成后更新 task_plan.md:
95
+ - Phase: proposal
96
+ - Status: complete
97
+ - Progress: 20%
98
+ requires: []
99
+
100
+ # ----------------------------------------------
101
+ # Phase 2: 技术设计
102
+ # ----------------------------------------------
103
+ - id: design
104
+ generates: design.md
105
+ description: 技术架构设计
106
+ template: design.md
107
+ instruction: |
108
+ 触发词: @writing-plans 或 /writing-plans
109
+
110
+ 创建技术设计文档,聚焦于 HOW。
111
+
112
+ 关键点:
113
+ 1. 架构概述
114
+ 2. 数据模型
115
+ 3. API 设计
116
+ 4. 组件设计
117
+ 5. 风险与缓解
118
+
119
+ [OPTIONAL] 架构图:Use the Skill tool with skill: "excalidraw-diagram"
120
+
121
+ 完成后更新 task_plan.md:
122
+ - Phase: design
123
+ - Status: complete
124
+ - Progress: 40%
125
+
126
+ 在 findings.md 记录架构决策(ADR)。
127
+ requires:
128
+ - proposal
129
+
130
+ # ----------------------------------------------
131
+ # Phase 3: 规格说明
132
+ # ----------------------------------------------
133
+ - id: specs
134
+ generates: specs/**/*.md
135
+ description: 功能规格说明
136
+ template: spec.md
137
+ instruction: |
138
+ 创建功能规格说明文档。
139
+
140
+ 使用 Gherkin 格式:
141
+ - Feature: 功能名称
142
+ - Scenario: 场景描述
143
+ - Given: 前置条件
144
+ - When: 触发动作
145
+ - Then: 期望结果
146
+
147
+ 覆盖三种场景:
148
+ - Happy Path: 成功路径
149
+ - Edge Cases: 边界情况
150
+ - Error Cases: 错误处理
151
+
152
+ 完成后更新 task_plan.md:
153
+ - Phase: specs
154
+ - Status: complete
155
+ - Progress: 60%
156
+ requires:
157
+ - design
158
+
159
+ # ----------------------------------------------
160
+ # Phase 4: 任务分解
161
+ # ----------------------------------------------
162
+ - id: tasks
163
+ generates: tasks.md
164
+ description: 实现任务清单
165
+ template: tasks.md
166
+ instruction: |
167
+ 触发词: @executing-plans 或 /executing-plans
168
+
169
+ 创建任务分解清单。
170
+
171
+ 任务粒度要求:
172
+ - 每个任务 2-5 分钟可完成
173
+ - 每个任务有明确的验证步骤
174
+ - 任务按批次组织
175
+ - 使用 `- [ ] X.Y Task description` 格式
176
+
177
+ 完成后更新 task_plan.md:
178
+ - Phase: tasks
179
+ - Status: complete
180
+ - Progress: 80%
181
+
182
+ 准备进入 apply 阶段。
183
+ requires:
184
+ - specs
185
+
186
+ # ================================================
187
+ # Fast-Forward 模式
188
+ # ================================================
189
+ fastForward:
190
+ enabled: true
191
+ command: ff
192
+ description: 一键生成所有规划文档
193
+ artifacts:
194
+ - proposal
195
+ - design
196
+ - specs
197
+ - tasks
198
+ instruction: |
199
+ 快速生成所有规划文档。
200
+
201
+ 执行流程:
202
+ 1. 初始化追踪层
203
+ 2. 依次创建 proposal → design → specs → tasks
204
+ 3. 更新进度追踪
205
+
206
+ 适用场景:
207
+ - 需求明确
208
+ - 时间紧迫
209
+ - 中小型功能
210
+
211
+ # ================================================
212
+ # Apply 阶段配置
213
+ # ================================================
214
+ apply:
215
+ requires:
216
+ - tasks
217
+ tracks: tasks.md
218
+ instruction: |
219
+ ## 执行流程
220
+
221
+ 1. 读取 tasks.md 获取任务列表
222
+ 2. 读取 task_plan.md 获取执行状态
223
+ 3. 按批次执行任务
224
+ 4. 完成任务后:
225
+ - 更新 tasks.md 的 checkbox: `- [ ]` → `- [x]`
226
+ - 更新 task_plan.md 的 Progress
227
+ - 记录 progress.md 操作日志
228
+
229
+ ## 错误处理(3-Strike 协议)
230
+
231
+ | 尝试 | 动作 |
232
+ |------|------|
233
+ | Attempt 1 | 诊断并修复 |
234
+ | Attempt 2 | 尝试替代方案 |
235
+ | Attempt 3 | 重新思考问题 |
236
+ | 3次失败 | 升级给用户 |
237
+
238
+ 在 task_plan.md 的错误日志中记录每次尝试。
239
+
240
+ ## 完成标准
241
+
242
+ - 所有 tasks.md 的 checkbox 已勾选
243
+ - task_plan.md Progress: 100%
244
+ - 所有验证步骤通过
245
+
246
+ # ================================================
247
+ # Verify 阶段配置
248
+ # ================================================
249
+ verify:
250
+ dimensions:
251
+ - completeness
252
+ - correctness
253
+ - coherence
254
+ instruction: |
255
+ 验证实现与文档的一致性。
256
+
257
+ 检查维度:
258
+ 1. Completeness (完整性)
259
+ - 所有任务完成
260
+ - 所有需求实现
261
+ - 所有场景覆盖
262
+
263
+ 2. Correctness (正确性)
264
+ - 实现符合规格意图
265
+ - 边界情况处理
266
+ - 错误状态匹配
267
+
268
+ 3. Coherence (一致性)
269
+ - 设计决策体现在代码中
270
+ - 命名规范一致
271
+ - 模式使用一致
272
+
273
+ # ================================================
274
+ # Archive 阶段配置
275
+ # ================================================
276
+ archive:
277
+ syncSpecs: true
278
+ moveToArchive: true
279
+ instruction: |
280
+ 归档完成的变更。
281
+
282
+ 执行流程:
283
+ 1. 检查所有 artifact 状态
284
+ 2. 同步 delta specs 到 main specs
285
+ 3. 移动到 archive 目录
286
+ 4. 更新项目状态