Skip to content

refactor(cli): add gt package#1069

Merged
ErnestM1234 merged 12 commits intomainfrom
e/gt/init-package
Mar 5, 2026
Merged

refactor(cli): add gt package#1069
ErnestM1234 merged 12 commits intomainfrom
e/gt/init-package

Conversation

@ErnestM1234
Copy link
Contributor

@ErnestM1234 ErnestM1234 commented Mar 5, 2026

  • change gtx-cli to gt
  • keep gtx-cli synced for backwards compatability

Summary by CodeRabbit

  • New Features

    • CLI rebranded to "gt" with a backward-compatible "gtx-cli" wrapper and packaged binary releases
  • Documentation

    • Installation, Quick Start and examples updated to use gt; gtx-cli marked as deprecated/migration guidance added
  • CI / Release

    • Workflows updated to build, test, and publish gt and gtx-cli binaries
  • Tests

    • New tests ensuring subpath re-exports across modules
  • Chores

    • Installer and user-facing messages updated to reference gt; release tooling and packaging scripts added
  • Config

    • Release/config entries updated to link gt and gtx-cli in release tooling

Greptile Summary

This PR renames the primary CLI package from gtx-cli to gt (living in packages/cli/) and adds a new thin gtx-cli wrapper package (packages/gtx-cli/) that re-exports everything from gt for backward compatibility. All internal consumers (locadex, examples, tests) and CI/release workflows are updated accordingly.

Key changes:

  • packages/cli/ is renamed to package name gt; binary names updated to gt-*
  • New packages/gtx-cli/ wrapper package delegates to gt via re-exports and a shebang entry point that overrides program.name back to gtx-cli
  • CI gains a dedicated test-cli-binaries job for gt and preserves test-gtx-cli-binaries for the wrapper
  • R2 upload paths split: gt binaries go to cli/, gtx-cli binaries to gtx-cli/
  • Changesets fixed group ensures both packages share the same version

Issues found:

  • assets/install.sh has BINARY_NAME="gtx" (unchanged from before) while the success message was updated to reference gt. The binary is physically installed as gtx on disk, but users are instructed to run gt --help, which will not be found.

Confidence Score: 3/5

  • Mostly safe to merge, but the install.sh BINARY_NAME bug means the shell-script installer directs users to a non-existent command after installation.
  • The monorepo restructuring and backward-compat wrapper are well-structured. The one concrete bug — BINARY_NAME="gtx" not updated to "gt" in install.sh — causes the shell installer to put the binary at the wrong name while advertising the new name in the success message, breaking the user-facing install flow for anyone using curl | sh.
  • assets/install.sh (BINARY_NAME mismatch), packages/gtx-cli/package.json (phantom export subpaths and missing vitest devDependency — noted in prior review threads)

Important Files Changed

