This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
pnpm build- Build all packages via Turbo (recommended)pnpm clean- Clean build artifacts
pnpm test- Run all testspnpm dev- Start Vite dev server for browser testingpnpm test:node- Run Node.js tests via Turbo
To run a single test or test module, use the browser test interface with pnpm dev and filter tests using the QUnit UI.
pnpm lint- Run ESLint quietlypnpm lint:fix- Auto-fix linting issues and format with Prettier (required before commits)pnpm lint:check- Check Prettier formattingpnpm lint:types- Type check all packages via Turbopnpm lint:all- Run all linting checkspnpm lint:published- Lint published packages
These commands MUST be run before pushing to ensure CI passes:
pnpm lint:fix- Fix formatting and lintingpnpm repo:update:conventions- Update package conventionspnpm repo:update:metadata- Update package metadata
The CI "Verify" job will fail if these commands produce uncommitted changes.
Glimmer VM is a compiler-based rendering engine that compiles Handlebars templates into bytecode for efficient execution and updates.
- Templates (Handlebars) → Compiler → Bytecode (Wire Format)
- Bytecode → Runtime VM → DOM Operations
- State Changes → Validator System → Targeted Updates
Compilation Pipeline:
@glimmer/syntax- Template parser and AST (uses visitor pattern for traversal)@glimmer/compiler- Compiles templates to bytecode@glimmer/wire-format- Bytecode format definitions@glimmer/opcode-compiler- Bytecode generation
Runtime Engine:
@glimmer/runtime- VM that executes bytecode@glimmer/vm- Core VM implementation@glimmer/reference- Reactive reference system for state tracking@glimmer/validator- Change detection and invalidation
Extension Points:
@glimmer/manager- Component/helper/modifier manager APIs@glimmer/interfaces- TypeScript interfaces and contracts
- Uses pnpm workspaces with Turbo for orchestration
- Packages in
packages/@glimmer/*are published to npm - Packages in
packages/@glimmer-workspace/*are internal tools - Each package has its own tsconfig with varying strictness levels
- Node version requirement: >= 22.12.0
- "Friend" properties use bracket notation:
object['_privateProperty'] - This allows cross-package internal access while maintaining type safety
- Different packages have different strictness levels in their tsconfig
- Integration tests in
@glimmer-workspace/integration-tests - Unit tests colocated with packages
- Browser tests use QUnit + Vite
- Node tests use Vitest
- Smoke tests verify package compatibility
The codebase includes sophisticated debug tooling:
check()function for runtime type checking (stripped in production by babel plugin)@glimmer/debugpackage for development-time debugging- Stack checking and validation in development builds
# For Node tests (Vitest)
cd packages/@glimmer/[package-name]
pnpm test:node -- path/to/test.ts
# For browser tests
pnpm dev
# Then navigate to the browser and use the QUnit filterIf you modify the AST structure in @glimmer/syntax:
- Run smoke tests:
cd smoke-tests/node && pnpm test:node - Update snapshots if needed:
pnpm vitest run -u - Document why changes are not breaking (visitor pattern protection)
Always run these commands to avoid CI failures:
pnpm lint:fix
pnpm repo:update:conventions
pnpm repo:update:metadata
git add -A && git commit- Write clear, concise commit messages that explain the change
- Do not include Claude attribution or automated generation notices
- Focus on the "why" and "what" of the change, not implementation details
- Squashing commits is often preferred for complex PRs
- When rebasing, be prepared to resolve conflicts in package.json, eslint.config.js, and build configs
- The babel debug plugin pattern requires
check()calls to be inline (not inside if blocks) for proper type narrowing
- Use
turbo <task>directly (withoutrun) for consistency - Common aliases added for better DX:
pnpm build→ builds all packagespnpm dev→ starts development server
- Caching enabled for deterministic tasks (lint, test:node, prepack)
- Proper input/output declarations for better cache hits
- Environment variables tracked: NODE_ENV, CI
- TUI enabled for better progress visualization
prepackdepends on upstream packages (^prepack)test:publintdepends onprepackto validate built packages- Type checking depends on all packages being built first