Skip to content

Commands

Mark Rogers edited this page Oct 22, 2026 · 8 revisions

Commands

Every command of bw.py 0.1.5 with its options, copied from --help. BW means python skills/brandwright/scripts/bw.py. Exit code 0 is success; a problem the CLI can explain exits with its message.

Set up

doctor

usage: bw.py doctor [-h] [--comfy COMFY] [--toolkit TOOLKIT]

options:
  -h, --help         show this help message and exit
  --comfy COMFY      ComfyUI URL to check (repeat; default BRANDWRIGHT_COMFY or :8188)
  --toolkit TOOLKIT  ostris ai-toolkit folder (or set BRANDWRIGHT_AI_TOOLKIT)

new

usage: bw.py new [-h] [--brand BRAND] [--trigger TRIGGER] [--site SITE]
                 [--model {klein4b,qwen_image,zimage,zimage_turbo}]
                 kit

positional arguments:
  kit                   kit folder to create or extend (keep it outside any repository)

options:
  -h, --help            show this help message and exit
  --brand BRAND         brand name (needed for a new kit)
  --trigger TRIGGER     brand trigger word (default: brand name + 'ui')
  --site SITE           NAME or NAME=URL; repeat for more sites
  --model {klein4b,qwen_image,zimage,zimage_turbo}
                        base model to train on (default zimage)

Capture

login

usage: bw.py login [-h] --site SITE [--channel CHANNEL] kit url

positional arguments:
  kit                kit folder (made by new)
  url                page to open for signing in

options:
  -h, --help         show this help message and exit
  --site SITE        site name in brand.json
  --channel CHANNEL  msedge or chrome: use the installed browser

capture

usage: bw.py capture [-h] --site SITE [--crawl CRAWL] [--crawl-all] [--viewports VIEWPORTS]
                     [--channel CHANNEL] [--cdp CDP] [--hide HIDE] [--blur BLUR] [--click CLICK]
                     [--no-mask] [--wait WAIT] [--timeout TIMEOUT] [--max-per-kind MAX_PER_KIND]
                     kit [urls ...]

