@claudecollab/cli 0.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudecollab/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1143,6 +1143,21 @@ async function main() {
1143
1143
  // Copy the SAFE invite (token-free); the host reaches their own tab via the
1144
1144
  // status-line URL. Claim the copy only if it actually happened (finding 5).
1145
1145
  copyInvite(inviteRoomUrl(code), (copied) => showToast(readyToast(copied), 15000));
1146
+ // Auto-open the host's control tab. The host URL lives ONLY in the band (one
1147
+ // line — a normal-width terminal CLIPS it, and a copied clipped link 404s the
1148
+ // room: launch-day dogfood finding). Opening the tab directly sidesteps copying
1149
+ // entirely. Gated on the automation flag the rigs/tests already set, and
1150
+ // opt-out via CLAUDE_SHARE_NO_OPEN for people who hate surprise tabs.
1151
+ if (
1152
+ process.env.CLAUDE_SHARE_SKIP_SETUP !== '1' &&
1153
+ !process.env.CLAUDE_SHARE_NO_OPEN &&
1154
+ stdout.isTTY
1155
+ ) {
1156
+ const opener = process.platform === 'darwin' ? 'open' : 'xdg-open';
1157
+ try {
1158
+ execFile(opener, [hostRoomUrl(code)], () => {});
1159
+ } catch {}
1160
+ }
1146
1161
  });
1147
1162
  r.onGone(() => {
1148
1163
  if (!current()) return;
@@ -22,6 +22,21 @@ const PATH_LINE = 'export PATH="$HOME/.claude-share/bin:$PATH"';
22
22
  // Default rc candidates (macOS/Linux stance — no Windows rc handling by design).
23
23
  const RC_CANDIDATES = ['.zshrc', '.bashrc'];
24
24
 
25
+ // The shim body. `collab` when a global install provides it; otherwise fall back
26
+ // to npx (an npx-only user has no global bin — without the fallback their `claude`
27
+ // would break outright). Exported for the installer and its test.
28
+ export const SHIM_SCRIPT = [
29
+ '#!/bin/sh',
30
+ '# claudecollab shim: claude runs wrapped (sharing dormant until /collab).',
31
+ '# Falls back to npx for installs that never got a global collab (npx-only',
32
+ '# users) - without this, the shim would break claude entirely.',
33
+ 'if command -v collab >/dev/null 2>&1; then',
34
+ ' exec collab "$@"',
35
+ 'fi',
36
+ 'exec npx -y @claudecollab/cli "$@"',
37
+ '',
38
+ ].join('\n');
39
+
25
40
  /** The dir the shim script lives in: `<home>/.claude-share/bin`. */
26
41
  export function shimDir(home = os.homedir()) {
27
42
  return path.join(home, '.claude-share', 'bin');
@@ -50,7 +65,7 @@ export function installShim({ home = os.homedir(), rcFiles } = {}) {
50
65
  const dir = shimDir(home);
51
66
  fs.mkdirSync(dir, { recursive: true });
52
67
  const script = path.join(dir, 'claude');
53
- fs.writeFileSync(script, '#!/bin/sh\nexec collab "$@"\n', { mode: 0o755 });
68
+ fs.writeFileSync(script, SHIM_SCRIPT, { mode: 0o755 });
54
69
  fs.chmodSync(script, 0o755); // writeFileSync doesn't re-chmod an existing file
55
70
 
56
71
  const targets = resolveRcFiles(home, rcFiles);