@willjackson/claude-code-bridge 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/README.md +94 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -50,6 +50,7 @@ Claude Code Bridge connects a native macOS/Linux Claude Code instance with a Cla
50
50
  - **Environment auto-detection** for Docksal, DDEV, Lando, and Docker
51
51
  - **Context synchronization** with configurable file patterns
52
52
  - **Task delegation** with timeout handling
53
+ - **Remote file operations** - read, write, and delete files on connected peers
53
54
  - **Peer-to-peer mode** allowing bidirectional communication
54
55
  - **CLI and programmatic API** for flexible integration
55
56
 
@@ -127,6 +128,22 @@ claude-bridge start --port 8765 --connect ws://host.docker.internal:8766
127
128
 
128
129
  Once connected, either side can send context or delegate tasks to the other.
129
130
 
131
+ ### Scenario 4: Remote File Operations
132
+
133
+ Enable file operations on the remote to allow reading, writing, and deleting files:
134
+
135
+ **Terminal 1 (Mac - relay mode, no handlers):**
136
+ ```bash
137
+ claude-bridge start --port 8766
138
+ ```
139
+
140
+ **Terminal 2 (Container - with file handlers):**
141
+ ```bash
142
+ claude-bridge start --with-handlers --connect ws://host.docker.internal:8766
143
+ ```
144
+
145
+ Now you can read, write, and edit files on the remote container from your Mac.
146
+
130
147
  ## CLI Reference
131
148
 
132
149
  ### Global Options
@@ -154,6 +171,7 @@ Options:
154
171
  -c, --connect <url> URL to connect to on startup (e.g., ws://localhost:8765)
155
172
  -a, --auto Auto-detect environment and configure
156
173
  -d, --daemon Run in background
174
+ --with-handlers Enable file operations and task handling (read/write/delete files)
157
175
  ```
158
176
 
159
177
  **Examples:**
@@ -170,6 +188,9 @@ claude-bridge start --connect ws://192.168.1.100:8765
170
188
 
171
189
  # Start in daemon mode
172
190
  claude-bridge start --daemon
191
+
192
+ # Start with file operation handlers enabled
193
+ claude-bridge start --with-handlers --connect ws://host.docker.internal:8766
173
194
  ```
174
195
 
175
196
  #### `stop` - Stop the Running Bridge
@@ -483,6 +504,79 @@ bridge.onTaskReceived(async (task) => {
483
504
  });
484
505
  ```
485
506
 
507
+ ### Remote File Operations
508
+
509
+ When connected to a peer running with `--with-handlers`, you can perform file operations:
510
+
511
+ ```typescript
512
+ // Read a file from the remote peer
513
+ const readResult = await bridge.delegateTask({
514
+ id: 'read-1',
515
+ description: 'Read config file',
516
+ scope: 'execute',
517
+ data: {
518
+ action: 'read_file',
519
+ path: 'config/settings.json',
520
+ },
521
+ });
522
+
523
+ if (readResult.success) {
524
+ console.log('File content:', readResult.data.content);
525
+ }
526
+
527
+ // Write a file to the remote peer
528
+ const writeResult = await bridge.delegateTask({
529
+ id: 'write-1',
530
+ description: 'Create new file',
531
+ scope: 'execute',
532
+ data: {
533
+ action: 'write_file',
534
+ path: 'src/newfile.ts',
535
+ content: 'export const hello = "world";',
536
+ },
537
+ });
538
+
539
+ console.log('Bytes written:', writeResult.data.bytesWritten);
540
+
541
+ // Delete a file on the remote peer
542
+ const deleteResult = await bridge.delegateTask({
543
+ id: 'delete-1',
544
+ description: 'Remove temp file',
545
+ scope: 'execute',
546
+ data: {
547
+ action: 'delete_file',
548
+ path: 'temp/cache.json',
549
+ },
550
+ });
551
+
552
+ // Edit a file (read, modify, write back)
553
+ const file = await bridge.delegateTask({
554
+ id: 'edit-read',
555
+ description: 'Read file for editing',
556
+ scope: 'execute',
557
+ data: { action: 'read_file', path: 'README.md' },
558
+ });
559
+
560
+ const newContent = file.data.content.replace('old text', 'new text');
561
+
562
+ await bridge.delegateTask({
563
+ id: 'edit-write',
564
+ description: 'Write edited file',
565
+ scope: 'execute',
566
+ data: { action: 'write_file', path: 'README.md', content: newContent },
567
+ });
568
+ ```
569
+
570
+ **Available file operations:**
571
+
572
+ | Action | Data Fields | Description |
573
+ |--------|-------------|-------------|
574
+ | `read_file` | `path` | Read file content from remote |
575
+ | `write_file` | `path`, `content` | Create or overwrite a file |
576
+ | `delete_file` | `path` | Delete a file |
577
+
578
+ > **Security Note:** All file operations are restricted to the project directory where the bridge is running. Paths outside the project root are rejected.
579
+
486
580
  ### Environment Detection
487
581
 
488
582
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willjackson/claude-code-bridge",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Bidirectional communication system for Claude Code instances across environments",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",