Skip to content

CLI: add project add keyvalue command#1569

Merged
Huijiro merged 5 commits into
mainfrom
feat/project-add-keyvalue
Jun 22, 2026
Merged

CLI: add project add keyvalue command#1569
Huijiro merged 5 commits into
mainfrom
feat/project-add-keyvalue

Conversation

@Huijiro

@Huijiro Huijiro commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds agentuity project add keyvalue (alias kv) to list or create a KV namespace and link it to the current project.
  • Writes AGENTUITY_KEYVALUE_NAMESPACE to local .env and optionally syncs it to the cloud project env, matching the database/storage project add flow.
  • Whitelists the new env key in the CLI allowlist and adds a ProcessEnv type 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 typecheck in packages/cli
  • bun test test/config/env-util.test.ts in packages/cli
  • bun src/main.ts project add --help shows keyvalue subcommand
  • agentuity project add keyvalue <name> against a real project creates/links namespace and persists env locally + cloud
  • agentuity --dry-run project add keyvalue <name> previews without changes

Made with Cursor

Summary by CodeRabbit

  • New Features
    • Added project add keyvalue (alias kv) to link or create key-value namespaces for your project
    • Supports interactive selection (and on-demand creation) of KV namespaces
    • Updates local environment variables from the selected KV namespace, warning if none are available
    • Optional sync of KV-related environment settings to the cloud during KV setup
    • Introduced KEYVALUE_NAMESPACE to set a default key-value namespace

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]>
@agentuity-agent

agentuity-agent Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest Agentuity deployment details.

Project Deployment Preview Updated (UTC)
docs 🟢 Ready (deploy_7efcb4ec9472f7f6c52368d57acdc9f0) - 2026-06-22T20:58:05Z

View deployment logs with the Agentuity CLI:

agentuity cloud deployment logs deploy_7efcb4ec9472f7f6c52368d57acdc9f0 --project-id=proj_5ed7da797bef771d65e1bd6946a052b1

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3d3fbebc-1ed2-4d31-aa5c-b19ca6007034

📥 Commits

Reviewing files that changed from the base of the PR and between 214a13e and 5d0b7fe.

📒 Files selected for processing (2)
  • packages/cli/src/cmd/project/add/keyvalue.ts
  • packages/server/src/api/region/create.ts
💤 Files with no reviewable changes (1)
  • packages/server/src/api/region/create.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/src/cmd/project/add/keyvalue.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (19)
  • GitHub Check: Linux distro install smoke
  • GitHub Check: Native install (Linux)
  • GitHub Check: Installer scenarios
  • GitHub Check: Native install (macOS)
  • GitHub Check: Bun version checks
  • GitHub Check: Migrate Chain (v1 → v2 → v3)
  • GitHub Check: Queue CLI Tests (node)
  • GitHub Check: Queue CLI Tests (bun)
  • GitHub Check: Service Client Smoke Tests
  • GitHub Check: Postgres SSL Integration Test
  • GitHub Check: Windows WSL CLI Smoke Test
  • GitHub Check: Package Installation & Usage Test (bun)
  • GitHub Check: Package Installation & Usage Test (node)
  • GitHub Check: Framework Demo Tests
  • GitHub Check: Pack & Upload
  • GitHub Check: Trivy Filesystem Scan
  • GitHub Check: Build
  • GitHub Check: OSV Scanner PR
  • GitHub Check: Agentuity - docs-docs

📝 Walkthrough

Walkthrough

A new project add keyvalue (alias kv) CLI subcommand is added. Server-side resource schemas are extended to support KV namespaces in ResourceListResponse, ResourceSpec, and createResources. A KEYVALUE_NAMESPACE env var is declared in core types. The subcommand handler resolves a namespace by name or interactive prompt, writes env vars locally, and optionally syncs to the cloud.

Changes

project add keyvalue subcommand

