|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +Static website for the Contextual Dynamics Lab at Dartmouth College. Hosted on GitHub Pages at [context-lab.com](https://context-lab.com). Content pages (publications, people, software, news) are **auto-generated** from Excel spreadsheets via a Python build system — never edit the root HTML for those pages directly. |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Install dependencies |
| 13 | +pip install -r requirements-build.txt |
| 14 | + |
| 15 | +# Validate spreadsheet data |
| 16 | +cd scripts && python validate_data.py |
| 17 | + |
| 18 | +# Build all content pages (publications, people, software, news) |
| 19 | +cd scripts && python build.py |
| 20 | + |
| 21 | +# Build CV (requires XeLaTeX + Dartmouth Ruzicka fonts) |
| 22 | +cd scripts && python build_cv.py |
| 23 | + |
| 24 | +# Run full test suite |
| 25 | +python -m pytest tests/ -v |
| 26 | + |
| 27 | +# Run a single test file |
| 28 | +python -m pytest tests/test_build_publications.py -v |
| 29 | + |
| 30 | +# Pre-push validation (validation + build + tests) |
| 31 | +cd scripts && python pre_push_check.py |
| 32 | + |
| 33 | +# Local dev server |
| 34 | +python3 -m http.server 8000 |
| 35 | + |
| 36 | +# Add hand-drawn borders to images |
| 37 | +python scripts/add_borders.py image.png images/publications/ |
| 38 | +python scripts/add_borders.py photo.jpg images/people/ --face |
| 39 | + |
| 40 | +# Onboard new member (from scripts/ dir) |
| 41 | +python onboard_member.py "First Last" --rank "grad student" --photo headshot --skip-llm |
| 42 | + |
| 43 | +# Offboard member to alumni (from scripts/ dir) |
| 44 | +python offboard_member.py "member name" --end-year 2025 |
| 45 | + |
| 46 | +# Reconcile people across website, CV, and lab-manual |
| 47 | +cd scripts && python reconcile_people.py --dry-run # report only |
| 48 | +cd scripts && python reconcile_people.py # apply auto-fixes |
| 49 | + |
| 50 | +# Initialize lab-manual submodule (required for reconciliation) |
| 51 | +git submodule update --init |
| 52 | +``` |
| 53 | + |
| 54 | +## Architecture |
| 55 | + |
| 56 | +### Content Pipeline |
| 57 | + |
| 58 | +``` |
| 59 | +data/*.xlsx → scripts/build_*.py → root *.html (auto-generated) |
| 60 | + ↑ |
| 61 | + templates/*.html (markers like <!-- PUBLICATIONS_PAPERS -->) |
| 62 | +``` |
| 63 | + |
| 64 | +Each `build_*.py` follows the same pattern: |
| 65 | +1. Load spreadsheet with `utils.load_spreadsheet_all_sheets()` |
| 66 | +2. Generate HTML fragments |
| 67 | +3. Inject into template via `utils.inject_content(template, output, {"MARKER": html})` |
| 68 | + |
| 69 | +### Key Directories |
| 70 | + |
| 71 | +| Directory | Purpose | |
| 72 | +|-|-| |
| 73 | +| `data/` | Source spreadsheets (publications.xlsx, people.xlsx, software.xlsx, news.xlsx) + Dartmouth fonts | |
| 74 | +| `templates/` | HTML templates with `<!-- MARKER -->` injection points | |
| 75 | +| `scripts/` | Python build system, validation, onboarding/offboarding tools | |
| 76 | +| `tests/` | pytest suite — conftest.py adds `scripts/` to sys.path | |
| 77 | +| `documents/` | CV source (JRM_CV.tex) and generated outputs (PDF, HTML) | |
| 78 | +| `css/style.css` | Single stylesheet with CSS variables at top | |
| 79 | +| `js/main.js` | All JS components (9 init functions) | |
| 80 | +| `lab-manual/` | Git submodule — [ContextLab/lab-manual](https://github.com/ContextLab/lab-manual) (init with `git submodule update --init`) | |
| 81 | + |
| 82 | +### CV Pipeline |
| 83 | + |
| 84 | +`documents/JRM_CV.tex` → `scripts/build_cv.py` + `scripts/extract_cv.py` (custom LaTeX→HTML parser) → `documents/JRM_CV.pdf` + `documents/JRM_CV.html` |
| 85 | + |
| 86 | +### GitHub Actions |
| 87 | + |
| 88 | +- **build-content.yml**: Triggers on changes to `data/`, `templates/`, `scripts/`. Validates, builds, runs tests, auto-commits regenerated HTML. |
| 89 | +- **build-cv.yml**: Triggers on changes to `documents/JRM_CV.tex`, CV scripts, or `css/cv.css`. Compiles LaTeX, runs tests, auto-commits PDF+HTML. |
| 90 | + |
| 91 | +## Critical Rules |
| 92 | + |
| 93 | +- **Never edit auto-generated root HTML** (`publications.html`, `people.html`, `software.html`, `news.html`) — edit `data/*.xlsx` or `templates/*.html` instead |
| 94 | +- **Never use `!important`** in CSS without explicit justification |
| 95 | +- **Never add inline styles** to templates — use CSS classes |
| 96 | +- **Always run tests before pushing**: `python -m pytest tests/ -v` |
| 97 | +- **All headings are lowercase** via `text-transform: lowercase` in CSS |
| 98 | + |
| 99 | +## Design System |
| 100 | + |
| 101 | +- **Colors**: `--primary-green: rgb(0, 112, 60)`, `--bg-green: rgba(0, 112, 60, 0.2)`, `--dark-text: rgba(0, 0, 0, 0.7)` |
| 102 | +- **Font**: Nunito Sans, 300 weight body, 14px base, 1.7 line-height |
| 103 | +- **Images**: 500x500px with hand-drawn green borders (use `scripts/add_borders.py`), face-detect cropping for people photos (`--face`) |
| 104 | +- **Forms**: Formspree backend — endpoint in form `action` attribute |
0 commit comments