feat: OSS 图片参数化优化 + skill 强制自我更新引导 - #1
Merged
Merged
Conversation
- 新增 ossImage()/ossImageSrcSet(),按渲染宽度+设备像素比拼 OSS x-oss-process (resize/format/quality),与公司其余前端(weapp/event/bff)同一套约定,避免内嵌页 原图直出。scaffold App.tsx 示例与 SKILL.md/cheatsheet 文档同步改用它包 coverUrl/avatarUrl。 - skill/、skill-internal-publish/ 两处 SKILL.md 顶部新增强制自我更新步骤:每次 执行前先确认不是过期副本,不允许跳过。
- ossImage():用 URL/URLSearchParams 重写,非 http(s)(如 data: 内联图)原样返回、 已带 x-oss-process 的 URL 不重复叠加参数。此前实现只做了 !source 判断,JSDoc 承诺的"非 http(s)/已处理不代为处理"完全没实现——data: 头像会被拼坏,重复调用会 产生重复 query key。 - CHANGELOG.md:修正"三处 SKILL.md 与 topic-embed-review"的错误表述,本仓库这次 commit 只改了两处;topic-embed-review 是独立仓库,改动见其自身 commit。 - skill/SKILL.md、skill-internal-publish/SKILL.md 的自我更新引导补充:明确排除 "正在对 topic-sdk 本身开发"场景(否则在 feature 分支上 git pull --ff-only 会直接失败卡死自己);不在 main 分支时不擅自切换/强制同步;纯拷贝覆盖场景收窄 到只覆盖 skill 自身文件,不动创作者项目的 .env/未提交改动;私有仓库场景明确 "如实告知无法确认新鲜度"而非假装拉取成功。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ossImage()/ossImageSrcSet():按渲染宽度 + 设备像素比拼接 OSSx-oss-process(resize/format/quality),与公司其余前端(weapp/event/bff 的getImageLink)同一套约定,避免内嵌页图片原图直出。scaffoldApp.tsx示例、SKILL.md、cheatsheet 已同步改用它包coverUrl/avatarUrl。skill/、skill-internal-publish/两处 SKILL.md 顶部新增强制自我更新步骤:每次执行前先确认本地不是过期副本。Review 修复(Linus 式审查后追加的第二个 commit)
ossImage()原实现只判断!source,JSDoc 承诺的"非 http(s)/已处理不代为处理"完全没做到——data:内联图会被拼坏、重复调用会产生重复x-oss-processquery key。已改用URL/URLSearchParams重写,行为与weapp侧的getImageLink.ts(同样用qs.stringify+url.searchParams.has判重)一致,并做了实测(data:/已处理 URL/相对路径/null 均按预期原样返回或跳过)。CHANGELOG.md此前错误声称"三处 SKILL.md 与 topic-embed-review",本仓库这次 commit 实际只改了两处;已改为准确表述。git pull --ff-only会直接失败卡死自己);不在 main 分支时不擅自切换/强制同步;纯拷贝覆盖收窄到只覆盖 skill 自身文件;私有仓库场景要求如实告知"无法确认新鲜度"。Test plan
pnpm typecheckpnpm build(dist/已同步重建)node -e手测ossImage/ossImageSrcSet:data:URI 原样返回、已带x-oss-process的 URL 去重、相对路径原样返回、null返回null、正常 URL 拼参正确talesofai-weapp/src/utils/getImageLink.ts确认 percent-encoding 行为与既有生产实现一致