feat: add SpecDialog component for editing spec frontmatter

- Implement SpecDialog for managing spec details including title, read mode, priority, and keywords.
- Add validation and keyword management functionality.
- Integrate SpecDialog into SpecsSettingsPage for editing specs.

feat: create index file for specs components

- Export SpecCard, SpecDialog, and related types from a new index file for better organization.

feat: implement SpecsSettingsPage for managing specs and hooks

- Create main settings page with tabs for Project Specs, Personal Specs, Hooks, Injection, and Settings.
- Integrate SpecDialog and HookDialog for editing specs and hooks.
- Add search functionality and mock data for specs and hooks.

feat: add spec management API routes

- Implement API endpoints for listing specs, getting spec details, updating frontmatter, rebuilding indices, and initializing the spec system.
- Handle errors and responses appropriately for each endpoint.
This commit is contained in:
catlog22
2026-02-26 22:03:13 +08:00
parent 430d817e43
commit 6155fcc7b8
115 changed files with 4883 additions and 21127 deletions

View File

@@ -106,36 +106,19 @@ bash(`mkdir -p ${sessionFolder} && test -d ${sessionFolder} && echo "SUCCESS: ${
**Exploration Decision Logic**:
```javascript
// Analysis handoff: reconstruct exploration from upstream analysis artifacts
if (workflowPreferences.analysisHandoff) {
const handoff = workflowPreferences.analysisHandoff
Write(`${sessionFolder}/exploration-from-analysis.json`, JSON.stringify({
relevant_files: handoff.exploration_digest.relevant_files || [],
patterns: handoff.exploration_digest.patterns || [],
key_findings: handoff.exploration_digest.key_findings || [],
clarification_needs: [], // analysis already did multi-round discussion
_metadata: { exploration_angle: "from-analysis", source_session: handoff.source_session, reconstructed: true }
}, null, 2))
Write(`${sessionFolder}/explorations-manifest.json`, JSON.stringify({
session_id: sessionId, task_description: task_description, timestamp: getUtc8ISOString(),
complexity: complexity, exploration_count: 1, from_analysis: handoff.source_session,
explorations: [{ angle: "from-analysis", file: "exploration-from-analysis.json",
path: `${sessionFolder}/exploration-from-analysis.json`, index: 1 }]
}, null, 2))
needsExploration = false
// clarification_needs=[] → Phase 2 naturally skipped → proceed to Phase 3
}
// Check if task description already contains prior analysis context (from analyze-with-file)
const hasPriorAnalysis = /##\s*Prior Analysis/i.test(task_description)
needsExploration = needsExploration ?? (
workflowPreferences.forceExplore ||
task.mentions_specific_files ||
task.requires_codebase_context ||
task.needs_architecture_understanding ||
task.modifies_existing_code
)
needsExploration = workflowPreferences.forceExplore ? true
: hasPriorAnalysis ? false
: (task.mentions_specific_files ||
task.requires_codebase_context ||
task.needs_architecture_understanding ||
task.modifies_existing_code)
if (!needsExploration) {
// Skip to Phase 2 (Clarification) or Phase 3 (Planning)
// Skip exploration — analysis context already in task description (or not needed)
// manifest is absent; Phase 3 loads it with safe fallback
proceed_to_next_phase()
}
```
@@ -185,12 +168,12 @@ const selectedAngles = selectAngles(task_description, complexity === 'High' ? 4
// Planning strategy determination
// Agent trigger: anything beyond trivial single-file change
// - analysisHandoff → always agent (analysis validated non-trivial task)
// - hasPriorAnalysis → always agent (analysis validated non-trivial task)
// - multi-angle exploration → agent (complexity warranted multiple angles)
// - Medium/High complexity → agent
// Direct Claude planning ONLY for truly trivial Low + no analysis + single angle
const planningStrategy = (
complexity === 'Low' && !workflowPreferences.analysisHandoff && selectedAngles.length <= 1
complexity === 'Low' && !hasPriorAnalysis && selectedAngles.length <= 1
) ? 'Direct Claude Planning'
: 'cli-lite-planning-agent'
@@ -233,7 +216,7 @@ Execute **${angle}** exploration for task planning context. Analyze codebase fro
- **Exploration Index**: ${index + 1} of ${selectedAngles.length}
## Agent Initialization
cli-explore-agent autonomously handles: project structure discovery, schema loading, project context loading (project-tech.json, project-guidelines.json), and keyword search. These steps execute automatically.
cli-explore-agent autonomously handles: project structure discovery, schema loading, project context loading (project-tech.json, specs/*.md), and keyword search. These steps execute automatically.
## Exploration Strategy (${angle} focus)
@@ -338,8 +321,10 @@ Angles explored: ${explorationManifest.explorations.map(e => e.angle).join(', ')
**Aggregate clarification needs from all exploration angles**:
```javascript
// Load manifest and all exploration files
const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
// Load manifest and all exploration files (may not exist if exploration was skipped)
const manifest = file_exists(`${sessionFolder}/explorations-manifest.json`)
? JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
: { exploration_count: 0, explorations: [] }
const explorations = manifest.explorations.map(exp => ({
angle: exp.angle,
data: JSON.parse(Read(exp.path))
@@ -432,8 +417,10 @@ taskFiles.forEach(taskPath => {
// Step 1: Read schema
const schema = Bash(`cat ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json`)
// Step 2: ⚠️ MANDATORY - Read and review ALL exploration files
const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
// Step 2: Read exploration files if available
const manifest = file_exists(`${sessionFolder}/explorations-manifest.json`)
? JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
: { explorations: [] }
manifest.explorations.forEach(exp => {
const explorationData = Read(exp.path)
console.log(`\n### Exploration: ${exp.angle}\n${explorationData}`)
@@ -509,9 +496,9 @@ Execute: cat ~/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.js
## Project Context (MANDATORY - Read Both Files)
1. Read: .workflow/project-tech.json (technology stack, architecture, key components)
2. Read: .workflow/project-guidelines.json (user-defined constraints and conventions)
2. Read: .workflow/specs/*.md (user-defined constraints and conventions)
**CRITICAL**: All generated tasks MUST comply with constraints in project-guidelines.json
**CRITICAL**: All generated tasks MUST comply with constraints in specs/*.md
## Task Description
${task_description}
@@ -669,8 +656,10 @@ if (autoYes) {
**Step 5.1: Build executionContext**
```javascript
// Load manifest and all exploration files
const manifest = JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
// Load manifest and all exploration files (may not exist if exploration was skipped)
const manifest = file_exists(`${sessionFolder}/explorations-manifest.json`)
? JSON.parse(Read(`${sessionFolder}/explorations-manifest.json`))
: { exploration_count: 0, explorations: [] }
const explorations = {}
manifest.explorations.forEach(exp => {

View File

@@ -485,7 +485,7 @@ ${(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/project-guidelines.json`)
context.push(`### Project Guidelines\n@.workflow/specs/*.md`)
if (context.length > 0) sections.push(`## Context\n${context.join('\n\n')}`)
sections.push(`Complete each task according to its "Done when" checklist.`)
@@ -672,7 +672,7 @@ if (hasUnresolvedIssues(reviewResult)) {
**Trigger**: After all executions complete (regardless of code review)
**Operation**: Execute `/workflow:session:sync -y "{summary}"` to update both `project-guidelines.json` and `project-tech.json` in one shot.
**Operation**: Execute `/workflow:session:sync -y "{summary}"` to update both `specs/*.md` and `project-tech.json` in one shot.
Summary 取值优先级:`originalUserInput``planObject.summary` → git log 自动推断。
@@ -767,7 +767,7 @@ Appended to `previousExecutionResults` array for context continuity in multi-exe
## Post-Completion Expansion
**Auto-sync**: 执行 `/workflow:session:sync -y "{summary}"` 更新 project-guidelines + project-techStep 6 已触发,此处不重复)。
**Auto-sync**: 执行 `/workflow:session:sync -y "{summary}"` 更新 specs/*.md + project-techStep 6 已触发,此处不重复)。
完成后询问用户是否扩展为issue(test/enhance/refactor/doc),选中项调用 `/issue:new "{summary} - {dimension}"`