refactor(tool): unify the cli entrypoint#275
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the tools package by consolidating multiple standalone CLI scripts (json-edit, replace-file-content, snap-test) into a single tool binary with subcommands. The change centralizes tool execution through a main entry point and updates TypeScript configuration to support the new structure.
Key changes:
- Consolidated three separate binaries into one
toolbinary with subcommands - Refactored each tool script to export functions instead of executing directly
- Updated package.json scripts to use the new
tool <subcommand>pattern
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Adds tools package to TypeScript project references |
| packages/tools/tsconfig.json | Configures TypeScript compilation for the tools package |
| packages/tools/src/snap-test.ts | Refactored to export snapTest() function and accept filtered arguments |
| packages/tools/src/replace-file-content.ts | Refactored to export replaceFileContent() function |
| packages/tools/src/json-edit.ts | Refactored to export jsonEdit() function |
| packages/tools/src/index.ts | New main entry point that routes to subcommands |
| packages/tools/src/bin.js | Bootstrap file that registers oxc-node and imports the TypeScript entry point |
| packages/tools/src/tests/utils.spec.ts | Updates import to remove .ts extension |
| packages/tools/snap-tests/replace-file-content/snap.txt | Test snapshot showing expected output (indicates test needs updating) |
| packages/tools/package.json | Updates bin configuration to use single tool binary |
| packages/cli/package.json | Updates snap-test script to use new tool command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
810f8b6 to
bebb0fb
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
eb3acc3 to
22137d3
Compare
22137d3 to
bcc886c
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: LongYinan <lynweklm@gmail.com>
bcc886c to
c20bde7
Compare

I'm preparing to add more tools to
@voidzero-dev/vite-plus-tools. Before adding more commands and tools, I want to unify the CLI entry point first.