Filename Overview
assets/install.sh BINARY_NAME is still "gtx" while the success message was updated to reference "gt", causing a mismatch: the binary is installed as gtx but users are told to run gt --help.
packages/gtx-cli/package.json New backward-compat wrapper package. Exports subpath map mirrors the gt package but the gtx-cli source tree only contains index/functions/main/bin files — the wildcard subpath exports (updates/, jsx/, fs/*, etc.) resolve to dist directories that will never be built by tsc. vitest is also missing from devDependencies.
packages/gtx-cli/src/bin/bin-entry.ts Entry point for the gtx-cli binary wrapper. Imports main from gt, overrides the program name back to gtx-cli for backward compat, then parses. Correct ordering.
packages/gtx-cli/src/bin/bin-main.ts Platform-routing binary launcher for gtx-cli. Correctly maps to gtx-cli-* binary names that match the build-exe.sh output. Minor: error event handler exits silently with no diagnostic message.
packages/cli/package.json Package renamed from gtx-cli to gt with alpha version bump. Exports and dependencies look correct.
packages/locadex/src/cli.ts Import paths correctly updated from gtx-cli to gt. GT_DASHBOARD_URL import from gt/utils/constants matches the exported subpath in the gt package.
.github/workflows/ci.yml New test-cli-binaries job for gt added alongside the existing test-gtx-cli-binaries job. Both jobs are correctly wired into run-tests needs. Change detection updated to watch both packages/cli/ and packages/gtx-cli/.
.github/workflows/release.yml Added gt binary build and upload steps. gtx-cli binaries now upload to a separate gtx-cli/ R2 prefix instead of the shared cli/ prefix. Changes look correct.
packages/gtx-cli/scripts/build-exe.sh Builds gtx-cli-* named binaries for all platforms, consistent with bin-main.ts detection map.
packages/gtx-cli/scripts/prepare-binary-release.js Correctly modifies package.json for binary release by appending -bin.0 suffix and pointing bin to dist/bin/bin-main.js.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph npm["npm registry"]
        PKG_GT["gt (packages/cli/)"]
        PKG_GTX["gtx-cli (packages/gtx-cli/)"]
    end

    subgraph users["End users"]
        U1["npx gt ..."]
        U2["npx gtx-cli ..."]
        U3["curl | sh install.sh"]
    end

    subgraph internals["Internal consumers"]
        LOC["locadex"]
        TESTS["cli-test-app"]
    end

    U1 -->|"bin: dist/main.js"| PKG_GT
    U2 -->|"bin: dist/main.js\nsets program.name('gtx-cli')"| PKG_GTX
    PKG_GTX -->|"re-exports via export * from 'gt'"| PKG_GT
    U3 -->|"downloads gt-* binary\ninstalls as BINARY_NAME (gtx ⚠️)"| PKG_GT
    LOC -->|"import from 'gt'"| PKG_GT
    TESTS -->|"pnpm gt --help"| PKG_GT

    PKG_GT -->|"builds"| BIN_GT["gt-darwin-arm64\ngt-linux-x64\ngt-win32-x64.exe\n..."]
    PKG_GTX -->|"builds"| BIN_GTX["gtx-cli-darwin-arm64\ngtx-cli-linux-x64\ngtx-cli-win32-x64.exe\n..."]
Loading

Comments Outside Diff (2)

  1. assets/install.sh, line 11 (link)

    BINARY_NAME mismatch causes incorrect binary name

    The BINARY_NAME is still set to "gtx" (a leftover from the previous name), but the rest of the script has been updated to reference gt. This causes the binary to be installed as gtx in $INSTALL_DIR, while the success message on line 150 tells users to run 'gt --help'. The command_exists "$BINARY_NAME" check on line 148 will also look for a command named gtx rather than gt, so it will always fall into the warning branch even after a successful install.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: assets/install.sh
    Line: 11
    
    Comment:
    **`BINARY_NAME` mismatch causes incorrect binary name**
    
    The `BINARY_NAME` is still set to `"gtx"` (a leftover from the previous name), but the rest of the script has been updated to reference `gt`. This causes the binary to be installed as `gtx` in `$INSTALL_DIR`, while the success message on line 150 tells users to run `'gt --help'`. The `command_exists "$BINARY_NAME"` check on line 148 will also look for a command named `gtx` rather than `gt`, so it will always fall into the warning branch even after a successful install.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
  2. assets/install.sh, line 11 (link)

    BINARY_NAME not updated — binary installed as gtx, not gt

    BINARY_NAME is still "gtx", so the binary is written to ${INSTALL_DIR}/gtx (e.g. /usr/local/bin/gtx). Meanwhile the success message on line 150 was changed to "Run 'gt --help' to get started." — but that command does not exist on disk. The command_exists "$BINARY_NAME" check (line 148) will find gtx, so no warning is printed, and the user is directed to run a command that will return command not found.

Last reviewed commit: dbe8bdc

@ErnestM1234 ErnestM1234 requested a review from a team as a code owner March 5, 2026 19:28
@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5ab81368-69b5-46ce-9c79-e4388fdd7070

📥 Commits

Reviewing files that changed from the base of the PR and between da09e9a and 95d4cab.

📒 Files selected for processing (1)
  • .github/workflows/benchmark.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/benchmark.yml

📝 Walkthrough

Walkthrough

Renames the primary CLI package from gtx-cli to gt, adds a backward-compatible gtx-cli wrapper that re-exports gt, updates CI and release workflows to build/test/publish binaries for both, and propagates name and docs changes across installer, examples, packages, and tests.

Changes

Cohort / File(s) Summary
Changesets & Workspace
\.changeset/config.json, pnpm-workspace.yaml, package.json
Added fixed link tying gtgtx-cli, excluded gt from minimumReleaseAge checks, and added release:gt-bin npm script.
CI / Release Workflows
.github/workflows/ci.yml, .github/workflows/release.yml
Added matrix jobs to build/test CLI binaries (multi-OS/arch), duplicated flows for gtx-cli, and release steps to build/upload binaries to R2 (versioned & latest) and publish npm packages for both gt and gtx-cli.
Primary CLI (gt)
packages/cli/package.json, packages/cli/README.md, packages/cli/scripts/build-exe.sh, packages/cli/src/...
Renamed package to gt, updated binary names to gt-*, changed CLI name/messages/usages across source, and added vitest devDependency.
Wrapper package (gtx-cli)
packages/gtx-cli/* (new) — e.g. package.json, README.md, tsconfig.json, vitest.config.ts, .gitignore, .npmignore, src/**, scripts/*
New package providing a backward-compatible wrapper: re-exports from gt, binary runner/launcher, multi-arch build scripts, package prep/restore scripts, tests, and deprecation/migration docs.
Re-exports / API surface
packages/gtx-cli/src/** (many files)
Added numerous export * from 'gt/...' files to preserve subpath exports and public API surface under the gtx-cli package.
Binary runners & build scripts
packages/gtx-cli/src/bin/bin-main.ts, packages/gtx-cli/scripts/build-exe.sh, packages/cli/scripts/build-exe.sh
Added platform-aware binary launcher and per-arch build scripts for gtx-cli; updated cli build script to emit gt binaries.
Installer & Assets
assets/install.sh
Rebranded installer strings, variables, and download paths from gtx-cli/gtx to gt.
Examples & Example configs
examples/*/package.json (multiple)
Replaced dependency gtx-cligt and updated build scripts to use npx gt translate.
Internal packages & imports
packages/locadex/*, packages/*/README.md, packages/*/local-dev.md
Swapped internal dependencies and import paths from gtx-cligt; updated docs and local-dev notes.
Tests & Test apps
tests/apps/**/package.json (several)
Added/updated workspace dependency entries to include gt (replacing or alongside gtx-cli).
Subpath export tests & changelog
packages/gtx-cli/__tests__/subpath-exports.test.ts, .changeset/chatty-papers-fold.md
Added tests validating re-exports and updated changeset metadata to include gt package bump.
Misc
.github/workflows/benchmark.yml, small docs/ts comments, assets/*
Minor workflow step additions and doc/comment updates referencing gt.

Sequence Diagram(s)

sequenceDiagram
  participant Release as Release Workflow
  participant Build as Build Step
  participant R2 as R2 Storage
  participant NPM as npm Registry

  Release->>Build: detect published packages (gt / gtx-cli)
  alt gt published
    Release->>Build: build gt binaries (multi-arch)
    Build->>R2: upload rgba(0,128,0,0.5) gt/v<version>/*
    Build->>R2: upload rgba(0,128,0,0.5) gt/latest/*
    Build->>NPM: publish gt binary package
  end
  alt gtx-cli published
    Release->>Build: build gtx-cli binaries (multi-arch)
    Build->>R2: upload rgba(0,0,255,0.5) gtx-cli/v<version>/*
    Build->>R2: upload rgba(0,0,255,0.5) gtx-cli/latest/*
    Build->>NPM: publish gtx-cli binary package
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • archie-mckenzie

Poem

🐰 I hopped through files both near and far,

Swapped names from gtx to gt, a shiny star.
A gentle wrapper keeps the old paths warm,
Binaries build and CI hums along the form.
Hooray — carrots for releases and a comfy dorm! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'refactor(cli): add gt package' accurately summarizes the main change: introducing a new 'gt' package as the primary CLI while maintaining 'gtx-cli' as a backward-compatible wrapper.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch e/gt/init-package

Comment @coderabbitai help to get the list of available commands and usage tips.

@archie-mckenzie
Copy link
Contributor

@greptile-ai re-review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 16

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/ci.yml (1)

180-199: ⚠️ Potential issue | 🟠 Major

test-gtx-cli-binaries has the same matrix coverage gap.

This job also defines per-arch/per-binary matrix values but validates pnpm gtx-cli --help instead of checking the actual built artifact for each matrix row.

💡 Minimal validation fix
-      - name: Test gtx-cli in test environment
+      - name: Validate built gtx-cli binary artifact
         if: steps.gtx_cli_changed.outputs.changed == 'true'
         shell: bash
-        run: cd tests/apps/cli-test-app && pnpm install && pnpm gtx-cli --help
+        run: |
+          test -f "packages/gtx-cli/binaries/${{ matrix.binary }}"
+          if [ "${{ matrix.arch }}" = "x64" ]; then
+            "./packages/gtx-cli/binaries/${{ matrix.binary }}" --help
+          fi

Also applies to: 247-255

🧹 Nitpick comments (4)
packages/gtx-cli/src/bin/bin-main.ts (1)

13-33: Consider centralizing platform mapping to avoid drift with packages/cli/src/bin/bin-main.ts.

This mapping is likely duplicated across launchers; keeping a shared resolver module reduces rebrand/compatibility regressions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/gtx-cli/src/bin/bin-main.ts` around lines 13 - 33, The
platform-to-binary mapping in detectPlatform (the platformMap constant and
detectPlatform function) is duplicated across launchers; extract this mapping
and resolution logic into a single shared resolver function (e.g.,
resolvePlatformBinary or getCliBinaryName) in a common module and replace the
local platformMap/detectPlatform in this file and the other launcher with
imports that call the shared resolver; ensure the exported function accepts
Node's process.platform and process.arch (or reads them internally) and
preserves the same return shape (string | null) so callers like detectPlatform
keep behaviour unchanged.
packages/gtx-cli/scripts/restore-package-json.js (1)

17-19: Capture original bin value before modifying it in prepare-binary-release.js.

At Line 18 in restore-package-json.js, hardcoding packageJson.bin = 'dist/main.js' ignores the original shape of the field. If bin is (or becomes) an object with multiple aliases, this approach will silently lose those entries. The prepare-binary-release.js script should capture the original bin value (like it does for version) and the restore script should use that captured value instead of assuming a fixed string.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/gtx-cli/scripts/restore-package-json.js` around lines 17 - 19, The
restore script is overwriting packageJson.bin with a hardcoded string and will
lose original shapes (strings or objects); capture the original bin value in
prepare-binary-release.js the same way originalVersion is captured (e.g., store
originalBin alongside originalVersion) and update restore-package-json.js to set
packageJson.bin = originalBin (or delete the field if originalBin was undefined)
instead of packageJson.bin = 'dist/main.js', referencing the same stored
variable name you add (originalBin) so multi-entry bin objects are preserved.
packages/gtx-cli/src/main.ts (1)

11-13: Use await program.parseAsync() for async command actions.

The commands registered via main(program) are async, and using program.parse() prevents Commander from waiting for them to complete. Switch to await program.parseAsync() to ensure proper promise handling and error consistency, especially when async actions may perform I/O or other async operations.

Proposed fix
 main(program);
 program.name('gtx-cli');
-program.parse();
+await program.parseAsync();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/gtx-cli/src/main.ts` around lines 11 - 13, The CLI is calling
program.parse() which doesn't await async command handlers; change the call in
main flow to await program.parseAsync() so Commander will wait for promises from
async actions registered in main(program); update the invocation where
main(program) executes and replace program.parse() with await
program.parseAsync(), and ensure the surrounding function is async or top-level
await is used so the await is valid.
packages/gtx-cli/package.json (1)

19-19: Avoid duplicate binary build in release script.

build:bin:clean already invokes build:bin, so the second call is redundant.

Proposed fix
-    "build:bin:release": "pnpm run build:bin:clean && pnpm run build:bin",
+    "build:bin:release": "pnpm run build:bin:clean",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/gtx-cli/package.json` at line 19, The "build:bin:release" npm script
currently runs "build:bin:clean && build:bin", but "build:bin:clean" already
invokes "build:bin", causing a redundant second build; update the
"build:bin:release" script to only call the cleaning script (i.e., replace the
current command with just "pnpm run build:bin:clean" or otherwise remove the
extra "&& pnpm run build:bin") so the release script doesn't perform the binary
build twice and references the existing scripts "build:bin:release",
"build:bin:clean", and "build:bin" when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 105-123: The CI matrix defines matrix.arch and matrix.binary but
never uses them to validate the produced artifacts; update the test-cli-binaries
job (referencing matrix.arch and matrix.binary) to download the built CLI
artifact(s) for the current matrix entry and assert the expected binary exists
and is runnable, e.g. add a step after artifact/package creation that uses
actions/download-artifact or similar to fetch packages/cli/binaries and then a
run step that checks packages/cli/binaries/${{ matrix.binary }} (or the
equivalent produced path) for existence and executability and runs a basic
invocation (e.g. --version or help) to validate the binary output; apply the
same changes to the corresponding matrix job block around the other matrix
entries referenced (the second block at lines 171-179).

In @.github/workflows/release.yml:
- Around line 87-93: Replace the brittle grep/sed JSON parsing in the gt-version
step (id: gt-version) and the gtx-cli extraction step with jq: read the
steps.changesets.outputs.publishedPackages JSON into a variable
(published_packages), use jq to select the object where .name == "gt" (and
separately .name == "gtx-cli") and extract .version, write that value to
GITHUB_OUTPUT as version, and add validation that the extracted version is
non-empty; if jq returns nothing or the version is empty, print an error to
stderr and exit 1 so the job fails fast instead of producing malformed paths.

In `@assets/install.sh`:
- Around line 149-153: The post-install messages are hardcoded to "gt" while the
script uses the BINARY_NAME variable (and checks/installs
"${BINARY_NAME}"/install_path); update the user-facing messages to reference the
actual binary variable (use "${BINARY_NAME}" instead of "gt") so the info and
warn calls (info "gt installed successfully!", info "Run 'gt --help'...", warn
"gt was installed to ${install_path}", etc.) are consistent with the
install/verification logic and reflect any rename.
- Line 121: The installer uses the Bash-only "local" keyword (e.g., declaration
of tmp_file in the function where tmp_file is set) which breaks POSIX /bin/sh;
remove all "local" prefixes (there are ~8 occurrences) and instead declare
variables with plain assignments at the start of the function (e.g.,
tmp_file="${tmp_dir}/gt"), ensure names are unique to avoid clobbering outer
scope, and explicitly unset or reassign them at function end if needed to mimic
local scope; update every function that uses local (search for "local "
occurrences) to follow this pattern so the script remains POSIX-compliant.

In `@examples/next-gt-starter/package.json`:
- Line 7: The "build" script in package.json uses a semicolon so `next build`
runs even if `gt translate` fails; change the "build" script entry (the "build"
key in package.json) to use a logical AND operator so the script fails fast
(i.e., run gt translate && next build) ensuring `next build` only runs if `gt
translate` succeeds.

In `@packages/cli/src/index.ts`:
- Line 10: The program name is hardcoded via program.name('gt') inside main,
which forces wrappers to override it; change main to make the CLI name
injectable by either (a) adding an optional parameter to main (e.g.,
main(program, cliName?) and call program.name(cliName) only when cliName is
provided, or (b) only call program.name(...) if program.name() is unset so
callers that set the name (the wrapper that calls main(program)) keep their
identity; update usages that call main(program) accordingly and keep the symbol
references program.name and main(program) consistent.

In `@packages/gtx-cli/__tests__/wrapper.test.ts`:
- Around line 2-7: The test currently imports main from the wrong module ('gt'),
so update the import in wrapper.test.ts to import { main } from 'gtx-cli' (the
wrapper package) and keep the existing assertion that typeof main is 'function'
to ensure the wrapper actually re-exports the symbol; locate the test file and
replace the import source while leaving the test name and expect assertion
intact.

In `@packages/gtx-cli/.gitignore`:
- Line 3: Replace the non-standard gitignore pattern **.tgz with the
conventional *.tgz in the packages/gtx-cli/.gitignore so the rule clearly and
idiomatically matches all .tgz files at any directory level; update the line
containing the pattern to use *.tgz.

In `@packages/gtx-cli/.prettierrc`:
- Line 8: Replace the deprecated JSON key "jsxBracketSameLine" in the
.prettierrc entry with the supported "bracketSameLine" (or remove the option
entirely to match the root config); locate the key "jsxBracketSameLine" in the
package's Prettier config, rename it to "bracketSameLine" and keep the boolean
value, or delete the key if you prefer to align with the root omission and other
packages.

In `@packages/gtx-cli/package.json`:
- Line 31: The release:bin script can skip bin:restore and build:clean if pnpm
publish fails due to the && chaining; update the "release:bin" script so the
publish step cannot short-circuit the rest (e.g., run pnpm publish --tag bin
--no-git-checks with a fail-tolerant form such as appending "|| true" or
wrapping the publish in a shell try/finally construct) so that pnpm run
bin:restore and pnpm run build:clean always execute after pnpm run bin:prep and
pnpm run build:bin:clean even if pnpm publish fails.

In `@packages/gtx-cli/scripts/build-exe.sh`:
- Around line 1-75: Add strict failure handling and safe variable quoting:
enable fail-fast by adding "set -euo pipefail" at the top of the script so any
failing bun build stops the script (preventing chmod on missing files), and
update the case dispatch to quote the ARCH variable (use case "$ARCH" in place
of case $ARCH) so values with spaces are handled safely; modify the existing
build_* functions (build_darwin_x64, build_darwin_arm64, build_linux_x64,
build_linux_arm64, build_windows_x64) and the case block to rely on these
changes so failed builds halt immediately and the script does not print "Build
complete!" on errors.

In `@packages/gtx-cli/scripts/prepare-binary-release.js`:
- Around line 14-18: The current code always appends "-bin.0" to
packageJson.version (using originalVersion and binaryVersion), causing
double-suffixing if run twice; change the logic in prepare-binary-release.js to
first derive a baseVersion by stripping any existing "-bin" suffix (e.g. use a
regex to remove /-bin(?:\.\d+)?$/ from packageJson.version or originalVersion),
then set packageJson.version = `${baseVersion}-bin.0`; reference
originalVersion, binaryVersion and packageJson.version when locating where to
change the assignment so the operation becomes idempotent.

In `@packages/gtx-cli/src/bin/bin-main.ts`:
- Around line 18-29: The child process close handler in bin-main.ts currently
treats a null exit code as failure; update the child.on('close', ...) logic in
the launcher (the handler attached to the spawned child in
packages/gtx-cli/src/bin/bin-main.ts — same logic exists in
packages/cli/src/bin/bin-main.ts) to detect the signal parameter and propagate
it using process.kill(process.pid, signal) when signal is truthy, otherwise exit
with the child code (process.exit(code ?? 1)); after fixing, factor the common
launcher/routing logic into a shared helper to avoid duplication between the two
bin-main.ts files.
- Around line 70-73: The child 'close' handler currently ignores the signal
parameter and always exits with code 1 on null code; update the
child.on('close', (code, signal) => { ... }) handler to preserve termination
semantics by checking signal first: if signal is set, re-emit/propagate that
signal to the current process (e.g., process.kill(process.pid, signal));
otherwise exit with the actual numeric code (use process.exit(code ?? 0)). Apply
this change to the child.on('close' ...) callback in the code using that pattern
(same fix required in the other bin-main.ts).

In `@packages/gtx-cli/src/main.ts`:
- Around line 7-10: The .env.production file is being loaded unconditionally via
dotenv.config({ path: '.env.production', override: true }) and will overwrite
local/dev variables; update the startup logic around dotenv.config calls so that
dotenv.config({ path: '.env.production', override: true }) only runs when
process.env.NODE_ENV === 'production' (or equivalent env check) after loading
.env and .env.local; keep the existing override order (.env, then .env.local
override true, then .env.production only in production) and ensure you still
pass override: true for the later loads to preserve intended precedence.

In `@packages/tanstack-start/local-dev.md`:
- Line 104: Replace the personal/stale phrase with a neutral, explicit
transitional instruction: change the sentence that says “I haven't set up `gt`
yet, so import `<T>` from `gt-react` and when you wrap `gt()` around a string,
wrap it in `msg()` from `gt-react` as well for registration” to something like
“Until `gt` is wired into this template, import `T` from `gt-react` and use
`msg()` to register any strings you wrap with `gt()` (e.g., wrap `gt()` calls in
`msg()`).” Ensure the updated wording references `gt`, `gt-react`, `T`, `msg()`,
and `gt()` exactly so readers know which symbols to use.

---

Nitpick comments:
In `@packages/gtx-cli/package.json`:
- Line 19: The "build:bin:release" npm script currently runs "build:bin:clean &&
build:bin", but "build:bin:clean" already invokes "build:bin", causing a
redundant second build; update the "build:bin:release" script to only call the
cleaning script (i.e., replace the current command with just "pnpm run
build:bin:clean" or otherwise remove the extra "&& pnpm run build:bin") so the
release script doesn't perform the binary build twice and references the
existing scripts "build:bin:release", "build:bin:clean", and "build:bin" when
making the change.

In `@packages/gtx-cli/scripts/restore-package-json.js`:
- Around line 17-19: The restore script is overwriting packageJson.bin with a
hardcoded string and will lose original shapes (strings or objects); capture the
original bin value in prepare-binary-release.js the same way originalVersion is
captured (e.g., store originalBin alongside originalVersion) and update
restore-package-json.js to set packageJson.bin = originalBin (or delete the
field if originalBin was undefined) instead of packageJson.bin = 'dist/main.js',
referencing the same stored variable name you add (originalBin) so multi-entry
bin objects are preserved.

In `@packages/gtx-cli/src/bin/bin-main.ts`:
- Around line 13-33: The platform-to-binary mapping in detectPlatform (the
platformMap constant and detectPlatform function) is duplicated across
launchers; extract this mapping and resolution logic into a single shared
resolver function (e.g., resolvePlatformBinary or getCliBinaryName) in a common
module and replace the local platformMap/detectPlatform in this file and the
other launcher with imports that call the shared resolver; ensure the exported
function accepts Node's process.platform and process.arch (or reads them
internally) and preserves the same return shape (string | null) so callers like
detectPlatform keep behaviour unchanged.

In `@packages/gtx-cli/src/main.ts`:
- Around line 11-13: The CLI is calling program.parse() which doesn't await
async command handlers; change the call in main flow to await
program.parseAsync() so Commander will wait for promises from async actions
registered in main(program); update the invocation where main(program) executes
and replace program.parse() with await program.parseAsync(), and ensure the
surrounding function is async or top-level await is used so the await is valid.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dc50d383-a68e-4899-a5a7-00cea16858a4

📥 Commits

Reviewing files that changed from the base of the PR and between 87be9eb and dbe8bdc.

⛔ Files ignored due to path filters (2)
  • packages/cli/src/generated/version.ts is excluded by !**/generated/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (51)
  • .changeset/config.json
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • README.md
  • assets/install.sh
  • examples/create-react-app/package.json
  • examples/next-chatbot/package.json
  • examples/next-create-app/package.json
  • examples/next-gt-starter/package.json
  • examples/next-pages-router/package.json
  • examples/next-ssg/package.json
  • examples/vite-create-app/package.json
  • package.json
  • packages/cli/README.md
  • packages/cli/package.json
  • packages/cli/scripts/build-exe.sh
  • packages/cli/src/bin/bin-main.ts
  • packages/cli/src/cli/base.ts
  • packages/cli/src/console/index.ts
  • packages/cli/src/functions.ts
  • packages/cli/src/index.ts
  • packages/cli/src/setup/agentInstructions.ts
  • packages/cli/src/setup/instructions/base.md
  • packages/cli/src/setup/wizard.ts
  • packages/cli/src/translation/validate.ts
  • packages/gtx-cli/.gitignore
  • packages/gtx-cli/.npmignore
  • packages/gtx-cli/.prettierrc
  • packages/gtx-cli/README.md
  • packages/gtx-cli/__tests__/wrapper.test.ts
  • packages/gtx-cli/package.json
  • packages/gtx-cli/scripts/build-exe.sh
  • packages/gtx-cli/scripts/prepare-binary-release.js
  • packages/gtx-cli/scripts/restore-package-json.js
  • packages/gtx-cli/src/bin/bin-entry.ts
  • packages/gtx-cli/src/bin/bin-main.ts
  • packages/gtx-cli/src/functions.ts
  • packages/gtx-cli/src/index.ts
  • packages/gtx-cli/src/main.ts
  • packages/gtx-cli/tsconfig.json
  • packages/gtx-cli/vitest.config.ts
  • packages/locadex/package.json
  • packages/locadex/src/cli.ts
  • packages/next/README.md
  • packages/react/README.md
  • packages/tanstack-start/README.md
  • packages/tanstack-start/local-dev.md
  • pnpm-workspace.yaml
  • tests/apps/cli-test-app/package.json
  • tests/apps/next/base/package.json
  • tests/apps/next/general-cases/package.json

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
packages/gtx-cli/package.json (1)

31-31: ⚠️ Potential issue | 🟠 Major

Ensure cleanup always runs after binary publish attempts.

Line 31 still short-circuits on publish failure, so bin:restore/build:clean can be skipped and leave the manifest in binary-release mode.

Proposed fix
-    "release:bin": "pnpm run bin:prep && pnpm run build:bin:clean && pnpm publish --tag bin --no-git-checks && pnpm run bin:restore && pnpm run build:clean",
+    "release:bin": "sh -c 'set -e; pnpm run bin:prep; trap \"pnpm run bin:restore; pnpm run build:clean\" EXIT; pnpm run build:bin:clean; pnpm publish --tag bin --no-git-checks'",
#!/bin/bash
set -euo pipefail

python - <<'PY'
import json, pathlib
p = pathlib.Path("packages/gtx-cli/package.json")
data = json.loads(p.read_text())
s = data["scripts"]["release:bin"]
print("release:bin =", s)
if "pnpm publish" in s and "trap" not in s:
    print("FAIL: cleanup is not guaranteed if publish fails")
    raise SystemExit(1)
print("PASS: cleanup guard detected")
PY
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/gtx-cli/package.json` at line 31, Update the release:bin script so
cleanup always runs even if pnpm publish fails: in the release:bin entry, set an
EXIT trap that runs "pnpm run bin:restore && pnpm run build:clean" before
running the sequence of bin:prep, build:bin:clean and pnpm publish (and clear
the trap after publish if desired); this ensures bin:restore and build:clean run
on any exit from the script. Target the release:bin script in package.json and
reference the existing steps bin:prep, build:bin:clean, pnpm publish,
bin:restore and build:clean when making the change.
🧹 Nitpick comments (2)
.changeset/chatty-papers-fold.md (1)

16-16: Make the release note explicit about rename + compatibility.

The current text is a bit terse for a user-facing changelog. Consider mentioning that gt is now primary and gtx-cli remains as a compatibility wrapper.

Suggested wording
-feat: add new gt package
+feat(cli): make `gt` the primary CLI package and keep `gtx-cli` as a compatibility wrapper
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/chatty-papers-fold.md at line 16, Update the release note line
"feat: add new gt package" to explicitly state the rename and compatibility: say
that the package has been renamed so "gt" is now the primary CLI package and
"gtx-cli" remains available as a compatibility wrapper for existing workflows,
ensuring users know both the rename and backward compatibility; edit the line in
.changeset/chatty-papers-fold.md that currently reads "feat: add new gt package"
to a fuller sentence including "gt" and "gtx-cli".
packages/gtx-cli/package.json (1)

19-19: Avoid running binary build twice in build:bin:release.

Line 19 calls build:bin again even though Line 18 (build:bin:clean) already ends with pnpm run build:bin.

Proposed simplification
-    "build:bin:release": "pnpm run build:bin:clean && pnpm run build:bin",
+    "build:bin:release": "pnpm run build:bin:clean",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/gtx-cli/package.json` at line 19, The "build:bin:release" npm script
is invoking the binary build twice; update the package.json so
"build:bin:release" only runs the cleaner script (or only runs the build)
instead of chaining both when "build:bin:clean" already invokes "build:bin";
edit the "build:bin:release" script entry to remove the redundant "&& pnpm run
build:bin" (leave just "pnpm run build:bin:clean" or change to a single "pnpm
run build:bin" depending on desired behavior), referencing the script names
"build:bin:release", "build:bin:clean", and "build:bin".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@packages/gtx-cli/package.json`:
- Line 31: Update the release:bin script so cleanup always runs even if pnpm
publish fails: in the release:bin entry, set an EXIT trap that runs "pnpm run
bin:restore && pnpm run build:clean" before running the sequence of bin:prep,
build:bin:clean and pnpm publish (and clear the trap after publish if desired);
this ensures bin:restore and build:clean run on any exit from the script. Target
the release:bin script in package.json and reference the existing steps
bin:prep, build:bin:clean, pnpm publish, bin:restore and build:clean when making
the change.

---

Nitpick comments:
In @.changeset/chatty-papers-fold.md:
- Line 16: Update the release note line "feat: add new gt package" to explicitly
state the rename and compatibility: say that the package has been renamed so
"gt" is now the primary CLI package and "gtx-cli" remains available as a
compatibility wrapper for existing workflows, ensuring users know both the
rename and backward compatibility; edit the line in
.changeset/chatty-papers-fold.md that currently reads "feat: add new gt package"
to a fuller sentence including "gt" and "gtx-cli".

In `@packages/gtx-cli/package.json`:
- Line 19: The "build:bin:release" npm script is invoking the binary build
twice; update the package.json so "build:bin:release" only runs the cleaner
script (or only runs the build) instead of chaining both when "build:bin:clean"
already invokes "build:bin"; edit the "build:bin:release" script entry to remove
the redundant "&& pnpm run build:bin" (leave just "pnpm run build:bin:clean" or
change to a single "pnpm run build:bin" depending on desired behavior),
referencing the script names "build:bin:release", "build:bin:clean", and
"build:bin".

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cc34696a-e1e5-48a2-8412-918c5e8234d4

📥 Commits

Reviewing files that changed from the base of the PR and between dbe8bdc and 12cc8f6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • .changeset/chatty-papers-fold.md
  • assets/install.sh
  • packages/cli/package.json
  • packages/gtx-cli/.gitignore
  • packages/gtx-cli/__tests__/subpath-exports.test.ts
  • packages/gtx-cli/package.json
  • packages/gtx-cli/src/config/generateSettings.ts
  • packages/gtx-cli/src/config/resolveConfig.ts
  • packages/gtx-cli/src/fs/config/setupConfig.ts
  • packages/gtx-cli/src/fs/matchFiles.ts
  • packages/gtx-cli/src/next/parse/handleInitGT.ts
  • packages/gtx-cli/src/next/parse/wrapContent.ts
  • packages/gtx-cli/src/react/parse/wrapContent.ts
  • packages/gtx-cli/src/types/index.ts
  • packages/gtx-cli/src/utils/installPackage.ts
  • packages/gtx-cli/src/utils/packageInfo.ts
  • packages/gtx-cli/src/utils/packageJson.ts
  • packages/gtx-cli/src/utils/packageManager.ts
✅ Files skipped from review due to trivial changes (2)
  • packages/gtx-cli/src/fs/config/setupConfig.ts
  • packages/gtx-cli/src/utils/packageManager.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/cli/package.json
  • packages/gtx-cli/.gitignore

@ErnestM1234 ErnestM1234 enabled auto-merge (squash) March 5, 2026 21:04
@ErnestM1234 ErnestM1234 merged commit ff38c7c into main Mar 5, 2026
26 checks passed
@ErnestM1234 ErnestM1234 deleted the e/gt/init-package branch March 5, 2026 21:29
@github-actions github-actions bot mentioned this pull request Mar 5, 2026
ErnestM1234 pushed a commit that referenced this pull request Mar 5, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## gt@2.7.0

### Minor Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

## gtx-cli@2.7.0

### Minor Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

### Patch Changes

- Updated dependencies
\[[`ff38c7c`](ff38c7c)]:
    -   gt@2.7.0

## @generaltranslation/compiler@1.1.24

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

## locadex@1.0.110

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

- Updated dependencies
\[[`ff38c7c`](ff38c7c)]:
    -   gt@2.7.0

## gt-next@6.13.4

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

- Updated dependencies
\[[`ff38c7c`](ff38c7c)]:
    -   @generaltranslation/compiler@1.1.24
    -   gt-react@10.11.3

## @generaltranslation/gt-next-lint@11.0.4

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

- Updated dependencies
\[[`ff38c7c`](ff38c7c)]:
    -   gt-next@6.13.4

## gt-react@10.11.3

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

- Updated dependencies
\[[`ff38c7c`](ff38c7c)]:
    -   @generaltranslation/react-core@1.5.3

## @generaltranslation/react-core@1.5.3

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

## @generaltranslation/react-core-linter@0.1.3

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

## gt-tanstack-start@0.1.10

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

- Updated dependencies
\[[`ff38c7c`](ff38c7c)]:
    -   @generaltranslation/react-core@1.5.3
    -   gt-react@10.11.3

## next-ssg@0.1.1

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

## gt-next-middleware-e2e@0.1.4

### Patch Changes

- [#1069](#1069)
[`ff38c7c`](ff38c7c)
Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - feat: add new
gt package

- Updated dependencies
\[[`ff38c7c`](ff38c7c)]:
    -   gt-next@6.13.4

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants