Skip to content

Commit 6e11c8a

Browse files
committed
Add AGENTS.md
1 parent 8d00f05 commit 6e11c8a

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

AGENTS.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# styled-ppx Agent Handbook
2+
3+
## Mission
4+
- Deliver maintainer-grade support for `styled-ppx` while respecting user intent, repository conventions, and safety rules.
5+
- Keep the codebase healthy: clarify requests, surface risks early, and document important decisions.
6+
- Act as a multiplier for the team—favour clear communication, reproducible steps, and actionable suggestions.
7+
- Balance velocity with correctness; when unsure, ask instead of guessing.
8+
9+
## Overview
10+
11+
styled-ppx is a CSS-in-Reason/OCaml ppx (preprocessor extension) and a library that provides type-safe, compile-time verified CSS with minimal runtime overhead.
12+
13+
## Architecture
14+
15+
The project consists of three main components:
16+
17+
## Working Agreements
18+
- Never revert user-authored changes unless explicitly requested; coordinate if unexpected diffs appear.
19+
- Avoid commits unless the user asks; stage or push only after explicit approval.
20+
- Keep responses concise yet complete. Use Markdown, short headers when they aid scanning, and bulleted lists with consistent phrasing.
21+
- Use the todo list tool for multi-step tasks; update statuses as you progress.
22+
- If the user requests a “review”, switch to code-review tone: findings first, severity ordered, cite files/lines, then residual risks.
23+
24+
## Testing & Quality Assurance
25+
- Consult `testing.mdc` (see workspace testing rules) for the authoritative testing matrix and command catalogue.
26+
- Typical commands (run with the project dune path):
27+
- Unit/expect tests: `/Users/davesnx/Code/github/davesnx/styled-ppx/_opam/bin/dune test`
28+
- PPX snapshots: relevant dune aliases exist per package; confirm via `dune --help` or `dune describe`.
29+
- When tests are skipped (time, platform, or request), call out the gap and suggest how the user can validate.
30+
- Record observed failures with enough context (command, exit code, snippet of output) for reproducibility.
31+
32+
## Architecture Orientation
33+
- **Parser & Type Checker** (`packages/parser`, `packages/css-property-parser`): builds the CSS AST, validates properties via generated combinators (`[%value.rec ...]`), and produces rich error messages for invalid CSS.
34+
- **PPX Transformer** (`packages/ppx/src/ppx.re`): exposes interfaces like `[%styled.tag]`, `[%cx]`, `[%css]`, `[%cx2]`, and `[%keyframes]`; orchestrates parsing, validation, and code generation.
35+
- **Property → Runtime Bridge** (`packages/ppx/src/Property_to_runtime.re`): maps validated properties to runtime constructors, preserves interpolations, and decides extraction vs runtime emission.
36+
- **Runtimes** (`packages/runtime/native`, `.../melange`, `.../rescript`): emit CSS for native servers, JS environments, and ReScript compatibility. Shared types live in `packages/runtime/native/shared/Css_types.ml`.
37+
- **Extraction Pipeline**: `[%cx2]` is the only statically extracted path today; it generates CSS assets during compilation for zero runtime overhead.
38+
39+
## Common Tasks & Playbooks
40+
- **Feature work**: locate the relevant package, add parser rules or runtime constructors, extend PPX mapping, and update tests.
41+
- **Bug fixes**: reproduce with minimal repro (fixture or snapshot), craft targeted patches, and add regression coverage.
42+
- **Docs**: keep developer guides (like this file) up to date; cross-link to tooling instructions and testing docs.
43+
- **Reviews**: inspect diffs critically, reason about downstream impact (compile-time + runtime), and recommend follow-up tests when missing.
44+
45+
## Troubleshooting Tips
46+
- Regenerate snapshots via the appropriate dune alias if expect tests fail after legitimate changes.
47+
- If opam tooling appears missing, double-check the `_opam` switch integrity before troubleshooting dune.
48+
- Watch for generated code churn; understand the source generator before editing outputs directly.
49+
- When PPX errors are opaque, reproduce with `dune exec -- <binary>` or `dune build --verbose` to capture the PPX invocation.
50+
51+
## Reference
52+
- Repository root: `/Users/davesnx/Code/github/davesnx/styled-ppx`
53+
- Dune binary: `/Users/davesnx/Code/github/davesnx/styled-ppx/_opam/bin/dune`
54+
- Key docs: `AGENT.md` (this guide), `testing.mdc` (testing policies), `docs/` (additional design notes), `packages/*` (source code).
55+
- Prefer absolute paths in tool calls and explanations so transcripts remain unambiguous.
56+
57+
Stay curious, verify assumptions, and leave the repo healthier than you found it.

0 commit comments

Comments
 (0)