|
| 1 | +# /legal:update - BetterCallClaude Framework Update |
| 2 | + |
| 3 | +**Update the BetterCallClaude framework to the latest version directly from Claude Code.** |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +This command provides an in-app update mechanism for BetterCallClaude, detecting your platform and executing the appropriate update commands. |
| 10 | + |
| 11 | +--- |
| 12 | + |
| 13 | +## Execution Behavior |
| 14 | + |
| 15 | +When this command is invoked, Claude must: |
| 16 | + |
| 17 | +### 1. Detect Platform from Environment |
| 18 | + |
| 19 | +Read the `<env>` context to determine the operating system: |
| 20 | +- **darwin** → macOS (use bash/zsh commands) |
| 21 | +- **linux** → Linux (use bash commands) |
| 22 | +- **win32** or contains "Windows" → Windows (use PowerShell commands) |
| 23 | + |
| 24 | +### 2. Check Current Version |
| 25 | + |
| 26 | +Before updating, display the current version: |
| 27 | +```bash |
| 28 | +# macOS/Linux |
| 29 | +bettercallclaude version 2>/dev/null || echo "CLI not available" |
| 30 | + |
| 31 | +# Windows PowerShell |
| 32 | +bettercallclaude version 2>$null |
| 33 | +``` |
| 34 | + |
| 35 | +### 3. Check for Updates Available |
| 36 | + |
| 37 | +Compare local vs remote version: |
| 38 | +```bash |
| 39 | +# macOS/Linux - via git in installation directory |
| 40 | +cd ~/.claude/bettercallclaude && git fetch origin && git log HEAD..origin/main --oneline |
| 41 | + |
| 42 | +# Windows PowerShell |
| 43 | +Push-Location "$env:USERPROFILE\.claude\bettercallclaude"; git fetch origin; git log HEAD..origin/main --oneline; Pop-Location |
| 44 | +``` |
| 45 | + |
| 46 | +### 4. Execute Platform-Specific Update |
| 47 | + |
| 48 | +#### macOS / Linux |
| 49 | +```bash |
| 50 | +# Option A: Using CLI wrapper (preferred) |
| 51 | +bettercallclaude update |
| 52 | + |
| 53 | +# Option B: Using installer directly |
| 54 | +cd ~/.claude/bettercallclaude && bash install.sh update |
| 55 | +``` |
| 56 | + |
| 57 | +#### Windows (PowerShell) |
| 58 | +```powershell |
| 59 | +# Option A: Using CLI wrapper (preferred) |
| 60 | +bettercallclaude update |
| 61 | +
|
| 62 | +# Option B: Using installer directly |
| 63 | +Push-Location "$env:USERPROFILE\.claude\bettercallclaude" |
| 64 | +.\install.ps1 -Update |
| 65 | +Pop-Location |
| 66 | +``` |
| 67 | + |
| 68 | +### 5. Display Post-Update Instructions |
| 69 | + |
| 70 | +After successful update, display: |
| 71 | + |
| 72 | +``` |
| 73 | +╔══════════════════════════════════════════════════════════════════╗ |
| 74 | +║ Update Complete! ║ |
| 75 | +╠══════════════════════════════════════════════════════════════════╣ |
| 76 | +║ BetterCallClaude has been updated to v{new_version} ║ |
| 77 | +║ ║ |
| 78 | +║ IMPORTANT: MCP servers have been rebuilt. ║ |
| 79 | +║ ║ |
| 80 | +║ To complete the update: ║ |
| 81 | +║ 1. Save any open work ║ |
| 82 | +║ 2. Restart Claude Code (Cmd/Ctrl+Shift+P → "Reload Window") ║ |
| 83 | +║ 3. MCP servers will reconnect automatically ║ |
| 84 | +║ ║ |
| 85 | +║ Run /legal:version to verify the update. ║ |
| 86 | +╚══════════════════════════════════════════════════════════════════╝ |
| 87 | +``` |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +## Response Format |
| 92 | + |
| 93 | +### Before Update |
| 94 | +``` |
| 95 | +╔══════════════════════════════════════════════════════════════════╗ |
| 96 | +║ BetterCallClaude Update ║ |
| 97 | +╠══════════════════════════════════════════════════════════════════╣ |
| 98 | +║ Current Version: v2.2.2 ║ |
| 99 | +║ Latest Version: v2.2.3 ║ |
| 100 | +║ Platform: macOS (darwin) ║ |
| 101 | +╠══════════════════════════════════════════════════════════════════╣ |
| 102 | +║ Checking for updates... ║ |
| 103 | +╚══════════════════════════════════════════════════════════════════╝ |
| 104 | +``` |
| 105 | + |
| 106 | +### Update In Progress |
| 107 | +``` |
| 108 | +╔══════════════════════════════════════════════════════════════════╗ |
| 109 | +║ Updating BetterCallClaude... ║ |
| 110 | +╠══════════════════════════════════════════════════════════════════╣ |
| 111 | +║ [✓] Fetching latest changes ║ |
| 112 | +║ [✓] Pulling updates from main ║ |
| 113 | +║ [✓] Rebuilding MCP servers ║ |
| 114 | +║ [✓] Updating manifest ║ |
| 115 | +╚══════════════════════════════════════════════════════════════════╝ |
| 116 | +``` |
| 117 | + |
| 118 | +### No Update Needed |
| 119 | +``` |
| 120 | +╔══════════════════════════════════════════════════════════════════╗ |
| 121 | +║ Already Up to Date! ║ |
| 122 | +╠══════════════════════════════════════════════════════════════════╣ |
| 123 | +║ Version: v2.2.2 ║ |
| 124 | +║ Status: You have the latest version ║ |
| 125 | +╚══════════════════════════════════════════════════════════════════╝ |
| 126 | +``` |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## Error Handling |
| 131 | + |
| 132 | +### Installation Not Found |
| 133 | +``` |
| 134 | +╔══════════════════════════════════════════════════════════════════╗ |
| 135 | +║ Error: BetterCallClaude Not Installed ║ |
| 136 | +╠══════════════════════════════════════════════════════════════════╣ |
| 137 | +║ No installation found at expected locations: ║ |
| 138 | +║ - ~/.claude/bettercallclaude (global) ║ |
| 139 | +║ - ./.bettercallclaude (local) ║ |
| 140 | +║ ║ |
| 141 | +║ To install BetterCallClaude: ║ |
| 142 | +║ curl -fsSL https://raw.githubusercontent.com/fedec65/ ║ |
| 143 | +║ BetterCallClaude/main/install.sh | bash ║ |
| 144 | +╚══════════════════════════════════════════════════════════════════╝ |
| 145 | +``` |
| 146 | + |
| 147 | +### Git Conflicts |
| 148 | +``` |
| 149 | +╔══════════════════════════════════════════════════════════════════╗ |
| 150 | +║ Warning: Local Changes Detected ║ |
| 151 | +╠══════════════════════════════════════════════════════════════════╣ |
| 152 | +║ The update found uncommitted local changes. ║ |
| 153 | +║ ║ |
| 154 | +║ Options: ║ |
| 155 | +║ 1. Stash changes: git stash (then retry update) ║ |
| 156 | +║ 2. Discard changes: git checkout . (then retry update) ║ |
| 157 | +║ 3. Manual update: cd ~/.claude/bettercallclaude && git pull ║ |
| 158 | +╚══════════════════════════════════════════════════════════════════╝ |
| 159 | +``` |
| 160 | + |
| 161 | +### Network Error |
| 162 | +``` |
| 163 | +╔══════════════════════════════════════════════════════════════════╗ |
| 164 | +║ Error: Network Connection Failed ║ |
| 165 | +╠══════════════════════════════════════════════════════════════════╣ |
| 166 | +║ Could not connect to GitHub to fetch updates. ║ |
| 167 | +║ ║ |
| 168 | +║ Please check: ║ |
| 169 | +║ - Your internet connection ║ |
| 170 | +║ - GitHub status: https://www.githubstatus.com ║ |
| 171 | +║ - Firewall/proxy settings ║ |
| 172 | +╚══════════════════════════════════════════════════════════════════╝ |
| 173 | +``` |
| 174 | + |
| 175 | +--- |
| 176 | + |
| 177 | +## Platform Detection Logic |
| 178 | + |
| 179 | +```javascript |
| 180 | +// Claude reads platform from <env> context in every session |
| 181 | +// Example env context: |
| 182 | +// Platform: darwin |
| 183 | +// OS Version: Darwin 25.1.0 |
| 184 | + |
| 185 | +// Detection rules: |
| 186 | +if (platform === "darwin") { |
| 187 | + // macOS - use bash commands |
| 188 | + useShell = "bash"; |
| 189 | + updateCmd = "bettercallclaude update"; |
| 190 | + installDir = "~/.claude/bettercallclaude"; |
| 191 | +} |
| 192 | +else if (platform === "linux") { |
| 193 | + // Linux - use bash commands |
| 194 | + useShell = "bash"; |
| 195 | + updateCmd = "bettercallclaude update"; |
| 196 | + installDir = "~/.claude/bettercallclaude"; |
| 197 | +} |
| 198 | +else if (platform.includes("win") || platform.includes("Windows")) { |
| 199 | + // Windows - use PowerShell |
| 200 | + useShell = "powershell"; |
| 201 | + updateCmd = "bettercallclaude update"; |
| 202 | + installDir = "$env:USERPROFILE\\.claude\\bettercallclaude"; |
| 203 | +} |
| 204 | +``` |
| 205 | + |
| 206 | +--- |
| 207 | + |
| 208 | +## Usage |
| 209 | + |
| 210 | +### Basic Update |
| 211 | +``` |
| 212 | +/legal:update |
| 213 | +``` |
| 214 | + |
| 215 | +### With Force Flag (skip confirmation) |
| 216 | +``` |
| 217 | +/legal:update --force |
| 218 | +``` |
| 219 | + |
| 220 | +### Check Only (no update) |
| 221 | +``` |
| 222 | +/legal:update --check |
| 223 | +``` |
| 224 | + |
| 225 | +--- |
| 226 | + |
| 227 | +## Options |
| 228 | + |
| 229 | +| Option | Description | |
| 230 | +|--------|-------------| |
| 231 | +| (none) | Interactive update with confirmation | |
| 232 | +| `--force` | Skip confirmation prompt, update immediately | |
| 233 | +| `--check` | Only check for updates, don't install | |
| 234 | +| `--changelog` | Display changelog after update | |
| 235 | + |
| 236 | +--- |
| 237 | + |
| 238 | +## Important Notes |
| 239 | + |
| 240 | +### MCP Server Reload Required |
| 241 | + |
| 242 | +After updating, MCP servers need to be reloaded. This requires: |
| 243 | + |
| 244 | +1. **Restart Claude Code** - The recommended method |
| 245 | + - macOS: `Cmd+Shift+P` → "Developer: Reload Window" |
| 246 | + - Windows: `Ctrl+Shift+P` → "Developer: Reload Window" |
| 247 | + |
| 248 | +2. **Or restart the terminal** and reopen Claude Code |
| 249 | + |
| 250 | +### Why Restart is Required |
| 251 | + |
| 252 | +MCP servers are registered at Claude Code startup. When BetterCallClaude updates: |
| 253 | +- New TypeScript code is pulled |
| 254 | +- MCP servers are rebuilt (`npm run build`) |
| 255 | +- But Claude Code's running MCP processes use the old code |
| 256 | + |
| 257 | +A restart refreshes the MCP server connections with the new code. |
| 258 | + |
| 259 | +--- |
| 260 | + |
| 261 | +## Related Commands |
| 262 | + |
| 263 | +- `/legal:version` - Check current version and MCP status |
| 264 | +- `/legal:help` - Full command reference |
| 265 | +- `/legal:doctor` - Diagnose installation issues (if implemented) |
| 266 | + |
| 267 | +--- |
| 268 | + |
| 269 | +## Changelog Display (--changelog) |
| 270 | + |
| 271 | +After update, optionally show recent changes: |
| 272 | + |
| 273 | +``` |
| 274 | +╔══════════════════════════════════════════════════════════════════╗ |
| 275 | +║ What's New in v2.2.3 ║ |
| 276 | +╠══════════════════════════════════════════════════════════════════╣ |
| 277 | +║ • Fixed CLI wrapper syntax error in heredoc ║ |
| 278 | +║ • Improved PowerShell parameter handling ║ |
| 279 | +║ • pyproject.toml now single source of truth for version ║ |
| 280 | +║ ║ |
| 281 | +║ Full changelog: https://github.com/fedec65/BetterCallClaude/ ║ |
| 282 | +║ blob/main/CHANGELOG.md ║ |
| 283 | +╚══════════════════════════════════════════════════════════════════╝ |
| 284 | +``` |
| 285 | + |
| 286 | +--- |
| 287 | + |
| 288 | +## Security Considerations |
| 289 | + |
| 290 | +- Updates are pulled from the official GitHub repository only |
| 291 | +- HTTPS is enforced for all connections |
| 292 | +- The update process runs in the user's context (no elevated privileges) |
| 293 | +- Local changes are preserved via git stash (not discarded) |
| 294 | + |
| 295 | +--- |
| 296 | + |
| 297 | +**BetterCallClaude v2.2.4 - Swiss Legal Intelligence Framework** |
0 commit comments