@ngcodes/ccpm 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/README.md +100 -229
  2. package/package.json +11 -4
package/README.md CHANGED
@@ -1,286 +1,157 @@
1
1
  # ccpm
2
2
 
3
- **Claude Code Profile Manager** — run multiple Claude Code accounts simultaneously with full isolation.
3
+ **Run multiple Claude Code accounts in parallel. Fully isolated. One command.**
4
4
 
5
5
  [![CI](https://github.com/nitin-1926/claude-code-profile-manager/actions/workflows/ci.yml/badge.svg)](https://github.com/nitin-1926/claude-code-profile-manager/actions/workflows/ci.yml)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
- [![Go Report Card](https://goreportcard.com/badge/github.com/nitin-1926/ccpm)](https://goreportcard.com/report/github.com/nitin-1926/ccpm)
6
+ [![npm](https://img.shields.io/npm/v/@ngcodes/ccpm)](https://www.npmjs.com/package/@ngcodes/ccpm)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
8
8
 
9
- ---
9
+ ccpm (Claude Code Profile Manager) lets you create isolated profiles for Claude Code, each with its own credentials, settings, MCP servers, and memory. Open two terminals, run two different accounts at the same time.
10
10
 
11
- ## Privacy & Security
11
+ ## Why
12
12
 
13
- **ccpm is 100% local.** Your data never leaves your machine.
13
+ Claude Code reads config from a single directory (`~/.claude`). If you have a personal account and a work account, you cannot use both at the same time. Switching means logging out and back in, or manually swapping config files.
14
14
 
15
- - No telemetry, analytics, or tracking of any kind
16
- - No network calls — ccpm never contacts any server
17
- - No data collection — we don't know you exist
18
- - Credentials stored in your **OS keychain** (macOS Keychain, Linux Secret Service, Windows Credential Manager)
19
- - Vault backups use **AES-256-GCM encryption** with a master key in your keychain
20
- - Config files live in `~/.ccpm/` on your filesystem — nowhere else
21
- - Fully open source — [audit the code yourself](https://github.com/nitin-1926/claude-code-profile-manager)
15
+ ccpm fixes this. Each profile gets its own config directory. When you run `ccpm run <profile>`, it sets `CLAUDE_CONFIG_DIR` to the right directory and launches Claude Code. Two terminals, two profiles, zero conflicts.
22
16
 
23
- ---
24
-
25
- ## The Problem
26
-
27
- You have multiple Claude Code accounts — personal, work, side projects — and switching between them is painful:
28
-
29
- - Manual logout/login cycles break your flow
30
- - No way to run two accounts in parallel
31
- - Settings, MCP servers, and memory bleed across accounts
32
- - VS Code extension hardcoded to one account
33
-
34
- **ccpm** fixes this. One command per terminal, full isolation, zero conflicts.
35
-
36
- ## Quick Start
17
+ ## Install
37
18
 
38
19
  ```bash
39
- # Install
40
- curl -fsSL https://raw.githubusercontent.com/nitin-1926/claude-code-profile-manager/main/scripts/install.sh | sh
41
-
42
- # Create profiles
43
- ccpm add personal # Choose OAuth or API key — first profile auto-sets as default
44
- ccpm add work # Each profile is fully isolated
45
-
46
- # Run in parallel — one per terminal
47
- ccpm run personal # Terminal 1
48
- ccpm run work # Terminal 2
49
- ```
50
-
51
- That's it. Each terminal runs a completely isolated Claude Code instance with its own credentials, settings, and memory.
52
-
53
- ## How It Works
54
-
55
- ccpm is built on one official Claude Code mechanism:
56
-
57
- > Setting `CLAUDE_CONFIG_DIR` to a directory path causes Claude Code to read all credentials, settings, MCP config, memory, and project data from that directory instead of `~/.claude`.
58
-
59
- ccpm manages isolated directories under `~/.ccpm/profiles/<name>/` and launches Claude with the correct environment. Each profile gets its own keychain entry on macOS, its own credentials file on Linux/Windows, and its own config.
60
-
61
- ```
62
- ~/.ccpm/
63
- ├── config.json # Global ccpm config
64
- ├── profiles/
65
- │ ├── personal/ # CLAUDE_CONFIG_DIR for "personal"
66
- │ │ ├── .claude.json # Account data, settings
67
- │ │ ├── settings.json # MCP servers, preferences
68
- │ │ └── sessions/ # Chat history
69
- │ └── work/ # Fully isolated from "personal"
70
- └── vault/
71
- ├── personal.enc # Encrypted credential backup
72
- └── work.enc
73
- ```
20
+ # npm
21
+ npm i -g @ngcodes/ccpm
74
22
 
75
- ## Installation
76
-
77
- ### curl (macOS / Linux)
78
-
79
- ```bash
23
+ # curl (macOS / Linux)
80
24
  curl -fsSL https://raw.githubusercontent.com/nitin-1926/claude-code-profile-manager/main/scripts/install.sh | sh
81
- ```
82
-
83
- ### Go
84
25
 
85
- ```bash
26
+ # go
86
27
  go install github.com/nitin-1926/ccpm@latest
87
28
  ```
88
29
 
89
- ### npm
90
-
91
- ```bash
92
- npm install -g ccpm
93
- ```
94
-
95
- ### From source
30
+ ## Quick start
96
31
 
97
32
  ```bash
98
- git clone https://github.com/nitin-1926/claude-code-profile-manager.git
99
- cd claude-code-profile-manager/cli
100
- make build # Binary at ./bin/ccpm
101
- go install . # Install to $GOPATH/bin
102
- ```
103
-
104
- ## Shell Integration (Optional)
105
-
106
- For `ccpm use` (setting a profile for your whole shell session), add this to your `~/.zshrc` or `~/.bashrc`:
107
-
108
- ```bash
109
- eval "$(ccpm shell-init)"
110
- ```
111
-
112
- Then reload: `source ~/.zshrc`
113
-
114
- > **Note:** `ccpm run` works without any shell setup. Shell integration is only needed for `ccpm use`.
115
-
116
- ## Commands
117
-
118
- ### Profile Management
119
-
120
- ```bash
121
- ccpm add <name> # Create profile (OAuth or API key)
122
- ccpm list # List all profiles with auth status
123
- ccpm remove <name> # Delete a profile
124
- ccpm status # Full system overview
125
- ```
126
-
127
- ### Running Claude
128
-
129
- ```bash
130
- ccpm run <name> # Launch Claude with this profile (recommended)
131
- ccpm use <name> # Set profile for current shell session
132
- ```
33
+ # Create profiles
34
+ ccpm add personal # authenticate via OAuth or API key
35
+ ccpm add work # same, with a different account
133
36
 
134
- ### Authentication
37
+ # Run them in parallel
38
+ ccpm run personal # in terminal 1
39
+ ccpm run work # in terminal 2
135
40
 
136
- ```bash
137
- ccpm auth status # Check auth health across all profiles
138
- ccpm auth refresh <n> # Re-authenticate a profile
139
- ccpm auth backup <n> # Encrypted credential backup to vault
140
- ccpm auth restore <n> # Restore credentials from vault backup
41
+ # Check status
42
+ ccpm list
141
43
  ```
142
44
 
143
- ### IDE / VS Code
45
+ Output:
144
46
 
145
- ```bash
146
- ccpm set-default <name> # Set profile for VS Code extension
147
- ccpm unset-default # Clear default
148
47
  ```
149
-
150
- ### Uninstall
151
-
152
- ```bash
153
- ccpm uninstall # Remove all ccpm data, profiles, and keychain entries
48
+ NAME AUTH STATUS
49
+ personal oauth ✓ nitin@gmail.com
50
+ work api_key ✓ sk-ant-...7f2k ★
154
51
  ```
155
52
 
156
- ## Auth Methods
53
+ ## Key features
157
54
 
158
- ccpm supports both authentication methods:
55
+ - **Parallel sessions**: run different Claude Code accounts in different terminals simultaneously
56
+ - **Full isolation**: each profile has its own credentials, settings, MCP servers, projects, and memory
57
+ - **OAuth + API key**: supports both authentication methods per profile
58
+ - **Skills, MCP, and settings management**: install globally or per-profile with `--global` / `--profile`
59
+ - **Encrypted vault**: AES-256-GCM encrypted credential backups with master key in your OS keychain
60
+ - **IDE support**: set the default profile for VS Code with `ccpm set-default`
61
+ - **Shell integration**: `ccpm use` sets the profile for your entire shell session
62
+ - **Cross-platform**: macOS Keychain, Linux Secret Service, Windows Credential Manager
159
63
 
160
- ### OAuth (Browser Login)
64
+ ## Commands
161
65
 
162
- ```bash
163
- $ ccpm add personal
164
- Choose authentication method:
165
- 1) OAuth (browser login via claude /login)
166
- 2) API Key
167
- Enter choice [1/2]: 1
66
+ | Command | Description |
67
+ | ----------------------------------------- | ------------------------------------------------------------------------- |
68
+ | `ccpm add <name>` | Create a new profile (OAuth or API key) with an interactive import wizard |
69
+ | `ccpm run <name>` | Launch Claude Code with a profile |
70
+ | `ccpm use <name>` | Set profile for the current shell session |
71
+ | `ccpm list` | List all profiles and their status |
72
+ | `ccpm status` | Show system overview |
73
+ | `ccpm doctor` | Diagnose env, auth health, root-vs-profile drift, symlink integrity |
74
+ | `ccpm set-default <name>` | Set the default profile for IDEs |
75
+ | `ccpm remove <name>` | Delete a profile |
76
+ | `ccpm sync` | Sync global installs into profiles |
77
+ | `ccpm import default` | Import assets from `~/.claude` (symlinked via shared store) |
78
+ | `ccpm import from-profile` | Clone assets from one ccpm profile to another |
79
+ | `ccpm skill add/remove/list/link` | Manage Claude Code skills |
80
+ | `ccpm mcp add/remove/list/import` | Manage MCP servers |
81
+ | `ccpm settings set/get/apply/show` | Manage Claude Code settings |
82
+ | `ccpm auth status/refresh/backup/restore` | Manage authentication |
168
83
 
169
- Claude Code will launch. Run /login to authenticate.
170
- # ...browser auth flow...
84
+ ## How it works
171
85
 
172
- Profile "personal" authenticated via OAuth
173
- ✓ Set as default profile (first profile)
174
- ```
86
+ ccpm uses one official mechanism: the `CLAUDE_CONFIG_DIR` environment variable.
175
87
 
176
- ### API Key
88
+ 1. `ccpm add` creates `~/.ccpm/profiles/<name>/` with its own config and credentials
89
+ 2. `ccpm run` merges shared settings/MCP fragments, sets `CLAUDE_CONFIG_DIR`, and execs `claude`
90
+ 3. Each terminal gets a completely isolated Claude Code instance
177
91
 
178
- ```bash
179
- $ ccpm add work
180
- Choose authentication method:
181
- 1) OAuth (browser login via claude /login)
182
- 2) API Key
183
- Enter choice [1/2]: 2
184
-
185
- Enter your Anthropic API key: ****
186
- ✓ Profile "work" authenticated via API key
187
- ```
92
+ Skills, MCP servers, and settings can be installed globally (`--global`) to apply across all profiles, or per-profile (`--profile <name>`). Global skills are symlinked into each profile from `~/.ccpm/share/`; settings and MCP definitions are stored as JSON fragments and merged into each profile's `settings.json` at launch time.
188
93
 
189
- API keys are stored in your OS keychain (macOS Keychain / Linux Secret Service / Windows Credential Manager) — never in plaintext files.
94
+ No daemons. No patches. No magic.
190
95
 
191
- ## Parallel Sessions
96
+ ## Privacy and security
192
97
 
193
- Run different accounts simultaneously in different terminals:
98
+ ccpm is 100% local. It never makes network requests, never collects data, and never phones home.
194
99
 
195
- ```
196
- ┌─────────────────────┐ ┌─────────────────────┐
197
- Terminal 1 │ │ Terminal 2 │
198
- │ │ │ │
199
- │ $ ccpm run personal │ │ $ ccpm run work │
200
- │ │ │ │
201
- │ Claude Code │ │ Claude Code │
202
- │ (personal@gmail.com) │ │ (work@company.com) │
203
- │ │ │ │
204
- │ Own settings │ │ Own settings │
205
- │ Own MCP servers │ │ Own MCP servers │
206
- │ Own memory │ │ Own memory │
207
- └─────────────────────┘ └─────────────────────┘
208
- ```
100
+ - API keys are stored in your OS keychain (macOS Keychain, Linux Secret Service, Windows Credential Manager)
101
+ - Vault backups use AES-256-GCM encryption with a master key in your OS keychain
102
+ - All data lives in `~/.ccpm/` on your machine
103
+ - No telemetry, analytics, or tracking
209
104
 
210
- ## Platform Support
105
+ ## Platform support
211
106
 
212
- | Feature | macOS | Linux | Windows |
213
- |---------|-------|-------|---------|
214
- | OAuth auth | Keychain (per-profile isolation) | `.credentials.json` in profile dir | `.credentials.json` in profile dir |
215
- | API key auth | Keychain | Secret Service (D-Bus) | Credential Manager |
216
- | Parallel sessions | Yes | Yes | Yes |
217
- | Vault backup | Yes | Yes | Yes |
218
- | Shell hook | zsh, bash, fish | zsh, bash, fish | PowerShell |
107
+ | Feature | macOS | Linux | Windows |
108
+ | ------------------ | ---------------------------------------- | ----------------- | --------------------------------- |
109
+ | OAuth per-profile | Keychain entry namespaced by profile dir | .credentials.json | .credentials.json |
110
+ | API key storage | Keychain | Secret Service | Credential Manager |
111
+ | Parallel sessions | Yes | Yes | Yes |
112
+ | Shared skill dedup | Symlinks | Symlinks | Symlinks (Developer Mode) or copy |
113
+ | Shell hook | zsh, bash, fish | zsh, bash, fish | PowerShell |
219
114
 
220
- ## Known Limitations
115
+ > **Requires Claude Code `v2.1.56` or newer for macOS OAuth isolation.** Earlier versions share a single keychain entry across all profiles. `ccpm doctor` warns on older versions.
221
116
 
222
- We believe in being honest about constraints:
117
+ ## MCP authentication model
223
118
 
224
- | # | Limitation | Severity | Workaround |
225
- |---|---|---|---|
226
- | L1 | **VS Code extension ignores `CLAUDE_CONFIG_DIR`** — reads from `~/.claude` always | High | Use `ccpm set-default <profile>` to set the VS Code account |
227
- | L2 | **`CLAUDE_CONFIG_DIR` path with `~/`** — Claude has a bug resolving `~/` paths on Linux | Medium | ccpm always uses absolute paths (handled automatically) |
228
- | L3 | **Same-account parallel sessions** — running one profile in two terminals hits Anthropic's refresh token race | Medium | Use different profiles in different terminals |
229
- | L4 | **Headless Linux** — `go-keyring` requires D-Bus + secret service | Low | API key profiles need a running secret service |
119
+ MCP servers authenticate in one of three ways, and ccpm isolates each differently:
230
120
 
231
- ## Project Structure
121
+ 1. **Env-var-based (isolated)** — tokens live in the per-profile MCP fragment. Each profile can carry a different value. Use `ccpm mcp add <name> --env KEY=VALUE --profile <name>`.
122
+ 2. **OAuth MCPs (isolated)** — Claude Code caches OAuth tokens inside `<CLAUDE_CONFIG_DIR>/.claude.json`, which is per-profile.
123
+ 3. **Globally-cached MCPs (shared)** — MCPs that write to `~/.config/<service>` or a fixed-name keychain entry are shared across every profile. ccpm cannot isolate them without upstream changes.
232
124
 
233
- ```
234
- claude-code-profile-manager/
235
- ├── cli/ # Go source code (ccpm binary)
236
- │ ├── cmd/ # CLI commands
237
- │ ├── internal/ # Core packages (config, profile, vault, etc.)
238
- │ └── Makefile
239
- ├── docs/ # Documentation website (Next.js, deploy to Vercel)
240
- ├── npm/ # npm wrapper package
241
- ├── scripts/ # Install script
242
- └── .github/ # CI/CD workflows
243
- ```
125
+ ## Known limitations
244
126
 
245
- ## Roadmap
246
-
247
- - [x] Profile management (add, list, remove, run)
248
- - [x] OAuth + API key authentication
249
- - [x] Encrypted vault backup/restore
250
- - [x] Shell integration (use, shell-init)
251
- - [x] VS Code default profile (set-default)
252
- - [x] Uninstall command
253
- - [ ] Per-profile MCP server management
254
- - [ ] Shared vs isolated config (skills, commands, CLAUDE.md)
255
- - [ ] Token optimization presets
256
- - [ ] Diagnostics (`ccpm doctor`)
257
- - [ ] GUI companion app
258
- - [ ] Multi-tool support (Codex CLI, Cursor CLI, Gemini CLI)
127
+ - **VS Code extension**: The Claude VS Code extension always reads from `~/.claude`. Use `ccpm set-default` to point it at a ccpm profile. On macOS this copies the namespaced keychain entry into the default slot.
128
+ - **Windows without Developer Mode**: ccpm falls back to copying shared assets instead of symlinking, and writes a marker at `~/.ccpm/.windows-copy-fallback`. Turn on Developer Mode for true deduplication.
129
+ - **Globally-cached MCP servers** (see the MCP auth model above) cannot be isolated per profile.
130
+ - **Linux headless**: `go-keyring` requires D-Bus and a secret service (gnome-keyring or kwallet). On headless servers, API key profiles need a running secret service.
259
131
 
260
- ## Contributing
261
-
262
- Contributions welcome! Please open an issue first to discuss what you'd like to change.
132
+ ## Build from source
263
133
 
264
134
  ```bash
265
- # Development setup
266
135
  git clone https://github.com/nitin-1926/claude-code-profile-manager.git
267
136
  cd claude-code-profile-manager/cli
268
- go mod tidy
269
- make build # Build binary to ./bin/ccpm
270
- go install . # Install to $GOPATH/bin for testing
271
- make test # Run tests
137
+ go build -o ccpm .
138
+ ./ccpm --version
272
139
  ```
273
140
 
274
- ### Testing the npm package locally
141
+ ## Contributing
275
142
 
276
- ```bash
277
- cd npm
278
- npm pack # Creates ccpm-0.1.0.tgz
279
- npm install -g ccpm-0.1.0.tgz # Install from local tarball
280
- ccpm --version # Verify
281
- npm uninstall -g ccpm # Clean up
282
- ```
143
+ Contributions are welcome. Please open an issue first to discuss what you want to change.
144
+
145
+ 1. Fork the repo
146
+ 2. Create a feature branch (`git checkout -b feature/your-feature`)
147
+ 3. Make your changes
148
+ 4. Run tests (`cd cli && go test ./...`)
149
+ 5. Open a pull request
283
150
 
284
151
  ## License
285
152
 
286
- [MIT](LICENSE)
153
+ MIT
154
+
155
+ ## Author
156
+
157
+ Built by [Nitin Gupta](https://x.com/nitingupta__7).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngcodes/ccpm",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Claude Code Profile Manager — manage multiple Claude Code accounts with isolated profiles",
5
5
  "bin": {
6
6
  "ccpm": "bin/ccpm"
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "scripts": {
18
18
  "postinstall": "node install.js",
19
- "test-local": "echo 'To test locally: npm pack && npm install -g nitin-1926-ccpm-0.1.0.tgz'"
19
+ "test-local": "echo 'To test locally: npm pack && npm install -g ngcodes-ccpm-0.1.0.tgz'"
20
20
  },
21
21
  "keywords": [
22
22
  "claude",
@@ -36,8 +36,15 @@
36
36
  "bugs": {
37
37
  "url": "https://github.com/nitin-1926/claude-code-profile-manager/issues"
38
38
  },
39
- "os": ["darwin", "linux", "win32"],
40
- "cpu": ["x64", "arm64"],
39
+ "os": [
40
+ "darwin",
41
+ "linux",
42
+ "win32"
43
+ ],
44
+ "cpu": [
45
+ "x64",
46
+ "arm64"
47
+ ],
41
48
  "engines": {
42
49
  "node": ">=16"
43
50
  }