Skip to content

feat: build metadata architecture (npmx.dev/wolfstar.rocks pattern) with non-Vercel runtime fallback - #61

Closed
RedStar071 wants to merge 9 commits into
mainfrom
t3code/8a3a8997
Closed

feat: build metadata architecture (npmx.dev/wolfstar.rocks pattern) with non-Vercel runtime fallback#61
RedStar071 wants to merge 9 commits into
mainfrom
t3code/8a3a8997

Conversation

@RedStar071

@RedStar071 RedStar071 commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

Adds packages/build-env: resolves what a Nuxt build is — version, commit, branch, deploy
channel (dev/preview/canary/release), deploy URL — the way npmx.dev's config/env.ts and
wolfstar.rocks' config/env.ts + modules/build-env.ts do, and registers it as a Nuxt module in
both apps/dashboard and apps/marketing.

The dashboard now shows that metadata under the signed-in user: a new BuildEnvironment.vue
(mirroring wolfstar.rocks' component of the same name) renders build date, release version or
deploy channel, and a linked short commit, in the sidebar below UserMenu. It replaces the
sidebar's previous package.json-sourced version display, so version/channel/commit come from one
resolved source instead of two that could drift.

Why

The build-time resolution (npmx.dev/wolfstar.rocks pattern) reads a hosting provider's own git
variables first (VERCEL_GIT_*, Netlify's COMMIT_REF/CONTEXT, etc.) and the checkout second.
That works cleanly on Vercel, where every field is known while the build runs — but this project
also ships a self-hosted node .output/server/index.mjs bundle and can run behind other hosts
(Netlify, Cloudflare Pages, a plain container built in CI), none of which expose those variables
to the build step.

So this adds a second, run-time pass (runtimeBuildInfo) that completes only the fields the build
left as an unknown sentinel, from whatever environment the server actually starts in —
AGENT_ZERO_BUILD_COMMIT/_BRANCH/_PR_NUMBER/_URL/_PRODUCTION_URL/_ENV for a deployment
that wants to state itself outright, or auto-detected from Netlify/Cloudflare Pages/GitHub Actions
variables at boot. A field the build resolved is never overwritten — the commit a bundle was
compiled from is a property of the bundle, not of the machine serving the request. On Vercel this
pass is a no-op (same variables, same answer), so nothing changes for that target.

Package boundary: packages/build-env is explicitly not a runtime package — packages/agent,
packages/runner, and their adapters may not import it (documented in AGENTS.md). It has two
entry points matching its two halves: . (pure, no filesystem/subprocess/@nuxt/kit, safe inside
a serverless bundle) and ./nuxt (the build-time module, pulls in @nuxt/kit).

Verification

  • aube run check:repo
  • aube run lint:ci
  • aube run typecheck
  • aube test
  • aube run build (excluding apps/docs, which OOMs on this branch and on main alike —
    pre-existing, unrelated to this change; verified by stashing the one file touched there and
    reproducing the identical crash)

Safety and compatibility

  • I added or updated deterministic tests for changed behavior.
  • I preserved observe mode as read-only, or explained the policy change above.
  • Runtime commands and target-repository writes remain inside the runner boundary.
  • I did not expose secrets, tokens, personal data, or untrusted output in logs.
  • I updated documentation and Agent Skills when workflows or boundaries changed.

Agent context

  • Agent/tools used: Claude Code (Sonnet 5), full session — research, implementation, and
    verification.
  • What the agent did, and what you changed or verified yourself: The agent designed and implemented
    packages/build-env (provider table, git fallback, build-time/run-time resolution passes, Nuxt
    module), wired it into both apps, wrote the BuildEnvironment.vue component and sidebar
    integration, updated i18n locales/schema, docs, .env.example, turbo.jsonc, AGENTS.md, and
    the accompanying test suites. I reviewed the diff, confirmed the check suite and full build pass,
    and confirmed the apps/docs OOM is pre-existing rather than introduced by this change.

Reviewer notes

  • Two commits: feat(build-env) (the package + Nuxt wiring + docs) and
    feat(dashboard) (the sidebar UI + i18n), so the architecture and its one consumer can be
    reviewed separately.
  • apps/docs build was excluded from the full-workspace verification run above due to a
    pre-existing out-of-memory crash unrelated to this PR; worth a follow-up issue if not already
    tracked.

Note

Add @agent-zero/build-env package for build metadata resolution across Nuxt apps

  • Introduces packages/build-env with two-pass resolution: resolveBuildInfo collects metadata at build time from provider env vars, git, and package.json; runtimeBuildInfo completes unresolved fields on the server without overwriting build-time values
  • Detects Vercel, Netlify, Cloudflare Pages, GitHub Actions, and self-hosted overrides via deploymentMetadataFromEnvironment; classifies env as dev, release, canary, or preview
  • Nuxt module publishes metadata under runtimeConfig.public.buildInfo and generates a tree-shakable useBuildInfo() composable that memoizes server-completed values for client hydration
  • Dashboard sidebar replaces static version string with <BuildEnvironment /> component showing timestamp, channel/release link, and optional commit link; marketing app also adopts the module
  • Updates turbo.jsonc cache inputs to include git refs and provider env vars so cached builds do not carry stale metadata; adds AGENT_ZERO_BUILD_* overrides to .env.example files
  • Behavioral Change: normalizeBuildInfo converts blank strings back to null for nullable fields because Nuxt runtimeConfig serializes missing values as empty strings; the i18n version key group is renamed to build in en and it locales

Macroscope summarized 9013919.

…lback

Adds packages/build-env, resolving version/commit/branch/deploy-channel
from the hosting provider first and the checkout second (matching the
npmx.dev and wolfstar.rocks pattern), and registers it as a Nuxt module
in the dashboard and marketing apps.

Vercel resolves everything at build time. Every other target — a
container image built in CI, a self-hosted `node .output/server/index.mjs`
— resolves what it can from the checkout and completes the rest from
AGENT_ZERO_BUILD_* at server start, so a non-Vercel deployment still
reports the commit it is actually serving.
Adds BuildEnvironment.vue (mirroring wolfstar.rocks' component of the
same name), rendered in the sidebar below UserMenu: build date, the
release version or deploy channel, and a linked short commit.

Replaces the sidebar's package.json-sourced version with useBuildInfo(),
so version, deploy channel, and commit come from one resolved source
instead of two that could drift. common.version.label becomes
common.build.{label,releaseAria,commitAria} in en/it, with the schema
regenerated.
@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-zero-dashboard Error Error Aug 22, 2026 3:27pm
agent-zero-docs Ready Ready Preview Aug 22, 2026 3:27pm
agent-zero-marketing Ready Ready Preview Aug 22, 2026 3:27pm

Comment thread packages/build-env/src/build-info.ts Outdated
Comment thread packages/build-env/src/build-info.ts Outdated
Comment thread packages/build-env/src/environment.ts Outdated
Comment thread packages/build-env/src/build-info.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR introduces a new cross-application build metadata subsystem with provider detection, build/server resolution, public runtime configuration, cache changes, prerender integration, and new dashboard UI. Its broad deployment and runtime surface is beyond a small self-contained change and warrants human review.

You can add or adjust custom eligibility rules. Learn more.

• Replace unknownRevision sentinel with null for commit and branch fields
• Remove nullable() helper and update BuildInfo type
• Simplify runtime field completion with consistent null coalescing
Comment thread packages/build-env/src/build-info.ts Outdated
Comment thread packages/build-env/src/build-info.ts Outdated
- Remove absoluteUrlPattern regex and its comment
- No longer needed after recent metadata handling refactor
- Use ufo's withHttps for URL normalization instead of manual regex
- Pass deployment configuration to providers via ProviderOptions
- Support defaultBranch configuration for production branch detection
- Remove `shortCommit` from `BuildInfo` type; compute via `shortenCommit()` function
- Complete null-based revision field handling throughout
- Improve `defaultBranch` parameter passing to providers
- Simplify `package.json` reading with `pkg-types`
@vercel
vercel Bot temporarily deployed to Preview – agent-zero-marketing August 22, 2026 13:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – agent-zero-docs August 22, 2026 13:00 Inactive
@vercel
vercel Bot temporarily deployed to Preview – agent-zero-dashboard August 22, 2026 13:00 Inactive
- Add normalizeBuildInfo to convert Nuxt's empty string serialization back to null
- Clear stale preview/production URLs when environment classification changes
- Preserve explicit URL schemes instead of always upgrading to https
- Update Turbo cache inputs to include git refs for proper build cache busting
- Remove shortCommit field references; derive via shortenCommit() on-demand
Signed-off-by: RedStar <redstar071@proton.me>
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​agent-zero/​build-env@​0.4.0N/AN/AN/AN/AN/A

View full report

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.

1 participant