Skip to content

Remove DEXTO_DEV_MODE and add DEXTO_HOME_DIR path override#633

Open
rahulkarajgikar wants to merge 10 commits intotruffle-ai:mainfrom
rahulkarajgikar:homedir-fixes
Open

Remove DEXTO_DEV_MODE and add DEXTO_HOME_DIR path override#633
rahulkarajgikar wants to merge 10 commits intotruffle-ai:mainfrom
rahulkarajgikar:homedir-fixes

Conversation

@rahulkarajgikar
Copy link
Copy Markdown
Collaborator

@rahulkarajgikar rahulkarajgikar commented Mar 3, 2026

Summary

  • remove maintainer-only DEXTO_DEV_MODE and --dev branching
  • make source-context behavior explicit (repo-local commands/ and repo .dexto/ paths)
  • add DEXTO_HOME_DIR as highest-precedence override for Dexto storage and env-loading paths
  • replace touched hardcoded ~/.dexto usages with shared path resolvers
  • update CLI/TUI/docs/dev scripts for the new behavior
  • update affected unit tests for path precedence and source/project/global semantics

Validation

  • bash scripts/quality-checks.sh
    • build passed
    • failed at sync-openapi-docs:check due existing OpenAPI drift in this branch
  • focused tests:
    • pnpm exec vitest run packages/agent-management/src/utils/path.test.ts packages/core/src/utils/path.test.ts packages/agent-management/src/plugins/discover-skills.test.ts packages/agent-management/src/plugins/marketplace/__tests__/registry.test.ts packages/agent-management/src/config/discover-prompts.test.ts packages/agent-management/src/resolver.test.ts packages/cli/src/cli/utils/setup-utils.test.ts packages/cli/src/utils/env.test.ts
  • smoke checks:
    • node packages/cli/dist/index.js --help
    • node packages/cli/dist/index.js auth status
    • DEXTO_HOME_DIR=/tmp/dexto-smoke node packages/cli/dist/index.js which coding-agent

Summary by CodeRabbit

  • New Features

    • DEXTO_HOME_DIR override added; new helpers for centralized model and storage management; CLI session storage now uses resolved Dexto home.
  • Bug Fixes & Improvements

    • Removed --dev flag / DEXTO_DEV_MODE and unified path resolution to the resolved Dexto home.
    • Global/local discovery made consistent for skills, models, plugins, and env paths; improved default behaviors and error handling in source context.
  • Documentation

    • CLI and developer docs updated to reflect home-dir override, path resolution, and usage examples.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 3, 2026

@rahulkarajgikar is attempting to deploy a commit to the Shaunak's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 3, 2026

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
📝 Walkthrough

Walkthrough

This PR removes DEXTO_DEV_MODE, adds a DEXTO_HOME_DIR override, centralizes path resolution via getDextoPath/getDextoGlobalPath/getDextoEnvPath, replaces homedir() usages with those helpers, changes source-context handling to always use source root, and updates imports, tests, docs, and scripts accordingly. (50 words)

Changes

