Add key mutation commands (add, set, unset, delete) for v0.0.4

- Add CLI commands: add, set, unset, delete for modifying .env files
- Add value auto-quoting for special characters (spaces, #, quotes, newlines)
- Add example file detection with warning for .env.example/.sample/.template
- Add library API: addEnvFileKey, setEnvFileKey, unsetEnvFileKey, deleteEnvFileKeys
- Export isExampleEnvFile utility
- Add tests for new mutation operations
- Update README and CHANGELOG
This commit is contained in:
David Ibia
2026-01-15 21:29:06 +01:00
parent d9d3a41b0f
commit a64cc5cdf6
9 changed files with 718 additions and 7 deletions

View File

@@ -4,6 +4,27 @@ All notable changes to this project are documented in this file.
This project follows [Semantic Versioning](https://semver.org/) and the format is loosely based on [Keep a Changelog](https://keepachangelog.com/).
## 0.0.4 (2026-01-15)
### Added
- Key mutation commands (CLI): `add`, `set`, `unset`, `delete`.
- `add`: Add a new key-value pair (fails if key already exists).
- `set`: Create or update a key-value pair (idempotent).
- `unset`: Set a key's value to empty (`KEY=`).
- `delete`: Remove key(s) from the file entirely (supports `--keys` for multiple).
- Value auto-quoting: Values with spaces, `#`, quotes, newlines, or other special characters are automatically double-quoted with proper escaping.
- Example file detection: Warns when targeting `.env.example`, `.env.sample`, `.env.template`, `.env.dist`, `.env.default(s)` files. Suppressible with `--no-example-warning`.
- Library API exports for key mutations: `addEnvFileKey`, `setEnvFileKey`, `unsetEnvFileKey`, `deleteEnvFileKeys`.
- Utility export: `isExampleEnvFile` for detecting example/template env files.
- Test coverage for new mutation operations.
### Changed
- Package version bumped to `0.0.4`.
- Updated CLI help text to include new commands and notes about dry-run behavior.
- Updated README with documentation for new commands and library API.
## 0.0.3 (2026-01-13)
### Added