positional arguments:
  kit                   kit folder (made by new)
  urls                  pages to capture (default: the site's urls in brand.json)

options:
  -h, --help            show this help message and exit
  --site SITE           site name in brand.json
  --crawl CRAWL         also visit up to N same-site links found on the pages
  --crawl-all           also crawl cookie, privacy, terms and sitemap pages
  --viewports VIEWPORTS
  --channel CHANNEL
  --cdp CDP             attach to a running browser started with --remote-debugging-port (e.g.
                        http://127.0.0.1:9222)
  --hide HIDE           CSS selector to hide before capture (repeat)
  --blur BLUR           CSS selector to blur before capture (repeat); prefer --hide
  --click CLICK         CSS selector to click before capture (e.g. open a menu)
  --no-mask             keep e-mail addresses and digit runs as they are (test data only)
  --wait WAIT           ms to wait after scrolling
  --timeout TIMEOUT
  --max-per-kind MAX_PER_KIND

import

usage: bw.py import [-h] --site SITE [--kind {screen,component}]
                    [--viewport {desktop,laptop,tablet,mobile,import}]
                    kit paths [paths ...]

positional arguments:
  kit                   kit folder (made by new)
  paths                 image files or folders (png, jpg, webp)

options:
  -h, --help            show this help message and exit
  --site SITE           site name in brand.json
  --kind {screen,component}
  --viewport {desktop,laptop,tablet,mobile,import}

tokens

usage: bw.py tokens [-h] kit

positional arguments:
  kit         kit folder (made by new)

options:
  -h, --help  show this help message and exit

Dataset

prep

usage: bw.py prep [-h] [--tiles TILES] [--dedupe DEDUPE] [--max-per-site MAX_PER_SITE]
                  [--brand-max BRAND_MAX]
                  kit

positional arguments:
  kit                   kit folder (made by new)

options:
  -h, --help            show this help message and exit
  --tiles TILES         viewport tiles per page, from the top
  --dedupe DEDUPE       max hash distance treated as a duplicate (0-64)
  --max-per-site MAX_PER_SITE
  --brand-max BRAND_MAX
                        brand dataset size, shared equally across sites

caption

usage: bw.py caption [-h] [--lora LORA] [--vlm {ollama,none}] [--model MODEL] [--host HOST]
                     [--force]
                     kit

positional arguments:
  kit                  kit folder (made by new)

options:
  -h, --help           show this help message and exit
  --lora LORA          one dataset only (default: all)
  --vlm {ollama,none}
  --model MODEL
  --host HOST          Ollama URL (default BRANDWRIGHT_OLLAMA or http://127.0.0.1:11434)
  --force              re-caption pictures that already have a model caption

review

usage: bw.py review [-h] kit

positional arguments:
  kit         kit folder (made by new)

options:
  -h, --help  show this help message and exit

Training

train

usage: bw.py train [-h] [--lora LORA] [--model {klein4b,qwen_image,zimage,zimage_turbo}]
                   [--mode {residual,continue,stack}] [--brand-lora BRAND_LORA] [--steps STEPS]
                   [--rank RANK] [--lr LR] [--res RES [RES ...]] [--save-every SAVE_EVERY]
                   [--samples SAMPLES] [--sample-every SAMPLE_EVERY]
                   [--for {ai-toolkit,musubi,onetrainer}] [--toolkit TOOLKIT] [--run] [--wait]
                   [--resume]
                   kit

positional arguments:
  kit                   kit folder (made by new)

options:
  -h, --help            show this help message and exit
  --lora LORA           brand, or a site name
  --model {klein4b,qwen_image,zimage,zimage_turbo}
                        base model (default: the kit's)
  --mode {residual,continue,stack}
                        site LoRAs: residual = learn only the difference from the brand LoRA
                        (Z-Image); continue = start from the brand LoRA, use alone; stack =
                        independent
  --brand-lora BRAND_LORA
                        brand LoRA file for residual or continue (default:
                        loras/brand-<model>.safetensors)
  --steps STEPS         default: 5 per picture, 400 to 1,500 (style LoRAs peak early)
  --rank RANK
  --lr LR
  --res RES [RES ...]
  --save-every SAVE_EVERY
                        checkpoint every N steps
  --samples SAMPLES     sample prompts drawn during training; 0 turns sampling off (default: 4, or
                        2 for residual site LoRAs)
  --sample-every SAMPLE_EVERY
                        draw samples every N steps (default: --save-every, or 200 for residual
                        site LoRAs, which also skip the step-0 sample)
  --for {ai-toolkit,musubi,onetrainer}
                        write the same job for musubi-tuner (dataset.toml + train.sh) or
                        OneTrainer (config + concepts)
  --toolkit TOOLKIT     ostris ai-toolkit folder (or BRANDWRIGHT_AI_TOOLKIT)
  --run                 start training now, detached; log in train/<name>.log
  --wait                with --run: block until training ends (for job queues)
  --resume              with --run: continue the run already in train/out/<name>; without it, that
                        folder is moved aside

status

usage: bw.py status [-h] kit

positional arguments:
  kit         kit folder (made by new)

options:
  -h, --help  show this help message and exit

pick

usage: bw.py pick [-h] [--lora LORA] [--step STEP]
                  [--model {klein4b,qwen_image,zimage,zimage_turbo}] [--to TO]
                  kit

positional arguments:
  kit                   kit folder (made by new)

options:
  -h, --help            show this help message and exit
  --lora LORA           brand, or a site name
  --step STEP           checkpoint step (default: the final file)
  --model {klein4b,qwen_image,zimage,zimage_turbo}
                        base model (default: the kit's)
  --to TO               ComfyUI models/loras folder (or set BRANDWRIGHT_COMFY_LORAS)

Mock-ups

gen

usage: bw.py gen [-h] [--lora LORA] [--n N] [--steps STEPS] [--cfg CFG] [--raw] [--comfy COMFY]
                 [--graph {klein4b,klein4b_base,qwen_image,zimage,zimage_turbo}] [--size SIZE]
                 [--seed SEED] [--timeout TIMEOUT]
                 kit prompt

positional arguments:
  kit                   kit folder (made by new)
  prompt                what to draw: view, what it is, parts in order, strings in double quotes

options:
  -h, --help            show this help message and exit
  --lora LORA           NAME=WEIGHT (brand=0.8, a site name, or file.safetensors=0.6); repeat
  --n N                 pictures per run
  --steps STEPS
  --cfg CFG
  --raw                 do not add trigger words
  --comfy COMFY         ComfyUI URL (default: brand.json comfy, or BRANDWRIGHT_COMFY)
  --graph {klein4b,klein4b_base,qwen_image,zimage,zimage_turbo}
                        model graph (default: the kit's training model)
  --size SIZE
  --seed SEED
  --timeout TIMEOUT

sweep

usage: bw.py sweep [-h] --a A [--b B] [--wa WA] [--wb WB] [--comfy COMFY]
                   [--graph {klein4b,klein4b_base,qwen_image,zimage,zimage_turbo}] [--size SIZE]
                   [--seed SEED] [--timeout TIMEOUT]
                   kit prompt

positional arguments:
  kit                   kit folder (made by new)
  prompt                what to draw: view, what it is, parts in order, strings in double quotes

options:
  -h, --help            show this help message and exit
  --a A                 first LoRA name (e.g. brand)
  --b B                 second LoRA name (e.g. a site)
  --wa WA
  --wb WB
  --comfy COMFY         ComfyUI URL (default: brand.json comfy, or BRANDWRIGHT_COMFY)
  --graph {klein4b,klein4b_base,qwen_image,zimage,zimage_turbo}
                        model graph (default: the kit's training model)
  --size SIZE
  --seed SEED
  --timeout TIMEOUT

ref

usage: bw.py ref [-h] --refs REFS [REFS ...] [--lora LORA] [--n N] [--raw] [--comfy COMFY]
                 [--graph {klein4b,klein4b_base,qwen_image,zimage,zimage_turbo}] [--size SIZE]
                 [--seed SEED] [--timeout TIMEOUT]
                 kit prompt

positional arguments:
  kit                   kit folder (made by new)
  prompt                what to draw: view, what it is, parts in order, strings in double quotes

options:
  -h, --help            show this help message and exit
  --refs REFS [REFS ...]
                        up to 4 reference screenshots
  --lora LORA
  --n N
  --raw                 send the prompt as written
  --comfy COMFY         ComfyUI URL (default: brand.json comfy, or BRANDWRIGHT_COMFY)
  --graph {klein4b,klein4b_base,qwen_image,zimage,zimage_turbo}
                        model graph (default: the kit's training model)
  --size SIZE
  --seed SEED
  --timeout TIMEOUT

render

usage: bw.py render [-h] [--out OUT] [--width WIDTH] [--height HEIGHT] [--scale SCALE] [--full]
                    [--selector SELECTOR] [--dark] [--channel CHANNEL]
                    html

positional arguments:
  html                 the mock-up page (link brand.css from it)

options:
  -h, --help           show this help message and exit
  --out OUT            PNG path (default: next to the HTML)
  --width WIDTH
  --height HEIGHT
  --scale SCALE
  --full
  --selector SELECTOR
  --dark
  --channel CHANNEL

score

usage: bw.py score [-h] [--json JSON] kit images [images ...]

positional arguments:
  kit          kit folder (made by new)
  images       images or folders

options:
  -h, --help   show this help message and exit
  --json JSON  also write the scores to this file

sheet

usage: bw.py sheet [-h] [--out OUT] [--cols COLS] images [images ...]

positional arguments:
  images       images or folders

options:
  -h, --help   show this help message and exit
  --out OUT
  --cols COLS

Clone this wiki locally