diff --git a/AGENTS.md b/AGENTS.md index aa34a37..547143a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ 本文件用于约束在 BlueArchiveToolkit 中工作的 AI Agent。 -具体开发进度看 `CURRENT_STATUS.md`,开发计划看 `PROJECT_PLAN.md`,当前缺口看 `docs/reports/CURRENT_GAPS.md`。这里不记录具体任务和阶段待办。 +具体开发进度看 `CURRENT_STATUS.md`,开发计划看 `PROJECT_PLAN.md`,当前能力缺口看 `docs/reports/CURRENT_GAPS.md`,具体工程任务、优先级和依赖看根目录 `TODO.md`。这里不记录具体任务和阶段待办。 ## 基本要求 @@ -14,6 +14,18 @@ BlueArchiveToolkit 是长期维护项目。不要为了尽快完成当前任务 如果发现用户提出的方案、现有代码或文档本身有问题,直接指出。不要为了迎合要求保留明显不合理的设计。 +## 工程修改原则 + +BlueArchiveToolkit 不以“最小修复”为工程目标。不要为了让单个 testcase 通过、暂时消除表面症状或缩小 diff,而留下已经能够确认的同根因问题。 + +处理问题时优先保证长期可维护性、可用性、安全性、明确契约、恢复能力和回归覆盖。进入一个工程边界后,应根据实际相关性检查正常路径、异常路径、并发、重试、恢复、兼容、持久化和资源限制,并把属于同一 root cause 或同一 contract 的问题完整收口。 + +这不意味着无边界重构。不要为了架构形式、代码行数或“以后也许会用”扩大修改范围;与当前 contract 无关的问题应记录到 `TODO.md`,留给后续独立处理。 + +跨模块问题必须沿真实状态所有权和调用链检查。例如 Rust 状态经 RPC 暴露给 Go,再由 HTTP 或 Web 消费时,不能只修改其中一层而让其他层继续保持矛盾语义。 + +持久化和状态机修改应考虑 schema/version、transaction、crash consistency、retry、recovery 与兼容读取;解析器、压缩包和其他外部输入应考虑 size/count/depth 等资源边界以及 malformed input 的确定性失败。 + ## 以什么为准 仓库里有不少历史文档,不能混着看。 @@ -71,6 +83,96 @@ Go `bat-api` 是资源 bootstrap、只读分发和管理入口。它通过 `bat. 不要静默改变已有字段的含义。确实需要破坏性修改时,先考虑版本号、迁移或兼容读取。 +## Dashboard 开发与设计 + +BlueArchiveToolkit 包含两个面向不同使用者的 Dashboard:用户 Dashboard 与运营 Dashboard。两者属于同一产品,应共享基础视觉语言、组件风格和交互一致性,但不得因为复用组件而混淆产品职责、信息层级或权限边界。 + +涉及 Dashboard、Web UI、页面布局、视觉样式、组件设计或交互体验的任务,在开始设计和修改前必须阅读仓库根目录的 `DESIGN.md`。 + +`DESIGN.md` 是 Dashboard 的主要视觉参考与设计灵感来源。应理解并延续其中的色彩关系、排版、空间、边框、层级、组件形态和交互气质,但不得机械复制其来源产品的页面结构、品牌内容或不适合 BlueArchiveToolkit 的设计。实际页面的信息架构始终由 BlueArchiveToolkit 当前功能、真实数据结构和使用场景决定。 + +### 用户 Dashboard + +用户 Dashboard 面向普通 BlueArchiveToolkit 用户,目标是以尽可能低的认知负担完成与汉化相关的用户操作。 + +当前用户可控制的核心能力仅包括: + +* 文字汉化是否启用; +* 图像汉化是否启用。 + +用户端可以展示与这些操作直接相关的必要信息,例如汉化状态、当前可用版本、更新状态、操作反馈或用户需要处理的异常,但不得暴露内部运维实现。 + +除非未来产品需求明确改变,否则用户 Dashboard 不应展示或要求用户理解: + +* `bat` / `bat-api` 内部状态; +* RPC、daemon、worker; +* CAS; +* Provider / provider run; +* Translation Memory 内部记录; +* translation task; +* Parser; +* official/localized release 的内部实现细节; +* 服务端日志、内部错误栈和运维指标。 + +用户端优先保证清晰、简洁、可信和易操作。不要为了表现“Dashboard 感”堆积 KPI 卡片、图表、技术指标或无实际用途的信息。 + +### 运营 Dashboard + +运营 Dashboard 面向项目运营和维护者,用于观察和管理 BlueArchiveToolkit 的真实运行状态。 + +运营端可以根据当前后端实际提供的 contract 展示和组织: + +* `bat` 与 `bat-api` 运行状态; +* official resource / official release; +* localized resource / localized release; +* 资源同步与更新状态; +* Translation / Translation Memory; +* Provider 与 worker; +* task / job; +* daemon/runtime; +* CAS; +* 错误、诊断与日志; +* 配置和必要的运营操作。 + +运营 Dashboard 是高信息密度的 developer/operations interface。优先使用结构化列表、表格、紧凑状态信息、清晰的主次层级和按需 drill-down,而不是将所有数据做成大型 Card。 + +首页应帮助运营者快速回答“系统是否正常、哪里需要处理、最近发生了什么”,而不是简单罗列所有可获得的指标。 + +### 两个 Dashboard 的关系 + +两个 Dashboard 应共享: + +* 基础 Design Token; +* Typography; +* Color System; +* Button、Input、Switch、Dialog 等基础组件; +* Loading、Empty、Error、Warning、Success 等状态语言; +* Motion 与交互反馈原则; +* 品牌识别。 + +但可以拥有不同的: + +* Navigation; +* 页面结构; +* 信息密度; +* 内容层级; +* 默认组件尺寸; +* 数据展示方式。 + +不要把运营 Dashboard 简单裁剪几个菜单后作为用户 Dashboard,也不要为了用户端的简洁限制运营端所需的信息密度。 + +### 设计实现原则 + +Dashboard 设计必须以真实接口和真实状态为依据。不得为了视觉完整性伪造后端不存在的数据、指标、趋势、操作或状态。 + +如果设计需要当前 API/RPC 尚未提供的信息,应明确指出缺失 contract,而不是在前端维护第二份业务状态或通过猜测拼接数据。 + +优先复用项目现有前端组件和设计基础。引入新组件模式前先确认现有组件无法合理满足需求,避免同一项目逐步形成多套 Card、Table、Badge、Button 或状态展示体系。 + +`DESIGN.md` 是视觉方向,不高于项目稳定架构与产品事实。发生冲突时按以下优先级处理: + +`AGENTS.md` 与稳定产品/接口契约 > 当前明确任务需求 > `DESIGN.md` > Agent 自身设计偏好。 + ## 代码修改 先弄清楚代码为什么放在当前位置,再决定是继续修改还是拆模块。 @@ -86,9 +188,19 @@ Go `bat-api` 是资源 bootstrap、只读分发和管理入口。它通过 `bat. * 无说明的硬编码; * 魔法数字; * 假实现、空实现冒充完成功能; -* 用 `TODO` / `FIXME` 代替正式的缺口记录。 +* 用代码内 `TODO` / `FIXME` 代替根目录 `TODO.md`、`CURRENT_GAPS.md` 或其他正式缺口记录。 -如果当前任务确实无法完成某一部分,应明确限制实现范围,并把剩余问题记录到对应的状态、缺口或 Issue 中。 +如果当前任务确实无法完成某一部分,应明确限制实现范围;具体后续工程任务记录到根目录 `TODO.md`,能力缺口同步到 `CURRENT_GAPS.md`,需要外部协作时再使用 Issue。 + +## TODO 任务治理 + +根目录 `TODO.md` 是具体工程任务、优先级、依赖关系和完成条件的仓库内任务账本。开始具体开发前,应读取与当前工作相关的 TODO;完成任务或发现独立新问题后,应同步更新其状态和依赖。 + +`TODO.md` 不是当前实现事实来源。源码和测试、`CURRENT_STATUS.md`、专项 current-status 文档以及稳定 contract 的优先级高于 TODO 描述。若 TODO 与当前实现冲突,应先核对事实并更新过时 TODO,不要按照旧条目重新实现已经完成的能力。 + +属于当前任务同一 root cause 或同一 contract 的已确认问题,不得仅为了缩小 patch 而登记 TODO 后绕过;应在当前工程边界内一起收口。明显独立的问题应记录到 `TODO.md`,避免当前修改无限扩张。 + +`docs/reports/CURRENT_GAPS.md` 用于记录产品或工程能力层面的当前缺口;`PROJECT_PLAN.md` 用于长期路线;`TODO.md` 用于可执行任务追踪。不要把这些职责混在一起。 ## 文件、网络和发布安全 @@ -145,7 +257,9 @@ make check-docs 不要把具体任务、临时优先级或某次实现方案写进本文件。 -新的长期架构决策应该进入 ADR 或对应架构文档;开发路线进入 `PROJECT_PLAN.md`;实际进度进入 `CURRENT_STATUS.md`;未完成内容进入 `CURRENT_GAPS.md` 或 Issue。 +新的长期架构决策应该进入 ADR 或对应架构文档;开发路线进入 `PROJECT_PLAN.md`;实际进度进入 `CURRENT_STATUS.md`;能力缺口进入 `docs/reports/CURRENT_GAPS.md`;具体工程任务、依赖和完成条件进入根目录 `TODO.md`;需要外部协作时再使用 Issue。 + +Dashboard 的视觉方向与设计灵感进入根目录 `DESIGN.md`;Dashboard 的产品职责、状态所有权和接口事实仍以本文件与稳定产品/接口契约为准。 ## 工作方式 diff --git a/DESIGN.md b/DESIGN.md new file mode 100644 index 0000000..3a70171 --- /dev/null +++ b/DESIGN.md @@ -0,0 +1,367 @@ +# Design System Inspiration of Linear + +## 1. Visual Theme & Atmosphere + +Linear's website is a masterclass in dark-mode-first product design — a near-black canvas (`#08090a`) where content emerges from darkness like starlight. The overall impression is one of extreme precision engineering: every element exists in a carefully calibrated hierarchy of luminance, from barely-visible borders (`rgba(255,255,255,0.05)`) to soft, luminous text (`#f7f8f8`). This is not a dark theme applied to a light design — it is darkness as the native medium, where information density is managed through subtle gradations of white opacity rather than color variation. + +The typography system is built entirely on Inter Variable with OpenType features `"cv01"` and `"ss03"` enabled globally, giving the typeface a cleaner, more geometric character. Inter is used at a remarkable range of weights — from 300 (light body) through 510 (medium, Linear's signature weight) to 590 (semibold emphasis). The 510 weight is particularly distinctive: it sits between regular and medium, creating a subtle emphasis that doesn't shout. At display sizes (72px, 64px, 48px), Inter uses aggressive negative letter-spacing (-1.584px to -1.056px), creating compressed, authoritative headlines that feel engineered rather than designed. Berkeley Mono serves as the monospace companion for code and technical labels, with fallbacks to ui-monospace, SF Mono, and Menlo. + +The color system is almost entirely achromatic — dark backgrounds with white/gray text — punctuated by a single brand accent: Linear's signature indigo-violet (`#5e6ad2` for backgrounds, `#7170ff` for interactive accents). This accent color is used sparingly and intentionally, appearing only on CTAs, active states, and brand elements. The border system uses ultra-thin, semi-transparent white borders (`rgba(255,255,255,0.05)` to `rgba(255,255,255,0.08)`) that create structure without visual noise, like wireframes drawn in moonlight. + +**Key Characteristics:** +- Dark-mode-native: `#08090a` marketing background, `#0f1011` panel background, `#191a1b` elevated surfaces +- Inter Variable with `"cv01", "ss03"` globally — geometric alternates for a cleaner aesthetic +- Signature weight 510 (between regular and medium) for most UI text +- Aggressive negative letter-spacing at display sizes (-1.584px at 72px, -1.056px at 48px) +- Brand indigo-violet: `#5e6ad2` (bg) / `#7170ff` (accent) / `#828fff` (hover) — the only chromatic color in the system +- Semi-transparent white borders throughout: `rgba(255,255,255,0.05)` to `rgba(255,255,255,0.08)` +- Button backgrounds at near-zero opacity: `rgba(255,255,255,0.02)` to `rgba(255,255,255,0.05)` +- Multi-layered shadows with inset variants for depth on dark surfaces +- Radix UI primitives as the component foundation (6 detected primitives) +- Success green (`#27a644`, `#10b981`) used only for status indicators + +## 2. Color Palette & Roles + +### Background Surfaces +- **Marketing Black** (`#010102` / `#08090a`): The deepest background — the canvas for hero sections and marketing pages. Near-pure black with an imperceptible blue-cool undertone. +- **Panel Dark** (`#0f1011`): Sidebar and panel backgrounds. One step up from the marketing black. +- **Level 3 Surface** (`#191a1b`): Elevated surface areas, card backgrounds, dropdowns. +- **Secondary Surface** (`#28282c`): The lightest dark surface — used for hover states and slightly elevated components. + +### Text & Content +- **Primary Text** (`#f7f8f8`): Near-white with a barely-warm cast. The default text color — not pure white, preventing eye strain on dark backgrounds. +- **Secondary Text** (`#d0d6e0`): Cool silver-gray for body text, descriptions, and secondary content. +- **Tertiary Text** (`#8a8f98`): Muted gray for placeholders, metadata, and de-emphasized content. +- **Quaternary Text** (`#62666d`): The most subdued text — timestamps, disabled states, subtle labels. + +### Brand & Accent +- **Brand Indigo** (`#5e6ad2`): Primary brand color — used for CTA button backgrounds, brand marks, and key interactive surfaces. +- **Accent Violet** (`#7170ff`): Brighter variant for interactive elements — links, active states, selected items. +- **Accent Hover** (`#828fff`): Lighter, more saturated variant for hover states on accent elements. +- **Security Lavender** (`#7a7fad`): Muted indigo used specifically for security-related UI elements. + +### Status Colors +- **Green** (`#27a644`): Primary success/active status. Used for "in progress" indicators. +- **Emerald** (`#10b981`): Secondary success — pill badges, completion states. + +### Border & Divider +- **Border Primary** (`#23252a`): Solid dark border for prominent separations. +- **Border Secondary** (`#34343a`): Slightly lighter solid border. +- **Border Tertiary** (`#3e3e44`): Lightest solid border variant. +- **Border Subtle** (`rgba(255,255,255,0.05)`): Ultra-subtle semi-transparent border — the default. +- **Border Standard** (`rgba(255,255,255,0.08)`): Standard semi-transparent border for cards, inputs, code blocks. +- **Line Tint** (`#141516`): Nearly invisible line for the subtlest divisions. +- **Line Tertiary** (`#18191a`): Slightly more visible divider line. + +### Light Mode Neutrals (for light theme contexts) +- **Light Background** (`#f7f8f8`): Page background in light mode. +- **Light Surface** (`#f3f4f5` / `#f5f6f7`): Subtle surface tinting. +- **Light Border** (`#d0d6e0`): Visible border in light contexts. +- **Light Border Alt** (`#e6e6e6`): Alternative lighter border. +- **Pure White** (`#ffffff`): Card surfaces, highlights. + +### Overlay +- **Overlay Primary** (`rgba(0,0,0,0.85)`): Modal/dialog backdrop — extremely dark for focus isolation. + +## 3. Typography Rules + +### Font Family +- **Primary**: `Inter Variable`, with fallbacks: `SF Pro Display, -apple-system, system-ui, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Open Sans, Helvetica Neue` +- **Monospace**: `Berkeley Mono`, with fallbacks: `ui-monospace, SF Mono, Menlo` +- **OpenType Features**: `"cv01", "ss03"` enabled globally — cv01 provides an alternate lowercase 'a' (single-story), ss03 adjusts specific letterforms for a cleaner geometric appearance. + +### Hierarchy + +| Role | Font | Size | Weight | Line Height | Letter Spacing | Notes | +|------|------|------|--------|-------------|----------------|-------| +| Display XL | Inter Variable | 72px (4.50rem) | 510 | 1.00 (tight) | -1.584px | Hero headlines, maximum impact | +| Display Large | Inter Variable | 64px (4.00rem) | 510 | 1.00 (tight) | -1.408px | Secondary hero text | +| Display | Inter Variable | 48px (3.00rem) | 510 | 1.00 (tight) | -1.056px | Section headlines | +| Heading 1 | Inter Variable | 32px (2.00rem) | 400 | 1.13 (tight) | -0.704px | Major section titles | +| Heading 2 | Inter Variable | 24px (1.50rem) | 400 | 1.33 | -0.288px | Sub-section headings | +| Heading 3 | Inter Variable | 20px (1.25rem) | 590 | 1.33 | -0.24px | Feature titles, card headers | +| Body Large | Inter Variable | 18px (1.13rem) | 400 | 1.60 (relaxed) | -0.165px | Introduction text, feature descriptions | +| Body Emphasis | Inter Variable | 17px (1.06rem) | 590 | 1.60 (relaxed) | normal | Emphasized body, sub-headings in content | +| Body | Inter Variable | 16px (1.00rem) | 400 | 1.50 | normal | Standard reading text | +| Body Medium | Inter Variable | 16px (1.00rem) | 510 | 1.50 | normal | Navigation, labels | +| Body Semibold | Inter Variable | 16px (1.00rem) | 590 | 1.50 | normal | Strong emphasis | +| Small | Inter Variable | 15px (0.94rem) | 400 | 1.60 (relaxed) | -0.165px | Secondary body text | +| Small Medium | Inter Variable | 15px (0.94rem) | 510 | 1.60 (relaxed) | -0.165px | Emphasized small text | +| Small Semibold | Inter Variable | 15px (0.94rem) | 590 | 1.60 (relaxed) | -0.165px | Strong small text | +| Small Light | Inter Variable | 15px (0.94rem) | 300 | 1.47 | -0.165px | De-emphasized body | +| Caption Large | Inter Variable | 14px (0.88rem) | 510–590 | 1.50 | -0.182px | Sub-labels, category headers | +| Caption | Inter Variable | 13px (0.81rem) | 400–510 | 1.50 | -0.13px | Metadata, timestamps | +| Label | Inter Variable | 12px (0.75rem) | 400–590 | 1.40 | normal | Button text, small labels | +| Micro | Inter Variable | 11px (0.69rem) | 510 | 1.40 | normal | Tiny labels | +| Tiny | Inter Variable | 10px (0.63rem) | 400–510 | 1.50 | -0.15px | Overline text, sometimes uppercase | +| Link Large | Inter Variable | 16px (1.00rem) | 400 | 1.50 | normal | Standard links | +| Link Medium | Inter Variable | 15px (0.94rem) | 510 | 2.67 | normal | Spaced navigation links | +| Link Small | Inter Variable | 14px (0.88rem) | 510 | 1.50 | normal | Compact links | +| Link Caption | Inter Variable | 13px (0.81rem) | 400–510 | 1.50 | -0.13px | Footer, metadata links | +| Mono Body | Berkeley Mono | 14px (0.88rem) | 400 | 1.50 | normal | Code blocks | +| Mono Caption | Berkeley Mono | 13px (0.81rem) | 400 | 1.50 | normal | Code labels | +| Mono Label | Berkeley Mono | 12px (0.75rem) | 400 | 1.40 | normal | Code metadata, sometimes uppercase | + +### Principles +- **510 is the signature weight**: Linear uses Inter Variable's 510 weight (between regular 400 and medium 500) as its default emphasis weight. This creates a subtly bolded feel without the heaviness of traditional medium or semibold. +- **Compression at scale**: Display sizes use progressively tighter letter-spacing — -1.584px at 72px, -1.408px at 64px, -1.056px at 48px, -0.704px at 32px. Below 24px, spacing relaxes toward normal. +- **OpenType as identity**: `"cv01", "ss03"` aren't decorative — they transform Inter into Linear's distinctive typeface, giving it a more geometric, purposeful character. +- **Three-tier weight system**: 400 (reading), 510 (emphasis/UI), 590 (strong emphasis). The 300 weight appears only in deliberately de-emphasized contexts. + +## 4. Component Stylings + +### Buttons + +**Ghost Button (Default)** +- Background: `rgba(255,255,255,0.02)` +- Text: `#e2e4e7` (near-white) +- Padding: comfortable +- Radius: 6px +- Border: `1px solid rgb(36, 40, 44)` +- Outline: none +- Focus shadow: `rgba(0,0,0,0.1) 0px 4px 12px` +- Use: Standard actions, secondary CTAs + +**Subtle Button** +- Background: `rgba(255,255,255,0.04)` +- Text: `#d0d6e0` (silver-gray) +- Padding: 0px 6px +- Radius: 6px +- Use: Toolbar actions, contextual buttons + +**Primary Brand Button (Inferred)** +- Background: `#5e6ad2` (brand indigo) +- Text: `#ffffff` +- Padding: 8px 16px +- Radius: 6px +- Hover: `#828fff` shift +- Use: Primary CTAs ("Start building", "Sign up") + +**Icon Button (Circle)** +- Background: `rgba(255,255,255,0.03)` or `rgba(255,255,255,0.05)` +- Text: `#f7f8f8` or `#ffffff` +- Radius: 50% +- Border: `1px solid rgba(255,255,255,0.08)` +- Use: Close, menu toggle, icon-only actions + +**Pill Button** +- Background: transparent +- Text: `#d0d6e0` +- Padding: 0px 10px 0px 5px +- Radius: 9999px +- Border: `1px solid rgb(35, 37, 42)` +- Use: Filter chips, tags, status indicators + +**Small Toolbar Button** +- Background: `rgba(255,255,255,0.05)` +- Text: `#62666d` (muted) +- Radius: 2px +- Border: `1px solid rgba(255,255,255,0.05)` +- Shadow: `rgba(0,0,0,0.03) 0px 1.2px 0px 0px` +- Font: 12px weight 510 +- Use: Toolbar actions, quick-access controls + +### Cards & Containers +- Background: `rgba(255,255,255,0.02)` to `rgba(255,255,255,0.05)` (never solid — always translucent) +- Border: `1px solid rgba(255,255,255,0.08)` (standard) or `1px solid rgba(255,255,255,0.05)` (subtle) +- Radius: 8px (standard), 12px (featured), 22px (large panels) +- Shadow: `rgba(0,0,0,0.2) 0px 0px 0px 1px` or layered multi-shadow stacks +- Hover: subtle background opacity increase + +### Inputs & Forms + +**Text Area** +- Background: `rgba(255,255,255,0.02)` +- Text: `#d0d6e0` +- Border: `1px solid rgba(255,255,255,0.08)` +- Padding: 12px 14px +- Radius: 6px + +**Search Input** +- Background: transparent +- Text: `#f7f8f8` +- Padding: 1px 32px (icon-aware) + +**Button-style Input** +- Text: `#8a8f98` +- Padding: 1px 6px +- Radius: 5px +- Focus shadow: multi-layer stack + +### Badges & Pills + +**Success Pill** +- Background: `#10b981` +- Text: `#f7f8f8` +- Radius: 50% (circular) +- Font: 10px weight 510 +- Use: Status dots, completion indicators + +**Neutral Pill** +- Background: transparent +- Text: `#d0d6e0` +- Padding: 0px 10px 0px 5px +- Radius: 9999px +- Border: `1px solid rgb(35, 37, 42)` +- Font: 12px weight 510 +- Use: Tags, filter chips, category labels + +**Subtle Badge** +- Background: `rgba(255,255,255,0.05)` +- Text: `#f7f8f8` +- Padding: 0px 8px 0px 2px +- Radius: 2px +- Border: `1px solid rgba(255,255,255,0.05)` +- Font: 10px weight 510 +- Use: Inline labels, version tags + +### Navigation +- Dark sticky header on near-black background +- Linear logomark left-aligned (SVG icon) +- Links: Inter Variable 13–14px weight 510, `#d0d6e0` text +- Active/hover: text lightens to `#f7f8f8` +- CTA: Brand indigo button or ghost button +- Mobile: hamburger collapse +- Search: command palette trigger (`/` or `Cmd+K`) + +### Image Treatment +- Product screenshots on dark backgrounds with subtle border (`rgba(255,255,255,0.08)`) +- Top-rounded images: `12px 12px 0px 0px` radius +- Dashboard/issue previews dominate feature sections +- Subtle shadow beneath screenshots: `rgba(0,0,0,0.4) 0px 2px 4px` + +## 5. Layout Principles + +### Spacing System +- Base unit: 8px +- Scale: 1px, 4px, 7px, 8px, 11px, 12px, 16px, 19px, 20px, 22px, 24px, 28px, 32px, 35px +- The 7px and 11px values suggest micro-adjustments for optical alignment +- Primary rhythm: 8px, 16px, 24px, 32px (standard 8px grid) + +### Grid & Container +- Max content width: approximately 1200px +- Hero: centered single-column with generous vertical padding +- Feature sections: 2–3 column grids for feature cards +- Full-width dark sections with internal max-width constraints +- Changelog: single-column timeline layout + +### Whitespace Philosophy +- **Darkness as space**: On Linear's dark canvas, empty space isn't white — it's absence. The near-black background IS the whitespace, and content emerges from it. +- **Compressed headlines, expanded surroundings**: Display text at 72px with -1.584px tracking is dense and compressed, but sits within vast dark padding. The contrast between typographic density and spatial generosity creates tension. +- **Section isolation**: Each feature section is separated by generous vertical padding (80px+) with no visible dividers — the dark background provides natural separation. + +### Border Radius Scale +- Micro (2px): Inline badges, toolbar buttons, subtle tags +- Standard (4px): Small containers, list items +- Comfortable (6px): Buttons, inputs, functional elements +- Card (8px): Cards, dropdowns, popovers +- Panel (12px): Panels, featured cards, section containers +- Large (22px): Large panel elements +- Full Pill (9999px): Chips, filter pills, status tags +- Circle (50%): Icon buttons, avatars, status dots + +## 6. Depth & Elevation + +| Level | Treatment | Use | +|-------|-----------|-----| +| Flat (Level 0) | No shadow, `#010102` bg | Page background, deepest canvas | +| Subtle (Level 1) | `rgba(0,0,0,0.03) 0px 1.2px 0px` | Toolbar buttons, micro-elevation | +| Surface (Level 2) | `rgba(255,255,255,0.05)` bg + `1px solid rgba(255,255,255,0.08)` border | Cards, input fields, containers | +| Inset (Level 2b) | `rgba(0,0,0,0.2) 0px 0px 12px 0px inset` | Recessed panels, inner shadows | +| Ring (Level 3) | `rgba(0,0,0,0.2) 0px 0px 0px 1px` | Border-as-shadow technique | +| Elevated (Level 4) | `rgba(0,0,0,0.4) 0px 2px 4px` | Floating elements, dropdowns | +| Dialog (Level 5) | Multi-layer stack: `rgba(0,0,0,0) 0px 8px 2px, rgba(0,0,0,0.01) 0px 5px 2px, rgba(0,0,0,0.04) 0px 3px 2px, rgba(0,0,0,0.07) 0px 1px 1px, rgba(0,0,0,0.08) 0px 0px 1px` | Popovers, command palette, modals | +| Focus | `rgba(0,0,0,0.1) 0px 4px 12px` + additional layers | Keyboard focus on interactive elements | + +**Shadow Philosophy**: On dark surfaces, traditional shadows (dark on dark) are nearly invisible. Linear solves this by using semi-transparent white borders as the primary depth indicator. Elevation isn't communicated through shadow darkness but through background luminance steps — each level slightly increases the white opacity of the surface background (`0.02` → `0.04` → `0.05`), creating a subtle stacking effect. The inset shadow technique (`rgba(0,0,0,0.2) 0px 0px 12px 0px inset`) creates a unique "sunken" effect for recessed panels, adding dimensional depth that traditional dark themes lack. + +## 7. Do's and Don'ts + +### Do +- Use Inter Variable with `"cv01", "ss03"` on ALL text — these features are fundamental to Linear's typeface identity +- Use weight 510 as your default emphasis weight — it's Linear's signature between-weight +- Apply aggressive negative letter-spacing at display sizes (-1.584px at 72px, -1.056px at 48px) +- Build on near-black backgrounds: `#08090a` for marketing, `#0f1011` for panels, `#191a1b` for elevated surfaces +- Use semi-transparent white borders (`rgba(255,255,255,0.05)` to `rgba(255,255,255,0.08)`) instead of solid dark borders +- Keep button backgrounds nearly transparent: `rgba(255,255,255,0.02)` to `rgba(255,255,255,0.05)` +- Reserve brand indigo (`#5e6ad2` / `#7170ff`) for primary CTAs and interactive accents only +- Use `#f7f8f8` for primary text — not pure `#ffffff`, which would be too harsh +- Apply the luminance stacking model: deeper = darker bg, elevated = slightly lighter bg + +### Don't +- Don't use pure white (`#ffffff`) as primary text — `#f7f8f8` prevents eye strain +- Don't use solid colored backgrounds for buttons — transparency is the system (rgba white at 0.02–0.05) +- Don't apply the brand indigo decoratively — it's reserved for interactive/CTA elements only +- Don't use positive letter-spacing on display text — Inter at large sizes always runs negative +- Don't use visible/opaque borders on dark backgrounds — borders should be whisper-thin semi-transparent white +- Don't skip the OpenType features (`"cv01", "ss03"`) — without them, it's generic Inter, not Linear's Inter +- Don't use weight 700 (bold) — Linear's maximum weight is 590, with 510 as the workhorse +- Don't introduce warm colors into the UI chrome — the palette is cool gray with blue-violet accent only +- Don't use drop shadows for elevation on dark surfaces — use background luminance stepping instead + +## 8. Responsive Behavior + +### Breakpoints +| Name | Width | Key Changes | +|------|-------|-------------| +| Mobile Small | <600px | Single column, compact padding | +| Mobile | 600–640px | Standard mobile layout | +| Tablet | 640–768px | Two-column grids begin | +| Desktop Small | 768–1024px | Full card grids, expanded padding | +| Desktop | 1024–1280px | Standard desktop, full navigation | +| Large Desktop | >1280px | Full layout, generous margins | + +### Touch Targets +- Buttons use comfortable padding with 6px radius minimum +- Navigation links at 13–14px with adequate spacing +- Pill tags have 10px horizontal padding for touch accessibility +- Icon buttons at 50% radius ensure circular, easy-to-tap targets +- Search trigger is prominently placed with generous hit area + +### Collapsing Strategy +- Hero: 72px → 48px → 32px display text, tracking adjusts proportionally +- Navigation: horizontal links + CTAs → hamburger menu at 768px +- Feature cards: 3-column → 2-column → single column stacked +- Product screenshots: maintain aspect ratio, may reduce padding +- Changelog: timeline maintains single-column through all sizes +- Footer: multi-column → stacked single column +- Section spacing: 80px+ → 48px on mobile + +### Image Behavior +- Dashboard screenshots maintain border treatment at all sizes +- Hero visuals simplify on mobile (fewer floating UI elements) +- Product screenshots use responsive sizing with consistent radius +- Dark background ensures screenshots blend naturally at any viewport + +## 9. Agent Prompt Guide + +### Quick Color Reference +- Primary CTA: Brand Indigo (`#5e6ad2`) +- Page Background: Marketing Black (`#08090a`) +- Panel Background: Panel Dark (`#0f1011`) +- Surface: Level 3 (`#191a1b`) +- Heading text: Primary White (`#f7f8f8`) +- Body text: Silver Gray (`#d0d6e0`) +- Muted text: Tertiary Gray (`#8a8f98`) +- Subtle text: Quaternary Gray (`#62666d`) +- Accent: Violet (`#7170ff`) +- Accent Hover: Light Violet (`#828fff`) +- Border (default): `rgba(255,255,255,0.08)` +- Border (subtle): `rgba(255,255,255,0.05)` +- Focus ring: Multi-layer shadow stack + +### Example Component Prompts +- "Create a hero section on `#08090a` background. Headline at 48px Inter Variable weight 510, line-height 1.00, letter-spacing -1.056px, color `#f7f8f8`, font-feature-settings `'cv01', 'ss03'`. Subtitle at 18px weight 400, line-height 1.60, color `#8a8f98`. Brand CTA button (`#5e6ad2`, 6px radius, 8px 16px padding) and ghost button (`rgba(255,255,255,0.02)` bg, `1px solid rgba(255,255,255,0.08)` border, 6px radius)." +- "Design a card on dark background: `rgba(255,255,255,0.02)` background, `1px solid rgba(255,255,255,0.08)` border, 8px radius. Title at 20px Inter Variable weight 590, letter-spacing -0.24px, color `#f7f8f8`. Body at 15px weight 400, color `#8a8f98`, letter-spacing -0.165px." +- "Build a pill badge: transparent background, `#d0d6e0` text, 9999px radius, 0px 10px padding, `1px solid #23252a` border, 12px Inter Variable weight 510." +- "Create navigation: dark sticky header on `#0f1011`. Inter Variable 13px weight 510 for links, `#d0d6e0` text. Brand indigo CTA `#5e6ad2` right-aligned with 6px radius. Bottom border: `1px solid rgba(255,255,255,0.05)`." +- "Design a command palette: `#191a1b` background, `1px solid rgba(255,255,255,0.08)` border, 12px radius, multi-layer shadow stack. Input at 16px Inter Variable weight 400, `#f7f8f8` text. Results list with 13px weight 510 labels in `#d0d6e0` and 12px metadata in `#62666d`." + +### Iteration Guide +1. Always set font-feature-settings `"cv01", "ss03"` on all Inter text — this is non-negotiable for Linear's look +2. Letter-spacing scales with font size: -1.584px at 72px, -1.056px at 48px, -0.704px at 32px, normal below 16px +3. Three weights: 400 (read), 510 (emphasize/navigate), 590 (announce) +4. Surface elevation via background opacity: `rgba(255,255,255, 0.02 → 0.04 → 0.05)` — never solid backgrounds on dark +5. Brand indigo (`#5e6ad2` / `#7170ff`) is the only chromatic color — everything else is grayscale +6. Borders are always semi-transparent white, never solid dark colors on dark backgrounds +7. Berkeley Mono for any code or technical content, Inter Variable for everything else diff --git a/DOCS_INDEX.md b/DOCS_INDEX.md index 07e7bd0..2e0afd7 100644 --- a/DOCS_INDEX.md +++ b/DOCS_INDEX.md @@ -1,6 +1,6 @@ # BlueArchive Toolkit 文档分类索引 -- **更新时间**:2026-09-04 +- **更新时间**:2026-09-13 - **用途**:按用途、时效性和权威级别定位文档。 - **原则**:目录是物理归档方式,不能单独代表文档权威性;当前源码、测试和下列当前文档优先于历史报告。 @@ -16,6 +16,8 @@ - `CHANGELOG.md`:版本变更记录,不作为当前实现的唯一依据。 - `CLAUDE.md`:旧工具兼容入口,不承载独立规则。 - `AGENTS.md`:AI agent 长期协作规则。 +- `TODO.md`:具体工程任务、优先级、依赖与完成条件的仓库内任务账本;不作为当前实现事实来源。 +- `DESIGN.md`:Dashboard 的主要视觉参考与设计灵感来源;涉及 Dashboard/Web UI/布局/视觉/组件/交互任务时必须先阅读。 ## 2. 当前状态、计划与缺口 @@ -25,6 +27,7 @@ - `docs/reports/GO_STATUS.md`:Go `bat-api` 边界和组件进度的权威文档。 - `docs/reports/CURRENT_GAPS.md`:当前缺口、影响和推进顺序。 - `PROJECT_PLAN.md`:目标和路线图;其中的计划项不等于已实现。 +- `TODO.md`:当前可执行工程任务、优先级、依赖与验收条件;条目状态不高于源码、测试和 current-status 文档。 - `docs/reports/BAT_API_CONTRACT_FIXTURE_HANDOFF.md`:Rust 输出、Go contract fixture 和联调的当前交接说明。 ## 3. 架构、决策与稳定契约 @@ -51,6 +54,15 @@ 契约文档涉及字段、状态码、错误码、release layout 或路径语义时,必须与源码测试和 `internal/api/testdata/contract/` 一起复核。 + +### 3.4 Dashboard 设计参考 + +- `DESIGN.md`:用户 Dashboard 与运营 Dashboard 的主要视觉参考和设计灵感来源,描述应延续的色彩关系、排版、空间、边框、层级、组件形态和交互气质。它不定义后端事实、权限或业务状态,也不要求复制参考来源的页面结构或品牌内容。 +- Dashboard 的稳定产品职责、信息边界和设计执行规则见 `AGENTS.md` 的“Dashboard 开发与设计”。用户 Dashboard 与运营 Dashboard 共享基础视觉语言和组件体系,但拥有不同的信息架构、信息密度和权限边界。 +- Dashboard 设计必须以当前真实 API/RPC contract 和数据结构为依据。若所需信息尚无后端 contract,应记录缺口,而不是在前端维护第二份业务状态或伪造指标。 + +发生冲突时遵循:`AGENTS.md` 与稳定产品/接口契约 > 当前明确任务需求 > `DESIGN.md` > Agent 自身设计偏好。 + ## 4. 用户、开发与运维指南 这些文件描述如何使用或验证已经存在的能力: @@ -118,6 +130,8 @@ ## 8. 推荐阅读顺序 +### 8.1 项目与开发者通用阅读顺序 + 1. `README.md` 2. `CURRENT_STATUS.md` 3. `PROJECT_PLAN.md` @@ -133,4 +147,17 @@ 13. `CONTRIBUTING.md` 14. `AGENTS.md` -阅读顺序中的状态和契约结论必须回到当前源码、测试和实际命令验证;历史报告只用于解释演进过程。 +### 8.2 AI / Agent 开发接管顺序 + +Agent 进入仓库进行开发时优先按以下顺序建立上下文: + +1. `AGENTS.md`:先确定长期规则、状态所有权和开发边界; +2. `DOCS_INDEX.md`:确认当前任务应阅读的权威文档; +3. `CURRENT_STATUS.md` 与对应专项状态文档:确认当前已经实现的事实; +4. `TODO.md`:确认当前具体任务、优先级、依赖和完成条件; +5. 当前任务直接相关的源码、tests、稳定 contract 和架构文档; +6. `docs/reports/CURRENT_GAPS.md` / `PROJECT_PLAN.md`:需要判断能力缺口或后续路线时再读取。 + +涉及 Dashboard、Web UI、页面布局、视觉样式、组件或交互体验时,在设计或修改前额外必须阅读 `DESIGN.md`。 + +阅读顺序中的状态和契约结论必须回到当前源码、测试和实际命令验证;`TODO.md`、`CURRENT_GAPS.md` 和 `PROJECT_PLAN.md` 均不能把计划项提升为已实现事实;历史报告只用于解释演进过程。 diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..0c9d2c8 --- /dev/null +++ b/TODO.md @@ -0,0 +1,1117 @@ +# BlueArchiveToolkit TODO Roadmap + +> 基线:`experiment` +> +> 当前已知基线提交:`37d49c9793d25288fd2fcc60b95c1ba55bdf7623` +> +> 工程原则:不以“最小修复”为目标。所有修复与新功能优先考虑长期可维护性、可用性、安全性、明确契约、回归测试和后续扩展成本;避免无关重构,但一旦处理一个问题,应完整收口其工程边界。 + +--- + +## 文件定位与权威边界 + +`TODO.md` 是仓库内的具体工程任务账本,用于记录可执行任务、优先级、依赖关系、验收条件和当前任务状态。它不定义当前实现事实,也不取代状态、架构或稳定契约文档。 + +判断当前实现时遵循 `AGENTS.md` 的权威规则: + +1. 当前源码和 tests; +2. `CURRENT_STATUS.md`; +3. 对应模块的专项 current-status 文档; +4. 已冻结的 RPC、release、schema 等稳定 contract。 + +`docs/reports/CURRENT_GAPS.md` 描述当前能力缺口,`PROJECT_PLAN.md` 描述长期路线,`TODO.md` 负责把需要执行的工作组织成具体任务。若 TODO 条目与当前源码、tests 或权威状态文档冲突,应先核对事实并更新过时条目,不得按照旧 TODO 重新实现已经完成的能力。 + +## 任务维护规则 + +- 开始任务前检查其依赖是否满足,并重新核对相关源码、tests 与 contract;TODO 中的实现建议不能替代对当前代码的确认。 +- 不做只针对当前 testcase 的最小补丁。同一 root cause / contract 内已经确认的问题应在当前工程边界内一起收口。 +- 明显独立的问题新增或更新 TODO,不因“顺手”无限扩大当前任务。 +- 每项任务应尽量保持问题、风险、目标状态、依赖、验收条件和必要非目标完整;需要长期架构决策时写入 ADR 或架构文档,而不是仅留在 TODO。 +- 完成任务后及时同步状态、依赖和验收结果;已经完成的能力不得继续保留为 Active/Ready 待办。 +- 如果任务执行过程中发现原假设不成立,应根据当前事实修订 TODO,而不是机械执行过时方案。 +- `TODO.md` 不记录凭据、Token、密码、个人环境秘密或其他敏感信息。 + +--- + +## 状态约定 + +* `P1`:优先处理,会影响当前生产语义或核心正确性。 +* `P2`:重要工程债务,应在相关功能继续扩展前完成。 +* `Feature`:正式功能开发。 +* `Continuous`:持续验证或长期运行任务。 +* `Hard Blocker`:前置任务完成前,不应开始后续任务。 +* `Recommended Before`:技术上可并行,但建议先完成。 +* `Ready`:依赖已满足,可以开始。 +* `In Progress`:当前正在实施。 +* `Blocked`:存在未满足的 Hard Blocker 或明确外部阻塞。 +* `Planned` / `Later`:已记录但尚未进入近期执行队列。 +* `Done`:目标 contract、验收与必要文档同步均已完成;不能仅因代码已写入就标记完成。 + +--- + +# T01 — bat-api 发布完整性与分发健康契约 + +**类型:** P1 +**状态:** Ready +**优先级:** 最高 + +## 问题 + +当前 Go `bat-api` 的 release readiness 和 CDN 分发主要依赖: + +* manifest entry 是否存在; +* 文件 size 是否匹配。 + +虽然 Rust 已有完整的发布状态、BLAKE3 校验与 release integrity 语义,但 Go 当前并未完整继承这一健康状态。 + +因此可能出现: + +* release 中 B 文件缺失,但 A 文件仍可通过 CDN 返回; +* 文件内容发生同大小损坏,但 Go index 仍认为其 size 正常; +* manifest 中的 BLAKE3 仍可能被用于生成强 ETag,而实际文件内容已发生变化; +* `/readyz` 与实际 CDN 分发行为出现不一致。 + +## 目标状态 + +建立统一的: + +```text +Rust release health + ↓ +Go ReleaseIndex + ↓ +readiness / bootstrap + ↓ +CDN distribution gate +``` + +生产 RPC 模式下,Go 不自行重新实现完整 release verifier,而是消费 Rust 已确认的发布健康事实。 + +完整 release 不健康时: + +* `/readyz` 不应报告 ready; +* bootstrap 不应报告 distributable; +* CDN 不应继续从该 release 分发任意文件。 + +保持现有: + +* GET +* HEAD +* Range +* Content-Length +* ETag +* immutable cache +* single-entry release distribution + +等协议行为。 + +## 验收 + +至少覆盖: + +```text +B 缺失,GET A +→ release 不应继续正常分发 + +B size mismatch,GET A +→ release 不应继续正常分发 + +B 同大小内容损坏,Rust health=false +→ Go refresh 后 ready=false +→ A/B 均不再作为健康 release 分发 + +完整健康 release +→ GET / HEAD / Range / ETag 行为保持 +``` + +## 非目标 + +* 不复制 Rust release verifier 到 Go。 +* 不在每个 CDN GET 时全量重新计算所有文件 hash。 +* 不重新设计 Release/CAS 生命周期。 + +## 依赖 + +无。 + +## 关系 + +**阻塞:** + +* T11 正式长期运行验证 +* Production-ready 判定 + +--- + +# T02 — ResourceRepository 查询契约统一 + +**类型:** P2 +**状态:** Ready + +## 问题 + +当前 ResourceRepository 的 glob contract 与实际实现存在差异。 + +预期: + +```text +* 不跨 / +** 可以跨 / +? 匹配一个字符 +``` + +当前 Rust matcher、SQLite LIKE 转换以及 `list()` / `count()` 的实际过滤语义并不完全一致。 + +可能产生: + +```text +list(query).len() != count(query) +``` + +以及 `/`、Unicode、大小写等边界行为不一致。 + +## 目标状态 + +建立单一、稳定、经过测试的 ResourceQuery pattern contract。 + +要求: + +* Rust 与 SQLite 查询语义一致; +* `list()` 与 `count()` 使用同一过滤逻辑; +* `*` / `**` / `?` 行为明确; +* Unicode 行为明确; +* path separator 行为明确; +* 不依赖模糊的 SQL LIKE 近似语义。 + +## 验收 + +建立针对: + +* `*` +* `**` +* `?` +* `/` +* Unicode +* 空结果 +* count/list equality + +的系统回归测试。 + +## 依赖 + +无。 + +## 关系 + +**Hard Blocker:** + +```text +T02 → T13 +``` + +--- + +# T03 — SQLite Schema Migration 体系化 + +**类型:** P2 +**状态:** Ready + +## 问题 + +当前 Translation Memory、Glossary、Translation Tasks 等 SQLite 数据库的初始化流程存在: + +```text +CREATE / ALTER / ensure_column +↓ +读取 schema_migrations +↓ +检查 future schema +``` + +的问题。 + +旧版本程序可能先修改未来版本数据库,再判断“不支持该 schema”。 + +此外部分 schema 已发生实际变化,但版本号仍未同步提升。 + +## 目标状态 + +建立统一 SQLite schema migration contract: + +```text +读取 schema/version +↓ +future schema → 零修改失败 +↓ +开始 transaction +↓ +按版本执行明确 migration +↓ +更新 schema version +↓ +commit +``` + +所有长期 SQLite 状态统一遵循该规则。 + +至少覆盖: + +* Translation Tasks +* Translation Memory +* Glossary + +## 要求 + +* future schema fail without mutation; +* migration transaction; +* migration idempotency; +* crash/retry 行为明确; +* schema version 与实际结构一致; +* 不再依赖散落的 `ensure_column` 隐式升级。 + +## 依赖 + +无。 + +## 关系 + +**Hard Blocker:** + +```text +T03 → T04 +T03 → T14 +``` + +**Recommended Before:** + +```text +T03 → T15 +T03 → T16 +``` + +--- + +# T04 — Translation Memory Trusted 唯一性与 Supersede 治理 + +**类型:** P2 +**状态:** Blocked by T03 + +## 问题 + +当前 TM 可以对相同: + +```text +raw source ++ exact context +``` + +产生多个不同译文的 `Trusted` entry。 + +worker 会通过排序选择其中一个,行为虽然确定,但没有明确的人工治理语义。 + +## 目标状态 + +对于相同 source + exact context: + +> 同一时间只能存在一个 current Trusted translation。 + +确认一个与现有 Trusted 内容不同的新译文时: + +* 必须显式 supersede; +* 记录 reviewer; +* 记录 reason; +* 更新 provenance; +* 保留历史记录; +* 历史 Trusted 变为 Superseded; +* worker 只自动复用 current Trusted。 + +利用现有: + +```text +supersedes_record_id +superseded_by_record_id +``` + +建立正式治理模型。 + +## 非目标 + +* 不实现 fuzzy TM。 +* 不实现 embedding/vector。 +* 不引入 AI 自动信任。 + +## 依赖 + +**Hard Blocker:T03** + +## 关系 + +```text +T03 → T04 → T14 +``` + +--- + +# T05 — bat.sock 本地 IPC 安全与资源边界 + +**类型:** P2 +**状态:** Ready + +## 目标 + +强化 Unix socket RPC 边界,包括: + +* socket 显式权限; +* state directory 权限契约; +* peer identity / same-user policy; +* RPC request size limit; +* RPC response size limit; +* oversized line/request 拒绝; +* malformed JSON diagnostics; +* connection lifetime 行为; +* 对应测试。 + +## 设计原则 + +`bat.sock` 是同机 IPC,不应为此重新设计网络鉴权体系。 + +优先考虑: + +```text +filesystem permission ++ peer credentials ++ bounded protocol +``` + +而不是额外 token。 + +## 依赖 + +无。 + +## 关系 + +**Recommended Before:** + +```text +T05 → Production-ready +``` + +--- + +# T06 — AssetBundle / ZIP Parser Resource Budget + +**类型:** P2 +**状态:** Ready + +## 问题 + +UnityFS 与 ZIP 解析当前主要依赖文件内部声明的大小。 + +在复杂真实样本继续扩展前,需要先建立资源消耗边界。 + +## 目标 + +建立统一 parser budget,包括但不限于: + +* 最大输入文件大小; +* 最大解压后大小; +* 最大 UnityFS block 数; +* 最大 directory 数; +* 最大 serialized object 数; +* 最大 TypeTree 深度; +* 最大 array/map 元素数; +* 最大 string/blob 长度; +* 最大 ZIP entry 数; +* 单 ZIP entry 最大输出; +* 总解析内存预算。 + +超限时返回结构化错误,而不是 OOM 或异常长时间运行。 + +## 依赖 + +无。 + +## 关系 + +**Hard Blocker:** + +```text +T06 → T09 +``` + +**Recommended Before:** + +```text +T06 → T12 +``` + +--- + +# T07 — Durable Atomic State Write + +**类型:** P2 +**状态:** Ready + +## 问题 + +当前 atomic writer 主要保证: + +```text +temp write +→ flush +→ rename +``` + +能较好处理进程中断,但不能完整保证掉电后的 durable persistence。 + +## 目标 + +为关键状态提供 durable atomic writer: + +```text +write temp +→ flush +→ sync_all(temp) +→ rename +→ sync parent directory +``` + +只用于需要强 durability 的状态。 + +重点包括: + +* version-state; +* publication anchor; +* release transaction journal; +* CAS ownership scope; +* cleanup ownership/progress; +* 其他关键状态机文件。 + +普通日志、cache 等不要求同步升级为强 fsync。 + +## 依赖 + +无。 + +## 关系 + +**Recommended Before:** + +```text +T07 → Production-ready +``` + +--- + +# T08 — CI Gate 与质量门禁整理 + +**类型:** Engineering Baseline +**状态:** Ready + +## 问题 + +当前 `make ci` 存在: + +* format target 会直接修改文件; +* 部分 lint tool 缺失时可能 skip; +* 最终 PASS 文案可能不能完整代表所有建议门禁实际执行。 + +## 目标 + +区分: + +```text +make format +``` + +和: + +```text +make ci-check +``` + +CI 检查必须: + +* read-only; +* 不修改源码; +* 明确报告每项 gate; +* required tool 缺失时不应伪装成全部通过; +* optional gate 明确标记 optional; +* 与实际 Gitea CI 尽量保持一致。 + +建议统一覆盖: + +```text +cargo fmt --all -- --check +cargo check --workspace +cargo clippy --workspace --all-targets -- -D warnings +cargo test --workspace + +go test +go vet +Go lint + +OpenAPI / RPC contract checks +make check-docs +``` + +## 依赖 + +无。 + +## 关系 + +**Recommended Before:** + +```text +T08 → T09 +T08 → T10 +T08 → T12 +T08 → T13 +T08 → T14 +T08 → T15 +T08 → T16 +``` + +T08 不应成为所有开发工作的绝对阻塞点,但应尽早完成。 + +--- + +# T09 — G-005 真实 AssetBundle 样本驱动兼容扩展 + +**类型:** Feature +**状态:** Blocked by T06 + +## 目标 + +以真实 Blue Archive 官方 AssetBundle 样本驱动扩展兼容性。 + +开发方式: + +```text +发现真实未支持结构 +↓ +保存最小可复现 fixture +↓ +解析 +↓ +建立 semantic invariant +↓ +修改 +↓ +rebuild +↓ +reparse +↓ +验证 byte / semantic invariant +``` + +重点覆盖: + +* 更多真实 Unity 2021.3 变体; +* serialized file 结构差异; +* TypeTree 变体; +* managed reference; +* container/map/list/array; +* alignment; +* multiple serialized files; +* block layout; +* compression variants。 + +## 原则 + +不追求“一次实现万能 Unity parser”。 + +只扩展真实样本证明确有需求的结构,但每个新增结构必须完整支持: + +```text +parse +→ inspect +→ modify +→ rebuild +→ verify +``` + +## 依赖 + +**Hard Blocker:T06** + +**Recommended Before:T08** + +## 关系 + +```text +T06 → T09 → T10 +``` + +--- + +# T10 — G-006 复杂 AssetBundle Patch / Rebuild + +**类型:** Feature +**状态:** Blocked by T09 + +## 目标 + +将 T09 已确认可稳定解析和重建的结构纳入 Generic Patch / localized publication。 + +重点: + +* 复杂 TypeTree field patch; +* nested structures; +* managed reference structures; +* map/list/array; +* 多 object 修改; +* 多 serialized file bundle; +* ZIP-inner UnityFS; +* provenance; +* rollback; +* replay verification。 + +## 原则 + +只有 AssetBundle engine 已经验证支持的结构才能进入正式 Patch contract。 + +Patch 层不能自行“猜”未知 Unity 结构。 + +## 依赖 + +**Hard Blocker:T09** + +--- + +# T11 — Official Smoke / 长期运行证据 + +**类型:** Continuous +**状态:** 可立即开始,T01 后数据作为正式证据 + +## 目标 + +长期保存真实官方资源运行证据。 + +不是一次 smoke 即完成,而是跨多个官方更新周期持续执行。 + +建议记录: + +* 时间; +* Git SHA; +* app version; +* bundle version; +* connection group; +* official release ID; +* publication identity; +* manifest entry 数; +* downloaded / resumed / release-reused / CAS-reused 数量; +* transfer bytes; +* verify result; +* repair result; +* daemon/watch 行为; +* elapsed time; +* failure / retry 情况。 + +建议覆盖: + +```text +fresh full pull +→ up-to-date poll +→ daemon/watch +→ official version update +→ historical reuse +→ CAS reuse +→ local corruption +→ verify +→ repair +→ publication +→ bat-api distribution +``` + +## 依赖 + +可立即开始。 + +但: + +**T01 完成后的记录才作为新的正式 distribution-integrity production evidence。** + +## 关系 + +```text +T01 ─────→ T11 正式 evidence +T09/T10 ─→ T11 增加 AssetBundle/Patch 真实验证 +``` + +--- + +# T12 — G-007 独立二进制 Addressables Catalog + +**类型:** Feature +**状态:** Planned + +## 目标 + +扩展当前 JSON/compact Addressables 支持,处理真实官方独立 binary catalog。 + +要求继续保持: + +* official resource discovery contract; +* deterministic parsing; +* fixture tests; +* malformed input handling; +* resource budget; +* 不影响当前已支持 JSON/compact 路径。 + +## 依赖 + +**Recommended Before:** + +* T06 +* T08 + +可与 T09 后半段并行。 + +--- + +# T13 — G-011 ResourceRepository 查询扩展 + +**类型:** Feature +**状态:** Blocked by T02 + +## 目标 + +在稳定查询 contract 上扩展: + +* richer filters; +* pagination; +* sorting; +* inspection; +* corruption reporting; +* recovery support; +* 上层 RPC/API 查询。 + +## 依赖 + +**Hard Blocker:T02** + +--- + +# T14 — G-012 Translation Memory 后续扩展 + +**类型:** Feature +**状态:** Blocked + +## 前置 + +```text +T03 schema migration +↓ +T04 Trusted governance +↓ +T14 +``` + +## 可能范围 + +之后再考虑: + +* fuzzy matching; +* normalized similarity; +* import/export; +* statistics; +* richer query; +* review workflow。 + +Embedding/vector 不应默认进入第一阶段。 + +--- + +# T15 — G-013 Glossary 协作、导入与搜索 + +**类型:** Feature +**状态:** Planned + +## 目标 + +在现有 Glossary V1 基础上逐步增加: + +* bulk import/export; +* richer search; +* conflict review; +* provenance inspection; +* history; +* collaboration-ready APIs。 + +仍保持: + +* Rust owns glossary semantics; +* Go 只做代理; +* Glossary QA 不直接修改翻译文本; +* approved terms 才自动参与; +* ambiguity 输出 diagnostic。 + +## 依赖 + +**Recommended Before:T03** + +--- + +# T16 — G-014 Translation Provider 扩展体系 + +**类型:** Feature +**状态:** Planned + +## 当前基础 + +现有真实 provider: + +* Mock +* Crowdin + +已经存在 Rust `TranslationProvider` trait。 + +## 目标 + +只有出现第二、第三种真实 provider 需求时,再抽象真正稳定的 provider extension contract。 + +应处理: + +* capability declaration; +* structured glossary constraints; +* retry/error classification; +* rate-limit; +* batching; +* provenance; +* provider-neutral result; +* cancellation; +* observability。 + +## 非目标 + +不要为了“插件架构完整”提前制作万能 provider framework。 + +## 依赖 + +**Recommended Before:T03** + +--- + +# T17 — Dashboard 产品化与完整 Web 协作后台 + +**类型:** Feature / Late Stage +**状态:** Later + +## 产品边界 + +BlueArchiveToolkit 的 Web 产品明确区分用户 Dashboard 与运营 Dashboard,两者共享基础视觉语言、Design Token、组件风格和状态语言,但不得混淆信息架构、权限和使用场景。涉及具体视觉、布局、组件或交互设计时遵循 `AGENTS.md` 并先阅读根目录 `DESIGN.md`。 + +用户 Dashboard 面向普通用户,当前核心控制能力仅包括文字汉化与图像汉化的启用/停用,以及与这些操作直接相关的状态、版本、更新反馈和必要异常提示。不得把运营端内部实现直接暴露给用户,也不得通过裁剪运营菜单来生成用户 Dashboard。 + +运营 Dashboard 面向项目运营和维护者,继续承担高信息密度的资源、release、Translation/TM、Provider/worker、task/job、daemon/runtime、CAS、诊断、日志、配置和必要运营操作。其页面应优先回答“系统是否正常、哪里需要处理、最近发生了什么”。 + +所有 Dashboard 必须以真实 API/RPC contract 和真实状态为依据,不得为了视觉完整性伪造后端不存在的数据或在前端维护第二份业务状态。 + +## 前置能力 + +完整协作能力建议至少等: + +```text +T13 Resource query +T14 TM +T15 Glossary +T16 Provider +``` + +达到相对稳定状态。用户 Dashboard 的基础产品壳和共享设计系统可以按真实用户 contract 独立推进,但不得绕过后端能力或提前虚构状态。 + +## 可能范围 + +* 用户 Dashboard 的文字/图像汉化控制与必要状态反馈; +* 运营 Dashboard 的运行观察与运营操作; +* 共享 Design Token 与基础组件体系; +* user / role; +* translation review; +* glossary workflow; +* task assignment; +* conflict handling; +* TM review; +* release observation; +* audit trail; +* collaboration。 + +当前 embedded dashboard 可继续作为运营入口并逐步演进。 + +不要为了 Web 提前迁移 Rust-owned 状态到 Go/PostgreSQL,也不要让前端复制后端状态机。 + +--- + +# T18 — 完整游戏业务 API + +**类型:** Feature / Late Stage +**状态:** Later + +当前 bat-api 明确是: + +```text +resource bootstrap ++ distribution ++ management forwarding +``` + +不是完整 Blue Archive game backend emulator。 + +如未来确实需要完整游戏业务 API,应单独立项。 + +## 前置 + +核心资源与 release 生命周期长期稳定后再开始。 + +--- + +# 依赖关系总图 + +```text + ┌─────────────────────────────┐ + │ T08 CI / Quality Baseline │ + └──────────────┬──────────────┘ + │ Recommended + ┌────────────────────────────┼────────────────────────────┐ + │ │ │ + ▼ ▼ ▼ + +T02 ResourceRepository ──Hard──→ T13 G-011 + +T03 SQLite Migration ──Hard──→ T04 TM Trust ──Hard──→ T14 G-012 + │ + ├────Recommended────→ T15 G-013 + └────Recommended────→ T16 G-014 + + +T06 Parser Budget ──Hard──→ T09 G-005 ──Hard──→ T10 G-006 + │ + └────Recommended──────→ T12 G-007 + + +T01 bat-api Distribution Integrity ───────────→ T11 Official Long-running Evidence + +T05 bat.sock Hardening ─────┐ + ├──────────────→ Production-ready +T07 Durable State Write ────┘ + + +T13 ─────┐ +T14 ─────┤ +T15 ─────┼──────────────→ T17 Full Web Collaboration +T16 ─────┘ + + +Stable Resource / Release / AssetBundle Platform + │ + └────────────────────→ T18 Full Game Business API +``` + +--- + +# 推荐执行队列 + +## In Progress + +建议当前只放: + +```text +T01 — bat-api 发布完整性与分发健康契约 +T08 — CI Gate 与质量门禁整理 +``` + +T01 是当前唯一 P1。 + +T08 可以与其并行,不涉及核心业务状态机。 + +--- + +## Ready + +```text +T02 — ResourceRepository 查询契约统一 +T03 — SQLite Schema Migration 体系化 +T05 — bat.sock 本地 IPC 安全与资源边界 +T06 — AssetBundle / ZIP Parser Resource Budget +T07 — Durable Atomic State Write +T11 — Official Smoke / 长期运行证据 +``` + +T11 可以现在就开始采集,但 T01 后的数据才作为新的正式 distribution integrity evidence。 + +--- + +## Blocked / Planned + +```text +T04 ← T03 + +T09 ← T06 +T10 ← T09 + +T12 ← 推荐 T06/T08 + +T13 ← T02 + +T14 ← T03 + T04 +T15 ← 推荐 T03 +T16 ← 推荐 T03 + +T17 ← T13/T14/T15/T16 +T18 ← 核心平台长期稳定 +``` + +--- + +# 当前明确封板的边界 + +以下内容不建立“继续优化”型 TODO。 + +## Release / CAS V1 + +当前已完成: + +* official/localized 独立 release 生命周期; +* staging / versions / current; +* verified publication phase; +* rollback; +* cleanup plan / plan_id; +* official/localized cleanup locks; +* CAS operation lock; +* refcount; +* durable release ledger; +* ownership ID; +* output-root scope; +* generation-aware ownership; +* legacy basename compatibility protection; +* independent official distribution publication identity; +* single-entry distribution hot path。 + +除非: + +* 真实运行发现问题; +* 新功能暴露新边界; +* 新审计找到具体 defect; + +否则不要继续进行纯粹的 Release/CAS “架构优化”。 + +--- + +# 长期工程原则 + +处理上述任何 TODO 时统一遵守: + +1. 不做只针对当前 testcase 的最小补丁。 +2. 先定义稳定 contract,再实现。 +3. 修复一个边界时同时考虑正常路径、异常路径、并发、重试、恢复和兼容。 +4. 所有状态修改考虑 crash consistency。 +5. 所有外部输入考虑 resource limit。 +6. Rust/Go 状态所有权不得模糊。 +7. 不为了架构美观进行无业务收益的大重构。 +8. 不提前抽象没有真实使用者的通用平台。 +9. 修复必须有 regression tests。 +10. 文档只描述真实实现,计划与现实必须明确区分。 +11. CI 未实际运行的 gate 不得宣称通过。 +12. Production-ready 必须依赖真实长期运行证据,而不是只依赖 unit tests。