feat: Framework-agnostic build pipeline (v1 backport)#1336
Draft
feat: Framework-agnostic build pipeline (v1 backport)#1336
Conversation
Rework the build command to detect and build ANY JS framework, not just Agentuity native apps. This is the foundation for Cloud Native Buildpack (CNB) support. New architecture: - detect/ — Framework detection (Next.js, Vite, SvelteKit, Astro, Nuxt, Remix, generic) - adapters/ — Framework-specific build logic (delegates to framework's own build) - package/ — Launch metadata generation (Procfile, launch.json) The build command now follows: detect → install → build → package Existing Agentuity native apps (app.ts + @agentuity/runtime) continue to work via the 'agentuity' adapter which delegates to the existing viteBundle pipeline. Framework detection checks (in priority order): 1. Agentuity native (app.ts + @agentuity/runtime) 2. Next.js (next.config.* or 'next' dep) 3. Nuxt (nuxt.config.* or 'nuxt' dep) 4. Remix (@remix-run/* deps) 5. SvelteKit (svelte.config.* or @sveltejs/kit) 6. Astro (astro.config.* or 'astro' dep) 7. Vite (vite.config.* — SPA or SSR) 8. Generic fallback (package.json with build/start scripts) Output includes: - launch.json — Machine-readable launch metadata - Procfile — Heroku/Railway/Render compatible - .agentuity-build — Build marker with framework info Tests: 93 tests across 4 files (all passing): - detect/framework-detection.test.ts — 34 tests for all detectors + priority - detect/util.test.ts — 29 tests for utility functions - adapters/registry.test.ts — 9 tests for adapter lookup - package/launch.test.ts — 21 tests for launch metadata + packaging
Add 11 end-to-end contract tests that create real minimal projects, run them through the full detect → build → package pipeline, and validate the output meets the buildpack contract: - launch.json exists with valid schema (processes, framework, runtime, build) - Procfile exists and follows standard 'type: command' format - .agentuity-build marker exists with correct metadata - Server apps have a 'web' process with non-empty command - Procfile and launch.json agree on start commands - Framework name/runtime/mode consistent across all output files - Build failure propagates as error - Static builds don't copy node_modules - Build duration is non-zero Fix: infinite recursion in generic adapter's cpSync When buildOutput is '.' (project root) and outputDir is inside it (e.g., '.agentuity'), cpSync would recursively copy .agentuity into itself infinitely. Fixed by resolving paths and checking containment before copying, plus adding a filter to exclude the output dir.
Replace 6 individual detector files (nextjs.ts, nuxt.ts, remix.ts, sveltekit.ts, astro.ts, vite.ts) with a single framework database (frameworks.ts) and generic detection engine (engine.ts). Detection rules are informed by @vercel/frameworks v3.22.0 (Apache-2.0). All Vercel-specific properties (logos, CDN URLs, runtime config, routing rules, deploy targets) have been stripped — only generic framework facts remain: package names, config filenames, default build commands, and output directories as documented by each framework's own docs. The database covers 25 JS/TS frameworks: - Meta-frameworks: Next.js, Nuxt, Remix, React Router, SvelteKit, Astro, SolidStart, TanStack Start, RedwoodJS - Static generators: Gatsby, Eleventy, VitePress, VuePress, Docusaurus, Hexo - UI frameworks: Angular, Vue.js, Create React App, Preact - Server: Nitro - Bundlers: Vite, Parcel The detection engine evaluates detectors.every (all must match) and detectors.some (at least one must match) rules against project files and package.json dependencies. This fixes several wrong assumptions from the hand-rolled approach: - Remix: now uses @remix-run/dev (not @remix-run/node) for detection - Nuxt: uses package match (not config file) as primary detector - SvelteKit: uses package.json content regex (matches Vercel's approach) - Vite: uses package match (not config file) as primary detector Tests updated: 102 passing (was 104 — removed tests for features we no longer implement per-framework like static/SSR mode detection).
|
The latest Agentuity deployment details.
|
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
📦 Canary Packages Publishedversion: PackagesInstallAdd to your {
"dependencies": {
"@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-core-1.0.63-d3c4584.tgz",
"@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-schema-1.0.63-d3c4584.tgz",
"@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-frontend-1.0.63-d3c4584.tgz",
"@agentuity/claude-code": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-claude-code-1.0.63-d3c4584.tgz",
"@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-auth-1.0.63-d3c4584.tgz",
"@agentuity/db": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-db-1.0.63-d3c4584.tgz",
"@agentuity/coder": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-coder-1.0.63-d3c4584.tgz",
"@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-runtime-1.0.63-d3c4584.tgz",
"@agentuity/email": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-email-1.0.63-d3c4584.tgz",
"@agentuity/keyvalue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-keyvalue-1.0.63-d3c4584.tgz",
"@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-server-1.0.63-d3c4584.tgz",
"@agentuity/schedule": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-schedule-1.0.63-d3c4584.tgz",
"@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-postgres-1.0.63-d3c4584.tgz",
"@agentuity/queue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-queue-1.0.63-d3c4584.tgz",
"@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-drizzle-1.0.63-d3c4584.tgz",
"@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-react-1.0.63-d3c4584.tgz",
"@agentuity/sandbox": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-sandbox-1.0.63-d3c4584.tgz",
"@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-evals-1.0.63-d3c4584.tgz",
"@agentuity/vector": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-vector-1.0.63-d3c4584.tgz",
"@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-cli-1.0.63-d3c4584.tgz",
"@agentuity/webhook": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-webhook-1.0.63-d3c4584.tgz",
"@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-opencode-1.0.63-d3c4584.tgz",
"@agentuity/task": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-task-1.0.63-d3c4584.tgz",
"@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-workbench-1.0.63-d3c4584.tgz"
}
}Or install directly: bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-core-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-schema-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-frontend-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-claude-code-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-auth-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-db-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-coder-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-runtime-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-email-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-keyvalue-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-server-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-schedule-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-postgres-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-queue-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-drizzle-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-react-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-sandbox-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-evals-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-vector-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-cli-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-webhook-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-opencode-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-task-1.0.63-d3c4584.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/1.0.63-d3c4584/agentuity-workbench-1.0.63-d3c4584.tgz |
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.
Backport of #1334 (buildpack build pipeline) to v1.
Same changes as the v3 PR but without the dev command rewrite. The existing dev command is preserved.
See #1334 for full description and backend integration guide.
102 tests, all passing.