feat: Enhance spec management with new hooks and settings features

- Updated test cycle execution steps to streamline agent execution.
- Improved HookDialog component with enhanced validation messages and localization.
- Introduced SpecDialog component for better spec management.
- Added new hooks for fetching and updating specs list and frontmatter.
- Implemented API functions for specs list retrieval and index rebuilding.
- Added localization support for new specs settings and hooks.
- Enhanced SpecsSettingsPage to manage project and personal specs effectively.
- Updated CLI commands to support keyword-based spec loading.
- Improved spec index builder to categorize specs by workflow stages.
This commit is contained in:
catlog22
2026-02-26 22:52:33 +08:00
parent 6155fcc7b8
commit 151b81ee4a
51 changed files with 731 additions and 690 deletions

View File

@@ -148,7 +148,7 @@ Priority: <issue.priority>
## MANDATORY FIRST STEPS
1. Run: ccw tool exec get_modules_by_depth '{}'
2. Execute ACE searches based on issue keywords
3. Read: .workflow/project-tech.json (if exists)
3. Run: ccw spec load --keywords exploration
## Exploration Focus
- Identify files directly related to this issue

View File

@@ -81,7 +81,7 @@ Session: ${sessionFolder}
## MANDATORY FIRST STEPS
1. Run: ccw tool exec get_modules_by_depth '{}'
2. Execute searches: ${strategy.searches.map(s => `"${s}"`).join(', ')}
3. Read: .workflow/project-tech.json (if exists)
3. Run: ccw spec load --keywords exploration
## Exploration Focus (${perspective} angle)
- **Depth**: ${strategy.depth}

View File

@@ -138,7 +138,7 @@ Session: <session-folder>
## MANDATORY FIRST STEPS
1. Run: ccw tool exec get_modules_by_depth '{}'
2. Execute relevant searches based on topic keywords
3. Read: .workflow/project-tech.json (if exists)
3. Run: ccw spec load --keywords exploration
## Exploration Focus (<perspective> angle)
<dimensions map to exploration focus areas>

View File

