Skip to content

fix(cli): support explicit project config paths#1435

Merged
jhaynie merged 2 commits intomainfrom
fix/cli-dir-explicit-project-config
May 2, 2026
Merged

fix(cli): support explicit project config paths#1435
jhaynie merged 2 commits intomainfrom
fix/cli-dir-explicit-project-config

Conversation

@jhaynie
Copy link
Copy Markdown
Member

@jhaynie jhaynie commented May 2, 2026

Summary

  • allow project-aware --dir values to point directly at an explicit JSON project config
  • keep ctx.projectDir rooted at the parent folder for explicit config files
  • ensure project config mutations write back to the loaded explicit config file
  • add focused tests for explicit config paths, profile fallback bypass, missing files, and .json directories

Fixes #1434

Verification

  • bun test packages/cli/test/config/project-config-paths.test.ts
  • bunx biome lint packages/cli/src/config.ts packages/cli/src/cli.ts packages/cli/test/config/project-config-paths.test.ts
  • bun run --filter='./packages/cli' typecheck
  • bun run --filter='./packages/cli' build

Summary by CodeRabbit

  • Bug Fixes

    • More reliable project config path resolution and consistent selection of the intended config file.
    • Improved handling of explicitly-specified config files: failures now exit immediately with a clear PROJECT_NOT_FOUND error that includes the resolved config path.
    • Updates now target the exact config file that was resolved/loaded.
  • Tests

    • Added tests covering config path resolution, explicit-file behavior, error metadata, and update targeting.

@agentuity-agent
Copy link
Copy Markdown

agentuity-agent Bot commented May 2, 2026

The latest Agentuity deployment details.

Project Deployment Preview Updated (UTC)
docs 🔴 Failed (deploy_40a38119b41349a71805c4336c7b7f42) - 2026-05-02T16:28:18Z

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

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: 6759f56b-40b4-411b-90e0-d2c63976370d

📥 Commits

Reviewing files that changed from the base of the PR and between a6c0875 and fed2641.

📒 Files selected for processing (2)
  • packages/cli/src/config.ts
  • packages/cli/test/config/project-config-paths.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/src/config.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Windows WSL CLI Smoke Test
  • GitHub Check: Queue CLI Tests
  • GitHub Check: Storage CLI Tests
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Queue SDK Tests
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Template Integration Tests
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Standalone Agent Test
  • GitHub Check: Postgres SSL Integration Test
  • GitHub Check: Build
  • GitHub Check: Pack & Upload
🧰 Additional context used
📓 Path-based instructions (4)
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/test/config/project-config-paths.test.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/test/config/project-config-paths.test.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/test/config/project-config-paths.test.ts
**/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/test/**/*.{ts,tsx}: Place tests in test/ folder, never in src/ or __tests__/ directories
Import from ../src/ in test files
Use @agentuity/test-utils for mocks in tests

Files:

  • packages/cli/test/config/project-config-paths.test.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/test/config/project-config-paths.test.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.

Applied to files:

  • packages/cli/test/config/project-config-paths.test.ts

📝 Walkthrough

Walkthrough

Refactors project-config resolution by adding resolveProjectConfigPaths() and a typed ProjectConfigNotFoundException. loadProjectConfig/updateProjectConfig now use the resolver and record resolved paths. CLI uses the resolver for projectDir resolution and treats missing explicit config files as immediate PROJECT_NOT_FOUND exits. Tests cover path-resolution and update behavior.

Changes

Project Config Path Resolution