Cohort / File(s) Summary
Core path utils
packages/core/src/utils/path.ts, packages/agent-management/src/utils/path.ts
Add DEXTO_HOME_DIR override helper; remove DEXTO_DEV_MODE branches; add optional startPath on global path helpers; unify source/global/env resolution and ensure directory creation flows.
Models & helpers
packages/agent-management/src/models/path-resolver.ts
Switch models directory to getDextoGlobalPath('models'); add many model file/directory utilities (ensure, list, delete, size, temp, format helpers).
Skill & marketplace discovery
packages/agent-management/src/plugins/discover-skills.ts, packages/agent-management/src/plugins/marketplace/registry.ts, packages/agent-management/src/plugins/discover-skills.test.ts, packages/agent-management/src/plugins/marketplace/__tests__/registry.test.ts
Replace hardcoded homedir paths with getDextoGlobalPath(...); tests stub/mock new path helper for stable expectations.
Agent config & resolver
packages/agent-management/src/config/discover-prompts.ts, packages/agent-management/src/config/discover-prompts.test.ts, packages/agent-management/src/config/config-enrichment.ts, packages/agent-management/src/loader.ts, packages/agent-management/src/resolver.ts, packages/agent-management/src/resolver.test.ts
Remove dev-mode gating for dexto-source; always consider source-root local commands when present; prefer user preferences when setup complete; tests updated to remove DEXTO_DEV_MODE branches.
Path-related tests
packages/agent-management/src/utils/path.test.ts, packages/core/src/utils/path.test.ts
Add DEXTO_HOME_DIR override test suites and lifecycle hooks; remove DEXTO_DEV_MODE-dependent cases; adjust helpers and expectations for explicit startPath usage.
CLI imports & env handling
packages/cli/src/cli/auth/dexto-api-key.ts, packages/cli/src/cli/auth/service.ts, packages/cli/src/cli/mcp/oauth-store.ts, packages/cli/src/cli/utils/api-key-setup.ts, packages/cli/src/cli/utils/package-mgmt.ts, packages/cli/src/cli/utils/setup-utils.ts, packages/cli/src/cli/utils/setup-utils.test.ts, packages/cli/src/utils/env.test.ts, packages/cli/src/utils/env.ts
Move path helper imports from @dexto/core to @dexto/agent-management; use getDextoGlobalPath/getDextoEnvPath for env/setup flows; remove dev-mode setup skips and update tests/mocks.
TUI / Overlay changes
packages/tui/src/containers/OverlayContainer.tsx, packages/tui/src/utils/soundNotification.ts
Always resolve sourceRoot in dexto-source context (no dev-mode fallback); set commandsDir from sourceRoot and update comments/docs accordingly.
CLI flags & scripts
packages/cli/src/index-main.ts, package.json, scripts/dev-server.ts, .claude/commands/dev-server.md
Remove --dev CLI flag and DEXTO_DEV_MODE usage from startup scripts/docs; update dev:cli script and dev-server invocation to not set DEXTO_DEV_MODE.
Auth / analytics / logging
packages/agent-management/src/utils/dexto-auth.ts, packages/analytics/src/state.ts, packages/image-logger-agent/src/hooks/request-logger.ts
Switch imports to agent-management path utilities; replace homedir-based defaults with getDextoGlobalPath(...) for logs/env/auth paths.
Documentation & developer guides
DEVELOPMENT.md, packages/cli/CLI.md, .claude/commands/dev-server.md
Document DEXTO_HOME_DIR override, replace "dev mode" wording with "source context" or home-dir override, update examples and developer setup instructions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant AgentMgmt as AgentManagement (path utils)
    participant FS as Filesystem/Prefs

    User->>CLI: start CLI / script (no --dev)
    CLI->>AgentMgmt: getExecutionContext / getDextoGlobalPath(startPath)
    AgentMgmt->>FS: resolve path (DEXTO_HOME_DIR? sourceRoot? global ~/.dexto)
    FS-->>AgentMgmt: path result
    AgentMgmt-->>CLI: return resolved paths (.env, models, skills, logs)
    CLI->>FS: read preferences/repo configs using returned paths
    FS-->>CLI: preferences / repo config
    CLI->>User: proceed with resolved defaults (preferences prioritized)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • shaunak99

Poem

🐰 Paths once scattered, now align the trail,
DEXTO_HOME_DIR whispers, "use this vale."
Dev-mode shadows quietly depart,
Source roots steady, preferences start.
Hop, code, hop—new paths without fail. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 79.31% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely summarizes the two main changes: removing DEXTO_DEV_MODE and adding DEXTO_HOME_DIR path override functionality.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@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: 7

🧹 Nitpick comments (3)
packages/cli/src/utils/env.test.ts (1)

28-46: Keep getDextoGlobalPath mock context detection aligned with the getExecutionContext mock.

This block duplicates context inference with narrower rules, which can drift and mask context-specific regressions in tests.