@@ -93,10 +93,11 @@ rg "password|token|secret|auth" -g "*.{ts,js,py}"
rg "eval|exec|innerHTML|dangerouslySetInnerHTML" -g "*.{ts,js,tsx}"
# Gemini security analysis
ccw spec load --keywords execution
ccw cli -p "
PURPOSE: Security audit of completed implementation
TASK: Review code for security vulnerabilities, insecure patterns, auth/authz issues
CONTEXT: @.summaries/IMPL-*.md,../.. @../../project-tech.json @../../specs/*.md
CONTEXT: @.summaries/IMPL-*.md,../..
EXPECTED: Security findings report with severity levels
RULES: Focus on OWASP Top 10, authentication, authorization, data validation, injection risks
" --tool gemini --mode write --cd ${sessionPath}
@@ -104,10 +105,11 @@ RULES: Focus on OWASP Top 10, authentication, authorization, data validation, in
**Architecture Review** (`architecture`):
```bash
ccw spec load --keywords execution
ccw cli -p "
PURPOSE: Architecture compliance review
TASK: Evaluate adherence to architectural patterns, identify technical debt, review design decisions
CONTEXT: @.summaries/IMPL-*.md,../.. @../../project-tech.json @../../specs/*.md
CONTEXT: @.summaries/IMPL-*.md,../..
EXPECTED: Architecture assessment with recommendations
RULES: Check for patterns, separation of concerns, modularity, scalability
" --tool qwen --mode write --cd ${sessionPath}
@@ -115,10 +117,11 @@ RULES: Check for patterns, separation of concerns, modularity, scalability
**Quality Review** (`quality`):
```bash
ccw spec load --keywords execution
ccw cli -p "
PURPOSE: Code quality and best practices review
TASK: Assess code readability, maintainability, adherence to best practices
CONTEXT: @.summaries/IMPL-*.md,../.. @../../project-tech.json @../../specs/*.md
CONTEXT: @.summaries/IMPL-*.md,../..
EXPECTED: Quality assessment with improvement suggestions
RULES: Check for code smells, duplication, complexity, naming conventions
" --tool gemini --mode write --cd ${sessionPath}
@@ -136,10 +139,11 @@ for task_file in ${sessionPath}/.task/*.json; do
done
# Cross-check implementation against requirements
ccw spec load --keywords execution
ccw cli -p "
PURPOSE: Verify all requirements and acceptance criteria are met
TASK: Cross-check implementation summaries against original requirements
CONTEXT: @.task/IMPL-*.json,.summaries/IMPL-*.md,../.. @../../project-tech.json @../../specs/*.md
CONTEXT: @.task/IMPL-*.json,.summaries/IMPL-*.md,../..
EXPECTED:
- Requirements coverage matrix
- Acceptance criteria verification

View File

@@ -126,17 +126,11 @@ if (autoYes) {
After collecting preferences, enhance context and dispatch:
```javascript
// Step 1: Check for project context files
const hasProjectTech = fileExists('.workflow/project-tech.json')
const hasProjectGuidelines = fileExists('.workflow/specs/*.md')
// Step 1: Load project context via ccw spec
Bash('ccw spec load --keywords planning')
// Step 2: Log available context
if (hasProjectTech) {
console.log('Project tech context available: .workflow/project-tech.json')
}
if (hasProjectGuidelines) {
console.log('Project guidelines available: .workflow/specs/*.md')
}
console.log('Project context loaded via: ccw spec load --keywords planning')
// Step 3: Dispatch to phase (workflowPreferences available as context)
if (mode === 'plan') {

View File

@@ -494,9 +494,9 @@ Generate implementation plan and write plan.json.
## Output Schema Reference
Execute: cat ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json (get schema reference before generating plan)
## Project Context (MANDATORY - Read Both Files)
1. Read: .workflow/project-tech.json (technology stack, architecture, key components)
2. Read: .workflow/specs/*.md (user-defined constraints and conventions)
## Project Context (MANDATORY - Load via ccw spec)
Execute: ccw spec load --keywords planning
This loads technology stack, architecture, key components, and user-defined constraints/conventions.
**CRITICAL**: All generated tasks MUST comply with constraints in specs/*.md

View File

@@ -485,7 +485,8 @@ ${(t.test?.success_metrics || []).length > 0 ? `\n**Success metrics**: ${t.test.
context.push(`### Artifacts\nPlan: ${executionContext.session.artifacts.plan}`)
}
// Project guidelines (user-defined constraints from /workflow:session:solidify)
context.push(`### Project Guidelines\n@.workflow/specs/*.md`)
// Loaded via: ccw spec load --keywords planning
context.push(`### Project Guidelines\n(Loaded via ccw spec load --keywords planning)`)
if (context.length > 0) sections.push(`## Context\n${context.join('\n\n')}`)
sections.push(`Complete each task according to its "Done when" checklist.`)

View File

@@ -100,17 +100,11 @@ if (autoYes) {
After collecting preferences, enhance context and dispatch:
```javascript
// Step 1: Check for project context files
const hasProjectTech = fileExists('.workflow/project-tech.json')
const hasProjectGuidelines = fileExists('.workflow/specs/*.md')
// Step 1: Load project context via ccw spec
Bash('ccw spec load --keywords planning')
// Step 2: Log available context
if (hasProjectTech) {
console.log('Project tech context available: .workflow/project-tech.json')
}
if (hasProjectGuidelines) {
console.log('Project guidelines available: .workflow/specs/*.md')
}
console.log('Project context loaded via: ccw spec load --keywords planning')
// Step 3: Dispatch to phase (workflowPreferences available as context)
if (mode === 'plan') {

View File

@@ -203,7 +203,7 @@ This is the PRIMARY context source - all subsequent analysis must align with use
Execute complete context-search-agent workflow (Phase 1-3) for implementation planning.
Key emphasis:
- Load project-tech.json and specs/*.md FIRST (per your spec Phase 1.1b)
- Run: ccw spec load --keywords exploration FIRST (per your spec Phase 1.1b)
- Synthesize exploration results with project context
- Generate prioritized_context with user_intent alignment
- Apply specs/*.md constraints during conflict detection

View File

@@ -170,21 +170,21 @@ Output:
Session ID: ${sessionId}
MCP Capabilities: {exa_code, exa_web, code_index}
## PROJECT CONTEXT (MANDATORY - load before planning-notes)
These files provide project-level constraints that apply to ALL tasks:
## PROJECT CONTEXT (MANDATORY - load via ccw spec)
Execute: ccw spec load --keywords planning
1. **.workflow/project-tech.json** (auto-generated tech analysis)
- Contains: tech_stack, architecture_type, key_components, build_system, test_framework
- Usage: Populate plan.json shared_context, align task tech choices, set correct test commands
- If missing: Fall back to context-package.project_context
This loads:
- Technology stack, architecture, key components, build system, test framework
- User-maintained rules and constraints (coding_conventions, naming_rules, forbidden_patterns, quality_gates)
2. **.workflow/specs/*.md** (user-maintained rules and constraints)
- Contains: coding_conventions, naming_rules, forbidden_patterns, quality_gates, custom_constraints
- Usage: Apply as HARD CONSTRAINTS on all generated tasks — task implementation steps,
acceptance criteria, and convergence.verification MUST respect these guidelines
- If empty/missing: No additional constraints (proceed normally)
Usage:
- Populate plan.json shared_context, align task tech choices, set correct test commands
- Apply as HARD CONSTRAINTS on all generated tasks — task implementation steps,
acceptance criteria, and convergence.verification MUST respect these guidelines
Loading order: project-tech.json → specs/*.md → planning-notes.md → context-package.json
If spec load returns empty: Proceed normally with context-package.project_context
Loading order: ccw spec load → planning-notes.md → context-package.json
## USER CONFIGURATION (from Step 4.0)
Execution Method: ${userConfig.executionMethod} // agent|hybrid|cli

View File

@@ -221,8 +221,7 @@ Execute complete context-search-agent workflow for TDD implementation planning:
### Phase 1: Initialization & Pre-Analysis
1. **Project State Loading**:
- Read and parse .workflow/project-tech.json. Use its overview section as the foundational project_context.
- Read and parse .workflow/specs/*.md. Load conventions, constraints, and learnings into a project_guidelines section.
- Run: \`ccw spec load --keywords execution\` to load project context, tech stack, and guidelines.
- If files don't exist, proceed with fresh analysis.
2. **Detection**: Check for existing context-package (early exit if valid)
3. **Foundation**: Initialize CodexLens, get project structure, load docs

View File

@@ -231,18 +231,14 @@ MCP Capabilities: {exa_code, exa_web, code_index}
## PROJECT CONTEXT (MANDATORY - load before planning-notes)
These files provide project-level constraints that apply to ALL tasks:
1. **.workflow/project-tech.json** (auto-generated tech analysis)
- Contains: tech_stack, architecture_type, key_components, build_system, test_framework
1. **ccw spec load --keywords execution** (project specs and tech analysis)
- Contains: tech_stack, architecture_type, key_components, build_system, test_framework, coding_conventions, naming_rules, forbidden_patterns, quality_gates, custom_constraints
- Usage: Populate plan.json shared_context, align task tech choices, set correct test commands
- If missing: Fall back to context-package.project_context
2. **.workflow/specs/*.md** (user-maintained rules and constraints)
- Contains: coding_conventions, naming_rules, forbidden_patterns, quality_gates, custom_constraints
- Usage: Apply as HARD CONSTRAINTS on all generated tasks — task implementation steps,
- Apply as HARD CONSTRAINTS on all generated tasks — task implementation steps,
acceptance criteria, and convergence.verification MUST respect these guidelines
- If empty/missing: No additional constraints (proceed normally)
Loading order: project-tech.json → specs/*.md → planning-notes.md → context-package.json
Loading order: \`ccw spec load --keywords execution\` → planning-notes.md → context-package.json
## USER CONFIGURATION (from Phase 0)
Execution Method: ${userConfig.executionMethod} // agent|hybrid|cli

View File

@@ -345,8 +345,7 @@ Execute complete context-search-agent workflow for implementation planning:
### Phase 1: Initialization & Pre-Analysis
1. **Project State Loading**:
- Read and parse .workflow/project-tech.json. Use its overview section as the foundational project_context.
- Read and parse .workflow/specs/*.md. Load conventions, constraints, and learnings into a project_guidelines section.
- Run: \`ccw spec load --keywords execution\` to load project context, tech stack, and guidelines.
- If files don't exist, proceed with fresh analysis.
2. **Detection**: Check for existing context-package (early exit if valid)
3. **Foundation**: Initialize CodexLens, get project structure, load docs

View File

@@ -244,8 +244,7 @@ Task(
${selectedStrategy} - ${strategyDescription}
## PROJECT CONTEXT (MANDATORY)
1. Read: .workflow/project-tech.json (tech stack, test framework, build system)
2. Read: .workflow/specs/*.md (constraints — apply as HARD CONSTRAINTS on fixes)
1. Run: \`ccw spec load --keywords execution\` (tech stack, test framework, build system, constraints)
## MANDATORY FIRST STEPS
1. Read test results: ${session.test_results_path}