Repository navigation
refactor(examples/hooks-and-scripts): export main and let the generated envelope own the process (RFC #50 Phase 2) - #55
Merged
Conversation
…ed envelope own the process (RFC #50 Phase 2) Both artifact Scripts drop the self-executing try/catch ritual and export `main` returning their exit code; the framework-generated executable envelope owns argv, awaiting, and numeric exit-code adoption — including detect-risk's blocking return of 2, the wave's non-zero/non-one witness. Asset resolution via `new URL('../assets/…', import.meta.url)` is unchanged: the wrapper bundles into the same emitted module. Zero examples-contract assertions change.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
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.
Summary
Phase-2 wave (RFC #50, plan §1.2 — executable-envelope witness), on top of the merged Phase-1 implementation (#52).
src/scripts/verify-release.tsandsrc/scripts/detect-risk.tsdrop the top-level self-executing try/catch rituals and insteadexport const main = async (): Promise<number>; the framework's generated executable envelope (build/entry-shell.ts) owns argv, awaiting, and numeric exit-code adoption.detect-risk's blocking path nowreturn 2— the wave's non-trivial exit-code witness: the envelope adopts the numeric return verbatim (process.exitCode = code), verified end-to-end (built.mjsexits 2 withREL-204on stderr from an unrelated cwd).new URL('../assets/…', import.meta.url)resolution is unchanged: the envelope is a virtual wrapper bundled into the same emittedscripts/<name>.mjs, so module-URL semantics are identical to today's direct bundle.src/hooks/session-start.tsuntouched (already the convention). README gains one line noting the scripts exportmainwith a generated process envelope; walkthrough sections unchanged.examples-contract.test.ts— all pinned assertions (compiledEntriesnames, verify stdout, detect-risk exit 2 + REL-204) hold as-is.Q5 resolution (verified against shipped Phase-1 source)
mainexport only (build/entries.tswraps iffhasMainExport);defaultis reserved for bin entries (build/package-build.ts).import.meta.urlsemantics unchanged under the wrapper (empirically: built script resolves packaged assets from an unrelated cwd).Verification
pnpm --filter @agent-bundle-example/hooks-and-scripts check— pass, zero diagnostics.AGENT_BUNDLE_WORKBENCH_PREBUILT=1 AGENT_BUNDLE_PACKAGE_PREBUILT=1 pnpm exec rstest --config rstest.integration.config.ts packages/agent-bundle/tests/examples-contract.test.ts— all 3 examples pass, no assertion changes.pnpm typecheck+pnpm lint— clean.checkpasses,inspectshowspackageBuildabsent andscripts: [], default-distartifact manifest intact, zero drift.