Skip to content

feat(cli): add optional path argument to coder start subcommand#1352

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1775416356-coder-path-arg
Open

feat(cli): add optional path argument to coder start subcommand#1352
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1775416356-coder-path-arg

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot commented Apr 5, 2026

Summary

Adds an optional positional path argument to the coder start subcommand so users can specify a local project directory to operate from:

agentuity coder start ~/path/to/my/project

When provided, the path is resolved to an absolute path, validated for existence, used as the cwd for the spawned pi process, and passed as a positional argument to pi. When omitted, behavior is unchanged (uses current working directory).

Updated help examples in both start.ts and index.ts to show the new usage pattern.

Review & Testing Checklist for Human

  • Verify pi accepts a directory as a positional argument. The code pushes cwd onto piArgs when a path is given — confirm that pi interprets a trailing positional arg as the working directory. If pi doesn't support this, the piArgs.push(cwd) line should be removed (the cwd option on Bun.spawn alone may suffice).
  • Path is not validated as a directory. existsSync will pass for files too. Consider whether a statSync(cwd).isDirectory() check is needed.
  • Path is silently ignored in remote/sandbox modes. If a user passes both --remote and a path, the path has no effect. Decide if a warning is appropriate.
  • Test end-to-end: Run agentuity coder start ~/some/project and confirm pi launches in the correct directory. Also test without a path to confirm no regression.

Notes

  • Only the start subcommand is modified. The create subcommand was intentionally left unchanged since it targets remote/sandbox sessions, not local projects.
  • Uses existsSync from node:fs (new import) for path validation.

Link to Devin session: https://app.devin.ai/sessions/851aa4f948c04bcaa045a3ef07748551

Summary by CodeRabbit

  • New Features

    • Added optional project directory argument to the start command so users can launch with a local path (e.g., coder start ~/path/to/my/project).
    • Console output now shows the selected Path when a local directory is used.
  • Bug Fixes / Validation

    • Resolves and validates ~ paths to ensure the directory exists, and exits with an error for invalid directories.
    • If a local path is provided alongside remote/sandbox options, the path is ignored and a warning is shown.

Allow users to specify a local project directory when starting a coder
session. The path is passed as a positional argument:

  agentuity coder start ~/path/to/my/project

When provided:
- The path is resolved and validated (must exist)
- Used as the working directory for the pi process
- Passed as a positional arg to pi
- Displayed in the startup output

When omitted, behavior is unchanged (uses current working directory).

Co-Authored-By: Rick Blalock <rickblalock@mac.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 5, 2026

📝 Walkthrough

Walkthrough

Adds an optional positional local project directory argument to coder start, implements tilde expansion and absolute-path resolution, validates the path is an existing directory, adjusts the command's working directory for local execution, emits warnings when ignored with remote/sandbox flags, and adds a CLI usage example.

Changes

Cohort / File(s) Summary
CLI usage docs
packages/cli/src/cmd/coder/index.ts
Added a new coder start ~/path/to/my/project example to the command examples array. No runtime wiring changed.
Start subcommand behavior & schema
packages/cli/src/cmd/coder/start.ts
Added optional positional arg args.path: string to start schema. When provided and not --remote/--sandbox: expand ~, resolve to absolute path, stat to ensure it is an existing directory, set cwd accordingly, update Pi spawn to use that cwd, and include the selected path in console output. If provided with --remote or --sandbox, ignore the path and emit a warning. On invalid path, call tui.fatal(..., ErrorCode.CONFIG_INVALID).
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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


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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 5, 2026

📦 Canary Packages Published

version: 2.0.9-2075d54

