cchost 0.1.1 → 0.1.2
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 +5 -3
- package/lib/cli.js +14 -15
- package/lib/migrate.js +3 -1
- package/lib/share.js +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,8 +20,8 @@ Requires Node.js 18+ and Claude Code 2.1.140+ already installed. Get Claude Code
|
|
|
20
20
|
| `cc use <profile> [...args]` | Launch Claude under that profile. Profile must already exist. Args after the name are forwarded verbatim to `claude`. |
|
|
21
21
|
| `cc list [--original] [--json]` | Show every profile: login state, account email, and storage mode (`shared` / `isolated`). |
|
|
22
22
|
| `cc migrate <src> <dest>` | Copy projects from `default`\|`shared` to `shared`\|`<profile>`. Skip-on-collision; credential files never copied. |
|
|
23
|
-
| `cc link <profile> [<profile>...]` | Link a profile's `projects/`
|
|
24
|
-
| `cc unlink <profile>` | Restore a profile to its own private `projects/`
|
|
23
|
+
| `cc link <profile> [<profile>...]` | Link a profile's `projects/` to `~/.claude-shared/projects`. Migrates existing content; renames on collision. |
|
|
24
|
+
| `cc unlink <profile>` | Restore a profile to its own private `projects/` (copies shared content back). |
|
|
25
25
|
| `cc remove <profile>` | Delete a profile. Requires typing the profile name to confirm. |
|
|
26
26
|
| `cc help [command]` | Print usage (top-level, or for a single command). |
|
|
27
27
|
|
|
@@ -66,7 +66,9 @@ cc link work
|
|
|
66
66
|
cc link personal
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
`work/projects` and `personal/projects` become links to `~/.claude-shared/projects`.
|
|
69
|
+
`work/projects` and `personal/projects` become links to `~/.claude-shared/projects`. On Windows this uses directory junctions (no admin/Developer Mode required); on macOS/Linux, regular symlinks.
|
|
70
|
+
|
|
71
|
+
**Only `projects/` is shared.** That's the directory Claude Code uses for resumable conversation transcripts (`projects/<project>/<session>.jsonl`). The sibling `sessions/` folder holds transient per-process registry state — PID, working directory, status, timestamps — and is **never** linked, migrated, or copied across profiles. Sharing it would corrupt Claude's running-process bookkeeping. `sessions/` stays per-profile under `~/.claude-profiles/<name>/sessions/`.
|
|
70
72
|
|
|
71
73
|
`cc link a b c` links several profiles at once; per-profile failures are reported but don't abort the rest of the batch.
|
|
72
74
|
|
package/lib/cli.js
CHANGED
|
@@ -18,8 +18,8 @@ Usage:
|
|
|
18
18
|
cc use <profile> [...args] Launch Claude under a named profile
|
|
19
19
|
cc list [--original] [--json] Show all profiles: login state, email, storage (shared/isolated)
|
|
20
20
|
cc migrate <src> <dest> Copy projects from default|shared to shared|<profile>
|
|
21
|
-
cc link <p>... Replace each profile's projects/
|
|
22
|
-
cc unlink <profile> Restore a profile's private projects/
|
|
21
|
+
cc link <p>... Replace each profile's projects/ with a link to shared
|
|
22
|
+
cc unlink <profile> Restore a profile's private projects/
|
|
23
23
|
cc remove <profile> Delete a profile and all its data (typed confirmation)
|
|
24
24
|
cc help [command] Show usage (optionally for a single command)
|
|
25
25
|
|
|
@@ -61,8 +61,8 @@ Columns:
|
|
|
61
61
|
Profile - profile name
|
|
62
62
|
LoggedIn - true if .credentials.json exists
|
|
63
63
|
Email - account email (alias-aware; - if not yet logged in)
|
|
64
|
-
Storage - 'shared' if projects/
|
|
65
|
-
|
|
64
|
+
Storage - 'shared' if projects/ is linked to ~/.claude-shared, 'isolated' otherwise
|
|
65
|
+
(sessions/ is transient per-process state and is never shared)
|
|
66
66
|
|
|
67
67
|
By default, the displayed email reflects any alias set via 'cc add'.
|
|
68
68
|
With --original, shows the real value from .claude.json.
|
|
@@ -71,8 +71,8 @@ With --json, emits an array of {name, dir, loggedIn, email, storage, alias}.
|
|
|
71
71
|
`,
|
|
72
72
|
migrate: `cc migrate <src> <dest>
|
|
73
73
|
|
|
74
|
-
Copy projects/
|
|
75
|
-
This is a COPY — the source is left untouched.
|
|
74
|
+
Copy projects/ from a source to a destination. sessions/ (transient per-process
|
|
75
|
+
registry state) is never migrated. This is a COPY — the source is left untouched.
|
|
76
76
|
|
|
77
77
|
<src>: default | shared
|
|
78
78
|
default = ~/.claude/ (Claude's built-in non-profile data)
|
|
@@ -90,9 +90,10 @@ Examples:
|
|
|
90
90
|
`,
|
|
91
91
|
link: `cc link <profile> [<profile>...]
|
|
92
92
|
|
|
93
|
-
Replace each profile's projects/
|
|
93
|
+
Replace each profile's projects/ with a link to ~/.claude-shared/projects/.
|
|
94
94
|
Existing content is migrated into shared first; collisions are renamed with a
|
|
95
|
-
__<profile> suffix (never overwritten).
|
|
95
|
+
__<profile> suffix (never overwritten). sessions/ (transient per-process state)
|
|
96
|
+
is intentionally never linked — it stays per-profile.
|
|
96
97
|
|
|
97
98
|
On Windows, link uses directory junctions (no admin/Developer Mode needed).
|
|
98
99
|
On macOS/Linux, regular symlinks.
|
|
@@ -102,8 +103,8 @@ are reported but don't abort the rest of the batch.
|
|
|
102
103
|
`,
|
|
103
104
|
unlink: `cc unlink <profile>
|
|
104
105
|
|
|
105
|
-
Remove a profile's
|
|
106
|
-
into the profile as private
|
|
106
|
+
Remove a profile's projects/ link to ~/.claude-shared/ and copy shared content
|
|
107
|
+
back into the profile as a private dir.
|
|
107
108
|
`,
|
|
108
109
|
remove: `cc remove <profile>
|
|
109
110
|
|
|
@@ -111,8 +112,8 @@ Delete a profile and everything inside its directory: credentials, sessions,
|
|
|
111
112
|
projects, plugins, and history. To confirm, you must type the exact profile
|
|
112
113
|
name — y/n is intentionally not accepted because credential loss is unrecoverable.
|
|
113
114
|
|
|
114
|
-
If the profile's projects/
|
|
115
|
-
|
|
115
|
+
If the profile's projects/ is a link to ~/.claude-shared/, only the link is
|
|
116
|
+
removed — the shared target is preserved.
|
|
116
117
|
`,
|
|
117
118
|
help: `cc help [command]
|
|
118
119
|
|
|
@@ -272,9 +273,7 @@ function cmdList(rest) {
|
|
|
272
273
|
const enriched = list.map((p) => {
|
|
273
274
|
const alias = p.alias || {};
|
|
274
275
|
const displayEmail = useOriginal ? p.email : (alias.email || p.email);
|
|
275
|
-
const
|
|
276
|
-
const sessionsLink = isLinkLike(path.join(p.dir, 'sessions'));
|
|
277
|
-
const storage = (projectsLink || sessionsLink) ? 'shared' : 'isolated';
|
|
276
|
+
const storage = isLinkLike(path.join(p.dir, 'projects')) ? 'shared' : 'isolated';
|
|
278
277
|
return {
|
|
279
278
|
name: p.name,
|
|
280
279
|
dir: p.dir,
|
package/lib/migrate.js
CHANGED
|
@@ -6,7 +6,9 @@ const os = require('os');
|
|
|
6
6
|
|
|
7
7
|
const profiles = require('./profiles');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// Only projects/ holds the resumable conversation transcripts. sessions/ is transient
|
|
10
|
+
// per-process state and is intentionally not migrated.
|
|
11
|
+
const SUBDIRS = ['projects'];
|
|
10
12
|
const EXCLUDED_FILES = new Set(['.credentials.json', '.claude.json']);
|
|
11
13
|
|
|
12
14
|
function defaultClaudeDir() {
|
package/lib/share.js
CHANGED
|
@@ -5,7 +5,10 @@ const path = require('path');
|
|
|
5
5
|
|
|
6
6
|
const profiles = require('./profiles');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// Only projects/ holds the resumable conversation transcripts (projects/<proj>/<session>.jsonl).
|
|
9
|
+
// sessions/ is transient per-process registry state (PID, cwd, status, timestamps) and
|
|
10
|
+
// must stay per-profile — sharing it would corrupt Claude's running-process bookkeeping.
|
|
11
|
+
const SHARED_SUBDIRS = ['projects'];
|
|
9
12
|
|
|
10
13
|
function symlinkType() {
|
|
11
14
|
return process.platform === 'win32' ? 'junction' : 'dir';
|