-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.ps1
More file actions
128 lines (107 loc) · 4.77 KB
/
install.ps1
File metadata and controls
128 lines (107 loc) · 4.77 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# ---------------------------------------------------------------------------
# Alfred Dev -- script de instalacion para Claude Code (Windows)
#
# Uso:
# irm https://raw.githubusercontent.com/686f6c61/alfred-dev/main/install.ps1 | iex
#
# Que hace:
# 1. Verifica que Claude Code esta instalado
# 2. Registra el marketplace del plugin con claude plugin marketplace add
# 3. Instala el plugin con claude plugin install
# 4. Listo para usar: /alfred-dev:help
#
# El script delega toda la gestion en la CLI nativa de Claude Code
# (claude plugin marketplace / claude plugin install) para garantizar
# compatibilidad con cualquier version futura de la herramienta.
# ---------------------------------------------------------------------------
$ErrorActionPreference = 'Stop'
$Repo = "686f6c61/alfred-dev"
$PluginName = "alfred-dev"
$Version = "0.6.0"
# -- Funciones auxiliares ---------------------------------------------------
function Write-Info { param([string]$Msg) Write-Host ">" $Msg -ForegroundColor Blue }
function Write-Ok { param([string]$Msg) Write-Host "+" $Msg -ForegroundColor Green }
function Write-Err { param([string]$Msg) Write-Host "x" $Msg -ForegroundColor Red }
# -- Verificaciones ---------------------------------------------------------
if (-not $env:USERPROFILE -or -not (Test-Path $env:USERPROFILE -PathType Container)) {
Write-Err "USERPROFILE no esta definido o no apunta a un directorio valido"
exit 1
}
$ClaudeDir = Join-Path $env:USERPROFILE ".claude"
if (-not (Test-Path $ClaudeDir)) {
Write-Err "No se encontro el directorio $ClaudeDir"
Write-Err "Asegurate de tener Claude Code instalado: https://docs.anthropic.com/en/docs/claude-code"
exit 1
}
if (-not (Get-Command claude -ErrorAction SilentlyContinue)) {
Write-Err "El comando 'claude' no esta disponible en el PATH"
Write-Err "Asegurate de tener Claude Code instalado y accesible desde la terminal"
exit 1
}
# -- Instalacion ------------------------------------------------------------
Write-Host ""
Write-Host "Alfred Dev" -ForegroundColor White -NoNewline
Write-Host " v$Version" -ForegroundColor DarkGray
Write-Host "Plugin de ingenieria de software automatizada" -ForegroundColor DarkGray
Write-Host ""
# -- 1. Registrar marketplace -----------------------------------------------
Write-Info "Registrando marketplace..."
$pluginKey = "$PluginName@$PluginName"
$pluginList = & claude plugin list 2>&1
if ($pluginList -match [regex]::Escape($pluginKey)) {
& claude plugin uninstall $pluginKey 2>&1 | Out-Null
}
$marketplaceList = & claude plugin marketplace list 2>&1
if ($marketplaceList -match $PluginName) {
& claude plugin marketplace remove $PluginName 2>&1 | Out-Null
}
$marketplaceResult = & claude plugin marketplace add $Repo 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Ok "Marketplace registrado"
}
else {
Write-Err "No se pudo registrar el marketplace"
Write-Err "Verifica tu conexion a internet y que el repositorio sea accesible:"
Write-Err " https://github.com/$Repo"
exit 1
}
$MarketplaceDir = Join-Path $ClaudeDir "plugins/marketplaces/$PluginName"
if (-not (Test-Path $MarketplaceDir -PathType Container)) {
Write-Info "El marketplace quedo declarado pero no aparecio en disco; reintentando..."
& claude plugin marketplace remove $PluginName 2>&1 | Out-Null
$marketplaceResult = & claude plugin marketplace add $Repo 2>&1
if ($LASTEXITCODE -eq 0 -and (Test-Path $MarketplaceDir -PathType Container)) {
Write-Ok "Marketplace refrescado correctamente en disco"
}
else {
Write-Err "El marketplace se registro, pero Claude Code no materializo el cache local"
Write-Err "El directorio esperado no existe: $MarketplaceDir"
Write-Err "Prueba a ejecutar manualmente:"
Write-Err " claude plugin marketplace remove $PluginName"
Write-Err " claude plugin marketplace add $Repo"
exit 1
}
}
# -- 2. Instalar plugin -----------------------------------------------------
Write-Info "Instalando plugin..."
$installResult = & claude plugin install $pluginKey 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Ok "Plugin instalado y habilitado"
}
else {
Write-Err "No se pudo instalar el plugin"
Write-Err "Puedes intentar instalarlo manualmente:"
Write-Err " claude plugin marketplace add $Repo"
Write-Err " claude plugin install $pluginKey"
exit 1
}
# -- Resultado --------------------------------------------------------------
Write-Host ""
Write-Host "Instalacion completada" -ForegroundColor Green
Write-Host ""
Write-Host " Reinicia Claude Code y ejecuta:"
Write-Host " /alfred-dev:help" -ForegroundColor White
Write-Host ""
Write-Host " Repositorio: https://github.com/$Repo" -ForegroundColor DarkGray
Write-Host " Documentacion: https://alfred-dev.com" -ForegroundColor DarkGray
Write-Host ""