Files
claude-foundations/memory/script-setup-formatters.md
Paul O'Reilly c3a151a87b Backfill memory files for all existing scripts and skills
Creates MEMORY.md index and 10 memory files documenting:
- Scripts: context-load, start-claude, install-hooks, setup-formatters, git-status-report
- Skills: /log, /reflect-logs, /reflect, /distill-best-practices, /linter

Each file covers purpose, usage, how it works, and gotchas.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:10:47 +13:00

29 lines
999 B
Markdown

# script: setup-formatters
**Location:** `scripts/setup-formatters.sh`
## Purpose
Opts a project into the auto-formatting system by creating a `formatters/` directory with symlinks back to the canonical formatter scripts in claude-foundations.
## Usage
```bash
scripts/setup-formatters.sh <project-dir> <ext> [<ext> ...]
```
Run with no arguments to see available formatters: `py`, `sh`, `ts`, `js`, `sql`, `json`, `yaml`, `md`.
## How it works
1. Creates `<project-dir>/formatters/` if needed
2. Computes a relative path from the project's `formatters/` to `claude-foundations/formatters/`
3. Creates symlinks for each requested extension
4. If the project is a git repo and has no pre-commit hook, installs `pre-commit-lint.sh` as the git pre-commit hook
## Gotchas
- Uses `python3` for relative path computation — requires Python 3 available.
- Won't overwrite an existing pre-commit hook.
- The `formatters/` directory can be committed (symlinks) or gitignored — project's choice.