Packages
Package Version URL
@agentuity/frontend 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-frontend-2.0.9-2075d54.tgz
@agentuity/postgres 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-postgres-2.0.9-2075d54.tgz
@agentuity/task 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-task-2.0.9-2075d54.tgz
@agentuity/keyvalue 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-keyvalue-2.0.9-2075d54.tgz
@agentuity/claude-code 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-claude-code-2.0.9-2075d54.tgz
@agentuity/email 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-email-2.0.9-2075d54.tgz
@agentuity/db 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-db-2.0.9-2075d54.tgz
@agentuity/runtime 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-runtime-2.0.9-2075d54.tgz
@agentuity/evals 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-evals-2.0.9-2075d54.tgz
@agentuity/coder-tui 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-coder-tui-2.0.9-2075d54.tgz
@agentuity/auth 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-auth-2.0.9-2075d54.tgz
@agentuity/webhook 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-webhook-2.0.9-2075d54.tgz
@agentuity/drizzle 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-drizzle-2.0.9-2075d54.tgz
@agentuity/core 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-core-2.0.9-2075d54.tgz
@agentuity/coder 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-coder-2.0.9-2075d54.tgz
@agentuity/schedule 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-schedule-2.0.9-2075d54.tgz
@agentuity/opencode 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-opencode-2.0.9-2075d54.tgz
@agentuity/vector 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-vector-2.0.9-2075d54.tgz
@agentuity/schema 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-schema-2.0.9-2075d54.tgz
@agentuity/cli 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-cli-2.0.9-2075d54.tgz
@agentuity/react 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-react-2.0.9-2075d54.tgz
@agentuity/server 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-server-2.0.9-2075d54.tgz
@agentuity/sandbox 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-sandbox-2.0.9-2075d54.tgz
@agentuity/workbench 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-workbench-2.0.9-2075d54.tgz
@agentuity/migrate 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-migrate-2.0.9-2075d54.tgz
@agentuity/queue 2.0.9-2075d54 https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-queue-2.0.9-2075d54.tgz
Install

Add to your package.json:

{
  "dependencies": {
    "@agentuity/frontend": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-frontend-2.0.9-2075d54.tgz",
    "@agentuity/postgres": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-postgres-2.0.9-2075d54.tgz",
    "@agentuity/task": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-task-2.0.9-2075d54.tgz",
    "@agentuity/keyvalue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-keyvalue-2.0.9-2075d54.tgz",
    "@agentuity/claude-code": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-claude-code-2.0.9-2075d54.tgz",
    "@agentuity/email": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-email-2.0.9-2075d54.tgz",
    "@agentuity/db": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-db-2.0.9-2075d54.tgz",
    "@agentuity/runtime": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-runtime-2.0.9-2075d54.tgz",
    "@agentuity/evals": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-evals-2.0.9-2075d54.tgz",
    "@agentuity/coder-tui": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-coder-tui-2.0.9-2075d54.tgz",
    "@agentuity/auth": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-auth-2.0.9-2075d54.tgz",
    "@agentuity/webhook": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-webhook-2.0.9-2075d54.tgz",
    "@agentuity/drizzle": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-drizzle-2.0.9-2075d54.tgz",
    "@agentuity/core": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-core-2.0.9-2075d54.tgz",
    "@agentuity/coder": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-coder-2.0.9-2075d54.tgz",
    "@agentuity/schedule": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-schedule-2.0.9-2075d54.tgz",
    "@agentuity/opencode": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-opencode-2.0.9-2075d54.tgz",
    "@agentuity/vector": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-vector-2.0.9-2075d54.tgz",
    "@agentuity/schema": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-schema-2.0.9-2075d54.tgz",
    "@agentuity/cli": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-cli-2.0.9-2075d54.tgz",
    "@agentuity/react": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-react-2.0.9-2075d54.tgz",
    "@agentuity/server": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-server-2.0.9-2075d54.tgz",
    "@agentuity/sandbox": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-sandbox-2.0.9-2075d54.tgz",
    "@agentuity/workbench": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-workbench-2.0.9-2075d54.tgz",
    "@agentuity/migrate": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-migrate-2.0.9-2075d54.tgz",
    "@agentuity/queue": "https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-queue-2.0.9-2075d54.tgz"
  }
}

Or install directly:

bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-frontend-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-postgres-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-task-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-keyvalue-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-claude-code-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-email-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-db-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-runtime-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-evals-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-coder-tui-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-auth-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-webhook-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-drizzle-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-core-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-coder-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-schedule-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-opencode-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-vector-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-schema-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-cli-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-react-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-server-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-sandbox-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-workbench-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-migrate-2.0.9-2075d54.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.9-2075d54/agentuity-queue-2.0.9-2075d54.tgz

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli/src/cmd/coder/start.ts`:
- Around line 133-141: The local-path existence check runs unconditionally; gate
it so it only runs in local mode (i.e., when not in remote or sandbox mode).
Move the existsSync + tui.fatal(ErrorCode.CONFIG_INVALID) validation into the
branch that handles local startup (check flags like args.remote or args.sandbox
or whichever mode variable your code uses) and skip validation when
remote/sandbox is true; if args.path is provided but ignored because
remote/sandbox mode is active, emit a concise tui.warn indicating the path was
ignored. Ensure you still set cwd = resolve(args.path) only for local mode and
keep references to cwd, args.path, existsSync, tui.fatal, and
ErrorCode.CONFIG_INVALID to locate the change.
- Line 385: The line that pushes the working directory into the Pi CLI
positional args is incorrect: remove the push of cwd into piArgs (the
conditional using args?.path and piArgs.push(cwd)) so the Pi CLI doesn't treat
the directory as a message/file; instead rely on the existing Bun.spawn
invocation that sets the cwd option to control the process working directory.
Locate the piArgs construction and the conditional referencing args?.path and
remove the piArgs.push(cwd) call so only valid flags/positional values are
passed to the Pi CLI.
- Line 2: resolve(args.path) does not expand a leading ~ and the current
existence check (including Bun.file().exists()) does not verify the target is a
directory; update the path handling to first expand a leading '~' to
os.homedir(), then call path.resolve on that expanded value (reference resolve
and args.path), and replace the Bun.file().exists() check with node:fs/promises
stat/lstat to ensure the path exists and stats.isDirectory() returns true (use
the async fs.stat or fs.lstat functions); if the check fails, log a clear error
via the same logger and exit, ensuring any imports are updated to include
node:os and node:fs/promises instead of relying on Bun.file().exists().
🪄 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: e9bcf5f0-6d70-47d0-9773-a8840ec73b1a

📥 Commits

Reviewing files that changed from the base of the PR and between 95d2860 and 6827e85.

📒 Files selected for processing (2)
  • packages/cli/src/cmd/coder/index.ts
  • packages/cli/src/cmd/coder/start.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). (12)
  • GitHub Check: Windows WSL CLI Smoke Test
  • GitHub Check: Pack & Upload
  • GitHub Check: Build
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: Queue CLI Tests
  • GitHub Check: Postgres SSL Integration Test
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Template Integration Tests
🧰 Additional context used
📓 Path-based instructions (5)
packages/cli/src/cmd/**/index.ts

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

packages/cli/src/cmd/**/index.ts: Each command must be structured as a directory in src/cmd/ with an index.ts file as the entry point
Always define interfaces or Zod schemas for command options; never use any type for type safety
Use tui.* helpers (header, info, success, warning, error, table, progress) for formatted TUI output instead of raw console methods
Use ctx.logger for logging instead of console methods; use logger.fatal() for fatal errors which logs and exits with code 1
Always check isJSONMode() before outputting data and provide machine-readable output when in JSON mode
Use requireAuth(ctx) for commands that require authentication or optionalAuth(ctx) for commands that support optional authentication

Files:

  • packages/cli/src/cmd/coder/index.ts
packages/cli/**/*.ts

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

Use Bun.file(f).exists() instead of existsSync(f) for file existence checks

Files:

  • packages/cli/src/cmd/coder/index.ts
  • packages/cli/src/cmd/coder/start.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5

Files:

  • packages/cli/src/cmd/coder/index.ts
  • packages/cli/src/cmd/coder/start.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript Strict mode with ESNext target and bundler moduleResolution
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/cli/src/cmd/coder/index.ts
  • packages/cli/src/cmd/coder/start.ts
**/index.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use named exports from package index.ts files

Files:

  • packages/cli/src/cmd/coder/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/cli/src/cmd/coder/index.ts
  • packages/cli/src/cmd/coder/start.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/coder/index.ts
  • packages/cli/src/cmd/coder/start.ts
🔇 Additional comments (1)
packages/cli/src/cmd/coder/start.ts (1)

104-106: Good addition of positional path schema.

The optional args.path definition is clean and type-safe, and it aligns with the new command UX.

…dation, remove piArgs.push

- Expand ~ to homedir() before resolving path (fixes ~/path examples)
- Validate path is a directory using stat().isDirectory() instead of existsSync()
- Remove piArgs.push(cwd) since Pi CLI doesn't accept directory positional args
  (Bun.spawn cwd option is sufficient)
- Gate path validation to local mode only; warn if used with --remote/--sandbox
- Use async stat from node:fs/promises instead of sync existsSync

Co-Authored-By: Rick Blalock <rickblalock@mac.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/cli/src/cmd/coder/start.ts`:
- Around line 136-145: The code currently treats args.path truthily and calls
trim(), which wrongly ignores empty strings and strips intentional spaces and
fails to expand Windows-style home paths; change the condition to check presence
explicitly (if (args?.path !== undefined)), stop using trim() (use raw =
args.path), and implement home expansion for '~' plus both '~/...' and '~\\...'
(e.g., if raw === '~' -> cwd = resolve(homedir()), else if raw.startsWith('~/')
|| raw.startsWith('~\\') -> cwd = resolve(homedir(), raw.slice(2)), otherwise
cwd = resolve(raw)); keep the existing tui.warning for when opts.remote or
opts.sandbox are set.
🪄 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: 257ae603-6e2c-49d3-bd2d-6a9804adf759

