# Skill: Quality Sweep

Full automated quality sweep across the entire codebase. Detects regressions, violations, and quality issues. This is the overnight watchdog.

Run all checks below sequentially. For each check, use the Grep tool (not bash grep) for local file scanning, and Bash for remote/build commands. Report a summary at the end.

## Checks

### 1. TypeScript Type Check
Run in bash:
```bash
cd /Users/dorian/Projects/archy/neode-ui && npx vue-tsc --noEmit 2>&1 | tail -20
```
PASS = zero errors. Count any errors found.

### 2. Frontend Violations
Use the Grep tool to scan `neode-ui/src/` for each pattern. Count matches for each:

**Silent catch blocks** — pattern: `catch\s*\(\s*\)\s*=>?\s*\{\s*\}` or `\.catch\(\(\)\s*=>\s*\{\}` in `*.vue` and `*.ts` files

**console.log in prod** — pattern: `console\.(log|warn|error)` in `*.vue` and `*.ts` files. Exclude lines containing `import.meta.env.DEV` or `// dev-only`

**any type usage** — pattern: `:\s*any[^a-zA-Z]|as\s+any[^a-zA-Z]` in `*.vue` and `*.ts` files. Exclude `.d.ts` files

**TODO/FIXME/HACK** — pattern: `TODO|FIXME|HACK|XXX` in `*.vue` and `*.ts` files

**Banned CSS classes** — pattern: `gradient-button|gradient-card` in `*.vue` files

### 3. Backend Violations (via SSH)
Run in bash:
```bash
ssh -i ~/.ssh/archipelago-deploy archipelago@192.168.1.228 "
  echo '--- unwrap/expect ---'
  grep -rn 'unwrap()\|\.expect(' ~/archy/core/archipelago/src/ ~/archy/core/container/src/ ~/archy/core/security/src/ --include='*.rs' | grep -v test | grep -v '_test.rs' | grep -v target/ | wc -l

  echo '--- println/eprintln ---'
  grep -rn 'println!\|eprintln!' ~/archy/core/ --include='*.rs' | grep -v test | grep -v target/ | wc -l

  echo '--- TODO/FIXME ---'
  grep -rn 'TODO\|FIXME\|HACK' ~/archy/core/ --include='*.rs' | grep -v target/ | wc -l
"
```

### 4. Hardcoded Credentials
Use Grep tool locally — pattern: `archipelago123|password123` in `core/` and `scripts/` directories, excluding `target/`, `node_modules/`, and `deploy-config.sh`

### 5. Server Health
Run in bash:
```bash
ssh -i ~/.ssh/archipelago-deploy archipelago@192.168.1.228 "
  echo 'service:' \$(systemctl is-active archipelago)
  echo 'health:' \$(curl -s -o /dev/null -w '%{http_code}' http://localhost:5678/health)
  echo 'containers:' \$(podman ps -q 2>/dev/null | wc -l || docker ps -q | wc -l)
  echo 'errors:' \$(journalctl -u archipelago --since '1 hour ago' --no-pager -p err 2>/dev/null | wc -l)
  echo 'disk:' \$(df -h / | tail -1 | awk '{print \$5}')
"
```

### 6. Frontend Build
Run in bash:
```bash
cd /Users/dorian/Projects/archy/neode-ui && npm run build 2>&1 | tail -5
```
PASS = exit code 0.

## Report Format

After all checks, output a summary exactly like this:

```
=== SWEEP REPORT ===

TypeScript:      PASS/FAIL (N errors)
Silent catches:  PASS/FAIL (N)
Console.log:     PASS/FAIL (N)
Any types:       PASS/FAIL (N)
TODOs:           PASS/FAIL (N)
Banned classes:  PASS/FAIL (N)
Backend unwrap:  PASS/FAIL (N)
Backend println: PASS/FAIL (N)
Hardcoded creds: PASS/FAIL (N)
Server health:   PASS/FAIL
Frontend build:  PASS/FAIL

Total violations: N
```

PASS = zero violations for that check. FAIL = one or more.

## Auto-Fix Rules

Safe to auto-fix without asking:
- `cargo fmt --all` on dev server (formatting only)
- Trailing whitespace removal
- Import ordering

Do NOT auto-fix (flag for review):
- Error handling changes
- Logic or behavior changes
- Anything in core/ Rust files beyond formatting

## Reference

Full plan with weekly task breakdown: `plan.md` (project root)
Current week's focus determines which violations are highest priority.
