Repository navigation
feat(shared): add wechat-article-fetch skill package - #43
Draft
2217173240 wants to merge 1 commit into
Draft
2217173240 wants to merge 1 commit into
2217173240 wants to merge 1 commit into
Conversation
聊天记录里常常只有 mp.weixin.qq.com 链接而没有正文,现有的 wechat-article-extract 只能整理附件里已有的内容,明确标注「仅有链接, 未含正文」。新技能补上另一半:用链接抓正文。 - SKILL.md:按官方包体例写输入/步骤/输出/注意;含缺少 Node 时的降级 写法,缺运行时不编造正文,也不让整条流程失败 - scripts/wechat-article.ts:上游 MIT 项目的原样副本(单文件、零依赖、 无需浏览器),随包分发,新的 scripts/README.md 记录来源与同步方式 - catalog.json:新增 wechat-article-fetch@1.0.0 - shared/Skills/README.md:改为三个官方包,说明 scripts/ 的运行时前提 - SkillStore 测试:覆盖带 scripts/ 的包 sync 时整树复制、摘要保持一致, 以及改动脚本会被判为 conflict 而不是静默更新
This branch has not been deployed
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.
这个 PR 做什么
新增一个官方技能包
wechat-article-fetch(公众号正文抓取):拿mp.weixin.qq.com链接把正文、图片和元信息抓下来,整理成 Markdown。为什么
wechat-article-extract的契约是只整理聊天记录里已经存在的内容——链接对应的正文不在附件里时,它按约定标注「仅有链接,无法读取正文」,这是对的,不该改。但这也意味着「聊天记录里只有链接」这个最常见的形态,目前没有任何技能能把正文补上。顺带一个观察,供维护者判断:
USAGE.zh-CN.md:66/USAGE_EN.md:65现在写的是「带上『公众号文章提取』技能,Agent 会先抓取正文再输出摘要」——本 PR 让这句话在「只有链接」的场景下真的能成立。要不要顺手改这两行文档,听你的;本 PR 保持单一主题,没有动文档。改动
shared/Skills/wechat-article-fetch/SKILL.mdshared/Skills/wechat-article-fetch/scripts/wechat-article.tsshared/Skills/wechat-article-fetch/scripts/README.mdshared/Skills/catalog.jsonwechat-article-fetch@1.0.0shared/Skills/README.mdscripts/的运行时前提macos/Tests/WeChatBridgeCoreTests/SkillTests.swifttestSyncCopiesNestedPackageFilesAndKeepsTheDigestStable这也是
shared/Skills里第一个带scripts/的包,所以顺手把这条路径用测试固定下来:syncOfficial必须整树复制(SkillPackage.packageDigest覆盖每个文件,只复制SKILL.md会让状态变成conflict而不是ready),改动脚本要被判为外部修改、不静默覆盖。关于运行时依赖(请重点看这条)
脚本来自 https://github.com/2217173240/wechat-article-scraping-skill(MIT,同一作者),单文件、零 npm 依赖、不需要浏览器,但需要目标机器上有 Node ≥ 22.18(靠 Node 原生 type stripping 直接运行
.ts)。shared/Skills/README.md写明「不会自动安装 Homebrew、pip 等外部依赖」,所以SKILL.md里没有让它去装任何东西:node --version探测;如果你的判断是「官方包不应该要求目标机器上有额外运行时」,这个 PR 可以改成只作为用户 ZIP 导入的技能、不进
catalog.json——我按这个方向改。验证
本地已经做过的:
bash macos/Scripts/check-release-config.sh→ 通过(它用json.tool校验catalog.json,并检查每个package目录都有非空SKILL.md、shared/Skills无符号链接);wechat-article-fetch满足^[a-z0-9]+(-[a-z0-9]+)*$,且目录名 / frontmattername/catalog.json的id三处一致;node shared/Skills/wechat-article-fetch/scripts/wechat-article.ts --help退出码0;对无效链接返回「链接参数错误或已失效」、退出码1,与SKILL.md里写的退出码约定一致;make-app.sh用ditto "$SHARED/Skills"整目录复制,Windows 侧.csproj用shared\Skills\**+%(RecursiveDir)链接,新包的scripts/会自动跟着走。没能本地跑到的:
swift test。开发机只装了 Command Line Tools、没有 Xcode,XCTest模块不可用(no such module 'XCTest'),所以新增的那条测试我这边跑不起来。我做到的是:语法解析通过(swiftc -frontend -parse),并逐个核对了用到的 API 签名和同文件里相邻测试的写法。如果 CI 挂了,我立刻修。Checklist
SKILL.md的name、catalog.json的id一致SKILL.mdscripts/的包的回归测试USAGE/PRODUCT_CAPABILITIES文档,按维护者意见决定