Repository navigation
Expand file tree
/
Copy pathinstall.ps1
More file actions
91 lines (79 loc) · 3.28 KB
/
Copy pathinstall.ps1
File metadata and controls
91 lines (79 loc) · 3.28 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
param(
[string]$InstallDir = "$HOME\.codex\marketplaces\drawio-scientific-illustrator",
[switch]$Link
)
$ErrorActionPreference = "Stop"
$Repository = "http://github.com/vector4wang/drawio-scientific-illustrator.git"
$Plugin = "drawio-scientific-illustrator@drawio-scientific-tools"
$ClaudeSkillNameLive = "drawio-live"
$ClaudeSkillDirLive = "$HOME\.claude\skills\$ClaudeSkillNameLive"
if (-not (Get-Command git -ErrorAction SilentlyContinue)) {
throw "Git is required. Install Git for Windows, then run this installer again."
}
$HasCodex = $null -ne (Get-Command codex -ErrorAction SilentlyContinue)
$HasClaude = $null -ne (Get-Command claude -ErrorAction SilentlyContinue)
if (-not $HasCodex -and -not $HasClaude) {
throw "Neither Codex CLI nor Claude Code CLI was found. Install at least one, then run this installer again."
}
# When only Claude Code is present the marketplace CLI is unavailable;
# the user has to register and install the plugin through slash commands.
$NeedsManualClaudeInstall = (-not $HasCodex) -and $HasClaude
# Clone or update the repository (shared)
if (Test-Path (Join-Path $InstallDir ".git")) {
Write-Host "Updating existing installation at $InstallDir ..."
git -C $InstallDir pull --ff-only
} elseif (Test-Path $InstallDir) {
throw "Install directory exists but is not this Git repository: $InstallDir"
} else {
Write-Host "Cloning to $InstallDir ..."
New-Item -ItemType Directory -Force -Path (Split-Path $InstallDir -Parent) | Out-Null
git clone $Repository $InstallDir
}
$Installed = @()
# Codex setup
if ($HasCodex) {
codex plugin marketplace add $InstallDir
codex plugin add $Plugin
$Installed += "Codex: $Plugin"
}
# Claude Code setup
if ($HasClaude) {
# Install drawio-live skill
New-Item -ItemType Directory -Force -Path $ClaudeSkillDirLive | Out-Null
$SkillSourceLive = Join-Path $InstallDir "claude-code\skills\$ClaudeSkillNameLive\SKILL.md"
$SkillTargetLive = Join-Path $ClaudeSkillDirLive "SKILL.md"
if ($Link) {
if (Test-Path $SkillTargetLive) { Remove-Item $SkillTargetLive -Force }
New-Item -ItemType SymbolicLink -Path $SkillTargetLive -Target $SkillSourceLive | Out-Null
$Installed += "Claude Code: drawio-live skill symlink -> $SkillSourceLive"
} else {
Copy-Item $SkillSourceLive $SkillTargetLive -Force
$Installed += "Claude Code: drawio-live skill installed to $ClaudeSkillDirLive"
}
$Installed += "Claude Code: .mcp.json available at $InstallDir\.mcp.json"
}
Write-Host "`n========================================"
Write-Host " Installation complete!"
Write-Host "========================================`n"
foreach ($item in $Installed) {
Write-Host " + $item"
}
Write-Host ""
if ($HasCodex) {
Write-Host " -> Restart Codex and start a new task before first use."
}
if ($HasClaude) {
if ($NeedsManualClaudeInstall) {
Write-Host " -> Claude Code: paste these two slash commands in a session:"
Write-Host ""
Write-Host " /plugin marketplace add '$InstallDir'"
Write-Host " /plugin install $Plugin"
} else {
Write-Host " -> Claude Code: open '$InstallDir' as your project directory."
Write-Host " The .mcp.json at the project root will be auto-detected."
}
if (-not $Link) {
Write-Host " Tip: re-run with -Link to auto-update the skill on git pull."
}
}
Write-Host ""