refactor: unify image-backend resolution with preferred_image_backend preference

Replaces the stateless ask-once backend rule with a 4-step resolution
(current-request override > saved preference > auto-select > ask) and
adds a single `preferred_image_backend` field (auto | ask | <backend-id>)
to every image-consuming skill's EXTEND.md schema. Runtime-native tools
(Codex `imagegen`, Hermes `image_generate`, ...) win by default; absent
field equals `auto` so existing user EXTEND.md files stay valid with no
schema version bump.

Each image-consuming skill also gains a top-level `## Changing
Preferences` section as a first-class surface for pinning a backend and
editing common one-line preferences.

Applies across:
  - baoyu-infographic (reverts in-progress two-field image_backend_mode design)
  - baoyu-comic
  - baoyu-cover-image
  - baoyu-image-cards
  - baoyu-article-illustrator
  - baoyu-slide-deck
  - baoyu-xhs-images
  - docs/image-generation-tools.md (canonical author-side doc)
This commit is contained in:
Jim Liu 宝玉
2026-04-21 16:43:58 -05:00
parent a4bd37c390
commit adb783ae6d
21 changed files with 258 additions and 72 deletions
@@ -17,6 +17,8 @@ preferred_aspect: null # landscape|portrait|square|null (custom W:H also acc
language: null # zh|en|ja|ko|null (null = auto-detect from source)
preferred_image_backend: auto # auto|ask|<backend-id>
custom_styles: # extra style definitions merged with the 21 built-ins
- name: my-brand
description: "Short description shown in Step 3 recommendations"
@@ -33,8 +35,19 @@ custom_styles: # extra style definitions merged with the 21 built-ins
| `preferred_style` | string\|null | null | Pre-selected style — surfaces as the top recommendation in Step 3 |
| `preferred_aspect` | string\|null | null | Default aspect for Step 4 (named preset or W:H string) |
| `language` | string\|null | null | Output language (null = auto-detect from source content) |
| `preferred_image_backend` | string | `auto` | Image backend selection. `auto` = prefer runtime-native tool, fall back to the only installed backend, ask if multiple non-native are present. `ask` = always confirm on every run. `<backend-id>` (e.g., `codex-imagegen`, `baoyu-imagine`, `image_generate`) = pin this backend when available; fall back to `auto` when it isn't. Absent = `auto`. |
| `custom_styles` | array | [] | Additional styles available alongside the 21 built-ins |
Backend resolution logic is documented in the `## Image Generation Tools` section of `SKILL.md`. This doc only defines the field.
Example backend ids:
| Value | Meaning |
|-------|---------|
| `codex-imagegen` | Codex built-in `imagegen` tool |
| `baoyu-imagine` | `baoyu-imagine` skill / script backend |
| `image_generate` | Generic runtime image tool such as Hermes |
## Layout Options
See the **Layout Gallery (21)** table in `SKILL.md` for the canonical list. Common picks:
@@ -87,6 +100,8 @@ language: zh
---
```
`preferred_image_backend` is omitted above; absence is treated as `auto`.
## Example: Full Preferences
```yaml
@@ -99,6 +114,8 @@ preferred_aspect: portrait
language: zh
preferred_image_backend: codex-imagegen
custom_styles:
- name: my-brand
description: "Brand-aligned warm pastel infographic"