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

@@ -10,36 +10,67 @@
"rebuildIndex": "Rebuild Index",
"loading": "Loading...",
"noSpecs": "No specs found. Create specs in .ccw/ directory.",
"required": "required",
"dimension": {
"specs": "Project Specs",
"personal": "Personal"
},
"scope": {
"all": "All",
"global": "Global",
"project": "Project"
},
"filterByScope": "Filter by scope:",
"category": {
"general": "General",
"exploration": "Exploration",
"planning": "Planning",
"execution": "Execution"
},
"recommendedHooks": "Recommended Hooks",
"recommendedHooksDesc": "One-click install system-preset spec injection hooks",
"installAll": "Install All Recommended Hooks",
"installAllHooks": "Install All Hooks",
"allHooksInstalled": "All Hooks Installed",
"hooksInstalled": "installed",
"manageHooks": "Manage Hooks",
"hookEvent": "Event",
"hookScope": "Scope",
"install": "Install",
"installed": "Installed",
"installing": "Installing...",
"installedHooks": "Installed Hooks",
"installedHooksDesc": "Manage your installed hooks configuration",
"searchHooks": "Search hooks...",
"noHooks": "No hooks installed. Install recommended hooks above.",
"spec": {
"edit": "Edit",
"toggle": "Toggle",
"delete": "Delete",
"required": "Required",
"optional": "Optional",
"priority": {
"critical": "Critical",
"high": "High",
"medium": "Medium",
"low": "Low"
}
"edit": "Edit Spec",
"toggle": "Toggle Status",
"delete": "Delete Spec",
"deleteConfirm": "Are you sure you want to delete this spec?",
"title": "Spec Title",
"keywords": "Keywords",
"keywordsPlaceholder": "Enter keywords, separated by commas",
"readMode": "Read Mode",
"priority": "Priority",
"file": "File Path"
},
"hook": {
"install": "Install",
"edit": "Edit",
"toggle": "Toggle",
"delete": "Delete",
"uninstall": "Uninstall",
"edit": "Edit Hook",
"toggle": "Toggle Status",
"delete": "Delete Hook",
"enabled": "Enabled",
"disabled": "Disabled",
"installed": "Installed",
"notInstalled": "Not Installed",
"scope": {
"global": "Global",
"project": "Project"
@@ -48,21 +79,142 @@
"SessionStart": "Session Start",
"UserPromptSubmit": "Prompt Submit",
"SessionEnd": "Session End"
},
"name": "Hook Name",
"eventLabel": "Trigger Event",
"command": "Command",
"scopeLabel": "Scope",
"timeout": "Timeout (ms)",
"failMode": "Fail Mode",
"failModeContinue": "Continue",
"failModeBlock": "Block",
"failModeWarn": "Warn"
},
"actions": {
"edit": "Edit",
"delete": "Delete",
"reset": "Reset",
"save": "Save",
"saving": "Saving...",
"view": "View Content"
},
"status": {
"enabled": "Enabled",
"disabled": "Disabled"
},
"readMode": {
"required": "Required",
"optional": "Optional"
},
"priority": {
"critical": "Critical",
"high": "High",
"medium": "Medium",
"low": "Low"
},
"hooks": {
"dialog": {
"createTitle": "Create Hook",
"editTitle": "Edit Hook",
"description": "Configure the hook trigger event, command, and other settings."
},
"fields": {
"name": "Hook Name",
"event": "Trigger Event",
"scope": "Scope",
"command": "Command",
"description": "Description",
"timeout": "Timeout",
"timeoutUnit": "ms",
"failMode": "Failure Mode"
},
"placeholders": {
"name": "Enter hook name",
"event": "Select event",
"command": "Enter command to execute",
"description": "Enter description (optional)"
},
"events": {
"sessionStart": "Session Start",
"userPromptSubmit": "Prompt Submit",
"sessionEnd": "Session End"
},
"scope": {
"global": "Global",
"project": "Project"
},
"failModes": {
"continue": "Continue",
"warn": "Show Warning",
"block": "Block Operation"
},
"validation": {
"nameRequired": "Name is required",
"commandRequired": "Command is required",
"timeoutMin": "Minimum timeout is 1000ms",
"timeoutMax": "Maximum timeout is 300000ms"
}
},
"hints": {
"hookEvents": "Select when this hook should be triggered",
"hookScope": "Global hooks apply to all projects, project hooks only to current project",
"hookCommand": "Command to execute, can use environment variables",
"hookTimeout": "Timeout for command execution",
"hookFailMode": "How to handle command execution failure"
},
"common": {
"cancel": "Cancel",
"save": "Save",
"delete": "Delete",
"edit": "Edit",
"reset": "Reset",
"confirm": "Confirm",
"close": "Close"
},
"content": {
"edit": "Edit",
"view": "View",
"metadata": "Metadata",
"markdownContent": "Markdown Content",
"noContent": "No content available",
"editHint": "Edit the full markdown content including frontmatter. Changes to frontmatter will be reflected in the spec metadata.",
"placeholder": "# Spec Title\n\nContent here..."
},
"injection": {
"title": "Injection Control",
"description": "Monitor and manage spec injection length",
"statusTitle": "Current Injection Status",
"settingsTitle": "Injection Control Settings",
"settingsDescription": "Configure how spec content is injected into AI context.",
"currentLength": "Current Length",
"maxLength": "Max Length",
"maxLength": "Max Injection Length (characters)",
"maxLengthHelp": "Recommended: 4000-10000. Too large may consume too much context; too small may truncate important specs.",
"warnThreshold": "Warn Threshold",
"warnThresholdLabel": "Warning Threshold (characters)",
"warnThresholdHelp": "A warning will be displayed when injection length exceeds this value.",
"percentage": "Usage",
"truncateOnExceed": "Truncate on Exceed",
"truncateDescription": "Automatically truncate when injection exceeds max length",
"truncateHelp": "Automatically truncate content when it exceeds the maximum length.",
"overLimit": "Over Limit",
"warning": "Warning",
"normal": "Normal"
"overLimitDescription": "Current injection content exceeds maximum length of {max} characters. Excess content will be truncated.",
"warning": "Approaching Limit",
"normal": "Normal",
"characters": "characters",
"statsInfo": "Statistics",
"requiredLength": "Required specs length:",
"matchedLength": "Keyword-matched length:",
"remaining": "Remaining space:",
"loadError": "Failed to load stats",
"saveSuccess": "Settings saved successfully",
"saveError": "Failed to save settings"
},
"settings": {
@@ -70,6 +222,7 @@
"description": "Configure personal spec defaults and system settings",
"personalSpecDefaults": "Personal Spec Defaults",
"defaultReadMode": "Default Read Mode",
"defaultReadModeHelp": "Default read mode for newly created personal specs",
"autoEnable": "Auto Enable",
"autoEnableDescription": "Automatically enable newly created personal specs"
},
@@ -77,17 +230,25 @@
"dialog": {
"cancel": "Cancel",
"save": "Save",
"close": "Close",
"editSpec": "Edit Spec",
"editHook": "Edit Hook",
"confirmDelete": "Confirm Delete",
"specTitle": "Spec Title",
"keywords": "Keywords",
"readMode": "Read Mode",
"priority": "Priority",
"hookName": "Hook Name",
"hookEvent": "Event",
"hookEvent": "Trigger Event",
"hookCommand": "Command",
"hookScope": "Scope",
"hookTimeout": "Timeout (ms)",
"hookFailMode": "Fail Mode"
},
"form": {
"readMode": "Read Mode",
"priority": "Priority",
"keywords": "Keywords"
}
}

