mycopunk-swag/docs/cli-reference.md

379 lines
7.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# CLI Reference
Complete command reference for the `mycopunk` CLI tool.
## Installation
```bash
cd cli
pip install -e .
```
This installs the CLI in development mode, allowing you to edit the code and see changes immediately.
## Global Options
```bash
mycopunk --version # Show version
mycopunk --help # Show help
```
---
## Design Commands
### `mycopunk design new`
Create a new design scaffold with metadata template.
```bash
mycopunk design new <path> [--template TEMPLATE]
```
**Arguments:**
- `path` - Design path in format `category/design-name` (e.g., `stickers/my-design`)
**Options:**
- `--template, -t` - Template to use (default: `sticker-3x3`)
**Available Templates:**
| Template | Dimensions | Use Case |
|----------|-----------|----------|
| `sticker-3x3` | 900×900 px | Small vinyl sticker |
| `sticker-4x4` | 1200×1200 px | Medium vinyl sticker |
| `sticker-6x6` | 1800×1800 px | Large vinyl sticker |
| `tshirt-front` | 3600×4800 px | Full front print |
| `tshirt-chest` | 1200×1200 px | Chest/pocket print |
| `print-8x10` | 2400×3000 px | 8×10 art print |
**Example:**
```bash
mycopunk design new stickers/spore-spiral --template=sticker-3x3
mycopunk design new shirts/mycelium-network --template=tshirt-front
```
**Creates:**
```
designs/stickers/spore-spiral/
├── spore-spiral.svg # Edit this in Inkscape
├── metadata.yaml # Configure products here
└── exports/
├── 300dpi/.gitkeep
└── mockups/.gitkeep
```
---
### `mycopunk design list`
List all designs in the repository.
```bash
mycopunk design list [--status STATUS] [--type TYPE]
```
**Options:**
- `--status, -s` - Filter by status (draft, active, retired)
- `--type, -t` - Filter by category (stickers, shirts, misc)
**Example:**
```bash
mycopunk design list
mycopunk design list --status=active
mycopunk design list --type=stickers --status=active
```
---
### `mycopunk design export`
Export design to print-ready files.
```bash
mycopunk design export <path> [--dpi DPI] [--format FORMAT]
```
**Arguments:**
- `path` - Design path (e.g., `stickers/my-design`)
**Options:**
- `--dpi` - Export resolution (default: 300)
- `--format, -f` - Export format: png, jpg (default: png)
**Example:**
```bash
mycopunk design export stickers/spore-spiral
mycopunk design export stickers/spore-spiral --dpi=600
```
**Requirements:**
- Inkscape must be installed for SVG export
- PIL/Pillow for raster format conversion
---
### `mycopunk design validate`
Validate design meets POD requirements.
```bash
mycopunk design validate <path> [--strict]
```
**Arguments:**
- `path` - Design path to validate
**Options:**
- `--strict` - Fail on warnings (not just errors)
**Checks:**
- ✓ Required metadata fields present
- ✓ Source file exists
- ✓ Exported PNG dimensions match spec
- ✓ Resolution meets minimum (300 DPI)
- ✓ Products configured correctly
**Example:**
```bash
mycopunk design validate stickers/spore-spiral
mycopunk design validate stickers/spore-spiral --strict
```
---
## Product Commands
### `mycopunk product create`
Create product on POD service from design.
```bash
mycopunk product create <path> [--provider PROVIDER] [--sandbox]
```
**Arguments:**
- `path` - Design path
**Options:**
- `--provider, -p` - POD provider: printful, prodigi (default: prodigi)
- `--sandbox` - Use sandbox/test mode (no real orders)
**Example:**
```bash
mycopunk product create stickers/spore-spiral --provider=prodigi --sandbox
mycopunk product create shirts/mycelium-network --provider=printful
```
---
### `mycopunk product push`
Push design updates to POD product.
```bash
mycopunk product push <path> [--provider PROVIDER]
```
**Arguments:**
- `path` - Design path
**Options:**
- `--provider, -p` - Specific provider (default: all configured)
**Example:**
```bash
mycopunk product push stickers/spore-spiral
mycopunk product push stickers/spore-spiral --provider=printful
```
---
### `mycopunk product list`
List all products by provider.
```bash
mycopunk product list [--provider PROVIDER]
```
**Options:**
- `--provider, -p` - Filter by provider
**Example:**
```bash
mycopunk product list
mycopunk product list --provider=printful
```
---
## Mockup Commands
### `mycopunk mockup generate`
Generate product mockups for a design.
```bash
mycopunk mockup generate <path> [--all] [--color COLOR] [--size SIZE]
```
**Arguments:**
- `path` - Design path
**Options:**
- `--all` - Generate all variant mockups
- `--color, -c` - Product color (e.g., black, white)
- `--size, -s` - Product size (e.g., M, L, XL)
**Example:**
```bash
mycopunk mockup generate stickers/spore-spiral --all
mycopunk mockup generate shirts/mycelium-network --color=black --size=L
```
---
## Catalog Commands
### `mycopunk catalog sync`
Sync product catalog from POD services.
```bash
mycopunk catalog sync [--provider PROVIDER]
```
**Options:**
- `--provider, -p` - Provider to sync: printful, prodigi, all (default: all)
**Example:**
```bash
mycopunk catalog sync
mycopunk catalog sync --provider=printful
```
---
## Batch Commands
### `mycopunk batch export`
Export all designs matching criteria.
```bash
mycopunk batch export [--type TYPE] [--status STATUS]
```
**Options:**
- `--type, -t` - Filter by category
- `--status, -s` - Filter by status (default: active)
**Example:**
```bash
mycopunk batch export --type=sticker
mycopunk batch export --status=active
```
---
### `mycopunk batch push`
Push all designs to POD services.
```bash
mycopunk batch push [--status STATUS] [--provider PROVIDER]
```
**Options:**
- `--status, -s` - Filter by status (default: active)
- `--provider, -p` - Specific provider
**Example:**
```bash
mycopunk batch push --status=active
mycopunk batch push --provider=prodigi
```
---
## Reports
### `mycopunk report`
Generate various reports.
```bash
mycopunk report <type> [--output FILE]
```
**Arguments:**
- `type` - Report type: pricing, inventory, orders
**Options:**
- `--output, -o` - Output file path
**Example:**
```bash
mycopunk report pricing
mycopunk report pricing --output=pricing.csv
```
---
## Environment Variables
Set these in `config/.env`:
| Variable | Description | Required |
|----------|-------------|----------|
| `PRINTFUL_API_TOKEN` | Printful API token | For Printful operations |
| `PRODIGI_API_KEY_SANDBOX` | Prodigi sandbox key | For testing |
| `PRODIGI_API_KEY_LIVE` | Prodigi production key | For live orders |
| `MYCOPUNK_ENV` | Environment: development/production | No (default: development) |
| `DEFAULT_PROVIDER` | Default POD provider | No (default: prodigi) |
| `DEBUG` | Enable debug logging | No (default: false) |
---
## Exit Codes
| Code | Meaning |
|------|---------|
| 0 | Success |
| 1 | Error (validation failed, API error, etc.) |
---
## Tips
### Quick Workflow
```bash
# Create a new sticker design
mycopunk design new stickers/mushroom-logo --template=sticker-3x3
# Edit the SVG in Inkscape
inkscape designs/stickers/mushroom-logo/mushroom-logo.svg
# Edit metadata.yaml to set pricing
# Export to PNG
mycopunk design export stickers/mushroom-logo
# Validate before pushing
mycopunk design validate stickers/mushroom-logo
# Create on Prodigi (test mode)
mycopunk product create stickers/mushroom-logo --provider=prodigi --sandbox
```
### Batch Operations
```bash
# Export all active stickers
mycopunk batch export --type=stickers --status=active
# Push everything to production
MYCOPUNK_ENV=production mycopunk batch push --status=active
```