Skip to content

Comments

fix: replace require() with ESM import in skills loader#207

Open
haosenwang1018 wants to merge 1 commit intoConway-Research:mainfrom
haosenwang1018:fix/skills-require-in-esm
Open

fix: replace require() with ESM import in skills loader#207
haosenwang1018 wants to merge 1 commit intoConway-Research:mainfrom
haosenwang1018:fix/skills-require-in-esm

Conversation

@haosenwang1018
Copy link
Contributor

Summary

  • checkRequirements() in skills/loader.ts calls require("child_process") inside the function body
  • Since the project uses "type": "module", require() is not available at runtime and throws ReferenceError
  • The error is silently caught by the try/catch on line 78, causing every skill with a requires.bins field to be skipped — binary requirement checks never actually run

Fix

  • Move execFileSync to a top-level ESM import statement (consistent with how skills/registry.ts already imports it)
  • Remove the inline require() call

Test plan

  • Verify npx tsc --noEmit passes (confirmed locally)
  • Create a skill with requires.bins: ["node"] and verify it loads correctly
  • Create a skill with requires.bins: ["nonexistent_binary"] and verify it is skipped

checkRequirements() uses require("child_process") inside the function
body (line 107). Since the project uses "type": "module", require() is
not available at runtime and throws ReferenceError. This silently
breaks skill requirement checks — every skill with a `requires.bins`
field is skipped because the error is caught on line 78.

Move to a top-level ESM import so execFileSync is available at runtime.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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