fix(create-agentuity): dispatch through the invoking package manager#1525
Conversation
The create wrapper hardcoded spawnSync('bunx', ...), which made Bun a hard
requirement for scaffolding even when invoked via npm/pnpm/yarn — contradicting
the package README ('Bun 1.3+ or Node.js 24+'). Node-only users hit a failure
when bunx was not on PATH.
Detect the invoking package manager from npm_config_user_agent and run the
underlying '@agentuity/cli ... create' through the matching one-off runner
(bunx / pnpm dlx / yarn dlx / npx), falling back to npx since the wrapper runs
under Node. Add unit tests for detection and command construction.
Fixes #1522
|
The latest Agentuity deployment details.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/*/test/**/*.test.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (2)📚 Learning: 2025-12-21T00:31:41.858ZApplied to files:
📚 Learning: 2026-02-21T02:05:57.982ZApplied to files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughThe create-agentuity launcher detects the invoking package manager (including yarn-classic) and builds the appropriate CLI invocation (bunx, pnpm dlx, yarn dlx, or npx) at runtime; bin.ts spawns that command. Tests and README are updated accordingly. ChangesMulti-package-manager launcher support
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
📦 Canary Packages Publishedversion: PackagesInstallAdd to your {
"dependencies": {
"@agentuity/pi": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-pi-3.0.3-9dfd18b.tgz",
"@agentuity/task": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-task-3.0.3-9dfd18b.tgz",
"@agentuity/queue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-queue-3.0.3-9dfd18b.tgz",
"@agentuity/sandbox": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-sandbox-3.0.3-9dfd18b.tgz",
"@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-core-3.0.3-9dfd18b.tgz",
"@agentuity/db": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-db-3.0.3-9dfd18b.tgz",
"@agentuity/vite": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-vite-3.0.3-9dfd18b.tgz",
"@agentuity/adapter": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-adapter-3.0.3-9dfd18b.tgz",
"@agentuity/keyvalue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-keyvalue-3.0.3-9dfd18b.tgz",
"@agentuity/analytics": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-analytics-3.0.3-9dfd18b.tgz",
"@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-drizzle-3.0.3-9dfd18b.tgz",
"@agentuity/stream": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-stream-3.0.3-9dfd18b.tgz",
"@agentuity/vector": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-vector-3.0.3-9dfd18b.tgz",
"@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-server-3.0.3-9dfd18b.tgz",
"@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-postgres-3.0.3-9dfd18b.tgz",
"@agentuity/hono": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-hono-3.0.3-9dfd18b.tgz",
"@agentuity/schedule": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-schedule-3.0.3-9dfd18b.tgz",
"@agentuity/claude-code": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-claude-code-3.0.3-9dfd18b.tgz",
"@agentuity/migrate": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-migrate-3.0.3-9dfd18b.tgz",
"@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-cli-3.0.3-9dfd18b.tgz",
"@agentuity/coder": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-coder-3.0.3-9dfd18b.tgz",
"@agentuity/local": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-local-3.0.3-9dfd18b.tgz",
"@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-schema-3.0.3-9dfd18b.tgz",
"@agentuity/storage": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-storage-3.0.3-9dfd18b.tgz",
"@agentuity/telemetry": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-telemetry-3.0.3-9dfd18b.tgz",
"@agentuity/coder-tui": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-coder-tui-3.0.3-9dfd18b.tgz",
"@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-opencode-3.0.3-9dfd18b.tgz",
"@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-runtime-3.0.3-9dfd18b.tgz",
"@agentuity/webhook": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-webhook-3.0.3-9dfd18b.tgz",
"create-agentuity": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/create-agentuity-3.0.3-9dfd18b.tgz",
"@agentuity/aigateway": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-aigateway-3.0.3-9dfd18b.tgz",
"@agentuity/email": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-email-3.0.3-9dfd18b.tgz"
}
}Or install directly: bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-pi-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-task-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-queue-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-sandbox-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-core-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-db-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-vite-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-adapter-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-keyvalue-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-analytics-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-drizzle-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-stream-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-vector-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-server-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-postgres-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-hono-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-schedule-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-claude-code-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-migrate-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-cli-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-coder-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-local-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-schema-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-storage-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-telemetry-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-coder-tui-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-opencode-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-runtime-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-webhook-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/create-agentuity-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-aigateway-3.0.3-9dfd18b.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.0.3-9dfd18b/agentuity-email-3.0.3-9dfd18b.tgz |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/create-agentuity/README.md (1)
49-50:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate script examples to match the npm-first approach.
The Usage section now leads with npm (line 12), but the Available scripts section still shows
bun run. For consistency and to avoid implying that Bun is required, these examples should match the package manager used in the primary Usage example.📝 Proposed fix for consistency
-bun run dev # Run the framework's dev server with AI Gateway env -bun run build # Framework build +npm run dev # Run the framework's dev server with AI Gateway env +npm run build # Framework build agentuity deploy # Deploy to Agentuity Cloud🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/create-agentuity/README.md` around lines 49 - 50, Update the "Available scripts" examples that currently show "bun run dev" and "bun run build" to the npm-first equivalents "npm run dev" and "npm run build" so they match the Usage section which leads with npm; locate the README's Available scripts block (the lines containing "bun run dev" and "bun run build") and replace those commands with the npm versions to avoid implying Bun is required.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/create-agentuity/src/index.ts`:
- Around line 72-73: The yarn branch currently returns { command: 'yarn', args:
['dlx', ...create] } which breaks on Yarn 1.x; change the case 'yarn' handling
to detect the installed Yarn major version and only use 'yarn dlx' for Yarn >= 2
(Berry). For Yarn 1.x fallback to invoking npx with --yes (e.g. { command:
'npx', args: ['--yes', ...create] }). Locate the switch/case handling the
package manager (the case 'yarn' that references the create array) and implement
version detection (parse output of `yarn --version` or existing helper if
present) and branch accordingly so Yarn 1.x uses npx --yes while Yarn >=2 uses
yarn dlx.
---
Outside diff comments:
In `@packages/create-agentuity/README.md`:
- Around line 49-50: Update the "Available scripts" examples that currently show
"bun run dev" and "bun run build" to the npm-first equivalents "npm run dev" and
"npm run build" so they match the Usage section which leads with npm; locate the
README's Available scripts block (the lines containing "bun run dev" and "bun
run build") and replace those commands with the npm versions to avoid implying
Bun is required.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a5871148-5d38-4162-8daf-52e399ebe0d8
📒 Files selected for processing (4)
packages/create-agentuity/README.mdpackages/create-agentuity/src/bin.tspackages/create-agentuity/src/index.tspackages/create-agentuity/test/index.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: Postgres SSL Integration Test
- GitHub Check: Framework Demo Tests
- GitHub Check: Queue CLI Tests (node)
- GitHub Check: Package Installation & Usage Test (node)
- GitHub Check: Package Installation & Usage Test (bun)
- GitHub Check: Migrate Chain (v1 → v2 → v3)
- GitHub Check: Pack & Upload
- GitHub Check: Service Client Smoke Tests
- GitHub Check: Build
- GitHub Check: Queue CLI Tests (bun)
- GitHub Check: Agentuity Deployment
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx,js,jsx}: Format code with Biome using tabs (width 3), single quotes, semicolons, lineWidth 100, and trailing commas es5
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
packages/create-agentuity/src/bin.tspackages/create-agentuity/test/index.test.tspackages/create-agentuity/src/index.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with ESNext and bundler moduleResolution
Files:
packages/create-agentuity/src/bin.tspackages/create-agentuity/test/index.test.tspackages/create-agentuity/src/index.ts
packages/*/test/**/*.test.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
packages/*/test/**/*.test.{ts,tsx,js,jsx}: Place tests intest/folder parallel tosrc/(never insidesrc/or under__tests__/)
Import from../src/in test files
Use@agentuity/test-utilsfor shared mocks in tests
Files:
packages/create-agentuity/test/index.test.ts
packages/*/src/index.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use named exports from package
index.tsfiles
Files:
packages/create-agentuity/src/index.ts
🧠 Learnings (2)
📚 Learning: 2025-12-21T00:31:41.858Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 274
File: packages/cli/src/cmd/build/vite/server-bundler.ts:12-41
Timestamp: 2025-12-21T00:31:41.858Z
Learning: In Bun runtime, BuildMessage and ResolveMessage are global types and are not exported from the bun module. Do not import { BuildMessage } from 'bun' or similar; these types are available globally and should be used without import. This applies to all TypeScript files that target the Bun runtime within the repository.
Applied to files:
packages/create-agentuity/src/bin.tspackages/create-agentuity/test/index.test.tspackages/create-agentuity/src/index.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.
Applied to files:
packages/create-agentuity/test/index.test.ts
🔇 Additional comments (4)
packages/create-agentuity/README.md (1)
8-20: LGTM!packages/create-agentuity/src/index.ts (1)
39-46: LGTM!packages/create-agentuity/src/bin.ts (1)
6-6: LGTM!Also applies to: 34-48
packages/create-agentuity/test/index.test.ts (1)
54-115: LGTM!
…ME scripts Yarn 1.x (Classic) has no `dlx` command, so `yarn dlx` fails there. Detect the yarn major version from npm_config_user_agent and report 1.x as 'yarn-classic', which getCreateCommand routes through `npx --yes` (Node/npx is always available). Yarn Berry (2+) still uses `yarn dlx`. Also align the README 'Available scripts' block with the npm-first Usage section (npm run dev/build instead of bun run). Addresses CodeRabbit review on #1525.
|
Addressed both CodeRabbit findings in 9dfd18b:
Verified end-to-end against the compiled output:
28 tests pass; typecheck/build/biome clean. |
Summary
The
create-agentuitywrapper hardcodedspawnSync('bunx', ...), making Bun a hard requirement for scaffolding even when invoked vianpm create/npx. This contradicted the package README ("Bun 1.3+ or Node.js 24+") — Node/pnpm/yarn-only users hit a failure whenbunxwasn't on PATH.This change detects the invoking package manager from
npm_config_user_agentand runs the underlying@agentuity/cli ... createthrough the matching one-off runner, falling back tonpx(the wrapper runs under#!/usr/bin/env node, so Node/npx is always available).Fixes #1522.
Changes
src/index.ts— two pure, testable helpers:detectPackageManager(userAgent)→bun/npm/pnpm/yarn/undefinedgetCreateCommand(pm, cliPackage, args)→ dispatch mapping:bunx <pkg> create ...pnpm dlx <pkg> create ...yarn dlx <pkg> create ...npx --yes <pkg> create ...src/bin.ts— use the helpers instead of hardcodingbunx; addsshell: trueon Windows (npx/pnpm/yarn are.cmdshims there).test/index.test.ts— 14 new tests for detection + command construction across all package managers and the fallbacks.README.md— Usage now leads with npm and lists all four package managers, matching the (now accurate) "Bun or Node" requirement.Verification
bun test→ 26 pass, 0 failbun run typecheck→ cleanbun run build→ cleanbiome check→ cleannpx --yes ... createnpm/...→npx --yes ... createpnpm/...→pnpm dlx ... createyarn/...→yarn dlx ... createbun/...→bunx ... createFollow-up
This unblocks the related docs change (PR #1462) that overstates Bun as a blanket prerequisite — once this lands, those docs can scope the Bun requirement to "optional" and default to Node/npm.
Summary by CodeRabbit
New Features
Documentation
Tests