fix(init): enable interactive Ink UI for npx/Node via ESM sidecar#938
fix(init): enable interactive Ink UI for npx/Node via ESM sidecar#938MathurAditya724 merged 2 commits intomainfrom
Conversation
|
Codecov Results 📊✅ 6837 passed | Total: 6837 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ❌ Patch coverage is 20.00%. Project has 13904 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 77.02% 77.05% +0.03%
==========================================
Files 317 317 —
Lines 60609 60594 -15
Branches 0 0 —
==========================================
+ Hits 46684 46690 +6
- Misses 13925 13904 -21
- Partials 0 0 —Generated by Codecov Action |
e247010 to
a46cca8
Compare
Ship the pre-bundled ink-app.js sidecar in the npm package so
`npx sentry@latest init` gets the full interactive Ink UI on Node,
not just LoggingUI.
The text-import-plugin now emits a path string (not an external
require) for the `with { type: "file" }` import in CJS bundles.
`createInkUI` resolves it via import.meta.url and loads the
self-contained ESM sidecar via dynamic import(). The factory no
longer gates on isBunRuntime() — Ink works on both runtimes.
Fixes #937
79271ee to
71c2372
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4bc4d03. Configure here.
| * npm/Node distribution. The `Bun` global only exists in the Bun | ||
| * runtime. | ||
| * | ||
| * Exported for the test suite — production callers should go through |
There was a problem hiding this comment.
Exported isBunRuntime() is now dead code
Low Severity
isBunRuntime() is still exported but no longer called anywhere in the codebase. Its only caller was shouldUseLogging(), and that call was removed in this PR. A grep confirms the only references are the definition itself and a stale comment in the test file — no code imports or invokes it.
Reviewed by Cursor Bugbot for commit 4bc4d03. Configure here.
## Summary - removes the exported `isBunRuntime()` function from `src/lib/init/ui/factory.ts` — it lost its only caller in #938 when `shouldUseLogging()` stopped gating on the Bun runtime - updates stale comment in the test file that referenced it Flagged by Cursor Bugbot in #938 (review).


npx sentry@latest initnow gets the full interactive Ink UI instead of failing with "The interactive UI failed to load."The pre-bundled
ink-app.jssidecar (self-contained ESM with ink/react/yoga-layout inlined) already existed for the Bun binary — this PR ships it in the npm package too. Thetext-import-pluginemits a path string instead of an externalrequire()for CJS bundles, andcreateInkUIresolves it viaimport.meta.url+ dynamicimport(). Node 22.12+ can load ESM from CJS context this way.Changes:
script/text-import-plugin.ts— for CJS format, emit virtual module exporting path string instead of{ external: true }script/bundle.ts— stop deletingdist/ink-app.jsafter bundlingsrc/lib/init/ui/ink-ui.ts— three-way path resolution (Bun binary / dev mode / Node npm)src/lib/init/ui/factory.ts— removeisBunRuntime()gate fromshouldUseLogging()package.json— adddist/ink-app.jstofilesTesting
bun run test:unit— 6838 tests passdist/ink-app.jsships (2.6 MB self-contained ESM)import()from CJS context on Node 22.20node dist/bin.cjs init --yes --dry-runstarts the wizard (no UI crash)mountAppandAppfunctions available from sidecarFixes #937