claude-multi 0.3.0 → 0.4.1
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/CHANGELOG.md +39 -0
- package/README.md +7 -85
- package/development.md +602 -0
- package/dist/cli.js +748 -138
- package/package.json +3 -3
- package/bun.lock +0 -77
package/development.md
ADDED
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
# Development Guide
|
|
2
|
+
|
|
3
|
+
This document contains technical documentation for developers working on claude-multi.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Development Setup](#development-setup)
|
|
8
|
+
- [Building and Packaging](#building-and-packaging)
|
|
9
|
+
- [Architecture](#architecture)
|
|
10
|
+
- [How It Works](#how-it-works)
|
|
11
|
+
- [Project Structure](#project-structure)
|
|
12
|
+
- [Configuration](#configuration)
|
|
13
|
+
- [Testing](#testing)
|
|
14
|
+
- [Debugging](#debugging)
|
|
15
|
+
- [Contribution Guidelines](#contribution-guidelines)
|
|
16
|
+
- [CI/CD](#cicd)
|
|
17
|
+
|
|
18
|
+
## Development Setup
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
- Node.js >= 18
|
|
23
|
+
- Bun (for development and building)
|
|
24
|
+
- Git
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Clone the repository
|
|
30
|
+
git clone <repository-url>
|
|
31
|
+
cd claude-multi
|
|
32
|
+
|
|
33
|
+
# Install dependencies
|
|
34
|
+
bun install
|
|
35
|
+
|
|
36
|
+
# Build the project
|
|
37
|
+
bun run build
|
|
38
|
+
|
|
39
|
+
# Install globally for testing
|
|
40
|
+
npm link
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Development Workflow
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Run in dev mode (uses ts-node)
|
|
47
|
+
bun run dev
|
|
48
|
+
|
|
49
|
+
# Build TypeScript to JavaScript
|
|
50
|
+
bun run build
|
|
51
|
+
|
|
52
|
+
# Watch mode for development
|
|
53
|
+
bun run dev
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Testing Commands
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Test adding an instance
|
|
60
|
+
bun run dev add test --binary ./test-bin/claude-test
|
|
61
|
+
|
|
62
|
+
# List all instances
|
|
63
|
+
bun run dev list
|
|
64
|
+
|
|
65
|
+
# Remove an instance
|
|
66
|
+
bun run dev remove test --force
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Building and Packaging
|
|
70
|
+
|
|
71
|
+
### Build Process
|
|
72
|
+
|
|
73
|
+
The project uses TypeScript and Bun for building:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Full build
|
|
77
|
+
bun run build
|
|
78
|
+
|
|
79
|
+
# This compiles TypeScript to JavaScript in the dist/ directory
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Package Structure
|
|
83
|
+
|
|
84
|
+
The built package includes:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
dist/
|
|
88
|
+
├── cli.js # Main CLI entry point
|
|
89
|
+
├── config.js # Instance configuration management
|
|
90
|
+
├── wrapper.js # Wrapper script generation
|
|
91
|
+
├── version.js # Version checking
|
|
92
|
+
└── templates.js # Provider templates
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Publishing
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Update version in package.json
|
|
99
|
+
# Commit changes
|
|
100
|
+
git commit -am "Bump version to X.Y.Z"
|
|
101
|
+
git tag vX.Y.Z
|
|
102
|
+
|
|
103
|
+
# Publish to npm
|
|
104
|
+
npm publish
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The CI/CD pipeline automatically publishes to npm when version tags are pushed.
|
|
108
|
+
|
|
109
|
+
## Architecture
|
|
110
|
+
|
|
111
|
+
### Design Decisions
|
|
112
|
+
|
|
113
|
+
**Wrapper Script Approach**
|
|
114
|
+
|
|
115
|
+
claude-multi uses wrapper scripts to create isolated Claude Code instances. This approach was chosen because:
|
|
116
|
+
|
|
117
|
+
- ✅ Doesn't modify Anthropic's code (legal)
|
|
118
|
+
- ✅ Uses official Claude Code (no forking)
|
|
119
|
+
- ✅ Auto-syncs with upstream (no version tracking needed)
|
|
120
|
+
- ✅ Simple and maintainable
|
|
121
|
+
|
|
122
|
+
**Why Not Fork?**
|
|
123
|
+
|
|
124
|
+
Forking would require:
|
|
125
|
+
- Maintaining a separate codebase
|
|
126
|
+
- Merging upstream changes manually
|
|
127
|
+
- Tracking Claude Code versions
|
|
128
|
+
- Potential licensing complications
|
|
129
|
+
|
|
130
|
+
**Why Not Modify Config Files Directly?**
|
|
131
|
+
|
|
132
|
+
Direct modification would:
|
|
133
|
+
- Require complex config parsing and manipulation
|
|
134
|
+
- Be fragile across Claude Code updates
|
|
135
|
+
- Make it difficult to switch between providers
|
|
136
|
+
- Risk corrupting user configurations
|
|
137
|
+
|
|
138
|
+
### Component Architecture
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
┌─────────────────────────────────────────────────────────┐
|
|
142
|
+
│ CLI Interface │
|
|
143
|
+
│ (cli.ts) │
|
|
144
|
+
└────────────────────┬────────────────────────────────────┘
|
|
145
|
+
│
|
|
146
|
+
┌────────────┼────────────┬────────────────┐
|
|
147
|
+
│ │ │ │
|
|
148
|
+
▼ ▼ ▼ ▼
|
|
149
|
+
┌──────────────┐ ┌─────────┐ ┌──────────┐ ┌──────────────┐
|
|
150
|
+
│ Config │ │ Wrapper │ │ Templates│ │ Version │
|
|
151
|
+
│ Management │ │ Generator│ │ │ │ Checker │
|
|
152
|
+
│ (config.ts) │ │(wrapper.ts)│ │(templates.ts)│ │ (version.ts) │
|
|
153
|
+
└──────────────┘ └─────────┘ └──────────┘ └──────────────┘
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Key Components
|
|
157
|
+
|
|
158
|
+
**CLI Interface ([`cli.ts`](src/cli.ts))**
|
|
159
|
+
- Parses command-line arguments using Commander.js
|
|
160
|
+
- Routes commands to appropriate handlers
|
|
161
|
+
- Manages user interaction and prompts
|
|
162
|
+
|
|
163
|
+
**Config Management ([`config.ts`](src/config.ts))**
|
|
164
|
+
- Reads and writes instance metadata
|
|
165
|
+
- Manages `~/.claude-multi/config.json`
|
|
166
|
+
- Validates instance configurations
|
|
167
|
+
|
|
168
|
+
**Wrapper Generator ([`wrapper.ts`](src/wrapper.ts))**
|
|
169
|
+
- Creates wrapper scripts for each instance
|
|
170
|
+
- Handles platform-specific script formats (Unix/Windows)
|
|
171
|
+
- Sets `CLAUDE_CONFIG_DIR` environment variable
|
|
172
|
+
|
|
173
|
+
**Templates ([`templates.ts`](src/templates.ts))**
|
|
174
|
+
- Defines provider-specific configurations
|
|
175
|
+
- Handles API key prompts
|
|
176
|
+
- Generates initial settings.json
|
|
177
|
+
|
|
178
|
+
**Version Checker ([`version.ts`](src/version.ts))**
|
|
179
|
+
- Checks for Claude Code updates
|
|
180
|
+
- Manages version information
|
|
181
|
+
|
|
182
|
+
## How It Works
|
|
183
|
+
|
|
184
|
+
### Wrapper Script Mechanism
|
|
185
|
+
|
|
186
|
+
claude-multi creates wrapper scripts that set the `CLAUDE_CONFIG_DIR` environment variable before calling the original `claude` binary:
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
#!/usr/bin/env node
|
|
190
|
+
process.env.CLAUDE_CONFIG_DIR = "/Users/you/.claude-glm"
|
|
191
|
+
import("/usr/local/bin/claude")
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Instance Creation Flow
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
User runs: claude-multi add glm --provider glm --api-key "key"
|
|
198
|
+
│
|
|
199
|
+
▼
|
|
200
|
+
┌─────────────────────────────────────────────────────────┐
|
|
201
|
+
│ 1. Parse command arguments │
|
|
202
|
+
│ 2. Validate provider and API key │
|
|
203
|
+
│ 3. Create config directory (~/.claude-glm) │
|
|
204
|
+
│ 4. Apply provider template (settings.json) │
|
|
205
|
+
│ 5. Generate wrapper script (claude-glm) │
|
|
206
|
+
│ 6. Register instance in ~/.claude-multi/config.json │
|
|
207
|
+
│ 7. Mark wrapper as executable (Unix only) │
|
|
208
|
+
└─────────────────────────────────────────────────────────┘
|
|
209
|
+
│
|
|
210
|
+
▼
|
|
211
|
+
Instance ready: claude-glm
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Wrapper Script Execution
|
|
215
|
+
|
|
216
|
+
When a user runs `claude-glm`:
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
User runs: claude-glm --help
|
|
220
|
+
│
|
|
221
|
+
▼
|
|
222
|
+
┌─────────────────────────────────────────────────────────┐
|
|
223
|
+
│ 1. Wrapper script executes │
|
|
224
|
+
│ 2. Sets CLAUDE_CONFIG_DIR=~/.claude-glm │
|
|
225
|
+
│ 3. Invokes original claude binary │
|
|
226
|
+
│ 4. Claude Code reads config from ~/.claude-glm │
|
|
227
|
+
│ 5. Uses provider-specific settings (API, models, etc.) │
|
|
228
|
+
└─────────────────────────────────────────────────────────┘
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Platform Differences
|
|
232
|
+
|
|
233
|
+
**Unix/Linux/macOS:**
|
|
234
|
+
```javascript
|
|
235
|
+
#!/usr/bin/env node
|
|
236
|
+
process.env.CLAUDE_CONFIG_DIR = "/home/user/.claude-glm";
|
|
237
|
+
import("/usr/local/bin/claude");
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Windows:**
|
|
241
|
+
```batch
|
|
242
|
+
@echo off
|
|
243
|
+
set CLAUDE_CONFIG_DIR=C:\Users\user\.claude-glm
|
|
244
|
+
node "%~dp0claude-glm-wrapper.js" %*
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Project Structure
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
claude-multi/
|
|
251
|
+
├── src/
|
|
252
|
+
│ ├── cli.ts # Main CLI interface and command routing
|
|
253
|
+
│ ├── config.ts # Instance config management (read/write)
|
|
254
|
+
│ ├── wrapper.ts # Wrapper script generation
|
|
255
|
+
│ ├── templates.ts # Provider templates and configurations
|
|
256
|
+
│ └── version.ts # Version checking and updates
|
|
257
|
+
├── test/
|
|
258
|
+
│ └── wrapper.test.ts # Unit tests for wrapper generation
|
|
259
|
+
├── scripts/
|
|
260
|
+
│ └── check-version.ts # Version validation script
|
|
261
|
+
├── docs/
|
|
262
|
+
│ └── raw-plan.md # Detailed implementation plan
|
|
263
|
+
├── package.json # Project metadata and dependencies
|
|
264
|
+
├── tsconfig.json # TypeScript configuration
|
|
265
|
+
├── bun.lock # Bun lock file
|
|
266
|
+
├── .npmignore # Files to exclude from npm package
|
|
267
|
+
├── .gitignore # Files to exclude from git
|
|
268
|
+
├── README.md # Consumer-facing documentation
|
|
269
|
+
├── development.md # This file - developer documentation
|
|
270
|
+
├── CHANGELOG.md # Version history
|
|
271
|
+
└── ROADMAP.md # Future plans
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Configuration
|
|
275
|
+
|
|
276
|
+
### Instance Metadata
|
|
277
|
+
|
|
278
|
+
Instance metadata is stored in `~/.claude-multi/config.json`:
|
|
279
|
+
|
|
280
|
+
```json
|
|
281
|
+
{
|
|
282
|
+
"instances": [
|
|
283
|
+
{
|
|
284
|
+
"name": "glm",
|
|
285
|
+
"configDir": "/Users/you/.claude-glm",
|
|
286
|
+
"binaryPath": "/usr/local/bin/claude-glm",
|
|
287
|
+
"createdAt": "2025-11-02T03:57:41.000Z"
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"version": "1.0.0"
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### Instance Config Directory
|
|
295
|
+
|
|
296
|
+
Each instance has its own config directory:
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
~/.claude-{name}/
|
|
300
|
+
├── settings.json # Claude Code settings
|
|
301
|
+
├── CLAUDE.md # Custom instructions
|
|
302
|
+
├── plugins/ # Installed plugins
|
|
303
|
+
├── history/ # Conversation history
|
|
304
|
+
└── debug.log # Debug logs
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### Provider Template Configuration
|
|
308
|
+
|
|
309
|
+
Provider templates define default settings:
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
interface ProviderTemplate {
|
|
313
|
+
name: string;
|
|
314
|
+
displayName: string;
|
|
315
|
+
apiEndpoint: string;
|
|
316
|
+
models: string[];
|
|
317
|
+
settings: Record<string, any>;
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Example GLM template:
|
|
322
|
+
|
|
323
|
+
```typescript
|
|
324
|
+
{
|
|
325
|
+
name: "glm",
|
|
326
|
+
displayName: "GLM (智谱AI)",
|
|
327
|
+
apiEndpoint: "https://api.z.ai/v1",
|
|
328
|
+
models: ["glm-4.5-air", "glm-4.6"],
|
|
329
|
+
settings: {
|
|
330
|
+
"apiProvider": "custom",
|
|
331
|
+
"customApiEndpoint": "https://api.z.ai/v1",
|
|
332
|
+
"model": "glm-4.6"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Testing
|
|
338
|
+
|
|
339
|
+
### Running Tests
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
# Run all tests
|
|
343
|
+
bun test
|
|
344
|
+
|
|
345
|
+
# Run specific test file
|
|
346
|
+
bun test test/wrapper.test.ts
|
|
347
|
+
|
|
348
|
+
# Run tests in watch mode
|
|
349
|
+
bun test --watch
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Test Structure
|
|
353
|
+
|
|
354
|
+
Tests are located in the `test/` directory:
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
// test/wrapper.test.ts
|
|
358
|
+
import { describe, it, expect } from 'bun:test';
|
|
359
|
+
import { generateWrapper } from '../src/wrapper';
|
|
360
|
+
|
|
361
|
+
describe('Wrapper Generation', () => {
|
|
362
|
+
it('should generate Unix wrapper script', () => {
|
|
363
|
+
const wrapper = generateWrapper('glm', '/home/user/.claude-glm', '/usr/local/bin/claude');
|
|
364
|
+
expect(wrapper).toContain('#!/usr/bin/env node');
|
|
365
|
+
expect(wrapper).toContain('process.env.CLAUDE_CONFIG_DIR');
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
it('should generate Windows batch file', () => {
|
|
369
|
+
const wrapper = generateWrapper('glm', 'C:\\Users\\user\\.claude-glm', 'C:\\npm\\claude.cmd');
|
|
370
|
+
expect(wrapper).toContain('@echo off');
|
|
371
|
+
expect(wrapper).toContain('set CLAUDE_CONFIG_DIR');
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Manual Testing
|
|
377
|
+
|
|
378
|
+
Test the CLI manually:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# Add instance
|
|
382
|
+
bun run dev add test --binary ./test-bin/claude-test
|
|
383
|
+
|
|
384
|
+
# List instances
|
|
385
|
+
bun run dev list
|
|
386
|
+
|
|
387
|
+
# Get instance info
|
|
388
|
+
bun run dev info test
|
|
389
|
+
|
|
390
|
+
# Remove instance
|
|
391
|
+
bun run dev remove test --force
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Debugging
|
|
395
|
+
|
|
396
|
+
### Enable Debug Logging
|
|
397
|
+
|
|
398
|
+
Set the `DEBUG` environment variable:
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
DEBUG=claude-multi:* bun run dev add test
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
### Common Issues
|
|
405
|
+
|
|
406
|
+
**Instance not found:**
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
# Check if instance exists
|
|
410
|
+
claude-multi list
|
|
411
|
+
|
|
412
|
+
# Check config file
|
|
413
|
+
cat ~/.claude-multi/config.json
|
|
414
|
+
|
|
415
|
+
# Verify wrapper exists
|
|
416
|
+
ls -la /usr/local/bin/claude-{name}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Wrapper not executable:**
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# On Unix/Linux/macOS
|
|
423
|
+
chmod +x /usr/local/bin/claude-{name}
|
|
424
|
+
|
|
425
|
+
# Or recreate the instance
|
|
426
|
+
claude-multi remove {name} --force
|
|
427
|
+
claude-multi add {name}
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Config directory issues:**
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Check config directory
|
|
434
|
+
ls -la ~/.claude-{name}
|
|
435
|
+
|
|
436
|
+
# Check settings.json
|
|
437
|
+
cat ~/.claude-{name}/settings.json
|
|
438
|
+
|
|
439
|
+
# Verify permissions
|
|
440
|
+
ls -ld ~/.claude-{name}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Provider template not working:**
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Check if provider is supported
|
|
447
|
+
claude-multi add test --provider invalid
|
|
448
|
+
|
|
449
|
+
# Verify API key format
|
|
450
|
+
claude-multi add test --provider glm --api-key "sk-..."
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
### Debug Commands
|
|
454
|
+
|
|
455
|
+
```bash
|
|
456
|
+
# Show instance details
|
|
457
|
+
claude-multi info {name}
|
|
458
|
+
|
|
459
|
+
# Check Claude Code version
|
|
460
|
+
claude-multi version
|
|
461
|
+
|
|
462
|
+
# Update Claude Code
|
|
463
|
+
claude-multi update
|
|
464
|
+
|
|
465
|
+
# List all instances with details
|
|
466
|
+
cat ~/.claude-multi/config.json | jq '.instances[]'
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
## Contribution Guidelines
|
|
470
|
+
|
|
471
|
+
### Getting Started
|
|
472
|
+
|
|
473
|
+
1. Fork the repository
|
|
474
|
+
2. Create a feature branch: `git checkout -b feature/my-feature`
|
|
475
|
+
3. Make your changes
|
|
476
|
+
4. Write tests for new functionality
|
|
477
|
+
5. Ensure all tests pass: `bun test`
|
|
478
|
+
6. Build the project: `bun run build`
|
|
479
|
+
7. Commit your changes: `git commit -am 'Add new feature'`
|
|
480
|
+
8. Push to the branch: `git push origin feature/my-feature`
|
|
481
|
+
9. Submit a pull request
|
|
482
|
+
|
|
483
|
+
### Code Style
|
|
484
|
+
|
|
485
|
+
- Use TypeScript for all new code
|
|
486
|
+
- Follow existing code formatting
|
|
487
|
+
- Add JSDoc comments for public functions
|
|
488
|
+
- Write descriptive commit messages
|
|
489
|
+
- Include tests for new features
|
|
490
|
+
|
|
491
|
+
### Adding New Provider Templates
|
|
492
|
+
|
|
493
|
+
To add a new provider template:
|
|
494
|
+
|
|
495
|
+
1. Edit [`src/templates.ts`](src/templates.ts)
|
|
496
|
+
2. Add provider configuration:
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
{
|
|
500
|
+
name: "newprovider",
|
|
501
|
+
displayName: "New Provider",
|
|
502
|
+
apiEndpoint: "https://api.newprovider.com/v1",
|
|
503
|
+
models: ["model-1", "model-2"],
|
|
504
|
+
settings: {
|
|
505
|
+
"apiProvider": "custom",
|
|
506
|
+
"customApiEndpoint": "https://api.newprovider.com/v1",
|
|
507
|
+
"model": "model-1"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
3. Update documentation in [`README.md`](README.md)
|
|
513
|
+
4. Add tests for the new template
|
|
514
|
+
5. Submit a pull request
|
|
515
|
+
|
|
516
|
+
### Adding New CLI Commands
|
|
517
|
+
|
|
518
|
+
To add a new CLI command:
|
|
519
|
+
|
|
520
|
+
1. Edit [`src/cli.ts`](src/cli.ts)
|
|
521
|
+
2. Add command definition:
|
|
522
|
+
|
|
523
|
+
```typescript
|
|
524
|
+
program
|
|
525
|
+
.command('newcommand [name]')
|
|
526
|
+
.description('Description of the new command')
|
|
527
|
+
.option('--option', 'Option description')
|
|
528
|
+
.action((name, options) => {
|
|
529
|
+
// Command logic here
|
|
530
|
+
});
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
3. Implement the command logic
|
|
534
|
+
4. Add tests
|
|
535
|
+
5. Update documentation
|
|
536
|
+
6. Submit a pull request
|
|
537
|
+
|
|
538
|
+
### Reporting Issues
|
|
539
|
+
|
|
540
|
+
When reporting issues, please include:
|
|
541
|
+
|
|
542
|
+
- Operating system and version
|
|
543
|
+
- Node.js version
|
|
544
|
+
- claude-multi version
|
|
545
|
+
- Steps to reproduce
|
|
546
|
+
- Expected behavior
|
|
547
|
+
- Actual behavior
|
|
548
|
+
- Error messages or logs
|
|
549
|
+
|
|
550
|
+
## CI/CD
|
|
551
|
+
|
|
552
|
+
### Continuous Integration
|
|
553
|
+
|
|
554
|
+
CI runs on all pull requests and pushes to the master branch:
|
|
555
|
+
|
|
556
|
+
- **Node Version**: 20.x
|
|
557
|
+
- **Tests**: All tests must pass
|
|
558
|
+
- **Build**: Project must build successfully
|
|
559
|
+
- **Linting**: Code must pass linting rules
|
|
560
|
+
|
|
561
|
+
### Publishing
|
|
562
|
+
|
|
563
|
+
The project automatically publishes to npm when version tags are pushed:
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
# Create and push version tag
|
|
567
|
+
git tag vX.Y.Z
|
|
568
|
+
git push origin vX.Y.Z
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
**Requirements:**
|
|
572
|
+
- `NPM_TOKEN` secret must be configured in GitHub
|
|
573
|
+
- Version in `package.json` must match the tag
|
|
574
|
+
- All CI checks must pass
|
|
575
|
+
|
|
576
|
+
### Release Process
|
|
577
|
+
|
|
578
|
+
1. Update version in [`package.json`](package.json)
|
|
579
|
+
2. Update [`CHANGELOG.md`](CHANGELOG.md)
|
|
580
|
+
3. Commit changes: `git commit -am "Bump version to X.Y.Z"`
|
|
581
|
+
4. Create tag: `git tag vX.Y.Z`
|
|
582
|
+
5. Push tag: `git push origin vX.Y.Z`
|
|
583
|
+
6. CI/CD automatically publishes to npm
|
|
584
|
+
|
|
585
|
+
### Workflow
|
|
586
|
+
|
|
587
|
+
```
|
|
588
|
+
Pull Request → CI Tests → Code Review → Merge to Master
|
|
589
|
+
│
|
|
590
|
+
▼
|
|
591
|
+
Version Tag Push
|
|
592
|
+
│
|
|
593
|
+
▼
|
|
594
|
+
Auto-publish to npm
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
## Additional Resources
|
|
598
|
+
|
|
599
|
+
- [Claude Code Documentation](https://docs.anthropic.com/claude-code)
|
|
600
|
+
- [Bun Documentation](https://bun.sh/docs)
|
|
601
|
+
- [Commander.js Documentation](https://github.com/tj/commander.js)
|
|
602
|
+
- [TypeScript Documentation](https://www.typescriptlang.org/docs)
|