From 30a73d38f5cd2d1ef2659902076d5c2607702f06 Mon Sep 17 00:00:00 2001 From: Menghuan1918 Date: Sat, 14 Nov 2026 01:35:31 +0800 Subject: [PATCH] chore(clues): drop internal-only exports, dead helpers and orphan facades 43 client clue symbols had no consumer outside their module; they are now module-private. Removes the dead isClueSelectionServerAction, the scope-note alias, the unused ClueTabSettings shape, the Feishu/GitHub/detail re-export facades nothing imported, and the last orphan clue CSS rule. --- src/client/clues/resource-summary.tsx | 4 +- src/client/clues/selection-actions.module.css | 7 ---- src/client/clues/selection-actions.tsx | 37 ++++++------------- src/client/clues/settings/config.tsx | 2 +- .../clues/sources/feishu/docs-preview.tsx | 6 +-- src/client/clues/sources/feishu/index.tsx | 5 --- src/client/clues/sources/github/index.tsx | 3 -- src/client/clues/tab/CluesTab.tsx | 16 +------- src/client/clues/tab/browser-shared.tsx | 4 +- src/client/clues/tab/browser.tsx | 6 +-- src/client/clues/windows/collect.tsx | 6 +-- src/client/clues/windows/comments.tsx | 2 +- src/client/clues/windows/create-pack.tsx | 6 +-- src/client/clues/windows/detail.tsx | 10 ++--- src/client/clues/windows/pack.tsx | 6 +-- src/client/clues/windows/settings.tsx | 4 +- src/client/clues/windows/share.tsx | 4 +- 17 files changed, 40 insertions(+), 88 deletions(-) diff --git a/src/client/clues/resource-summary.tsx b/src/client/clues/resource-summary.tsx index 29322d7c..3599fde7 100644 --- a/src/client/clues/resource-summary.tsx +++ b/src/client/clues/resource-summary.tsx @@ -290,7 +290,7 @@ function StateChip(props: { readonly state: ClueResourceState; readonly dot: num // ── Components ───────────────────────────────────────────────────────────── /** Props of {@link ResourceSummary}. */ -export interface ResourceSummaryProps { +interface ResourceSummaryProps { /** The source-owned snapshot; absent/empty renders nothing but the action seat. */ readonly info?: ClueResourceInfo /** @@ -383,7 +383,7 @@ export function ResourceSummary({ info, actions, className }: ResourceSummaryPro } /** Props of {@link ResourceInlineMeta}. */ -export interface ResourceInlineMetaProps { +interface ResourceInlineMetaProps { readonly info?: ClueResourceInfo readonly className?: string } diff --git a/src/client/clues/selection-actions.module.css b/src/client/clues/selection-actions.module.css index 59875ff3..ec48d82d 100644 --- a/src/client/clues/selection-actions.module.css +++ b/src/client/clues/selection-actions.module.css @@ -37,13 +37,6 @@ border-bottom: 1px solid var(--dsw-alias-border-l1); } -.destinationLabel { - display: block; - padding: 0 4px 4px; - color: var(--dsw-alias-label-secondary); - font: var(--dsw-font-xxxs-11); -} - .destinations { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); diff --git a/src/client/clues/selection-actions.tsx b/src/client/clues/selection-actions.tsx index c3b89b82..e959d00a 100644 --- a/src/client/clues/selection-actions.tsx +++ b/src/client/clues/selection-actions.tsx @@ -51,23 +51,8 @@ export const CLUE_SELECTION_ACTIONS = [ /** One menu entry. */ export type ClueSelectionAction = (typeof CLUE_SELECTION_ACTIONS)[number] -/** The server-owned action names (insert is local-only). */ -export const CLUE_SELECTION_SERVER_ACTIONS = [ - 'explain', - 'rewrite', - 'expand', - 'continue', - 'shorten', - 'translate', -] as const - -/** One server-owned selection action. */ -export type ClueSelectionServerAction = (typeof CLUE_SELECTION_SERVER_ACTIONS)[number] - -/** Whether a value is a server-owned action. */ -export function isClueSelectionServerAction(value: unknown): value is ClueSelectionServerAction { - return typeof value === 'string' && (CLUE_SELECTION_SERVER_ACTIONS as readonly string[]).includes(value) -} +/** One server-owned selection action (insert is local-only). */ +type ClueSelectionServerAction = Exclude /** The exact request payload of `clues.actions.start`. */ export interface ClueSelectionActionRequest { @@ -93,7 +78,7 @@ export interface ClueSelectionActionScope { } /** The transport seam (tests and integration may replace it). */ -export type ClueSelectionActionStarter = (request: ClueSelectionActionRequest) => Promise +type ClueSelectionActionStarter = (request: ClueSelectionActionRequest) => Promise /** Core and lazy editor bundles inline this module independently; only the page owns bridge state. */ interface SelectionBridgeState { @@ -124,7 +109,7 @@ export function startClueSelectionAction(request: ClueSelectionActionRequest): P } /** One insert decision: the parent appends the payload to its composer draft. */ -export interface ClueSelectionInsertInput { +interface ClueSelectionInsertInput { /** Present when the wrapper/bridge knows the owning clue target. */ readonly workspaceId?: string readonly sessionId?: string @@ -145,7 +130,7 @@ export type ClueSelectionInsertHandler = (input: ClueSelectionInsertInput) => bo * `ResourceSelectionActions` wrapper (the shared TextEditor uses the target * fields; a bare bridge supplies `onInsert` only). */ -export interface ClueSelectionActionContext { +interface ClueSelectionActionContext { readonly workspaceId?: string readonly sessionId?: string readonly resource?: ClueClientResourceInput @@ -229,7 +214,7 @@ export function useClueSelectionActionContext(): ClueSelectionActionContext | un } /** Typed selection labels from the integrated locale dictionaries. */ -export const CLUE_SELECTION_LOCALE_KEYS = { +const CLUE_SELECTION_LOCALE_KEYS = { menu: 'clueSelectionMenu', insert: 'clueSelectionInsert', explain: 'clueSelectionExplain', @@ -246,12 +231,12 @@ export const CLUE_SELECTION_LOCALE_KEYS = { type SelectionLabelKey = keyof typeof CLUE_SELECTION_LOCALE_KEYS /** The localized label of one key, checked against the integrated dictionary. */ -export function clueSelectionLabel(key: SelectionLabelKey): string { +function clueSelectionLabel(key: SelectionLabelKey): string { return t(CLUE_SELECTION_LOCALE_KEYS[key]) } /** The localized label of one menu action. */ -export function clueSelectionActionLabel(action: ClueSelectionAction): string { +function clueSelectionActionLabel(action: ClueSelectionAction): string { return clueSelectionLabel(action) } @@ -266,12 +251,12 @@ function requestResourceOf(resource: ClueClientResourceInput): ClueClientResourc } /** The actions a surface offers; comments are intentionally narrower. */ -export function clueSelectionActionsFor(comment: boolean | undefined): readonly ClueSelectionAction[] { +function clueSelectionActionsFor(comment: boolean | undefined): readonly ClueSelectionAction[] { return comment === true ? ['insert', 'explain'] : CLUE_SELECTION_ACTIONS } /** One menu anchor (viewport coordinates, like `SelectionPopup`). */ -export interface SelectionActionMenuProps { +interface SelectionActionMenuProps { readonly workspaceId: string readonly sessionId: string readonly resource: ClueClientResourceInput @@ -457,7 +442,7 @@ export function SelectionActionMenu(props: SelectionActionMenuProps): ReactNode } /** Props of the wrapper surface. */ -export interface ResourceSelectionActionsProps { +interface ResourceSelectionActionsProps { readonly workspaceId: string readonly sessionId: string readonly resource: ClueClientResourceInput diff --git a/src/client/clues/settings/config.tsx b/src/client/clues/settings/config.tsx index c080ee40..a4962d35 100644 --- a/src/client/clues/settings/config.tsx +++ b/src/client/clues/settings/config.tsx @@ -63,7 +63,7 @@ const PERMISSION_COPY: Readonly> = { } /** Props of the configuration page (S6 window content). */ -export interface SourceConfigPageProps { +interface SourceConfigPageProps { readonly sourceId: string readonly sourceName: string readonly dependencyIds: readonly string[] diff --git a/src/client/clues/sources/feishu/docs-preview.tsx b/src/client/clues/sources/feishu/docs-preview.tsx index cd61a2d0..838d54ca 100644 --- a/src/client/clues/sources/feishu/docs-preview.tsx +++ b/src/client/clues/sources/feishu/docs-preview.tsx @@ -18,7 +18,6 @@ import { createElement, useId, useMemo, useState, type ReactNode } from 'react' import type { ClueFormatRendererProps, JsonValue } from '../../../../clues/types.ts' import { - DOCS_EDIT_SCOPE_NOTE, FEISHU_FORMATS, parseDocEditData, parseDocReadData, @@ -38,7 +37,7 @@ import { appDateTime } from './time.ts' const MAX_PREVIEW_CHARS = 40_000 /** Props of {@link FeishuDocsPreview}. */ -export interface FeishuDocsPreviewProps extends ClueFormatRendererProps { +interface FeishuDocsPreviewProps extends ClueFormatRendererProps { readonly labels: FeishuClientLabels /** App-locale date/time formatter (S9 supplies it; fallback is the browser locale). */ readonly formatDateTime?: (value: string) => string @@ -616,8 +615,5 @@ export function FeishuDocsPreview(props: FeishuDocsPreviewProps): ReactNode { ) } -/** The host-visible scope note (exported for S9's settings copy). */ -export const FEISHU_DOCS_EDIT_SCOPE_NOTE = DOCS_EDIT_SCOPE_NOTE - /** The editable-block contract is exported for S9 renderer wiring/tests. */ export type { FeishuDocEditBlock, FeishuDocEditData, FeishuDocReadData } diff --git a/src/client/clues/sources/feishu/index.tsx b/src/client/clues/sources/feishu/index.tsx index a4fbf9e6..91dfd468 100644 --- a/src/client/clues/sources/feishu/index.tsx +++ b/src/client/clues/sources/feishu/index.tsx @@ -275,8 +275,3 @@ export function registerFeishuSourceClient( currentFormats = new Map() } } - -export { DEFAULT_FEISHU_LABELS, resolveFeishuLabels, type FeishuClientLabels } from './labels.ts' -export { FeishuDocsPreview } from './docs-preview.tsx' -export { FeishuTaskEditor } from './task-editor.tsx' -export { FeishuDocsGlyph, FeishuTasksGlyph, feishuDocsIcon, feishuTasksIcon } from './icons.tsx' diff --git a/src/client/clues/sources/github/index.tsx b/src/client/clues/sources/github/index.tsx index df574c1d..53f3f1fc 100644 --- a/src/client/clues/sources/github/index.tsx +++ b/src/client/clues/sources/github/index.tsx @@ -22,9 +22,6 @@ import type { BetterSidebarCluesClientFace } from '../../registry.ts' import { githubMarkdownRenderer } from './editor.tsx' import { GithubIssueIcon, GithubPullRequestIcon } from './icons.tsx' -export { githubMarkdownRenderer, isGithubSource } from './editor.tsx' -export { GithubIssueIcon, GithubPullRequestIcon } from './icons.tsx' - /** * Register the GitHub source presentation and the title+body editor. * @param face - `ctx.betterSidebar.clues`. diff --git a/src/client/clues/tab/CluesTab.tsx b/src/client/clues/tab/CluesTab.tsx index a3562f76..83b0718e 100644 --- a/src/client/clues/tab/CluesTab.tsx +++ b/src/client/clues/tab/CluesTab.tsx @@ -43,22 +43,10 @@ import design from '../../ui/design.module.css' import css from './clues-tab.module.css' /** The plugin-settings key of the clue tab (one sparse blob). */ -export const CLUE_TAB_SETTINGS_KEY = 'clues' +const CLUE_TAB_SETTINGS_KEY = 'clues' /** The subset of the tab component props the clue page consumes. */ -export type CluesTabProps = Pick - -/** The persisted clue-tab settings shape. */ -export interface ClueTabSettings { - /** workspaceId -> sourceId -> persisted range value. */ - readonly scopes?: Readonly>>> - /** Most recently inserted/opened pack ids (ordering only). */ - readonly recentPacks?: readonly string[] - /** Expanded sidebar sections (VSCode-style explorer state). */ - readonly layout?: { readonly browse?: boolean; readonly packs?: boolean } - /** Last chosen source, restored when the tab opens again. */ - readonly activeSource?: string -} +type CluesTabProps = Pick /** The persisted section state, with the explorer defaults applied. */ function sectionLayoutOf(blob: Record): { browse: boolean; packs: boolean } { diff --git a/src/client/clues/tab/browser-shared.tsx b/src/client/clues/tab/browser-shared.tsx index cc81e701..dc0fd6a6 100644 --- a/src/client/clues/tab/browser-shared.tsx +++ b/src/client/clues/tab/browser-shared.tsx @@ -94,14 +94,14 @@ export function SourceNavigation(props: { /** Whether this source needs an explicitly chosen range before listing. */ -export function scopeRequired(sourceId: string): boolean { +function scopeRequired(sourceId: string): boolean { return sourceId === BUILTIN_SOURCE_IDS.githubIssues || sourceId === BUILTIN_SOURCE_IDS.githubPulls || sourceId === BUILTIN_SOURCE_IDS.feishuDocs } /** The `kind` of a persisted Feishu docs range, when it has one. */ -export function feishuRangeKind(scope: JsonValue | undefined): string | undefined { +function feishuRangeKind(scope: JsonValue | undefined): string | undefined { if (scope === null || typeof scope !== 'object' || Array.isArray(scope)) return undefined const kind = (scope as Record).kind return typeof kind === 'string' ? kind : undefined diff --git a/src/client/clues/tab/browser.tsx b/src/client/clues/tab/browser.tsx index 01211150..3f6e1992 100644 --- a/src/client/clues/tab/browser.tsx +++ b/src/client/clues/tab/browser.tsx @@ -83,16 +83,16 @@ import type { BetterSidebarWindowsClientFace } from '../../windows/types.ts' import css from './clues-tab.module.css' /** The persisted range per source id (JSON value, absent = not chosen). */ -export type ClueScopes = Readonly> +type ClueScopes = Readonly> /** Imperative seam the tab uses to start a collection from a detail window. */ -export interface ClueBrowserController { +interface ClueBrowserController { /** Add one resource to a pack through the SAME collection window/CAS flow. */ addToPack(target: ClueDetailTarget): void } /** Props of the browser. */ -export interface ClueBrowserProps { +interface ClueBrowserProps { readonly workspaceId: string readonly face: BetterSidebarCluesClientFace readonly windows: BetterSidebarWindowsClientFace diff --git a/src/client/clues/windows/collect.tsx b/src/client/clues/windows/collect.tsx index 12344eda..dfa8c574 100644 --- a/src/client/clues/windows/collect.tsx +++ b/src/client/clues/windows/collect.tsx @@ -89,13 +89,13 @@ export function clearClueCollectionDrafts(): void { } /** The mutable close guard the hosted window reads. */ -export interface ClueCollectGuard { +interface ClueCollectGuard { busy: boolean handle?: WindowHandle } /** Options of {@link openClueCollectionWindow}. */ -export interface OpenClueCollectionWindowOptions { +interface OpenClueCollectionWindowOptions { readonly windows: BetterSidebarWindowsClientFace readonly face: BetterSidebarCluesClientFace readonly workspaceId: string @@ -113,7 +113,7 @@ export interface OpenClueCollectionWindowOptions { } /** Options of {@link openClueCollectionForTarget}. */ -export interface OpenClueCollectionForTargetOptions { +interface OpenClueCollectionForTargetOptions { readonly windows: BetterSidebarWindowsClientFace readonly face: BetterSidebarCluesClientFace readonly workspaceId: string diff --git a/src/client/clues/windows/comments.tsx b/src/client/clues/windows/comments.tsx index b7afe614..42c351c8 100644 --- a/src/client/clues/windows/comments.tsx +++ b/src/client/clues/windows/comments.tsx @@ -25,7 +25,7 @@ export interface ResourceDiscussionProps { onCreate(body: string, replyToId: string | undefined, requestId: string): Promise } -export function reviewStateLabel(state: string): string { +function reviewStateLabel(state: string): string { switch (state.toUpperCase()) { case 'APPROVED': return copy('clueReviewApproved') case 'CHANGES_REQUESTED': return copy('clueReviewChangesRequested') diff --git a/src/client/clues/windows/create-pack.tsx b/src/client/clues/windows/create-pack.tsx index f9a6b4f6..05a5b73d 100644 --- a/src/client/clues/windows/create-pack.tsx +++ b/src/client/clues/windows/create-pack.tsx @@ -36,13 +36,13 @@ export function createPackWindowId(workspaceId: string): string { * latch (state alone is one render behind a double click); `handle` is wired * after `open()` returns so the page can close its own window. */ -export interface CreatePackGuard { +interface CreatePackGuard { busy: boolean handle?: WindowHandle } /** Options of {@link openCreatePackWindow}. */ -export interface OpenCreatePackWindowOptions { +interface OpenCreatePackWindowOptions { readonly windows: BetterSidebarWindowsClientFace readonly face: BetterSidebarCluesClientFace readonly workspaceId: string @@ -86,7 +86,7 @@ export function openCreatePackWindow(options: OpenCreatePackWindowOptions): Wind } /** The interactive create-pack surface. */ -export function CreatePackPage(props: OpenCreatePackWindowOptions & { readonly guard: CreatePackGuard }): ReactNode { +function CreatePackPage(props: OpenCreatePackWindowOptions & { readonly guard: CreatePackGuard }): ReactNode { const { face, workspaceId, guard, onCreated, onNotice } = props const inputRef = useRef(null) const [draft, setDraft] = useState('') diff --git a/src/client/clues/windows/detail.tsx b/src/client/clues/windows/detail.tsx index c903fd60..59074be0 100644 --- a/src/client/clues/windows/detail.tsx +++ b/src/client/clues/windows/detail.tsx @@ -137,7 +137,7 @@ export interface ClueDetailTarget { } /** Options of {@link openClueDetailWindow}. */ -export interface ClueDetailWindowOptions { +interface ClueDetailWindowOptions { readonly windows: BetterSidebarWindowsClientFace readonly face: BetterSidebarCluesClientFace readonly workspaceId: string @@ -229,7 +229,7 @@ function httpUrlOf(value: unknown): string | undefined { * A source-body URL (Feishu docs `sourceUrl`, task `url`) for locators that * do not carry one. It only feeds the credential-free "open source" link. */ -export function sourceUrlFromData(data: JsonValue | undefined): string | undefined { +function sourceUrlFromData(data: JsonValue | undefined): string | undefined { if (data === null || typeof data !== 'object' || Array.isArray(data)) return undefined const record = data as Record return httpUrlOf(record.sourceUrl) ?? httpUrlOf(record.url) @@ -241,14 +241,14 @@ export function sourceUrlFromData(data: JsonValue | undefined): string | undefin * a direct-URL target like `owner/repo#42` must adopt the real title once the * source returns it. Empty/absent values never erase the current title. */ -export function sourceTitleOf(data: JsonValue | undefined): string | undefined { +function sourceTitleOf(data: JsonValue | undefined): string | undefined { if (data === null || typeof data !== 'object' || Array.isArray(data)) return undefined const title = (data as Record).title return typeof title === 'string' && title.trim() !== '' ? title.trim() : undefined } /** The localized explanation of a source-owned read-only marker. */ -export function readOnlyReasonCopy(reason: string | undefined): string { +function readOnlyReasonCopy(reason: string | undefined): string { switch (reason) { case 'archived': return t('clueDetailReadOnlyArchived') @@ -1653,5 +1653,3 @@ export function openClueDetailWindow(options: ClueDetailWindowOptions): WindowHa controller.attach(handle, guard) return handle } - -export { ResourceInlineMeta, ResourceSummary } from '../resource-summary.tsx' diff --git a/src/client/clues/windows/pack.tsx b/src/client/clues/windows/pack.tsx index 6101284e..f6da3371 100644 --- a/src/client/clues/windows/pack.tsx +++ b/src/client/clues/windows/pack.tsx @@ -83,7 +83,7 @@ import type { ClueDetailTarget } from './detail.tsx' import css from './pack.module.css' /** The workspace the pack belongs to (display only; never used to guess). */ -export interface PackWorkspaceChoice { +interface PackWorkspaceChoice { readonly workspaceId: string readonly title: string } @@ -96,7 +96,7 @@ export interface PackDraftGuard { } /** Options of {@link openPackManagementWindow}. */ -export interface PackManagementOptions { +interface PackManagementOptions { readonly windows: BetterSidebarWindowsClientFace readonly workspaceId: string readonly face: BetterSidebarCluesClientFace @@ -187,7 +187,7 @@ function memberRowsOf(pack: CluePack, clues: readonly Clue[]): MemberRow[] { } /** The window id of one pack (a second open focuses the same surface). */ -export function packWindowId(packId: string): string { +function packWindowId(packId: string): string { return `pack:${packId}` } diff --git a/src/client/clues/windows/settings.tsx b/src/client/clues/windows/settings.tsx index e5e2c640..f74a1411 100644 --- a/src/client/clues/windows/settings.tsx +++ b/src/client/clues/windows/settings.tsx @@ -18,10 +18,10 @@ import { openClueSettings, type ClueSettingsGroup } from '../settings/navigation import { t } from '../../locales.ts' /** The settings window id (one instance; a second open focuses it). */ -export const CLUE_SETTINGS_WINDOW_ID = 'clue-settings' +const CLUE_SETTINGS_WINDOW_ID = 'clue-settings' /** Options of {@link openClueSettingsWindow}. */ -export interface OpenClueSettingsWindowOptions { +interface OpenClueSettingsWindowOptions { readonly windows: BetterSidebarWindowsClientFace readonly store: SidebarStore readonly service: BetterSidebarService diff --git a/src/client/clues/windows/share.tsx b/src/client/clues/windows/share.tsx index fec61410..91827d32 100644 --- a/src/client/clues/windows/share.tsx +++ b/src/client/clues/windows/share.tsx @@ -44,10 +44,10 @@ import { LoadingIndicator } from '../../ui/LoadingIndicator.tsx' import css from './share.module.css' /** The share window id (one instance per plugin; opening again focuses it). */ -export const CLUE_SHARE_WINDOW_ID = 'clue-share' +const CLUE_SHARE_WINDOW_ID = 'clue-share' /** Options of {@link openShareWindow}. */ -export interface OpenShareWindowOptions { +interface OpenShareWindowOptions { readonly windows: BetterSidebarWindowsClientFace readonly workspaceId: string readonly face: BetterSidebarCluesClientFace