Skip to content

fix(cli): inline string-width into the CLI bundle and gate packaged module resolution - #1266

Merged
arul28 merged 2 commits into
mainfrom
release/v1.2.75-cli-bundle
Sep 20, 2026
Merged

arul28 merged 2 commits into
mainfrom
release/v1.2.75-cli-bundle

Conversation

@arul28

@arul28 arul28 commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Problem

v1.2.75's release run (35494811333) failed all three packaging jobs: the packaged ade --help smoke threw Cannot find module 'string-width' on mac arm64, mac x64, and Windows.

Cause

cli.ts now imports tuiClient/displayWidth at module scope for the table formatters. tsup externalizes every package dependency, and the packaged CLI resolves externals through NODE_PATH into the desktop package's production tree, which does not include string-width. This checkout hoists a dev-only copy, so every local run passed.

Change and boundary

  • Inline string-width (CJS, 144 KB with deps) into the CLI bundle via noExternal.
  • verify-built-cli.mjs gains assertPackagedResolutionCliHelp(): copies the bundle into an empty directory, exposes only the desktop lock file's production packages on NODE_PATH, and runs --help. It names the missing module and distinguishes an uninstalled production dependency from an unshipped one.
  • No desktop dependency change; no runtime code change.

Verification

  • Fixed config: build + verifier pass; the isolated --help prints the banner.
  • Negative control: the previous config fails the new guard with bare require("string-width") … not in apps/desktop's production dependency tree.
  • Dual-track quality review on the diff: tsup change clean; guard findings applied (lock-derived tree, sibling NODE_PATH dir, explicit link cleanup, honest scope).

Authored with Claude Fable 5.1 via ADE.


Devin Review


Note

Low Risk
Build-time bundling and verification only; no runtime CLI behavior or desktop dependency changes beyond preventing a known packaging smoke failure.

Overview
Fixes packaged ade --help failing with Cannot find module 'string-width' by bundling that dependency instead of leaving it as an external resolved through the desktop app’s production NODE_PATH.

tsup.config.ts adds string-width to noExternal for the main CJS CLI bundle so module-scope imports from tuiClient/displayWidth (table formatters) are inlined rather than emitted as bare require() calls the shipped app cannot satisfy.

verify-built-cli.mjs adds assertPackagedResolutionCliHelp(), wired into the build verifier: it runs dist/cli.cjs --help from an isolated directory with only the desktop lockfile’s production packages on NODE_PATH, matching packaged resolution. Failures name the missing module and distinguish “not installed in checkout” vs “not in desktop’s production tree,” with guidance to inline via noExternal or add a desktop dependency.

Reviewed by Cursor Bugbot for commit bdd96c6. Configure here.

Summary by CodeRabbit

  • Bug Fixes

    • Improved packaged CLI dependency resolution so the help command runs reliably in desktop production environments.
    • Bundled a required text-width dependency directly with the CLI, preventing missing-module errors at runtime.
    • Added graceful handling when optional packaged-resolution checks cannot be completed in a checkout.
  • Tests

    • Enhanced verification of packaged CLI help output and production dependency resolution.

…odule resolution

The packaged ade CLI resolves tsup externals through NODE_PATH into the
desktop package's production tree. cli.ts now reaches tuiClient/displayWidth
at module scope, which requires string-width, a package the desktop app does
not ship, so v1.2.75's release run failed its packaged `ade --help` smoke
on mac and Windows. Inline string-width, and make verify-built-cli.mjs run
--help with only the desktop production tree on NODE_PATH so this class
fails at build time instead of after notarization.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
ade Ignored Ignored Preview Sep 20, 2026 7:34am UTC

@cursor

cursor Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_8cce6777-4921-441d-8de5-f88212ba6354)

@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: arul28/ADE/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 807755cd-7951-43ee-baee-da89ad807eef

📥 Commits

Reviewing files that changed from the base of the PR and between bdd96c6 and 3924e1e.

📒 Files selected for processing (1)
  • apps/ade-cli/scripts/verify-built-cli.mjs

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The CJS CLI now bundles string-width. Packaged CLI verification checks desktop dependencies first, falls back to CLI dependencies, and skips checks when shipped dependencies are absent from both trees.

Changes

Packaged CLI resolution

Layer / File(s) Summary
Bundle string-width
apps/ade-cli/tsup.config.ts
The CJS CLI configuration now inlines string-width instead of leaving it external.
Validate packaged CLI resolution
apps/ade-cli/scripts/verify-built-cli.mjs
The verification checks packaged CLI help, resolves dependencies from the desktop tree and then the CLI tree, skips unavailable shipped dependencies, and still throws for other missing modules. The top-level verification sequence continues to run this check.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes both primary changes: inlining string-width into the CLI bundle and gating packaged module resolution.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

…ee installed

The runtime-binary jobs build the CLI without installing apps/desktop, so
the gate saw every shipped package as not installed. Resolve names from the
desktop tree first and this package's own copy second; when a shipped
package is installed in neither, skip with a notice instead of failing —
the packaging jobs install the desktop app and run the same check.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@arul28
arul28 merged commit 3494d95 into main Sep 20, 2026
40 checks passed
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.

1 participant