1+ Write-Host " 🔧 Testing scoop manifest fix..."
2+
3+ if (Test-Path ' dist/scoop/zed-cli-win-unofficial.json' ) {
4+ Write-Host " ✅ Found scoop manifest, reading contents..."
5+
6+ # Read the original content as text to preserve formatting
7+ $content = Get-Content ' dist/scoop/zed-cli-win-unofficial.json' - Raw
8+
9+ Write-Host " 📄 Original manifest:"
10+ Write-Host $content
11+
12+ # Parse JSON to check current bin array (for logging only)
13+ $manifest = $content | ConvertFrom-Json
14+ Write-Host " "
15+ Write-Host " 📋 Current bin array:"
16+ $manifest.architecture ." 64bit" .bin | ForEach-Object { Write-Host " - $_ " }
17+
18+ # Use regex to find and modify the bin array while preserving formatting
19+ # This looks for the bin array pattern and adds zed.bat if not already present
20+ if ($content -notmatch ' "zed-cli-win-unofficial/zed\.bat"' ) {
21+ Write-Host " "
22+ Write-Host " 🔧 Adding zed.bat to bin array..."
23+
24+ # Find the bin array and add the new entry
25+ # Pattern matches: "bin": ["existing-entry"] or "bin": ["entry1", "entry2"]
26+ $pattern = ' ("bin":\s*\[\s*"[^"]+")(\s*\])'
27+ $replacement = ' $1, "zed-cli-win-unofficial/zed.bat"$2'
28+
29+ $updatedContent = $content -replace $pattern , $replacement
30+
31+ Write-Host " 📄 Updated manifest:"
32+ Write-Host $updatedContent
33+
34+ # Create bucket directory for testing
35+ if (-not (Test-Path ' bucket' )) {
36+ New-Item - ItemType Directory - Path ' bucket'
37+ Write-Host " "
38+ Write-Host " 📁 Created bucket directory (for testing)"
39+ }
40+
41+ # Save the updated manifest with preserved formatting
42+ $updatedContent | Set-Content ' bucket/zed-cli-win-unofficial.json' - NoNewline
43+ Write-Host " "
44+ Write-Host " 💾 Saved updated manifest to bucket/ (for testing)"
45+ Write-Host " ✅ Scoop manifest fix test successful!"
46+
47+ }
48+ else {
49+ Write-Host " "
50+ Write-Host " ✅ zed.bat already exists in bin array"
51+ }
52+
53+ }
54+ else {
55+ Write-Host " ❌ Scoop manifest not found"
56+ exit 1
57+ }
0 commit comments