mirror of
https://github.com/JimLiu/baoyu-skills.git
synced 2026-08-08 09:53:02 +08:00
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:
@@ -141,13 +141,13 @@ preferred_layout: [selected layout or null]
|
||||
preferred_style: [selected style or null]
|
||||
preferred_aspect: [landscape|portrait|square|null]
|
||||
language: [selected language or null]
|
||||
preferred_image_backend: auto
|
||||
custom_styles: []
|
||||
---
|
||||
```
|
||||
|
||||
`preferred_image_backend: auto` is the baked-in default — first-time setup never asks about it. The `## Image Generation Tools` rule in SKILL.md then picks the runtime-native tool (Codex `imagegen`, Hermes `image_generate`, etc.) when one is available, and falls back to installed backends like `baoyu-imagine`.
|
||||
|
||||
## Modifying Preferences Later
|
||||
|
||||
Users can edit EXTEND.md directly or trigger setup again:
|
||||
- Delete EXTEND.md to re-trigger setup
|
||||
- Edit YAML frontmatter for quick changes
|
||||
- Full schema: `references/config/preferences-schema.md`
|
||||
See the `## Changing Preferences` section in `SKILL.md` for the canonical list of common edits (pin backend, change layout/style defaults, retrigger setup). Full schema: `references/config/preferences-schema.md`.
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user