@openbuilder/cli 0.50.20 → 0.50.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,1053 +1,274 @@
1
1
  # OpenBuilder CLI
2
2
 
3
- The OpenBuilder CLI is a command-line tool for building AI-powered applications locally on your machine. It connects to the OpenBuilder server and uses Claude AI to generate and build projects in an isolated workspace.
3
+ The OpenBuilder CLI connects your local machine to [OpenBuilder](https://openbuilder.sh) to build AI-powered applications. It handles code generation, dev servers, and live previews - all running on your machine.
4
4
 
5
- ## Table of Contents
6
-
7
- - [Installation](#installation)
8
- - [Getting Started from Zero](#getting-started-from-zero)
9
- - [CLI Reference](#cli-reference)
10
- - [Configuration](#configuration)
11
- - [Architecture](#architecture)
12
- - [Development](#development)
13
- - [Troubleshooting](#troubleshooting)
14
-
15
- ## Installation
16
-
17
- ### Quick Install (Recommended)
18
-
19
- ```bash
20
- # Install via curl
21
- curl -fsSL https://openbuilder.sh/install | bash
22
-
23
- # Verify installation
24
- openbuilder --version
25
- ```
26
-
27
- This installs the OpenBuilder CLI globally on your machine.
28
-
29
- ### From Source (Development)
30
-
31
- ```bash
32
- # Clone the repository
33
- git clone <repo-url>
34
- cd openbuilder/apps/runner
35
-
36
- # Install dependencies
37
- pnpm install
38
-
39
- # Build the CLI
40
- pnpm run build
41
-
42
- # Link globally for testing
43
- npm link
44
-
45
- # Verify
46
- openbuilder-cli --version
47
- ```
48
-
49
- ## Getting Started from Zero
50
-
51
- ### Prerequisites
52
-
53
- Before you begin, ensure you have:
54
-
55
- 1. **Node.js 18 or higher** installed
56
- ```bash
57
- node --version # Should be 18.0.0 or higher
58
- ```
59
-
60
- 2. **npm or pnpm** package manager
61
- ```bash
62
- npm --version
63
- # or
64
- pnpm --version
65
- ```
66
-
67
- 3. **Git** installed (for template downloads)
68
- ```bash
69
- git --version
70
- ```
71
-
72
- 4. **A shared secret** from your OpenBuilder deployment
73
- - Get this from your Railway deployment environment variables
74
- - Or from your local `.env.local` if running locally
75
-
76
- ### Two Ways to Use OpenBuilder
77
-
78
- **Option A: Full Stack (Local Development)**
79
- - Runs web app, broker, and runner all locally
80
- - Perfect for development and testing
81
- - Command: `openbuilder run`
82
-
83
- **Option B: Runner Only (Production Use)**
84
- - Connects to remote broker (e.g., Railway)
85
- - Just executes builds on your machine
86
- - Command: `openbuilder --runner` or `openbuilder runner`
87
-
88
- ### Step-by-Step Setup (Runner Only Mode)
89
-
90
- #### 1. Install the CLI
91
-
92
- ```bash
93
- curl -fsSL https://openbuilder.sh/install | bash
94
- ```
95
-
96
- #### 2. Initialize Your Runner
97
-
98
- Run the interactive setup:
5
+ ## Quick Start
99
6
 
100
7
  ```bash
101
- openbuilder init
102
- ```
103
-
104
- You'll be asked:
105
-
106
- **Workspace Location:**
107
- ```
108
- ? Where should projects be stored?
109
- Default: ~/openbuilder-workspace
110
-
111
- This is where all generated projects will be saved.
112
- ```
8
+ # Run directly with npx (no install needed)
9
+ npx @openbuilder/cli runner
113
10
 
114
- **Broker URL:**
115
- ```
116
- ? Broker WebSocket URL:
117
- Default: ws://localhost:4000/socket
118
-
119
- For local development: Use default (localhost)
120
- For remote (Railway): wss://broker.up.railway.app/socket
121
- ```
122
-
123
- **Shared Secret:**
124
- ```
125
- ? Shared secret:
126
- Default: dev-secret
127
-
128
- For local development: Use default (dev-secret)
129
- For remote: Get from your Railway deployment environment variables
130
- ```
131
-
132
- **Runner ID:**
133
- ```
134
- ? Runner ID (identifier for this machine):
135
- Default: local
136
-
137
- For local development: Use default (local)
138
- For multiple runners: Use descriptive names like "macbook-pro"
139
- ```
140
-
141
- #### 3. Verify Configuration
142
-
143
- Check that everything is set up correctly:
144
-
145
- ```bash
146
- openbuilder-cli status
147
- ```
148
-
149
- You should see:
150
- ```
151
- OpenBuilder Runner Status
152
-
153
- ℹ Status: Initialized
154
-
155
- Config File:
156
- ~/Library/Application Support/openbuilder/config.json
157
-
158
- Workspace:
159
- Path: ~/openbuilder-workspace
160
- Exists: Yes
161
- Projects: 0
162
-
163
- Broker:
164
- URL: wss://broker.up.railway.app/socket
165
- Secret: Set
166
-
167
- Runner:
168
- ID: macbook-pro
169
- Reconnect Attempts: 5
170
- Heartbeat Interval: 15000ms
171
-
172
- Validation:
173
- ✓ Configuration is valid
174
-
175
- Ready to run! Use:
176
- openbuilder-cli run
177
- or just openbuilder-cli
178
- ```
179
-
180
- #### 4. Start the Runner
181
-
182
- **Runner only mode (connect to remote broker):**
183
-
184
- ```bash
185
- openbuilder --runner
186
- ```
187
-
188
- Or use the explicit command:
189
- ```bash
11
+ # Or install globally
12
+ npm install -g @openbuilder/cli
190
13
  openbuilder runner
191
14
  ```
192
15
 
193
- **Full stack mode (local development):**
16
+ That's it! The CLI will:
17
+ 1. Open your browser to authenticate (GitHub or Sentry SSO)
18
+ 2. Automatically generate and store your runner token
19
+ 3. Connect to openbuilder.sh and start listening for builds
194
20
 
195
- ```bash
196
- openbuilder run
197
- ```
21
+ ## Installation Options
198
22
 
199
- Or simply:
23
+ ### npx (Recommended)
24
+ No installation needed - always uses the latest version:
200
25
  ```bash
201
- openbuilder
202
- ```
203
-
204
- You should see (runner-only mode):
26
+ npx @openbuilder/cli runner
205
27
  ```
206
- Starting OpenBuilder Runner
207
-
208
- ℹ Broker: wss://broker.up.railway.app/socket
209
- ℹ Runner ID: macbook-pro
210
- ℹ Workspace: ~/openbuilder-workspace
211
28
 
212
- [runner] workspace root: /Users/yourname/openbuilder-workspace
213
- [runner] connected to broker wss://broker.up.railway.app/socket...
214
- ```
215
-
216
- Or (full stack mode):
217
- ```
218
- Starting OpenBuilder Full Stack
219
-
220
- ℹ Monorepo root: /Users/yourname/openbuilder
221
- ℹ Web app port: 3000
222
- ℹ Broker port: 4000
223
-
224
- ℹ Starting services...
225
-
226
- ℹ 1/3 Starting web app...
227
- ℹ 2/3 Starting broker...
228
- ℹ 3/3 Starting runner...
229
-
230
- ✔ All services started!
231
-
232
- Services running:
233
- Web App: http://localhost:3000
234
- Broker: http://localhost:4000
235
- Runner: Connected to broker
236
-
237
- Press Ctrl+C to stop all services
238
- ```
239
-
240
- #### 5. Create Your First Project
241
-
242
- 1. Open the OpenBuilder web app in your browser
243
- 2. Click "New Project"
244
- 3. Enter a prompt like:
245
- ```
246
- Create a React app with TypeScript and Tailwind CSS
247
- ```
248
- 4. Watch the runner execute the build in your terminal
249
- 5. Once complete, click "Start Dev Server" in the UI
250
- 6. Preview your project via the tunnel URL
251
-
252
- ### What Happens Behind the Scenes
253
-
254
- 1. **Template Download**: Runner clones the appropriate starter template
255
- 2. **AI Build**: Claude AI modifies the template based on your prompt
256
- 3. **Workspace Storage**: Project is saved to `~/openbuilder-workspace/project-name/`
257
- 4. **Dev Server**: Runner starts the dev server (e.g., `npm run dev`)
258
- 5. **Tunnel Creation**: Cloudflare tunnel exposes your local dev server
259
- 6. **Preview**: Web UI displays your project in an iframe
260
-
261
- ## CLI Reference
262
-
263
- ### Default Commands
264
-
265
- **Start full stack:**
29
+ ### Global Install
266
30
  ```bash
267
- openbuilder
268
- # or
269
- openbuilder run
270
- ```
271
-
272
- **Start runner only:**
273
- ```bash
274
- openbuilder --runner
275
- # or
31
+ npm install -g @openbuilder/cli
276
32
  openbuilder runner
277
33
  ```
278
34
 
279
- ### `openbuilder init`
280
-
281
- Initialize workspace and configuration.
282
-
283
- ```bash
284
- openbuilder init [options]
285
- ```
286
-
287
- **Options:**
288
- - `--workspace <path>` - Set workspace directory without prompts
289
- - `--broker <url>` - Set broker URL without prompts
290
- - `--secret <secret>` - Set shared secret without prompts
291
- - `--non-interactive` - Use all defaults (requires --secret)
292
-
293
- **Examples:**
294
-
295
- ```bash
296
- # Interactive mode (recommended)
297
- openbuilder init
298
-
299
- # Non-interactive with all options
300
- openbuilder init \
301
- --workspace ~/my-projects \
302
- --broker wss://broker.up.railway.app/socket \
303
- --secret my-secret-key \
304
- --non-interactive
305
-
306
- # Reset existing config
307
- openbuilder config reset
308
- openbuilder init
309
- ```
310
-
311
- ---
312
-
313
- ### `openbuilder run`
314
-
315
- Start the full stack (web app + broker + runner) locally.
316
-
317
- ```bash
318
- openbuilder run [options]
319
- openbuilder [options] # 'run' is the default command
320
- ```
321
-
322
- **Options:**
323
- - `-p, --port <port>` - Web app port (default: 3000)
324
- - `-b, --broker-port <port>` - Broker port (default: 4000)
325
-
326
- **Examples:**
327
-
328
- ```bash
329
- # Start full stack with defaults
330
- openbuilder run
331
-
332
- # Just use default (same as run)
333
- openbuilder
334
-
335
- # Custom ports
336
- openbuilder run --port 3001 --broker-port 4001
337
- ```
338
-
339
- **What starts:**
340
- 1. **Web App** - Next.js app on port 3000
341
- 2. **Broker** - WebSocket server on port 4000
342
- 3. **Runner** - Connects to local broker
343
-
344
- ---
345
-
346
- ### `openbuilder runner`
347
-
348
- Start runner only (connect to existing broker).
349
-
350
- ```bash
351
- openbuilder runner [options]
352
- openbuilder --runner # Alternative: use --runner flag
353
- ```
354
-
355
- **Options:**
356
- - `-b, --broker <url>` - Override broker WebSocket URL
357
- - `-w, --workspace <path>` - Override workspace directory
358
- - `-i, --runner-id <id>` - Override runner identifier
359
- - `-s, --secret <secret>` - Override shared secret
360
- - `-v, --verbose` - Enable verbose logging
361
-
362
- **Examples:**
363
-
35
+ ### Curl Install Script
364
36
  ```bash
365
- # Use saved configuration
37
+ curl -fsSL https://openbuilder.sh/install | bash
366
38
  openbuilder runner
367
-
368
- # Alternative syntax
369
- openbuilder --runner
370
-
371
- # Connect to local broker
372
- openbuilder runner --broker ws://localhost:4000/socket
373
-
374
- # Use custom workspace
375
- openbuilder runner --workspace ~/custom-projects
376
-
377
- # Override all settings
378
- openbuilder runner \
379
- --broker wss://broker.up.railway.app/socket \
380
- --workspace ~/dev-projects \
381
- --runner-id my-laptop \
382
- --secret production-secret \
383
- --verbose
384
39
  ```
385
40
 
386
- **Stopping the Runner:**
387
-
388
- Press `Ctrl+C` to gracefully shutdown. The runner will:
389
- 1. Close all active tunnels
390
- 2. Stop dev servers
391
- 3. Flush telemetry data
392
- 4. Close broker connection
41
+ ## Usage
393
42
 
394
- ---
395
-
396
- ### `openbuilder status`
397
-
398
- Show runner status and configuration.
43
+ ### Connect to OpenBuilder SaaS
399
44
 
400
45
  ```bash
401
- openbuilder status
402
- ```
403
-
404
- **Output includes:**
405
- - Initialization status
406
- - Config file location
407
- - Workspace path and project count
408
- - Broker connection details
409
- - Runner settings
410
- - Configuration validation
411
-
412
- ---
413
-
414
- ### `openbuilder config`
415
-
416
- Manage runner configuration.
417
-
418
- ```bash
419
- openbuilder config <action> [key] [value]
420
- ```
46
+ # Start the runner (auto-authenticates via browser)
47
+ npx @openbuilder/cli runner
421
48
 
422
- **Actions:**
423
-
424
- **`list`** - Show all configuration:
425
- ```bash
426
- openbuilder config list
427
- ```
428
-
429
- **`get <key>`** - Get specific value:
430
- ```bash
431
- openbuilder config get workspace
432
- openbuilder config get broker.url
433
- ```
434
-
435
- **`set <key> <value>`** - Update configuration:
436
- ```bash
437
- openbuilder config set workspace ~/new-workspace
438
- openbuilder config set runner.id my-laptop
439
- ```
440
-
441
- **`path`** - Show config file location:
442
- ```bash
443
- openbuilder config path
444
- ```
445
-
446
- **`validate`** - Validate configuration:
447
- ```bash
448
- openbuilder config validate
449
- ```
450
-
451
- **`reset`** - Reset to defaults (requires confirmation):
452
- ```bash
453
- openbuilder config reset
454
- ```
455
-
456
- ---
457
-
458
- ### `openbuilder cleanup`
459
-
460
- Clean up projects and resources.
461
-
462
- ```bash
463
- openbuilder cleanup [options]
49
+ # Or if installed globally
50
+ openbuilder runner
464
51
  ```
465
52
 
466
- **Options:**
467
- - `--project <slug>` - Delete specific project
468
- - `--all` - Delete all projects (requires confirmation)
469
- - `--tunnels` - Close all tunnels (runner must be running)
470
- - `--processes` - Kill all dev servers (runner must be running)
53
+ On first run, your browser will open for authentication. After logging in, the CLI automatically:
54
+ - Creates a secure runner token
55
+ - Stores it locally for future sessions
56
+ - Connects to openbuilder.sh
471
57
 
472
- **Examples:**
58
+ ### Interactive TUI Mode
473
59
 
474
60
  ```bash
475
- # Delete specific project
476
- openbuilder cleanup --project my-react-app
477
-
478
- # Delete all projects (with confirmation)
479
- openbuilder cleanup --all
480
-
481
- # Show cleanup help
482
- openbuilder cleanup
61
+ npx @openbuilder/cli
62
+ # or
63
+ openbuilder
483
64
  ```
484
65
 
485
- ---
66
+ This opens an interactive menu where you can:
67
+ - **Runner Mode** - Connect to openbuilder.sh (SaaS)
68
+ - **Local Mode** - Run everything locally (self-hosted)
486
69
 
487
- ### `openbuilder --help`
70
+ ### Local Mode (Self-Hosted)
488
71
 
489
- Show help for any command.
72
+ Run the entire OpenBuilder stack locally:
490
73
 
491
74
  ```bash
492
- openbuilder --help
493
- openbuilder init --help
494
- openbuilder run --help
495
- openbuilder runner --help
75
+ openbuilder run
496
76
  ```
497
77
 
498
- ---
78
+ This starts:
79
+ - Web App on `http://localhost:3000`
80
+ - Runner connected to local web app
499
81
 
500
- ### `openbuilder --version`
82
+ ## Keyboard Shortcuts
501
83
 
502
- Show CLI version.
84
+ When the runner is connected, use these shortcuts:
503
85
 
504
- ```bash
505
- openbuilder --version
506
- ```
86
+ | Key | Action |
87
+ |-----|--------|
88
+ | `b` | Open OpenBuilder in browser |
89
+ | `r` | Restart runner connection |
90
+ | `q` | Quit the runner |
507
91
 
508
92
  ## Configuration
509
93
 
510
- ### Config File Location
511
-
512
- Configuration is stored in a platform-specific location:
513
-
514
- **macOS:**
515
- ```
516
- ~/Library/Application Support/openbuilder/config.json
517
- ```
518
-
519
- **Linux:**
520
- ```
521
- ~/.config/openbuilder/config.json
522
- ```
523
-
524
- ### Config File Structure
525
-
526
- ```json
527
- {
528
- "version": "0.1.0",
529
- "workspace": "/Users/yourname/openbuilder-workspace",
530
- "broker": {
531
- "url": "wss://broker.up.railway.app/socket",
532
- "secret": "your-shared-secret"
533
- },
534
- "runner": {
535
- "id": "macbook-pro",
536
- "reconnectAttempts": 5,
537
- "heartbeatInterval": 15000
538
- },
539
- "tunnel": {
540
- "provider": "cloudflare",
541
- "autoCreate": true
542
- }
543
- }
544
- ```
545
-
546
- ### Configuration Priority
547
-
548
- Settings are resolved in this order (highest to lowest):
549
-
550
- 1. **Command-line flags** (`--broker`, `--workspace`, etc.)
551
- 2. **Config file** (`config.json`)
552
- 3. **Environment variables** (when running from source)
553
- 4. **Defaults**
554
-
555
- ### Workspace Directory
556
-
557
- The workspace directory stores all generated projects:
558
-
559
- ```
560
- ~/openbuilder-workspace/
561
- ├── react-todo-app/
562
- │ ├── package.json
563
- │ ├── src/
564
- │ └── ...
565
- ├── nextjs-blog/
566
- │ ├── package.json
567
- │ ├── app/
568
- │ └── ...
569
- └── vite-portfolio/
570
- ├── package.json
571
- ├── src/
572
- └── ...
573
- ```
574
-
575
- Each project is completely isolated with its own:
576
- - Dependencies (`node_modules/`)
577
- - Configuration files
578
- - Git history (initialized)
579
- - Dev server process
580
-
581
- ## Architecture
94
+ Configuration is stored at:
95
+ - **macOS**: `~/Library/Application Support/openbuilder/config.json`
96
+ - **Linux**: `~/.config/openbuilder/config.json`
582
97
 
583
- ### Component Overview
584
-
585
- ```
586
- ┌─────────────────────────────────────┐
587
- │ CLI Entry Point │
588
- │ (src/cli/index.ts) │
589
- └────────────┬────────────────────────┘
590
-
591
- ┌──────┴───────┐
592
- │ Commands │
593
- └──────┬───────┘
594
-
595
- ┌─────────┼─────────┐
596
- │ │ │
597
- ▼ ▼ ▼
598
- ┌──────┐ ┌──────┐ ┌──────┐
599
- │ init │ │ run │ │ ... │
600
- └───┬──┘ └───┬──┘ └──────┘
601
- │ │
602
- ▼ ▼
603
- ┌────────────────────┐
604
- │ Utilities │
605
- │ - Config Manager │
606
- │ - Logger │
607
- │ - Prompts │
608
- │ - Spinner │
609
- └────────────────────┘
610
-
611
-
612
- ┌────────────────────┐
613
- │ Runner Core │
614
- │ (src/index.ts) │
615
- │ - WebSocket │
616
- │ - Build Engine │
617
- │ - Process Manager │
618
- │ - Tunnel Manager │
619
- └────────────────────┘
620
- ```
621
-
622
- ### Key Components
623
-
624
- **CLI Layer** (`src/cli/`):
625
- - Commander.js-based command parser
626
- - Interactive prompts with Inquirer
627
- - Colored output with Chalk
628
- - Progress indicators with Ora
629
- - Configuration management with Conf
630
-
631
- **Runner Core** (`src/`):
632
- - WebSocket client for broker communication
633
- - Claude AI integration for builds
634
- - Dev server process management
635
- - Cloudflare tunnel creation
636
- - Project scoped file permissions
637
-
638
- **Libraries** (`src/lib/`):
639
- - `build/` - Build orchestration and streaming
640
- - `templates/` - Template download and selection
641
- - `tunnel/` - Tunnel management and auto-install
642
- - `permissions/` - Project-scoped permission handlers
643
- - `process-manager.ts` - Dev server lifecycle
644
-
645
- ### Message Flow
646
-
647
- ```
648
- Web UI → OpenBuilder API → Broker → Runner CLI
649
-
650
- 1. User submits prompt
651
- 2. API creates build command
652
- 3. Broker forwards via WebSocket
653
- 4. Runner executes build
654
- 5. Runner streams progress back
655
- 6. UI shows real-time updates
656
- ```
657
-
658
- ### Security Model
659
-
660
- The runner implements strict security controls:
661
-
662
- 1. **Project Isolation**: Each project confined to its directory
663
- 2. **Path Validation**: All file operations validated
664
- 3. **Permission Scoping**: Claude restricted to project directory only
665
- 4. **Secret Management**: Shared secret for authentication
666
- 5. **WebSocket TLS**: Encrypted communication (wss://)
667
-
668
- ## Development
669
-
670
- ### Setup Development Environment
98
+ ### View Configuration
671
99
 
672
100
  ```bash
673
- # Clone repository
674
- git clone <repo-url>
675
- cd openbuilder/apps/runner
676
-
677
- # Install dependencies
678
- pnpm install
679
-
680
- # Create environment file
681
- cp .env.example .env.local
682
- ```
683
-
684
- ### Development Workflow
685
-
686
- **Running in Development Mode:**
687
-
688
- ```bash
689
- # Start runner directly (no CLI)
690
- pnpm run dev
691
-
692
- # Test CLI in development
693
- pnpm run dev:cli init
694
- pnpm run dev:cli status
695
-
696
- # Test full stack mode
697
- pnpm run dev:cli run
698
-
699
- # Test runner-only mode
700
- pnpm run dev:cli runner
701
- ```
702
-
703
- **Building:**
704
-
705
- ```bash
706
- # Build TypeScript to JavaScript
707
- pnpm run build
708
-
709
- # Output goes to dist/
710
- ```
711
-
712
- **Testing CLI Locally:**
713
-
714
- ```bash
715
- # Build and link globally
716
- pnpm run build
717
- npm link
718
-
719
- # Now use anywhere
720
101
  openbuilder status
721
- openbuilder --help
722
- openbuilder --runner # Test runner mode
723
- openbuilder run # Test full stack mode
724
-
725
- # Unlink when done
726
- npm unlink -g @openbuilder/cli
727
- ```
728
-
729
- ### Project Structure
730
-
731
- ```
732
- apps/runner/
733
- ├── src/
734
- │ ├── cli/ # CLI implementation
735
- │ │ ├── index.ts # CLI entry point
736
- │ │ ├── commands/ # Command implementations
737
- │ │ │ ├── init.ts
738
- │ │ │ ├── run.ts
739
- │ │ │ ├── config.ts
740
- │ │ │ ├── status.ts
741
- │ │ │ └── cleanup.ts
742
- │ │ └── utils/ # CLI utilities
743
- │ │ ├── logger.ts
744
- │ │ ├── spinner.ts
745
- │ │ ├── prompts.ts
746
- │ │ └── config-manager.ts
747
- │ ├── lib/ # Runner core libraries
748
- │ │ ├── build/
749
- │ │ ├── templates/
750
- │ │ ├── tunnel/
751
- │ │ └── permissions/
752
- │ ├── shared/ # Shared types
753
- │ │ └── runner/
754
- │ │ └── messages.ts
755
- │ └── index.ts # Runner core
756
- ├── templates/ # Config templates
757
- │ └── config.template.json
758
- ├── dist/ # Build output
759
- ├── package.json
760
- ├── tsconfig.json
761
- └── README.md # This file
762
- ```
763
-
764
- ### Environment Variables (Development)
765
-
766
- Create `.env.local`:
767
-
768
- ```env
769
- # Runner Configuration
770
- RUNNER_ID=default
771
- RUNNER_WS_URL=ws://localhost:3000/ws/runner
772
- RUNNER_SHARED_SECRET=your-secret-here
773
- WORKSPACE_ROOT=/Users/yourname/openbuilder-workspace
774
- API_BASE_URL=http://localhost:3000
775
-
776
- # Sentry Configuration
777
- SENTRY_DSN=your-sentry-dsn
778
- SENTRY_AUTH_TOKEN=your-sentry-token
779
- ```
780
-
781
- ### Adding New Commands
782
-
783
- 1. Create command file in `src/cli/commands/`:
784
-
785
- ```typescript
786
- // src/cli/commands/mycommand.ts
787
- import { logger } from '../utils/logger.js';
788
-
789
- export async function myCommand(options: any) {
790
- logger.info('Executing my command...');
791
- // Implementation here
792
- }
102
+ openbuilder config list
793
103
  ```
794
104
 
795
- 2. Register in `src/cli/index.ts`:
796
-
797
- ```typescript
798
- program
799
- .command('mycommand')
800
- .description('My new command')
801
- .action(async (options) => {
802
- const { myCommand } = await import('./commands/mycommand.js');
803
- await myCommand(options);
804
- });
805
- ```
105
+ ### Change Workspace
806
106
 
807
- 3. Build and test:
107
+ Projects are stored in `~/openbuilder-projects/` by default:
808
108
 
809
109
  ```bash
810
- pnpm run build
811
- node dist/cli/index.js mycommand
110
+ openbuilder config set workspace ~/my-projects
812
111
  ```
813
112
 
814
- ### Testing
815
-
816
- ```bash
817
- # Run type checking
818
- pnpm run build
819
-
820
- # Test specific command
821
- node dist/cli/index.js status
822
- node dist/cli/index.js config list
823
-
824
- # Test with debugger
825
- node --inspect dist/cli/index.js run
826
- ```
113
+ ### CLI Options
827
114
 
828
- ### Publishing
115
+ Override settings via command-line:
829
116
 
830
117
  ```bash
831
- # Update version
832
- npm version patch # or minor, major
833
-
834
- # Build
835
- pnpm run build
836
-
837
- # Publish to npm
838
- npm publish --access public
839
-
840
- # Create git tag
841
- git tag v0.1.1
842
- git push origin v0.1.1
843
- ```
118
+ openbuilder runner \
119
+ --workspace ~/custom-projects \
120
+ --runner-id my-macbook
121
+ ```
122
+
123
+ ## Commands Reference
124
+
125
+ | Command | Description |
126
+ |---------|-------------|
127
+ | `openbuilder` | Launch interactive TUI |
128
+ | `openbuilder runner` | Connect to openbuilder.sh |
129
+ | `openbuilder run` | Start local mode (self-hosted) |
130
+ | `openbuilder login` | Authenticate with openbuilder.sh |
131
+ | `openbuilder logout` | Clear stored credentials |
132
+ | `openbuilder status` | Show runner status |
133
+ | `openbuilder config list` | View all settings |
134
+ | `openbuilder config set <key> <value>` | Update a setting |
135
+ | `openbuilder config reset` | Reset to defaults |
136
+ | `openbuilder cleanup --all` | Remove all projects |
137
+ | `openbuilder upgrade` | Upgrade to latest version |
138
+
139
+ ## How It Works
140
+
141
+ ```
142
+ ┌─────────────────────┐ ┌─────────────────┐
143
+ │ openbuilder.sh │◀──────▶│ Runner CLI │
144
+ │ (Web Interface) │ WSS │ (Your Machine) │
145
+ └─────────────────────┘ └────────┬────────┘
146
+
147
+
148
+ ┌─────────────────┐
149
+ │ AI Backend │
150
+ │ (Claude Code) │
151
+ └─────────────────┘
152
+ ```
153
+
154
+ 1. You create a project at openbuilder.sh
155
+ 2. The web app sends build commands to your runner via WebSocket
156
+ 3. Your runner executes the AI agent (Claude Code) locally
157
+ 4. Generated code is saved to your workspace
158
+ 5. Runner starts dev server and creates a Cloudflare tunnel for preview
159
+
160
+ ## Prerequisites
161
+
162
+ - **Node.js 18+** - [Download](https://nodejs.org/)
163
+ - **Claude CLI** - For AI code generation
164
+ ```bash
165
+ # Install Claude CLI
166
+ npm install -g @anthropic-ai/claude-cli
167
+ claude auth login
168
+ ```
844
169
 
845
170
  ## Troubleshooting
846
171
 
847
- ### Common Issues
172
+ ### "Runner not authenticated"
848
173
 
849
- #### "Runner not initialized"
850
-
851
- **Problem:** Running `openbuilder runner` before `init`.
852
-
853
- **Solution:**
174
+ The OAuth flow didn't complete. Try:
854
175
  ```bash
855
- openbuilder init
176
+ openbuilder login
856
177
  ```
857
178
 
858
- #### "Cannot connect to broker"
859
-
860
- **Problem:** Broker URL is incorrect or broker is down.
861
-
862
- **Solutions:**
863
- 1. Check broker URL:
864
- ```bash
865
- openbuilder config get broker.url
866
- ```
867
- 2. Test broker connectivity:
868
- ```bash
869
- curl https://broker.up.railway.app/status
870
- ```
871
- 3. Try local broker:
872
- ```bash
873
- openbuilder runner --broker ws://localhost:4000/socket
874
- ```
875
-
876
- #### "Shared secret is required"
179
+ ### "Cannot connect to server"
877
180
 
878
- **Problem:** Secret not set in config.
879
-
880
- **Solution:**
881
- ```bash
882
- openbuilder config set broker.secret your-secret-here
883
- # or
884
- openbuilder init # Re-run setup
885
- ```
886
-
887
- #### "Workspace directory does not exist"
888
-
889
- **Problem:** Workspace path is invalid or was deleted.
890
-
891
- **Solution:**
181
+ Check your internet connection and runner status:
892
182
  ```bash
893
- mkdir -p ~/openbuilder-workspace
894
- # or
895
- openbuilder config set workspace ~/new-workspace
183
+ openbuilder status
896
184
  ```
897
185
 
898
- #### Build fails with template errors
899
-
900
- **Problem:** Template download failed or git not installed.
186
+ ### Browser doesn't open for auth
901
187
 
902
- **Solutions:**
903
- 1. Verify git is installed:
904
- ```bash
905
- git --version
906
- ```
907
- 2. Check network connectivity
908
- 3. Clear and retry:
909
- ```bash
910
- openbuilder cleanup --project failed-project
911
- # Try build again in UI
912
- ```
913
-
914
- #### Tunnel creation fails
915
-
916
- **Problem:** Cloudflared binary not installed or port not ready.
917
-
918
- **Solutions:**
919
- 1. Runner auto-installs cloudflared, check logs
920
- 2. Verify port is listening:
921
- ```bash
922
- lsof -i :3000
923
- ```
924
- 3. Try manual tunnel:
925
- ```bash
926
- cloudflared tunnel --url localhost:3000
927
- ```
928
-
929
- #### Config corruption
930
-
931
- **Problem:** Config file is invalid JSON.
932
-
933
- **Solution:**
188
+ Manually visit the URL shown in the terminal, or:
934
189
  ```bash
935
- # Show config location
936
- openbuilder-cli config path
937
-
938
- # Reset and reconfigure
939
- openbuilder-cli config reset
940
- openbuilder-cli init
190
+ openbuilder login
941
191
  ```
942
192
 
943
- ### Debug Mode
944
-
945
- Enable verbose logging:
193
+ ### Projects not appearing
946
194
 
195
+ Ensure you're connected to the same account:
947
196
  ```bash
948
- openbuilder-cli run --verbose
197
+ openbuilder status # Shows connected account
949
198
  ```
950
199
 
951
- Or set environment variable:
200
+ ### Reset everything
952
201
 
953
202
  ```bash
954
- DEBUG=* openbuilder-cli run
203
+ openbuilder logout
204
+ openbuilder config reset
205
+ openbuilder cleanup --all
206
+ openbuilder runner # Re-authenticate
955
207
  ```
956
208
 
957
- ### Getting Help
958
-
959
- 1. Check status:
960
- ```bash
961
- openbuilder-cli status
962
- ```
963
-
964
- 2. Validate config:
965
- ```bash
966
- openbuilder-cli config validate
967
- ```
968
-
969
- 3. View logs:
970
- - Runner logs appear in terminal
971
- - Check Sentry dashboard for errors
972
-
973
- 4. Reset everything:
974
- ```bash
975
- openbuilder-cli config reset
976
- openbuilder-cli cleanup --all
977
- openbuilder-cli init
978
- ```
979
-
980
209
  ## FAQ
981
210
 
982
- **Q: Can I run multiple runners?**
983
- A: Yes! Each runner needs a unique `runner-id`. Set it during init or with:
984
- ```bash
985
- openbuilder runner --runner-id my-second-runner
986
- ```
211
+ **Q: Do I need an API key?**
212
+ A: No! Authentication is handled via OAuth (GitHub or Sentry SSO). The CLI automatically manages tokens.
987
213
 
988
214
  **Q: Where are my projects stored?**
989
- A: In your workspace directory. Check with:
990
- ```bash
991
- openbuilder config get workspace
992
- ```
215
+ A: In `~/openbuilder-projects/` by default. Check with `openbuilder config get workspace`.
993
216
 
994
- **Q: Can I change the workspace location?**
995
- A: Yes:
996
- ```bash
997
- openbuilder config set workspace ~/new-location
998
- ```
999
-
1000
- **Q: How do I update the CLI?**
1001
- A: Reinstall from npm:
217
+ **Q: Can I run multiple runners?**
218
+ A: Yes! Each runner gets a unique ID. Run on different machines or use `--runner-id`:
1002
219
  ```bash
1003
- npm update -g @openbuilder/cli
220
+ openbuilder runner --runner-id work-laptop
221
+ openbuilder runner --runner-id home-desktop
1004
222
  ```
1005
223
 
1006
224
  **Q: Does the runner need to stay running?**
1007
- A: Yes, while you're using the web UI. It executes builds and manages dev servers.
225
+ A: Yes, while you're using openbuilder.sh. It executes builds and serves previews.
1008
226
 
1009
- **Q: Can I run the runner in the background?**
1010
- A: Use a process manager like PM2:
1011
- ```bash
1012
- pm2 start openbuilder --name runner -- runner
1013
- pm2 logs runner
1014
- ```
227
+ **Q: Can I use a different AI model?**
228
+ A: Yes! Select your preferred Claude model using the `@model` tag in the web UI:
229
+ - `claude-haiku-4-5` (fast)
230
+ - `claude-sonnet-4-5` (balanced)
231
+ - `claude-opus-4-5` (most capable)
1015
232
 
1016
- **Q: How do I start just the runner vs full stack?**
1017
- A:
233
+ **Q: How do I update the CLI?**
234
+ A:
1018
235
  ```bash
1019
- # Full stack (web + broker + runner)
1020
- openbuilder run
236
+ # If using npx, it auto-updates
237
+ npx @openbuilder/cli runner
1021
238
 
1022
- # Runner only (connect to remote broker)
1023
- openbuilder --runner
239
+ # If installed globally
240
+ npm update -g @openbuilder/cli
1024
241
  # or
1025
- openbuilder runner
242
+ openbuilder upgrade
1026
243
  ```
1027
244
 
1028
245
  **Q: How do I uninstall?**
1029
246
  A:
1030
247
  ```bash
1031
- # Clean up projects
1032
248
  openbuilder cleanup --all
1033
-
1034
- # Uninstall CLI
1035
249
  npm uninstall -g @openbuilder/cli
1036
-
1037
- # Remove config (optional)
1038
- rm -rf ~/Library/Application\ Support/openbuilder
250
+ rm -rf ~/Library/Application\ Support/openbuilder # macOS
251
+ rm -rf ~/.config/openbuilder # Linux
1039
252
  ```
1040
253
 
1041
- ## Contributing
254
+ ## Development
255
+
256
+ See the main [OpenBuilder repository](https://github.com/codyde/openbuilder) for development instructions.
257
+
258
+ ```bash
259
+ # Clone and setup
260
+ git clone https://github.com/codyde/openbuilder.git
261
+ cd openbuilder
262
+ pnpm install
1042
263
 
1043
- Contributions are welcome! Please:
264
+ # Build the CLI
265
+ cd apps/runner
266
+ pnpm run build
1044
267
 
1045
- 1. Fork the repository
1046
- 2. Create a feature branch
1047
- 3. Make your changes
1048
- 4. Add tests if applicable
1049
- 5. Submit a pull request
268
+ # Test locally
269
+ node dist/cli/index.js runner
270
+ ```
1050
271
 
1051
272
  ## License
1052
273
 
1053
- [License info here]
274
+ MIT