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

@@ -54,14 +54,11 @@ Phase 4: Output Generation
- Other schemas as specified in prompt
Read and memorize schema requirements BEFORE any analysis begins (feeds Phase 3 validation).
3. **Project Context Loading** (from init.md products):
- Read `.workflow/project-tech.json` (if exists):
3. **Project Context Loading** (from spec system):
- Load exploration specs using: `ccw spec load --keywords exploration`
- Extract: `tech_stack`, `architecture`, `key_components`, `overview`
- Usage: Align analysis scope and patterns with actual project technology choices
- Read `.workflow/specs/*.md` (if exists):
- Extract: `conventions`, `constraints`, `quality_rules`, `learnings`
- Usage: Apply as constraints during pattern analysis, integration point evaluation, and recommendations
- If either file does not exist, proceed with fresh analysis (no error).
- If no specs are returned, proceed with fresh analysis (no error).
4. **Task Keyword Search** (initial file discovery):
```bash

View File

@@ -54,9 +54,8 @@ When invoked with `process_docs: true` in input context:
## Input Context
**Project Context** (read from init.md products at startup):
- `.workflow/project-tech.json` → tech_stack, architecture, key_components
- `.workflow/specs/*.md` → conventions, constraints, quality_rules
**Project Context** (loaded from spec system at startup):
- Load specs using: `ccw spec load --keywords "exploration architecture"` → tech_stack, architecture, key_components, conventions, constraints, quality_rules
```javascript
{

View File

@@ -77,14 +77,11 @@ if (file_exists(contextPackagePath)) {
**1.1b Project Context Loading** (MANDATORY):
```javascript
// Load project-level context (from workflow:init products)
// Load project-level context (from spec system)
// These provide foundational constraints for ALL context gathering
const projectTech = file_exists('.workflow/project-tech.json')
? JSON.parse(Read('.workflow/project-tech.json')) // tech_stack, architecture_type, key_components, build_system, test_framework
: null;
const projectGuidelines = file_exists('.workflow/specs/*.md')
? JSON.parse(Read('.workflow/specs/*.md')) // coding_conventions, naming_rules, forbidden_patterns, quality_gates
: null;
const projectSpecs = Bash('ccw spec load --keywords "exploration architecture" --stdin');
const projectTech = projectSpecs?.tech_stack ? projectSpecs : null;
const projectGuidelines = projectSpecs?.coding_conventions ? projectSpecs : null;
// Usage:
// - projectTech → Populate project_context fields (tech_stack, architecture_patterns)

View File

@@ -35,9 +35,8 @@ Phase 5: Fix & Verification
## Phase 1: Bug Analysis
**Load Project Context** (from init.md products):
- Read `.workflow/project-tech.json` (if exists) for tech stack context
- Read `.workflow/specs/*.md` (if exists) for coding constraints
**Load Project Context** (from spec system):
- Load exploration specs using: `ccw spec load --keywords exploration` for tech stack context and coding constraints
**Session Setup**:
```javascript

View File

@@ -98,22 +98,18 @@ if (isPopulated) {
### Step 2: Load Project Context
```javascript
const projectTech = JSON.parse(Read('.workflow/project-tech.json'))
// Load project context via ccw spec load for planning context
const projectContext = Bash('ccw spec load --keywords planning 2>/dev/null || echo "{}"')
const specData = JSON.parse(projectContext)
// Extract key info for generating smart questions
const languages = projectTech.technology_analysis?.technology_stack?.languages
|| projectTech.overview?.technology_stack?.languages || []
// Extract key info from loaded specs for generating smart questions
const languages = specData.overview?.technology_stack?.languages || []
const primaryLang = languages.find(l => l.primary)?.name || languages[0]?.name || 'Unknown'
const frameworks = projectTech.technology_analysis?.technology_stack?.frameworks
|| projectTech.overview?.technology_stack?.frameworks || []
const testFrameworks = projectTech.technology_analysis?.technology_stack?.test_frameworks
|| projectTech.overview?.technology_stack?.test_frameworks || []
const archStyle = projectTech.technology_analysis?.architecture?.style
|| projectTech.overview?.architecture?.style || 'Unknown'
const archPatterns = projectTech.technology_analysis?.architecture?.patterns
|| projectTech.overview?.architecture?.patterns || []
const buildTools = projectTech.technology_analysis?.technology_stack?.build_tools
|| projectTech.overview?.technology_stack?.build_tools || []
const frameworks = specData.overview?.technology_stack?.frameworks || []
const testFrameworks = specData.overview?.technology_stack?.test_frameworks || []
const archStyle = specData.overview?.architecture?.style || 'Unknown'
const archPatterns = specData.overview?.architecture?.patterns || []
const buildTools = specData.overview?.technology_stack?.build_tools || []
```
### Step 3: Multi-Round Interactive Questionnaire

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}