Skip to content

Fix: bundle Action runtime with ncc to vendor agent-gov-core#18

Merged
Conalh merged 1 commit into
mainfrom
fix/bundle-action-runtime
May 22, 2026
Merged

Fix: bundle Action runtime with ncc to vendor agent-gov-core#18
Conalh merged 1 commit into
mainfrom
fix/bundle-action-runtime

Conversation

@Conalh
Copy link
Copy Markdown
Owner

@Conalh Conalh commented May 22, 2026

Real production bug, not just a self-dogfood failure

CapabilityEcho's action.yml uses using: node24, main: dist/action.js — GitHub's node24 runner invokes the main file directly without any npm install step. So every runtime dep must be vendored into the published tarball.

When PR #16 migrated discovery.ts to import 'agent-gov-core', that broke the published Action for any external consumer:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'agent-gov-core' imported from
/home/runner/work/_actions/Conalh/CapabilityEcho/main/dist/discovery.js

That's what was making PR #17's capability-drift self-check fail. The fix is also the proper pattern for node-runtime GitHub Actions.

Fix

  • @vercel/ncc as devDep
  • New bundle-action npm script: ncc build src/action.ts -o dist/action-bundle --minify produces a single self-contained 57KB JS file with all transitive deps inlined (agent-gov-core included).
  • build now runs tsc + the bundle step.
  • action.yml main path updated to dist/action-bundle/index.js.
  • One test that asserts the action.yml main path was updated accordingly.

Why only CapabilityEcho needed this

Other suite tools (ScopeTrail, PolicyMesh, TaskBound, SessionTrail) use using: composite with npm ci && npm run build at runtime, which handles deps a different way and doesn't have this problem.

Test plan

CapabilityEcho's action.yml uses 'using: node24, main: dist/action.js' —
GitHub's node24 runner invokes the main file directly without any
'npm install' step, so every runtime dep must be vendored.

When PR #16 migrated discovery.ts to import from agent-gov-core, that
broke the published Action: dist/action.js eventually resolves
'agent-gov-core' which isn't in the published tarball's tree. Real
production bug — any external consumer of Conalh/CapabilityEcho@main
was hitting ERR_MODULE_NOT_FOUND on first run.

Fix:
- @vercel/ncc as devDep
- 'bundle-action' npm script: ncc bundles src/action.ts into a single
  self-contained dist/action-bundle/index.js with all transitive deps
  (including agent-gov-core) inlined. 57KB minified.
- action.yml main: dist/action-bundle/index.js
- Test asserting the action.yml main path updated accordingly.

This is the standard pattern for Node-runtime GitHub Actions (used by
actions/checkout, etc.). Other suite tools (TaskBound, PolicyMesh,
SessionTrail, ScopeTrail) use 'using: composite' with npm ci + npm run
build at runtime, which handles deps differently and doesn't have this
problem — only CapabilityEcho needed the bundler.
@Conalh Conalh merged commit 4720513 into main May 22, 2026
3 of 4 checks passed
@Conalh Conalh deleted the fix/bundle-action-runtime branch May 22, 2026 17:29
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