refactor: migrate to clibu#16
Conversation
…nfig for option resolution
…ing and configuration
There was a problem hiding this comment.
Pull request overview
This pull request migrates the Packlet CLI from Commander to Clibu, introduces unified configuration resolution from package.json.packlet, and adds comprehensive environment variable support. The refactor modernizes the CLI architecture, reduces dependencies, and provides a more consistent configuration experience.
Key changes:
- Replaced Commander with Clibu across all CLI entry points (
@packlet/cli,@packlet/gpr) - Introduced centralized configuration system in
@packlet/corewith precedence-based resolution (CLI > env > config > defaults) - Added comprehensive test coverage for configuration resolution and argv utilities
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/cli/src/index.ts |
Migrated from Commander to Clibu; integrated new config resolution system |
packages/gpr/src/index.ts |
Migrated from Commander to Clibu; updated command definitions |
packages/gpr/src/gpr-cli.ts |
Adapted to use resolveGprOptions from core config module |
packages/gpr/src/prepare-gpr.ts |
Integrated config resolution for GPR preparation |
packages/core/src/config.ts |
New centralized configuration module with resolution functions |
packages/core/src/cli-argv.ts |
New argv normalization and adaptation utilities for Clibu |
packages/core/src/index.ts |
Exports new config and argv utilities |
packages/core/test/config.test.ts |
Test coverage for configuration resolution precedence |
packages/core/test/argv-utils.test.ts |
Test coverage for argv utilities |
packages/cli/package.json |
Replaced commander with clibu dependency |
packages/gpr/package.json |
Replaced commander with clibu dependency |
packages/packlet/package.json |
Added workspace dev dependencies |
package.json |
Removed commander from root devDependencies; minor script update |
packages/packlet/README.md |
Updated documentation for new configuration model and CLI usage |
packages/gpr/README.md |
Updated to reflect Clibu migration and configuration support |
packages/core/README.md |
Documented new configuration API and precedence rules |
packages/cli/README.md |
Updated CLI documentation |
packages/build/README.md |
Minor documentation improvements |
README.md |
Updated root README with configuration overview |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| require("node:fs").writeFileSync( | ||
| manifestPath, | ||
| JSON.stringify(manifest, null, 2) | ||
| ) |
There was a problem hiding this comment.
The code uses require("node:fs") but fs is not imported at the top of the file. Since this is an ES module (indicated by the .mjs extension and ES import syntax), you should import fs at the top:
import fs from "node:fs"Then use:
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2))Alternatively, since the file already imports path, you could dynamically import it, but a static import is cleaner and more consistent with the rest of the codebase.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Below is a corrected and concise PR description that reflects the actual changes involving the CLI migration to Clibu and related functionality. Tone remains formal, technical, and aligned with typical PR documentation.
This pull request migrates the Packlet CLI implementation to Clibu, resulting in a lighter, more efficient, and better-structured command-line tool. The refactor simplifies internal logic, reduces overhead, and improves maintainability.
CLI Architecture and Performance
Configuration Enhancements
package.json.packletin addition to standard CLI flags, enabling more flexible and declarative project setup.package.jsonsettings with command-line arguments in a predictable manner.Collectively, these changes modernize the CLI, improve performance, and provide a more ergonomic configuration experience for Packlet users.