feat(build-env): resolve build metadata with a non-Vercel runtime fallback - #64
Merged
Merged
Conversation
…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.
• 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
- 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`
- 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>
…shot The dashboard's Vercel build failed in Nitro's `node-externals` pass with `ENOENT: realpath` on `node_modules/.aube/@better-auth+drizzle-adapter@1.6.26_.../node_modules/drizzle-orm`. Both `@better-auth/drizzle-adapter` snapshots in `pnpm-lock.yaml` listed their `drizzle-orm` peer as drizzle-orm@0.45.2(...)(prisma@7.9.1)(sql.js@1.14.2) while the only `drizzle-orm@0.45.2` snapshot the lockfile defines — and the one already embedded in each adapter's own snapshot key — is drizzle-orm@0.45.2(...)(prisma@7.9.1(better-sqlite3@12.11.1))(sql.js@1.14.2) The referenced peer variant has no snapshot entry, so the installer linked the adapter's `drizzle-orm` at a store path it never materialized. `packages/auth` imports `drizzleAdapter`, so Nitro traces into it and the dangling link aborts the build; `apps/marketing` never reaches better-auth, which is why only the dashboard deploy failed while marketing stayed green on the same commits. Both references now name the snapshot that exists, matching the peer id each adapter's snapshot key already carries. After the change the set of unresolved snapshot references in the lockfile is identical to `main`'s. Verified with a frozen install followed by `NITRO_PRESET=vercel turbo run build --filter=@agent-zero/dashboard`, which now completes and writes `.vercel/output`. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SjNmQ7vt3nXuoeyAbrF7Nj
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a new cross-provider build-metadata system with server-side fallback, SSR serialization, deployment classification, cache-key changes, and dashboard UI integration. Its effects span build, deployment, and user-visible runtime behavior, making human validation appropriate. You can add or adjust custom eligibility rules. Learn more. |
Four CI jobs were red on this branch — lint, typecheck, unit tests and the
unused-code check — plus the dashboard's sidebar navigation. Three causes:
`packages/build-env/src/resolve.ts` was left half-refactored. `packageVersion`
called `readPackageJSON` without importing it (TS2304, and the two `node:`
imports it replaced went unused, which is what oxlint reported), so the body no
longer matched the imports at the top of the file.
Restoring the direct read is the fix rather than adding the missing import:
`readPackageJSON` ascends to the *nearest* manifest, so in this workspace an app
without its own `package.json` resolves to the repository root's and reports
that version as the app's — the drift between two version sources this package
exists to remove. `src/resolve.test.ts` already pinned that contract and has
been failing since the refactor landed. `pkg-types` has no other consumer, so it
goes with it.
`aube run knip` pre-builds only `@agent-zero/i18n` and `@agent-zero/auth`. This
branch adds `@agent-zero/build-env`, which both Nuxt apps' `vitest.config.ts`
import as `@agent-zero/build-env/nuxt`, so with its `dist/` absent knip could
not load either config: 30 test files looked unreferenced and `@nuxt/schema`
looked unused. Building it alongside the other two resolves both, which is why
no `ignoreDependencies` entry is needed.
`Sidebar.vue` lost `import { NuxtLink } from '#components'` when the
`package.json` version import beside it was replaced by `<BuildEnvironment />`.
The template still uses `NuxtLink` as a value in `<component :is>`, so this was
a typecheck error and, unchecked, would have rendered every nav item with a
route as nothing.
Verified against a frozen install: typecheck, lint, test (26/26) and build all
pass, `oxfmt --check` is clean over 482 files, and knip exits 0 with only the 13
configuration hints `main` already carries. `@agent-zero/i18n` is excluded
locally — its `@lunariajs/core` dependency is served from `pkg.pr.new`, which
this sandbox's egress policy denies; its CI job was already green.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjNmQ7vt3nXuoeyAbrF7Nj
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 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.
Note
Add
@agent-zero/build-envpackage for multi-provider build metadata resolution@agent-zero/build-envpackage that resolves build metadata (version, commit, branch, env, deploy URLs) from Vercel, Netlify, Cloudflare Pages, GitHub Actions, or self-hosted overrides, with a git-checkout fallback for branch/commit.runtimeConfig.public.buildInfoat build time, completes missing fields at server startup viaruntimeBuildInfo(), and auto-imports auseBuildInfo()composable.package.jsonversion row in the dashboard sidebar with a new<BuildEnvironment />component (BuildEnvironment.vue) that renders build time, deploy channel or release version, and an optional commit link..env.examplefiles for bothdashboardandmarketingapps with theAGENT_ZERO_BUILD_*override variables and the two-pass resolution model.system.version.label(replaced bysystem.buildgroup withlabel,releaseAria,commitAriain en/common.json and it/common.json); any out-of-tree consumers of the old key will break.Macroscope summarized bd5b087.