732 Commits

Author SHA1 Message Date
Jim Liu 宝玉 6b7a2e4175 更新 baoyu-wechat-summary 技能:调整输出顺序并拆分环境/群记忆参考文件 2026-07-03 20:22:55 -05:00
Jim Liu 宝玉 a4e78af813 Merge branch 'main' of https://github.com/JimLiu/baoyu-skills 2026-07-01 23:41:41 -05:00
Jim Liu 宝玉 1378544ea2 baoyu-wechat-summary v1.118.0: 归因校验、群主查证、memory 强制留痕、机械计数 2026-07-01 21:34:41 -05:00
wangruofeng c9a50cc908 fix(baoyu-post-to-x): 修复紧贴中文的加粗/斜体在 X Articles 渲染为字面 ** 的问题 (#189)
* fix(baoyu-post-to-x): render CJK-adjacent bold/italics in articles

md-to-html.ts preprocessed markdown with remark + remark-cjk-friendly, then re-stringified and re-parsed with marked. remark-cjk-friendly parses emphasis adjacent to CJK correctly, but remark-stringify re-emits the **bold*/*italic* markers, which marked then FAILS to parse: its flanking test does not treat a CJK character after the closing delimiter as valid punctuation/whitespace. Result: literal **...** asterisks leak into the pasted X Article body whenever the closing delimiter is directly followed by a CJK character.

Fix: convert strong/emphasis mdast nodes (already identified correctly by remark-cjk-friendly) into raw inline <strong>/<em> HTML before stringify, so marked passes them through untouched. A small recursive serializer preserves nested links, inline code, images, etc.

- add remarkStrongEmToHtml remark plugin + inline mdast serializer
- add unist-util-visit as an explicit dependency
- add regression test covering CJK-adjacent bold and italics

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(baoyu-post-to-x): 修复紧贴中文的加粗/斜体在 X Articles 渲染为字面 ** 的问题

按维护者建议改用 remark-cjk-friendly 标准用法,替代自定义插件/序列化器:

- 删除 remarkStrongEmToHtml 插件与 serializeMdastNode 序列化器
- preprocessCjkMarkdown 简化为 remarkParse + remarkCjkFriendly + remarkStringify 往返
- 移除原 markdown 阶段的 &#x...; 实体解码(该解码会还原 cjk-friendly 为
  骗过 marked flanking 判定而生成的实体,正是 CJK 加粗失败的根因)
- 改在 marked 渲染出最终 HTML 后再 decodeHtmlEntities,此时 markdown 语法
  已不存在,解码安全且保持输出干净
- 移除不再使用的 unist-util-visit 显式依赖
- 测试补充引用式链接 **[docs][d]** 在强调内的回归断言(顺带修复 Codex
  指出的 linkReference 渲染为纯文本的 P2 问题)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(baoyu-post-to-x): 移除渲染后无差别实体解码,避免篡改作者字面实体

回应 Codex review (P2):decodeHtmlEntities 对整个渲染 HTML 做无差别
&#x...; 解码,会把作者为显示字面 HTML 而写的实体(如 &#x3C;b&#x3E;)
解码成真实标签,存在内容篡改与 HTML 注入风险。

该解码本就只是为了让输出 HTML「好看」,而 remark-cjk-friendly 引入的
实体是合法 HTML 字符引用,粘进 X 编辑器时能正确渲染;且这些实体只会
出现在强调 span 的外侧(边界字符),不会出现在 span 内部。因此直接
移除解码,既消除过度解码风险,又无功能损失。

- 删除 decodeHtmlEntities 及其在 convertMarkdownToHtml 的调用
- 新增测试:作者字面实体 &#x3C;b&#x3E; 不被解码为真实 <b>,CJK 加粗
  仍正常渲染
- bun test 8 个用例全部通过;真实文章端到端验证 17 处加粗、0 字面 **、
  0 真实标签注入

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: ruofeng <ruofeng.wang@rd.group>
Co-authored-by: Claude <noreply@anthropic.com>
2026-06-28 01:42:07 -05:00
Jim Liu 宝玉 348dc82612 Add explicit MIT license 2026-06-19 23:01:55 -05:00
Jim Liu 宝玉 dba3d732c3 Merge pull request #187 from jiji262/fix/gemini3-image-extraction
fix(gemini-web): recover generated images on Gemini 3
2026-06-19 22:45:31 -05:00
jiji262 661bdd08ff fix(gemini-web): recover generated images on Gemini 3
Gemini 3 stopped emitting the legacy `image_generation_content` marker in
the candidate text and moved the generated image into a later response
part. The `wants_generated` gate only checked the candidate text / a single
structured field, so on Gemini 3 it was never true and the image was
silently dropped: generate_content returned an empty result even though the
gg-dl image URL was present in the raw response.

- Broaden `wants_generated` to also fire when the raw response contains a
  `gg-dl/` generated-image URL or an `image_generation_content` marker.
- When a candidate has no image part, skip extraction instead of throwing
  ImageGenerationError, so multi-candidate responses don't fail wholesale.

Verified against a live Gemini 3 account: image generation returns the
generated image again with the default gemini-3-pro model.
2026-06-20 11:37:12 +08:00
Jim Liu 宝玉 f490f7e5e3 chore: release v2.5.2 v2.5.2 2026-06-18 14:14:54 -05:00
Jim Liu 宝玉 22031aa2d2 docs(project): document Codex project-level install and WeChat credential scopes 2026-06-18 14:13:43 -05:00
Jim Liu 宝玉 51b31aa050 fix(baoyu-image-gen): require real image_gen evidence in codex-imagegen
Stop Codex from satisfying a request by copying an unrelated pre-existing
image from generated_images instead of generating a new one. Verification
now requires a PNG in this thread's generated_images dir (or an image_gen
stream item, kept as a forward-compatible signal), and the spawned-agent
instruction forbids reading or reusing history images before image_gen is
called. Removes the findCpToTarget fallback that allowed the shortcut.

Validated against a real codex exec run: image_gen leaves no stream item,
so the filesystem check is the load-bearing signal; locked in via a
condensed real-stream regression fixture.

Closes #185
2026-06-18 14:13:43 -05:00
Jim Liu 宝玉 441ca307a6 chore(release): sync ClawHub skill versions 2026-06-13 00:00:38 -05:00
Jim Liu 宝玉 b0ac5233cc docs(image-generation): document Cursor GenerateImage backend v2.5.1 2026-06-12 23:56:34 -05:00
Jim Liu 宝玉 c1f96f8421 chore: release v2.5.0 v2.5.0 2026-06-12 20:29:18 -05:00
Jim Liu 宝玉 4d2322fd02 feat(baoyu-wechat-summary): add per-group fact memory (memory.md) 2026-06-12 20:28:46 -05:00
Jim Liu 宝玉 154d0d1f52 Merge pull request #179 from sandypoli-boop/fix/windows-bun-mkdir-eexist
fix(baoyu-image-gen): tolerate Bun-on-Windows EEXIST from mkdir(recursive)
2026-06-12 19:45:52 -05:00
sandy 7a956f6e7d fix(baoyu-image-gen): tolerate Bun-on-Windows EEXIST from mkdir(recursive)
On Windows, Bun throws EEXIST for mkdir(dir, { recursive: true }) when the
directory already exists, contradicting Node's documented contract (it should
resolve silently). Image generation then succeeds but the file save fails
whenever the output directory already exists (e.g. the Desktop):

    EEXIST: file already exists, mkdir 'C:\Users\...\Desktop'

Add an ensureDir() helper that tolerates EEXIST only when the path really is a
directory (rethrowing otherwise, so a genuine EEXIST against an existing file
is not swallowed), and route writeImage() and migrateLegacyExtendConfig()
through it. Covered by a cross-platform unit test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 15:13:22 +08:00
Jim Liu 宝玉 55223daf5c Merge pull request #176 from Osamaali313/fix/youtube-embed-url
fix(baoyu-fetch): parse YouTube /embed/ URLs in parseYouTubeVideoId
2026-06-10 17:56:23 -05:00
Syed Osama Ali Shah a1c4b732c5 fix(baoyu-fetch): parse YouTube /embed/ URLs in parseYouTubeVideoId
parseYouTubeVideoId handled watch, youtu.be, /shorts/ and /live/ URLs but
not the common /embed/<id> player form, so embed links returned null and the
YouTube adapter treated them as "no document". Add an /embed/ branch
mirroring the existing /shorts/ and /live/ handling, with a regression test.
2026-06-09 23:55:40 +03:00
Jim Liu 宝玉 894008c7f6 Promote baoyu-design in README skill listings 2026-06-09 01:47:53 -05:00
Jim Liu 宝玉 9daa6f5db3 Merge pull request #174 from Davidlaizz/custom/main
feat(baoyu-image-gen): add Agnes AI image generation provider
2026-06-08 23:32:34 -05:00
Davidlaizz 53aa30bbca fix(baoyu-image-gen): remove gcd from resolveSize to fix decimal aspect ratio distortion 2026-06-06 05:46:38 +08:00
Davidlaizz 3f1120e903 fix(baoyu-image-gen): add agnes to provider_limits YAML whitelist 2026-06-06 05:18:27 +08:00
Davidlaizz 7ea2692acd fix(baoyu-image-gen): add agnes to default_model YAML whitelist and remote ref allowlist 2026-06-06 05:15:26 +08:00
Davidlaizz 591614cfa5 docs(baoyu-image-gen): add Agnes to SKILL.md, README, and config docs 2026-06-06 04:56:19 +08:00
Davidlaizz ad7a7a646d feat(baoyu-image-gen): add Agnes AI image generation provider 2026-06-06 04:53:00 +08:00
Jim Liu 宝玉 ce84174bf7 Merge pull request #173 from yanghaod2278827/improve-skill-descriptions
docs: improve skill description for better trigger accuracy
2026-06-03 12:43:13 -05:00
yanghaod2278827 06e84b92c3 docs: improve skill description for better trigger accuracy 2026-06-03 11:30:52 +08:00
Jim Liu 宝玉 67fa5cd329 docs: add ebook link and fix WeChat config spacing 2026-06-02 17:01:56 -05:00
Jim Liu 宝玉 3907281f48 docs: add book info to Chinese README 2026-06-02 11:01:23 -05:00
Jim Liu 宝玉 011406036c fix: bump baoyu package dependencies v2.4.1 2026-06-01 23:21:05 -05:00
Jim Liu 宝玉 e6f4cd8a46 Merge pull request #171 from NTLx/feat/content-source-url
feat(baoyu-post-to-wechat): add content_source_url support for original article link
2026-05-29 23:01:42 -05:00
Jim Liu 宝玉 a80eec7d75 Merge pull request #170 from hypn4/feat/google-ga-image-models
feat(baoyu-image-gen): migrate Google image generation to GA Gemini endpoints
2026-05-29 23:01:12 -05:00
Jim Liu 宝玉 ec704c8afd chore: release v2.4.0 v2.4.0 2026-05-29 18:59:31 -05:00
Jim Liu 宝玉 a85c81e8db feat(baoyu-wechat-summary): add @bot Q&A section to normal and roast digests 2026-05-29 18:59:26 -05:00
NTLx f06a9021a0 feat(baoyu-post-to-wechat): add content_source_url support for "阅读原文" link
Add the ability to specify the original article URL ("阅读原文" / "Read
Original" link) when publishing to WeChat Official Account draft via API.

Changes:
- ArticleOptions interface: add contentSourceUrl optional field
- publishToDraft: conditionally write content_source_url for news articles
- CLI: add --source-url parameter
- Frontmatter: extract sourceUrl / contentSourceUrl / content_source_url
- Priority chain: CLI --source-url → frontmatter → (none)
- SKILL.md: document the new option and draft/add payload rule

The field is only written for article_type=news per WeChat API spec.
content_source_url is optional (max 1KB) per the official draft/add API.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 13:20:58 +08:00
hypn4 d79ebe4838 feat(baoyu-image-gen): default to GA Gemini image endpoints and sync docs 2026-05-29 12:35:28 +09:00
hypn4 d3d1a9f7cd feat(baoyu-image-gen): allow reference images with GA Gemini image endpoints 2026-05-29 11:44:28 +09:00
Jim Liu 宝玉 77dd193b58 fix: sync npm lockfile 2026-05-27 23:26:46 -05:00
Jim Liu 宝玉 84d817ed52 chore: release v2.3.0 v2.3.0 2026-05-27 23:24:29 -05:00
Jim Liu 宝玉 639e0b4193 feat: support Obsidian wikilink images
Support Obsidian image wikilinks alongside standard markdown images, preserve mixed image order, and resolve Obsidian default Attachments/ paths.

Co-authored-by: Chao Zheng <10296164+zcqqq@users.noreply.github.com>
2026-05-27 23:06:56 -05:00
Jim Liu 宝玉 84cefc2784 fix: harden URL-decoded image paths
Co-authored-by: zcqqq <10296164+zcqqq@users.noreply.github.com>
2026-05-27 21:44:22 -05:00
Chao Zheng 876f01ac19 fix(baoyu-md, baoyu-post-to-x): decode URL-encoded image paths
Obsidian creates markdown image links with URL-encoded filenames
(e.g. `Pasted%20image%2020260524.png`) but the actual file has spaces.
Add `decodeURIComponent()` before path resolution in both baoyu-md's
shared `resolveImagePath()` and baoyu-post-to-x's independent version.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-27 21:43:53 -05:00
Jim Liu 宝玉 e1c0ff7c02 chore: release v2.2.1 v2.2.1 2026-05-26 00:53:56 -05:00
Jim Liu 宝玉 860dd36bb6 docs(baoyu-image-gen): surface build-batch.ts in Usage and clarify {baseDir} script paths
Add the outline.md + prompts/ → batch.json one-liner to SKILL.md's Usage section so the
build-batch helper is discoverable next to --batchfile, and update build-batch.ts --help
to print the bun / npx-y bun invocations with the {baseDir}/scripts/... layout used by
the rest of the skill.
2026-05-26 00:52:51 -05:00
Jim Liu 宝玉 aab0e28823 chore: release v2.2.0 v2.2.0 2026-05-25 00:21:09 -05:00
Jim Liu 宝玉 95cdad2a2a docs(baoyu-article-illustrator,baoyu-comic,baoyu-infographic,baoyu-slide-deck,baoyu-xhs-images): point codex-imagegen flow at baoyu-image-gen --provider codex-cli
Add a `Codex via codex exec` branch to each skill's backend-selection
ladder and ship a per-skill references/codex-imagegen.md with the
invocation contract (preferred baoyu-image-gen --provider codex-cli
path, direct-wrapper fallback, parameter notes, stdout schema, batch
semantics).
2026-05-25 00:18:41 -05:00
Jim Liu 宝玉 8838161729 docs(baoyu-cover-image): redirect codex-imagegen invocation through baoyu-image-gen --provider codex-cli
Replace the long inline `scripts/codex-imagegen.sh` invocation block in
SKILL.md with a pointer to references/codex-imagegen.md. The reference
documents the preferred `baoyu-image-gen --provider codex-cli` path and
keeps the direct-wrapper fallback for runtimes without baoyu-image-gen.
2026-05-25 00:18:32 -05:00
Jim Liu 宝玉 49e9c46ca4 feat(baoyu-image-gen): add codex-cli provider wrapping codex-imagegen
Expose Codex CLI's built-in image_gen tool through baoyu-image-gen's
standard CLI + batch flow as a dedicated provider. The provider spawns
the bundled scripts/codex-imagegen/main.ts (synced from
packages/baoyu-codex-imagegen/src/) so the skill remains self-contained
and inherits retry, cache, file-lock, and JSONL logging. No
OPENAI_API_KEY required — uses the user's Codex subscription.

New env vars: BAOYU_CODEX_IMAGEGEN_{BIN,CACHE_DIR,TIMEOUT_MS,RETRIES,LOG_FILE}.
Hyphenated provider names now resolve under-scored env vars (e.g.,
BAOYU_IMAGE_GEN_CODEX_CLI_CONCURRENCY). codex-cli is never auto-selected
— pin via --provider or default_provider in EXTEND.md.
2026-05-25 00:18:27 -05:00
Jim Liu 宝玉 23fac03691 refactor(codex-imagegen): extract backend to packages/baoyu-codex-imagegen workspace
Move the codex-imagegen wrapper out of scripts/ into its own workspace
package alongside baoyu-md, baoyu-chrome-cdp, and baoyu-fetch. Drop the
bash shim — src/main.ts now carries a `#\!/usr/bin/env bun` shebang and
serves as the sole entrypoint. Add scripts/sync-codex-imagegen.sh so
skills/baoyu-image-gen/scripts/codex-imagegen/ can be regenerated from
packages/baoyu-codex-imagegen/src/ for skill self-containment. Update
CLAUDE.md, docs/codex-imagegen-backend.md, and the CI workflow paths
accordingly.
2026-05-25 00:18:16 -05:00
Jim Liu 宝玉 66160abb9f chore: release v2.1.0 v2.1.0 2026-05-24 21:27:57 -05:00