homebrew-fonts/CLAUDE.md
Matt Troutman 96f96c919b
Repo cleanup: fix .gitignore, process 11 new fonts from To Sort, remove duplicates
- Fix .gitignore: use correct .DS_Store pattern, add __pycache__/, *.pyc, .pytest_cache/, Icon?
- Remove tracked Icon file from git
- Add 11 new fonts: copixel, depixel, fresh-christmas, introvert, lazare-grotesk, neopixel, pixel-crash, pixel-gamer, pixel-grid, qraydom, space-rabbit
- Remove duplicate pixelon from To Sort
- Clean up empty Webfonts directory in depixel
- Clear processed fonts from To Sort
- Add CLAUDE.md for Claude Code guidance
- All 934 tests passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 21:01:00 -06:00

2.7 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What This Is

A Homebrew tap for custom fonts. Users brew tap and then brew install font-<name>. The repo contains font assets in font_files/ and generated Ruby formulae in Formula/.

Commands

# Add or update a font (cleanup + formula generation + tests + brew audit)
uv run add-font <path_or_name>
uv run add-font <path_or_name> --no-test --no-audit

# Run tests
uv run pytest tests/ -v --tb=short

# Run a single test file
uv run pytest tests/test_font_structure.py -v

# Run tests for a specific font
uv run pytest tests/ -v -k "font-acrylic-hand"

# Regenerate all formulae (without the full add-font flow)
python3 .fontfoldercleanup/create_homebrew_formula.py

# Reorganize font folders only
python3 .fontfoldercleanup/cleanup_font_folders.py --path font_files

Architecture

  • font_files/font-<name>/ — Each font has exactly 4 subdirs: ttf/, otf/, web/, other_files/. No other top-level files allowed.
  • Formula/font-<name>.rb — Generated Ruby formulae. Never edit by hand. Edits go in .fontfoldercleanup/create_homebrew_formula.py.
  • tap_cli/main.py — The add-font CLI entry point. Copies font to font_files/, runs cleanup script, runs formula generator, then runs tests and brew audit.
  • .fontfoldercleanup/cleanup_font_folders.py — Sorts loose font files into ttf/, otf/, web/, other_files/ subdirs.
  • .fontfoldercleanup/create_homebrew_formula.py — Scans font_files/font-* and writes one .rb per font. Contains HomebrewFormulaGenerator class and formula_name_to_class() for Ruby PascalCase conversion.
  • tests/ — Parametrized pytest suite. Tests validate: folder structure, formula existence, formula content (paths, class name), no orphan formulae, no duplicates.
  • To Sort/ — Staging area for new downloads not yet processed.

Formula Naming Convention

font-<name> → Ruby class Font<PascalCase>. Split on hyphens/underscores, capitalize each part:

  • font-acrylic-handFontAcrylicHand
  • font-graham_handFontGrahamHand

Key Constraints

  • Python 3, standard library only (pathlib, shutil, argparse, re). pytest is the sole dependency.
  • Formulae download from http://clancy.genet-godzilla.ts.net:3002/Fonts/homebrew-fonts/archive/main.tar.gz and expect the archive to unpack as homebrew-fonts-main/.
  • CI runs uv run pytest on push/PR to main, plus brew audit on macOS (non-blocking).
  • PROJECT.md is the canonical project description. When updating project rules, update PROJECT.md first, then sync .cursorrules, .github/copilot-instructions.md, and .claude/skills/project-context/SKILL.md.