feat(版本): 完善计划覆盖与工作台待办

关键改动:

- 增加计划日志汇总、需求覆盖草稿校验与对应测试

- 抽取工作台工作项 Hook,补充待办计数能力

- 优化版本详情中计划、任务、测试用例和 Bug 的筛选与展示

Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
Script Generator
2026-06-30 13:43:18 +08:00
parent a6a4d7d3d9
commit 52a88626d4
23 changed files with 1082 additions and 281 deletions

View File

@@ -87,6 +87,11 @@ export type PlanLogDraft = Omit<VersionPlanLog, 'id' | 'createdAt'> & {
createdAt?: string;
};
export type VersionPlanLogView = VersionPlanLog & {
planId: string;
planTitle: string;
};
export const REQUIREMENT_COVERAGE_LABEL: Record<RequirementCoverageStatus, string> = {
not_started: '未开始',
partial: '部分完成',
@@ -177,6 +182,18 @@ export function getRequirementCoverageSummary(plan: VersionPlan): {
};
}
export function canSaveRequirementCoverageDraft(
status: RequirementCoverageStatus,
completedContent?: string,
remainingContent?: string,
): boolean {
if (status === 'completed') return true;
if (status === 'partial') {
return Boolean(completedContent?.trim()) && Boolean(remainingContent?.trim());
}
return false;
}
export function appendPlanLog(plan: VersionPlan, draft: PlanLogDraft): VersionPlanLog[] {
const createdAt = draft.createdAt ?? new Date().toISOString();
const log: VersionPlanLog = {
@@ -187,6 +204,21 @@ export function appendPlanLog(plan: VersionPlan, draft: PlanLogDraft): VersionPl
return [log, ...(plan.logs ?? [])];
}
function getPlanLogCreatedAtTime(log: VersionPlanLog): number {
const time = new Date(log.createdAt).getTime();
return Number.isFinite(time) ? time : 0;
}
export function getPlanLogsForPlans(plans: VersionPlan[]): VersionPlanLogView[] {
return plans
.flatMap((plan) => (plan.logs ?? []).map((log) => ({
...log,
planId: plan.id,
planTitle: plan.title,
})))
.sort((a, b) => getPlanLogCreatedAtTime(b) - getPlanLogCreatedAtTime(a));
}
export function updateRequirementCoverage(
plan: VersionPlan,
input: RequirementCoverageUpdateInput,