Layer / File(s) Summary
Type definitions & cache
packages/cli/src/config.ts
Adds ResolvedProjectConfigPaths type, typed ProjectConfigNotFoundException, and loadedProjectConfigPaths map; resetConfigCache() clears the map.
Filesystem helpers & resolver
packages/cli/src/config.ts
Adds async stat usage and exports `resolveProjectConfigPaths(path: string, config?: Config
Load / Update behavior
packages/cli/src/config.ts
loadProjectConfig() uses resolver, records (projectDir -> configPath), and throws ProjectConfigNotFoundException with configPath and explicit. updateProjectConfig() resolves target path preferring explicit inputs and loadedProjectConfigPaths, and throws typed ProjectConfigNotFoundException (with ErrorCode.PROJECT_NOT_FOUND) when missing.
CLI wiring & error handling
packages/cli/src/cli.ts
Replaces manual ~/ expansion + resolve() with resolveProjectConfigPaths(dir, baseCtx.config).projectDir. If ProjectConfigNotFoundException.explicit === true, CLI exits immediately with PROJECT_NOT_FOUND referencing the resolved configPath.
Tests
packages/cli/test/config/project-config-paths.test.ts
Adds tests validating resolveProjectConfigPaths outputs, loadProjectConfig/updateProjectConfig behavior for explicit vs. fallback configs, directory-vs-file disambiguation, error messages/metadata on missing explicit files, and that updates target the explicit file when expected.
🚥 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 PR implements all explicit config file acceptance criteria: supports .json file paths via resolveProjectConfigPaths, sets projectDir to parent directory, bypasses profile fallback for explicit files, preserves directory behavior, fails on missing files, ensures config mutations write to loaded file, and maintains --project-id precedence.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #1434 objectives: config path resolution refactoring, error handling for missing explicit files, profile fallback bypass, and comprehensive test coverage for explicit config file scenarios.

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


Review rate limit: 0/5 reviews remaining, refill in 54 minutes and 1 second.

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

📦 Canary Packages Published

version: 2.0.12-fed2641

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

Add to your package.json:

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

Or install directly:

bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-task-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-email-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-migrate-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-coder-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-cli-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-postgres-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-server-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-sandbox-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-coder-tui-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-webhook-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-frontend-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-keyvalue-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-evals-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-core-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-drizzle-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-db-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-claude-code-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-react-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-schema-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-queue-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-auth-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-opencode-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-schedule-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-vector-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-runtime-2.0.12-fed2641.tgz
bun add https://agentuity-sdk-objects.t3.storageapi.dev/npm/2.0.12-fed2641/agentuity-workbench-2.0.12-fed2641.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.

🧹 Nitpick comments (1)
packages/cli/src/config.ts (1)

767-775: ⚡ Quick win

Use the typed project-config error in updateProjectConfig() as well.

Now that this path can target explicit JSON files too, Line 774 still throwing a plain Error drops the configPath/explicit metadata that loadProjectConfig() and cli.ts use for clear PROJECT_NOT_FOUND handling. That makes mutation flows inconsistent with the new resolver behavior.

♻️ Suggested change
 	const file = Bun.file(configPath);
 	if (!(await file.exists())) {
-		throw new Error(`Project config not found at ${configPath}`);
+		throw new ProjectConfigNotFoundException({
+			message: `Project config not found at ${configPath}`,
+			configPath,
+			explicit: resolved.explicitConfigFile,
+		});
 	}

As per coding guidelines "Use StructuredError from @agentuity/core for error handling".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/src/config.ts` around lines 767 - 775, The current throw in
updateProjectConfig() uses a plain Error which loses the structured metadata
expected by loadProjectConfig() and cli.ts; replace that throw with a
StructuredError (from `@agentuity/core`) carrying the PROJECT_NOT_FOUND code and
include the configPath plus the explicit flag (use resolved.configPath and
resolved.explicitConfigFile) so callers can inspect { configPath, explicit }
like loadProjectConfig() does; locate the logic around
resolveProjectConfigPaths, loadedProjectConfigPaths and the file.exists() check
and swap the Error for a StructuredError with the same message and the extra
metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@packages/cli/src/config.ts`:
- Around line 767-775: The current throw in updateProjectConfig() uses a plain
Error which loses the structured metadata expected by loadProjectConfig() and
cli.ts; replace that throw with a StructuredError (from `@agentuity/core`)
carrying the PROJECT_NOT_FOUND code and include the configPath plus the explicit
flag (use resolved.configPath and resolved.explicitConfigFile) so callers can
inspect { configPath, explicit } like loadProjectConfig() does; locate the logic
around resolveProjectConfigPaths, loadedProjectConfigPaths and the file.exists()
check and swap the Error for a StructuredError with the same message and the
extra metadata.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 140044ab-fe8f-4d3f-b63b-6d1cbbf6b256

📥 Commits

Reviewing files that changed from the base of the PR and between 7d8cc1e and a6c0875.

📒 Files selected for processing (3)
  • packages/cli/src/cli.ts
  • packages/cli/src/config.ts
  • packages/cli/test/config/project-config-paths.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: Queue SDK Tests
  • GitHub Check: Build
  • GitHub Check: Template Integration Tests
  • GitHub Check: Sandbox CLI Tests
  • GitHub Check: Playwright E2E Smoke Test
  • GitHub Check: Queue CLI Tests
  • GitHub Check: SDK Integration Test Suite
  • GitHub Check: Postgres SSL Integration Test
  • GitHub Check: Framework Integration Tests (TanStack & Next.js)
  • GitHub Check: Cloud Deployment Tests
  • GitHub Check: Standalone Agent Test
  • GitHub Check: Package Installation & Usage Test
  • GitHub Check: Storage CLI Tests
  • GitHub Check: Pack & Upload
  • GitHub Check: Windows WSL CLI Smoke Test
🧰 Additional context used
📓 Path-based instructions (4)
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/test/config/project-config-paths.test.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/config.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/test/config/project-config-paths.test.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/config.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/test/config/project-config-paths.test.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/config.ts
**/test/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/test/**/*.{ts,tsx}: Place tests in test/ folder, never in src/ or __tests__/ directories
Import from ../src/ in test files
Use @agentuity/test-utils for mocks in tests

Files:

  • packages/cli/test/config/project-config-paths.test.ts
🧠 Learnings (3)
📚 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/test/config/project-config-paths.test.ts
  • packages/cli/src/cli.ts
  • packages/cli/src/config.ts
📚 Learning: 2026-02-21T02:05:57.982Z
Learnt from: jhaynie
Repo: agentuity/sdk PR: 1010
File: packages/drizzle/test/proxy.test.ts:594-603
Timestamp: 2026-02-21T02:05:57.982Z
Learning: Do not rely on StructuredError from agentuity/core in test files or simple error handling paths. In tests and straightforward error handling, use plain Error objects to represent failures, reserving StructuredError for more complex error scenarios in application logic.

Applied to files:

  • packages/cli/test/config/project-config-paths.test.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/cli.ts
  • packages/cli/src/config.ts

@jhaynie jhaynie merged commit 2f897f5 into main May 2, 2026
18 of 19 checks passed
@jhaynie jhaynie deleted the fix/cli-dir-explicit-project-config branch May 2, 2026 16:37
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: allow --dir to accept an explicit agentuity JSON config file path

1 participant