Repository navigation
ci(examples): typecheck the TypeScript examples against the SDK built in the PR (#143) - #152
Merged
Eras256 merged 1 commit intoOct 21, 2026
Conversation
… in the PR (nirium-protocol#143) Builds and packs packages/sdk once, then runs tsc --noEmit in every examples/*/tsconfig.json as a matrix job. Each example installs from its own lockfile and then gets the packed tarball in place of the nirium the lockfile pins, and the job fails unless node_modules/nirium matches the tarball. Examples are discovered at run time, so new ones are picked up without editing the workflow. ALLOWED_TO_FAIL lists examples broken on main; it is empty because all seven pass today. Runs on PRs and pushes to main that touch packages/sdk/** or examples/**. No secrets, read-only token, no network beyond npm install. Closes nirium-protocol#143 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
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.
Adds
.github/workflows/examples-typecheck.ymland.github/scripts/typecheck-example.sh. The workflow builds the SDK from the PR and runstsc --noEmiton each TypeScript example against that build, with one matrix job per example.How it works
build-sdk(same setup assdk-test.yml: Node 22,npm install --no-audit --no-fund --legacy-peer-deps,npm run build) runsnpm packonpackages/sdkand uploads the tarball as a 1-day artifact. It then lists everyexamples/*/tsconfig.jsonas the matrix. Discovery happens at run time, so a new example (for examplex402-policy-daily-budgetfrom feat(examples): daily-budget policy engine for the pre-sign hook (#127) #146) gets picked up without editing the workflow.typecheck (<example>), one job per example withfail-fast: false: it runsnpm cifrom the example's own lockfile, thennpm install --no-saveof the PR tarball in place of theniriumthe lockfile pins. The job fails unlessnode_modules/nirium/dist/index.d.tsis byte-identical to the tarball's (cmp), and only then runsnpx --no-install tsc --noEmit -p ..How each "Done when" item is met
packages/sdk/**orexamples/**: yes, plus the workflow and script themselves. It also runs on pushes tomainwith the same paths, assdk-test.ymldoes.niriumresolves to the SDK built in the same run: the PR tarball replaces the npm release the lockfile pins (0.10.1 to 0.14.1 today) or thefile:link to an unbuilt SDK. Thecmpcheck enforces that.permissions: contents: read, nosecrets.*, andtscmakes no network calls. Nothing runs the examples.ALLOWED_TO_FAIL(a space-separated list in the workflowenv, wired tocontinue-on-error) is empty and no extra issue was needed.express-x402has atsconfig.jsonbut does not depend onnirium. It is still typechecked, but nothing gets swapped in.Validation (Node 22.23.3, npm 10.9.9)
actionlint1.7.12 with shellcheck 0.11.0: no errors.shellcheckon the script: no warnings.nirium resolves to nirium-0.16.1.tgz(express-x402: nonirium) and passedtsc --noEmit. The replay also caught a bug in the first draft (npm packneeds the destination directory to exist), which is fixed.const broken: number = "not a number"in treasury-vault-quickstart):error TS2322, exit 2.Agent.getTreasuryVaultinpackages/sdk/src, then rebuilt and repacked): treasury-vault-quickstart fails witherror TS2551: Property 'getTreasuryVault' does not exist on type 'Agent', exit 2. The published 0.16.1 still has that method, so this proves the check runs against the PR build and not npm.Out of scope, as in the issue: running the examples, and the Go/Rust/Unity C# parts.
audit-forensic-bridge(pnpm, has atypecheckscript but notsconfig.json) andws-signals-resilient(notsconfig.json) are not covered.Closes #143