claude-multi 0.2.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 CHANGED
@@ -5,6 +5,60 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.1] - 2025-01-26
9
+
10
+ ### Added
11
+ - **Test Suite**: Comprehensive sandboxing tests for auto-sync functionality
12
+ - 46 tests covering syncPluginsAndSkills, unsyncPluginsAndSkills, copySettingsFromDefault, and copyAllFromDefault
13
+ - Real file system operations in temporary directories with complete isolation
14
+ - AutoSyncTestHelper class for test utilities and assertions
15
+ - Test helper functions to override default Claude directory for testing
16
+ - Integration tests for sync/unsync cycles and auto-sync toggle
17
+
18
+ ### Fixed
19
+ - macOS compatibility: Fixed rmSync usage to properly handle both symlinks and directories
20
+ - Security: copySettingsFromDefault now uses whitelist approach to only copy safe settings (exclude sensitive data like env and mcpServers)
21
+
22
+ [0.4.1]: https://github.com/hmziqrs/claude-multi/compare/v0.4.0...v0.4.1
23
+
24
+ ## [0.4.0] - 2025-01-26
25
+
26
+ ### Added
27
+ - **Auto-Sync for Plugins and Skills**: Share plugins/skills across instances via symlinks
28
+ - New `--auto-sync` and `--manual` flags for `add` command
29
+ - Auto-sync enabled by default when copying all files
30
+ - `auto-sync <name> <on|off>` command to toggle for existing instances
31
+ - Interactive mode option to toggle auto-sync setting
32
+ - Instance info/list now display auto-sync status
33
+ - **Bun Runtime Support**: Migrated from npm/node to Bun
34
+ - All npm commands replaced with bun equivalents
35
+ - Build target changed from node to bun
36
+ - Shebangs updated to use bun instead of node
37
+ - Windows binary path changed to `%LOCALAPPDATA%\bun\bin`
38
+
39
+ ### Changed
40
+ - Plugins and skills directories now use symlinks by default (auto-sync mode)
41
+ - When auto-sync is enabled, plugins/skills are symlinked from `~/.claude`
42
+ - When auto-sync is disabled, files are copied to instance config directory
43
+
44
+ ### Fixed
45
+ - Removed unused code and improved error handling
46
+
47
+ ## [0.3.0] - 2025-01-XX
48
+
49
+ ### Added
50
+ - **Provider Templates**: Built-in templates for popular AI providers
51
+ - GLM (智谱AI) template with GLM-4.5-air and GLM-4.6 models
52
+ - MiniMax template with MiniMax-M2 model
53
+ - Interactive provider selection with secure API key prompt
54
+ - CLI flags: `--provider <name>` and `--api-key <key>`
55
+ - Auto-configuration of base URLs, model mappings, and optimal settings
56
+ - **Quick Start Guide**: Added quick start section with provider template examples
57
+
58
+ ### Changed
59
+ - Interactive mode now prompts for provider templates before config copying
60
+ - Enhanced instance creation flow with provider-first approach
61
+
8
62
  ## [0.2.0] - 2025-01-XX
9
63
 
10
64
  ### Added
@@ -45,5 +99,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
45
99
  - Support for custom config and binary paths
46
100
  - Command-line interface built with Commander.js
47
101
 
102
+ [0.3.0]: https://github.com/hmziqrs/claude-multi/compare/v0.2.0...v0.3.0
48
103
  [0.2.0]: https://github.com/hmziqrs/claude-multi/compare/v0.1.0...v0.2.0
49
104
  [0.1.0]: https://github.com/hmziqrs/claude-multi/releases/tag/v0.1.0
package/README.md CHANGED
@@ -11,20 +11,36 @@ Claude Code supports multiple AI providers (Anthropic, GLM, Minimax), but switch
11
11
  - 🔄 **Multiple Instances**: Run different Claude Code configs simultaneously
12
12
  - 🎯 **Simple CLI**: Easy-to-use commands for managing instances
13
13
  - 🔒 **Isolated Configs**: Each instance has its own settings and history
