Skip to content
This repository was archived by the owner on Feb 14, 2026. It is now read-only.

Commit 69b5689

Browse files
fedec65claude
andcommitted
feat: add /legal:update command for in-app framework updates
- Add new /legal:update slash command for cross-platform updates - Support macOS, Linux, and Windows with automatic platform detection - Include options: --force, --check, --changelog - Update /legal:help with new command documentation - Update /legal:version to reference update command - Bump version to 2.2.4 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f1d7880 commit 69b5689

5 files changed

Lines changed: 331 additions & 6 deletions

File tree

.claude/commands/legal-help.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ All commands work in **DE/FR/IT/EN**:
271271
| `/swiss:precedent` | Precedent Analyst 📊 | Precedent chain analysis | Citation evolution, case chains |
272272
| `/doc:analyze` | Document Analyst 📄 | Legal document analysis | Contract review, issue identification |
273273
| `/legal:version` | [Reference] | Framework version information | Current version and capabilities |
274+
| `/legal:update` | [System] | Update framework to latest version | In-app cross-platform update |
274275
| `/legal:help` | [Reference] | Command documentation | This help document |
275276

276277
---
@@ -458,6 +459,32 @@ When you use `/legal:` commands, these MCP servers are activated:
458459

459460
---
460461

462+
### `/legal:update` - Framework Update
463+
**Purpose**: Update BetterCallClaude to the latest version directly from Claude Code
464+
465+
**Features**:
466+
- Cross-platform support (macOS, Linux, Windows)
467+
- Automatic platform detection from environment
468+
- MCP server rebuild included
469+
- Changelog display option
470+
471+
**Example**:
472+
```
473+
/legal:update
474+
→ Detecting platform: macOS (darwin)
475+
→ Current version: v2.2.2
476+
→ Latest version: v2.2.3
477+
→ Updating... Done!
478+
→ Please restart Claude Code to reload MCP servers
479+
```
480+
481+
**Options**:
482+
- `--force` - Skip confirmation prompt
483+
- `--check` - Only check for updates, don't install
484+
- `--changelog` - Display changelog after update
485+
486+
---
487+
461488
## 📚 Additional Resources
462489

463490
- **Onboarding Guides**:

.claude/commands/legal-update.md

Lines changed: 297 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
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**

.claude/commands/legal-version.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ For each server, indicate:
3434
Check for available updates:
3535
- Compare local version with remote `pyproject.toml` from GitHub main branch
3636
- If update available, display: **Update available: v{remote_version}**
37-
- Provide command to update: `./install.sh update` or `bettercallclaude update`
37+
- Provide command to update: `/legal:update` (in-app) or `bettercallclaude update` (terminal)
3838

3939
---
4040

@@ -69,10 +69,11 @@ No arguments required. This command displays current status and checks for updat
6969

7070
## Related Commands
7171

72+
- `/legal:update` - Update framework to latest version (in-app)
7273
- `/legal:help` - Full command reference
73-
- `./install.sh version` - Terminal version check with update option
74-
- `./install.sh doctor` - Comprehensive installation diagnostics
74+
- `bettercallclaude version` - Terminal version check
75+
- `bettercallclaude doctor` - Comprehensive installation diagnostics
7576

7677
---
7778

78-
**BetterCallClaude v1.3.2 - Swiss Legal Intelligence Framework**
79+
**BetterCallClaude v2.2.4 - Swiss Legal Intelligence Framework**

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# BetterCallClaude: Legal Intelligence Framework for Swiss Lawyers
22

3-
[![Version](https://img.shields.io/badge/version-2.2.2-blue.svg)](https://github.com/fedec65/bettercallclaude)
3+
[![Version](https://img.shields.io/badge/version-2.2.4-blue.svg)](https://github.com/fedec65/bettercallclaude)
44
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
55
[![Languages](https://img.shields.io/badge/languages-DE%20%7C%20FR%20%7C%20IT%20%7C%20EN-orange.svg)]()
66
[![Claude Code](https://img.shields.io/badge/built%20with-Claude%20Code-purple.svg)](https://claude.ai/code)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "adversarial-workflow"
7-
version = "2.2.2"
7+
version = "2.2.4"
88
description = "Adversarial workflow for legal document analysis with multi-agent communication"
99
readme = "README.md"
1010
requires-python = ">=3.11"

0 commit comments

Comments
 (0)