♻️ Suggested refactor
-                const context =
-                    fs.existsSync(path.join(startPath, 'package.json')) &&
-                    JSON.parse(fs.readFileSync(path.join(startPath, 'package.json'), 'utf-8'))
-                        .name === 'dexto-monorepo'
-                        ? 'dexto-source'
-                        : 'global-cli';
+                const pkgPath = path.join(startPath, 'package.json');
+                let context: 'dexto-source' | 'dexto-project' | 'global-cli' = 'global-cli';
+                if (fs.existsSync(pkgPath)) {
+                    const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
+                    if (pkg.name === 'dexto-monorepo' || pkg.name === 'dexto') {
+                        context = 'dexto-source';
+                    } else if (pkg.dependencies?.dexto || pkg.devDependencies?.dexto) {
+                        context = 'dexto-project';
+                    }
+                }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/src/utils/env.test.ts` around lines 28 - 46, The
getDextoGlobalPath mock duplicates the logic for detecting execution context and
can drift from the getExecutionContext mock; modify getDextoGlobalPath to reuse
or delegate to the same getExecutionContext mock (or call the exported
getExecutionContext function) to determine whether context is 'dexto-source' or
'global-cli' rather than re-implementing the package.json check, then compute
homeRoot and basePath from that shared result so both mocks stay aligned (refer
to the getDextoGlobalPath and getExecutionContext symbols to locate and change
the logic).
packages/agent-management/src/plugins/discover-skills.ts (1)

99-101: Deduplicate skill directory paths before scanning/returning search paths.

When resolved global skills path equals project .dexto/skills, this can scan/list the same directory twice.

♻️ Proposed dedupe refactor
 export function discoverStandaloneSkills(projectPath?: string): DiscoveredSkill[] {
     const skills: DiscoveredSkill[] = [];
     const seenNames = new Set<string>();
     const homeDir = process.env.HOME || process.env.USERPROFILE || '';
     const cwd = projectPath || process.cwd();
     const dextoSkillsDir = getDextoGlobalPath('skills', undefined, cwd);
+    const projectDextoSkillsDir = path.join(cwd, '.dexto', 'skills');

@@
-    scanSkillsDir(path.join(cwd, '.dexto', 'skills'), 'project');
+    scanSkillsDir(projectDextoSkillsDir, 'project');

@@
-    scanSkillsDir(dextoSkillsDir, 'user');
+    if (dextoSkillsDir !== projectDextoSkillsDir) {
+        scanSkillsDir(dextoSkillsDir, 'user');
+    }

     return skills;
 }

 export function getSkillSearchPaths(): string[] {
@@
-    return [
+    return Array.from(
+        new Set([
             path.join(cwd, '.agents', 'skills'),
             path.join(cwd, '.dexto', 'skills'),
             homeDir ? path.join(homeDir, '.agents', 'skills') : '',
             dextoSkillsDir,
-    ].filter(Boolean);
+        ].filter(Boolean))
+    );
 }

Also applies to: 109-109, 125-130

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

In `@packages/agent-management/src/plugins/discover-skills.ts` around lines 99 -
101, scanSkillsDir is being called on potentially identical directories (e.g.
project '.dexto/skills' and resolved global skills) which causes duplicate scans
and returned search paths; change the code around the scanSkillsDir invocations
(references: scanSkillsDir, cwd, '.agents/skills', '.dexto/skills', resolved
global skills path) to deduplicate paths before scanning and before returning
the search paths — e.g., gather candidate paths into a collection, normalize
them, remove duplicates (Set or equality check), then iterate to call
scanSkillsDir and build the final returned list; apply the same dedupe logic to
the other spots noted (the calls around the same block at the other
occurrences).
packages/agent-management/src/utils/path.ts (1)

1-3: Consider collapsing this shim onto the core path utilities to avoid drift.

Given this module is a temporary duplicate, keeping two path resolvers in sync across packages is a long-term maintenance hazard.

Based on learnings: Applies to **/*.{ts,tsx} : Use context-aware path resolution utilities from packages/core/src/utils/path.ts for path resolution that differs by execution context.

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

In `@packages/agent-management/src/utils/path.ts` around lines 1 - 3, This shim
duplicates the core path resolver and should be collapsed: remove the local
duplicate implementations in this module and instead import and re-export the
context-aware path utilities from the core package (use the same exported API
this file currently exposes so callers remain unchanged), or directly delegate
functions in this module to the core utilities; ensure TypeScript
types/signatures match the original exports and update any local references to
call the core implementation so the package uses the single source-of-truth path
resolver.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@DEVELOPMENT.md`:
- Around line 214-219: Replace the misleading phrase "Setup checks skipped for
maintainer workflows" in the sentence under "When running in this repository
(`dexto-source` context)" with wording that reflects source-context behavior
(e.g., "Setup checks skipped in source context" or "Setup checks skipped when
running in repository source context"); update the line so the list item reads
consistently with the surrounding bullets about repository-local defaults and
does not reference maintainer-only semantics.

In `@packages/agent-management/src/models/path-resolver.ts`:
- Around line 14-15: Update the function doc for getDextoGlobalPath to state
that returned path is context-dependent: in normal contexts it maps to
<dexto-home>/models but in the "dexto-source" context it resolves to the
repository-local .dexto/models; mention both behaviors and the context switch so
callers understand when they will receive a global home path vs a repo-local
.dexto path and reference getDextoGlobalPath('models') and the "dexto-source"
context by name in the comment.

In `@packages/agent-management/src/utils/path.ts`:
- Around line 36-39: Update the doc comments to reflect the actual path shape
used when DEXTO_HOME_DIR is set: indicate that the implementation resolves paths
as <DEXTO_HOME_DIR>/<type> (not just <DEXTO_HOME_DIR>), and apply this
clarification to the context-aware sections for both resolvers in this file (the
source and project resolvers that read DEXTO_HOME_DIR). Ensure the comment lines
that currently say "Use <DEXTO_HOME_DIR>" are changed to "Use
<DEXTO_HOME_DIR>/<type>" (and similarly update the other instance around lines
89-91) so the documentation matches the implementation.