14
+ - 🎨 **Provider Templates**: Built-in templates for GLM, MiniMax, and more
14
15
  - ✅ **Legal**: Uses wrapper scripts, no code modification
15
16
  - 🚀 **Auto-sync**: Always uses the latest official Claude Code
16
17
 
17
18
  ## Installation
18
19
 
19
20
  ```bash
20
- # Install dependencies
21
- bun install
21
+ npm install -g claude-multi
22
+ ```
23
+
24
+ ## Quick Start
22
25
 
23
- # Build the project
24
- bun run build
26
+ Get started with a provider template in 30 seconds:
25
27
 
26
- # Install globally (optional)
27
- npm link
28
+ ```bash
29
+ # Create a GLM instance
30
+ claude-multi add glm --provider glm --api-key "your-glm-api-key"
31
+
32
+ # Use it!
33
+ claude-glm --help
34
+ ```
35
+
36
+ **Or use interactive mode:**
37
+
38
+ ```bash
39
+ claude-multi add myinstance
40
+ # Choose "Yes" when asked about provider templates
41
+ # Select GLM or MiniMax
42
+ # Enter your API key
43
+ # Done!
28
44
  ```
29
45
 
30
46
  ### Windows Setup
@@ -46,9 +62,13 @@ After adding to PATH, restart your terminal for changes to take effect.
46
62
  ### Create instances
47
63
 
48
64
  ```bash
49
- # Create instance (interactive - prompts for copying settings)
65
+ # Create instance (interactive - prompts for provider templates and copying settings)
50
66
  claude-multi add glm
51
67
 
68
+ # Create instance with provider template (CLI mode)
69
+ claude-multi add glm --provider glm --api-key "your-api-key-here"
70
+ claude-multi add minimax --provider minimax --api-key "your-api-key-here"
71
+
52
72
  # Create instance with custom config path
53
73
  claude-multi add work --config ~/configs/claude-work
54
74
 
@@ -61,11 +81,18 @@ claude-multi add glm --copy-all # Copy all files (settings, CLAUDE.md,
61
81
  claude-multi add glm --skip-prompts # Start fresh, no prompts
62
82
  ```
63
83
 
84
+ **Provider Templates:**
85
+ - **GLM (智谱AI)**: GLM-4.5-air and GLM-4.6 models via z.ai
86
+ - **MiniMax**: MiniMax-M2 model via minimax.io
87
+
64
88
  **Interactive prompt options:**
89
+ - **Provider templates**: Choose GLM, MiniMax, or None/Custom
65
90
  - **Nothing - start fresh**: Empty config directory
66
91
  - **Only settings.json**: Copy your settings (API keys, preferences)
67
92
  - **All files**: Copy settings, CLAUDE.md, plugins, etc. (excludes history, debug logs)
68
93
 
94
+ When using a provider template, you'll be prompted to enter your API key securely.
95
+
69
96
  ### Use instances
70
97
 
71
98
  Each instance gets its own command:
@@ -103,22 +130,6 @@ claude-multi version
103
130
  claude-multi update
104
131
  ```
105
132
 
106
- ## How It Works
107
-
108
- `claude-multi` creates wrapper scripts that set the `CLAUDE_CONFIG_DIR` environment variable before calling the original `claude` binary:
109
-
110
- ```javascript
111
- #!/usr/bin/env node
112
- process.env.CLAUDE_CONFIG_DIR = "/Users/you/.claude-glm"
113
- import("/usr/local/bin/claude")
114
- ```
115
-
116
- This approach:
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
133
  ## Use Cases
123
134
 
124
135
  ### Personal + Work
@@ -130,13 +141,20 @@ claude-personal # Personal projects
130
141
  claude-work # Work projects
131
142
  ```
132
143
 
