Skip to content

fix: plugin hooks no-op on Node 21+ (require.main undefined under -e) + green the suite#2184

Merged
affaan-m merged 1 commit into
mainfrom
fix/green-main-hooks
Jun 7, 2026
Merged

fix: plugin hooks no-op on Node 21+ (require.main undefined under -e) + green the suite#2184
affaan-m merged 1 commit into
mainfrom
fix/green-main-hooks

Conversation

@affaan-m

@affaan-m affaan-m commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Root cause

Plugin hooks load plugin-hook-bootstrap.js via node -e "...; process.argv.splice(1,0,s); require(s)". On Node 21+, require.main is undefined under --eval, so the if (require.main === module) guard was false and main() never ran — every plugin hook silently no-op'd (e.g. the MCP-health PreToolUse hook stopped blocking unhealthy MCP calls). CI runs Node 18/20 where the trick still works, which is why this stayed hidden; it only surfaces on Node 21+.

Fix: also run main() when require.main is undefined (the eval-bootstrap case), while staying dormant on real require() imports (tests) where require.main is a defined, different module.

Also clears pre-existing main debt the full local suite enforces

Verification

Full suite 2683/2683 green under Node v25; lint + unicode clean. (Was 4 failures on Node 25 before.)


Summary by cubic

Fixes plugin hooks no-op on Node 21+ by running main() when require.main is undefined under node --eval; hooks now execute correctly while staying dormant on imports. Also greens the suite on Node 25, syncs agent/skill counts in docs, pins actions/checkout to v6.0.3, and applies markdown/unicode cleanup.

Written for commit 44da898. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores

    • Updated plugin inventory counts to reflect 64 agents and 255 skills across all documentation and configurations.
  • Bug Fixes

    • Fixed plugin hook execution to properly initialize in Node.js 21+ bootstrap scenarios.
  • Documentation

    • Improved formatting and consistency across documentation in multiple languages; corrected minor typos and spacing issues.

…rn Node

ROOT CAUSE: hooks load plugin-hook-bootstrap.js via
`node -e "...; process.argv.splice(1,0,s); require(s)"`. On Node 21+,
require.main is `undefined` under --eval, so the `if (require.main === module)`
guard was false and main() never ran — every plugin hook silently no-op'd
(e.g. the MCP-health PreToolUse hook stopped blocking). CI (Node 18/20) hid
this; it only surfaces on Node 21+. Fix: also run main() when require.main is
undefined (the eval-bootstrap case), while staying dormant on real imports.

