Skip to content

Commit fbf1652

Browse files
committed
Add AGENTS.md
1 parent e3d6ca1 commit fbf1652

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

AGENTS.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# AGENTS.md
2+
3+
## Project Overview
4+
5+
`create-rescript-app` is the official CLI tool for scaffolding new ReScript applications. It supports creating projects from templates and adding ReScript to existing JavaScript projects. The tool is written in ReScript and distributed as a bundled Node.js CLI.
6+
7+
## Coding Style & Naming Conventions
8+
9+
- Make sure to use modern ReScript and not Reason syntax! Read https://rescript-lang.org/llms/manual/llm-small.txt to learn the language syntax.
10+
- Formatting is enforced by `rescript format`; keep 2-space indentation and prefer pattern matching over chained conditionals.
11+
- Module files are PascalCase (`Templates.res`), values/functions camelCase, types/variants PascalCase, and records snake_case fields only when matching external JSON.
12+
- Keep `.resi` signatures accurate and minimal; avoid exposing helpers that are template-specific.
13+
- When touching templates, mirror upstream defaults and keep package scripts consistent with the chosen toolchain.
14+
15+
## Package Manager Support
16+
17+
- Detects and supports npm, yarn, pnpm, and bun
18+
- Handles existing project detection based on presence of `package.json`
19+
- Adapts installation commands based on detected package manager
20+
21+
## Directory Structure
22+
23+
- **`src/`**: ReScript source files
24+
- **`lib/`**: Generated build artifacts from ReScript compiler (do not edit)
25+
- **`out/`**: Production bundle (`create-rescript-app.cjs`) for distribution
26+
- **`templates/`**: Project starter templates (keep self-contained)
27+
- **`bindings/`**: External library bindings (ClackPrompts, CompareVersions)
28+
29+
## Development Commands
30+
31+
- **`npm start`** - Run CLI directly from source (`src/Main.res.mjs`) for interactive testing and development
32+
- **`npm run dev`** - Watch ReScript sources and rebuild automatically to `lib/` directory
33+
- **`npm run prepack`** - Compile ReScript and bundle with Rollup into `out/create-rescript-app.cjs` (production build)
34+
- **`npm run format`** - Apply ReScript formatter across all source files
35+
36+
## Testing and Validation
37+
38+
- **Manual Testing**: No automated test suite - perform smoke tests by running the CLI into a temp directory
39+
- **Template Validation**: After changes, test each template type (basic/Next.js/Vite) to ensure templates bootstrap cleanly
40+
- **Build Verification**: Run `npm run prepack` to ensure the production bundle builds correctly
41+
42+
## Build System
43+
44+
- **ReScript Compiler**: Outputs ES modules in-source (`src/*.res.mjs`) with configuration in `rescript.json`
45+
- **Rollup Bundler**: Creates `out/create-rescript-app.cjs` CommonJS bundle for distribution
46+
47+
## Template Modification Guidelines
48+
49+
When modifying templates:
50+
51+
1. Maintain consistency with upstream toolchain defaults
52+
2. Ensure package scripts match the chosen build tool (Vite, Next.js, etc.)
53+
3. Keep templates self-contained with their own dependencies
54+
4. Test template bootstrapping after modifications

0 commit comments

Comments
 (0)