Repository navigation
fix: rename root index.js to index.cjs for ESM compat - #845
Merged
Merged
Conversation
Root index.js uses CJS syntax (require, module.exports, module-level return) but root package.json has type:module, causing Node.js to parse it as ESM. The bare return; at line 408 triggers SyntaxError: Illegal return statement, failing 90/121 tests in insider release. Fix: rename to .cjs so Node always treats it as CommonJS, regardless of the package type field. Update all 9 test files that reference it. Fixes insider release workflow run #23997554171. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🛫 PR Readiness Check
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | No source files changed — changeset not required |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | No Copilot review threads |
| ❌ | CI passing | 17 check(s) still running |
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
Contributor
🟡 Impact Analysis — PR #845Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
tests (9 files)
This report is generated automatically for every PR. See #733 for details. |
Contributor
There was a problem hiding this comment.
Pull request overview
Renames the repo-root CLI entry point from index.js to index.cjs so it is always parsed as CommonJS under type: "module", and updates integration tests to execute the renamed file.
Changes:
- Add
index.cjsas the CommonJS CLI entry point (replacing the formerindex.jsusage). - Update 9
.cjsintegration tests to runindex.cjsinstead ofindex.js.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| index.cjs | New root CLI entry point using .cjs extension to avoid ESM parsing issues. |
| test/workflows.test.cjs | Points test CLI invocation to index.cjs. |
| test/version-stamping.test.cjs | Points test CLI invocation to index.cjs. |
| test/skills-export-import.test.cjs | Points test CLI invocation to index.cjs. |
| test/rework-rate.test.cjs | Points test CLI invocation to index.cjs. |
| test/plugin-marketplace.test.cjs | Points test CLI invocation to index.cjs. |
| test/migrate-directory.test.cjs | Points test CLI invocation to index.cjs. |
| test/mcp-config.test.cjs | Points test CLI invocation to index.cjs. |
| test/init-flow.test.cjs | Points test CLI invocation to index.cjs. |
| test/email-scrub.test.cjs | Points test CLI invocation to index.cjs. |
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.
Problem
Root index.js uses CJS syntax (require, module.exports, module-level return) but root package.json has type:module. Node.js parses .js files as ESM in this configuration, making the bare return; at line 408 an Illegal return statement.
This caused 90/121 tests to fail in the insider release workflow, blocking npm publish.
Fix
Scope
10 files changed. Purely a file extension rename + test reference updates. No logic changes.
Investigated and fixed by Brady's Squad Bot