新增: Phase2 阶段收尾(Sprint 1-20)

重构:删 5 零引用 crate(df-evolve/plugin/stages/task/traceability)+ 清死模块、ai.rs 拆 11 子 module、ai.ts 拆 6 composable、i18n 拆目录
功能:知识库全栈(df-project/scan + CRUD + 时间线 + 前端)、Settings 拆分、appSettings KV 迁移、模型池、LLM 并发 Semaphore
修复:审批持久化根治、ConditionEngine 默认拒绝、NodeRegistry unimplemented 清除、promote 补偿删除、工具结果截断 50KB、路径校验防 symlink 逃逸
文档:B-03 人工审批设计、决策记录三分档、规格契约自检、经验记录、todo 看板、PROGRESS 更新

详见 PROGRESS.md。src-tauri/儿童每日打卡应用/ 与本项目无关,已排除。
This commit is contained in:
2026-06-14 14:08:20 +08:00
parent 98393b4908
commit cf017f81e2
167 changed files with 19549 additions and 6886 deletions

101
src/constants/project.ts Normal file
View File

@@ -0,0 +1,101 @@
//! 项目 & 任务状态映射常量
//!
//! 统一各视图(Projects/ProjectDetail/Tasks/Dashboard)的 label / badge / 阶段进度,
//! 根治此前三套状态映射互相矛盾、任务文案两处不一致的问题。
// ── 项目状态 ──
// 值为 i18n key,实际文案走 $t('projects.status.<key>')(见 src/i18n/{zh-CN,en}/projects.ts)
export const PROJECT_STATUS_LABELS: Record<string, string> = {
planning: 'projects.status.planning',
in_progress: 'projects.status.in_progress',
paused: 'projects.status.paused',
completed: 'projects.status.completed',
cancelled: 'projects.status.cancelled',
active: 'projects.status.active',
}
/** 项目状态 → 卡片 badge 样式 class */
export const PROJECT_STATUS_BADGE_CLASS: Record<string, string> = {
planning: 'stage-design',
in_progress: 'stage-coding',
paused: 'stage-testing',
completed: 'stage-release',
cancelled: 'stage-design',
}
/** 项目状态 → 阶段/进度信息(详情页 pipeline + Dashboard 进度条共用) */
export interface ProjectStageInfo {
/** pipeline 步骤索引 0-4: idea/requirement/coding/testing/release */
stepIndex: number
/** 进度百分比 */
progress: number
/** Dashboard dot/chip 颜色档: coding/testing/release */
stage: string
}
export const PROJECT_STAGE_INFO: Record<string, ProjectStageInfo> = {
planning: { stepIndex: 0, progress: 20, stage: 'coding' },
in_progress: { stepIndex: 2, progress: 55, stage: 'coding' },
paused: { stepIndex: 2, progress: 40, stage: 'testing' },
completed: { stepIndex: 4, progress: 100, stage: 'release' },
cancelled: { stepIndex: 0, progress: 0, stage: 'testing' },
}
export function projectStatusLabel(status: string): string {
return PROJECT_STATUS_LABELS[status] ?? status
}
export function projectBadgeClass(status: string): string {
return PROJECT_STATUS_BADGE_CLASS[status] ?? 'stage-design'
}
export function projectStageInfo(status: string): ProjectStageInfo {
return PROJECT_STAGE_INFO[status] ?? PROJECT_STAGE_INFO.planning
}
// ── 任务状态 ──
// 值为 i18n key,实际文案走 $t('tasks.status.<key>')(见 src/i18n/{zh-CN,en}/tasks.ts)
export const TASK_STATUS_LABELS: Record<string, string> = {
todo: 'tasks.status.todo',
in_progress: 'tasks.status.in_progress',
review_ready: 'tasks.status.review_ready',
merged: 'tasks.status.merged',
abandoned: 'tasks.status.abandoned',
}
export const TASK_STATUS_CLASS: Record<string, string> = {
todo: 'status-todo',
in_progress: 'status-progress',
review_ready: 'status-review',
merged: 'status-done',
abandoned: 'status-abandoned',
}
export function taskStatusLabel(status: string): string {
return TASK_STATUS_LABELS[status] ?? status
}
export function taskStatusClass(status: string): string {
return TASK_STATUS_CLASS[status] ?? 'status-todo'
}
// ── 任务优先级 ──
export const PRIORITY_LABELS: Record<number, string> = { 0: 'P0', 1: 'P1', 2: 'P2', 3: 'P3' }
export const PRIORITY_CLASSES: Record<number, string> = {
0: 'priority-critical',
1: 'priority-high',
2: 'priority-medium',
3: 'priority-low',
}
export function priorityLabel(p: number): string {
return PRIORITY_LABELS[p] ?? `P${p}`
}
export function priorityClass(p: number): string {
return PRIORITY_CLASSES[p] ?? 'priority-low'
}