# Scripts Reference (Temporary)

## Scripts with AUTO-DETECTION (no argument = natural workflow)

These scripts work without arguments by auto-detecting the next batch/site:

| Script | Without Args | With Args |
|--------|-------------|-----------|
| `tools/design/run.sh` | Auto-finds sites with d/B/- status | `--sites "domain:title:desc:theme,..."` |
| `tools/implement/run.sh` | Auto-finds batch with D/O status | `--batch <id>` |
| `tools/implement/status.sh` | Shows active/latest batch | `<batch_id>` |
| `tools/implement/lock.sh` | Locks next ready batch | `<batch_id>` |

### Auto-Detection Priority

**Design phase** (`tools/design/run.sh`):
1. Sites with `d` status (in-progress) → continue
2. Sites with `B` status (batched) → start
3. Sites with `-` status (unassigned) → batch first

**Implement phase** (`tools/implement/run.sh`, `lock.sh`):
1. Batch with `i` status (in-progress) → continue
2. Batch with `O` status (ready) → start
3. Batch with `D` status (design done) → transition

## Helper: tools/shared/find-next.sh

Central utility for finding next work:

```bash
# Find next implement batch (JSON)
tools/shared/find-next.sh --registry .smbatcher/REGISTRY.md --mode batch --phase implement

# Find next design sites (simple output)
tools/shared/find-next.sh --registry .smbatcher/REGISTRY.md --mode sites --phase design --format simple

# Show status counts
tools/shared/find-next.sh --registry .smbatcher/REGISTRY.md --mode status

# Find active batch
tools/shared/find-next.sh --registry .smbatcher/REGISTRY.md --mode active
```

## Scripts with REQUIRED arguments

| Script | Required Arguments | Description |
|--------|-------------------|-------------|
| `tools/shared/lock-registry.sh` | `-- <command> [args...]` | Execute command with registry lock |
| `tools/design/register.sh` | `--sites "domain:title:desc[:theme],..."` | Register sites for design |
| `tools/design/batch.sh` | `--sites "domain:title:desc:theme,..."` | Create design batch from sites |
| `tools/check/file-stats.sh` | `<site-dir>` | Show file statistics for site |
| `tools/check/serve.sh` | `<site-dir> [port]` | Serve site locally |
| `tools/check/js-syntax.sh` | `<site-dir>` | Check JavaScript syntax |
| `tools/check/html-check.sh` | `<site-dir>` | Validate HTML |
| `tools/check/verify-site.sh` | `<site-dir>` | Verify site structure |
| `tools/check/tree-view.sh` | `<site-dir>` | Show site directory tree |
| `tools/check/design-compliance.sh` | `<site-dir>` | Check design compliance |
| `tools/check/select-themes.sh` | `"domain:title:desc:theme,..."` | Select themes for sites |
| `tools/check/mkdir-themes.sh` | `"domain:title:desc:theme,..."` | Create theme directories |
| `tools/check/batch-manage.sh` | `list \| register <domain> <title> [desc]` | Manage batches |

## Scripts with OPTIONAL arguments

| Script | Optional Arguments | Description |
|--------|-------------------|-------------|
| `tools/prepare/info.sh` | `[--root PATH] [--sites PATH] [--config PATH]` | Show prepare inputs summary |
| `tools/prepare/batch.sh` | `[--version vX] [--batch-size N] [--input-file PATH]` | Create prepare batch |
| `tools/prepare/register.sh` | `[--input-file PATH] [--sites "..."]` | Register sites for prepare |
| `tools/claude.sh` | `sync` | Claude sync operations |

## Python wrapper scripts (pass-through `$@`)

Arguments defined in corresponding `.py` files:

### design/
- `start.sh`, `complete.sh`, `check-design.sh`, `read-design.sh`, `write-design.sh`
- `list-designed.sh`, `analyze-seeds.sh`, `frequency.sh`, `check-dirs.sh`, `verify-post-design.sh`

### implement/
- `start.sh`, `complete.sh`, `finish.sh`, `generate.sh`, `check-outputs.sh`

### shared/
- `validate.sh`, `similarity.sh`, `find-next.sh`

## No arguments needed

| Script | Description |
|--------|-------------|
| `tools/chmod-scripts.sh` | Add execute permissions to all scripts |
| `tools/shared/ci-dry-run.sh` | CI dry run (limited sites) |
| `tools/shared/dry-run.sh` | Full dry run |
| `tools/shared/metrics.sh` | Show metrics |
| `tools/check/site-list.sh` | Parse and list sites from CSV |
| `tools/check/status-report.sh` | Show status report |
