Skip to content

fix(setup): remove stale CJS bundle check from setup-open-code - #3908

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.26from
herjarsa:fix/setup-opencode-cli-improvements
Jun 15, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.26from
herjarsa:fix/setup-opencode-cli-improvements

Conversation

@herjarsa

Copy link
Copy Markdown
Contributor

Follow-up to #3883.

#3883 dropped the CJS bundle from tsup (format: ["esm"] only), but bin/cli/commands/setup-open-code.mjs::resolveBundledPlugin() still checks for dist/index.cjs:

if (!existsSync(esmEntry) || !existsSync(cjsEntry)) { throw ... }

The cjs check always fails now, so omniroute setup opencode throws even when the plugin is correctly built (only the ESM dist is present). This breaks the setup command on the release branch post-#3883.

Changes

  • Drop the cjsEntry check in resolveBundledPlugin()
  • Update JSDoc @returns to remove cjsEntry
  • Refresh the comment to reflect ESM-only build

Testing

  • All 4 tests in tests/unit/cli-setup-opencode.test.ts pass
  • All 4 tests in tests/unit/cli-setup-command.test.ts pass
  • npm run typecheck:core clean

Scoped narrowly to the CJS check; the other follow-ups you mentioned (security validation, Windows USERPROFILE) are skipped here since they touched the same file and would conflict with the version on the release branch. Happy to rebase against a more recent base if you want those too.

PR diegosouzapw#3883 dropped the CJS bundle from tsup (format: ["esm"] only), but
bin/cli/commands/setup-open-code.mjs::resolveBundledPlugin() still
checks for dist/index.cjs:

  if (!existsSync(esmEntry) || !existsSync(cjsEntry)) { throw ... }

The cjs check always fails now, so the setup command throws even when
the plugin is correctly built (only the ESM dist is present). This
breaks `omniroute setup opencode` on the release branch post-diegosouzapw#3883.

Drop the cjsEntry check, update the JSDoc return type, and refresh the
comment to reflect the ESM-only build. All 8 existing tests pass.
@herjarsa
herjarsa requested a review from diegosouzapw as a code owner June 15, 2026 16:02

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request transitions the @omniroute/opencode-plugin build to ESM-only by removing CommonJS (CJS) support in bin/cli/commands/setup-open-code.mjs. The review feedback correctly points out that the JSDoc description still references the deleted dist/index.cjs file and needs updating. Additionally, the feedback notes that corresponding tests must be added or updated to comply with the repository style guide regarding changes to production code under the bin/ directory.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

* may not have tsup available (it's a devDependency).
*
* @returns {{ distEntry: string, cjsEntry: string, packageDir: string }}
* @returns {{ distEntry: string, packageDir: string }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The JSDoc description above (specifically on line 84 of the file) still mentions dist/index.cjs (e.g., Built (dist/index.cjs + dist/index.js exist)). Since the CommonJS bundle has been dropped, please update that description to reflect that only dist/index.js is expected.

const cjsEntry = join(BUNDLED_PLUGIN_DIR, "dist", "index.cjs");

if (!existsSync(esmEntry) || !existsSync(cjsEntry)) {
if (!existsSync(esmEntry)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

According to the Repository Style Guide (Rule 9), you must always include or update tests when changing production code under bin/. Since bin/cli/commands/setup-open-code.mjs has been modified, please ensure that corresponding test changes or additions are included in this pull request.

References
  1. Always include tests when changing production code (src/, open-sse/, electron/, bin/). (link)

@diegosouzapw

Copy link
Copy Markdown
Owner

Thanks, @herjarsa! 🙏 Perfect follow-up to #3883 — after the CJS bundle was dropped, setup-open-code.mjs was still requiring dist/index.cjs to exist, so it would have failed even on a correct ESM-only build. Removing the stale check (and the cjsEntry from the return shape) closes that loop. Tests green (4/4). Merging into release/v3.8.26. 🚀

@diegosouzapw
diegosouzapw merged commit c45f992 into diegosouzapw:release/v3.8.26 Jun 15, 2026
2 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jun 16, 2026
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
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