Also clears pre-existing main debt the full local suite enforces:
- catalog:sync — README/docs agent+skill counts drifted after recent merges
- tests/ci/supply-chain-watch-workflow: update checkout SHA to the merged v6.0.3 (#2183)
- markdownlint + check-unicode-safety --write across docs/skills

Suite: 2683/2683 green under Node v25; lint + unicode clean.
@ecc-tools

ecc-tools Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

ECC bundle files are already tracked in this repository. Skipping generation of another bundle PR.

@affaan-m affaan-m merged commit e755c5f into main Jun 7, 2026
39 of 40 checks passed
@affaan-m affaan-m deleted the fix/green-main-hooks branch June 7, 2026 08:05
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5f80c891-e3b9-4be0-ae37-9f1b47c22fb2

📥 Commits

Reviewing files that changed from the base of the PR and between eef31ad and 44da898.

📒 Files selected for processing (36)
  • .claude-plugin/marketplace.json
  • .claude-plugin/plugin.json
  • AGENTS.md
  • README.md
  • README.zh-CN.md
  • agents/php-reviewer.md
  • docs/es/skills/quarkus-patterns/SKILL.md
  • docs/es/skills/quarkus-security/SKILL.md
  • docs/es/skills/quarkus-tdd/SKILL.md
  • docs/fixes/HOOK-FIX-20260421-ADDENDUM.md
  • docs/ja-JP/skills/agent-payment-x402/SKILL.md
  • docs/ja-JP/skills/homelab-pihole-dns/SKILL.md
  • docs/ja-JP/skills/homelab-wireguard-vpn/SKILL.md
  • docs/ja-JP/skills/quarkus-security/SKILL.md
  • docs/ja-JP/skills/quarkus-tdd/SKILL.md
  • docs/ja-JP/skills/quarkus-verification/SKILL.md
  • docs/tr/skills/quarkus-patterns/SKILL.md
  • docs/tr/skills/quarkus-security/SKILL.md
  • docs/tr/skills/quarkus-tdd/SKILL.md
  • docs/tr/skills/quarkus-verification/SKILL.md
  • docs/ur/README.md
  • docs/zh-CN/AGENTS.md
  • docs/zh-CN/README.md
  • scripts/hooks/plugin-hook-bootstrap.js
  • skills/codehealth-mcp/SKILL.md
  • skills/fastapi-patterns/SKILL.md
  • skills/frontend-a11y/SKILL.md
  • skills/homelab-pihole-dns/SKILL.md
  • skills/homelab-wireguard-vpn/SKILL.md
  • skills/inherit-legacy-style/SKILL.md
  • skills/motion-patterns/SKILL.md
  • skills/quarkus-patterns/SKILL.md
  • skills/quarkus-security/SKILL.md
  • skills/quarkus-tdd/SKILL.md
  • skills/quarkus-verification/SKILL.md
  • tests/ci/supply-chain-watch-workflow.test.js

📝 Walkthrough

Walkthrough

This PR updates the ECC plugin catalog inventory from 63/251 to 64/255 agents/skills across manifests and documentation, fixes plugin hook bootstrap execution for eval/Node 21+ loading paths, and applies extensive whitespace and formatting normalization across skill and documentation files.

Changes

Catalog inventory count updates

Layer / File(s) Summary
Plugin manifest and marketplace descriptions
.claude-plugin/marketplace.json, .claude-plugin/plugin.json
Marketplace metadata and plugin manifest descriptions updated to report 64 agents and 255 skills.
English README and AGENTS documentation
AGENTS.md, README.md
AGENTS.md and README.md updated with new inventory in capability statements, release notes, quick-start completion messages, repository tree, and feature parity tables.
Chinese locale documentation
README.zh-CN.md, docs/zh-CN/AGENTS.md, docs/zh-CN/README.md
Chinese-language documentation and feature comparison tables updated to reflect 64 agents / 255 skills across quick-start messages and parity tables.

Plugin hook bootstrap execution fix

Layer / File(s) Summary
Bootstrap execution guard broadening
scripts/hooks/plugin-hook-bootstrap.js
The main() execution condition is expanded to trigger when require.main === module or require.main is undefined, enabling plugin hooks to initialize in both direct-entry and eval/Node 21+ bootstrap loading paths.

Documentation and skill file formatting normalization

Layer / File(s) Summary
Skill and agent documentation formatting
docs/es/skills/quarkus-patterns/SKILL.md, docs/es/skills/quarkus-security/SKILL.md, docs/es/skills/quarkus-tdd/SKILL.md, docs/ja-JP/skills/*, docs/tr/skills/*, docs/ur/README.md, docs/fixes/HOOK-FIX-20260421-ADDENDUM.md, agents/php-reviewer.md, skills/quarkus-patterns/SKILL.md, skills/quarkus-security/SKILL.md, skills/quarkus-tdd/SKILL.md, skills/quarkus-verification/SKILL.md, skills/codehealth-mcp/SKILL.md, skills/fastapi-patterns/SKILL.md, skills/homelab-pihole-dns/SKILL.md, skills/homelab-wireguard-vpn/SKILL.md, skills/motion-patterns/SKILL.md, skills/frontend-a11y/SKILL.md, skills/inherit-legacy-style/SKILL.md
Comprehensive whitespace, blank-line, and line-wrap normalization across Spanish, Turkish, Japanese, and English skill documentation files. Java/XML/YAML code snippets, step lists, and Markdown examples are reflowed for consistency while preserving all example logic, code semantics, and documentation content.
Supply-chain workflow test assertion
tests/ci/supply-chain-watch-workflow.test.js
Updated the expected actions/checkout commit SHA in the workflow contract test to match the new pinned version.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • affaan-m/ECC#1607: Parallel catalog inventory and metadata refresh across plugin manifests and documentation (earlier rc1 surface-count update with different totals).
  • affaan-m/ECC#1766: Direct update to marketplace and plugin manifest description counts for agent/skill inventory.
  • affaan-m/ECC#2024: Concurrent marketplace plugin description count string updates in .claude-plugin/marketplace.json.

Poem

🐰 The counts have grown from sixty-three to four,
New skills bloom—now two-fifty-five and more!
With bootstrap paths now fixed, the hooks align,
And docs reformatted, oh so fine!
A tidy PR hops forward without a care,
Inventory, code, and docs—all polished fair! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/green-main-hooks

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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 and usage tips.

syarfandi pushed a commit to syarfandi/ECC that referenced this pull request Jun 9, 2026
…rn Node (affaan-m#2184)

ROOT CAUSE: hooks load plugin-hook-bootstrap.js via
`node -e "...; process.argv.splice(1,0,s); require(s)"`. On Node 21+,
require.main is `undefined` under --eval, so the `if (require.main === module)`
guard was false and main() never ran — every plugin hook silently no-op'd
(e.g. the MCP-health PreToolUse hook stopped blocking). CI (Node 18/20) hid
this; it only surfaces on Node 21+. Fix: also run main() when require.main is
undefined (the eval-bootstrap case), while staying dormant on real imports.

Also clears pre-existing main debt the full local suite enforces:
- catalog:sync — README/docs agent+skill counts drifted after recent merges
- tests/ci/supply-chain-watch-workflow: update checkout SHA to the merged v6.0.3 (affaan-m#2183)
- markdownlint + check-unicode-safety --write across docs/skills

Suite: 2683/2683 green under Node v25; lint + unicode clean.

Co-authored-by: ECC Test <ecc@example.test>
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