mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-07-14 06:39:48 +08:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 41a75584b3 | |||
| 88843b0276 | |||
| 6909c016b2 | |||
| bec1f1e2a1 | |||
| 39a97678bb | |||
| 6cd709b9e7 | |||
| aaf0f188dd | |||
| b6bf8ecd06 | |||
| 7a0ffd9533 | |||
| 69355b4ee1 |
@@ -6,7 +6,7 @@
|
|||||||
},
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"description": "Skills shared by Baoyu for improving daily work efficiency",
|
"description": "Skills shared by Baoyu for improving daily work efficiency",
|
||||||
"version": "1.83.0"
|
"version": "1.87.0"
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"./skills/baoyu-danger-gemini-web",
|
"./skills/baoyu-danger-gemini-web",
|
||||||
"./skills/baoyu-danger-x-to-markdown",
|
"./skills/baoyu-danger-x-to-markdown",
|
||||||
"./skills/baoyu-format-markdown",
|
"./skills/baoyu-format-markdown",
|
||||||
"./skills/baoyu-image-gen",
|
"./skills/baoyu-imagine",
|
||||||
"./skills/baoyu-infographic",
|
"./skills/baoyu-infographic",
|
||||||
"./skills/baoyu-markdown-to-html",
|
"./skills/baoyu-markdown-to-html",
|
||||||
"./skills/baoyu-post-to-weibo",
|
"./skills/baoyu-post-to-weibo",
|
||||||
|
|||||||
@@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
English | [中文](./CHANGELOG.zh.md)
|
English | [中文](./CHANGELOG.zh.md)
|
||||||
|
|
||||||
|
## 1.87.0 - 2026-03-26
|
||||||
|
|
||||||
|
### Maintenance
|
||||||
|
- Remove deprecated `baoyu-image-gen` redirect skill and plugin manifest entry — migration to `baoyu-imagine` is complete
|
||||||
|
|
||||||
|
## 1.86.0 - 2026-03-25
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- `baoyu-translate`: enrich translation prompt with full analysis context — source voice assessment, structured figurative language mapping, comprehension challenge reasoning, structural/creative challenges, and chunk position context for subagents
|
||||||
|
|
||||||
|
## 1.85.0 - 2026-03-25
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- `baoyu-imagine`: auto-migrate legacy `baoyu-image-gen` EXTEND.md config path at runtime
|
||||||
|
- Add `baoyu-image-gen` deprecation redirect skill to guide users to install `baoyu-imagine` and remove the old skill
|
||||||
|
|
||||||
|
## 1.84.0 - 2026-03-25
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- Rename `baoyu-image-gen` skill to `baoyu-imagine` — shorter command name, all references updated across docs, configs, and dependent skills
|
||||||
|
|
||||||
## 1.83.0 - 2026-03-25
|
## 1.83.0 - 2026-03-25
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|||||||
@@ -2,6 +2,27 @@
|
|||||||
|
|
||||||
[English](./CHANGELOG.md) | 中文
|
[English](./CHANGELOG.md) | 中文
|
||||||
|
|
||||||
|
## 1.87.0 - 2026-03-26
|
||||||
|
|
||||||
|
### 维护
|
||||||
|
- 移除已废弃的 `baoyu-image-gen` 重定向技能及插件清单条目 — 向 `baoyu-imagine` 的迁移已完成
|
||||||
|
|
||||||
|
## 1.86.0 - 2026-03-25
|
||||||
|
|
||||||
|
### 新功能
|
||||||
|
- `baoyu-translate`:丰富翻译提示词的分析上下文 — 加入原文语气评估、结构化比喻映射表、理解难点推理、结构性/创造性翻译挑战,以及分块翻译的位置上下文
|
||||||
|
|
||||||
|
## 1.85.0 - 2026-03-25
|
||||||
|
|
||||||
|
### 新功能
|
||||||
|
- `baoyu-imagine`:运行时自动迁移旧版 `baoyu-image-gen` 的 EXTEND.md 配置路径
|
||||||
|
- 新增 `baoyu-image-gen` 废弃重定向技能,引导用户安装 `baoyu-imagine` 并移除旧技能
|
||||||
|
|
||||||
|
## 1.84.0 - 2026-03-25
|
||||||
|
|
||||||
|
### 新功能
|
||||||
|
- 将 `baoyu-image-gen` 技能重命名为 `baoyu-imagine` — 更简短的命令名,所有文档、配置和依赖技能中的引用已同步更新
|
||||||
|
|
||||||
## 1.83.0 - 2026-03-25
|
## 1.83.0 - 2026-03-25
|
||||||
|
|
||||||
### 新功能
|
### 新功能
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# CLAUDE.md
|
# CLAUDE.md
|
||||||
|
|
||||||
Claude Code marketplace plugin providing AI-powered content generation skills. Version: **1.83.0**.
|
Claude Code marketplace plugin providing AI-powered content generation skills. Version: **1.87.0**.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ Execute: `${BUN_X} skills/<skill>/scripts/main.ts [options]`
|
|||||||
|
|
||||||
- **Bun**: TypeScript runtime (`bun` preferred, fallback `npx -y bun`)
|
- **Bun**: TypeScript runtime (`bun` preferred, fallback `npx -y bun`)
|
||||||
- **Chrome**: Required for CDP-based skills (gemini-web, post-to-x/wechat/weibo, url-to-markdown). All CDP skills share a single profile, override via `BAOYU_CHROME_PROFILE_DIR` env var. Platform paths: [docs/chrome-profile.md](docs/chrome-profile.md)
|
- **Chrome**: Required for CDP-based skills (gemini-web, post-to-x/wechat/weibo, url-to-markdown). All CDP skills share a single profile, override via `BAOYU_CHROME_PROFILE_DIR` env var. Platform paths: [docs/chrome-profile.md](docs/chrome-profile.md)
|
||||||
- **Image generation APIs**: `baoyu-image-gen` requires API key (OpenAI, Azure OpenAI, Google, OpenRouter, DashScope, or Replicate) configured in EXTEND.md
|
- **Image generation APIs**: `baoyu-imagine` requires API key (OpenAI, Azure OpenAI, Google, OpenRouter, DashScope, or Replicate) configured in EXTEND.md
|
||||||
- **Gemini Web auth**: Browser cookies (first run opens Chrome for login, `--login` to refresh)
|
- **Gemini Web auth**: Browser cookies (first run opens Chrome for login, `--login` to refresh)
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
@@ -46,7 +46,7 @@ Execute: `${BUN_X} skills/<skill>/scripts/main.ts [options]`
|
|||||||
| Rule | Description |
|
| Rule | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
| **Load project skills first** | Project skills override system/user-level skills with same name |
|
| **Load project skills first** | Project skills override system/user-level skills with same name |
|
||||||
| **Default image generation** | Use `skills/baoyu-image-gen/SKILL.md` unless user specifies otherwise |
|
| **Default image generation** | Use `skills/baoyu-imagine/SKILL.md` unless user specifies otherwise |
|
||||||
|
|
||||||
Priority: project `skills/` → `$HOME/.baoyu-skills/` → system-level.
|
Priority: project `skills/` → `$HOME/.baoyu-skills/` → system-level.
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ This repository now supports publishing each `skills/baoyu-*` directory as an in
|
|||||||
ClawHub installs skills individually, not as one marketplace bundle. After publishing, users can install specific skills such as:
|
ClawHub installs skills individually, not as one marketplace bundle. After publishing, users can install specific skills such as:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
clawhub install baoyu-image-gen
|
clawhub install baoyu-imagine
|
||||||
clawhub install baoyu-markdown-to-html
|
clawhub install baoyu-markdown-to-html
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -661,58 +661,58 @@ Post content to Weibo (微博). Supports regular posts with text, images, and vi
|
|||||||
|
|
||||||
AI-powered generation backends.
|
AI-powered generation backends.
|
||||||
|
|
||||||
#### baoyu-image-gen
|
#### baoyu-imagine
|
||||||
|
|
||||||
AI SDK-based image generation using OpenAI, Azure OpenAI, Google, OpenRouter, DashScope (Aliyun Tongyi Wanxiang), MiniMax, Jimeng (即梦), Seedream (豆包), and Replicate APIs. Supports text-to-image, reference images, aspect ratios, custom sizes, batch generation, and quality presets.
|
AI SDK-based image generation using OpenAI, Azure OpenAI, Google, OpenRouter, DashScope (Aliyun Tongyi Wanxiang), MiniMax, Jimeng (即梦), Seedream (豆包), and Replicate APIs. Supports text-to-image, reference images, aspect ratios, custom sizes, batch generation, and quality presets.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Basic generation (auto-detect provider)
|
# Basic generation (auto-detect provider)
|
||||||
/baoyu-image-gen --prompt "A cute cat" --image cat.png
|
/baoyu-imagine --prompt "A cute cat" --image cat.png
|
||||||
|
|
||||||
# With aspect ratio
|
# With aspect ratio
|
||||||
/baoyu-image-gen --prompt "A landscape" --image landscape.png --ar 16:9
|
/baoyu-imagine --prompt "A landscape" --image landscape.png --ar 16:9
|
||||||
|
|
||||||
# High quality (2k)
|
# High quality (2k)
|
||||||
/baoyu-image-gen --prompt "A banner" --image banner.png --quality 2k
|
/baoyu-imagine --prompt "A banner" --image banner.png --quality 2k
|
||||||
|
|
||||||
# Specific provider
|
# Specific provider
|
||||||
/baoyu-image-gen --prompt "A cat" --image cat.png --provider openai
|
/baoyu-imagine --prompt "A cat" --image cat.png --provider openai
|
||||||
|
|
||||||
# Azure OpenAI (model = deployment name)
|
# Azure OpenAI (model = deployment name)
|
||||||
/baoyu-image-gen --prompt "A cat" --image cat.png --provider azure --model gpt-image-1.5
|
/baoyu-imagine --prompt "A cat" --image cat.png --provider azure --model gpt-image-1.5
|
||||||
|
|
||||||
# OpenRouter
|
# OpenRouter
|
||||||
/baoyu-image-gen --prompt "A cat" --image cat.png --provider openrouter
|
/baoyu-imagine --prompt "A cat" --image cat.png --provider openrouter
|
||||||
|
|
||||||
# OpenRouter with reference images
|
# OpenRouter with reference images
|
||||||
/baoyu-image-gen --prompt "Make it blue" --image out.png --provider openrouter --model google/gemini-3.1-flash-image-preview --ref source.png
|
/baoyu-imagine --prompt "Make it blue" --image out.png --provider openrouter --model google/gemini-3.1-flash-image-preview --ref source.png
|
||||||
|
|
||||||
# DashScope (Aliyun Tongyi Wanxiang)
|
# DashScope (Aliyun Tongyi Wanxiang)
|
||||||
/baoyu-image-gen --prompt "一只可爱的猫" --image cat.png --provider dashscope
|
/baoyu-imagine --prompt "一只可爱的猫" --image cat.png --provider dashscope
|
||||||
|
|
||||||
# DashScope with custom size
|
# DashScope with custom size
|
||||||
/baoyu-image-gen --prompt "为咖啡品牌设计一张 21:9 横幅海报,包含清晰中文标题" --image banner.png --provider dashscope --model qwen-image-2.0-pro --size 2048x872
|
/baoyu-imagine --prompt "为咖啡品牌设计一张 21:9 横幅海报,包含清晰中文标题" --image banner.png --provider dashscope --model qwen-image-2.0-pro --size 2048x872
|
||||||
|
|
||||||
# MiniMax
|
# MiniMax
|
||||||
/baoyu-image-gen --prompt "A fashion editorial portrait by a bright studio window" --image out.jpg --provider minimax
|
/baoyu-imagine --prompt "A fashion editorial portrait by a bright studio window" --image out.jpg --provider minimax
|
||||||
|
|
||||||
# MiniMax with subject reference
|
# MiniMax with subject reference
|
||||||
/baoyu-image-gen --prompt "A girl stands by the library window, cinematic lighting" --image out.jpg --provider minimax --model image-01 --ref portrait.png --ar 16:9
|
/baoyu-imagine --prompt "A girl stands by the library window, cinematic lighting" --image out.jpg --provider minimax --model image-01 --ref portrait.png --ar 16:9
|
||||||
|
|
||||||
# Replicate
|
# Replicate
|
||||||
/baoyu-image-gen --prompt "A cat" --image cat.png --provider replicate
|
/baoyu-imagine --prompt "A cat" --image cat.png --provider replicate
|
||||||
|
|
||||||
# Jimeng (即梦)
|
# Jimeng (即梦)
|
||||||
/baoyu-image-gen --prompt "一只可爱的猫" --image cat.png --provider jimeng
|
/baoyu-imagine --prompt "一只可爱的猫" --image cat.png --provider jimeng
|
||||||
|
|
||||||
# Seedream (豆包)
|
# Seedream (豆包)
|
||||||
/baoyu-image-gen --prompt "一只可爱的猫" --image cat.png --provider seedream
|
/baoyu-imagine --prompt "一只可爱的猫" --image cat.png --provider seedream
|
||||||
|
|
||||||
# With reference images (Google, OpenAI, Azure OpenAI, OpenRouter, Replicate, MiniMax, or Seedream 5.0/4.5/4.0)
|
# With reference images (Google, OpenAI, Azure OpenAI, OpenRouter, Replicate, MiniMax, or Seedream 5.0/4.5/4.0)
|
||||||
/baoyu-image-gen --prompt "Make it blue" --image out.png --ref source.png
|
/baoyu-imagine --prompt "Make it blue" --image out.png --ref source.png
|
||||||
|
|
||||||
# Batch mode
|
# Batch mode
|
||||||
/baoyu-image-gen --batchfile batch.json --jobs 4 --json
|
/baoyu-imagine --batchfile batch.json --jobs 4 --json
|
||||||
```
|
```
|
||||||
|
|
||||||
**Options**:
|
**Options**:
|
||||||
@@ -1045,7 +1045,7 @@ Custom style descriptions are also accepted, e.g., `--style "poetic and lyrical"
|
|||||||
Some skills require API keys or custom configuration. Environment variables can be set in `.env` files:
|
Some skills require API keys or custom configuration. Environment variables can be set in `.env` files:
|
||||||
|
|
||||||
**Load Priority** (higher priority overrides lower):
|
**Load Priority** (higher priority overrides lower):
|
||||||
1. CLI environment variables (e.g., `OPENAI_API_KEY=xxx /baoyu-image-gen ...`)
|
1. CLI environment variables (e.g., `OPENAI_API_KEY=xxx /baoyu-imagine ...`)
|
||||||
2. `process.env` (system environment)
|
2. `process.env` (system environment)
|
||||||
3. `<cwd>/.baoyu-skills/.env` (project-level)
|
3. `<cwd>/.baoyu-skills/.env` (project-level)
|
||||||
4. `~/.baoyu-skills/.env` (user-level)
|
4. `~/.baoyu-skills/.env` (user-level)
|
||||||
|
|||||||
+19
-19
@@ -32,7 +32,7 @@ npx skills add jimliu/baoyu-skills
|
|||||||
ClawHub 按“单个 skill”安装,不是把整个 marketplace 一次性装进去。发布后,用户可以按需安装:
|
ClawHub 按“单个 skill”安装,不是把整个 marketplace 一次性装进去。发布后,用户可以按需安装:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
clawhub install baoyu-image-gen
|
clawhub install baoyu-imagine
|
||||||
clawhub install baoyu-markdown-to-html
|
clawhub install baoyu-markdown-to-html
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -661,58 +661,58 @@ accounts:
|
|||||||
|
|
||||||
AI 驱动的生成后端。
|
AI 驱动的生成后端。
|
||||||
|
|
||||||
#### baoyu-image-gen
|
#### baoyu-imagine
|
||||||
|
|
||||||
基于 AI SDK 的图像生成,支持 OpenAI、Azure OpenAI、Google、OpenRouter、DashScope(阿里通义万相)、MiniMax、即梦(Jimeng)、豆包(Seedream)和 Replicate API。支持文生图、参考图、宽高比、自定义尺寸、批量生成和质量预设。
|
基于 AI SDK 的图像生成,支持 OpenAI、Azure OpenAI、Google、OpenRouter、DashScope(阿里通义万相)、MiniMax、即梦(Jimeng)、豆包(Seedream)和 Replicate API。支持文生图、参考图、宽高比、自定义尺寸、批量生成和质量预设。
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 基础生成(自动检测服务商)
|
# 基础生成(自动检测服务商)
|
||||||
/baoyu-image-gen --prompt "一只可爱的猫" --image cat.png
|
/baoyu-imagine --prompt "一只可爱的猫" --image cat.png
|
||||||
|
|
||||||
# 指定宽高比
|
# 指定宽高比
|
||||||
/baoyu-image-gen --prompt "风景图" --image landscape.png --ar 16:9
|
/baoyu-imagine --prompt "风景图" --image landscape.png --ar 16:9
|
||||||
|
|
||||||
# 高质量(2k 分辨率)
|
# 高质量(2k 分辨率)
|
||||||
/baoyu-image-gen --prompt "横幅图" --image banner.png --quality 2k
|
/baoyu-imagine --prompt "横幅图" --image banner.png --quality 2k
|
||||||
|
|
||||||
# 指定服务商
|
# 指定服务商
|
||||||
/baoyu-image-gen --prompt "一只猫" --image cat.png --provider openai
|
/baoyu-imagine --prompt "一只猫" --image cat.png --provider openai
|
||||||
|
|
||||||
# Azure OpenAI(model 为部署名称)
|
# Azure OpenAI(model 为部署名称)
|
||||||
/baoyu-image-gen --prompt "一只猫" --image cat.png --provider azure --model gpt-image-1.5
|
/baoyu-imagine --prompt "一只猫" --image cat.png --provider azure --model gpt-image-1.5
|
||||||
|
|
||||||
# OpenRouter
|
# OpenRouter
|
||||||
/baoyu-image-gen --prompt "一只猫" --image cat.png --provider openrouter
|
/baoyu-imagine --prompt "一只猫" --image cat.png --provider openrouter
|
||||||
|
|
||||||
# OpenRouter + 参考图
|
# OpenRouter + 参考图
|
||||||
/baoyu-image-gen --prompt "把它变成蓝色" --image out.png --provider openrouter --model google/gemini-3.1-flash-image-preview --ref source.png
|
/baoyu-imagine --prompt "把它变成蓝色" --image out.png --provider openrouter --model google/gemini-3.1-flash-image-preview --ref source.png
|
||||||
|
|
||||||
# DashScope(阿里通义万相)
|
# DashScope(阿里通义万相)
|
||||||
/baoyu-image-gen --prompt "一只可爱的猫" --image cat.png --provider dashscope
|
/baoyu-imagine --prompt "一只可爱的猫" --image cat.png --provider dashscope
|
||||||
|
|
||||||
# DashScope 自定义尺寸
|
# DashScope 自定义尺寸
|
||||||
/baoyu-image-gen --prompt "为咖啡品牌设计一张 21:9 横幅海报,包含清晰中文标题" --image banner.png --provider dashscope --model qwen-image-2.0-pro --size 2048x872
|
/baoyu-imagine --prompt "为咖啡品牌设计一张 21:9 横幅海报,包含清晰中文标题" --image banner.png --provider dashscope --model qwen-image-2.0-pro --size 2048x872
|
||||||
|
|
||||||
# MiniMax
|
# MiniMax
|
||||||
/baoyu-image-gen --prompt "A fashion editorial portrait by a bright studio window" --image out.jpg --provider minimax
|
/baoyu-imagine --prompt "A fashion editorial portrait by a bright studio window" --image out.jpg --provider minimax
|
||||||
|
|
||||||
# MiniMax + 角色参考图
|
# MiniMax + 角色参考图
|
||||||
/baoyu-image-gen --prompt "A girl stands by the library window, cinematic lighting" --image out.jpg --provider minimax --model image-01 --ref portrait.png --ar 16:9
|
/baoyu-imagine --prompt "A girl stands by the library window, cinematic lighting" --image out.jpg --provider minimax --model image-01 --ref portrait.png --ar 16:9
|
||||||
|
|
||||||
# Replicate
|
# Replicate
|
||||||
/baoyu-image-gen --prompt "一只猫" --image cat.png --provider replicate
|
/baoyu-imagine --prompt "一只猫" --image cat.png --provider replicate
|
||||||
|
|
||||||
# 即梦(Jimeng)
|
# 即梦(Jimeng)
|
||||||
/baoyu-image-gen --prompt "一只可爱的猫" --image cat.png --provider jimeng
|
/baoyu-imagine --prompt "一只可爱的猫" --image cat.png --provider jimeng
|
||||||
|
|
||||||
# 豆包(Seedream)
|
# 豆包(Seedream)
|
||||||
/baoyu-image-gen --prompt "一只可爱的猫" --image cat.png --provider seedream
|
/baoyu-imagine --prompt "一只可爱的猫" --image cat.png --provider seedream
|
||||||
|
|
||||||
# 带参考图(Google、OpenAI、Azure OpenAI、OpenRouter、Replicate、MiniMax 或 Seedream 5.0/4.5/4.0)
|
# 带参考图(Google、OpenAI、Azure OpenAI、OpenRouter、Replicate、MiniMax 或 Seedream 5.0/4.5/4.0)
|
||||||
/baoyu-image-gen --prompt "把它变成蓝色" --image out.png --ref source.png
|
/baoyu-imagine --prompt "把它变成蓝色" --image out.png --ref source.png
|
||||||
|
|
||||||
# 批量模式
|
# 批量模式
|
||||||
/baoyu-image-gen --batchfile batch.json --jobs 4 --json
|
/baoyu-imagine --batchfile batch.json --jobs 4 --json
|
||||||
```
|
```
|
||||||
|
|
||||||
**选项**:
|
**选项**:
|
||||||
@@ -1045,7 +1045,7 @@ AI 驱动的生成后端。
|
|||||||
部分技能需要 API 密钥或自定义配置。环境变量可以在 `.env` 文件中设置:
|
部分技能需要 API 密钥或自定义配置。环境变量可以在 `.env` 文件中设置:
|
||||||
|
|
||||||
**加载优先级**(高优先级覆盖低优先级):
|
**加载优先级**(高优先级覆盖低优先级):
|
||||||
1. 命令行环境变量(如 `OPENAI_API_KEY=xxx /baoyu-image-gen ...`)
|
1. 命令行环境变量(如 `OPENAI_API_KEY=xxx /baoyu-imagine ...`)
|
||||||
2. `process.env`(系统环境变量)
|
2. `process.env`(系统环境变量)
|
||||||
3. `<cwd>/.baoyu-skills/.env`(项目级)
|
3. `<cwd>/.baoyu-skills/.env`(项目级)
|
||||||
4. `~/.baoyu-skills/.env`(用户级)
|
4. `~/.baoyu-skills/.env`(用户级)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Skills that require image generation MUST delegate to available image generation
|
|||||||
|
|
||||||
## Skill Selection
|
## Skill Selection
|
||||||
|
|
||||||
**Default**: `skills/baoyu-image-gen/SKILL.md` (unless user specifies otherwise).
|
**Default**: `skills/baoyu-imagine/SKILL.md` (unless user specifies otherwise).
|
||||||
|
|
||||||
1. Read skill's SKILL.md for parameters and capabilities
|
1. Read skill's SKILL.md for parameters and capabilities
|
||||||
2. If user requests different skill, check `skills/` for alternatives
|
2. If user requests different skill, check `skills/` for alternatives
|
||||||
@@ -16,7 +16,7 @@ Skills that require image generation MUST delegate to available image generation
|
|||||||
### Step N: Generate Images
|
### Step N: Generate Images
|
||||||
|
|
||||||
**Skill Selection**:
|
**Skill Selection**:
|
||||||
1. Check available skills (`baoyu-image-gen` default, or `baoyu-danger-gemini-web`)
|
1. Check available skills (`baoyu-imagine` default, or `baoyu-danger-gemini-web`)
|
||||||
2. Read selected skill's SKILL.md for parameters
|
2. Read selected skill's SKILL.md for parameters
|
||||||
3. If multiple skills available, ask user to choose
|
3. If multiple skills available, ask user to choose
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ Skills that require image generation MUST delegate to available image generation
|
|||||||
4. On failure, auto-retry once before reporting error
|
4. On failure, auto-retry once before reporting error
|
||||||
```
|
```
|
||||||
|
|
||||||
**Batch Parallel** (`baoyu-image-gen` only): concurrent workers with per-provider throttling via `batch.max_workers` in EXTEND.md.
|
**Batch Parallel** (`baoyu-imagine` only): concurrent workers with per-provider throttling via `batch.max_workers` in EXTEND.md.
|
||||||
|
|
||||||
## Output Path Convention
|
## Output Path Convention
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ Full template: [references/workflow.md](references/workflow.md#step-4-generate-o
|
|||||||
|
|
||||||
⛔ **BLOCKING: Prompt files MUST be saved before ANY image generation.**
|
⛔ **BLOCKING: Prompt files MUST be saved before ANY image generation.**
|
||||||
|
|
||||||
**Execution strategy**: When multiple illustrations have saved prompt files and the task is now plain generation, prefer `baoyu-image-gen` batch mode (`build-batch.ts` → `--batchfile`) over spawning subagents. Use subagents only when each image still needs separate prompt iteration or creative exploration.
|
**Execution strategy**: When multiple illustrations have saved prompt files and the task is now plain generation, prefer `baoyu-imagine` batch mode (`build-batch.ts` → `--batchfile`) over spawning subagents. Use subagents only when each image still needs separate prompt iteration or creative exploration.
|
||||||
|
|
||||||
1. For each illustration, create a prompt file per [references/prompt-construction.md](references/prompt-construction.md)
|
1. For each illustration, create a prompt file per [references/prompt-construction.md](references/prompt-construction.md)
|
||||||
2. Save to `prompts/NN-{type}-{slug}.md` with YAML frontmatter
|
2. Save to `prompts/NN-{type}-{slug}.md` with YAML frontmatter
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ Prompt Files:
|
|||||||
**DO NOT** pass ad-hoc inline text to `--prompt` without first saving prompt files. The generation command should either use `--promptfiles prompts/NN-{type}-{slug}.md` or read the saved file content for `--prompt`.
|
**DO NOT** pass ad-hoc inline text to `--prompt` without first saving prompt files. The generation command should either use `--promptfiles prompts/NN-{type}-{slug}.md` or read the saved file content for `--prompt`.
|
||||||
|
|
||||||
**Execution choice**:
|
**Execution choice**:
|
||||||
- If multiple illustrations already have saved prompt files and the task is now plain generation, prefer `baoyu-image-gen` batch mode (`build-batch.ts` -> `main.ts --batchfile`)
|
- If multiple illustrations already have saved prompt files and the task is now plain generation, prefer `baoyu-imagine` batch mode (`build-batch.ts` -> `main.ts --batchfile`)
|
||||||
- Use subagents only when each illustration still needs separate prompt rewriting, style exploration, or other per-image reasoning before generation
|
- Use subagents only when each illustration still needs separate prompt rewriting, style exploration, or other per-image reasoning before generation
|
||||||
|
|
||||||
**CRITICAL - References in Frontmatter**:
|
**CRITICAL - References in Frontmatter**:
|
||||||
@@ -352,7 +352,7 @@ Check available skills. If multiple, ask user.
|
|||||||
|
|
||||||
| Skill Supports `--ref` | Action |
|
| Skill Supports `--ref` | Action |
|
||||||
|------------------------|--------|
|
|------------------------|--------|
|
||||||
| Yes (e.g., baoyu-image-gen with Google) | Pass reference images via `--ref` |
|
| Yes (e.g., baoyu-imagine with Google) | Pass reference images via `--ref` |
|
||||||
| No | Convert to text description, append to prompt |
|
| No | Convert to text description, append to prompt |
|
||||||
|
|
||||||
**Verification**: Before generating, confirm reference processing:
|
**Verification**: Before generating, confirm reference processing:
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ Options:
|
|||||||
--prompts <path> Path to prompts directory
|
--prompts <path> Path to prompts directory
|
||||||
--output <path> Path to output batch.json
|
--output <path> Path to output batch.json
|
||||||
--images-dir <path> Directory for generated images
|
--images-dir <path> Directory for generated images
|
||||||
--provider <name> Provider for baoyu-image-gen batch tasks (default: replicate)
|
--provider <name> Provider for baoyu-imagine batch tasks (default: replicate)
|
||||||
--model <id> Model for baoyu-image-gen batch tasks (default: google/nano-banana-pro)
|
--model <id> Model for baoyu-imagine batch tasks (default: google/nano-banana-pro)
|
||||||
--ar <ratio> Aspect ratio for all tasks (default: 16:9)
|
--ar <ratio> Aspect ratio for all tasks (default: 16:9)
|
||||||
--quality <level> Quality for all tasks (default: 2k)
|
--quality <level> Quality for all tasks (default: 2k)
|
||||||
--jobs <count> Recommended worker count metadata (optional)
|
--jobs <count> Recommended worker count metadata (optional)
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ Analyze → [Check Existing?] → [Confirm: Style + Reviews] → Storyboard →
|
|||||||
|
|
||||||
**7.1 Generate character sheet first**:
|
**7.1 Generate character sheet first**:
|
||||||
- **Backup rule**: If `characters/characters.png` exists, rename to `characters/characters-backup-YYYYMMDD-HHMMSS.png`
|
- **Backup rule**: If `characters/characters.png` exists, rename to `characters/characters-backup-YYYYMMDD-HHMMSS.png`
|
||||||
- Invoke an installed image generation skill such as `baoyu-image-gen`
|
- Invoke an installed image generation skill such as `baoyu-imagine`
|
||||||
- Read that skill's `SKILL.md` and follow its documented interface rather than calling its scripts directly
|
- Read that skill's `SKILL.md` and follow its documented interface rather than calling its scripts directly
|
||||||
- Use `characters/characters.md` as the prompt-file input
|
- Use `characters/characters.md` as the prompt-file input
|
||||||
- Save output to `characters/characters.png`
|
- Save output to `characters/characters.png`
|
||||||
|
|||||||
@@ -433,7 +433,7 @@ With confirmed prompts from Step 5/6:
|
|||||||
| Supports `--ref` | **Strategy A** | Pass `characters/characters.png` with EVERY page |
|
| Supports `--ref` | **Strategy A** | Pass `characters/characters.png` with EVERY page |
|
||||||
| Does NOT support `--ref` | **Strategy B** | Prepend character descriptions to EVERY prompt |
|
| Does NOT support `--ref` | **Strategy B** | Prepend character descriptions to EVERY prompt |
|
||||||
|
|
||||||
**Strategy A: Using `--ref` parameter** (e.g., baoyu-image-gen)
|
**Strategy A: Using `--ref` parameter** (e.g., baoyu-imagine)
|
||||||
|
|
||||||
- Read the chosen image generation skill's `SKILL.md`
|
- Read the chosen image generation skill's `SKILL.md`
|
||||||
- Invoke that installed skill via its documented interface, not by calling its scripts directly
|
- Invoke that installed skill via its documented interface, not by calling its scripts directly
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
name: baoyu-image-gen
|
name: baoyu-imagine
|
||||||
description: AI image generation with OpenAI, Azure OpenAI, Google, OpenRouter, DashScope, MiniMax, Jimeng, Seedream and Replicate APIs. Supports text-to-image, reference images, aspect ratios, and batch generation from saved prompt files. Sequential by default; use batch parallel generation when the user already has multiple prompts or wants stable multi-image throughput. Use when user asks to generate, create, or draw images.
|
description: AI image generation with OpenAI, Azure OpenAI, Google, OpenRouter, DashScope, MiniMax, Jimeng, Seedream and Replicate APIs. Supports text-to-image, reference images, aspect ratios, and batch generation from saved prompt files. Sequential by default; use batch parallel generation when the user already has multiple prompts or wants stable multi-image throughput. Use when user asks to generate, create, or draw images.
|
||||||
version: 1.56.4
|
version: 1.56.4
|
||||||
metadata:
|
metadata:
|
||||||
openclaw:
|
openclaw:
|
||||||
homepage: https://github.com/JimLiu/baoyu-skills#baoyu-image-gen
|
homepage: https://github.com/JimLiu/baoyu-skills#baoyu-imagine
|
||||||
requires:
|
requires:
|
||||||
anyBins:
|
anyBins:
|
||||||
- bun
|
- bun
|
||||||
@@ -30,17 +30,17 @@ Check EXTEND.md existence (priority: project → user):
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS, Linux, WSL, Git Bash
|
# macOS, Linux, WSL, Git Bash
|
||||||
test -f .baoyu-skills/baoyu-image-gen/EXTEND.md && echo "project"
|
test -f .baoyu-skills/baoyu-imagine/EXTEND.md && echo "project"
|
||||||
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-image-gen/EXTEND.md" && echo "xdg"
|
test -f "${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-imagine/EXTEND.md" && echo "xdg"
|
||||||
test -f "$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md" && echo "user"
|
test -f "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md" && echo "user"
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# PowerShell (Windows)
|
# PowerShell (Windows)
|
||||||
if (Test-Path .baoyu-skills/baoyu-image-gen/EXTEND.md) { "project" }
|
if (Test-Path .baoyu-skills/baoyu-imagine/EXTEND.md) { "project" }
|
||||||
$xdg = if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { "$HOME/.config" }
|
$xdg = if ($env:XDG_CONFIG_HOME) { $env:XDG_CONFIG_HOME } else { "$HOME/.config" }
|
||||||
if (Test-Path "$xdg/baoyu-skills/baoyu-image-gen/EXTEND.md") { "xdg" }
|
if (Test-Path "$xdg/baoyu-skills/baoyu-imagine/EXTEND.md") { "xdg" }
|
||||||
if (Test-Path "$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md") { "user" }
|
if (Test-Path "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md") { "user" }
|
||||||
```
|
```
|
||||||
|
|
||||||
| Result | Action |
|
| Result | Action |
|
||||||
@@ -52,8 +52,10 @@ if (Test-Path "$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md") { "user" }
|
|||||||
|
|
||||||
| Path | Location |
|
| Path | Location |
|
||||||
|------|----------|
|
|------|----------|
|
||||||
| `.baoyu-skills/baoyu-image-gen/EXTEND.md` | Project directory |
|
| `.baoyu-skills/baoyu-imagine/EXTEND.md` | Project directory |
|
||||||
| `$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md` | User home |
|
| `$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md` | User home |
|
||||||
|
|
||||||
|
Legacy compatibility: if `.baoyu-skills/baoyu-image-gen/EXTEND.md` exists and the new path does not, runtime renames it to `baoyu-imagine`. If both files exist, runtime leaves them unchanged and uses the new path.
|
||||||
|
|
||||||
**EXTEND.md Supports**: Default provider | Default quality | Default aspect ratio | Default image size | Default models | Batch worker cap | Provider-specific batch limits
|
**EXTEND.md Supports**: Default provider | Default quality | Default aspect ratio | Default image size | Default models | Batch worker cap | Provider-specific batch limits
|
||||||
|
|
||||||
@@ -252,7 +254,7 @@ When translating CLI args into DashScope behavior:
|
|||||||
- `--size` wins over `--ar`
|
- `--size` wins over `--ar`
|
||||||
- For `qwen-image-2.0*`, prefer explicit `--size`; otherwise infer from `--ar` and use the official recommended resolutions below
|
- For `qwen-image-2.0*`, prefer explicit `--size`; otherwise infer from `--ar` and use the official recommended resolutions below
|
||||||
- For `qwen-image-max/plus/image`, only use the five official fixed sizes; if the requested ratio is not covered, switch to `qwen-image-2.0-pro`
|
- For `qwen-image-max/plus/image`, only use the five official fixed sizes; if the requested ratio is not covered, switch to `qwen-image-2.0-pro`
|
||||||
- `--quality` is a baoyu-image-gen compatibility preset, not a native DashScope API field. Mapping `normal` / `2k` onto the `qwen-image-2.0*` table below is an implementation inference, not an official API guarantee
|
- `--quality` is a baoyu-imagine compatibility preset, not a native DashScope API field. Mapping `normal` / `2k` onto the `qwen-image-2.0*` table below is an implementation inference, not an official API guarantee
|
||||||
|
|
||||||
Recommended `qwen-image-2.0*` sizes for common aspect ratios:
|
Recommended `qwen-image-2.0*` sizes for common aspect ratios:
|
||||||
|
|
||||||
@@ -267,7 +269,7 @@ Recommended `qwen-image-2.0*` sizes for common aspect ratios:
|
|||||||
| `16:9` | `1280*720` | `1920*1080` |
|
| `16:9` | `1280*720` | `1920*1080` |
|
||||||
| `21:9` | `1344*576` | `2048*872` |
|
| `21:9` | `1344*576` | `2048*872` |
|
||||||
|
|
||||||
DashScope official APIs also expose `negative_prompt`, `prompt_extend`, and `watermark`, but `baoyu-image-gen` does not expose them as dedicated CLI flags today.
|
DashScope official APIs also expose `negative_prompt`, `prompt_extend`, and `watermark`, but `baoyu-imagine` does not expose them as dedicated CLI flags today.
|
||||||
|
|
||||||
Official references:
|
Official references:
|
||||||
|
|
||||||
@@ -294,7 +296,7 @@ MiniMax subject reference notes:
|
|||||||
|
|
||||||
- `--ref` files are sent as MiniMax `subject_reference`
|
- `--ref` files are sent as MiniMax `subject_reference`
|
||||||
- MiniMax docs currently describe `subject_reference[].type` as `character`
|
- MiniMax docs currently describe `subject_reference[].type` as `character`
|
||||||
- Official docs say `image_file` supports public URLs or Base64 Data URLs; `baoyu-image-gen` sends local refs as Data URLs
|
- Official docs say `image_file` supports public URLs or Base64 Data URLs; `baoyu-imagine` sends local refs as Data URLs
|
||||||
- Official docs recommend front-facing portrait references in JPG/JPEG/PNG under 10MB
|
- Official docs recommend front-facing portrait references in JPG/JPEG/PNG under 10MB
|
||||||
|
|
||||||
Official references:
|
Official references:
|
||||||
+5
-5
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: first-time-setup
|
name: first-time-setup
|
||||||
description: First-time setup and default model selection flow for baoyu-image-gen
|
description: First-time setup and default model selection flow for baoyu-imagine
|
||||||
---
|
---
|
||||||
|
|
||||||
# First-Time Setup
|
# First-Time Setup
|
||||||
@@ -147,8 +147,8 @@ options:
|
|||||||
|
|
||||||
| Choice | Path | Scope |
|
| Choice | Path | Scope |
|
||||||
|--------|------|-------|
|
|--------|------|-------|
|
||||||
| Project | `.baoyu-skills/baoyu-image-gen/EXTEND.md` | Current project |
|
| Project | `.baoyu-skills/baoyu-imagine/EXTEND.md` | Current project |
|
||||||
| User | `$HOME/.baoyu-skills/baoyu-image-gen/EXTEND.md` | All projects |
|
| User | `$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md` | All projects |
|
||||||
|
|
||||||
### EXTEND.md Template
|
### EXTEND.md Template
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ options:
|
|||||||
|
|
||||||
Notes for Azure setup:
|
Notes for Azure setup:
|
||||||
|
|
||||||
- In `baoyu-image-gen`, Azure `--model` / `default_model.azure` should be the Azure deployment name, not just the underlying model family.
|
- In `baoyu-imagine`, Azure `--model` / `default_model.azure` should be the Azure deployment name, not just the underlying model family.
|
||||||
- If the deployment name is custom, save that exact deployment name in `default_model.azure`.
|
- If the deployment name is custom, save that exact deployment name in `default_model.azure`.
|
||||||
|
|
||||||
### OpenRouter Model Selection
|
### OpenRouter Model Selection
|
||||||
@@ -255,7 +255,7 @@ Notes for DashScope setup:
|
|||||||
|
|
||||||
- Prefer `qwen-image-2.0-pro` when the user needs custom `--size`, uncommon ratios like `21:9`, or strong Chinese/English text rendering.
|
- Prefer `qwen-image-2.0-pro` when the user needs custom `--size`, uncommon ratios like `21:9`, or strong Chinese/English text rendering.
|
||||||
- `qwen-image-max` / `qwen-image-plus` / `qwen-image` only support five fixed sizes: `1664*928`, `1472*1104`, `1328*1328`, `1104*1472`, `928*1664`.
|
- `qwen-image-max` / `qwen-image-plus` / `qwen-image` only support five fixed sizes: `1664*928`, `1472*1104`, `1328*1328`, `1104*1472`, `928*1664`.
|
||||||
- In `baoyu-image-gen`, `quality` is a compatibility preset. It is not a native DashScope parameter.
|
- In `baoyu-imagine`, `quality` is a compatibility preset. It is not a native DashScope parameter.
|
||||||
|
|
||||||
### Replicate Model Selection
|
### Replicate Model Selection
|
||||||
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: preferences-schema
|
name: preferences-schema
|
||||||
description: EXTEND.md YAML schema for baoyu-image-gen user preferences
|
description: EXTEND.md YAML schema for baoyu-imagine user preferences
|
||||||
---
|
---
|
||||||
|
|
||||||
# Preferences Schema
|
# Preferences Schema
|
||||||
+58
-2
@@ -13,6 +13,7 @@ import {
|
|||||||
getWorkerCount,
|
getWorkerCount,
|
||||||
isRetryableGenerationError,
|
isRetryableGenerationError,
|
||||||
loadBatchTasks,
|
loadBatchTasks,
|
||||||
|
loadExtendConfig,
|
||||||
mergeConfig,
|
mergeConfig,
|
||||||
normalizeOutputImagePath,
|
normalizeOutputImagePath,
|
||||||
parseArgs,
|
parseArgs,
|
||||||
@@ -69,7 +70,7 @@ async function makeTempDir(prefix: string): Promise<string> {
|
|||||||
return fs.mkdtemp(path.join(os.tmpdir(), prefix));
|
return fs.mkdtemp(path.join(os.tmpdir(), prefix));
|
||||||
}
|
}
|
||||||
|
|
||||||
test("parseArgs parses the main image-gen CLI flags", () => {
|
test("parseArgs parses the main baoyu-imagine CLI flags", () => {
|
||||||
const args = parseArgs([
|
const args = parseArgs([
|
||||||
"--promptfiles",
|
"--promptfiles",
|
||||||
"prompts/system.md",
|
"prompts/system.md",
|
||||||
@@ -170,6 +171,61 @@ batch:
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("loadExtendConfig renames legacy EXTEND.md when the new path is missing", async () => {
|
||||||
|
const root = await makeTempDir("baoyu-imagine-extend-");
|
||||||
|
const cwd = path.join(root, "project");
|
||||||
|
const home = path.join(root, "home");
|
||||||
|
const legacyPath = path.join(cwd, ".baoyu-skills", "baoyu-image-gen", "EXTEND.md");
|
||||||
|
const currentPath = path.join(cwd, ".baoyu-skills", "baoyu-imagine", "EXTEND.md");
|
||||||
|
|
||||||
|
await fs.mkdir(path.dirname(legacyPath), { recursive: true });
|
||||||
|
await fs.mkdir(home, { recursive: true });
|
||||||
|
await fs.writeFile(legacyPath, `---
|
||||||
|
default_provider: google
|
||||||
|
default_quality: 2k
|
||||||
|
---
|
||||||
|
`);
|
||||||
|
|
||||||
|
const config = await loadExtendConfig(cwd, home);
|
||||||
|
|
||||||
|
assert.equal(config.default_provider, "google");
|
||||||
|
assert.equal(config.default_quality, "2k");
|
||||||
|
await fs.access(currentPath);
|
||||||
|
await assert.rejects(() => fs.access(legacyPath));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("loadExtendConfig leaves legacy EXTEND.md untouched when both paths exist", async () => {
|
||||||
|
const root = await makeTempDir("baoyu-imagine-extend-dual-");
|
||||||
|
const cwd = path.join(root, "project");
|
||||||
|
const home = path.join(root, "home");
|
||||||
|
const legacyPath = path.join(cwd, ".baoyu-skills", "baoyu-image-gen", "EXTEND.md");
|
||||||
|
const currentPath = path.join(cwd, ".baoyu-skills", "baoyu-imagine", "EXTEND.md");
|
||||||
|
|
||||||
|
await fs.mkdir(path.dirname(legacyPath), { recursive: true });
|
||||||
|
await fs.mkdir(path.dirname(currentPath), { recursive: true });
|
||||||
|
await fs.mkdir(home, { recursive: true });
|
||||||
|
await fs.writeFile(legacyPath, `---
|
||||||
|
default_provider: google
|
||||||
|
---
|
||||||
|
`);
|
||||||
|
await fs.writeFile(currentPath, `---
|
||||||
|
default_provider: openai
|
||||||
|
---
|
||||||
|
`);
|
||||||
|
|
||||||
|
const config = await loadExtendConfig(cwd, home);
|
||||||
|
|
||||||
|
assert.equal(config.default_provider, "openai");
|
||||||
|
assert.equal(await fs.readFile(legacyPath, "utf8"), `---
|
||||||
|
default_provider: google
|
||||||
|
---
|
||||||
|
`);
|
||||||
|
assert.equal(await fs.readFile(currentPath, "utf8"), `---
|
||||||
|
default_provider: openai
|
||||||
|
---
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
test("mergeConfig only fills values missing from CLI args", () => {
|
test("mergeConfig only fills values missing from CLI args", () => {
|
||||||
const merged = mergeConfig(
|
const merged = mergeConfig(
|
||||||
makeArgs({
|
makeArgs({
|
||||||
@@ -349,7 +405,7 @@ test("batch worker and provider-rate-limit configuration prefer env over EXTEND
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("loadBatchTasks and createTaskArgs resolve batch-relative paths", async (t) => {
|
test("loadBatchTasks and createTaskArgs resolve batch-relative paths", async (t) => {
|
||||||
const root = await makeTempDir("baoyu-image-gen-batch-");
|
const root = await makeTempDir("baoyu-imagine-batch-");
|
||||||
t.after(() => fs.rm(root, { recursive: true, force: true }));
|
t.after(() => fs.rm(root, { recursive: true, force: true }));
|
||||||
|
|
||||||
const batchFile = path.join(root, "jobs", "batch.json");
|
const batchFile = path.join(root, "jobs", "batch.json");
|
||||||
@@ -2,7 +2,7 @@ import path from "node:path";
|
|||||||
import process from "node:process";
|
import process from "node:process";
|
||||||
import { homedir } from "node:os";
|
import { homedir } from "node:os";
|
||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
import { access, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
||||||
import type {
|
import type {
|
||||||
BatchFile,
|
BatchFile,
|
||||||
BatchTaskInput,
|
BatchTaskInput,
|
||||||
@@ -471,14 +471,49 @@ export function parseSimpleYaml(yaml: string): Partial<ExtendConfig> {
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadExtendConfig(): Promise<Partial<ExtendConfig>> {
|
type ExtendConfigPathPair = {
|
||||||
const home = homedir();
|
current: string;
|
||||||
const cwd = process.cwd();
|
legacy: string;
|
||||||
|
};
|
||||||
|
|
||||||
const paths = [
|
function getExtendConfigPathPairs(cwd: string, home: string): ExtendConfigPathPair[] {
|
||||||
path.join(cwd, ".baoyu-skills", "baoyu-image-gen", "EXTEND.md"),
|
return [
|
||||||
path.join(home, ".baoyu-skills", "baoyu-image-gen", "EXTEND.md"),
|
{
|
||||||
|
current: path.join(cwd, ".baoyu-skills", "baoyu-imagine", "EXTEND.md"),
|
||||||
|
legacy: path.join(cwd, ".baoyu-skills", "baoyu-image-gen", "EXTEND.md"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
current: path.join(home, ".baoyu-skills", "baoyu-imagine", "EXTEND.md"),
|
||||||
|
legacy: path.join(home, ".baoyu-skills", "baoyu-image-gen", "EXTEND.md"),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
async function exists(filePath: string): Promise<boolean> {
|
||||||
|
try {
|
||||||
|
await access(filePath);
|
||||||
|
return true;
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function migrateLegacyExtendConfig(cwd: string, home: string): Promise<void> {
|
||||||
|
for (const { current, legacy } of getExtendConfigPathPairs(cwd, home)) {
|
||||||
|
const [hasCurrent, hasLegacy] = await Promise.all([exists(current), exists(legacy)]);
|
||||||
|
if (hasCurrent || !hasLegacy) continue;
|
||||||
|
await mkdir(path.dirname(current), { recursive: true });
|
||||||
|
await rename(legacy, current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function loadExtendConfig(
|
||||||
|
cwd = process.cwd(),
|
||||||
|
home = homedir(),
|
||||||
|
): Promise<Partial<ExtendConfig>> {
|
||||||
|
await migrateLegacyExtendConfig(cwd, home);
|
||||||
|
|
||||||
|
const paths = getExtendConfigPathPairs(cwd, home).map(({ current }) => current);
|
||||||
|
|
||||||
for (const p of paths) {
|
for (const p of paths) {
|
||||||
try {
|
try {
|
||||||
+1
-1
@@ -136,7 +136,7 @@ test("Azure image generation routes model to deployment and sends mapped quality
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("Azure image edits include quality in multipart requests", async (t) => {
|
test("Azure image edits include quality in multipart requests", async (t) => {
|
||||||
const root = await makeTempDir("baoyu-image-gen-azure-");
|
const root = await makeTempDir("baoyu-imagine-azure-");
|
||||||
t.after(() => fs.rm(root, { recursive: true, force: true }));
|
t.after(() => fs.rm(root, { recursive: true, force: true }));
|
||||||
|
|
||||||
const pngPath = path.join(root, "ref.png");
|
const pngPath = path.join(root, "ref.png");
|
||||||
+1
-1
@@ -421,7 +421,7 @@ export async function generateImage(
|
|||||||
|
|
||||||
if (args.referenceImages.length > 0) {
|
if (args.referenceImages.length > 0) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Reference images are not supported with DashScope provider in baoyu-image-gen. Use --provider google with a Gemini multimodal model."
|
"Reference images are not supported with DashScope provider in baoyu-imagine. Use --provider google with a Gemini multimodal model."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: baoyu-translate
|
name: baoyu-translate
|
||||||
description: Translates articles and documents between languages with three modes - quick (direct), normal (analyze then translate), and refined (analyze, translate, review, polish). Supports custom glossaries and terminology consistency via EXTEND.md. Use when user asks to "translate", "翻译", "精翻", "translate article", "translate to Chinese/English", "改成中文", "改成英文", "convert to Chinese", "localize", "本地化", or needs any document translation. Also triggers for "refined translation", "精细翻译", "proofread translation", "快速翻译", "快翻", "这篇文章翻译一下", or when a URL or file is provided with translation intent.
|
description: Translates articles and documents between languages with three modes - quick (direct), normal (analyze then translate), and refined (analyze, translate, review, polish). Supports custom glossaries and terminology consistency via EXTEND.md. Use when user asks to "translate", "翻译", "精翻", "translate article", "translate to Chinese/English", "改成中文", "改成英文", "convert to Chinese", "localize", "本地化", or needs any document translation. Also triggers for "refined translation", "精细翻译", "proofread translation", "快速翻译", "快翻", "这篇文章翻译一下", or when a URL or file is provided with translation intent.
|
||||||
version: 1.56.1
|
version: 1.57.0
|
||||||
metadata:
|
metadata:
|
||||||
openclaw:
|
openclaw:
|
||||||
homepage: https://github.com/JimLiu/baoyu-skills#baoyu-translate
|
homepage: https://github.com/JimLiu/baoyu-skills#baoyu-translate
|
||||||
@@ -189,12 +189,12 @@ Before translating chunks:
|
|||||||
- Splits at markdown block boundaries to preserve structure
|
- Splits at markdown block boundaries to preserve structure
|
||||||
- If a single block exceeds the threshold, falls back to line splitting, then word splitting
|
- If a single block exceeds the threshold, falls back to line splitting, then word splitting
|
||||||
4. **Assemble translation prompt**:
|
4. **Assemble translation prompt**:
|
||||||
- Main agent reads `01-analysis.md` (if exists) and assembles shared context using Part 1 of [references/subagent-prompt-template.md](references/subagent-prompt-template.md) — inlining the resolved style preset (from `--style` flag, EXTEND.md `style` setting, or default `storytelling`), content background, merged glossary, and comprehension challenges
|
- Main agent reads `01-analysis.md` (if exists) and assembles shared context using Part 1 of [references/subagent-prompt-template.md](references/subagent-prompt-template.md) — inlining: target style + source voice assessment, content background, merged glossary, figurative language mapping (structured table), comprehension challenges (with reasoning), and translation challenges (structural/creative)
|
||||||
- Save as `02-prompt.md` in the output directory (shared context only, no task instructions)
|
- Save as `02-prompt.md` in the output directory (shared context only, no task instructions)
|
||||||
5. **Draft translation via subagents** (if Agent tool available):
|
5. **Draft translation via subagents** (if Agent tool available):
|
||||||
- Spawn one subagent **per chunk**, all in parallel (Part 2 of the template)
|
- Spawn one subagent **per chunk**, all in parallel (Part 2 of the template)
|
||||||
- Each subagent reads `02-prompt.md` for shared context, translates its chunk, saves to `chunks/chunk-NN-draft.md`
|
- Each subagent reads `02-prompt.md` for shared context, receives chunk position info (chunk N of M + brief context of where it sits in the argument), translates its chunk, saves to `chunks/chunk-NN-draft.md`
|
||||||
- Terminology consistency is guaranteed by the shared `02-prompt.md` (glossary + comprehension challenges from analysis)
|
- Consistency is guaranteed by the shared `02-prompt.md` (glossary, figurative language mapping, comprehension challenges, source voice, and translation challenges from analysis)
|
||||||
- If no chunks (content under threshold): spawn one subagent for the entire source file
|
- If no chunks (content under threshold): spawn one subagent for the entire source file
|
||||||
- If Agent tool is unavailable, translate chunks sequentially inline using `02-prompt.md`
|
- If Agent tool is unavailable, translate chunks sequentially inline using `02-prompt.md`
|
||||||
6. **Merge**: Once all subagents complete, combine translated chunks in order. If `chunks/frontmatter.md` exists, prepend it. Save as `03-draft.md` (refined) or `translation.md` (normal)
|
6. **Merge**: Once all subagents complete, combine translated chunks in order. If `chunks/frontmatter.md` exists, prepend it. Save as `03-draft.md` (refined) or `translation.md` (normal)
|
||||||
|
|||||||
@@ -121,9 +121,16 @@ Implicit assumptions: [unstated premises]
|
|||||||
|
|
||||||
## Step 2: Assemble Translation Prompt
|
## Step 2: Assemble Translation Prompt
|
||||||
|
|
||||||
Main agent reads `01-analysis.md` and assembles a complete translation prompt using [references/subagent-prompt-template.md](subagent-prompt-template.md). Inline the resolved style preset (from `--style` flag, EXTEND.md `style` setting, or default `storytelling`), content background, merged glossary, and comprehension challenges into the prompt. Save to `02-prompt.md`.
|
Main agent reads `01-analysis.md` and assembles a complete translation prompt using [references/subagent-prompt-template.md](subagent-prompt-template.md). Inline the following from analysis into the prompt:
|
||||||
|
|
||||||
This prompt is used by the subagent (chunked) or by the main agent itself (non-chunked).
|
- **Target style + Source voice**: Resolved style preset (from `--style` flag, EXTEND.md `style` setting, or default `storytelling`) AND the source voice assessment from analysis §1.5 (formal/conversational, humor, register, sentence rhythm)
|
||||||
|
- **Content background**: Quick summary, core argument, author background, writing context, purpose, implicit assumptions (from §1.1–1.3)
|
||||||
|
- **Glossary**: Merged glossary with analysis-extracted terms (from §1.4)
|
||||||
|
- **Figurative Language Mapping**: Structured table from analysis §1.7 — each metaphor/idiom with intended meaning, approach (interpret/substitute/retain), and suggested rendering
|
||||||
|
- **Comprehension Challenges**: Each challenge with reasoning (why it confuses readers) and proposed note (from §1.6)
|
||||||
|
- **Translation Challenges**: Structural and creative challenges from analysis §1.8 — specific passages with suggested approaches
|
||||||
|
|
||||||
|
Save to `02-prompt.md`. This prompt is used by the subagent (chunked) or by the main agent itself (non-chunked).
|
||||||
|
|
||||||
## Step 3: Initial Draft
|
## Step 3: Initial Draft
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,15 @@ You are a professional translator. Your task is to translate markdown content fr
|
|||||||
|
|
||||||
## Translation Style
|
## Translation Style
|
||||||
|
|
||||||
{style description — e.g., "storytelling: engaging narrative flow, smooth transitions, vivid phrasing" or custom style from user}
|
**Target style**: {style description — e.g., "storytelling: engaging narrative flow, smooth transitions, vivid phrasing" or custom style from user}
|
||||||
|
|
||||||
Apply this style consistently: it determines the voice, tone, and sentence-level choices throughout the translation. Style is independent of audience — a technical audience can still get a storytelling-style translation, or a general audience can get a formal one.
|
**Source voice** (from analysis, if exists): {Describe the original author's voice — e.g., "Self-deprecating, conversational tone with frequent tech-industry humor. Sarcasm used to critique trends. Short punchy sentences alternate with longer analytical passages." Include: formal/conversational, humor type, cultural register, sentence rhythm, any distinctive patterns.}
|
||||||
|
|
||||||
|
Apply the target style consistently while respecting the source voice. The translator should understand what the original sounds like in order to produce a translation that captures the same feel in the target style. Style is independent of audience — a technical audience can still get a storytelling-style translation, or a general audience can get a formal one.
|
||||||
|
|
||||||
## Content Background
|
## Content Background
|
||||||
|
|
||||||
{Inlined from 01-analysis.md if analysis exists: quick summary, core argument, author background, writing context, tone assessment, figurative language & metaphor mapping.}
|
{Inlined from 01-analysis.md if analysis exists: quick summary, core argument, author background, writing context, purpose, implicit assumptions.}
|
||||||
|
|
||||||
## Glossary
|
## Glossary
|
||||||
|
|
||||||
@@ -35,23 +37,43 @@ Apply these term translations consistently throughout. First occurrence of each
|
|||||||
|
|
||||||
{Merged glossary — combine built-in glossary + EXTEND.md glossary + terms extracted in analysis. One per line: English → Translation}
|
{Merged glossary — combine built-in glossary + EXTEND.md glossary + terms extracted in analysis. One per line: English → Translation}
|
||||||
|
|
||||||
|
## Figurative Language Mapping
|
||||||
|
|
||||||
|
{Inlined from 01-analysis.md section 1.7 if analysis exists. Structured table — one row per metaphor, idiom, or figurative expression identified in the source:}
|
||||||
|
|
||||||
|
| Original Expression | Intended Meaning | Approach | Suggested Rendering |
|
||||||
|
|--------------------|--------------------|----------|---------------------|
|
||||||
|
| {source metaphor} | {what the author actually means} | {Interpret / Substitute / Retain} | {target-language rendering or guidance} |
|
||||||
|
|
||||||
|
Also note any emotional connotations (words carrying subjective feeling beyond dictionary meaning) and implied meanings (sentences where surface meaning is simpler than the author's full intent) identified in the analysis — preserve these in translation.
|
||||||
|
|
||||||
## Comprehension Challenges
|
## Comprehension Challenges
|
||||||
|
|
||||||
The following terms or references may confuse target readers. Add translator's notes in parentheses where they appear: `译文(English original,通俗解释)`
|
The following terms or references may confuse target readers. Add translator's notes in parentheses where they appear: `译文(English original,通俗解释)`
|
||||||
|
|
||||||
{Inlined from 01-analysis.md comprehension challenges section if analysis exists. Each entry: term → explanation to use as note.}
|
{Inlined from 01-analysis.md comprehension challenges section if analysis exists. Each entry includes the reasoning so the translator can calibrate annotation depth:}
|
||||||
|
|
||||||
|
- **{term/passage}**: {why this may confuse target readers} → Note: {concise explanation to use as translator's note}
|
||||||
|
|
||||||
|
## Translation Challenges
|
||||||
|
|
||||||
|
{Inlined from 01-analysis.md section 1.8 if analysis exists. Specific passages requiring structural or creative adaptation:}
|
||||||
|
|
||||||
|
- {location/passage}: {what makes it challenging — e.g., 60-word participial chain, wordplay, pun, author's signature humor} → {suggested approach — e.g., break into 2-3 shorter sentences, adapt the joke for target culture, preserve the ambiguity}
|
||||||
|
|
||||||
|
If this section is empty, omit it.
|
||||||
|
|
||||||
## Translation Principles
|
## Translation Principles
|
||||||
|
|
||||||
- **Accuracy first**: Facts, data, and logic must match the original exactly
|
- **Accuracy first**: Facts, data, and logic must match the original exactly
|
||||||
- **Meaning over words**: Translate what the author means, not just what the words say. When a literal translation sounds unnatural or fails to convey the intended effect, restructure freely to express the same meaning in idiomatic {target_lang}
|
- **Meaning over words**: Translate what the author means, not just what the words say. When a literal translation sounds unnatural or fails to convey the intended effect, restructure freely to express the same meaning in idiomatic {target_lang}
|
||||||
- **Figurative language**: Interpret metaphors, idioms, and figurative expressions by their intended meaning. When a source-language image does not carry the same connotation in {target_lang}, replace it with a natural expression that conveys the same idea and emotional effect. Refer to the Figurative Language section in Content Background (if provided) for pre-analyzed metaphor mappings
|
- **Figurative language**: Interpret metaphors, idioms, and figurative expressions by their intended meaning. When a source-language image does not carry the same connotation in {target_lang}, replace it with a natural expression that conveys the same idea and emotional effect. Follow the Figurative Language Mapping table above for pre-analyzed decisions
|
||||||
- **Emotional fidelity**: Preserve the emotional connotations of word choices, not just their dictionary meanings
|
- **Emotional fidelity**: Preserve the emotional connotations of word choices, not just their dictionary meanings
|
||||||
- **Natural flow**: Use idiomatic {target_lang} word order and sentence patterns; break or restructure sentences freely when the source structure doesn't work naturally
|
- **Natural flow**: Use idiomatic {target_lang} word order and sentence patterns; break or restructure sentences freely when the source structure doesn't work naturally
|
||||||
- **Terminology**: Use glossary translations consistently; annotate with original term in parentheses on first occurrence
|
- **Terminology**: Use glossary translations consistently; annotate with original term in parentheses on first occurrence
|
||||||
- **Preserve format**: Keep all markdown formatting (headings, bold, italic, images, links, code blocks)
|
- **Preserve format**: Keep all markdown formatting (headings, bold, italic, images, links, code blocks)
|
||||||
- **Respect original**: Maintain original meaning and intent; do not add, remove, or editorialize — but sentence structure and imagery may be adapted freely to serve the meaning
|
- **Respect original**: Maintain original meaning and intent; do not add, remove, or editorialize — but sentence structure and imagery may be adapted freely to serve the meaning
|
||||||
- **Translator's notes**: For terms or cultural references listed in Comprehension Challenges above, add a concise explanatory note in parentheses. Only annotate where genuinely needed for the target audience.
|
- **Translator's notes**: For terms or cultural references listed in Comprehension Challenges above, add a concise explanatory note in parentheses. Use the provided reasoning to judge annotation depth — explain more for genuinely obscure references, less for terms that are merely unfamiliar. Only annotate where genuinely needed for the target audience.
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -63,6 +85,9 @@ The following terms or references may confuse target readers. Add translator's n
|
|||||||
```
|
```
|
||||||
Read the translation instructions from: {output_dir}/02-prompt.md
|
Read the translation instructions from: {output_dir}/02-prompt.md
|
||||||
|
|
||||||
|
You are translating chunk {NN} of {total_chunks}.
|
||||||
|
Context: {brief description of what this chunk covers and where it sits in the overall argument — e.g., "This chunk covers the author's critique of current approaches, following the introduction of the problem and leading into the proposed solution."}
|
||||||
|
|
||||||
Translate this chunk:
|
Translate this chunk:
|
||||||
1. Read `{output_dir}/chunks/chunk-{NN}.md`
|
1. Read `{output_dir}/chunks/chunk-{NN}.md`
|
||||||
2. Translate following the instructions in 02-prompt.md
|
2. Translate following the instructions in 02-prompt.md
|
||||||
|
|||||||
Reference in New Issue
Block a user