Skip to content

重构:内容访问 seam + 4 项架构深化 - #2

Merged
LJMcarryu merged 12 commits into
masterfrom
feat/content-access-seam
Jun 2, 2026
Merged

LJMcarryu merged 12 commits into
masterfrom
feat/content-access-seam

Conversation

@LJMcarryu

Copy link
Copy Markdown
Owner

源自一次架构审查(/improve-codebase-architecture)。审查产出 5 个深化机会,本 PR 全部落地,外加修复过期 e2e、补 ADR 与实现计划。全程 TDD(纯核先行)+ 工作流并行发现 + 对抗式校验。

落地内容

候选 1 · 内容访问 seam(首选)

  • 15 处 queryCollection 直呼 → useBlogPosts/useLearnArticles/useProjects(client 适配)+ rss.xml.ts(server 适配),共享 shared/content/{spec,predicates,apply}.ts 纯核。
  • related/feed 算法(原散在 3 个 [slug] 页)收编为 relatedTo/mergeFeed;500/404 抛错与 cacheKey 收进模块。
  • 两个适配器(页面 + RSS)坐实 seam;纯核 vitest 覆盖,无需 Nuxt 运行时。
  • 设计取舍记于 docs/adr/0001-内容访问与图片解析解耦.md。

候选 2 · 图片解析单一策略

  • 一个 resolveArticleImage:frontmatter(cover/credit/alt) > 本地 Unsplash 表 > picsum。
  • 三个集合 schema 补 cover/credit/creditUrl/alt;修复 projects/[slug] 不认 cover 的缺口;详情页 hero 现带 alt 文本。

候选 3 · 收掉分叉文章页

  • 删除 526 行硬编码的 blog/claude-code-guide.vue(用了设计规范明令禁止的旧 token/渐变/辉光/emoji,且影子路由覆盖了 [slug])。
  • 改为 markdown,由唯一的 [slug].vue 渲染;新增 4 个编辑式 MDC 组件(PlatformTabs/FaqList/StepList/CardGrid)——单一钴蓝强调,无 AI 模板气息。
  • .prettierignore 排除 content/**/*.md(prettier 会破坏 MDC 语法)。

候选 4 · 统一动效能力守卫

  • (pointer:fine) && !reduced-motion 守卫原在 5 处逐字重复 → useMotionAllowed()(基于纯 readMotion)。按报告建议不强行合并 4 个独立 rAF loop(避免过度抽象)。

候选 5 · 导航单一来源

  • header/footer 各写一份的导航路由 → useNavigation()(共享 shared/nav.ts)。

附带

  • 修复过期 e2e:首页 hero 断言对齐暗黑改版文案;移除已删功能的语言切换测试。

验证

  • 单测 27 passed(新增纯核:spec/predicates/apply/nav/motion/image)
  • nuxt typecheck 0 error · eslint 0 problem
  • nuxt build 成功,/rss.xml 预渲染(learn+blog 合并、按日期降序)
  • e2e 9/9(健康 dev server 下)
  • 运行时核对:全部页面类型 200;/blog/claude-code-guide 的 MDC 组件正常渲染、无残留 :: 标记

🤖 Generated with Claude Code

jmliu6 and others added 12 commits June 2, 2026 15:42
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ChainBuilder uses method signatures for bivariant params so
CollectionQueryBuilder<T> is structurally assignable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
8 pages drop raw queryCollection + useAsyncData + 500/404 boilerplate;
related/other lists move behind useRelatedPosts/useRelatedArticles/useOtherProjects.
home featured-learn now consistently ordered date DESC.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hero copy matches the dark-cinematic redesign; drop the language-switch
test (single-locale Chinese site, feature removed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Header and footer iterate one shared { to, label }[] (shared/nav.ts).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
useMotionAllowed() (over pure readMotion) replaces the matchMedia guard
duplicated across lenis/index/TheReel/TheCursor/useScrollReveal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
One resolver (frontmatter cover/credit/alt > local Unsplash table > picsum).
Adds cover/credit/creditUrl/alt to all collection schemas; projects/[slug]
now honors cover (parity with blog/learn); detail heroes carry alt text.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Delete the 526-line hardcoded page (banned legacy tokens/gradients/glow/
emoji) that shadowed the route. The guide is now markdown rendered by the
single [slug].vue adapter, with 4 editorial MDC components (PlatformTabs,
FaqList, StepList, CardGrid) — single cobalt accent, no AI-template tells.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
turing Ready Ready Preview, Comment Jun 2, 2026 8:28am

@LJMcarryu
LJMcarryu merged commit 4b4fb21 into master Jun 2, 2026
4 of 5 checks passed
@LJMcarryu
LJMcarryu deleted the feat/content-access-seam branch June 2, 2026 08:40

This branch was successfully deployed

1 active deployment
Preview — 522072de Deployed Jun 2, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant