feat: add category and scope to specs for enhanced filtering and organization

- Introduced SpecCategory and SpecScope types to categorize specs by workflow stage and scope (global/project).
- Updated Spec interface to include category and scope properties.
- Enhanced SpecCard component to display category and scope badges.
- Implemented category and scope filtering in SpecsSettingsPage.
- Updated localization files to support new category and scope labels.
- Modified spec loading commands to utilize category instead of keywords.
- Adjusted spec index builder to handle category and scope during spec parsing.
- Updated seed documents to include category information.
This commit is contained in:
catlog22
2026-02-26 23:43:55 +08:00
parent 052e25dddb
commit dfa8e0d9f5
47 changed files with 619 additions and 179 deletions

View File

@@ -55,7 +55,7 @@ Phase 4: Output Generation
Read and memorize schema requirements BEFORE any analysis begins (feeds Phase 3 validation).
3. **Project Context Loading** (from spec system):
- Load exploration specs using: `ccw spec load --keywords exploration`
- Load exploration specs using: `ccw spec load --category exploration`
- Extract: `tech_stack`, `architecture`, `key_components`, `overview`
- Usage: Align analysis scope and patterns with actual project technology choices
- If no specs are returned, proceed with fresh analysis (no error).

View File

@@ -55,7 +55,7 @@ When invoked with `process_docs: true` in input context:
## Input Context
**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
- Load specs using: `ccw spec load --category "exploration architecture"` → tech_stack, architecture, key_components, conventions, constraints, quality_rules
```javascript
{

View File

@@ -79,7 +79,7 @@ if (file_exists(contextPackagePath)) {
```javascript
// Load project-level context (from spec system)
// These provide foundational constraints for ALL context gathering
const projectSpecs = Bash('ccw spec load --keywords "exploration architecture" --stdin');
const projectSpecs = Bash('ccw spec load --category "exploration architecture" --stdin');
const projectTech = projectSpecs?.tech_stack ? projectSpecs : null;
const projectGuidelines = projectSpecs?.coding_conventions ? projectSpecs : null;

View File

@@ -36,7 +36,7 @@ Phase 5: Fix & Verification
## Phase 1: Bug Analysis
**Load Project Context** (from spec system):
- Load exploration specs using: `ccw spec load --keywords exploration` for tech stack context and coding constraints
- Load exploration specs using: `ccw spec load --category exploration` for tech stack context and coding constraints
**Session Setup**:
```javascript

View File

@@ -99,7 +99,7 @@ if (isPopulated) {
```javascript
// Load project context via ccw spec load for planning context
const projectContext = Bash('ccw spec load --keywords planning 2>/dev/null || echo "{}"')
const projectContext = Bash('ccw spec load --category planning 2>/dev/null || echo "{}"')
const specData = JSON.parse(projectContext)
// Extract key info from loaded specs for generating smart questions

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. Run: ccw spec load --keywords exploration
3. Run: ccw spec load --category 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. Run: ccw spec load --keywords exploration
3. Run: ccw spec load --category 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. Run: ccw spec load --keywords exploration
3. Run: ccw spec load --category exploration
## Exploration Focus (<perspective> angle)
<dimensions map to exploration focus areas>

View File

@@ -93,7 +93,7 @@ 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 spec load --category execution
ccw cli -p "
PURPOSE: Security audit of completed implementation
TASK: Review code for security vulnerabilities, insecure patterns, auth/authz issues
@@ -105,7 +105,7 @@ RULES: Focus on OWASP Top 10, authentication, authorization, data validation, in
**Architecture Review** (`architecture`):
```bash
ccw spec load --keywords execution
ccw spec load --category execution
ccw cli -p "
PURPOSE: Architecture compliance review
TASK: Evaluate adherence to architectural patterns, identify technical debt, review design decisions
@@ -117,7 +117,7 @@ RULES: Check for patterns, separation of concerns, modularity, scalability
**Quality Review** (`quality`):
```bash
ccw spec load --keywords execution
ccw spec load --category execution
ccw cli -p "
PURPOSE: Code quality and best practices review
TASK: Assess code readability, maintainability, adherence to best practices
@@ -139,7 +139,7 @@ for task_file in ${sessionPath}/.task/*.json; do
done
# Cross-check implementation against requirements
ccw spec load --keywords execution
ccw spec load --category execution
ccw cli -p "
PURPOSE: Verify all requirements and acceptance criteria are met
TASK: Cross-check implementation summaries against original requirements

View File

@@ -127,10 +127,10 @@ After collecting preferences, enhance context and dispatch:
```javascript
// Step 1: Load project context via ccw spec
Bash('ccw spec load --keywords planning')
Bash('ccw spec load --category planning')
// Step 2: Log available context
console.log('Project context loaded via: ccw spec load --keywords planning')
console.log('Project context loaded via: ccw spec load --category planning')
// Step 3: Dispatch to phase (workflowPreferences available as context)
if (mode === 'plan') {

View File

@@ -495,7 +495,7 @@ Generate implementation plan and write plan.json.
Execute: cat ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json (get schema reference before generating plan)
## Project Context (MANDATORY - Load via ccw spec)
Execute: ccw spec load --keywords planning
Execute: ccw spec load --category 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,8 +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)
// Loaded via: ccw spec load --keywords planning
context.push(`### Project Guidelines\n(Loaded via ccw spec load --keywords planning)`)
// Loaded via: ccw spec load --category planning
context.push(`### Project Guidelines\n(Loaded via ccw spec load --category 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

@@ -101,10 +101,10 @@ After collecting preferences, enhance context and dispatch:
```javascript
// Step 1: Load project context via ccw spec
Bash('ccw spec load --keywords planning')
Bash('ccw spec load --category planning')
// Step 2: Log available context
console.log('Project context loaded via: ccw spec load --keywords planning')
console.log('Project context loaded via: ccw spec load --category 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:
- Run: ccw spec load --keywords exploration FIRST (per your spec Phase 1.1b)
- Run: ccw spec load --category 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

@@ -171,7 +171,7 @@ Session ID: ${sessionId}
MCP Capabilities: {exa_code, exa_web, code_index}
## PROJECT CONTEXT (MANDATORY - load via ccw spec)
Execute: ccw spec load --keywords planning
Execute: ccw spec load --category planning
This loads:
- Technology stack, architecture, key components, build system, test framework

View File

@@ -221,7 +221,7 @@ Execute complete context-search-agent workflow for TDD implementation planning:
### Phase 1: Initialization & Pre-Analysis
1. **Project State Loading**:
- Run: \`ccw spec load --keywords execution\` to load project context, tech stack, and guidelines.
- Run: \`ccw spec load --category 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,14 +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. **ccw spec load --keywords execution** (project specs and tech analysis)
1. **ccw spec load --category 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
- 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: \`ccw spec load --keywords execution\` → planning-notes.md → context-package.json
Loading order: \`ccw spec load --category execution\` → planning-notes.md → context-package.json
## USER CONFIGURATION (from Phase 0)
Execution Method: ${userConfig.executionMethod} // agent|hybrid|cli

View File

@@ -345,7 +345,7 @@ Execute complete context-search-agent workflow for implementation planning:
### Phase 1: Initialization & Pre-Analysis
1. **Project State Loading**:
- Run: \`ccw spec load --keywords execution\` to load project context, tech stack, and guidelines.
- Run: \`ccw spec load --category 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,7 +244,7 @@ Task(
${selectedStrategy} - ${strategyDescription}
## PROJECT CONTEXT (MANDATORY)
1. Run: \`ccw spec load --keywords execution\` (tech stack, test framework, build system, constraints)
1. Run: \`ccw spec load --category execution\` (tech stack, test framework, build system, constraints)
## MANDATORY FIRST STEPS
1. Read test results: ${session.test_results_path}