CLI: add project add keyvalue command#1569
Conversation
Fixes #1511 by matching the database/storage project add flow: list or create a namespace, write AGENTUITY_KEYVALUE_NAMESPACE to .env, and sync to the cloud project. Co-authored-by: Cursor <[email protected]>
|
The latest Agentuity deployment details.
View deployment logs with the Agentuity CLI: |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (19)
📝 WalkthroughWalkthroughA new Changesproject add keyvalue subcommand
🚥 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/coder": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-coder-3.1.1-5d0b7fe.tgz",
"@agentuity/sandbox": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-sandbox-3.1.1-5d0b7fe.tgz",
"@agentuity/db": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-db-3.1.1-5d0b7fe.tgz",
"@agentuity/vector": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-vector-3.1.1-5d0b7fe.tgz",
"@agentuity/analytics": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-analytics-3.1.1-5d0b7fe.tgz",
"@agentuity/coder-tui": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-coder-tui-3.1.1-5d0b7fe.tgz",
"@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-opencode-3.1.1-5d0b7fe.tgz",
"@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-schema-3.1.1-5d0b7fe.tgz",
"@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-drizzle-3.1.1-5d0b7fe.tgz",
"@agentuity/client": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-client-3.1.1-5d0b7fe.tgz",
"@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-runtime-3.1.1-5d0b7fe.tgz",
"@agentuity/keyvalue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-keyvalue-3.1.1-5d0b7fe.tgz",
"@agentuity/migrate": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-migrate-3.1.1-5d0b7fe.tgz",
"@agentuity/stream": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-stream-3.1.1-5d0b7fe.tgz",
"@agentuity/hono": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-hono-3.1.1-5d0b7fe.tgz",
"@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-core-3.1.1-5d0b7fe.tgz",
"@agentuity/claude-code": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-claude-code-3.1.1-5d0b7fe.tgz",
"@agentuity/storage": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-storage-3.1.1-5d0b7fe.tgz",
"@agentuity/webhook": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-webhook-3.1.1-5d0b7fe.tgz",
"@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-server-3.1.1-5d0b7fe.tgz",
"@agentuity/task": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-task-3.1.1-5d0b7fe.tgz",
"@agentuity/queue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-queue-3.1.1-5d0b7fe.tgz",
"@agentuity/schedule": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-schedule-3.1.1-5d0b7fe.tgz",
"@agentuity/telemetry": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-telemetry-3.1.1-5d0b7fe.tgz",
"@agentuity/api": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-api-3.1.1-5d0b7fe.tgz",
"@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-cli-3.1.1-5d0b7fe.tgz",
"@agentuity/pi": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-pi-3.1.1-5d0b7fe.tgz",
"@agentuity/adapter": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-adapter-3.1.1-5d0b7fe.tgz",
"@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-postgres-3.1.1-5d0b7fe.tgz",
"@agentuity/config": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-config-3.1.1-5d0b7fe.tgz",
"@agentuity/email": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-email-3.1.1-5d0b7fe.tgz",
"create-agentuity": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/create-agentuity-3.1.1-5d0b7fe.tgz",
"@agentuity/aigateway": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-aigateway-3.1.1-5d0b7fe.tgz",
"@agentuity/vite": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-vite-3.1.1-5d0b7fe.tgz"
}
}Or install directly: bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-coder-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-sandbox-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-db-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-vector-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-analytics-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-coder-tui-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-opencode-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-schema-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-drizzle-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-client-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-runtime-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-keyvalue-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-migrate-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-stream-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-hono-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-core-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-claude-code-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-storage-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-webhook-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-server-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-task-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-queue-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-schedule-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-telemetry-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-api-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-cli-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-pi-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-adapter-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-postgres-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-config-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-email-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/create-agentuity-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-aigateway-3.1.1-5d0b7fe.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-vite-3.1.1-5d0b7fe.tgz |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/cli/src/cmd/project/add/keyvalue.ts (1)
63-66: ⚡ Quick winUse
isJSONMode()in this handler instead of repeatedoptions.jsonchecks.This command gates multiple TUI branches directly on
options.json; switch to the shared JSON-mode helper for consistent machine-readable behavior.As per coding guidelines: "Always check
isJSONMode()for machine-readable output in command handlers."Also applies to: 100-103, 162-164, 179-182, 187-188, 215-216, 220-225
🤖 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/cli/src/cmd/project/add/keyvalue.ts` around lines 63 - 66, Replace all direct checks of `options.json` throughout the keyvalue.ts file with calls to the shared `isJSONMode()` helper function. This includes the conditional at line 63 where `if (!options.json)` appears, as well as all other occurrences noted at lines 100-103, 162-164, 179-182, 187-188, 215-216, and 220-225. Ensure that every branch gating TUI output or machine-readable behavior uses `isJSONMode()` instead of directly accessing the options object to maintain consistency with the coding guidelines and provide a single source of truth for JSON mode detection.Source: Coding guidelines
🤖 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/cli/src/cmd/project/add/keyvalue.ts`:
- Around line 118-119: The value 'Create New' used as a sentinel for the create
new namespace option conflicts with potential real namespace names, creating
ambiguity in the selection logic. Replace the literal 'Create New' string with a
unique sentinel value that cannot be a valid namespace name (such as a special
marker with underscores or symbols). Apply this change to both occurrences
mentioned in the diff around lines 118-119 and 134-135 where the namespace
selection options are constructed and where the selection result is checked
against this sentinel value.
---
Nitpick comments:
In `@packages/cli/src/cmd/project/add/keyvalue.ts`:
- Around line 63-66: Replace all direct checks of `options.json` throughout the
keyvalue.ts file with calls to the shared `isJSONMode()` helper function. This
includes the conditional at line 63 where `if (!options.json)` appears, as well
as all other occurrences noted at lines 100-103, 162-164, 179-182, 187-188,
215-216, and 220-225. Ensure that every branch gating TUI output or
machine-readable behavior uses `isJSONMode()` instead of directly accessing the
options object to maintain consistency with the coding guidelines and provide a
single source of truth for JSON mode detection.
🪄 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: ca8da27d-05e3-4af3-8477-cc666a552229
📒 Files selected for processing (4)
packages/cli/src/cmd/project/add/index.tspackages/cli/src/cmd/project/add/keyvalue.tspackages/cli/src/env-util.tspackages/core/src/env.d.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). (17)
- GitHub Check: Installer scenarios
- GitHub Check: Native install (Linux)
- GitHub Check: Native install (macOS)
- GitHub Check: Linux distro install smoke
- GitHub Check: Bun version checks
- GitHub Check: Build
- GitHub Check: Framework Demo Tests
- GitHub Check: Postgres SSL Integration Test
- GitHub Check: Queue CLI Tests (bun)
- GitHub Check: Queue CLI Tests (node)
- GitHub Check: Package Installation & Usage Test (bun)
- GitHub Check: Package Installation & Usage Test (node)
- GitHub Check: Migrate Chain (v1 → v2 → v3)
- GitHub Check: Service Client Smoke Tests
- GitHub Check: Windows WSL CLI Smoke Test
- GitHub Check: Pack & Upload
- GitHub Check: Agentuity - docs-docs
🧰 Additional context used
📓 Path-based instructions (5)
packages/core/src/**/*.ts
📄 CodeRabbit inference engine (packages/core/AGENTS.md)
packages/core/src/**/*.ts: Build TypeScript code usingbun run buildwhich compiles with tsc
Run TypeScript type checking withbun run typecheck
Ensure runtime compatibility with both Browser and Node/Bun environments - no runtime-specific code
Use ESNext as build target with TypeScript declaration files
Use TypeScript-first development - all code must be TypeScript
Prefer interfaces for public APIs
Use generics for reusable type utilities
Ensure no framework coupling - code must work in any JavaScript environment
Many exports aretypeorinterfaceonly - usetypekeyword for type-only exports
Ensure all exports are pure with no side effects or global mutations
All relative imports in TypeScript files MUST include the.tsextension for proper ESM module resolution
Files:
packages/core/src/env.d.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Run
bun run formatusing Biome with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5
Files:
packages/core/src/env.d.tspackages/cli/src/cmd/project/add/index.tspackages/cli/src/env-util.tspackages/cli/src/cmd/project/add/keyvalue.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript in strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
packages/core/src/env.d.tspackages/cli/src/cmd/project/add/index.tspackages/cli/src/env-util.tspackages/cli/src/cmd/project/add/keyvalue.ts
packages/cli/src/cmd/**/index.ts
📄 CodeRabbit inference engine (packages/cli/AGENTS.md)
packages/cli/src/cmd/**/index.ts: Each command must be a directory insrc/cmd/with anindex.tsentry point
Always define interfaces for command options using Zod schemas; never useanyfor type safety
Files:
packages/cli/src/cmd/project/add/index.ts
packages/cli/src/**/*.ts
📄 CodeRabbit inference engine (packages/cli/AGENTS.md)
packages/cli/src/**/*.ts: Usetui.*helpers for formatted output (header,info,success,warning,error,table,progress)
Usectx.loggerfor logging;logger.fatal()logs and exits with code 1
Useawait readFile(p, 'utf-8')andawait writeFile(p, content)fromnode:fs/promisesfor file I/O
ImportpathExistsfromnode-compat/fsfor file existence checks instead of using Node's built-in
Do not use Bun globals (Bun.file,Bun.spawn,Bun.color,Bun.stringWidth, etc.) in production source code;tsconfig.jsontype checking enforces this
Imports must use explicit.tsextensions for relative paths (e.g.,from './foo.ts', notfrom './foo'); TypeScript'srewriteRelativeImportExtensionswill rewrite them to.jsin output
Always checkisJSONMode()for machine-readable output in command handlers
UserequireAuth(ctx)oroptionalAuth(ctx)for authenticated commands
Files:
packages/cli/src/cmd/project/add/index.tspackages/cli/src/env-util.tspackages/cli/src/cmd/project/add/keyvalue.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/core/src/env.d.tspackages/cli/src/cmd/project/add/index.tspackages/cli/src/env-util.tspackages/cli/src/cmd/project/add/keyvalue.ts
📚 Learning: 2026-02-17T14:23:15.448Z
Learnt from: potofpie
Repo: agentuity/sdk PR: 974
File: packages/cli/src/cmd/git/account/list.ts:39-40
Timestamp: 2026-02-17T14:23:15.448Z
Learning: In the Agentuity CLI framework (packages/cli), when a subcommand declares requires: { auth: true }, the framework will automatically call requireAuth() before invoking the handler. Do not call requireAuth(ctx) manually inside command handlers. This applies to all TypeScript command files under packages/cli/src, including paths like packages/cli/src/cmd/git/account/list.ts.
Applied to files:
packages/cli/src/cmd/project/add/index.tspackages/cli/src/env-util.tspackages/cli/src/cmd/project/add/keyvalue.ts
🔇 Additional comments (3)
packages/core/src/env.d.ts (1)
43-44: LGTM!packages/cli/src/env-util.ts (1)
26-26: LGTM!packages/cli/src/cmd/project/add/index.ts (1)
4-4: LGTM!Also applies to: 34-41, 43-43
Avoids ambiguity if an org already has a namespace named "Create New". Co-authored-by: Cursor <[email protected]>
List and create KV namespaces via GET/POST /resource like database and storage, writing KEYVALUE_NAMESPACE from the platform env map so cloud sync needs no app allowlist change. Co-authored-by: Cursor <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/cli/src/cmd/project/add/keyvalue.ts (1)
65-67: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winUse
isJSONMode()in handler branches instead of directoptions.jsonchecks.The handler currently branches directly on
options.jsonin multiple places; switch to the standard JSON-mode helper to match command-framework behavior and keep machine-output checks consistent.As per coding guidelines:
packages/cli/src/**/*.ts: “Always checkisJSONMode()for machine-readable output in command handlers.”Also applies to: 110-111, 184-185, 201-204, 209-210, 235-237, 240-244, 250-253
🤖 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/cli/src/cmd/project/add/keyvalue.ts` around lines 65 - 67, Replace all direct checks on `options.json` with calls to the standard `isJSONMode()` helper function throughout the keyvalue handler. This includes the conditional at the start of the diff (the `if (!options.json)` check before `tui.info('[DRY RUN] Key-value namespace linking skipped')`) as well as all other instances mentioned in the file at the specified line ranges. Use `isJSONMode()` instead of `!options.json` to align with command-framework conventions for machine-output detection.Source: Coding guidelines
🤖 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/cli/src/cmd/project/add/keyvalue.ts`:
- Around line 87-99: The args.name parameter is used directly without
normalization, while interactive input is trimmed, creating a discrepancy that
could cause namespace lookup failures and unintended duplicate creation.
Normalize args.name by trimming whitespace before passing it to
validateNamespaceName() and before using it for the selectedNamespace lookup and
createResources() call. Apply this same normalization to the similar code block
around line 162-173 where args.name is also used directly.
In `@packages/core/src/env.d.ts`:
- Line 44: Remove the unused KEYVALUE_NAMESPACE declaration from the env.d.ts
file and also remove the corresponding KEYVALUE_NAMESPACE_ENV_KEY constant from
packages/server/src/api/region/create.ts. These declarations are dead code since
the codebase actually uses AGENTUITY_KEYVALUE_URL for key-value configuration
instead. Clean up both locations to eliminate unused environment variable
declarations.
---
Outside diff comments:
In `@packages/cli/src/cmd/project/add/keyvalue.ts`:
- Around line 65-67: Replace all direct checks on `options.json` with calls to
the standard `isJSONMode()` helper function throughout the keyvalue handler.
This includes the conditional at the start of the diff (the `if (!options.json)`
check before `tui.info('[DRY RUN] Key-value namespace linking skipped')`) as
well as all other instances mentioned in the file at the specified line ranges.
Use `isJSONMode()` instead of `!options.json` to align with command-framework
conventions for machine-output detection.
🪄 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: 9ae98f0a-d8ec-45f4-bac7-83e997b7848b
📒 Files selected for processing (5)
packages/cli/src/cmd/project/add/keyvalue.tspackages/core/src/env.d.tspackages/server/src/api/region/create.tspackages/server/src/api/region/resources.tspackages/server/src/api/region/types.ts
✅ Files skipped from review due to trivial changes (1)
- packages/server/src/api/region/types.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (17)
- GitHub Check: Bun version checks
- GitHub Check: Native install (Linux)
- GitHub Check: Installer scenarios
- GitHub Check: Linux distro install smoke
- GitHub Check: Native install (macOS)
- GitHub Check: Postgres SSL Integration Test
- GitHub Check: Package Installation & Usage Test (bun)
- GitHub Check: Service Client Smoke Tests
- GitHub Check: Framework Demo Tests
- GitHub Check: Queue CLI Tests (node)
- GitHub Check: Queue CLI Tests (bun)
- GitHub Check: Package Installation & Usage Test (node)
- GitHub Check: Migrate Chain (v1 → v2 → v3)
- GitHub Check: Build
- GitHub Check: Pack & Upload
- GitHub Check: Windows WSL CLI Smoke Test
- GitHub Check: Agentuity - docs-docs
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Run
bun run formatusing Biome with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5
Files:
packages/server/src/api/region/resources.tspackages/core/src/env.d.tspackages/server/src/api/region/create.tspackages/cli/src/cmd/project/add/keyvalue.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Use TypeScript in strict mode with ESNext target and bundler moduleResolution
UseStructuredErrorfrom@agentuity/corefor error handling
Files:
packages/server/src/api/region/resources.tspackages/core/src/env.d.tspackages/server/src/api/region/create.tspackages/cli/src/cmd/project/add/keyvalue.ts
packages/server/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (packages/server/AGENTS.md)
All code must be TypeScript
Files:
packages/server/src/api/region/resources.tspackages/server/src/api/region/create.ts
packages/server/src/**/*.ts
📄 CodeRabbit inference engine (packages/server/AGENTS.md)
packages/server/src/**/*.ts: Use zod for runtime validation
Always use.tsextensions in relative imports (e.g.,from '../api.ts', notfrom '../api'). This is required for Node.js ESM compatibility —tscrewrites.ts→.jsin compiled output, but leaves extensionless imports untouched, which breaks Node.js module resolution. This is enforced by theuseImportExtensionsBiome lint rule.
Files:
packages/server/src/api/region/resources.tspackages/server/src/api/region/create.ts
packages/core/src/**/*.ts
📄 CodeRabbit inference engine (packages/core/AGENTS.md)
packages/core/src/**/*.ts: Build TypeScript code usingbun run buildwhich compiles with tsc
Run TypeScript type checking withbun run typecheck
Ensure runtime compatibility with both Browser and Node/Bun environments - no runtime-specific code
Use ESNext as build target with TypeScript declaration files
Use TypeScript-first development - all code must be TypeScript
Prefer interfaces for public APIs
Use generics for reusable type utilities
Ensure no framework coupling - code must work in any JavaScript environment
Many exports aretypeorinterfaceonly - usetypekeyword for type-only exports
Ensure all exports are pure with no side effects or global mutations
All relative imports in TypeScript files MUST include the.tsextension for proper ESM module resolution
Files:
packages/core/src/env.d.ts
packages/cli/src/**/*.ts
📄 CodeRabbit inference engine (packages/cli/AGENTS.md)
packages/cli/src/**/*.ts: Usetui.*helpers for formatted output (header,info,success,warning,error,table,progress)
Usectx.loggerfor logging;logger.fatal()logs and exits with code 1
Useawait readFile(p, 'utf-8')andawait writeFile(p, content)fromnode:fs/promisesfor file I/O
ImportpathExistsfromnode-compat/fsfor file existence checks instead of using Node's built-in
Do not use Bun globals (Bun.file,Bun.spawn,Bun.color,Bun.stringWidth, etc.) in production source code;tsconfig.jsontype checking enforces this
Imports must use explicit.tsextensions for relative paths (e.g.,from './foo.ts', notfrom './foo'); TypeScript'srewriteRelativeImportExtensionswill rewrite them to.jsin output
Always checkisJSONMode()for machine-readable output in command handlers
UserequireAuth(ctx)oroptionalAuth(ctx)for authenticated commands
Files:
packages/cli/src/cmd/project/add/keyvalue.ts
🧠 Learnings (4)
📚 Learning: 2025-12-19T14:19:33.765Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 259
File: packages/cli/src/cmd/build/vite/registry-generator.ts:306-312
Timestamp: 2025-12-19T14:19:33.765Z
Learning: Route files under src/api should use the .ts extension only (no .tsx) and regex patterns for such paths should anchor to \.ts$ (e.g., /\/.ts$/). Agent files may support both .ts and .tsx, but route files in the Agentuity SDK codebase are restricted to .ts. This guideline applies to all similar route files under src/api across the repository.
Applied to files:
packages/server/src/api/region/resources.tspackages/server/src/api/region/create.ts
📚 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/server/src/api/region/resources.tspackages/core/src/env.d.tspackages/server/src/api/region/create.tspackages/cli/src/cmd/project/add/keyvalue.ts
📚 Learning: 2025-12-30T00:13:37.849Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 355
File: packages/server/src/api/sandbox/util.ts:2-6
Timestamp: 2025-12-30T00:13:37.849Z
Learning: In the packages/server tree, treat code as runtime-agnostic between Node.js and Bun. Ensure TypeScript files (e.g., util.ts) import and use APIs in a way that works under both runtimes. It is acceptable to rely on Bun’s Node.js compatibility for built-ins accessed via the node: namespace (e.g., node:events, node:stream, node:buffer). During reviews, prefer patterns and imports that remain compatible with Bun's environment, and flag any hard dependencies on runtime-specific globals or non-portable Node APIs.
Applied to files:
packages/server/src/api/region/resources.tspackages/server/src/api/region/create.ts
📚 Learning: 2026-02-17T14:23:15.448Z
Learnt from: potofpie
Repo: agentuity/sdk PR: 974
File: packages/cli/src/cmd/git/account/list.ts:39-40
Timestamp: 2026-02-17T14:23:15.448Z
Learning: In the Agentuity CLI framework (packages/cli), when a subcommand declares requires: { auth: true }, the framework will automatically call requireAuth() before invoking the handler. Do not call requireAuth(ctx) manually inside command handlers. This applies to all TypeScript command files under packages/cli/src, including paths like packages/cli/src/cmd/git/account/list.ts.
Applied to files:
packages/cli/src/cmd/project/add/keyvalue.ts
🔇 Additional comments (2)
packages/server/src/api/region/resources.ts (1)
36-46: LGTM!packages/server/src/api/region/create.ts (1)
136-161: LGTM!Also applies to: 185-185, 198-198, 214-219
Trim namespace names from CLI args and drop unused KEYVALUE_NAMESPACE_ENV_KEY export. Co-authored-by: Cursor <[email protected]>
Summary
agentuity project add keyvalue(aliaskv) to list or create a KV namespace and link it to the current project.AGENTUITY_KEYVALUE_NAMESPACEto local.envand optionally syncs it to the cloud project env, matching the database/storageproject addflow.ProcessEnvtype for it.Fixes #1511.
Related: agentuity/app#1348 (app API allowlist must accept the same key on
PUT /cli/project/:id/env).Test plan
bun run typecheckinpackages/clibun test test/config/env-util.test.tsinpackages/clibun src/main.ts project add --helpshowskeyvaluesubcommandagentuity project add keyvalue <name>against a real project creates/links namespace and persists env locally + cloudagentuity --dry-run project add keyvalue <name>previews without changesMade with Cursor
Summary by CodeRabbit
project add keyvalue(aliaskv) to link or create key-value namespaces for your projectKEYVALUE_NAMESPACEto set a default key-value namespace