Repository navigation
Releases
v1.2.0
@cldmv/envm v1.2.0 Changelog
Release Date: November 2026
Release Type: Minor
Branch: release/1.2.0
Overview
require("@cldmv/envm") now returns the envManager object itself, so require(x).set(…) works. It still carries .envManager, and gains .default, so every v1.1.0 call keeps working. The CommonJS entry is the generic CLDMV shim, and dist/ is built one file per module instead of as tsup bundles, so the CLI no longer ships a second copy of the library.
This release also fixes three bugs. A typo'd or missing scope was accepted and silently did nothing, or wrote the system registry on Windows. The CLI could take a flag as a value or edit the wrong variable. And backup.purge() never deleted backups by age. Test coverage goes from about 33% to about 98%.
✨ Features
require() returns envManager itself (#87, #89)
src/index.cjs is now the generic CLDMV CommonJS shim. After the Node.js version guard it loads ./index.mjs through require(esm). The ESM entry has one export, envManager, so the shim returns that object, with .default and .envManager both pointing back at it. v1.1.0's entry was module.exports = require("./index.mjs"), which returned the module namespace.
#87 switched to the shim when it still returned the bare object with no names, which would have broken require(x).envManager and const { envManager } = require(x). #89 puts .default and the ESM name back on it before any release, so nothing that worked in v1.1.0 breaks. Measured against the built package:
require("@cldmv/envm") |
v1.1.0 | v1.2.0 |
|---|---|---|
| result | { envManager } |
the envManager object |
.envManager.set |
function | function (.envManager is the same object) |
const { envManager } = require(x) |
works | works |
.set |
undefined |
function |
.default |
undefined |
the same object |
ESM import { envManager } from "@cldmv/envm" is unchanged.
🐛 Bug Fixes
An unknown or missing scope is refused (#94, fixes #95)
Scope must be session, user or system, but nothing checked it. On POSIX, envManager.set("FOO", "bar", { scope: "usre" }) did nothing and reported nothing. On Windows, anything that wasn't session or user read and wrote HKLM\SYSTEM\...\Environment. The CLI ran with the bad scope, and --scope with no value became session. The new src/scope.mjs checks the scope in both platform backends, in backup listing and in the CLI before anything is read or written. A bad scope now throws Invalid scope "bogus". Valid scopes: session, user, system, and the CLI reports a --scope with no value as missing.
The CLI no longer takes a flag as a value or edits the wrong variable (#94, fixes #90)
envm set FOO --scope user stored the literal value --scope, and envm path append --values /q without --name appended to a variable called append, leaving PATH alone. The CLI now parses its arguments properly. A value flag never takes another --flag as its value, and the positional name after path is read after the op. A missing name, value, --values or backup id fails with a usage message instead of running with undefined.
backup.purge() deletes backups by age (#93, fixes #91)
The backup file timestamp was turned back into a date by replacing every dash with a colon, including those in the date part, so the result was always an Invalid Date and maxAgeDays never removed anything. Only the time part's dashes are converted now, so backups older than maxAgeDays are purged. The CLI's exit-time purge is fixed by the same change.
🔧 Build
dist/ is one file per module, no bundle (#97, fixes #85)
The two tsup bundles are replaced by scripts/build.mjs, which runs esbuild over every src/**/*.mjs file with bundle: false and the node14 target. Each module is minified on its own with names kept and written to the same path under dist/. dist/cli.mjs imports the library from dist/ instead of carrying its own copy, and src/index.cjs is still copied verbatim. The entry points and exports are unchanged.
🔧 CI & tooling
- Test coverage goes from about 33% to about 98%, with tests for the POSIX and Windows backends, backups, the PATH helpers and the CLI (#92, fixes #3).
test:cjsruns the CommonJS entry check, and the newtest:distruns the Vitest suite against the builtdist/(#76).- The Vitest config sets the
envm-devcondition withdevCondition(), replacing atest.nodeOptionssetting that Vitest ignored (#74). ci.ymlis synced with the CLDMV/.github v4.43.0 template (#84), and superseded CI runs onnextandhotfixesare cancelled (#88, fixes #86).- The
sync-release-notescompanion workflow keeps GitHub Release bodies and tags in step with these changelog files (#82). - File headers are restamped with fix-headers 2.6.1 and 2.6.2, which write
@Filenamewithout a leading slash (#96, #98).
📚 Documentation
- NEW: docs/changelog/v1/v1.2.0.md, this changelog.
- README: the CommonJS section shows
require()returningenvManager(#87, #89), and What's New is promoted to v1.2.0.
🔧 Dependencies
Development dependencies only; envm still has no runtime dependencies.
- CLDMV dev tools (#78, #96, #98):
@cldmv/vitest-runner1.5.6 → 1.11.5,@cldmv/configs1.3.0 → 1.5.1 and@cldmv/fix-headers2.2.4 → 2.6.2, with@cldmv/jsonvand@cldmv/prettier-plugin-jsonv→ 1.2.4. vitestand@vitest/coverage-v85.0.5 → 5.1.2 (#77, #96).esbuildadded andtsupremoved (#97).
Upgrade notes
- No breaking changes. Drop-in for v1.1.0:
require(x).envManager,const { envManager } = require(x)and ESMimportwork as before, andrequire(x).set(…)andrequire(x).defaultare new. - A scope other than
session,userorsystemnow throws instead of silently doing nothing, or writing system scope on Windows. Check any computed scope values. envm set NAME --scope …with no value now fails with a usage message instead of storing--scope.
| Metric | Coverage |
|---|---|
| Statements | 99.2% |
| Branches | 95.0% |
| Functions | 98.6% |
| Lines | 99.1% |
Avg: 97.9% · 4f52d80 · Node lts/*
👥 Contributors
v1.1.0
@cldmv/envm v1.1.0 Changelog
Release Date: November 2026
Release Type: Minor
Branch: release/1.1.0
Overview
envm moves to the CLDMV library layout. The package is now built with tsup into a single ESM bundle, require("@cldmv/envm") works through a small CommonJS entry that loads that same bundle, the package ships generated type declarations, and an envm-dev export condition lets a checkout run straight from src/. The "." and "./cli" entry points keep their paths and their exports.
This release also fixes four bugs that made parts of the API silently do nothing: the installed envm command never ran, Windows rollback never restored the registry backup, unset at user scope on Linux and macOS never removed the variable, and a name containing regex metacharacters could remove other variables. User scope on Linux and macOS works end to end for the first time: reading a variable there used to throw Not implemented, which also made every user-scope set and unset reject after it had rewritten ~/.profile.
The package now declares engines.node >=14.14.0. Earlier releases declared no floor at all; see Requirements.
📦 Requirements
Node.js >=14.14.0, with require() on ^20.19.0 or >=22.13.0 (#67)
v1.0.12 and earlier had no engines field. v1.1.0 sets engines.node to >=14.14.0, the first version with the fs/promises rm() that the Windows registry helper uses. import works from there. require() loads the ESM build through Node's require(esm), so it needs Node.js ^20.19.0 or >=22.13.0; on an older Node.js the CommonJS entry throws ERR_REQUIRE_ESM naming that range and pointing at import().
Developing the package needs Node.js 22.22.0 or later, because the build toolchain (tsup 9 and its chokidar 6 dependency) doesn't run on anything older. That floor is declared in npm's devEngines (runtime node >=22.22.0, onFail: "error"), so npm enforces it in a checkout of this repository and never for consumers installing the package.
✨ Features
CLDMV library layout with a CommonJS entry (#60, closes #59)
- tsup build. The old
esbuildcommand wrote one unbundled file per source module. tsup now buildsdist/index.mjs(the library, with the platform adapters and backup helpers bundled in) anddist/cli.mjs(the CLI, which keeps its./index.mjsimport external so it loads the library bundle instead of carrying a second copy). Output is minified with function names kept. The library plus CLI is about 15 KB minified, down from about 29 KB. require()support.src/index.cjsis a short wrapper thatrequire()s the siblingindex.mjsthrough Node'srequire(esm)and re-exports{ envManager }. It is copied verbatim todist/index.cjs, so CommonJS and ESM callers share one copy of the library and its state. On a Node.js version withoutrequire(esm)it throwsERR_REQUIRE_ESMwith a message naming the supported range and pointing atimport().- Type declarations.
types/is generated from the JSDoc bytscand published;exportscarries atypescondition for both entry points.envManageris typed through explicitEnvManager,PathHelpersandBackupHelperstypedefs so its declaration emits as a typedconst(#63). envm-devexport condition."."and"./cli"resolve todist/by default. In a checkout,node --conditions=envm-devresolves them tosrc/instead. The Vitest suite runs againstsrc/through the condition, andnpm run test:distbuilds the package and checks the built entries withnode --test.- Shared backup state in the CLI. The CLI's exit-time purge now goes through
envManager.backup, so it uses the same backup directory as the library rather than a separately loaded copy ofbackup.mjs. package.jsongainsmain(./dist/index.cjs),module,types, a./package.jsonexport, and aprepackbuild in place ofprepublishOnly.
🐛 Bug Fixes
The installed envm command did nothing (#60, fixes #61)
src/cli.mjs only ran main() when import.meta.url equalled `file://${process.argv[1]}`. An installed envm runs through the node_modules/.bin/envm symlink, so process.argv[1] was the link path, the check failed and the command exited without doing anything. Paths containing URL-encoded characters such as spaces failed the same way. The check now compares fileURLToPath(import.meta.url) with realpathSync(process.argv[1]). The CLI file also starts with a #!/usr/bin/env node line, which the published bin lacked.
Windows rollback never restored the registry backup (#60, fixes #62)
When verification failed after a set or unset at user or system scope, the rollback path called require("os") and require("fs"). require is not defined in an ES module, so it threw a ReferenceError, the surrounding catch swallowed it, and the registry backup was never imported. Rollback now uses the module's own imports and works.
unset at user scope never removed the variable on Linux and macOS (#60)
The filter for ~/.profile lines was a RegExp built from a template literal, where \s lost its backslash and the pattern became ^exports+NAME=. It never matched, so the export line stayed in the envm block and the variable survived the unset. The filter now parses each export NAME= line and compares the name literally, which also fixes the next item.
User-scope variables on Linux and macOS couldn't be read (#69, fixes #68)
getRaw() and getExpanded() at user scope on POSIX were stubs that threw Not implemented: getRaw user. set and unset at user scope verify the change by reading the variable back, so both rewrote ~/.profile and then rejected with that error, and the rollback that should follow a failed verification never ran. getRaw() now reads the value from the managed # envm-begin / # envm-end block in ~/.profile, unquoting the 'value' envm writes, and returns undefined when the profile, the block or the variable is missing. set uses the same line parser, so it updates an existing line in place for names that aren't plain word characters (A.B) instead of adding a second one.
System-scope variables on Linux and macOS couldn't be read (#72, fixes #71)
getRaw for the system scope was a stub that threw, so every system-scope set and unset failed at its verify step after writing /etc/environment. It now reads the value back from that file, matching the name exactly. ENVM_SYSTEM_ENV_FILE points envm at another file, which the tests use.
Variable names were treated as regex patterns (#60)
Because that filter interpolated the variable name into a RegExp, metacharacters in the name matched other variables: unsetting A.B would also remove AxB. Names are now compared as plain strings.
Registry import files went to a predictable temp path (#60)
Windows rollback and backup.restore() wrote the .reg file to a fixed-pattern name in the shared temp directory, and restore() never deleted it. All three paths now go through one helper that creates a private directory with mkdtemp, writes the file with exclusive create and mode 0600, runs reg import, and removes the directory afterwards.
🔧 CI & tooling
- CI matrix floor raised to 22.22.0 (#60, #67). The dev toolchain needs Node.js 22.22, so the CI and publish matrices start there (previously 22.12.0). Their
min_node_versiondescriptions say it is the dev toolchain floor and should matchdevEngines, notengines. - tsup builds for
node14, matchingengines.node(#67). build:cinow runs lint, the format check, the declaration build and the tsup build; the CI coverage legs runbuild:ci, and the bundle-size check measures the.mjsand.cjsfiles indist/.- ESLint and Prettier configs moved to
.configs/on the shared CLDMV base, withlint,lint:fix,formatandformat:checkscripts and a.prettierignore; the existing lint errors were cleared. The leftoverjest.config.mjsis gone. - TypeScript is pinned to 6 for the declaration build, because TypeScript 7's JavaScript declaration emit isn't complete yet, and the declarations were regenerated with it (#63).
📚 Documentation
- NEW: docs/changelog/v1/v1.1.0.md — this changelog.
- README: the Node.js requirements for
import,require()and development (#67), a CommonJS usage section, a Development section on theenvm-devcondition and the build, and What's New now leads with v1.1.0.
🔧 Dependencies
The package still has no runtime dependencies. Everything below is development-only.
v1.0.12
@cldmv/envm v1.0.12 Changelog
Release Date: October 2026
Release Type: Patch
Overview
A dev-dependency release. The @cldmv/vitest-runner test runner moves from 1.2.0 to 1.5.3, and vitest and @vitest/coverage-v8 move from 5.0.2 to 5.0.3. Nothing under src/ changed, and package.json differs from v1.0.11 only in its version field: all of it is a lockfile re-resolution inside the existing ^ ranges. Every package that changed in package-lock.json is a development dependency, and the package has no runtime dependencies, so the library and CLI are unaffected.
The notable effect is on the toolchain's Node.js floor. @cldmv/vitest-runner 1.5.3 declares engines.node >=22.12.0 (it was >=20.19.0 in 1.2.0) and depends on chalk 6, which needs Node.js 22. The CI matrix already starts at 22.12.0, the floor vitest 5 runs on, so CI is not affected; running npm test locally now needs Node.js 22.12.0 or later. envm declares no engines field, and that is unchanged.
🔧 CI & tooling
npm testandnpm run build:cipass on the mergednextbranch. The build is a realesbuildbundle ofsrc/intodist/, so a passingbuild:cidoes verify the shipped output.
📚 Documentation
- NEW: docs/changelog/v1/v1.0.12.md — this changelog.
- README — What's New now leads with v1.0.12.
🔧 Dependencies
All development-only; none is a runtime or peer dependency of envm.
@cldmv/vitest-runner^1.2.0→ resolved 1.5.3 (#44). Thepackage.jsonrange stays^1.2.0; only the lockfile moved. The jump covers the 1.3 to 1.5 releases, including a real bundleddist/build, anexcludeoption for test discovery, and a CommonJS entry that now fails with a clearERR_REQUIRE_ESMmessage on Node.js withoutrequire(esm). Itsengines.nodemoves from>=20.19.0to>=22.12.0. Itschalkdependency moves from^5to^6, so the lockfile's top-levelchalkgoes from 5.6.2 (engines.node^12.17.0 || ^14.13 || >=16.0.0) to 6.0.1 (engines.node>=22).vitest5.0.2 → 5.0.3 (#42), with@vitest/mockerand@vitest/spyat 5.0.3.vitest5.0.3 pinswhy-is-node-runningto exactly 3.2.1, so that package resolves one patch version lower than before (3.2.2 → 3.2.1).@vitest/coverage-v85.0.2 → 5.0.3 (#43).- Transitive tooling that moved with the Vitest update:
vite8.3.1 → 8.3.2,rolldown1.2.11 → 1.2.12 (and its platform bindings) and@oxc-project/types0.151.0 → 0.152.0.
Upgrade notes
- No breaking changes, and no runtime code changed. It is a drop-in replacement for v1.0.11.
- For contributors: running the test suite locally needs Node.js 22.12.0 or later.
| Metric | Coverage |
|---|---|
| Statements | 32.8% |
| Branches | 25.3% |
| Functions | 50.7% |
| Lines | 32.9% |
Avg: 35.4% · 240b2e8 · Node lts/*
👥 Contributors
v1.0.11
@cldmv/envm v1.0.11 Changelog
Release Date: October 2026
Release Type: Patch
Branch: release/1.0.11
Overview
A dev-dependency release. @cldmv/fix-headers moves from 2.1.1 to 2.2.0, passing through 2.1.4, and the shared @cldmv/configs config moves from 1.2.0 to 1.2.4. Both header passes were re-run and every header already matched what the new versions write, so no file was restamped: the net change to the repository outside documentation is the two version ranges in package.json and the lockfile. No library or CLI code, published file or dependency used at runtime changed.
📚 Documentation
- NEW: docs/changelog/v1/v1.0.11.md — this changelog, plus backfilled changelog files for every earlier release, v1.0.2 through v1.0.10.
- NEW: README ✨ What's New section.
🔧 Dependencies
Both are dev-only and affect only the npm run fix:headers script, which extends @cldmv/configs/fix-headers.json.
@cldmv/fix-headers^2.1.1→^2.2.0, in two steps. 2.1.4 (#34) stops the tool from writing comment headers into files that cannot carry one, such as strict JSON, and from walkingnode_modules. 2.2.0 (#40) makes@Last modified byfollow edits to a file's content only, so a run that merely rewrites a header keeps the recorded editor.@cldmv/configs^1.2.0→^1.2.4(#40). The shared fix-headers config now setsforceAuthorUpdateandforceLastModifiedAuthorUpdatetofalse, so@Authorkeeps the file's creator and@Last modified bychanges only with real content edits. The 1.2.1 and 1.2.2 releases of that package only changed its own CI.
Upgrade notes
- No runtime changes — drop-in for v1.0.10.
| Metric | Coverage |
|---|---|
| Statements | 32.8% |
| Branches | 25.3% |
| Functions | 50.7% |
| Lines | 32.9% |
Avg: 35.4% · c7f8069 · Node lts/*
👥 Contributors
v1.0.5
@cldmv/envm v1.0.5 Changelog
Release Date: August 2026
Release Type: Patch
Availability: Release commit on master only; not tagged and not published to npm
Overview
A CI-only release: the concurrency policy of ci.yml changes so release-relevant runs are no longer cancelled. No runtime code changed (#9).
🔧 CI & tooling
ci.ymlderives the release base branch (theCLDMV_RELEASE_BASEvariable, falling back to the repository's default branch) instead of hardcodingmaster/main. Pushes to the release base, tonextandhotfixes, andnext/hotfixesrelease PRs now each get a unique concurrency group per run, so a burst of release-time pushes no longer cancels a run and leaves a red cancelled check on the release PR. Feature branches still cancel superseded runs.
Upgrade notes
- No runtime changes.
v1.0.10
@cldmv/envm v1.0.10 Changelog
Release Date: October 2026
Release Type: Patch
Availability: GitHub Release only (v1.0.10); not published to npm
Overview
A CI-only release: the ✅ Required PR Check mirror job now runs on every path instead of being skipped on in-repo feature PRs. No library or CLI code changed.
🔧 CI & tooling
Run the in-repo PR mirror job instead of skipping it (#32)
The fix in v1.0.9 gave the mirror job a conditional name so a skipped run would not report under the required name, but GitHub does not evaluate the name: of a skipped job, so the skipped run showed up under the raw expression text. The job now always runs (if: always()), so its name is always evaluated: on the paths that own the status it reports as ✅ Required PR Check and mirrors the test matrix's result, and on an in-repo feature PR's pull_request run it reports as ⏭️ Required PR Check (reported by the push run) and exits as a no-op.
Upgrade notes
- No runtime changes.
| Metric | Coverage |
|---|---|
| Statements | 32.8% |
| Branches | 25.3% |
| Functions | 50.7% |
| Lines | 32.9% |
Avg: 35.4% · 10a6d81 · Node lts/*
👥 Contributors
v1.0.9
@cldmv/envm v1.0.9 Changelog
Release Date: October 2026
Release Type: Patch
Availability: Tagged v1.0.9; no GitHub Release and not published to npm
Overview
A CI-only release: a skipped PR run can no longer satisfy the ✅ Required PR Check ruleset. No library or CLI code changed.
🔧 CI & tooling
A skipped PR run no longer satisfies Required PR Check (#30)
On an in-repo feature PR, the pull_request run skips the required-check mirror job because the push run on the head branch owns the status. GitHub still posts a check run for a skipped job and treats a skipped required check as passing, so the skipped job, named ✅ Required PR Check, could green-light the ruleset (and auto-merge) before the push run's real mirror existed. The job name is now an expression that evaluates to ✅ Required PR Check only on the paths that own the status.
Upgrade notes
- No runtime changes.
v1.0.8
@cldmv/envm v1.0.8 Changelog
Release Date: October 2026
Release Type: Patch
Availability: GitHub Release only (v1.0.8); not published to npm
Overview
A maintenance release with no change to the library or CLI. Every source, test, config and workflow file now carries the uniform CLDMV file header from the shared @cldmv/configs fix-headers config, the LICENSE file is restored to the verbatim Apache-2.0 text, the workflows are synced with the CLDMV/.github v4.29.2 templates, and the vitest toolchain moves to 5.0.2. The only edits under src/ are the new header comments.
🔧 CI & tooling
Uniform file headers from the shared CLDMV config (#26)
A new fix:headers script runs @cldmv/fix-headers against .configs/fix-headers.json, which extends @cldmv/configs/fix-headers.json. The first run stamped every file under src/ and tests/, eslint.config.mjs, jest.config.mjs and .configs/vitest.config.mjs with a header, and rewrote the workflow headers to the same layout, with ISO 8601 dates.
v4 workflow sync with CLDMV/.github v4.29.2 (#23, #24)
The workflows are synced with the current templates, adding bundle-size.yml, dependabot-recreate.yml, member-auto-merge.yml, pr-notify.yml, provenance.yml and release-merge.yml, keeping the template's full release-merge workflow list, moving master-commit-audit.yml onto the reusable workflow, and correcting the template header metadata.
📚 Documentation
LICENSEis restored to the verbatim Apache-2.0 text (#22): the Trademarks clause regains its "reasonable and customary use" wording. The license terms are unchanged.
🔧 Dependencies
vitest5.0.0 → 5.0.2 (#19, #27) and@vitest/coverage-v85.0.0 → 5.0.2 (#20, #28) — dev-only.- NEW dev dependencies:
@cldmv/configs^1.2.0and@cldmv/fix-headers^2.1.1, for the header tooling (#26).
Upgrade notes
- No runtime changes.
| Metric | Coverage |
|---|---|
| Statements | 32.8% |
| Branches | 25.3% |
| Functions | 50.7% |
| Lines | 32.9% |
Avg: 35.4% · 30e9e9a · Node lts/*
👥 Contributors
v1.0.7
@cldmv/envm v1.0.7 Changelog
Release Date: September 2026
Release Type: Patch
Availability: GitHub Release only (v1.0.7); not published to npm
Overview
A tooling release: vitest 5, the CLDMV bot's GPG secrets for redirected security PRs, and grouped Dependabot updates. No runtime code changed (#18).
🔧 CI & tooling
hotfix-redirector.ymlnow mapsCLDMV_BOT_NAME,CLDMV_BOT_EMAIL,CLDMV_BOT_GPG_PRIVATE_KEYandCLDMV_BOT_GPG_PASSPHRASEso security PRs redirected tohotfixesare cherry-picked as signed commits.ci.ymlandpublish.ymlraise the Node test-matrix defaults:min_node_versionfrom22to22.12.0(the floor vitest 5 runs on) andmax_node_majorfrom22to26..github/dependabot.ymladdsvitest,eslintandprettierupdate groups so peer-locked packages are bumped together.
🔧 Dependencies
vitest^4.1.10to^5.0.0(dev-only).@vitest/coverage-v8^4.1.10to^5.0.0(dev-only).
Upgrade notes
- No runtime changes; the package declares no
enginesfield, and that is unchanged.
👥 Contributors
v1.0.6
@cldmv/envm v1.0.6 Changelog
Release Date: August 2026
Release Type: Patch
Availability: GitHub Release only (v1.0.6); not published to npm
Overview
A maintenance release: an esbuild patch bump and bot-identity secret mappings in three release workflows. No runtime code changed (#11).
🔧 CI & tooling
feature-pr.yml,next-release.ymlandhotfixes-release.ymlnow passBOT_NAMEandBOT_EMAIL(from theCLDMV_BOT_NAMEandCLDMV_BOT_EMAILsecrets) to the reusable workflows.
🔧 Dependencies
esbuild0.28.1 to 0.28.2, resolved in the lockfile within the existing^0.28.1range (dev-only).vitestand@vitest/coverage-v84.1.10 to 4.1.11 in the lockfile (dev-only).
Upgrade notes
- No runtime changes.