View File

@@ -10,16 +10,47 @@
"rebuildIndex": "重建索引",
"loading": "加载中...",
"noSpecs": "未找到规范。请在 .ccw/ 目录中创建规范文件。",
"required": "必读",
"dimension": {
"specs": "项目规范",
"personal": "个人规范"
},
"scope": {
"all": "全部",
"global": "全局",
"project": "项目"
},
"filterByScope": "按范围筛选:",
"category": {
"general": "通用",
"exploration": "探索",
"planning": "规划",
"execution": "执行"
},
"recommendedHooks": "推荐钩子",
"recommendedHooksDesc": "一键安装系统预设的规范注入钩子",
"installAll": "安装所有推荐钩子",
"installAllHooks": "安装所有钩子",
"allHooksInstalled": "已安装所有钩子",
"hooksInstalled": "已安装",
"manageHooks": "管理钩子",
"hookEvent": "事件",
"hookScope": "范围",
"install": "安装",
"installed": "已安装",
"installing": "安装中...",
"installedHooks": "已安装钩子",
"installedHooksDesc": "管理已安装的钩子配置",
"searchHooks": "搜索钩子...",
"noHooks": "未安装钩子。请安装上方的推荐钩子。",
"actions": {
"view": "查看内容",
"edit": "编辑",
"delete": "删除",
"reset": "重置",
@@ -45,6 +76,7 @@
},
"spec": {
"view": "查看内容",
"edit": "编辑规范",
"toggle": "切换状态",
"delete": "删除规范",
@@ -57,6 +89,23 @@
"file": "文件路径"
},
"content": {
"edit": "编辑",
"view": "查看",
"metadata": "元数据",
"markdownContent": "Markdown 内容",
"noContent": "无内容",
"editHint": "编辑完整的 Markdown 内容(包括 frontmatter。frontmatter 的更改将反映到规范元数据中。",
"placeholder": "# 规范标题\n\n内容..."
},
"common": {
"cancel": "取消",
"save": "保存",
"saving": "保存中...",
"close": "关闭"
},
"hook": {
"install": "安装",
"uninstall": "卸载",
@@ -88,6 +137,9 @@
},
"hooks": {
"installSuccess": "钩子安装成功",
"installError": "钩子安装失败",
"installAllSuccess": "所有钩子安装成功",
"dialog": {
"createTitle": "创建钩子",
"editTitle": "编辑钩子",
@@ -122,6 +174,12 @@
"continue": "继续执行",
"warn": "显示警告",
"block": "阻止操作"
},
"validation": {
"nameRequired": "名称为必填项",
"commandRequired": "命令为必填项",
"timeoutMin": "最小超时时间为 1000ms",
"timeoutMax": "最大超时时间为 300000ms"
}
},
@@ -133,18 +191,8 @@
"hookFailMode": "命令执行失败时的处理方式"
},
"common": {
"cancel": "取消",
"save": "保存",
"delete": "删除",
"edit": "编辑",
"reset": "重置",
"confirm": "确认"
},
"injection": {
"title": "注入控制",
"description": "监控和管理规范注入长度",
"statusTitle": "当前注入状态",
"settingsTitle": "注入控制设置",
"settingsDescription": "配置如何将规范内容注入到 AI 上下文中。",
@@ -198,5 +246,11 @@
"hookScope": "作用域",
"hookTimeout": "超时时间(ms)",
"hookFailMode": "失败模式"
},
"form": {
"readMode": "读取模式",
"priority": "优先级",
"keywords": "关键词"
}
}