From 06249dd83f87fab2a84644fc22b36c9554227e6d Mon Sep 17 00:00:00 2001 From: weichen Date: Thu, 15 Oct 2026 07:34:49 +0000 Subject: [PATCH] Keep the duty draft exports inside the knip baseline Why: the settings page only needs the draft operations the views call. Extra aliases and unused helpers pushed the unused-export count over the baseline. Evidence: SELF node scripts/check-knip.mjs reported 43 <= 43, and duty-draft vitest passed. Impact: chapter-review command aliases are gone from the settings gate. The draft behavior is unchanged. Refs: modules/frontend/knip-baseline.json Co-authored-by: Cursor --- src/duties/draft.ts | 15 ++++----------- src/rdmManagement.ts | 6 ------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/duties/draft.ts b/src/duties/draft.ts index 54c74eb..a3781ee 100644 --- a/src/duties/draft.ts +++ b/src/duties/draft.ts @@ -1,7 +1,7 @@ // 文档职责草稿的唯一存储。三个视图只投影这份数据;单元格值由三权反推。 export type CellDuty = 'none' | 'author' | 'reviewer' | 'approver' -export interface DutyRoles { +interface DutyRoles { author: string reviewers: string[] approver: string @@ -28,7 +28,7 @@ export interface DutyMember { canApprove: boolean } -export interface DutySaveItem { +interface DutySaveItem { docId: string author: string reviewers: string[] @@ -80,7 +80,7 @@ export function replacementNote(roles: DutyRoles, owner: string, duty: CellDuty) return '' } -export function dutyConflicts(roles: DutyRoles): number { +function dutyConflicts(roles: DutyRoles): number { const seen = new Map() const mark = (owner: string) => { if (!owner) return @@ -112,11 +112,7 @@ export function saveIssues(roles: DutyRoles): string[] { return issues } -export function sameRoles(a: DutyRoles, b: DutyRoles): boolean { - return a.author === b.author && a.approver === b.approver && a.reviewers.join('\0') === b.reviewers.join('\0') -} - -export function rolesFromCells(docId: string, cells: { docId: string; owner: string; duty: string }[]): DutyRoles { +function rolesFromCells(docId: string, cells: { docId: string; owner: string; duty: string }[]): DutyRoles { const roles: DutyRoles = { author: '', reviewers: [], approver: '' } for (const cell of cells) { if (cell.docId !== docId) continue @@ -198,6 +194,3 @@ export function savePayload(docs: DutyDocDraft[], confirmInvalidation: boolean): } } -export function needsInvalidationConfirm(docs: DutyDocDraft[]): boolean { - return dirtyDocs(docs).some(doc => doc.activeRound > 0) -} diff --git a/src/rdmManagement.ts b/src/rdmManagement.ts index b5c4576..cdd0972 100644 --- a/src/rdmManagement.ts +++ b/src/rdmManagement.ts @@ -63,9 +63,6 @@ export const RDM_DUTY_COMMANDS = [ 'rdm.review.assign.doc.batch', ] as const -/** @deprecated 设置页已改用 RDM_DUTY_COMMANDS。保留导出名,避免旧调用点仍指向审签命令。 */ -export const RDM_DOC_REVIEW_COMMANDS = RDM_DUTY_COMMANDS - export type CommandListItem = { id?: string; enabled?: boolean } | null | undefined function ready(cmds: CommandListItem[] | null | undefined, need: readonly string[]): boolean { @@ -85,9 +82,6 @@ export const rdmMembersReady = (cmds: CommandListItem[] | null | undefined) => export const rdmDutyReady = (cmds: CommandListItem[] | null | undefined) => ready(cmds, RDM_DUTY_COMMANDS) -/** @deprecated 使用 rdmDutyReady。 */ -export const rdmDocReviewReady = rdmDutyReady - /** 项目权限矩阵页是否就绪。 */ export const rdmPermMatrixReady = (cmds: CommandListItem[] | null | undefined) => ready(cmds, RDM_PERM_MATRIX_COMMANDS)