This file provides guidance to Claude Code and Copilot when working with code in this repository.
Lage ("make" in Norwegian) is a task runner for JavaScript/TypeScript monorepos. It pipelines npm scripts across packages so that, for example, test can start as soon as its own package's build finishes rather than waiting for all builds. This is a Yarn Berry (v4) workspace monorepo with ~28 packages under packages/.
yarn build # transpile + types + bundle
yarn test # run all tests via lage
yarn lint # lint all packages
yarn api # update API report files
yarn ci # full CI: transpile, types, build, test, lint, bundle, api
yarn format # prettier --write
yarn format:check # prettier --check
yarn change # create beachball change files for versioning
yarn checkchange # validate change files exist
yarn deps:check # dependency audit (depcheck)
yarn lage-local # run the locally-built lage CLI (node packages/lage/dist/lage.js)cd packages/<name>
yarn test # all tests in that package
yarn test --testNamePattern="pattern" # specific test by nameyarn run -T runs the command using the root-installed tool (jest, tsc, etc.).
cd packages/<name>
yarn build # transpile and type checkIf changes span multiple packages, you should yarn build from the root. This is the best way to ensure all dependencies build in proper order.
To verify changes to a single package:
cd packages/<name>
yarn build
yarn lint
yarn test
yarn apiBefore finalizing changes, run yarn ci from the root for complete build/test/lint verification.
lageβ CLI entry point, esbuild-bundled intodist/lage.jscliβ CLI implementation (depends on nearly all other packages)schedulerβ Task scheduling enginetarget-graphβ Builds the dependency graph of tasks (targets) across packagesrunnersβ Task runner implementations (npm script, worker)cacheβ Caching layer (wrappingbackfill-cache)hasherβ Content hashing for cache invalidationconfigβ Configuration loading via cosmiconfigworker-threads-poolβ Worker thread managementreportersβ Output formatting
The repo also contains the backfill family of packages. backfill is the underlying caching library for lage.
backfillβ CLI entry point (yargs-based), not directly used bylagebackfill-cacheβ Cache providers (local tar + Azure blob storage)backfill-configβ Configuration loading (find-up based)backfill-hasherβ Git-based content hashing (lageuses some of the utilities but not the mainHasherclass)backfill-loggerβ Logging and output handlingbackfill-utils-dotenvβ Loads.envvariables intoprocess.env
The workspace-tools helper library is also hosted in this repo.
@lage-run/monorepo-scripts (aliased as monorepo-scripts bin) provides shared build commands (transpile, lint, etc) used by all packages. Shared configs live in scripts/config/ (jest, eslint, tsconfig base).
lib/β transpiled JS + type declarations (all packages exceptlage)dist/β esbuild bundle (lagepackage only)
- TypeScript strict mode, ES2020 target, CommonJS modules
- Consistent type imports required: use
import type { Foo }orimport { type Foo, ValueBar } - File extensions required in TS imports: e.g.,
import { foo } from "./foo.js" - No
require()in .ts files - No
console.logβ use the logger package - No floating promises β all promises must be awaited
- Explicit return types on exported functions
- Prettier: 140 char width, double quotes, 2-space indent, LF line endings
- Pre-commit hook runs prettier via lint-staged
Every PR must include a beachball change file. beachball normally uses an interactive CLI prompt, but an alternative is as follows:
- Stage or commit all changes
- Run
yarn checkchangeto get the list of changed packages detected bybeachball(this excludes certain files such as tests) - Create a file in the following format under
change/change-<random guid>.json. There should be achangesentry for each package withtypeset to the appropriate semver change type.
{
"changes": [
{
"type": "<patch|minor|major|none>",
"comment": "<describe changes to this package>",
"packageName": "<name>",
"email": "email not defined",
"dependentChangeType": "<'none' if 'type' is 'none', 'patch' otherwise>"
}
]
}