In `@packages/cli/CLI.md`:
- Around line 121-123: Update the Architecture section to reflect that the CLI
uses multiple local React state hooks rather than a centralized reducer: replace
the bullet "State Management - Centralized reducer pattern for predictable
state" with a concise line like "State Management - localized React useState
hooks (no centralized reducer)", and mention that the implementation in the CLI
component (referenced as ink-cli) intentionally uses multiple useState hooks;
ensure any other references to a reducer or centralized state (e.g., in "Custom
Hooks" or "Services" descriptions) are removed or reworded to avoid implying a
reducer-based pattern.

In `@packages/cli/src/cli/utils/setup-utils.ts`:
- Around line 117-121: Update the stale comment block in setup-utils.ts to
reflect the new "source skip" behavior: change the bullet list so "Source
context" indicates setup is skipped and preferences are not required/validated
(mirror "Project context: Skip setup"), and adjust the "First-time user" and
"Has preferences" bullets to specify they only apply to global-cli contexts;
ensure the wording clearly distinguishes source/global-cli vs project contexts
so the comment matches the runtime behavior.

In `@packages/core/src/utils/path.ts`:
- Around line 48-49: Replace the plain `throw new Error('...')` usages with the
core typed error factory for this module: locate each throw that uses the
message "Not in dexto source context" (and the other similar throw sites at the
additional ranges) in this file (e.g., the throws inside the path utilities) and
replace them with a module-specific typed error from the core error factory
(e.g., call the module's error helper like
createPathError('NotInDextoSourceContext', { detail: 'Not in dexto source
context' }) or similar), ensuring you import the factory helper and use
consistent error codes/names rather than raw Error instances for all occurrences
referenced (lines ~48, ~56, ~66, ~93, ~196, ~204).

In `@packages/tui/src/containers/OverlayContainer.tsx`:
- Around line 2271-2274: The code currently falls back silently to
getDextoGlobalPath('commands') when findDextoSourceRoot() returns falsy, which
can write prompts to an unexpected global location; change this to fail-fast (or
log an explicit error and abort) and use the context-aware path resolution
utilities from packages/core/src/utils/path.ts instead of getDextoGlobalPath.
Replace the conditional that sets commandsDir (which references
findDextoSourceRoot() and getDextoGlobalPath) with a call to the appropriate
path util (from packages/core/src/utils/path.ts) that resolves a commands path
based on execution context, and if it cannot resolve a source root ensure the
code throws or returns an explicit error/abort rather than silently using the
global path.

---

Nitpick comments:
In `@packages/agent-management/src/plugins/discover-skills.ts`:
- Around line 99-101: scanSkillsDir is being called on potentially identical
directories (e.g. project '.dexto/skills' and resolved global skills) which
causes duplicate scans and returned search paths; change the code around the
scanSkillsDir invocations (references: scanSkillsDir, cwd, '.agents/skills',
'.dexto/skills', resolved global skills path) to deduplicate paths before
scanning and before returning the search paths — e.g., gather candidate paths
into a collection, normalize them, remove duplicates (Set or equality check),
then iterate to call scanSkillsDir and build the final returned list; apply the
same dedupe logic to the other spots noted (the calls around the same block at
the other occurrences).

In `@packages/agent-management/src/utils/path.ts`:
- Around line 1-3: This shim duplicates the core path resolver and should be
collapsed: remove the local duplicate implementations in this module and instead
import and re-export the context-aware path utilities from the core package (use
the same exported API this file currently exposes so callers remain unchanged),
or directly delegate functions in this module to the core utilities; ensure
TypeScript types/signatures match the original exports and update any local
references to call the core implementation so the package uses the single
source-of-truth path resolver.

In `@packages/cli/src/utils/env.test.ts`:
- Around line 28-46: The getDextoGlobalPath mock duplicates the logic for
detecting execution context and can drift from the getExecutionContext mock;
modify getDextoGlobalPath to reuse or delegate to the same getExecutionContext
mock (or call the exported getExecutionContext function) to determine whether
context is 'dexto-source' or 'global-cli' rather than re-implementing the
package.json check, then compute homeRoot and basePath from that shared result
so both mocks stay aligned (refer to the getDextoGlobalPath and
getExecutionContext symbols to locate and change the logic).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6604f90 and e24aac4.

📒 Files selected for processing (36)
  • .claude/commands/dev-server.md
  • DEVELOPMENT.md
  • package.json
  • packages/agent-management/src/config/config-enrichment.ts
  • packages/agent-management/src/config/discover-prompts.test.ts
  • packages/agent-management/src/config/discover-prompts.ts
  • packages/agent-management/src/config/loader.ts
  • packages/agent-management/src/models/path-resolver.ts
  • packages/agent-management/src/plugins/discover-skills.test.ts
  • packages/agent-management/src/plugins/discover-skills.ts
  • packages/agent-management/src/plugins/marketplace/__tests__/registry.test.ts
  • packages/agent-management/src/plugins/marketplace/registry.ts
  • packages/agent-management/src/resolver.test.ts
  • packages/agent-management/src/resolver.ts
  • packages/agent-management/src/utils/dexto-auth.ts
  • packages/agent-management/src/utils/path.test.ts
  • packages/agent-management/src/utils/path.ts
  • packages/analytics/src/state.ts
  • packages/cli/CLI.md
  • packages/cli/src/cli/auth/dexto-api-key.ts
  • packages/cli/src/cli/auth/service.ts
  • packages/cli/src/cli/mcp/oauth-store.ts
  • packages/cli/src/cli/utils/api-key-setup.ts
  • packages/cli/src/cli/utils/package-mgmt.ts
  • packages/cli/src/cli/utils/setup-utils.test.ts
  • packages/cli/src/cli/utils/setup-utils.ts
  • packages/cli/src/index-main.ts
  • packages/cli/src/utils/env.test.ts
  • packages/cli/src/utils/env.ts
  • packages/core/src/llm/providers/local/ai-sdk-adapter.ts
  • packages/core/src/utils/path.test.ts
  • packages/core/src/utils/path.ts
  • packages/image-logger-agent/src/hooks/request-logger.ts
  • packages/tui/src/containers/OverlayContainer.tsx
  • packages/tui/src/utils/soundNotification.ts
  • scripts/dev-server.ts
💤 Files with no reviewable changes (2)
  • scripts/dev-server.ts
  • packages/cli/src/index-main.ts

Copy link
Copy Markdown

@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

🧹 Nitpick comments (2)
packages/cli/CLI.md (2)

160-160: Consider adding default path for user convenience.

For troubleshooting, mentioning the default location might help users locate their session files more quickly.

📝 Optional enhancement
-Sessions are stored in `.dexto/sessions/` under the resolved Dexto home
+Sessions are stored in `.dexto/sessions/` under the resolved Dexto home (`~/.dexto` by default)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/CLI.md` at line 160, Update the Sessions documentation line that
currently reads "Sessions are stored in `.dexto/sessions/` under the resolved
Dexto home" to include the default resolved Dexto home path for convenience
(e.g., expand to show the default like "~/.config/dexto/.dexto/sessions" or the
platform-specific defaults), so users can immediately locate session files; keep
the existing phrasing but append the default path example and note that it may
vary by OS.

171-176: Consider clarifying that DEXTO_HOME_DIR is the authoritative override.

The PR emphasizes DEXTO_HOME_DIR as the "highest-precedence override," but the comment only mentions "custom Dexto home for local testing." Adding a brief note about it overriding all other path resolution would align with the PR's design intent.

📝 Optional clarification
-# Use custom Dexto home for local testing
+# Override Dexto home directory (highest precedence)
 export DEXTO_HOME_DIR=/tmp/dexto
 dexto --mode cli

Or keep it user-friendly but mention the override behavior:

-# Use custom Dexto home for local testing
+# Use custom Dexto home for local testing (overrides default ~/.dexto)
 export DEXTO_HOME_DIR=/tmp/dexto
 dexto --mode cli
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/cli/CLI.md` around lines 171 - 176, Update the "Home Directory
Override" section and the example to state that the environment variable
DEXTO_HOME_DIR is the authoritative, highest-precedence override for Dexto's
home directory (it supersedes any other path resolution or config). In the "Home
Directory Override" header and the code snippet area, add a short sentence
clarifying that setting DEXTO_HOME_DIR will override all other home directory
settings so users understand its precedence.
🤖 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/agent-management/src/utils/path.ts`:
- Around line 89-96: Update the JSDoc return description for the function
documented by the comment with params (type, filename, startPath) to reflect
that it can return three kinds of absolute paths: the DEXTO_HOME_DIR/<type> when
DEXTO_HOME_DIR is set, the repo-local .dexto/<type> when running in source
context, or the global ~/.dexto/<type> otherwise; mention that filename is
appended when provided and that the returned value is an absolute path.

---

Nitpick comments:
In `@packages/cli/CLI.md`:
- Line 160: Update the Sessions documentation line that currently reads
"Sessions are stored in `.dexto/sessions/` under the resolved Dexto home" to
include the default resolved Dexto home path for convenience (e.g., expand to
show the default like "~/.config/dexto/.dexto/sessions" or the platform-specific
defaults), so users can immediately locate session files; keep the existing
phrasing but append the default path example and note that it may vary by OS.
- Around line 171-176: Update the "Home Directory Override" section and the
example to state that the environment variable DEXTO_HOME_DIR is the
authoritative, highest-precedence override for Dexto's home directory (it
supersedes any other path resolution or config). In the "Home Directory
Override" header and the code snippet area, add a short sentence clarifying that
setting DEXTO_HOME_DIR will override all other home directory settings so users
understand its precedence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 35714ee6-6e5d-4399-ab86-354a34218c54

📥 Commits

Reviewing files that changed from the base of the PR and between 03d7980 and 840cb66.

📒 Files selected for processing (6)
  • DEVELOPMENT.md
  • packages/agent-management/src/models/path-resolver.ts
  • packages/agent-management/src/utils/path.ts
  • packages/cli/CLI.md
  • packages/cli/src/cli/utils/setup-utils.ts
  • packages/tui/src/containers/OverlayContainer.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/tui/src/containers/OverlayContainer.tsx
  • packages/cli/src/cli/utils/setup-utils.ts
  • DEVELOPMENT.md

Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
packages/agent-management/src/utils/path.ts (1)

53-71: Avoid repeated root discovery after context detection.

getExecutionContext(startPath) already performs directory-walk checks, then each branch repeats root discovery. Consider resolving roots/context once per function and reusing the result to reduce repeated filesystem traversal and simplify control flow.

Also applies to: 105-107, 262-278

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

In `@packages/agent-management/src/utils/path.ts` around lines 53 - 71, The switch
uses getExecutionContext(startPath) but then calls findDextoSourceRoot/startPath
and findDextoProjectRoot/startPath again — remove the duplicated walks by
resolving the root once and reusing it: call getExecutionContext(startPath) and
then immediately compute the appropriate root variable (e.g., sourceRoot via
findDextoSourceRoot or projectRoot via findDextoProjectRoot) before the switch
(or compute both and pick the correct one), throw if missing, and then set
basePath = path.join(resolvedRoot, '.dexto', type); apply the same refactor to
the other similar blocks that use findDextoSourceRoot/findDextoProjectRoot (the
blocks referencing lines ~105-107 and ~262-278) so filesystem traversal happens
only once per function.
🤖 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/agent-management/src/utils/path.ts`:
- Around line 235-236: Update the JSDoc/comment for the function
ensureDextoGlobalDirectory to reflect that it ensures the resolved storage
directory (which may be source-local, DEXTO_HOME_DIR, or a global directory)
rather than implying it always creates a global storage directory; locate the
comment above the ensureDextoGlobalDirectory symbol and reword it to mention
"resolved storage directory" or "resolved Dexto storage directory" and that it
may be global or source-local depending on configuration.

---

Nitpick comments:
In `@packages/agent-management/src/utils/path.ts`:
- Around line 53-71: The switch uses getExecutionContext(startPath) but then
calls findDextoSourceRoot/startPath and findDextoProjectRoot/startPath again —
remove the duplicated walks by resolving the root once and reusing it: call
getExecutionContext(startPath) and then immediately compute the appropriate root
variable (e.g., sourceRoot via findDextoSourceRoot or projectRoot via
findDextoProjectRoot) before the switch (or compute both and pick the correct
one), throw if missing, and then set basePath = path.join(resolvedRoot,
'.dexto', type); apply the same refactor to the other similar blocks that use
findDextoSourceRoot/findDextoProjectRoot (the blocks referencing lines ~105-107
and ~262-278) so filesystem traversal happens only once per function.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8a1e21df-911e-40c7-8222-80005b7c52c9

📥 Commits

Reviewing files that changed from the base of the PR and between 840cb66 and 1bea44e.

📒 Files selected for processing (1)
  • packages/agent-management/src/utils/path.ts

@rahulkarajgikar
Copy link
Copy Markdown
Collaborator Author

Smoke pass completed after e40113de and this is ready for signoff from my side.

Checks run:

  • bash scripts/quality-checks.sh
    • build passed
    • OpenAPI docs passed
    • tests passed
    • lint passed
    • typecheck passed
  • Built CLI help smoke: node packages/cli/dist/index.js --help
  • Source-context path smoke from repo root:
    • getDextoPath('logs') -> <repo>/.dexto/logs
    • getDextoGlobalPath('agents') -> <repo>/.dexto/agents
    • getDextoEnvPath() -> <repo>/.env
    • resolveBundledScript('agents/agent-registry.json') resolved correctly
  • DEXTO_HOME_DIR override smoke with temp home /tmp/dexto-pr633-smoke:
    • getDextoPath('logs') -> /tmp/dexto-pr633-smoke/logs
    • getDextoGlobalPath('agents') -> /tmp/dexto-pr633-smoke/agents
    • getDextoEnvPath() -> /tmp/dexto-pr633-smoke/.env
    • loadAgentConfig() expanded ${{dexto.project_dir}}/plans -> /tmp/dexto-pr633-smoke/plans
  • Bundled agent install/resolve smoke under the same temp DEXTO_HOME_DIR:
    • installBundledAgent('coding-agent') installed to /tmp/dexto-pr633-smoke/agents/coding-agent/coding-agent.yml
    • resolveAgentPath('coding-agent', false) resolved the same path
    • node packages/cli/dist/index.js agents list saw the installed agent

Net: the new home-dir override, source-context defaults, bundled agent resolution, and config template expansion all behave correctly in the exercised flows.

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.

1 participant