Skip to content

Commit 34782b3

Browse files
committed
feat: add native Windows PowerShell installation script and update release workflow to support .zip artifacts
1 parent 6075d40 commit 34782b3

4 files changed

Lines changed: 124 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
uses: actions/upload-artifact@v7
8585
with:
8686
name: omni-${{ matrix.target }}
87-
path: dist/omni-${{ github.ref_name }}-${{ matrix.target }}.tar.gz*
87+
path: dist/omni-${{ github.ref_name }}-${{ matrix.target }}.*
8888

8989
release:
9090
name: Create Release
@@ -101,7 +101,7 @@ jobs:
101101
- name: Collect release files
102102
run: |
103103
mkdir -p release
104-
find artifacts -type f \( -name '*.tar.gz' -o -name '*.sha256' \) -exec cp {} release/ \;
104+
find artifacts -type f \( -name '*.tar.gz' -o -name '*.zip' -o -name '*.sha256' \) -exec cp {} release/ \;
105105
106106
echo "=== Release files ==="
107107
ls -la release/
@@ -118,6 +118,7 @@ jobs:
118118
generate_release_notes: true
119119
files: |
120120
release/*.tar.gz
121+
release/*.zip
121122
release/SHA256SUMS
122123
env:
123124
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

INSTALL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ brew install fajarhide/tap/omni
1414
curl -fsSL https://omni.weekndlabs.com/install | sh
1515
```
1616

17+
### Via PowerShell (Windows Native)
18+
19+
```powershell
20+
irm https://raw.githubusercontent.com/fajarhide/omni/main/scripts/install.ps1 | iex
21+
```
22+
1723
### From Source
1824

1925
```bash

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,16 @@ omni doctor --fix
135135
omni init --status
136136
```
137137

138-
On universal setup
138+
On universal setup (macOS / Linux / WSL)
139139
```bash
140140
curl -fsSL https://omni.weekndlabs.com/install | bash
141141
```
142142

143+
On Windows (Native PowerShell)
144+
```powershell
145+
irm https://raw.githubusercontent.com/fajarhide/omni/main/scripts/install.ps1 | iex
146+
```
147+
143148
## Custom Filters (TOML)
144149

145150
You can define your own distillation rules for custom internal tools:

scripts/install.ps1

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<#
2+
.SYNOPSIS
3+
OMNI - Universal Windows Install Script
4+
5+
.DESCRIPTION
6+
Installs the latest OMNI binary to $HOME\.local\bin\omni.exe.
7+
Supports: Windows (x86_64)
8+
9+
.EXAMPLE
10+
irm https://raw.githubusercontent.com/fajarhide/omni/main/scripts/install.ps1 | iex
11+
#>
12+
13+
$ErrorActionPreference = "Stop"
14+
15+
$Repo = "fajarhide/omni"
16+
$InstallDir = if ($env:OMNI_INSTALL_DIR) { $env:OMNI_INSTALL_DIR } else { "$env:USERPROFILE\.local\bin" }
17+
$Version = if ($env:OMNI_VERSION) { $env:OMNI_VERSION } else { "latest" }
18+
19+
Write-Host ""
20+
Write-Host " ┌─────────────────────────────────────┐" -ForegroundColor Cyan
21+
Write-Host " │ OMNI Installer │" -ForegroundColor Cyan
22+
Write-Host " │ Less noise. More signal. │" -ForegroundColor Cyan
23+
Write-Host " └─────────────────────────────────────┘" -ForegroundColor Cyan
24+
Write-Host ""
25+
26+
# --- Version Resolution ---
27+
if ($Version -eq "latest") {
28+
Write-Host "[omni] Fetching latest version from GitHub..." -ForegroundColor Cyan
29+
try {
30+
$ReleaseInfo = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/latest"
31+
$Version = $ReleaseInfo.tag_name
32+
} catch {
33+
Write-Error "[omni] Failed to fetch latest version from GitHub."
34+
exit 1
35+
}
36+
}
37+
38+
$Platform = "x86_64-pc-windows-msvc"
39+
$TargetUrl = "https://github.com/$Repo/releases/download/$Version/omni-$Version-$Platform.zip"
40+
$TmpDir = Join-Path $env:TEMP "omni_install_$([guid]::NewGuid().ToString().Substring(0,8))"
41+
$ZipFile = Join-Path $TmpDir "omni.zip"
42+
43+
Write-Host "[omni] Platform: $Platform" -ForegroundColor Cyan
44+
Write-Host "[omni] Version: $Version" -ForegroundColor Cyan
45+
Write-Host "[omni] Target: $InstallDir\omni.exe" -ForegroundColor Cyan
46+
Write-Host ""
47+
48+
# --- Download & Install ---
49+
if (-not (Test-Path $TmpDir)) {
50+
New-Item -ItemType Directory -Force -Path $TmpDir | Out-Null
51+
}
52+
53+
Write-Host "[omni] Downloading omni $Version for $Platform..." -ForegroundColor Cyan
54+
try {
55+
Invoke-WebRequest -Uri $TargetUrl -OutFile $ZipFile
56+
} catch {
57+
Write-Error "[omni] Download failed. Check if version $Version exists at: $TargetUrl"
58+
exit 1
59+
}
60+
61+
Write-Host "[omni] Extracting archive..." -ForegroundColor Cyan
62+
Expand-Archive -Path $ZipFile -DestinationPath $TmpDir -Force
63+
64+
if (-not (Test-Path $InstallDir)) {
65+
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
66+
}
67+
68+
$ExtractedExe = Join-Path $TmpDir "omni.exe"
69+
if (-not (Test-Path $ExtractedExe)) {
70+
Write-Error "[omni] Extract failed: omni.exe not found in downloaded archive."
71+
exit 1
72+
}
73+
74+
Copy-Item -Path $ExtractedExe -Destination "$InstallDir\omni.exe" -Force
75+
76+
# --- Cleanup ---
77+
Remove-Item -Path $TmpDir -Recurse -Force | Out-Null
78+
79+
Write-Host ""
80+
Write-Host "[omni] ✓ OMNI installed to $InstallDir\omni.exe" -ForegroundColor Green
81+
82+
# --- Verify ---
83+
try {
84+
$ExeVersion = & "$InstallDir\omni.exe" version
85+
Write-Host "[omni] Verified: $ExeVersion" -ForegroundColor Green
86+
} catch {
87+
Write-Host "[omni] Unable to verify executable easily." -ForegroundColor Yellow
88+
}
89+
90+
# --- PATH Check ---
91+
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
92+
if ($UserPath -notmatch [regex]::Escape($InstallDir)) {
93+
Write-Host ""
94+
Write-Host "[omni] $InstallDir is not in your PATH." -ForegroundColor Yellow
95+
Write-Host "[omni] Adding $InstallDir to your User PATH..." -ForegroundColor Cyan
96+
97+
$NewPath = "$UserPath;$InstallDir"
98+
[Environment]::SetEnvironmentVariable("Path", $NewPath, "User")
99+
100+
Write-Host "[omni] ✓ PATH updated successfully." -ForegroundColor Green
101+
Write-Host "[omni] IMPORTANT: You must restart your terminal or open a new PowerShell window to use the 'omni' command." -ForegroundColor Yellow
102+
}
103+
104+
Write-Host ""
105+
Write-Host " Next steps:"
106+
Write-Host " omni init --hook # Activate Claude Code hooks"
107+
Write-Host " omni doctor # Verify installation"
108+
Write-Host " omni stats # View savings after first session"
109+
Write-Host ""

0 commit comments

Comments
 (0)