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

@@ -1,13 +1,13 @@
---
name: sync
description: Quick-sync session work to project-guidelines and project-tech
description: Quick-sync session work to specs/*.md and project-tech
argument-hint: "[-y|--yes] [\"what was done\"]"
allowed-tools: Bash(*), Read(*), Write(*), Edit(*)
---
# Session Sync (/workflow:session:sync)
One-shot update `project-guidelines.json` + `project-tech.json` from current session context.
One-shot update `specs/*.md` + `project-tech.json` from current session context.
**Design**: Scan context → extract → write. No interactive wizards.
@@ -73,7 +73,8 @@ Analyze context and produce two update payloads. Use LLM reasoning (current agen
// RULE: Only extract genuinely reusable insights. Skip trivial/obvious items.
// RULE: Deduplicate against existing guidelines before adding.
const existingGuidelines = JSON.parse(Read('.workflow/project-guidelines.json'))
// Load existing specs via ccw spec load
const existingSpecs = Bash('ccw spec load --dimension specs 2>/dev/null || echo ""')
const guidelineUpdates = [] // populated by agent analysis
// ── Tech extraction ──
@@ -123,7 +124,7 @@ Tech [${detectCategory(summary)}]:
${techEntry.title}
Target files:
.workflow/project-guidelines.json
.workflow/specs/*.md
.workflow/project-tech.json
`)
@@ -136,33 +137,31 @@ if (!autoYes) {
## Step 4: Write
```javascript
// ── Update project-guidelines.json ──
// ── Update specs/*.md ──
if (guidelineUpdates.length > 0) {
const guidelines = JSON.parse(Read('.workflow/project-guidelines.json'))
// Map guideline types to spec files
const specFileMap = {
convention: '.workflow/specs/coding-conventions.md',
constraint: '.workflow/specs/architecture-constraints.md',
learning: '.workflow/specs/coding-conventions.md' // learnings appended to conventions
}
for (const g of guidelineUpdates) {
if (g.type === 'learning') {
// Deduplicate by insight text
if (!guidelines.learnings.some(l => l.insight === g.text)) {
guidelines.learnings.push({
date: new Date().toISOString().split('T')[0],
session_id: techEntry.session_id,
insight: g.text,
category: g.category
})
}
} else {
// convention or constraint
const section = g.type === 'convention' ? 'conventions' : 'constraints'
if (!guidelines[section][g.category]) guidelines[section][g.category] = []
if (!guidelines[section][g.category].includes(g.text)) {
guidelines[section][g.category].push(g.text)
}
const targetFile = specFileMap[g.type]
const existing = Read(targetFile)
const ruleText = g.type === 'learning'
? `- [${g.category}] ${g.text} (learned: ${new Date().toISOString().split('T')[0]})`
: `- [${g.category}] ${g.text}`
// Deduplicate: skip if text already in file
if (!existing.includes(g.text)) {
const newContent = existing.trimEnd() + '\n' + ruleText + '\n'
Write(targetFile, newContent)
}
}
guidelines._metadata.updated_at = new Date().toISOString()
Write('.workflow/project-guidelines.json', JSON.stringify(guidelines, null, 2))
// Rebuild spec index after writing
Bash('ccw spec rebuild')
}
// ── Update project-tech.json ──