Skip to content

feat: Bundle blueprint into cli - #586

Merged
razor-x merged 12 commits into
mainfrom
bundle-blueprint
Jul 28, 2026
Merged

feat: Bundle blueprint into cli#586
razor-x merged 12 commits into
mainfrom
bundle-blueprint

Conversation

@razor-x

@razor-x razor-x commented Jul 28, 2026

Copy link
Copy Markdown
Member
  • feat: Cache the API blueprint on disk
  • feat: Generate the blueprint at build time instead of caching it
  • ci: Generate code
  • Fix .gitignore

claude and others added 12 commits July 28, 2026 05:39
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
razor-x marked this pull request as ready for review July 28, 2026 21:52
@razor-x razor-x changed the title Bundle blueprint into cli feat: Bundle blueprint into cli Jul 28, 2026
@razor-x
razor-x merged commit 59e38aa into main Jul 28, 2026
12 checks passed
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.

3 participants