math-tasks/.claude/commands/sprites.md

37 lines
1.3 KiB
Markdown

---
description: Split sprite sheets into individual icons using split-sprites script
allowed-tools: [Bash, Glob, AskUserQuestion]
---
You are splitting sprite sheet images into individual icons. The user's message may contain the source folder and/or destination folder.
## Step 1: Parse arguments
Extract from the user's message:
- **Source folder** — a subdirectory inside `assets/items/` (e.g. `assets/items/elements`)
- **Destination folder** — a subdirectory inside `assets/icons/` (e.g. `assets/icons/pack2`)
## Step 2: Fill in missing arguments
If the source folder is missing, list available subdirectories in `assets/items/` and ask the user to pick one using AskUserQuestion.
If the destination folder is missing, list existing packs in `assets/icons/` and suggest the next available `packN` name. Ask the user to confirm or specify a different name using AskUserQuestion.
## Step 3: Validate
Check that the source folder exists and contains image files (jpeg, png, webp). If it's empty or doesn't exist, tell the user and stop.
## Step 4: Run the split script
Run:
```bash
node src/scripts/split-sprites.mjs <source-folder> <destination-folder>
```
## Step 5: Report
Tell the user:
- How many icons were created
- Where they are located
- The naming convention used (`{name}-{row}-{col}.png`)