Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 统一键盘快捷键键帽圆角 (#4001)

Dash5be8c30871d1
diff --git a/apps/desktop/src/renderer/__tests__/promptRecommendationBadge.test.ts b/apps/desktop/src/renderer/__tests__/promptRecommendationBadge.test.ts
index f51da16daa..9daa51aac4 100644
--- a/apps/desktop/src/renderer/__tests__/promptRecommendationBadge.test.ts
+++ b/apps/desktop/src/renderer/__tests__/promptRecommendationBadge.test.ts
@@ -15,7 +15,7 @@ describe('prompt recommendation shortcut badge', () => {
);
expect(chatInputSource).toContain('className="min-w-0 truncate"');
expect(chatInputSource).toContain(
- "'pointer-events-auto ml-1 inline-flex h-4 min-w-[22px] shrink-0 cursor-pointer items-center justify-center rounded-lg border border-current'",
+ "'pointer-events-auto ml-1 inline-flex h-4 min-w-[22px] shrink-0 cursor-pointer items-center justify-center rounded-[4px] border border-current'",
);
expect(chatInputSource).toContain(
"'bg-transparent px-0.5 text-11 font-normal leading-none text-inherit'",
diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
index bb56133ef6..4900c9023f 100644
--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
@@ -8430,7 +8430,7 @@ export function ChatInput({
type="button"
aria-label={`${t('newChat.chatInput.recommendationShortcut')}: ${recommendedPrompt ?? ''}`}
className={cn(
- 'pointer-events-auto ml-1 inline-flex h-4 min-w-[22px] shrink-0 cursor-pointer items-center justify-center rounded-lg border border-current',
+ 'pointer-events-auto ml-1 inline-flex h-4 min-w-[22px] shrink-0 cursor-pointer items-center justify-center rounded-[4px] border border-current',
'bg-transparent px-0.5 text-11 font-normal leading-none text-inherit',
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--focus-ring)]',
)}
diff --git a/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx b/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx
index 7d49a1256e..970cc0d00f 100644
--- a/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx
+++ b/apps/desktop/src/renderer/components/settings/KeyboardShortcutsSection.tsx
@@ -487,7 +487,7 @@ export function KeyboardShortcutsSection() {
{/* 组合键展示位: 录制中显示提示, 无绑定显示"未设置" */}
<span
className={cn(
- 'inline-flex min-w-[72px] items-center justify-center rounded-md px-2 py-1',
+ 'inline-flex min-w-[72px] items-center justify-center rounded-[4px] px-2 py-1',
// 不用 font-mono: 项目的 mono 映射到 --app-font-code (代码字体),
// 普遍缺 ⌘⇧⌥⌃ 字形, 会 fallback 渲染得又小又不协调。系统 UI
// 字体自带这些符号的正确字形 (与 VoiceInputSection 显示一致)。
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
index 8b03078d37..ba641bd848 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/__tests__/sessionCardReviewRegressions.test.ts
@@ -7,6 +7,7 @@ const sidebarDir = resolve(__dirname, '..');
const sessionCardSource = readFileSync(resolve(sidebarDir, 'SessionCard.tsx'), 'utf8');
const sessionEntryListSource = readFileSync(resolve(sidebarDir, 'SessionEntryList.tsx'), 'utf8');
const sessionItemSource = readFileSync(resolve(sidebarDir, 'SessionItem.tsx'), 'utf8');
+const sessionOrdinalBadgeSource = readFileSync(resolve(sidebarDir, 'sessionOrdinalBadges.tsx'), 'utf8');
const railNavSource = readFileSync(resolve(sidebarDir, 'RailNav.tsx'), 'utf8');
const sessionRenameInputSource = readFileSync(
resolve(sidebarDir, '..', 'SessionRenameInput.tsx'),
@@ -196,6 +197,7 @@ describe('SessionCard review regressions', () => {
);
expect(sessionItemSource).toContain('invisible col-start-1 row-start-1 inline-flex');
expect(sessionItemSource).toContain('<SessionOrdinalBadgeKbd label={ordinalBadgeLabel} />');
+ expect(sessionOrdinalBadgeSource).toContain('rounded-[4px]');
expect(sessionCardSource).toContain('invisible col-start-1 row-start-1 inline-flex');
expect(sessionCardSource).toContain('<SessionOrdinalBadgeKbd label={ordinalBadgeLabel} />');
expect(sessionItemSource).not.toContain(
diff --git a/apps/desktop/src/renderer/features/cc-agent/sidebar/sessionOrdinalBadges.tsx b/apps/desktop/src/renderer/features/cc-agent/sidebar/sessionOrdinalBadges.tsx
index 222cb35f9d..575a4fb7db 100644
--- a/apps/desktop/src/renderer/features/cc-agent/sidebar/sessionOrdinalBadges.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/sidebar/sessionOrdinalBadges.tsx
@@ -50,7 +50,7 @@ export function SessionOrdinalBadgeKbd({ label }: { label: string }) {
return (
<kbd
aria-hidden
- className="flex select-none items-center gap-px rounded-md bg-[color-mix(in_srgb,currentColor_10%,transparent)] px-1.5 py-[2px] text-11 font-normal leading-none text-current"
+ className="flex select-none items-center gap-px rounded-[4px] bg-[color-mix(in_srgb,currentColor_10%,transparent)] px-1.5 py-[2px] text-11 font-normal leading-none text-current"
>
{macParts ? (
<>
diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.md
index 13ca5f332a..82a20c5de3 100644
--- a/docs/design-rules/DESIGN.md
+++ b/docs/design-rules/DESIGN.md
@@ -16,9 +16,9 @@ What makes this system distinctive is the combination of a single geometric sans
- Near-monochrome default theme; chromatic color only via the sanctioned semantic set (§2), always consumed through tokens (§10)
- Inter as the single sans family, carrying both display headlines and body text
-- Tight border-radius system: 8px (inner controls) / 12px (containers) / 9999px (pill) — three values, nothing else
+- Tight border-radius system: 4px (keyboard keycaps) / 8px (inner controls) / 12px (containers) / 9999px (pill)
- Zero shadows in the base language — depth comes from background color shifts and 1px borders (narrow token-gated exceptions live in §10)
-- Pill-shaped geometry on all interactive elements (buttons, tabs, single-line inputs, tags) — the only exemption is registered bare text buttons (§5); textareas use the 8px inner-control radius (§5)
+- Pill-shaped geometry on interactive elements (buttons, tabs, single-line inputs, tags); visible keyboard shortcut frames use the registered 4px keycap exception (§5), and textareas use the 8px inner-control radius (§5)
- No mascots or decorative artwork in the working UI — brand imagery appears only on sanctioned brand surfaces (see §15.7 / §16)
- Extreme content restraint — each surface presents one clear idea
@@ -327,9 +327,10 @@ Three tiers — **these three only** (wording hardened 2026-08-29, designer ruli
- **Pill (9999px)**: **every button is a pill — the only exemption is registered bare text buttons.** Anything that commits a decision or triggers an action wears the pill: buttons (permission approve/deny included), tabs, single-line inputs, tags, badges — including buttons with transparent or outlined fills (dialog secondary/cancel are pills with a transparent fill; a control's fill style never changes its tier). The exemption is exactly **bare text buttons with no background of their own** (wizard back-navigation "← 上一步", the §16.3 login text-button category): they have no shape to round — text, not a button-shaped control — so they carry no radius at all. Register any new bare-text-button usage in the component entry that introduces it.
- **Container (12px)**: the box that holds content — code blocks, cards, panels, dialogs. Implemented as Tailwind `rounded-xl` (12px).
+- **Keyboard keycap (4px)**: every visible keyboard shortcut frame, whether rendered as `<kbd>` or as an interactive button that accepts the shortcut, uses a 4px outer radius (`rounded-[4px]`). Keep its border, fill, padding, and text colors appropriate to the surrounding control; the radius is the shared cross-surface rule. This is the sole 4px exception and keeps keyboard hints visually distinct from pill buttons and containers.
- **Inner control (8px)**: multi-line inputs (textarea) — **always 8px, whether the textarea sits inside a visible container or is the outermost control of a form area** — plus selected/hover row highlights in dropdowns/menus and small in-block cells nested inside a container. Implemented as Tailwind `rounded-lg` (8px).
-_No 4px / 6px / 10px, and no arbitrary radii. **4px is not a tier**: existing `rounded-[4px]` usages (30 production occurrences on 2026-08-29 — `git grep -o "rounded-\[4px\]" -- apps/desktop/src/renderer | wc -l`) are registered debt to be migrated by the design-system roadmap, and **new code must not introduce it** — in ANY of its equivalent spellings: bare `rounded` (Tailwind DEFAULT 0.25rem; 58 string-literal occurrences) and `rounded-sm` (`--radius`−4px; 11 occurrences — `--radius` is runtime-injected by `theme-service` from `colors.ts` `registerColor('radius', '0.5rem')`) both resolve to 4px too, and are equally forbidden (counts and commands live in the decision log's 08-29 entry; the `--radius` math assumes the theme does not override `colors.radius` — a local-theme override shifts the derived values, see the decision log's 08-29 entry §(7)). Do not add tiers, and **"it looks small" is never a reason to move an element down a tier** — an element's tier follows what it IS (button / box / textarea — always 8px / nested non-button), not its size or nesting. Mind nesting: an 8px row highlight inside a 12px panel must stay smaller than its container to nest cleanly (hence 8, not 12) — a pill there becomes a lozenge, 12px looks bloated._
+_No 6px / 10px, and no arbitrary radii. **4px is reserved for keyboard keycaps** as defined above; other new components must not introduce it. Existing non-keycap `rounded-[4px]` usages remain registered debt. Bare `rounded` and `rounded-sm` are not substitutes for the keycap rule. Do not add tiers, and **"it looks small" is never a reason to move an element down a tier** — an element's tier follows what it IS (button / box / textarea — always 8px / nested non-button), not its size or nesting. Mind nesting: an 8px row highlight inside a 12px panel must stay smaller than its container; a pill there becomes a lozenge, 12px looks bloated._
> **Narrow exception — status micro-cells (2px)** (registered 2026-07-28): non-interactive status squares of 8×8px or smaller keep a 2px radius — the workflow agent status strip's cells (background-tasks panel detail + workflow chat card) and the equivalent per-category square in SystemCard. At that size any tier radius rounds the square into a dot and destroys the "block strip" read that lets a large agent fleet be scanned at a glance. Scope is exactly this: **non-interactive, ≤8px, status-only**. Do NOT generalize to buttons, tags, rows, badges or containers — those still pick a tier.
@@ -348,7 +349,7 @@ _No 4px / 6px / 10px, and no arbitrary radii. **4px is not a tier**: existing `r
### Do
- Use Surface (`#f8f8f6` Light / `#1f1f1e` Dark) as the page background — every page starts here
-- Use pill-shaped (9999px) radius on all interactive elements — buttons, tabs, single-line inputs, tags (registered bare text buttons are the only exemption — §5)
+- Use pill-shaped (9999px) radius on interactive elements — buttons, tabs, single-line inputs, tags. Visible keyboard shortcut frames use the registered 4px keycap exception (§5).
- Use 12px radius on all non-interactive containers — code blocks, cards, panels
- Use 8px radius for multi-line inputs (textarea, always) and non-button inner controls — dropdown/menu row highlights, in-block cells (see §5)
- Keep the palette strictly grayscale — chromatic color only via the sanctioned semantic set in §2, always through tokens
@@ -361,7 +362,7 @@ _No 4px / 6px / 10px, and no arbitrary radii. **4px is not a tier**: existing `r
### Don't
- Don't introduce any chromatic color outside the sanctioned semantic set in §2 — no brand blue, no accent green, no warm tones beyond the registered exceptions
-- Don't invent arbitrary radii — only three values exist: 8px (inner controls), 12px (containers), 9999px (pill). Nothing in between, nothing else.
+- Don't invent arbitrary radii — use the registered values: 4px (keyboard keycaps), 8px (inner controls), 12px (containers), 9999px (pill).
- Don't add shadows to any element — the flat aesthetic is intentional
- Don't use font weights above 600 in UI chrome — 700 only inside the exemption domains registered in the §3 registry (that table is the single source of truth; it currently covers markdown content, hljs theme ports, login / Splash brand canvas, third-party viewers under `vendor/`, and imperative third-party APIs). Don't re-enumerate the domains here — read §3. No 800+, no in-between values, anywhere
- Don't add decorative illustrations — Cindy's working UI carries no mascots or artwork; brand imagery appears only on the explicitly enumerated sanctioned brand surfaces in §15.7 / §16
@@ -411,7 +412,7 @@ Cindy Mobile (React Native) has its own device-class rules (phone / pad portrait
1. Focus on ONE component at a time
2. Keep all values grayscale — "Stone (#737373)" not "use a light color"
-3. Always specify radius from the three tiers — pill (9999px) / container (12px) / inner control (8px — textareas always, dropdown rows & non-button inner cells). Nothing else.
+3. Always specify radius from the defined tiers — pill (9999px) / container (12px) / inner control (8px — textareas always, dropdown rows & non-button inner cells) / keyboard keycap (4px). Nothing else.
4. Shadows are always zero — never add them
5. Weight is 400/500 for everyday chrome, 600 for rationed emphasis — 700 never appears in new UI (registered exemption domains in §3 only)
6. If something feels too decorated, remove it — less is always more
diff --git a/docs/design-rules/design-decision-log.md b/docs/design-rules/design-decision-log.md
index e2caa17e22..1565329f8a 100644
--- a/docs/design-rules/design-decision-log.md
+++ b/docs/design-rules/design-decision-log.md
@@ -12,6 +12,8 @@
## 2026-09
+- **09-06** **键盘快捷键外框统一使用 4px 圆角(用户裁决,PR #4001)**:所有可见快捷键外框,无论使用 `<kbd>` 还是承载快捷键的交互按钮,统一采用 `rounded-[4px]`;边框、填充、内边距和文字颜色按所在表面保留上下文差异。该规则是圆角体系的注册例外,覆盖 08-29「4px 不入档」对键盘键帽的适用范围;`DESIGN.md §5` 与 `design-governance.md §10` 已同步回写。
+
- **09-06** **首页撤掉订阅与赠送余额告知大卡(拍板人 = 用户)**——用户重申:
「我要求撤掉的……重新发个 pr,按我要求调整。」
[首页改版最初提交](https://github.com/makecindy/cindy/commit/c1b88f8824a342d9976c042aaea446c77d3194a5)
diff --git a/docs/design-rules/design-governance.md b/docs/design-rules/design-governance.md
index 15ef60209b..61d60f673c 100644
--- a/docs/design-rules/design-governance.md
+++ b/docs/design-rules/design-governance.md
@@ -229,7 +229,8 @@ ls apps/desktop/src/renderer/themes/builtin/*.ts | wc -l
| 事项 | 现状 | 裁决人 | 规则 |
| --- | --- | --- | --- |
-| PermissionPrompt 圆角 | **已关闭(2026-08-29 裁决,#3619 回写)**:三档不变、按钮一律胶囊(唯一豁免 = 已登记的裸文字按钮)、8px = textarea 一律 8px + 盒内非按钮、4px 不入档(含裸 `rounded` / `rounded-sm` 等价写法,**前提 = 主题未覆盖 `colors.radius`**;存量为债、新代码禁止)、「看起来小」不是改档理由。`DESIGN.md §5` 已加硬,全文归档于 [`design-decision-log.md`](./design-decision-log.md)「08-29」条 | 设计师 | 已按 `DESIGN.md §13` 机制回写并归档(与回写同一 PR 生效) |
+| PermissionPrompt 圆角 | **已关闭(2026-08-29 裁决,#3619 回写)**:按钮一律胶囊,8px 用于 textarea 与盒内非按钮;该行不决定键盘键帽。 | 设计师 | 原裁决保留;键盘键帽由 2026-09-06 的独立规则覆盖 |
+| 键盘快捷键外框圆角 | **已关闭(2026-09-06,#4001)**:所有可见快捷键外框(`<kbd>` 或承载快捷键的交互按钮)统一使用 4px 外圆角;边框、填充、内边距和文字颜色按所在表面处理。 | 用户 | 已回写 `DESIGN.md §5` 与 `design-decision-log.md`「09-06」条 |
| `radius` 主题覆盖 | 待裁决(随 DS-7 棘轮设计一并关):本地主题 JSON 可覆盖 `colors.radius`(`resolveThemeValue` 优先 `theme.colors[id]`),届时 `rounded-sm`/`rounded-md` 的 computed 值整体平移、不再等于 4px/6px。是否冻结 `radius` 为不可覆盖不变量(涉及 `local-themes-normalize` 白名单 + 既有本地主题兼容红线);裁决前 DS-7 按类名建基线、以默认主题 computed 值为准 | 设计师 | 未关闭前 DS-7 棘轮不得把覆盖了 `radius` 的本地主题报为违规;结论回写 `DESIGN.md` §5 与 decision-log |
| 单行输入 focus 环:spec 与实现不一致 | 待裁决(DS-4 2026-09-04 登记):`DESIGN.md §4` `input/text` 规定 focus 用 `--focus-ring-soft`(50% 蓝),而 `components/ui/input.tsx`(升格自 SettingsTextInput)实到的是 opaque `--focus-ring`——该偏差在收敛 SettingsTextInput 时即存在,理由是与相邻未迁移输入保持一致。DS-4 只登记不擅自统一:改 spec 会追认一个没人裁决过的值,改实现会动 6 个既有消费者的观感 | 设计师 | 未关闭前 `ui/input` 维持 opaque `--focus-ring`,§4 保留 ⚠ 标注;结论回写 `DESIGN.md §4` 并归档 decision-log |
| Permission 迁移余项 | 待裁决:允许/拒绝按钮的视觉主次、危险授权样式、Desktop 与 Mobile 权限弹窗几何是否一致 | 设计师 | 余项未关闭前,Permission 相关文件不得进入任何迁移 PR 的 diff(DS-6 前置);结论同样回写 `DESIGN.md` 并归档 |