# Behavior traces — lerna/lerna

> Canonical page: https://codevetter.com/unpack/lerna/behavior-traces

# Behavior traces — lerna/lerna

Scanned commit ce3e38f2889b26573f1b38cfb487546903292158 (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

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)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

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