|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Commands |
| 6 | + |
| 7 | +### Building |
| 8 | +- `pnpm run build:control` - Build all packages using Rollup |
| 9 | +- `pnpm clean` - Clean build artifacts |
| 10 | +- `pnpm repo:prepack` - Prepare packages for publishing via Turbo |
| 11 | + |
| 12 | +### Testing |
| 13 | +- `pnpm test` - Run all tests |
| 14 | +- `ember test --server` - Run tests in watch mode (recommended for development) |
| 15 | +- `pnpm test:node` - Run Node.js tests via Turbo |
| 16 | +- `pnpm test:smoke` - Run smoke tests |
| 17 | +- `pnpm test:browserstack` - Run cross-browser tests |
| 18 | +- `pnpm start` - Start Vite dev server for browser testing at http://localhost:7357/tests/ |
| 19 | + |
| 20 | +To run a single test or test module, use the browser test interface with `pnpm start` and filter tests using the QUnit UI. |
| 21 | + |
| 22 | +### Linting & Type Checking |
| 23 | +- `pnpm test:lint` - Run ESLint |
| 24 | +- `pnpm lint:fix` - Auto-fix linting issues and format with Prettier |
| 25 | +- `pnpm lint:format` - Check Prettier formatting |
| 26 | +- `pnpm repo:lint:types` - Type check all packages via Turbo |
| 27 | + |
| 28 | +### Development |
| 29 | +- `pnpm repo:update:metadata` - Update package metadata |
| 30 | +- `pnpm repo:update:conventions` - Update conventions across packages |
| 31 | + |
| 32 | +### Automated Code Fixes |
| 33 | +- `node bin/fixes/apply-eslint-suggestions.js <file> [rule]` - Apply ESLint suggestions |
| 34 | +- `node bin/fixes/apply-ts-codefixes.js <file> [error-code]` - Apply TypeScript code fixes |
| 35 | +- `node bin/fixes/apply-suggestions.js <file> [type]` - Apply both ESLint and TS fixes |
| 36 | +- `node bin/fixes/list-available-fixes.js <file>` - Show available fixes |
| 37 | + |
| 38 | +These tools help both humans and LLMs systematically fix linting issues by applying official ESLint suggestions and TypeScript Language Service code fixes, rather than guessing at solutions. |
| 39 | + |
| 40 | +## Architecture |
| 41 | + |
| 42 | +Glimmer VM is a **compiler-based rendering engine** that compiles Handlebars templates into bytecode for efficient execution and updates. |
| 43 | + |
| 44 | +### Core Flow |
| 45 | +1. **Templates** (Handlebars) → **Compiler** → **Bytecode** (Wire Format) |
| 46 | +2. **Bytecode** → **Runtime VM** → **DOM Operations** |
| 47 | +3. **State Changes** → **Validator System** → **Targeted Updates** |
| 48 | + |
| 49 | +### Key Packages |
| 50 | + |
| 51 | +**Compilation Pipeline**: |
| 52 | +- `@glimmer/syntax` - Template parser and AST |
| 53 | +- `@glimmer/compiler` - Compiles templates to bytecode |
| 54 | +- `@glimmer/wire-format` - Bytecode format definitions |
| 55 | +- `@glimmer/opcode-compiler` - Bytecode generation |
| 56 | + |
| 57 | +**Runtime Engine**: |
| 58 | +- `@glimmer/runtime` - VM that executes bytecode |
| 59 | +- `@glimmer/vm` - Core VM implementation |
| 60 | +- `@glimmer/reference` - Reactive reference system for state tracking |
| 61 | +- `@glimmer/validator` - Change detection and invalidation |
| 62 | + |
| 63 | +**Extension Points**: |
| 64 | +- `@glimmer/manager` - Component/helper/modifier manager APIs |
| 65 | +- `@glimmer/interfaces` - TypeScript interfaces and contracts |
| 66 | + |
| 67 | +### Monorepo Structure |
| 68 | +- Uses pnpm workspaces with Turbo for orchestration |
| 69 | +- Packages in `packages/@glimmer/*` are published |
| 70 | +- Packages in `packages/@glimmer-workspace/*` are internal tools |
| 71 | +- Each package has its own tsconfig with varying strictness levels |
| 72 | + |
| 73 | +### Testing Strategy |
| 74 | +- Integration tests in `@glimmer-workspace/integration-tests` |
| 75 | +- Unit tests colocated with packages |
| 76 | +- Browser tests use QUnit + Testem |
| 77 | +- Node tests use Vitest |
| 78 | + |
| 79 | +## Local Debug Functions |
| 80 | + |
| 81 | +The `check()`, `expect()`, `localAssert()`, and other debug functions from `@glimmer/debug` are **only for local development** while working on the Glimmer VM codebase. They must not appear in any published builds (neither development nor production). |
| 82 | + |
| 83 | +These functions are automatically stripped from all builds using a Babel plugin during the build process. This allows developers to write assertions freely during development without worrying about them appearing in published packages. |
| 84 | + |
| 85 | +## Contribution Guidelines |
| 86 | + |
| 87 | +### Commit Messages |
| 88 | +- Write clear, concise commit messages that explain the change |
| 89 | +- **REQUIRED: Do not include Claude attribution or automated generation notices** - this violates project specifications |
| 90 | +- Focus on the "why" and "what" of the change, not implementation details |
| 91 | +- All commits must appear as standard developer contributions |
0 commit comments