Skip to content

Commit 5ceb3a8

Browse files
committed
Add Windows PowerShell installation support and update editor configuration
- should be multiplatform (so support windows) - do we support antigravity IDE? - sometimes user doesn't have their editor in path, they can fix it via running command palette. they should get such hint in the installation script
1 parent d2aef46 commit 5ceb3a8

3 files changed

Lines changed: 114 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@
1313
<p align="center">Securely build from source for VS Code, Cursor, or Antigravity:</p>
1414

1515
<p align="center">
16+
<strong>macOS / Linux</strong><br>
1617
<code>curl -fsSL https://raw.githubusercontent.com/robertpiosik/CodeWebChat/main/install.sh | bash</code>
1718
</p>
1819

20+
<p align="center">
21+
<strong>Windows (PowerShell)</strong><br>
22+
<code>irm https://raw.githubusercontent.com/robertpiosik/CodeWebChat/main/install.ps1 | iex</code>
23+
</p>
24+
1925
<p align="center"><img src="https://github.com/robertpiosik/CodeWebChat/raw/HEAD/media/screenshot-1.png"></p>
2026

2127
## Privacy-first

‎install.ps1‎

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
# Check git first
4+
if (!(Get-Command git -ErrorAction SilentlyContinue)) {
5+
Write-Error "Error: git is required but not installed."
6+
exit 1
7+
}
8+
9+
# Validate Node.js version
10+
if (!(Get-Command node -ErrorAction SilentlyContinue)) {
11+
Write-Error "Error: Node.js version 20 or higher is required."
12+
exit 1
13+
}
14+
15+
$nodeVersion = (node -v) -replace '^v',''
16+
$major = [int]($nodeVersion -split '\.')[0]
17+
if ($major -lt 20) {
18+
Write-Error "Error: Node.js version 20 or higher is required (Node.js 22.x is recommended)."
19+
exit 1
20+
}
21+
22+
# Detect available editors in the system
23+
$availableEditors = @()
24+
$editorCmds = @()
25+
26+
function Check-Editor($Name, $Cmd) {
27+
if (Get-Command $Cmd -ErrorAction SilentlyContinue) {
28+
$script:availableEditors += $Name
29+
$script:editorCmds += $Cmd
30+
}
31+
}
32+
33+
Check-Editor "VS Code" "code"
34+
Check-Editor "VS Code Insiders" "code-insiders"
35+
Check-Editor "VSCodium" "codium"
36+
Check-Editor "Cursor" "cursor"
37+
Check-Editor "Antigravity" "agy-ide"
38+
39+
if ($availableEditors.Count -eq 0) {
40+
Write-Host "Hint: If your editor is installed, you might need to add its command to your PATH." -ForegroundColor Yellow
41+
Write-Host "Open your editor, open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P), and run a command like: `"Shell Command: Install 'cursor' command in PATH`" (or 'agy-ide', etc.)." -ForegroundColor Yellow
42+
Write-Error "Error: No supported editors found in your PATH."
43+
exit 1
44+
}
45+
46+
Write-Host "Detected editors:"
47+
for ($i = 0; $i -lt $availableEditors.Count; $i++) {
48+
Write-Host "$($i + 1)) $($availableEditors[$i])"
49+
}
50+
Write-Host "a) All detected editors"
51+
Write-Host "q) Quit`n"
52+
53+
$choice = Read-Host "Select editor(s) to install CWC to"
54+
55+
if ($choice -eq 'q' -or $choice -eq 'Q') {
56+
Write-Host "Installation cancelled."
57+
exit 0
58+
} elseif ($choice -ne 'a' -and $choice -ne 'A') {
59+
if ($choice -notmatch '^[0-9]+$' -or [int]$choice -lt 1 -or [int]$choice -gt $availableEditors.Count) {
60+
Write-Error "Invalid choice. Exiting."
61+
exit 1
62+
}
63+
}
64+
65+
$tmpDir = Join-Path $env:TEMP ("CWC_Install_" + [Guid]::NewGuid().ToString().Substring(0,8))
66+
New-Item -ItemType Directory -Path $tmpDir | Out-Null
67+
Write-Host "`nCloning repository into temporary directory..."
68+
git clone -q --depth 1 https://github.com/robertpiosik/CodeWebChat.git $tmpDir
69+
70+
Push-Location $tmpDir
71+
72+
Write-Host "Installing dependencies..."
73+
npx --yes pnpm install *>$null
74+
75+
Write-Host "Building extension..."
76+
Set-Location apps/editor
77+
npx --yes pnpm run build *>$null
78+
79+
$vsixFile = Get-ChildItem *.vsix | Select-Object -First 1
80+
81+
if (!$vsixFile) {
82+
Write-Error "Error: VSIX file was not generated."
83+
Pop-Location
84+
exit 1
85+
}
86+
87+
function Install-ToEditor($idx) {
88+
$editorName = $availableEditors[$idx]
89+
$editorCmd = $editorCmds[$idx]
90+
Write-Host "Installing to $editorName..."
91+
& $editorCmd --install-extension $vsixFile.FullName --force *>$null
92+
}
93+
94+
if ($choice -eq 'a' -or $choice -eq 'A') {
95+
for ($i = 0; $i -lt $availableEditors.Count; $i++) {
96+
Install-ToEditor $i
97+
}
98+
} else {
99+
Install-ToEditor ([int]$choice - 1)
100+
}
101+
102+
Write-Host "`nDone!"
103+
104+
Pop-Location
105+
Remove-Item -Recurse -Force $tmpDir

‎install.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ check_editor "VS Code" "code"
6262
check_editor "VS Code Insiders" "code-insiders"
6363
check_editor "VSCodium" "codium"
6464
check_editor "Cursor" "cursor"
65-
check_editor "Windsurf" "windsurf"
65+
check_editor "Antigravity" "agy-ide"
6666

6767
if [ ${#AVAILABLE_EDITORS[@]} -eq 0 ]; then
6868
echo "Error: No supported editors found in your PATH."
69+
echo "Hint: If your editor is installed, you might need to add its command to your PATH."
70+
echo "Open your editor, open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P), and run a command like: \"Shell Command: Install 'cursor' command in PATH\" (or 'agy-ide' etc.)."
6971
exit 1
7072
fi
7173

0 commit comments

Comments
 (0)