Overview
The Dex CLI uses a workspace configuration system to manage multiple Git repositories and coordinate development across thesite and api repos. This configuration lives outside your project directories and persists across terminal sessions.
The workspace config is stored in
~/.config/dexdsl/workspaces.json (or %APPDATA%/dexdsl/workspaces.json on Windows).Configuration Structure
The workspace configuration is a JSON file with the following structure:Configuration Fields
Always
dex-workspaces-v1. Used for future schema migrations.Last modification timestamp. Automatically updated on writes.
Which repository to use when a command doesn’t specify
--repo.Map of repository keys to configuration objects. Each repo must have a
root property pointing to an absolute path.Environment Variables
You can override workspace behavior with environment variables:| Variable | Purpose | Example |
|---|---|---|
DEX_CONFIG_DIR | Custom config directory | ~/dex-config |
DEX_WORKSPACE_FILE | Direct path to workspace file | ~/my-workspace.json |
Setup and Validation
Initial Setup
Run the setup wizard to configure your workspace:- Prompt for the
siterepo path - Prompt for the
apirepo path - Validate that both paths are Git repositories
- Write the configuration to disk
- Display the active workspace context
Resetting Configuration
To reconfigure your workspace from scratch:Validation Rules
The workspace validator enforces:Git Repository Check
Each path must be a valid Git repository root (contains
.git or passes git rev-parse --is-inside-work-tree).Workspace Resolution
When you run a Dex command, the CLI resolves the active repository root:Example Resolution
Given this workspace config:dex init→ uses/home/user/dexdsl/sitedex init --repo api→ uses/home/user/dexdsl/apidex init --repo invalid→ falls back to/home/user/dexdsl/site
Source Code Reference
The workspace configuration system is implemented inscripts/lib/dex-workspace-config.mjs:
See
scripts/lib/dex-workspace-config.mjs for the complete implementation including normalization, validation, and platform-specific config path resolution.Troubleshooting
Config Not Found
If you see “workspace config not found”:Invalid Git Repository
If a path fails Git validation:- Verify the directory exists:
ls /path/to/repo - Check for
.gitdirectory:ls -la /path/to/repo/.git - Test Git:
git -C /path/to/repo status
Permission Issues
If you can’t write to the config directory:Best Practices
Single Source of Truth
Keep one workspace config per development machine. Don’t commit
workspaces.json to Git.Absolute Paths
Always use absolute paths or
~ for home directory. Relative paths will cause resolution issues.Validate After Clone
After cloning repos, run
dex setup --reset to update paths for the new machine.Team Consistency
Document expected repo structure in team README so everyone uses consistent naming.