feat(workflow): add unified workflow spec command system

- Add /workflow:init-specs command for interactive spec creation with scope selection (global/project)
- Update /workflow:init to chain solidify and add --skip-specs flag
- Add category field support to generated specs frontmatter
- Add GET /api/project-tech/stats endpoint for development progress stats
- Add devProgressInjection settings to system configuration
- Add development progress injection control card to GlobalSettingsTab
- Add i18n keys for new settings in en/zh locales
This commit is contained in:
catlog22
2026-02-27 12:25:26 +08:00
parent 4d755ff9b4
commit 99a3561f71
10 changed files with 877 additions and 33 deletions

View File

@@ -1,10 +1,11 @@
---
name: init
description: Initialize project-level state with intelligent project analysis using cli-explore-agent
argument-hint: "[--regenerate]"
argument-hint: "[--regenerate] [--skip-specs]"
examples:
- /workflow:init
- /workflow:init --regenerate
- /workflow:init --skip-specs
---
# Workflow Init Command (/workflow:init)
@@ -22,13 +23,15 @@ Initialize `.workflow/project-tech.json` and `.workflow/specs/*.md` with compreh
```bash
/workflow:init # Initialize (skip if exists)
/workflow:init --regenerate # Force regeneration
/workflow:init --skip-specs # Initialize project-tech only, skip spec initialization
```
## Execution Process
```
Input Parsing:
─ Parse --regenerate flag → regenerate = true | false
─ Parse --regenerate flag → regenerate = true | false
└─ Parse --skip-specs flag → skipSpecs = true | false
Decision:
├─ BOTH_EXIST + no --regenerate → Exit: "Already initialized"
@@ -42,27 +45,30 @@ Analysis Flow:
│ ├─ Semantic analysis (Gemini CLI)
│ ├─ Synthesis and merge
│ └─ Write .workflow/project-tech.json
├─ Create guidelines scaffold (if not exists)
Write .workflow/specs/*.md (empty structure)
├─ Display summary
└─ Ask about guidelines configuration
├─ If guidelines empty → Ask user: "Configure now?" or "Skip"
├─ Configure now → Skill(skill="workflow:init-guidelines")
Skip → Show next steps
└─ If guidelines populated → Show next steps only
├─ Spec Initialization (if not --skip-specs)
Check if specs/*.md exist
├─ If NOT_FOUND → Run ccw spec init
│ ├─ Run ccw spec rebuild
└─ Ask about guidelines configuration
├─ If guidelines empty → Ask user: "Configure now?" or "Skip"
Configure now → Skill(skill="workflow:init-guidelines")
│ └─ Skip → Show next steps
│ └─ If guidelines populated → Show next steps only
└─ Display summary
Output:
├─ .workflow/project-tech.json (+ .backup if regenerate)
└─ .workflow/specs/*.md (scaffold or configured)
└─ .workflow/specs/*.md (scaffold or configured, unless --skip-specs)
```
## Implementation
### Step 1: Parse Input and Check Existing State
**Parse --regenerate flag**:
**Parse flags**:
```javascript
const regenerate = $ARGUMENTS.includes('--regenerate')
const skipSpecs = $ARGUMENTS.includes('--skip-specs')
```
**Check existing state**:
@@ -159,13 +165,20 @@ Project root: ${projectRoot}
)
```
### Step 3.5: Initialize Spec System (if not exists)
### Step 3.5: Initialize Spec System (if not --skip-specs)
```javascript
// Initialize spec system if not already initialized
if (!file_exists('.workflow/specs/coding-conventions.md')) {
Bash('ccw spec init');
Bash('ccw spec rebuild');
// Skip spec initialization if --skip-specs flag is provided
if (!skipSpecs) {
// Initialize spec system if not already initialized
const specsCheck = Bash('test -f .workflow/specs/coding-conventions.md && echo EXISTS || echo NOT_FOUND')
if (specsCheck.includes('NOT_FOUND')) {
console.log('Initializing spec system...')
Bash('ccw spec init')
Bash('ccw spec rebuild')
}
} else {
console.log('Skipping spec initialization (--skip-specs)')
}
```
@@ -173,7 +186,7 @@ if (!file_exists('.workflow/specs/coding-conventions.md')) {
```javascript
const projectTech = JSON.parse(Read('.workflow/project-tech.json'));
const specsInitialized = file_exists('.workflow/specs/coding-conventions.md');
const specsInitialized = !skipSpecs && file_exists('.workflow/specs/coding-conventions.md');
console.log(`
Project initialized successfully
@@ -193,16 +206,27 @@ Components: ${projectTech.overview.key_components.length} core modules
---
Files created:
- Tech analysis: .workflow/project-tech.json
- Specs: .workflow/specs/ ${specsInitialized ? '(initialized)' : ''}
${!skipSpecs ? `- Specs: .workflow/specs/ ${specsInitialized ? '(initialized)' : ''}` : '- Specs: (skipped via --skip-specs)'}
${regenerate ? '- Backup: .workflow/project-tech.json.backup' : ''}
`);
```
### Step 5: Ask About Guidelines Configuration
### Step 5: Ask About Guidelines Configuration (if not --skip-specs)
After displaying the summary, ask the user if they want to configure project guidelines interactively.
After displaying the summary, ask the user if they want to configure project guidelines interactively. Skip this step if `--skip-specs` was provided.
```javascript
// Skip guidelines configuration if --skip-specs was provided
if (skipSpecs) {
console.log(`
Next steps:
- Use /workflow:init-specs to create individual specs
- Use /workflow:init-guidelines to configure specs interactively
- Use /workflow:plan to start planning
`);
return;
}
// Check if specs have user content beyond seed documents
const specsList = Bash('ccw spec list --json');
const specsCount = JSON.parse(specsList).total || 0;
@@ -233,6 +257,7 @@ if (specsCount <= 5) {
} else {
console.log(`
Next steps:
- Use /workflow:init-specs to create individual specs
- Use /workflow:init-guidelines to configure specs interactively
- Use ccw spec load to import specs from external sources
- Use /workflow:plan to start planning
@@ -243,6 +268,7 @@ Next steps:
Specs already configured (${specsCount} spec files).
Next steps:
- Use /workflow:init-specs to create additional specs
- Use /workflow:init-guidelines --reset to reconfigure
- Use /workflow:session:solidify to add individual rules
- Use /workflow:plan to start planning
@@ -258,6 +284,7 @@ Next steps:
## Related Commands
- `/workflow:init-specs` - Interactive wizard to create individual specs with scope selection
- `/workflow:init-guidelines` - Interactive wizard to configure project guidelines (called after init)
- `/workflow:session:solidify` - Add individual rules/constraints one at a time
- `workflow-plan` skill - Start planning with initialized project context