Fix: bundle Action runtime with ncc to vendor agent-gov-core#18
Merged
Conversation
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.
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.
Real production bug, not just a self-dogfood failure
CapabilityEcho's
action.ymlusesusing: node24, main: dist/action.js— GitHub's node24 runner invokes the main file directly without anynpm installstep. So every runtime dep must be vendored into the published tarball.When PR #16 migrated
discovery.tstoimport 'agent-gov-core', that broke the published Action for any external consumer:That's what was making PR #17's
capability-driftself-check fail. The fix is also the proper pattern for node-runtime GitHub Actions.Fix
@vercel/nccas devDepbundle-actionnpm script:ncc build src/action.ts -o dist/action-bundle --minifyproduces a single self-contained 57KB JS file with all transitive deps inlined (agent-gov-core included).buildnow runs tsc + the bundle step.action.ymlmain path updated todist/action-bundle/index.js.Why only CapabilityEcho needed this
Other suite tools (ScopeTrail, PolicyMesh, TaskBound, SessionTrail) use
using: compositewithnpm ci && npm run buildat runtime, which handles deps a different way and doesn't have this problem.Test plan
build-testpassescapability-drift(which actually runs the published Action) passes