Bundle cua-cli with tsdown; smoke-test the bin in CI#30
Merged
Conversation
packages/cli used extensionless relative imports, which compile cleanly under moduleResolution Bundler and work in vitest, but fail at runtime with ERR_MODULE_NOT_FOUND when Node executes the published dist. Add .js extensions to all relative imports and switch the package to module/moduleResolution NodeNext so tsc enforces them from now on. Run the packed-tarball bin smoke test in the cli-unit CI job (mirrors release-cua-cli.yml) so the real binary is executed on every PR instead of only at release time.
Revert the .js-extension sweep and NodeNext switch; bundle the cli with tsdown (matching cua-ai and cua-agent) so extensionless relative imports keep working and the published dist runs under Node ESM. tsc -b now does declaration-only emit to dist-tsc for typechecking, tsdown owns dist/, and the root build bundles the cli after typechecking.
|
Created a monitoring plan for this PR. What this PR does: Fixes the Intended effect:
No production telemetry signal exists for this change — Risks:
Status updates will be posted automatically on this PR as monitoring progresses. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The packed-tarball smoke test (runbook step 4) fails with
ERR_MODULE_NOT_FOUND: ...dist/cli-harness. packages/cli used extensionless relative imports and shipped rawtscoutput — legal under the repo'smoduleResolution: "Bundler"and resolvable by vitest, but Node ESM requires fully-specified relative specifiers, so the published bin could never run. Nothing caught it because the only bin smoke test lives in the release workflow, which only runs oncua-cli/v*tags.Fix: bundle the cli with tsdown, the same build the other published packages (
cua-ai,cua-agent) already use. Bundling rewrites specifiers, so source imports stay extensionless.packages/clibuilds with tsdown (dist/cli.js+ split chunk for the dynamically imported TUI; deps externalized; shebang preserved).tsc -bbecomes declaration-only emit todist-tsc/for typechecking, mirroringpackages/agent.buildbundles the cli aftertsc -b, sonpm ci && npm run buildproduces a runnable bin.typesfield — it's a binary, and tsdown no longer emitscli.d.ts.cua --helpsmoke test into thecli-unitCI job so the real binary executes on every PR.Test plan
npm pack→ install into a temp project →./node_modules/.bin/cua --helpprints usage, exit 0; tarball shipsdist/cli.js+ chunksnpm run buildpasses (incl. ptywright native via zig)npx tsc -bcleanPTYWRIGHT_REQUIRED=1 npm test --workspace @onkernel/cua-cli— 33/33🤖 Generated with Claude Code
Note
Medium Risk
Changes the published CLI artifact and build pipeline; low runtime risk for library consumers but high impact if the bundled bin or pack layout is wrong—mitigated by the new CI smoke test.
Overview
Fixes published
@onkernel/cua-clifailing at runtime under Node ESM by bundling the CLI with tsdown instead of shipping rawtscoutput with extensionless relative imports.packages/clinow buildsdist/cli.jsvia tsdown (aligned withcua-ai/cua-agent), uses declaration-onlytscintodist-tsc/for typechecking, drops thetypesfield, and addstsdownas a dev dependency. The rootbuildscript runs the cli workspace build aftertsc -b.CI (
cli-unit) adds steps to build the cli,npm pack, install the tarball in a temp project, and smoke-testcua --helpso the real binary is exercised on every PR—not only on release tags.Reviewed by Cursor Bugbot for commit 1e0664b. Bugbot is set up for automated code reviews on this repo. Configure here.