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

@@ -21,7 +21,7 @@ Check these items. Report results as a checklist.
### 1.2 Strongly Recommended (warn if missing)
- **Project specs**: Run `ccw spec load --keywords execution` to load project context
- **Project specs**: Run `ccw spec load --category execution` to load project context
- If spec system unavailable: Read `package.json` / `tsconfig.json` / `pyproject.toml` and generate a minimal version. Ask user: "检测到项目使用 [tech stack], 是否正确?需要补充什么?"
- **Test framework**: Detect from config files (jest.config, vitest.config, pytest.ini, etc.)
- If missing: Ask user: "未检测到测试框架配置,请指定测试命令(如 `npm test`, `pytest`),或输入 'skip' 跳过测试验证"
@@ -36,7 +36,7 @@ Print formatted checklist:
✓ 项目根目录: D:\myproject
✓ 工作空间: .workflow/.cycle/ 就绪
⚠ Git: 3 个未提交变更
✓ Project specs: 已加载 (ccw spec load --keywords execution)
✓ Project specs: 已加载 (ccw spec load --category execution)
⚠ specs: 未找到 (已跳过)
✓ 测试框架: jest (npm test)
```
@@ -170,7 +170,7 @@ Read the user's `$TASK` and score each dimension:
For dimensions still at score 1 after Q&A, auto-enhance from codebase:
- **Scope**: Use `Glob` and `Grep` to find related files, list them
- **Context**: Run `ccw spec load --keywords execution` to load project context
- **Context**: Run `ccw spec load --category execution` to load project context
- **Constraints**: Infer from `specs/*.md` and existing patterns
### 2.5 Assemble Refined Task

View File

@@ -21,7 +21,7 @@ Check these items. Report results as a checklist.
### 1.2 Strongly Recommended (warn if missing)
- **Project specs**: Run `ccw spec load --keywords planning` to load project context
- **Project specs**: Run `ccw spec load --category planning` to load project context
- If spec system unavailable: WARN — Phase 1 will call `workflow:init` to initialize. Ask user: "检测到项目使用 [tech stack from package.json], 是否正确?需要补充什么?"
- **Test framework**: Detect from config files (jest.config, vitest.config, pytest.ini, etc.)
- If missing: Ask: "未检测到测试框架,请指定测试命令(如 `npm test`),或输入 'skip' 跳过"
@@ -36,7 +36,7 @@ Print formatted checklist:
✓ 项目根目录: D:\myproject
✓ .workflow/ 目录就绪
⚠ Git: 3 个未提交变更
✓ Project specs: 已加载 (ccw spec load --keywords planning)
✓ Project specs: 已加载 (ccw spec load --category planning)
⚠ specs: 未找到 (Phase 1 将初始化)
✓ 测试框架: jest (npm test)
```
@@ -160,7 +160,7 @@ Each dimension scores 0-2 (0=missing, 1=vague, 2=clear). **Total minimum: 6/10 t
For dimensions still at score 1 after Q&A, auto-enhance from codebase:
- **Scope**: Use `Glob` and `Grep` to find related files
- **Context**: Run `ccw spec load --keywords planning` to load project context
- **Context**: Run `ccw spec load --category planning` to load project context
- **Constraints**: Infer from `specs/*.md`
### 2.5 Assemble Structured Description

View File

@@ -85,7 +85,7 @@ Step 1: Topic Understanding
Step 2: Exploration (Inline, No Agents)
├─ Detect codebase → search relevant modules, patterns
│ ├─ Run `ccw spec load --keywords exploration` (if spec system available)
│ ├─ Run `ccw spec load --category exploration` (if spec system available)
│ └─ Use Grep, Glob, Read, mcp__ace-tool__search_context
├─ Multi-perspective analysis (if selected, serial)
│ ├─ Single: Comprehensive analysis
@@ -297,7 +297,7 @@ const hasCodebase = Bash(`
if (hasCodebase !== 'none') {
// 1. Read project metadata (if exists)
// - Run `ccw spec load --keywords exploration` (load project specs)
// - Run `ccw spec load --category exploration` (load project specs)
// - .workflow/specs/*.md (project conventions)
// 2. Search codebase for relevant content

View File

@@ -282,7 +282,7 @@ Use built-in tools to understand the codebase structure before spawning perspect
**Context Gathering Activities**:
1. **Get project structure** - Execute `ccw tool exec get_modules_by_depth '{}'`
2. **Search for related code** - Use Grep/Glob to find files matching topic keywords
3. **Read project tech context** - Run `ccw spec load --keywords "exploration planning"` if spec system available
3. **Read project tech context** - Run `ccw spec load --category "exploration planning"` if spec system available
4. **Analyze patterns** - Identify common code patterns and architecture decisions
**exploration-codebase.json Structure**:
@@ -358,7 +358,7 @@ const agentIds = perspectives.map(perspective => {
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-explore-agent.md (MUST read first)
2. Run: `ccw spec load --keywords "exploration planning"`
2. Run: `ccw spec load --category "exploration planning"`
3. Read project tech context from loaded specs
---
@@ -566,7 +566,7 @@ const deepDiveAgent = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-explore-agent.md (MUST read first)
2. Read: ${sessionFolder}/perspectives.json (prior findings)
3. Run: `ccw spec load --keywords "exploration planning"`
3. Run: `ccw spec load --category "exploration planning"`
---

View File

@@ -194,7 +194,7 @@ Use built-in tools directly to understand the task scope and identify sub-domain
**Analysis Activities**:
1. **Search for references** — Find related documentation, README files, and architecture guides
- Use: `mcp__ace-tool__search_context`, Grep, Glob, Read
- Run: `ccw spec load --keywords planning` (if spec system available)
- Run: `ccw spec load --category planning` (if spec system available)
2. **Extract task keywords** — Identify key terms and concepts from the task description
3. **Identify ambiguities** — List any unclear points or multiple possible interpretations
4. **Clarify with user** — If ambiguities found, use AskUserQuestion for clarification

View File

@@ -231,7 +231,7 @@ const agentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/{agent-type}.md (MUST read first)
2. Execute: ccw spec load --keywords exploration
2. Execute: ccw spec load --category exploration
## TASK CONTEXT
${taskContext}

View File

@@ -268,7 +268,7 @@ const hasCodebase = bash(`
// 2. Codebase Exploration (only when hasCodebase !== 'none')
if (hasCodebase !== 'none') {
// Read project metadata (if exists)
// Run `ccw spec load --keywords planning`
// Run `ccw spec load --category planning`
// Search codebase for requirement-relevant context
// Use: mcp__ace-tool__search_context, Grep, Glob, Read

View File

@@ -303,7 +303,7 @@ const agentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/{agent-type}.md (MUST read first)
2. Execute: ccw spec load --keywords "exploration execution"
2. Execute: ccw spec load --category "exploration execution"
---

View File

@@ -94,7 +94,7 @@ dimensions.forEach(dimension => {
3. Get target files: Read resolved_files from review-state.json
4. Validate file access: bash(ls -la ${targetFiles.join(' ')})
5. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-dimension-results-schema.json (get output schema reference)
6. Execute: ccw spec load --keywords "exploration execution" (technology stack and constraints)
6. Execute: ccw spec load --category "exploration execution" (technology stack and constraints)
---
@@ -216,7 +216,7 @@ dimensions.forEach(dimension => {
4. Get changed files: bash(cd ${workflowDir} && git log --since="${sessionCreatedAt}" --name-only --pretty=format: | sort -u)
5. Read review state: ${reviewStateJsonPath}
6. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-dimension-results-schema.json (get output schema reference)
7. Execute: ccw spec load --keywords "exploration execution" (technology stack and constraints)
7. Execute: ccw spec load --category "exploration execution" (technology stack and constraints)
---
@@ -334,7 +334,7 @@ const deepDiveAgentId = spawn_agent({
4. Identify related code: bash(grep -r "import.*${basename(file)}" ${projectDir}/src --include="*.ts")
5. Read test files: bash(find ${projectDir}/tests -name "*${basename(file, '.ts')}*" -type f)
6. Execute: cat ~/.ccw/workflows/cli-templates/schemas/review-deep-dive-results-schema.json (get output schema reference)
7. Execute: ccw spec load --keywords "exploration execution" (technology stack and constraints for remediation)
7. Execute: ccw spec load --category "exploration execution" (technology stack and constraints for remediation)
---

View File

@@ -105,7 +105,7 @@ const agentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-planning-agent.md (MUST read first)
2. Execute: ccw spec load --keywords planning
2. Execute: ccw spec load --category planning
---

View File

@@ -60,7 +60,7 @@ const execAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-execution-agent.md (MUST read first)
2. Execute: ccw spec load --keywords execution
2. Execute: ccw spec load --category execution
---

View File

@@ -38,7 +38,7 @@ completion report.
### Step 1: Load Context
After reading role definition:
- Run: `ccw spec load --keywords execution`
- Run: `ccw spec load --category execution`
- Extract issue ID, solution file path, session dir from task message
### Step 2: Load Solution

View File

@@ -48,7 +48,7 @@ Outputs `ISSUE_READY:{issueId}` after each solution and waits for orchestrator t
### Step 1: Load Context
After reading role definition, load project context:
- Run: `ccw spec load --keywords planning`
- Run: `ccw spec load --category planning`
- Extract session directory and artifacts directory from task message
### Step 2: Parse Input
@@ -81,7 +81,7 @@ spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/issue-plan-agent.md (MUST read first)
2. Run: `ccw spec load --keywords planning`
2. Run: `ccw spec load --category planning`
---

View File

@@ -85,7 +85,7 @@ const plannerAgent = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/planex-planner.md (MUST read first)
2. Run: `ccw spec load --keywords "planning execution"`
2. Run: `ccw spec load --category "planning execution"`
---
@@ -155,7 +155,7 @@ while (true) {
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/planex-executor.md (MUST read first)
2. Run: `ccw spec load --keywords "planning execution"`
2. Run: `ccw spec load --category "planning execution"`
---

View File

@@ -88,7 +88,7 @@ const agentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/{agent-type}.md (MUST read first)
2. Run: `ccw spec load --keywords "planning execution"`
2. Run: `ccw spec load --category "planning execution"`
## TASK CONTEXT
${taskContext}

View File

@@ -75,7 +75,7 @@ const contextAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/test-context-search-agent.md (MUST read first)
2. Run: `ccw spec load --keywords planning`
2. Run: `ccw spec load --category planning`
---
@@ -101,7 +101,7 @@ const contextAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/context-search-agent.md (MUST read first)
2. Run: `ccw spec load --keywords planning`
2. Run: `ccw spec load --category planning`
---
@@ -174,7 +174,7 @@ const analysisAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-execution-agent.md (MUST read first)
2. Run: `ccw spec load --keywords planning`
2. Run: `ccw spec load --category planning`
---
@@ -242,7 +242,7 @@ const taskGenAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/action-planning-agent.md (MUST read first)
2. Run: `ccw spec load --keywords planning`
2. Run: `ccw spec load --category planning`
---

View File

@@ -90,7 +90,7 @@ const analysisAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/cli-planning-agent.md (MUST read first)
2. Run: `ccw spec load --keywords planning`
2. Run: `ccw spec load --category planning`
---
@@ -156,7 +156,7 @@ const fixAgentId = spawn_agent({
### MANDATORY FIRST STEPS (Agent Execute)
1. **Read role definition**: ~/.codex/agents/test-fix-agent.md (MUST read first)
2. Run: `ccw spec load --keywords execution`
2. Run: `ccw spec load --category execution`
---