# lerna/lerna — codebase unpack

> Canonical page: https://codevetter.com/unpack/lerna

This is a deterministic Repo Unpack scan of lerna/lerna — a structural map, not a review, security audit, or maintainer-endorsed description.

- Scanned commit: ce3e38f2889b26573f1b38cfb487546903292158 (2026-10-02)
- Last upstream commit: chore: update dependency oxfmt to v0.70.0 (#4538)
- Generated by codevetter 1.15.0 on 2026-10-02
- 1479 files scanned · 3.7 MB

Source inspection; upstream code and tests were not executed.

## Languages

- JSON: 652 files
- TypeScript: 591 files
- Markdown: 73 files
- JavaScript: 32 files
- YAML: 16 files
- Shell: 15 files
- CSS: 12 files
- TOML: 1 files

## Repository structure

- libs/ — 868 files
- e2e/ — 164 files
- __fixtures__/ — 164 files
- packages/ — 87 files
- integration/ — 74 files
- website/ — 70 files
- .github/ — 16 files
- tools/ — 10 files

Probable source entrypoint: `packages/` (inferred from the tree, not upstream docs)

## Package

- package.json: lerna-monorepo — 36 declared dependencies

## Structural health signals

Average score 8.5/10 across 96 files; 4 hotspots. These are deterministic review leads, not proof of a bug.

## Recent history

- ce3e38f2889b (2026-10-02) chore: update dependency oxfmt to v0.70.0 (#4538)
- 93682300054d (2026-10-02) chore: update vitest monorepo to v5 (#4508)
- 5cf576627cc1 (2026-10-02) chore: switch lint and format to oxlint and oxfmt (#4537)
- 87da4c1977c4 (2026-10-02) fix: update dependency @octokit/rest to v22 (#4517)
- 430e67618ff3 (2026-10-02) feat: upgrade the npm publishing dependency stack (#4536)

## Overview

Lerna is a Node.js CLI for teams managing and publishing multiple JavaScript or TypeScript packages in one repository. It combines Nx project discovery and task execution with package-aware change detection, coordinated versioning, npm publishing, and GitHub/GitLab releases. This pinned revision publishes an ESM package while preserving selected CommonJS entrypoint contracts; its React website is a separate Docusaurus documentation surface.

## System map

The product runtime is a Node CLI assembled from command libraries and shared core utilities. Nx supplies project graphs and the default task runner, while Lerna owns package metadata and release coordination. Persistent state consists primarily of workspace files, Git state, and registry artifacts. The npm package and documentation website have separate build and deployment paths.
- The published lerna package is ESM, exposes dist/cli.js as its binary, and exports the main API, command modules, selected helpers, migrations, and utilities. — [packages/lerna/package.json#L17-27](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/package.json#L17-L27) [packages/lerna/package.json#L88-98](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/package.json#L88-L98)
- cli.ts first delegates through importLocal; otherwise it requires index.js and passes process.argv.slice(2) to main. — [packages/lerna/src/cli.ts#L3-12](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/cli.ts#L3-L12)
- main explicitly registers 15 command modules; shared CLI setup uses strict yargs parsing, requires a command, and maps failures to nonzero exit codes. — [packages/lerna/src/index.ts#L26-51](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/index.ts#L26-L51) [libs/core/src/lib/cli.ts#L18-44](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/cli.ts#L18-L44)
- Most command implementations resolve through @lerna aliases into libs/commands; published run wrappers re-export that implementation rather than duplicate it. — [tsconfig.base.json#L25-50](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/tsconfig.base.json#L25-L50) [packages/lerna/src/commands/run/index.ts#L1-1](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/run/index.ts#L1-L1) [packages/lerna/src/commands/run/command.ts#L1-4](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/run/command.ts#L1-L4)
- Command orchestrates Project initialization, environment/options/properties setup, validation, graph detection, preparations, and subclass execution; composed publish/version calls can reuse graph data. — [libs/core/src/lib/command/index.ts#L110-143](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L110-L143) [libs/core/src/lib/command/index.ts#L338-354](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L338-L354)
- Project owns root configuration and Package owns mutable manifests; serialization writes lerna configuration and package.json files rather than a database. — [libs/core/src/lib/project/index.ts#L90-108](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/index.ts#L90-L108) [libs/core/src/lib/project/index.ts#L201-208](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/index.ts#L201-L208) [libs/core/src/lib/package.ts#L269-285](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/package.ts#L269-L285)
- Nx/esbuild compiles the published package for Node as split ESM with explicit additional entrypoints; root scripts route tests, lint, and integration through Nx. — [packages/lerna/project.json#L17-40](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/project.json#L17-L40) [packages/lerna/project.json#L95-111](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/project.json#L95-L111) [package.json#L16-26](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/package.json#L16-L26)
- The website uses Docusaurus and React, deploys to the lerna/website repository, and has a PR build check; npm releases use a separately dispatched workflow with an npm-production environment. — [website/package.json#L4-26](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/website/package.json#L4-L26) [.github/workflows/website-deploy.yml#L18-39](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.github/workflows/website-deploy.yml#L18-L39) [website/docusaurus.config.js#L19-23](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/website/docusaurus.config.js#L19-L23) [.github/workflows/release.yml#L49-62](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.github/workflows/release.yml#L49-L62)

## Feature catalog

The registered CLI covers workspace setup, package inspection, task execution, cleanup, importing history, and releases. Shared filtering supports package scopes, exclusions, changed-package selection, and dependency expansion where commands expose those options. Versioning and publishing have distinct modes and side effects. Legacy package-management names remain registered only to explain their removal.
- init generates lerna.json, adds Lerna as a development dependency, supplies workspace configuration for a new repository, and supports dry-run previews; create scaffolds package files and optional CLI files. — [libs/commands/init/src/index.ts#L85-122](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/init/src/index.ts#L85-L122) [libs/commands/init/src/index.ts#L136-210](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/init/src/index.ts#L136-L210) [libs/commands/create/src/index.ts#L183-206](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/create/src/index.ts#L183-L206)
- list filters and formats packages; changed collects release candidates and returns exit code 1 when none exist; diff invokes Git for a named package or package parent directories; info reports environment details. — [libs/commands/list/src/index.ts#L21-40](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/list/src/index.ts#L21-L40) [libs/commands/changed/src/index.ts#L39-61](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/changed/src/index.ts#L39-L61) [libs/commands/diff/src/index.ts#L38-57](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/diff/src/index.ts#L38-L57) [libs/commands/info/src/index.ts#L11-20](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/info/src/index.ts#L11-L20)
- run accepts comma-separated targets and forwards arguments after --; Nx is the default runner, while useNx=false selects parallel, topological, or lexical legacy execution and rejects multiple targets. — [libs/commands/run/src/command.ts#L9-29](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/command.ts#L9-L29) [libs/commands/run/src/index.ts#L74-87](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L74-L87) [libs/commands/run/src/index.ts#L132-140](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L132-L140)
- exec runs shell commands in selected package directories with LERNA_PACKAGE_NAME and LERNA_ROOT_PATH; watch delegates change-triggered execution to Nx with LERNA_PACKAGE_NAME and LERNA_FILE_CHANGES. — [libs/commands/exec/src/index.ts#L122-147](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/exec/src/index.ts#L122-L147) [packages/lerna/src/commands/watch/index.ts#L49-58](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/watch/index.ts#L49-L58)
- clean removes selected packages' node_modules directories after confirmation or --yes; import reads an external repository and sequentially applies rewritten commit patches with git am. — [libs/commands/clean/src/index.ts#L29-60](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/clean/src/index.ts#L29-L60) [libs/commands/import/src/index.ts#L47-108](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/import/src/index.ts#L47-L108) [libs/commands/import/src/index.ts#L239-283](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/import/src/index.ts#L239-L283)
- version supports fixed and independent versions, explicit semver or increment keywords, interactive selection, conventional-commit recommendations, changelogs, Git tags, pushes, and optional hosted releases. — [libs/commands/version/src/index.ts#L420-474](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L420-L474) [libs/commands/version/src/index.ts#L709-774](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L709-L774) [libs/commands/version/src/index.ts#L370-405](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L370-L405)
- publish selects from-git, from-package, canary, or composed versioning; it supports custom publish directories/assets, private-package inclusion, temporary dist-tags, throttling, and a JSON summary. — [libs/commands/publish/src/index.ts#L179-186](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L179-L186) [libs/commands/publish/src/index.ts#L284-332](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L284-L332) [libs/commands/publish/src/index.ts#L403-429](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L403-L429) [libs/commands/publish/src/index.ts#L982-1002](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L982-L1002)
- add-caching collects script dependency/cache/output answers and writes nx.json; repair passes registered Lerna migrations to Nx; add, bootstrap, and link terminate with removal guidance. — [packages/lerna/src/commands/add-caching/index.ts#L68-114](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/add-caching/index.ts#L68-L114) [packages/lerna/src/commands/add-caching/index.ts#L130-160](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/add-caching/index.ts#L130-L160) [packages/lerna/src/commands/repair/index.ts#L23-35](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/repair/index.ts#L23-L35) [packages/lerna/src/index.ts#L61-89](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/index.ts#L61-L89)

## Data flow

Inputs enter through yargs, workspace configuration, package manifests, Git history, and registry responses. Project and Command establish effective options before Nx graph nodes acquire Package objects and dependency metadata. Task flows produce process output and exit codes; release flows mutate workspace files and transmit packed artifacts. Authentication state is passed through in-memory publish options and configuration.
- Run's argument builder converts comma-separated script input into an array and preserves -- arguments; Command merges CLI values before command-specific config, global lerna config, and environment defaults. — [libs/commands/run/src/command.ts#L14-29](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/command.ts#L14-L29) [libs/core/src/lib/command/index.ts#L267-283](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L267-L283)
- Project searches lerna.json/package.json, applies extends, and derives its root from the resolved configuration; package globs come from explicit config, pnpm-workspace.yaml, or root workspaces. — [libs/core/src/lib/project/index.ts#L90-108](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/index.ts#L90-L108) [libs/core/src/lib/project/index.ts#L257-284](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/index.ts#L257-L284) [libs/core/src/lib/project/index.ts#L345-397](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/index.ts#L345-L397)
- detectProjects obtains the Nx graph and file map, then createProjectGraphWithPackages matches configured roots, reads manifests, attaches Package instances, and sorts nodes by root. — [libs/core/src/lib/command/detect-projects.ts#L5-16](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/detect-projects.ts#L5-L16) [libs/core/src/lib/command/create-project-graph-with-packages.ts#L24-61](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/create-project-graph-with-packages.ts#L24-L61)
- Graph enrichment resolves manifest dependency specs, records collection and resolution metadata, and includes local dependencies only when workspace protocol, directory location, or version requirements match. — [libs/core/src/lib/command/create-project-graph-with-packages.ts#L87-120](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/create-project-graph-with-packages.ts#L87-L120) [libs/core/src/lib/command/create-project-graph-with-packages.ts#L134-162](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/create-project-graph-with-packages.ts#L134-L162)
- filterProjects applies private/scope/ignore selection, optionally intersects Git-derived updates, then expands dependents and dependencies; update detection uses git diff paths and ignoreChanges predicates. — [libs/core/src/lib/filter-projects.ts#L27-85](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/filter-projects.ts#L27-L85) [libs/core/src/lib/collect-updates/make-diff-predicate.ts#L31-56](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/collect-updates/make-diff-predicate.ts#L31-L56) [libs/core/src/lib/collect-updates/make-diff-predicate.ts#L60-70](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/collect-updates/make-diff-predicate.ts#L60-L70)
- Run maps selected project names and targets into runOne/runMany, forwarding output style, concurrency, cache/bail/cycle options, argument overrides, and loadDotEnvFiles, which defaults to true. — [libs/commands/run/src/index.ts#L275-299](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L275-L299) [libs/commands/run/src/index.ts#L341-358](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L341-L358) [libs/commands/run/src/index.ts#L394-399](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L394-L399)
- Version refreshes manifests after preversion hooks, mutates versions/dependencies, serializes packages and lockfiles, and writes fixed-mode lerna.json; writePackage sorts dependency keys and preserves detected indentation. — [libs/commands/version/src/index.ts#L676-706](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L676-L706) [libs/commands/version/src/index.ts#L750-774](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L750-L774) [libs/core/src/lib/write-package.ts#L19-28](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/write-package.ts#L19-L28) [libs/core/src/lib/write-package.ts#L36-51](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/write-package.ts#L36-L51)
- Packing converts Arborist/npm-packlist output into a temporary tarball; npmPublish reads that archive and prepared manifest, merges publishConfig, attempts OIDC authentication, and submits through libnpmpublish with OTP handling. — [libs/core/src/lib/pack-directory.ts#L72-99](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/pack-directory.ts#L72-L99) [libs/core/src/lib/temp-write.ts#L11-13](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/temp-write.ts#L11-L13) [libs/core/src/lib/npm-publish.ts#L63-104](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/npm-publish.ts#L63-L104) [libs/core/src/lib/oidc.ts#L160-161](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/oidc.ts#L160-L161)

## Behavior traces

Source inspection followed startup, task execution, and version persistence through their concrete functions and branches. Publishing was also traced from selection through archive upload and cleanup. These are execution-order descriptions inferred directly from source, not observed runtime traces. Early returns and configuration switches materially change the work performed.
- Startup: cli.ts → importLocal or main(argv) → lernaCLI() → explicit command registration → cli.parse(argv, context); strict parser failures reach cli.exit with a positive error code or 1. — [packages/lerna/src/cli.ts#L8-12](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/cli.ts#L8-L12) [packages/lerna/src/index.ts#L26-51](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/index.ts#L26-L51) [libs/core/src/lib/cli.ts#L23-44](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/cli.ts#L23-L44)
- Shared command startup: constructor → new Project → configureEnvironment → configureOptions → configureProperties → logger → conditional runValidations → detectProjects or reuse preinitialized graph data → runPreparations → runCommand; initialize=false prevents execute. — [libs/core/src/lib/command/index.ts#L115-143](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L115-L143) [libs/core/src/lib/command/index.ts#L338-343](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L338-L343)
- lerna run: handler → factory → RunCommand.initialize → filterProjects → target-presence filtering → execute; missing scripts raise ENOSCRIPT, while zero matching targets return false with a success message. — [libs/commands/run/src/command.ts#L97-101](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/command.ts#L97-L101) [libs/commands/run/src/index.ts#L31-32](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L31-L32) [libs/commands/run/src/index.ts#L63-115](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L63-L115)
- Default task execution: execute → runScriptsUsingNx → configureNxOutput → prepNxOptions → runOne for one project/one target, otherwise runMany; custom Nx configuration changes dependency and parallel/sort behavior. — [libs/commands/run/src/index.ts#L132-140](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L132-L140) [libs/commands/run/src/index.ts#L262-299](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L262-L299) [libs/commands/run/src/index.ts#L312-335](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L312-L335) [libs/commands/run/src/index.ts#L361-384](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L361-L384)
- Version selection: initialize validates Git state when required, collects updates, filters private/unversioned packages, checks the working tree when enabled, then calls getVersionsForUpdates → setUpdatesForVersions → confirmVersions. — [libs/commands/version/src/index.ts#L216-281](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L216-L281) [libs/commands/version/src/index.ts#L298-335](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L298-L335) [libs/commands/version/src/index.ts#L354-367](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L354-L367)
- Version persistence: updatePackageVersions runs root preversion unless rooted-leaf, then per-package preversion → refresh → version/dependency writes → version hook → optional changelog; afterward it updates fixed-mode configuration and root lockfiles. — [libs/commands/version/src/index.ts#L671-706](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L671-L706) [libs/commands/version/src/index.ts#L709-774](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L709-L774) [libs/commands/version/src/index.ts#L783-850](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L783-L850)
- Version completion: execute awaits updatePackageVersions, optional commitAndTagUpdates, optional gitPushToRemote, then optional createRelease; commitAndTagUpdates chooses fixed/independent tags and runs postversion hooks. — [libs/commands/version/src/index.ts#L370-405](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L370-L405) [libs/commands/version/src/index.ts#L876-893](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L876-L893) [libs/commands/version/src/index.ts#L919-938](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L919-L938)
- Publishing: initialize selects tagged/unpublished/canary updates or invokes version; execute prepares registry/licenses/private state → rewrites dependency links → serializes → packUpdated → publishPacked → restores private flags → serializes → optional resetChanges/dist-tag promotion. — [libs/commands/publish/src/index.ts#L318-370](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L318-L370) [libs/commands/publish/src/index.ts#L376-405](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L376-L405) [libs/commands/publish/src/index.ts#L904-934](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L904-L934) [libs/commands/publish/src/index.ts#L993-1024](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L993-L1024)

## Testing signals

Tests and CI were inspected, not executed; no passing result or coverage percentage is established. Vitest supplies shared Node-environment configuration for unit, integration, and e2e projects. Inspected suites mix mocked command boundaries with actual CLI and local-registry scenarios. The inventory is bounded, and mock coverage does not establish live service correctness.
- Shared Vitest configuration enables globals, a Node environment, single-run mode, spec/test discovery, Jest-compatible snapshot formatting, cleared mocks, and V8 coverage output. — [vitest.shared.ts#L92-118](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/vitest.shared.ts#L92-L118)
- Run unit tests mock npm script execution and assert script validation, filtering, streaming/prefix behavior, no-match success, alternate clients, and bail/non-bail exit propagation. — [libs/commands/run/src/lib/run-command.spec.ts#L19-30](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/lib/run-command.spec.ts#L19-L30) [libs/commands/run/src/lib/run-command.spec.ts#L68-125](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/lib/run-command.spec.ts#L68-L125) [libs/commands/run/src/lib/run-command.spec.ts#L128-177](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/lib/run-command.spec.ts#L128-L177)
- Version unit tests mock push and upstream checks while checking working-tree validation, version prompts, updated manifests, commit snapshots, and push arguments. — [libs/commands/version/src/lib/version-command.spec.ts#L32-46](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/lib/version-command.spec.ts#L32-L46) [libs/commands/version/src/lib/version-command.spec.ts#L91-115](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/lib/version-command.spec.ts#L91-L115)
- Publish unit tests mock packing, publishing, authentication helpers, and checkout; they assert rejected CLI options and package publication order, so those assertions do not exercise a live npm service. — [libs/commands/publish/src/lib/publish-command.spec.ts#L17-47](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/lib/publish-command.spec.ts#L17-L47) [libs/commands/publish/src/lib/publish-command.spec.ts#L65-116](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/lib/publish-command.spec.ts#L65-L116) [libs/commands/publish/src/lib/publish-command.spec.ts#L120-160](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/lib/publish-command.spec.ts#L120-L160)
- Integration tests invoke the CLI on fixtures and check exec filtering, shell environment expansion, streaming, and failure codes; inspected non-bail cases are conditional on non-Windows platforms. — [integration/__tests__/lerna-exec.spec.ts#L48-96](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/integration/__tests__/lerna-exec.spec.ts#L48-L96) [integration/__tests__/lerna-exec.spec.ts#L130-173](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/integration/__tests__/lerna-exec.spec.ts#L130-L173) [integration/vitest.config.ts#L7-13](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/integration/vitest.config.ts#L7-L13)
- E2e defaults serialize spec files and retry failures up to three times; an inspected publish scenario uses localhost:4873 to verify recovery when one version already exists, and task-runner assertions check environment loading. — [vitest.shared.ts#L42-57](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/vitest.shared.ts#L42-L57) [e2e/publish/src/from-git-recover-from-error.spec.ts#L36-64](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/e2e/publish/src/from-git-recover-from-error.spec.ts#L36-L64) [e2e/run/task-runner/src/env-files/assertions.spec.ts#L25-64](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/e2e/run/task-runner/src/env-files/assertions.spec.ts#L25-L64)
- The inspected OIDC suite has two mocked cases: CircleCI token exchange and skipping unsupported CI. The ESM compatibility suite checks built output, ESM imports, synchronous require contracts, and CLI version output. — [libs/core/src/lib/oidc.spec.ts#L38-69](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/oidc.spec.ts#L38-L69) [packages/lerna/src/esm-compat.spec.ts#L17-29](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/esm-compat.spec.ts#L17-L29) [packages/lerna/src/esm-compat.spec.ts#L32-107](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/esm-compat.spec.ts#L32-L107)
- CI defines a Node 22.22.2 package-entrypoint job, distributed Linux checks, Windows unit/integration jobs, and isolated task-runner e2e; core config excludes three config-chain suites on Windows. — [.github/workflows/ci.yml#L24-36](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.github/workflows/ci.yml#L24-L36) [.github/workflows/ci.yml#L62-72](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.github/workflows/ci.yml#L62-L72) [.github/workflows/ci.yml#L101-112](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.github/workflows/ci.yml#L101-L112) [libs/core/vitest.config.ts#L17-26](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/vitest.config.ts#L17-L26)

## Risk map

These are source observations and explicitly labeled hypotheses, not confirmed vulnerabilities. Lerna intentionally executes workspace-controlled commands and writes release artifacts, so trust boundaries include configuration, scripts, Git, and registries. Release operations span several independent systems and are not presented as one atomic transaction. Inspection also found narrow authentication tests and strong coupling to Nx internals.
- exec joins command and arguments into shell-interpreted text, uses shell=true, and copies the parent environment into package processes; callers must treat supplied command text as executable input. — [libs/commands/exec/src/index.ts#L48-70](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/exec/src/index.ts#L48-L70) [libs/commands/exec/src/index.ts#L122-147](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/exec/src/index.ts#L122-L147)
- Configuration can execute code: applyExtends requires resolved modules, changelog presets use require/import and callable builders, and lifecycle scripts run through @npmcli/run-script unless ignored. — [libs/core/src/lib/project/apply-extends.ts#L11-29](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/apply-extends.ts#L11-L29) [libs/core/src/lib/conventional-commits/get-changelog-config.ts#L134-170](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/conventional-commits/get-changelog-config.ts#L134-L170) [libs/core/src/lib/run-lifecycle.ts#L75-90](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/run-lifecycle.ts#L75-L90) [libs/core/src/lib/run-lifecycle.ts#L132-144](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/run-lifecycle.ts#L132-L144)
- Publishing deliberately writes archives beneath the system temporary directory, and configured contents/assets influence filesystem destinations; the inspected contents setter uses string-prefix selection and path joining rather than a containment check. — [libs/core/src/lib/temp-write.ts#L11-13](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/temp-write.ts#L11-L13) [libs/core/src/lib/temp-write.ts#L33-43](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/temp-write.ts#L33-L43) [libs/core/src/lib/package.ts#L203-226](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/package.ts#L203-L226) [libs/commands/publish/src/index.ts#L1182-1221](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L1182-L1221)
- Publish restoration defaults to enabled, but granularPathspec=false makes gitCheckout target '.'; import failure recovery invokes git am --abort and git reset --hard to the saved HEAD. — [libs/commands/publish/src/index.ts#L155-158](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L155-L158) [libs/core/src/lib/git-checkout.ts#L14-20](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/git-checkout.ts#L14-L20) [libs/commands/import/src/index.ts#L307-312](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/import/src/index.ts#L307-L312)
- Hypothesis: a later failure can leave earlier release side effects in place because ordinary publish awaits composed versioning before registry upload, and version executes writes, tags, pushes, and hosted releases sequentially. (inferred) — [libs/commands/publish/src/index.ts#L324-332](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L324-L332) [libs/commands/publish/src/index.ts#L380-400](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L380-L400) [libs/commands/version/src/index.ts#L370-405](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L370-L405)
- Run and repair import nx/src internal APIs, while publish/version share preinitialized graph data; dependency upgrades therefore affect execution contracts beyond the public @nx/devkit interface. — [libs/commands/run/src/index.ts#L22-23](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L22-L23) [libs/commands/run/src/index.ts#L315-322](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/index.ts#L315-L322) [packages/lerna/src/commands/repair/index.ts#L1-4](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/repair/index.ts#L1-L4) [libs/core/src/lib/command/index.ts#L129-140](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L129-L140)
- OIDC exchanges identity tokens against the effective registry and suppresses exchange failures before normal publish authentication continues; GitHub acquisition and provenance branches are not exercised by the two cases in the inspected OIDC suite. — [libs/core/src/lib/oidc.ts#L68-99](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/oidc.ts#L68-L99) [libs/core/src/lib/oidc.ts#L125-146](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/oidc.ts#L125-L146) [libs/core/src/lib/oidc.ts#L170-193](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/oidc.ts#L170-L193) [libs/core/src/lib/oidc.spec.ts#L38-69](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/oidc.spec.ts#L38-L69)
- Release workflow protections include nonpersisted checkout credentials, a pinned npm registry, disabled remote build cache, serialized releases, environment-scoped Git credentials, and validation of free-text version input; their live environment configuration was not verified. — [.github/workflows/release.yml#L41-70](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.github/workflows/release.yml#L41-L70) [.github/workflows/release.yml#L85-116](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.github/workflows/release.yml#L85-L116)

## Extension points

Extension mechanisms are explicit command registration, shared command hooks, configuration, Nx task definitions, and migration metadata. Publishing accepts configurable artifact directories and assets, while conventional-commit processing loads presets. Hosted release providers share an adapter-shaped API. Public package entrypoints and build lists must stay aligned with implementation changes.
- A CLI command plugs into main's .command chain using a yargs CommandModule with builder and handler; run demonstrates handler-to-factory construction. — [packages/lerna/src/index.ts#L31-47](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/index.ts#L31-L47) [libs/commands/run/src/command.ts#L8-29](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/command.ts#L8-L29) [libs/commands/run/src/command.ts#L97-105](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/command.ts#L97-L105)
- Command subclasses implement initialize/execute and can override requiresGit, otherCommandConfigs, or project detection; initialize=false supplies a standard early-return contract. — [libs/core/src/lib/command/index.ts#L223-238](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L223-L238) [libs/core/src/lib/command/index.ts#L338-354](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L338-L354)
- Lerna config extends supports locally resolvable modules with circular-reference detection; effective command options can inherit another command's namespace, as changed does for version and publish. — [libs/core/src/lib/project/apply-extends.ts#L8-32](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/apply-extends.ts#L8-L32) [libs/core/src/lib/command/index.ts#L267-283](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L267-L283) [libs/commands/changed/src/index.ts#L24-26](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/changed/src/index.ts#L24-L26)
- Nx targetDefaults and package.json nx configuration define task dependencies; add-caching writes cache/dependsOn/output settings, replacing array-form entries with object form for per-script answers. — [website/docs/concepts/task-pipeline-configuration.md#L27-66](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/website/docs/concepts/task-pipeline-configuration.md#L27-L66) [website/docs/concepts/task-pipeline-configuration.md#L82-96](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/website/docs/concepts/task-pipeline-configuration.md#L82-L96) [packages/lerna/src/commands/add-caching/index.ts#L141-178](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/add-caching/index.ts#L141-L178)
- Publishing configuration accepts root/package directory and asset definitions with projectRoot, projectName, and workspaceRoot interpolation; assets support strings or from/to objects. — [libs/commands/publish/src/index.ts#L265-309](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L265-L309) [libs/commands/publish/src/index.ts#L1176-1203](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/publish/src/index.ts#L1176-L1203)
- getChangelogConfig accepts named or object presets, loads CommonJS/ESM exports, invokes builder or legacy callback functions, and normalizes legacy preset fields for modern consumers. — [libs/core/src/lib/conventional-commits/get-changelog-config.ts#L74-103](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/conventional-commits/get-changelog-config.ts#L74-L103) [libs/core/src/lib/conventional-commits/get-changelog-config.ts#L134-180](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/conventional-commits/get-changelog-config.ts#L134-L180)
- createReleaseClient selects GitHub or GitLab; GitLab adapts createRelease to the repos.createRelease interface, while provider environment variables configure credentials and alternate API endpoints. — [libs/commands/version/src/lib/create-release.ts#L35-44](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/lib/create-release.ts#L35-L44) [libs/commands/version/src/lib/create-release.ts#L76-86](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/lib/create-release.ts#L76-L86) [libs/core/src/lib/scm-clients/github/create-github-client.ts#L17-41](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/scm-clients/github/create-github-client.ts#L17-L41) [libs/core/src/lib/scm-clients/gitlab/create-gitlab-client.ts#L4-22](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/scm-clients/gitlab/create-gitlab-client.ts#L4-L22)
- Migration generators are registered with versions/descriptions/implementation paths in migrations.json; repair forwards that registry to Nx, and generators mutate an Nx Tree and format it. — [packages/lerna/migrations.json#L2-37](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/migrations.json#L2-L37) [packages/lerna/src/commands/repair/index.ts#L23-35](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/repair/index.ts#L23-L35) [packages/lerna/src/migrations/add-schema-config/add-schema-config.ts#L3-11](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/migrations/add-schema-config/add-schema-config.ts#L3-L11)

## Contributor handoff

Tests and CI were inspected, not executed, and this brief provides bounded onboarding evidence rather than exhaustive coverage. Begin with contributor guidance, but resolve drift against manifests and executable source. Keep implementation, argument builders, public wrappers, and build entrypoints consistent. Release and e2e commands have material filesystem, process, Git, and registry side effects.
- Read AGENTS.md, CLAUDE.md, and CONTRIBUTING.md first, then verify against root package.json: this commit pins Node 26.10.0 and npm 12.1.0, despite older versions appearing in CLAUDE.md. — [AGENTS.md#L3-13](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/AGENTS.md#L3-L13) [CLAUDE.md#L68-79](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/CLAUDE.md#L68-L79) [CLAUDE.md#L129-135](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/CLAUDE.md#L129-L135) [package.json#L10-15](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/package.json#L10-L15)
- Start a command change in its libs implementation and command.ts builder, inspect the published wrapper, and preserve exports/additional entrypoints when changing the public module surface. — [libs/commands/run/src/command.ts#L8-29](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/src/command.ts#L8-L29) [packages/lerna/src/commands/run/index.ts#L1-1](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/commands/run/index.ts#L1-L1) [packages/lerna/package.json#L88-98](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/package.json#L88-L98) [packages/lerna/project.json#L79-103](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/project.json#L79-L103)
- Read shared Command, Project, and graph enrichment before changing discovery: explicit lerna package globs select packages from the Nx graph and do not redefine the underlying workspace graph. — [libs/core/src/lib/command/index.ts#L115-143](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/index.ts#L115-L143) [libs/core/src/lib/project/index.ts#L337-353](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/project/index.ts#L337-L353) [libs/core/src/lib/command/create-project-graph-with-packages.ts#L24-39](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/core/src/lib/command/create-project-graph-with-packages.ts#L24-L39)
- Preserve ESM/CommonJS compatibility contracts: main exports a module.exports alias, selected command factories attach their classes, and package tests explicitly check synchronous require and ESM import behavior. — [packages/lerna/src/index.ts#L95-96](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/index.ts#L95-L96) [libs/commands/version/src/index.ts#L956-962](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/version/src/index.ts#L956-L962) [packages/lerna/src/esm-compat.spec.ts#L32-103](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/packages/lerna/src/esm-compat.spec.ts#L32-L103)
- For an authorized change, begin with the affected Nx test project; contributor guidance requires format, lint, unit, and integration checks and gates e2e behind other tests and build. None of these checks was executed in this investigation. — [CLAUDE.md#L9-38](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/CLAUDE.md#L9-L38) [package.json#L16-26](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/package.json#L16-L26) [libs/commands/run/vitest.config.ts#L1-8](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/libs/commands/run/vitest.config.ts#L1-L8)
- Use the correct e2e target names from CONTRIBUTING.md and project configuration; modern task-runner e2e first prepares the local package, then runs a bash capture harness, while shared e2e defaults include retries. — [CONTRIBUTING.md#L143-181](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/CONTRIBUTING.md#L143-L181) [e2e/run/task-runner/src/run-tests.sh#L16-27](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/e2e/run/task-runner/src/run-tests.sh#L16-L27) [vitest.shared.ts#L42-57](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/vitest.shared.ts#L42-L57)
- The build script must run at the workspace root and performs removal, Nx builds, npm install, and package copying; local registry configuration can affect later lockfile resolutions, so these are not source-inspection commands. — [tools/scripts/build.sh#L6-28](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/tools/scripts/build.sh#L6-L28) [CONTRIBUTING.md#L129-137](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/CONTRIBUTING.md#L129-L137) [AGENTS.md#L19-23](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/AGENTS.md#L19-L23)
- Follow Oxlint module-boundary configuration and Oxfmt's 110-column style, use Conventional Commit scopes, and keep real releases in the gated GitHub workflow rather than invoking production publish locally. — [.oxlintrc.json#L28-40](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.oxlintrc.json#L28-L40) [.oxfmtrc.json#L1-5](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/.oxfmtrc.json#L1-L5) [CLAUDE.md#L117-127](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/CLAUDE.md#L117-L127) [CONTRIBUTING.md#L193-206](https://github.com/lerna/lerna/blob/ce3e38f2889b26573f1b38cfb487546903292158/CONTRIBUTING.md#L193-L206)

Source repository: https://github.com/lerna/lerna
Full evidence corpus: https://github.com/Codevetter/codevetter/tree/main/benchmarks/repo-unpacks/lerna.json

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
