agentleFS
MicrosoftKnown publishermicrosoft/beachball/AGENTS.md

beachball

AGENTS.md816 starsChanged 6 months agoMITView on GitHub

Trust these instructions. Only search the codebase if information here is incomplete or found to be in error (notify the user if an error is found). Following these steps will minimize failed commands and CI rejections. Beachball is a CLI tool for automating semantic version bumping, changelog generation, and npm publishing in monorepos and single-package repos. This repo is a Yarn 4 monorepo of ~2,000 files. The main deliverable is the beachball npm package. Always run yarn --immutable first if…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository3 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

14 rules. About 0 are common, 3 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always run yarn --immutable first: if dependencies may be out of date.

    line 24
  2. Distinctive:

    When validating the entire repo, run the following commands in order:

    line 28
  3. Very specific:

    When developing in a single package, use these commands first before building/validating the entire repo.

    line 44
  4. Very specific:

    Prefer scripts over running binaries directly.

    line 59
  5. Very specific:

    Run all of: yarn build, yarn test, and yarn lint.

    line 63
  6. Very specific:

    Use the /beachball-change-file skill to generate a Beachball change file if needed.

    line 67
  7. Distinctive:

    Check whether documentation site or CLI help text updates are needed.

    line 68
  8. Very specific:

    Imports: use import "fs/promises" directly (not fs.promises) to enable Jest mocking.

    line 102
  9. Very specific:

    Markdown: use sentence case for headings.

    line 105
  10. Very specific:

    Import Jest APIs from @jest/globals (no implicit globals).

    line 111
  11. Very specific:

    Prefer real generator functions or __fixtures__ helpers over hand-building complex objects (PackageInfos, ChangeInfo, BumpInfo, …

    line 112
  12. Distinctive:

    When testing a function with complex parameters, consider creating a wrapper function in the test which fills in common defaults.

    line 113
  13. Very specific:

    Prefer complete value assertions (toEqual({...}), toEqual([...])) over partial matchers.

    line 116
  14. Very specific:

    When adding a new page, you MUST add it to the sidebar in docs/.vuepress/config.ts.

    line 126

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Beachball copilot instructions

Trust these instructions. Only search the codebase if information here is incomplete or found to be in error (notify the user if an error is found). Following these steps will minimize failed commands and CI rejections.

What this repo is

Beachball is a CLI tool for automating semantic version bumping, changelog generation, and npm publishing in monorepos and single-package repos. This repo is a Yarn 4 monorepo of ~2,000 files. The main deliverable is the beachball npm package.

  • Runtime: Node.js >=22.18.0 (repo developed on Node 22; CI also runs Node 24). TypeScript files can be run directly with node (no extra flags).
  • Language: TypeScript ~6.0. The beachball and p-graph package output is CommonJS (other packages use ESM).
  • Package manager: Yarn 4 (Berry), nodeLinker: node-modules. Some dependency versions are shared via Yarn catalogs (catalogs in .yarnrc.yml). Never use npm install.
  • Task runner: lage orchestrates build, test, lint across workspaces (config: lage.config.js).
  • Testing: Jest 30 via Babel.
  • Linting/formatting: ESLint 9 flat config + Prettier.
  • Dependency consistency: syncpack + depcheck.

Branches

  • main (default): development for beachball v3 (alpha). Breaking changes allowed.
  • v2: current stable release. Non-breaking changes should target v2.

Build and validation commands

Always run yarn --immutable first if dependencies may be out of date.

Repo root commands

When validating the entire repo, run the following commands in order:

StepCommandNotes / timing (validated)
Installyarn --immutableRequired before any build/test/lint.
Buildyarn build~8s. Runs lage build bundle across all workspaces.
Lintyarn lint~10s. Runs eslint + depcheck + syncpack via lage.
Test (all)yarn testRuns all workspace tests via lage.
Update snapshotsyarn update-snapshotsUse after intentional output changes.

Do NOT run jest or tsc directly from the repo root. yarn build and yarn lint must succeed with zero warnings.

The pre-commit hook runs Prettier (yarn format) automatically on all staged files using lint-staged. Do not manually run yarn format, Prettier, or a formatting check after routine edits. Run formatting commands only when explicitly requested, when preparing a PR without committing locally, or when diagnosing a formatting failure.

Package-level commands

When developing in a single package, use these commands first before building/validating the entire repo. Run cd packages/<name> then:

TaskCommand
Build a single packageyarn build
Test (packages other than beachball)yarn test
(beachball) All tests, correct orderyarn test:all
(beachball) All unit testsyarn test:unit (~3s)
(beachball) All functional testsyarn test:func
(beachball) All E2E testsyarn test:e2e (slow)
Single test file/name (wraps jest), ANY packageyarn test <path or name>
Update snapshotsyarn update-snapshots

In the beachball package, do NOT use test:* commands to run a single test. Use yarn test <path or name>.

Prefer scripts over running binaries directly. If you must run a binary such as jest, use yarn run -T <binary>.

Required before each commit

Run all of: yarn build, yarn test, and yarn lint. Prettier runs automatically in the pre-commit hook.

Required before creating a PR

  • Use the /beachball-change-file skill to generate a Beachball change file if needed. Sometimes it's not needed, but verify by running yarn checkchange (CI also runs this).
  • Check whether documentation site or CLI help text updates are needed.

Repo layout

  • packages/beachball — main package (see architecture below).
  • packages/p-graph — promise graph runner, used by beachball.
  • packages/proper-changelog — changelog/release notes helper.
  • packages/esrp-npm-release — helper for the Microsoft release process.
  • scripts — repo-internal scripts (@microsoft/beachball-scripts); shared build/test/eslint config lives in scripts/config.
  • actions/* — GitHub Action definitions (check-for-modified-files, install-beachball, should-release); their dist/ is committed and must be rebuilt via yarn build+yarn bundle if src changes.
  • yarn-plugins/* — Yarn v4 plugins (engines, npmrc) loaded by the repo's own .yarnrc.yml. Each builds a bundle via yarn build+yarn bundle into a committed dist/plugin.js, which must be rebuilt and committed if src changes. See yarn-plugins/README.md.
  • renovate/ - Renovate presets migrated from m365-renovate-config; scripts under renovate/scripts; presets under renovate/presets; auto-updated readme
  • docs/ — Vuepress documentation site with its own separate Yarn install.
  • change/ — pending Beachball change files (JSON).
  • Root config: beachball.config.js, lage.config.js, syncpack.config.js, .prettierrc.json5, .yarnrc.yml. Per-package: tsconfig.json, jest.config.js, eslint.config.*.

beachball package architecture (paths under packages/beachball)

  • Entry point: src/cli.ts dispatches commands: check, change, bump, publish, canary, sync, init, config.
  • src/commands/ — command implementations.
  • src/bump/ — version bump calculation (bumpInMemory is the core algorithm).
  • src/changefile/ — reading/writing/prompting for change files.
  • src/changelog/ — changelog generation (markdown + JSON).
  • src/monorepo/ — package discovery (workspace-tools), dependency graph, package groups.
  • src/publish/ — npm publish orchestration, git tagging, dependency-ordered publishing.
  • src/git/ — git operation wrappers using nano-spawn.
  • src/options/ — CLI arg parsing + config loading.
  • src/validation/ — pre-command validation.
  • src/types/ — TypeScript interfaces (BeachballOptions is the central config type).
  • Option resolution: CLI args > config (usually beachball.config.js) > defaults. getOptions() returns both raw cliOptions and merged options.

Coding standards

  • No global state: process.cwd(), process.chdir(), and process.exit() are banned via ESLint. Pass an explicit cwd. process.exit() may only be used in cli.ts.
  • Imports: use import "fs/promises" directly (not fs.promises) to enable Jest mocking. Use import type for type-only imports (enforced).
  • Naming: camelCase or PascalCase; unused parameters prefixed with _.
  • Style: Prettier — single quotes, 120 char width, ES5 trailing commas.
  • Markdown: use sentence case for headings. NEVER manually wrap lines in .md files (except within code blocks).

Testing standards

packages/beachball has three Jest projects: unit (src/__tests__/, no filesystem), functional (src/__functional__/, realistic setups / real filesystem), e2e (src/__e2e__/, full commands, uses verdaccio). Fixtures/mock factories are in src/__fixtures__/.

  • Import Jest APIs from @jest/globals (no implicit globals).
  • Prefer real generator functions or __fixtures__ helpers over hand-building complex objects (PackageInfos, ChangeInfo, BumpInfo, BeachballOptions).
  • When testing a function with complex parameters, consider creating a wrapper function in the test which fills in common defaults.
  • Any test that writes to the console must call initMockLogs().
  • Beachball's logs are its UI. Often, tests should include complete inline snapshots of output (especially if it's only a few lines).
  • Prefer complete value assertions (toEqual({...}), toEqual([...])) over partial matchers.

Documentation site

Vuepress site under docs/ with a separate Yarn install. (Ignore docs/v2/ when reading or updating documentation unless the task explicitly targets the v2 docs.)

To edit/validate:

  1. cd docs && yarn --immutable (install docs deps first).
  2. yarn docs:build to validate.
  3. When adding a new page, you MUST add it to the sidebar in docs/.vuepress/config.ts.

You must update the doc site when adding a new option or command.

CI checks (must pass before merge)

Defined in .github/workflows/pr.yml. Replicate locally with the commands above.

  • build job (ubuntu + windows, node 22/npm 10 and node 24/npm 11): yarn --immutable, yarn build --verbose, yarn checkchange --verbose, yarn format:check and yarn lint --verbose (ubuntu/node22 only), yarn test --verbose, plus extra Windows-bash tests.
  • actions job: builds, then runs check-for-modified-files — if action dist/ changed, run yarn build and commit the updated dist files.
  • docs job: cd docs && yarn --immutable && yarn docs:build.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.