Layer / File(s) Summary
Server-side KV resource schemas, validation, and env key
packages/server/src/api/region/resources.ts, packages/server/src/api/region/create.ts, packages/server/src/api/region/types.ts, packages/core/src/env.d.ts
ResourceListResponse gains a kv array field; ResourceSpec and createResources parameter type are expanded to include type: 'kv'; validateNamespaceName function is exported; a kv validation branch is added to the resource-creation loop; API request schema descriptions are updated; KEYVALUE_NAMESPACE is declared as an optional ProcessEnv field.
keyvalue subcommand: contract, namespace resolution, env write, and cloud sync
packages/cli/src/cmd/project/add/keyvalue.ts
Exports keyvalueSubcommand with name/alias kv, Zod arg schema, and response shape. Handler implements dry-run short-circuit, namespace fetch with internal filtering, args.name path with auto-create via createResources, interactive prompt with a "Create new namespace" sentinel, headless guard, env write via addResourceEnvVars, optional cloud sync via projectEnvUpdate with error warning, and final { success: true, name } response.
Register keyvalueSubcommand in project add
packages/cli/src/cmd/project/add/index.ts
Imports keyvalueSubcommand and adds it to the subcommands array of addCommand alongside two new project add keyvalue usage examples.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The pull request implements all core requirements from #1511: interactive namespace selection/creation, non-interactive syntax support, environment variable handling, and --dry-run flag support.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the keyvalue subcommand and supporting infrastructure; no unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jun 19, 2026

Copy link
Copy Markdown

📦 Canary Packages Published

version: 3.1.1-5d0b7fe

Packages
Package Version URL
@agentuity/coder 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-coder-3.1.1-5d0b7fe.tgz
@agentuity/sandbox 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-sandbox-3.1.1-5d0b7fe.tgz
@agentuity/db 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-db-3.1.1-5d0b7fe.tgz
@agentuity/vector 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-vector-3.1.1-5d0b7fe.tgz
@agentuity/analytics 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-analytics-3.1.1-5d0b7fe.tgz
@agentuity/coder-tui 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-coder-tui-3.1.1-5d0b7fe.tgz
@agentuity/opencode 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-opencode-3.1.1-5d0b7fe.tgz
@agentuity/schema 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-schema-3.1.1-5d0b7fe.tgz
@agentuity/drizzle 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-drizzle-3.1.1-5d0b7fe.tgz
@agentuity/client 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-client-3.1.1-5d0b7fe.tgz
@agentuity/runtime 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-runtime-3.1.1-5d0b7fe.tgz
@agentuity/keyvalue 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-keyvalue-3.1.1-5d0b7fe.tgz
@agentuity/migrate 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-migrate-3.1.1-5d0b7fe.tgz
@agentuity/stream 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-stream-3.1.1-5d0b7fe.tgz
@agentuity/hono 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-hono-3.1.1-5d0b7fe.tgz
@agentuity/core 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-core-3.1.1-5d0b7fe.tgz
@agentuity/claude-code 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-claude-code-3.1.1-5d0b7fe.tgz
@agentuity/storage 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-storage-3.1.1-5d0b7fe.tgz
@agentuity/webhook 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-webhook-3.1.1-5d0b7fe.tgz
@agentuity/server 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-server-3.1.1-5d0b7fe.tgz
@agentuity/task 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-task-3.1.1-5d0b7fe.tgz
@agentuity/queue 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-queue-3.1.1-5d0b7fe.tgz
@agentuity/schedule 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-schedule-3.1.1-5d0b7fe.tgz
@agentuity/telemetry 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-telemetry-3.1.1-5d0b7fe.tgz
@agentuity/api 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-api-3.1.1-5d0b7fe.tgz
@agentuity/cli 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-cli-3.1.1-5d0b7fe.tgz
@agentuity/pi 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-pi-3.1.1-5d0b7fe.tgz
@agentuity/adapter 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-adapter-3.1.1-5d0b7fe.tgz
@agentuity/postgres 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-postgres-3.1.1-5d0b7fe.tgz
@agentuity/config 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-config-3.1.1-5d0b7fe.tgz
@agentuity/email 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-email-3.1.1-5d0b7fe.tgz
create-agentuity 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/create-agentuity-3.1.1-5d0b7fe.tgz
@agentuity/aigateway 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-aigateway-3.1.1-5d0b7fe.tgz
@agentuity/vite 3.1.1-5d0b7fe https://agentuity-sdk-objects.t3.storageapi.dev/npm/3.1.1-5d0b7fe/agentuity-vite-3.1.1-5d0b7fe.tgz
Install

Add to your package.json:

{
  "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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/cli/src/cmd/project/add/keyvalue.ts (1)

63-66: ⚡ Quick win

Use isJSONMode() in this handler instead of repeated options.json checks.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4a839aa and 5858ad8.

📒 Files selected for processing (4)
  • packages/cli/src/cmd/project/add/index.ts
  • packages/cli/src/cmd/project/add/keyvalue.ts
  • packages/cli/src/env-util.ts
  • packages/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 using bun run build which compiles with tsc
Run TypeScript type checking with bun 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 are type or interface only - use type keyword 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 .ts extension for proper ESM module resolution

Files:

  • packages/core/src/env.d.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Run bun run format using Biome with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5

Files:

  • packages/core/src/env.d.ts
  • packages/cli/src/cmd/project/add/index.ts
  • packages/cli/src/env-util.ts
  • packages/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
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/core/src/env.d.ts
  • packages/cli/src/cmd/project/add/index.ts
  • packages/cli/src/env-util.ts
  • packages/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 in src/cmd/ with an index.ts entry point
Always define interfaces for command options using Zod schemas; never use any for 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: Use tui.* helpers for formatted output (header, info, success, warning, error, table, progress)
Use ctx.logger for logging; logger.fatal() logs and exits with code 1
Use await readFile(p, 'utf-8') and await writeFile(p, content) from node:fs/promises for file I/O
Import pathExists from node-compat/fs for 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.json type checking enforces this
Imports must use explicit .ts extensions for relative paths (e.g., from './foo.ts', not from './foo'); TypeScript's rewriteRelativeImportExtensions will rewrite them to .js in output
Always check isJSONMode() for machine-readable output in command handlers
Use requireAuth(ctx) or optionalAuth(ctx) for authenticated commands

Files:

  • packages/cli/src/cmd/project/add/index.ts
  • packages/cli/src/env-util.ts
  • packages/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.ts
  • packages/cli/src/cmd/project/add/index.ts
  • packages/cli/src/env-util.ts
  • packages/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.ts
  • packages/cli/src/env-util.ts
  • packages/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

Comment thread packages/cli/src/cmd/project/add/keyvalue.ts Outdated
Huijiro and others added 3 commits June 22, 2026 12:15
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]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Use isJSONMode() in handler branches instead of direct options.json checks.

The handler currently branches directly on options.json in 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 check isJSONMode() 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1f45c64 and cf6f096.

📒 Files selected for processing (5)
  • packages/cli/src/cmd/project/add/keyvalue.ts
  • packages/core/src/env.d.ts
  • packages/server/src/api/region/create.ts
  • packages/server/src/api/region/resources.ts
  • packages/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 format using Biome with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5

Files:

  • packages/server/src/api/region/resources.ts
  • packages/core/src/env.d.ts
  • packages/server/src/api/region/create.ts
  • packages/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
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/server/src/api/region/resources.ts
  • packages/core/src/env.d.ts
  • packages/server/src/api/region/create.ts
  • packages/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.ts
  • packages/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 .ts extensions in relative imports (e.g., from '../api.ts', not from '../api'). This is required for Node.js ESM compatibility — tsc rewrites .ts.js in compiled output, but leaves extensionless imports untouched, which breaks Node.js module resolution. This is enforced by the useImportExtensions Biome lint rule.

Files:

  • packages/server/src/api/region/resources.ts
  • packages/server/src/api/region/create.ts
packages/core/src/**/*.ts

📄 CodeRabbit inference engine (packages/core/AGENTS.md)

packages/core/src/**/*.ts: Build TypeScript code using bun run build which compiles with tsc
Run TypeScript type checking with bun 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 are type or interface only - use type keyword 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 .ts extension 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: Use tui.* helpers for formatted output (header, info, success, warning, error, table, progress)
Use ctx.logger for logging; logger.fatal() logs and exits with code 1
Use await readFile(p, 'utf-8') and await writeFile(p, content) from node:fs/promises for file I/O
Import pathExists from node-compat/fs for 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.json type checking enforces this
Imports must use explicit .ts extensions for relative paths (e.g., from './foo.ts', not from './foo'); TypeScript's rewriteRelativeImportExtensions will rewrite them to .js in output
Always check isJSONMode() for machine-readable output in command handlers
Use requireAuth(ctx) or optionalAuth(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.ts
  • packages/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.ts
  • packages/core/src/env.d.ts
  • packages/server/src/api/region/create.ts
  • packages/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.ts
  • packages/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

Comment thread packages/cli/src/cmd/project/add/keyvalue.ts Outdated
Comment thread packages/core/src/env.d.ts
Trim namespace names from CLI args and drop unused KEYVALUE_NAMESPACE_ENV_KEY export.

Co-authored-by: Cursor <[email protected]>
@Huijiro Huijiro merged commit 5c4bd0c into main Jun 22, 2026
29 checks passed
@Huijiro Huijiro deleted the feat/project-add-keyvalue branch June 22, 2026 21:09
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.

CLI: agentuity project add keyvalue is missing

1 participant