📥 Commits

Reviewing files that changed from the base of the PR and between 6827e85 and 2075d54.

📒 Files selected for processing (1)
  • packages/cli/src/cmd/coder/start.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). (14)
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Postgres SSL Integration Test
  • GitHub Check: Queue SDK Tests
  • GitHub Check: Storage CLI Tests
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: Queue CLI Tests
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Template Integration Tests
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Pack & Upload
  • GitHub Check: Build
  • GitHub Check: Windows WSL CLI Smoke Test
🧰 Additional context used
📓 Path-based instructions (3)
packages/cli/**/*.ts

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

Use Bun.file(f).exists() instead of existsSync(f) for file existence checks

Files:

  • packages/cli/src/cmd/coder/start.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome as code formatter with tabs (width 3), single quotes, semicolons, lineWidth 100, and trailingCommas es5

Files:

  • packages/cli/src/cmd/coder/start.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript Strict mode with ESNext target and bundler moduleResolution
Use StructuredError from @agentuity/core for error handling

Files:

  • packages/cli/src/cmd/coder/start.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/cli/src/cmd/coder/start.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/coder/start.ts

Comment on lines +136 to +145
if (args?.path) {
// Warn if path is provided with --remote or --sandbox (path is ignored in those modes)
if (opts?.remote !== undefined || opts?.sandbox !== undefined) {
tui.warning('Path argument is ignored in remote/sandbox mode');
} else {
const raw = args.path.trim();
cwd =
raw === '~' || raw.startsWith('~/')
? resolve(homedir(), raw.slice(2))
: resolve(raw);
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.

⚠️ Potential issue | 🟡 Minor

Don't rely on truthiness and trim() for the positional path.

if (args?.path) treats "" as “no path”, while trim() makes ' ' resolve to process.cwd() and strips intentional leading/trailing spaces from quoted directory names. The home-expansion check also misses ~\..., so Windows-style home paths resolve incorrectly.

🛠️ Proposed fix
-		if (args?.path) {
+		if (args?.path !== undefined) {
 			// Warn if path is provided with --remote or --sandbox (path is ignored in those modes)
 			if (opts?.remote !== undefined || opts?.sandbox !== undefined) {
 				tui.warning('Path argument is ignored in remote/sandbox mode');
 			} else {
-				const raw = args.path.trim();
+				const raw = args.path;
+				if (raw.trim().length === 0) {
+					tui.fatal('Path argument cannot be empty', ErrorCode.CONFIG_INVALID);
+					return;
+				}
 				cwd =
-					raw === '~' || raw.startsWith('~/')
+					raw === '~' || raw.startsWith('~/') || raw.startsWith('~\\')
 						? resolve(homedir(), raw.slice(2))
 						: resolve(raw);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/src/cmd/coder/start.ts` around lines 136 - 145, The code
currently treats args.path truthily and calls trim(), which wrongly ignores
empty strings and strips intentional spaces and fails to expand Windows-style
home paths; change the condition to check presence explicitly (if (args?.path
!== undefined)), stop using trim() (use raw = args.path), and implement home
expansion for '~' plus both '~/...' and '~\\...' (e.g., if raw === '~' -> cwd =
resolve(homedir()), else if raw.startsWith('~/') || raw.startsWith('~\\') -> cwd
= resolve(homedir(), raw.slice(2)), otherwise cwd = resolve(raw)); keep the
existing tui.warning for when opts.remote or opts.sandbox are set.

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.

0 participants