feat: Bundle blueprint into cli - #586
Merged
Merged
Conversation
razor-x
commented
Jul 28, 2026
Member
- feat: Cache the API blueprint on disk
- feat: Generate the blueprint at build time instead of caching it
- ci: Generate code
- Fix .gitignore
Building the blueprint costs around 700ms on every invocation, almost all of it evaluating @seamapi/types and running createBlueprint. Persist the result as JSON under the platform cache directory, which takes a full command from roughly 750ms to roughly 300ms. The blueprint is a pure function of @seamapi/types and @seamapi/blueprint, so their installed versions form the cache key together with a format version for changes to how the blueprint is built. Both packages are now imported dynamically, so a cache hit never pays to evaluate them; that also takes seam --version from roughly 420ms to roughly 260ms, since it no longer loads the API definitions to print a string. Remote definitions are never cached because they can change without any package version changing. Writes go through a rename so a concurrent invocation cannot read a partial file, stale entries are pruned when a new one is written, and any cache failure falls back to rebuilding rather than failing the command. SEAM_CLI_DISABLE_BLUEPRINT_CACHE bypasses it entirely. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XoC26cdSXPRxxJ4cbk4rrj
Replace the runtime blueprint cache with a blueprint.json generated by scripts/generate-blueprint.ts and shipped with the package. Nothing builds a blueprint on the default path any more, so @seamapi/types becomes a development dependency and an optional peer rather than a runtime one. It is most of the install: 63MB unpacked, because it ships ESM, CJS, TypeScript sources and both flavours of declarations, with multi-MB generated route types and OpenAPI document in each. An install goes from around 81MB to around 21MB, which is what matters for Homebrew and the AUR. env-paths and the user-level cache directory are gone with it. Generation is idempotent: the file records the versions it was generated from and is rewritten only when they change, so the prebuild and prestart hooks are cheap to re-run. It is not committed, since each revision would add a few MB to the repository permanently. Two paths still build a blueprint and so still need @seamapi/types: remote definitions, which describe whatever the server is running and cannot be generated ahead of time, and a working copy where blueprint.json has yet to be generated. Neither occurs in a published install, and reaching one without the package installed reports what to install. Spell out CustomMetadata structurally so the published declarations do not depend on the optional peer either. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XoC26cdSXPRxxJ4cbk4rrj
razor-x
marked this pull request as ready for review
July 28, 2026 21:52
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.