11# Boxel CLI - Claude Code Integration
22
3+ ## GitHub Repository
4+
5+ ** Official repo:** https://github.com/cardstack/boxel-cli
6+
7+ ---
8+
39## How to Run Boxel Commands
410
511** IMPORTANT:** In this development repo, the ` boxel ` CLI is not globally installed. Always run commands using:
@@ -43,63 +49,51 @@ The skill contains comprehensive Boxel development guidance including CardDef/Fi
4349
4450## Onboarding Flow
4551
46- When you detect a new user (no ` .env ` file or first interaction ), guide them through setup:
52+ When you detect a new user (no profile configured ), guide them through setup:
4753
48- ### Step 1: Check Environment
54+ ### Step 1: Check Profile
4955``` bash
50- # Check if .env exists and has content
51- cat .env 2> /dev/null || echo " NOT_CONFIGURED"
52- ```
53-
54- ### Step 2: Prompt for Environment Choice
55- If not configured, ask:
56-
56+ npm run dev -- profile
5757```
58- Welcome to Boxel CLI! Let's get you set up.
5958
60- Which environment do you want to use?
59+ If no profile exists, run the interactive setup:
6160
62- 1. **Production** (app.boxel.ai) - Live Boxel
63- 2. **Staging** (realms-staging.stack.cards) - Development/testing
64-
65- You'll need your Boxel username and password (same as web login).
66-
67- Your username is your Boxel handle (e.g., `aallen90`, `ctse`). Find it in:
68- - **Account panel**: shown as `@username:stack.cards`
69- - **Workspace URLs**: `app.boxel.ai/username/workspace-name`
61+ ### Step 2: Add a Profile
62+ ``` bash
63+ npm run dev -- profile add
7064```
7165
72- ### Step 3: Create .env
73- Based on their choice:
66+ This launches an interactive wizard that:
67+ 1 . Asks for environment (Production or Staging)
68+ 2 . Asks for username and password
69+ 3 . Creates the profile in ` ~/.boxel-cli/profiles.json `
7470
75- ** Production:**
76- ``` env
77- MATRIX_URL=https://matrix.boxel.ai
78- MATRIX_USERNAME=<ask for username>
79- MATRIX_PASSWORD=<ask for password>
80- REALM_SERVER_URL=https://app.boxel.ai/
81- ```
71+ ** Non-interactive option:**
72+ ``` bash
73+ # Production
74+ npm run dev -- profile add -u @username:boxel.ai -p " password" -n " My Prod Account"
8275
83- ** Staging:**
84- ``` env
85- MATRIX_URL=https://matrix-staging.stack.cards
86- MATRIX_USERNAME=<ask for username>
87- MATRIX_PASSWORD=<ask for password>
88- REALM_SERVER_URL=https://realms-staging.stack.cards/
76+ # Staging
77+ npm run dev -- profile add -u @username:stack.cards -p " password" -n " My Staging Account"
8978```
9079
91- ### Step 4 : Verify & List Workspaces
80+ ### Step 3 : Verify & List Workspaces
9281``` bash
93- npm install
9482npm run dev -- list
9583```
9684
97- ### Step 5 : First Sync
85+ ### Step 4 : First Sync
9886Help them sync their first workspace:
9987``` bash
10088npm run dev -- sync @username/workspace ./workspace-name
10189```
10290
91+ ### Switching Between Profiles
92+ ``` bash
93+ npm run dev -- profile list # See all profiles (★ = active)
94+ npm run dev -- profile switch username # Switch by partial match
95+ ```
96+
10397---
10498
10599## Available Skills
@@ -145,7 +139,17 @@ boxel sync . --delete # Sync deletions both ways
145139boxel sync . --dry-run # Preview only
146140```
147141
148- ### Watch
142+ ### Track ⇆ (Local File Watching)
143+ ``` bash
144+ boxel track . # Track local edits, auto-checkpoint as you save
145+ boxel track . -d 5 -i 30 # 5s debounce, 30s min between checkpoints
146+ boxel track . -q # Quiet mode
147+ ```
148+
149+ ** Use track when:** Editing locally in IDE/VS Code. Creates checkpoints as you save files.
150+ ** Symbol:** ⇆ (horizontal arrows = local changes)
151+
152+ ### Watch ⇅ (Remote Server Watching)
149153``` bash
150154boxel watch # Watch all configured realms (from .boxel-workspaces.json)
151155boxel watch . # Watch single workspace
@@ -154,6 +158,14 @@ boxel watch . -i 5 -d 3 # Active: 5s interval, 3s debounce
154158boxel watch . -q # Quiet mode
155159```
156160
161+ ** Use watch when:** Others are editing in Boxel web UI. Pulls their changes and creates checkpoints.
162+ ** Symbol:** ⇅ (vertical arrows = remote server changes)
163+
164+ ### Stop
165+ ``` bash
166+ boxel stop # Stop all running watch (⇅) and track (⇆) processes
167+ ```
168+
157169** Multi-realm watching:** Useful when code lives in one realm and data in another. Each realm gets its own checkpoint tracking and debouncing.
158170
159171### Realms (Multi-Realm Configuration)
@@ -175,6 +187,7 @@ boxel history . # View checkpoints
175187boxel history . -r # Interactive restore
176188boxel history . -r 3 # Quick restore to #3
177189boxel history . -r abc123 # Restore by hash
190+ boxel history . -m " Message" # Create checkpoint with custom message
178191```
179192
180193### Skills
@@ -186,6 +199,23 @@ boxel skills --disable "Name" # Disable a skill
186199boxel skills --export ./project # Export as Claude commands
187200```
188201
202+ ### Profile (Authentication)
203+ ``` bash
204+ boxel profile # Show current active profile
205+ boxel profile list # List all saved profiles (★ = active)
206+ boxel profile add # Interactive wizard to add profile
207+ boxel profile add -u @user:boxel.ai -p pass -n " Name" # Non-interactive
208+ boxel profile switch < username> # Switch profile (partial match OK)
209+ boxel profile remove < profile-id> # Remove a profile
210+ boxel profile migrate # Migrate from old .env file
211+ ```
212+
213+ ** Profile IDs:** Use Matrix format ` @username:domain `
214+ - Production: ` @username:boxel.ai `
215+ - Staging: ` @username:stack.cards `
216+
217+ ** Storage:** Profiles stored in ` ~/.boxel-cli/profiles.json ` (permissions: 0600)
218+
189219### Other
190220``` bash
191221boxel list # List workspaces
@@ -373,8 +403,8 @@ Watch waits for changes to settle:
373403### 4. Checkpoint Classification
374404- ` [MAJOR] ` - New files, deleted files, .gts changes, >3 files
375405- ` [minor] ` - Small updates to existing .json files
376- - ` LOCAL ` (↑) - Changes you pushed
377- - ` SERVER ` (↓) - External changes from web UI
406+ - ` LOCAL ` ⇆ - Changes from local edits (track command)
407+ - ` SERVER ` ⇅ - External changes from web UI (watch command)
378408
379409---
380410
@@ -403,6 +433,65 @@ Commands accept:
403433
404434---
405435
436+ ## Understanding Boxel URLs (Card IDs)
437+
438+ When a user shares a URL like:
439+ ```
440+ https://app.boxel.ai/tribecaprep/employee-handbook/Document/d8341312-f3a0-442b-a2e5-49c5cdd84695
441+ ```
442+
443+ ** This is a Card ID, not a fetchable URL!**
444+
445+ ### How to Parse Boxel URLs
446+
447+ | URL Part | Meaning |
448+ | ----------| ---------|
449+ | ` app.boxel.ai ` | Production server |
450+ | ` tribecaprep ` | User/organization |
451+ | ` employee-handbook ` | Realm/workspace name |
452+ | ` Document/d8341312-... ` | Card type and instance path |
453+
454+ ### NEVER Use WebFetch on Boxel URLs
455+
456+ - Boxel realms are ** usually private** and require Matrix authentication
457+ - WebFetch will fail with 401/403 errors
458+ - The user is referencing content ** they expect you to have locally**
459+
460+ ### Finding the Local Copy
461+
462+ If the user references a Boxel URL, the file is likely already synced to the local workspace:
463+
464+ 1 . ** Parse the path** : ` Document/d8341312-f3a0-442b-a2e5-49c5cdd84695 ` → local path is ` Document/d8341312-f3a0-442b-a2e5-49c5cdd84695.json `
465+
466+ 2 . ** Search the workspace** :
467+ ``` bash
468+ # Find by card ID
469+ find . -name " d8341312-f3a0-442b-a2e5-49c5cdd84695*"
470+
471+ # Or search for the card type folder
472+ ls ./Document/
473+ ```
474+
475+ 3 . ** Read the local file** using the Read tool
476+
477+ ### Example Workflow
478+
479+ User says: "Check the handbook at https://app.boxel.ai/tribecaprep/employee-handbook/Document/abc123 "
480+
481+ ** Do this:**
482+ ```
483+ # Look for local file
484+ Read ./Document/abc123.json
485+ ```
486+
487+ ** NOT this:**
488+ ```
489+ # This will FAIL - private realm
490+ WebFetch https://app.boxel.ai/tribecaprep/employee-handbook/Document/abc123
491+ ```
492+
493+ ---
494+
406495## API Reference
407496
408497| Endpoint | Method | Purpose |
@@ -433,13 +522,15 @@ Headers:
433522## Troubleshooting
434523
435524### "Authentication failed"
436- - Check credentials in ` .env `
437- - Verify you can log into Boxel web
438- - For staging: use ` matrix-staging.stack.cards `
525+ - Check active profile: ` boxel profile `
526+ - Verify credentials: ` boxel profile list `
527+ - Verify you can log into Boxel web with same credentials
528+ - For staging: ensure profile uses ` @username:stack.cards `
439529
440530### "No workspace found"
441531- Run ` boxel list ` to see workspaces
442532- Use full URL for first sync
533+ - Ensure correct profile is active for the environment
443534
444535### Files keep reverting after restore
445536- Stop watch before restoring
@@ -448,4 +539,8 @@ Headers:
448539### Watch not detecting changes
449540- Check interval setting
450541- Verify server URL
451- - Check JWT auth
542+ - Check active profile: ` boxel profile `
543+
544+ ### Switching environments (prod/staging)
545+ - Add profiles for each environment
546+ - Switch with: ` boxel profile switch <username> `
0 commit comments