-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall-ps.ps1
More file actions
98 lines (78 loc) · 2.6 KB
/
install-ps.ps1
File metadata and controls
98 lines (78 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Claude Code Model Switcher - PowerShell Installer
# Run this script to set up ccm/ccc functions in PowerShell
$ProfileContent = @'
# ============================================================================
# CCM - Claude Code Model Switcher
# ============================================================================
function ccm {
<#
.SYNOPSIS
Switch Claude Code AI provider
.EXAMPLE
ccm glm china # Switch to GLM China
ccm kimi global # Switch to Kimi Global
ccm minimax # Switch to MiniMax
ccm list # List all providers
ccm status # Show current config
#>
# Try installed command first, fallback to python -m
$cmd = Get-Command ccm -ErrorAction SilentlyContinue
if ($cmd -and $cmd.CommandType -eq "Application") {
$output = & ccm $args 2>&1
} else {
$output = python -m ccm.cli $args 2>&1
}
$output | ForEach-Object {
Write-Host $_
if ($_ -match '^\$env:\w+\s*=\s*".*"') {
Invoke-Expression $_
}
}
}
function ccc {
<#
.SYNOPSIS
Switch provider and launch Claude Code
.EXAMPLE
ccc glm china # Switch to GLM China and launch
ccc kimi # Switch to Kimi and launch
#>
# Try installed command first, fallback to python -m
$cmd = Get-Command ccc -ErrorAction SilentlyContinue
if ($cmd -and $cmd.CommandType -eq "Application") {
& ccc $args
} else {
python -m ccm.launcher $args
}
}
# ============================================================================
'@
$ProfilePath = $PROFILE
# Check if already installed
if (Test-Path $ProfilePath) {
$existingContent = Get-Content $ProfilePath -Raw
if ($existingContent -match "# CCM - Claude Code Model Switcher") {
Write-Host "CCM already installed in PowerShell profile." -ForegroundColor Yellow
Write-Host "To reinstall, remove the CCM section from $ProfilePath and run again." -ForegroundColor Yellow
exit 0
}
}
# Append to profile
Add-Content -Path $ProfilePath -Value $ProfileContent
Write-Host @"
========================================
CCM installed successfully!
========================================
Profile: $ProfilePath
To use ccm/ccc now, reload your profile:
. `$PROFILE
Or restart PowerShell.
Usage:
ccm glm china # Switch to GLM China
ccm kimi global # Switch to Kimi Global
ccm minimax # Switch to MiniMax
ccm list # List all providers
ccm status # Show current config
ccm config # Edit config file
ccc glm china # Switch and launch Claude Code
"@