Skip to content

Commit 3eae2a5

Browse files
committed
chore: bump version to 0.1.9, resolve version dynamically, and document new features in README
1 parent 45e723c commit 3eae2a5

4 files changed

Lines changed: 34 additions & 4 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [0.1.8] - 2026-07-13
8+
## [0.1.9] - 2026-07-13
99

1010
### Added
1111

@@ -14,6 +14,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
- Added `init` command to bootstrap `.env.example` templates by parsing an active `.env` file, preserving formatting/comments, and stripping variable values.
1515
- Configured continuous integration automation in `.github/workflows/ci.yml` verifying builds, tests, lints, and format rules.
1616
- Created `SECURITY.md` defining supported versions and secure vulnerability disclosure channels.
17+
- Updated CLI entry to dynamically resolve program version from `package.json` at runtime, preventing manual synchronization overhead.
18+
- Expanded `README.md` to document the new `init` command, the `--mode` flag, and multi-environment cascading rules.
1719

1820
### Fixed
1921

‎README.md‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
- [Comparison](#comparison)
4545
- [Command Reference](#command-reference)
4646
- [Options](#options)
47+
- [Multi-Environment Support](#multi-environment-support)
4748
- [CI/CD Integration](#cicd-integration)
4849
- [Contributing](#contributing)
4950
- [License](#license)
@@ -289,12 +290,34 @@ envrepair check
289290

290291
Runs validation without interactive prompts, outputs differences in JSON, and exits with status 1 if variables are missing. Designed for CI/CD scripting.
291292

293+
### init
294+
295+
```bash
296+
envrepair init
297+
```
298+
299+
Bootstraps a `.env.example` template by parsing an active `.env` file, preserving all spacing, comments, and structure while stripping the values of all variables.
300+
292301
## Options
293302

294-
- `-e, --env <path>`: Path to the active env file (defaults to `.env`).
303+
- `-e, --env <path>`: Path to the active env file.
295304
- `-x, --example <path>`: Path to the template example file (defaults to `.env.example`).
305+
- `-m, --mode <name>`: Specifies environment mode (e.g. `development`, `production`). Resolves cascading files matching the mode.
296306
- `-h, --help`: Displays help information.
297307

308+
## Multi-Environment Support
309+
310+
`envrepair` automatically supports multi-environment configurations using priority-based cascading resolution, mirroring standard frameworks (such as Next.js and Vite).
311+
312+
When you run `envrepair` without file path overrides, it scans and merges variables from existing active files in the following priority order (from lowest to highest):
313+
314+
1. `.env` (lowest priority)
315+
2. `.env.${mode}` (if `--mode` is specified)
316+
3. `.env.local` (local overrides; skipped if `--mode test` is used)
317+
4. `.env.${mode}.local` (highest priority; if `--mode` is specified)
318+
319+
Any missing variables identified will be appended to the highest priority existing override file on disk (defaulting to `.env` or `.env.${mode}`).
320+
298321
## CI/CD Integration
299322

300323
In headless environments, `envrepair` skips prompts and exits with status 1 if variables are missing:

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "envrepair",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"description": "Self-healing environment configuration manager for local development",
55
"type": "module",
66
"main": "./dist/index.js",

‎src/cli/index.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Command } from "commander"
22
import path from "node:path"
3+
import { readFileSync } from "node:fs"
4+
import { fileURLToPath } from "node:url"
35
import { findEnvFiles, fileExists } from "../utils/env-files.js"
46
import { compareEnvs } from "../core/differ.js"
57
import { appendVariables } from "../core/writer.js"
@@ -9,12 +11,15 @@ import { launchProcess } from "../runner/proxy.js"
911
import { isCI } from "../utils/ci.js"
1012
import { log } from "../utils/logger.js"
1113

14+
const pkgPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../package.json")
15+
const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"))
16+
1217
const program = new Command()
1318

1419
program
1520
.name("envrepair")
1621
.description("Self-healing environment configuration manager for local development")
17-
.version("0.1.8")
22+
.version(pkg.version)
1823
.option("-e, --env <path>", "Path to the environment file")
1924
.option("-x, --example <path>", "Path to the example template file")
2025
.option("-m, --mode <name>", "Environment mode (e.g. development, production, test)")

0 commit comments

Comments
 (0)