133
- ### Paid + Free Providers
144
+ ### Different AI Providers
134
145
  ```bash
135
- claude-multi add anthropic # Paid subscription
136
- claude-multi add glm # Free GLM API
137
-
138
- claude-anthropic # High-quality, paid
139
- claude-glm # Free tier
146
+ # Interactive mode with provider template
147
+ claude-multi add anthropic # Use Anthropic (prompted for API key)
148
+ claude-multi add glm # Use GLM template (prompted for API key)
149
+ claude-multi add minimax # Use MiniMax template (prompted for API key)
150
+
151
+ # CLI mode with provider template
152
+ claude-multi add glm --provider glm --api-key "sk-..."
153
+ claude-multi add minimax --provider minimax --api-key "sk-..."
154
+
155
+ claude-anthropic # Uses Anthropic Claude
156
+ claude-glm # Uses GLM-4.6
157
+ claude-minimax # Uses MiniMax-M2
140
158
  ```
141
159
 
142
160
  ### Multiple Environments
@@ -148,28 +166,32 @@ claude-multi add dev
148
166
  # Different configs for each
149
167
  ```
150
168
 
151
- ## Development
169
+ ## Provider Templates
152
170
 
153
- ```bash
154
- # Install dependencies
155
- bun install
171
+ Built-in templates for popular AI providers. Each template auto-configures the API endpoint, model mappings, and optimal settings.
172
+
173
+ ### Available Providers
174
+
175
+ **GLM (智谱AI)**: GLM-4.5-air and GLM-4.6 models via `api.z.ai`
156
176
 
157
- # Run in dev mode
158
- bun run dev
177
+ **MiniMax**: MiniMax-M2 model via `api.minimax.io`
159
178
 
160
- # Build
161
- bun run build
179
+ ### Usage
180
+
181
+ ```bash
182
+ # CLI mode
183
+ claude-multi add glm --provider glm --api-key "your-api-key"
162
184
 
163
- # Test
164
- bun run dev add test --binary ./test-bin/claude-test
165
- bun run dev list
166
- bun run dev remove test --force
185
+ # Interactive mode
186
+ claude-multi add myinstance
187
+ # Select provider when prompted and enter API key
167
188
  ```
168
189
 
190
+ Customize later by editing `~/.claude-{name}/settings.json`
191
+
169
192
  ## Requirements
170
193
 
171
194
  - Node.js >= 18
172
- - Bun (for development)
173
195
  - `@anthropic-ai/claude-code` installed globally
174
196
 
175
197
  ## Platform Support
@@ -192,45 +214,6 @@ bun run dev remove test --force
192
214
  - Binary path defaults to `~/.local/bin`
193
215
  - Scripts are automatically marked as executable
194
216
 
195
- ## Project Structure
196
-
197
- ```
198
- claude-multi/
199
- ├── src/
200
- │ ├── cli.ts # Main CLI interface
201
- │ ├── config.ts # Instance config management
202
- │ ├── wrapper.ts # Wrapper script generation
203
- │ └── version.ts # Version checking
204
- ├── docs/
205
- │ └── raw-plan.md # Detailed implementation plan
206
- ├── package.json
207
- └── README.md
208
- ```
209
-
210
- ## Configuration
211
-
212
- Instance metadata is stored in `~/.claude-multi/config.json`:
213
-
214
- ```json
215
- {
216
- "instances": [
217
- {
218
- "name": "glm",
219
- "configDir": "/Users/you/.claude-glm",
220
- "binaryPath": "/usr/local/bin/claude-glm",
221
- "createdAt": "2025-11-02T03:57:41.000Z"
222
- }
223
- ],
224
- "version": "1.0.0"
225
- }
226
- ```
227
-
228
- ## CI/CD
229
-
230
- - **CI**: Runs on PRs and pushes to master (Node 20.x)
231
- - **Publish**: Auto-publishes to npm when version tags are pushed
232
- - **Requirements**: `NPM_TOKEN` secret configured in GitHub
233
-
234
217
  ## License
235
218
 
236
219
  MIT
@@ -240,3 +223,9 @@ MIT
240
223
  Built with [Bun](https://bun.sh) and [Commander.js](https://github.com/tj/commander.js)
241
224
 
242
225
  Wrapper for [@anthropic-ai/claude-code](https://www.npmjs.com/package/@anthropic-ai/claude-code)
226
+
227
+ ## Support
228
+
229
+ For technical documentation, development setup, and contribution guidelines, see [development.md](development.md).
230
+
231
+ For issues, questions, or feature requests, please visit the project's issue tracker.