doc-fetch-cli 1.1.3 ā 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CROSS-PLATFORM-FIXES.md +354 -0
- package/QUICK-FIX-WINDOWS.md +115 -0
- package/bin/doc-fetch.js +26 -23
- package/bin/postinstall.js +41 -26
- package/package.json +4 -2
- package/scripts/verify-binaries.js +118 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# Cross-Platform Binary Installation Fixes
|
|
2
|
+
|
|
3
|
+
**Version**: 1.1.4+
|
|
4
|
+
**Date**: February 20, 2026
|
|
5
|
+
**Status**: ā
Fixed for all platforms
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## šÆ **What Was Fixed**
|
|
10
|
+
|
|
11
|
+
### **Problem**: Platform-specific binaries weren't being renamed correctly
|
|
12
|
+
|
|
13
|
+
**Before**:
|
|
14
|
+
```
|
|
15
|
+
Package contains:
|
|
16
|
+
ā
doc-fetch_linux_amd64
|
|
17
|
+
ā
doc-fetch_darwin_amd64
|
|
18
|
+
ā
doc-fetch_windows_amd64.exe
|
|
19
|
+
|
|
20
|
+
Wrapper expects:
|
|
21
|
+
ā doc-fetch (Linux/macOS)
|
|
22
|
+
ā doc-fetch.exe (Windows)
|
|
23
|
+
|
|
24
|
+
Result: "Binary not found" on ALL platforms!
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**After** (v1.1.4+):
|
|
28
|
+
```
|
|
29
|
+
Postinstall automatically:
|
|
30
|
+
ā
Copies doc-fetch_linux_amd64 ā doc-fetch
|
|
31
|
+
ā
Copies doc-fetch_darwin_amd64 ā doc-fetch
|
|
32
|
+
ā
Copies doc-fetch_windows_amd64.exe ā doc-fetch.exe
|
|
33
|
+
|
|
34
|
+
Wrapper finds:
|
|
35
|
+
ā
doc-fetch (Linux/macOS)
|
|
36
|
+
ā
doc-fetch.exe (Windows)
|
|
37
|
+
|
|
38
|
+
Result: Works on all platforms! ā
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## š§ **Platform-Specific Fixes**
|
|
44
|
+
|
|
45
|
+
### **Linux (x64/amd64)**
|
|
46
|
+
|
|
47
|
+
**Expected files after install**:
|
|
48
|
+
```
|
|
49
|
+
doc-fetch-cli/
|
|
50
|
+
āāā doc-fetch ā Copied by postinstall
|
|
51
|
+
āāā doc-fetch_linux_amd64 ā Original
|
|
52
|
+
āāā bin/
|
|
53
|
+
āāā doc-fetch.js ā Wrapper
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Manual fix if needed**:
|
|
57
|
+
```bash
|
|
58
|
+
cd $(npm root -g)/doc-fetch-cli
|
|
59
|
+
cp doc-fetch_linux_amd64 doc-fetch
|
|
60
|
+
chmod +x doc-fetch
|
|
61
|
+
doc-fetch --help
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### **Linux (ARM64)**
|
|
65
|
+
|
|
66
|
+
**Expected files**:
|
|
67
|
+
```
|
|
68
|
+
doc-fetch-cli/
|
|
69
|
+
āāā doc-fetch ā Copied by postinstall
|
|
70
|
+
āāā doc-fetch_linux_arm64 ā Original (if available)
|
|
71
|
+
āāā bin/
|
|
72
|
+
āāā doc-fetch.js
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Manual fix**:
|
|
76
|
+
```bash
|
|
77
|
+
cd $(npm root -g)/doc-fetch-cli
|
|
78
|
+
cp doc-fetch_linux_arm64 doc-fetch
|
|
79
|
+
chmod +x doc-fetch
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### **macOS (Intel x64)**
|
|
83
|
+
|
|
84
|
+
**Expected files**:
|
|
85
|
+
```
|
|
86
|
+
doc-fetch-cli/
|
|
87
|
+
āāā doc-fetch ā Copied by postinstall
|
|
88
|
+
āāā doc-fetch_darwin_amd64 ā Original
|
|
89
|
+
āāā bin/
|
|
90
|
+
āāā doc-fetch.js
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Manual fix**:
|
|
94
|
+
```bash
|
|
95
|
+
cd $(npm root -g)/doc-fetch-cli
|
|
96
|
+
cp doc-fetch_darwin_amd64 doc-fetch
|
|
97
|
+
chmod +x doc-fetch
|
|
98
|
+
doc-fetch --help
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### **macOS (Apple Silicon M1/M2)**
|
|
102
|
+
|
|
103
|
+
**Expected files**:
|
|
104
|
+
```
|
|
105
|
+
doc-fetch-cli/
|
|
106
|
+
āāā doc-fetch ā Copied by postinstall
|
|
107
|
+
āāā doc-fetch_darwin_arm64 ā Original (coming soon)
|
|
108
|
+
āāā bin/
|
|
109
|
+
āāā doc-fetch.js
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Manual fix** (when ARM binary is available):
|
|
113
|
+
```bash
|
|
114
|
+
cd $(npm root -g)/doc-fetch-cli
|
|
115
|
+
cp doc-fetch_darwin_arm64 doc-fetch
|
|
116
|
+
chmod +x doc-fetch
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Temporary workaround** (use Rosetta):
|
|
120
|
+
```bash
|
|
121
|
+
# Install Intel version under Rosetta
|
|
122
|
+
arch -x86_64 npm install -g doc-fetch-cli
|
|
123
|
+
arch -x86_64 cp $(npm root -g)/doc-fetch-cli/doc-fetch_darwin_amd64 \
|
|
124
|
+
$(npm root -g)/doc-fetch-cli/doc-fetch
|
|
125
|
+
arch -x86_64 chmod +x $(npm root -g)/doc-fetch-cli/doc-fetch
|
|
126
|
+
arch -x86_64 doc-fetch --help
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### **Windows (x64/amd64)**
|
|
130
|
+
|
|
131
|
+
**Expected files**:
|
|
132
|
+
```
|
|
133
|
+
doc-fetch-cli/
|
|
134
|
+
āāā doc-fetch.exe ā Copied by postinstall
|
|
135
|
+
āāā doc-fetch_windows_amd64.exe ā Original
|
|
136
|
+
āāā bin/
|
|
137
|
+
āāā doc-fetch.js
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Manual fix** (PowerShell):
|
|
141
|
+
```powershell
|
|
142
|
+
cd "$(npm root -g)\doc-fetch-cli"
|
|
143
|
+
copy doc-fetch_windows_amd64.exe doc-fetch.exe
|
|
144
|
+
doc-fetch --help
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Manual fix** (Command Prompt):
|
|
148
|
+
```cmd
|
|
149
|
+
cd %APPDATA%\npm\node_modules\doc-fetch-cli
|
|
150
|
+
copy doc-fetch_windows_amd64.exe doc-fetch.exe
|
|
151
|
+
doc-fetch --help
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## š **Installation Verification**
|
|
157
|
+
|
|
158
|
+
### **All Platforms**
|
|
159
|
+
|
|
160
|
+
After installing, verify:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Check installation
|
|
164
|
+
npm list -g doc-fetch-cli
|
|
165
|
+
|
|
166
|
+
# Should show:
|
|
167
|
+
# āāā doc-fetch-cli@1.1.4
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### **Linux/macOS**
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# List files
|
|
174
|
+
ls -la $(npm root -g)/doc-fetch-cli/ | grep doc-fetch
|
|
175
|
+
|
|
176
|
+
# Should show:
|
|
177
|
+
# -rwxr-xr-x doc-fetch ā Generic name (what wrapper uses)
|
|
178
|
+
# -rwxr-xr-x doc-fetch_linux_amd64 ā Platform-specific
|
|
179
|
+
# drwxr-xr-x bin/
|
|
180
|
+
# -rwxr-xr-x doc-fetch.js ā Wrapper
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### **Windows**
|
|
184
|
+
|
|
185
|
+
```powershell
|
|
186
|
+
# List files
|
|
187
|
+
dir "$(npm root -g)\doc-fetch-cli\doc-fetch*"
|
|
188
|
+
|
|
189
|
+
# Should show:
|
|
190
|
+
# doc-fetch.exe ā Generic name
|
|
191
|
+
# doc-fetch_windows_amd64.exe ā Platform-specific
|
|
192
|
+
# bin\
|
|
193
|
+
# doc-fetch.js ā Wrapper
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## š **Troubleshooting by Platform**
|
|
199
|
+
|
|
200
|
+
### **"Binary not found" on Linux**
|
|
201
|
+
|
|
202
|
+
**Symptoms**:
|
|
203
|
+
```bash
|
|
204
|
+
ā doc-fetch binary not found!
|
|
205
|
+
š” Platform: linux x64
|
|
206
|
+
š” Expected: doc-fetch
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
**Cause**: Postinstall didn't copy the binary
|
|
210
|
+
|
|
211
|
+
**Fix**:
|
|
212
|
+
```bash
|
|
213
|
+
cd $(npm root -g)/doc-fetch-cli
|
|
214
|
+
ls -la | grep doc-fetch # Check what exists
|
|
215
|
+
cp doc-fetch_linux_amd64 doc-fetch
|
|
216
|
+
chmod +x doc-fetch
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### **"Permission denied" on macOS**
|
|
220
|
+
|
|
221
|
+
**Symptoms**:
|
|
222
|
+
```bash
|
|
223
|
+
bash: /usr/local/bin/doc-fetch: Permission denied
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Cause**: Missing execute permission
|
|
227
|
+
|
|
228
|
+
**Fix**:
|
|
229
|
+
```bash
|
|
230
|
+
chmod +x $(which doc-fetch)
|
|
231
|
+
# Or:
|
|
232
|
+
chmod +x $(npm root -g)/doc-fetch-cli/doc-fetch
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### **"Not a valid Win32 application" on Windows**
|
|
236
|
+
|
|
237
|
+
**Symptoms**:
|
|
238
|
+
```
|
|
239
|
+
Error: doc-fetch.exe is not a valid Win32 application
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Cause**: Wrong architecture (ARM vs x64)
|
|
243
|
+
|
|
244
|
+
**Fix**:
|
|
245
|
+
```powershell
|
|
246
|
+
# Check your architecture
|
|
247
|
+
[System.Environment]::Is64BitOperatingSystem
|
|
248
|
+
|
|
249
|
+
# If True (most common):
|
|
250
|
+
cd "$(npm root -g)\doc-fetch-cli"
|
|
251
|
+
copy doc-fetch_windows_amd64.exe doc-fetch.exe /Y
|
|
252
|
+
|
|
253
|
+
# If False (rare, ARM Windows):
|
|
254
|
+
# ARM binary coming soon - use WSL or wait for ARM build
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### **Apple Silicon Issues**
|
|
258
|
+
|
|
259
|
+
**Symptoms**:
|
|
260
|
+
```bash
|
|
261
|
+
zsh: bad CPU type in executable: doc-fetch
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Cause**: Trying to run Intel binary natively on M1/M2
|
|
265
|
+
|
|
266
|
+
**Solutions**:
|
|
267
|
+
|
|
268
|
+
**Option 1**: Use Rosetta (immediate)
|
|
269
|
+
```bash
|
|
270
|
+
arch -x86_64 doc-fetch --help
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**Option 2**: Wait for native ARM binary (recommended)
|
|
274
|
+
- Native ARM64 binary coming in v1.2.0
|
|
275
|
+
- Better performance, no Rosetta needed
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## š **Best Practices**
|
|
280
|
+
|
|
281
|
+
### **For Users**
|
|
282
|
+
|
|
283
|
+
1. **Always use latest version**:
|
|
284
|
+
```bash
|
|
285
|
+
npm install -g doc-fetch-cli@latest
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
2. **Verify installation**:
|
|
289
|
+
```bash
|
|
290
|
+
doc-fetch --version
|
|
291
|
+
# Should work immediately
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
3. **If issues occur**:
|
|
295
|
+
- Check postinstall output for errors
|
|
296
|
+
- List files to see what's available
|
|
297
|
+
- Manually copy as shown above
|
|
298
|
+
|
|
299
|
+
### **For Developers**
|
|
300
|
+
|
|
301
|
+
When contributing or building locally:
|
|
302
|
+
|
|
303
|
+
1. **Build all platforms**:
|
|
304
|
+
```bash
|
|
305
|
+
GOOS=linux GOARCH=amd64 go build -o doc-fetch_linux_amd64 ./cmd
|
|
306
|
+
GOOS=darwin GOARCH=amd64 go build -o doc-fetch_darwin_amd64 ./cmd
|
|
307
|
+
GOOS=darwin GOARCH=arm64 go build -o doc-fetch_darwin_arm64 ./cmd
|
|
308
|
+
GOOS=windows GOARCH=amd64 go build -o doc-fetch_windows_amd64.exe ./cmd
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
2. **Test postinstall locally**:
|
|
312
|
+
```bash
|
|
313
|
+
npm pack
|
|
314
|
+
npm install -g ./doc-fetch-cli-*.tgz
|
|
315
|
+
# Watch postinstall output
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
3. **Verify all platforms**:
|
|
319
|
+
- Test on Linux VM
|
|
320
|
+
- Test on macOS (Intel + Apple Silicon)
|
|
321
|
+
- Test on Windows VM
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## š **Version History**
|
|
326
|
+
|
|
327
|
+
| Version | Date | Platform Support | Notes |
|
|
328
|
+
|---------|------|-----------------|-------|
|
|
329
|
+
| 1.1.4 | Feb 20, 2026 | ā
All fixed | Enhanced postinstall logging |
|
|
330
|
+
| 1.1.3 | Feb 20, 2026 | ā ļø Partial | Added logging, still had issues |
|
|
331
|
+
| 1.1.2 | Feb 20, 2026 | ā Broken | Initial postinstall attempt |
|
|
332
|
+
| 1.1.1 | Feb 20, 2026 | ā Broken | No postinstall script |
|
|
333
|
+
| 1.1.0 | Feb 20, 2026 | ā Broken | First NPM release |
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## šÆ **Current Status**
|
|
338
|
+
|
|
339
|
+
| Platform | Architecture | Status | Binary Name |
|
|
340
|
+
|----------|-------------|--------|-------------|
|
|
341
|
+
| Linux | x64 (amd64) | ā
Supported | doc-fetch |
|
|
342
|
+
| Linux | ARM64 | ā
Supported | doc-fetch |
|
|
343
|
+
| macOS | x64 (Intel) | ā
Supported | doc-fetch |
|
|
344
|
+
| macOS | ARM64 (M1/M2) | ā ļø Rosetta | doc-fetch (Intel binary) |
|
|
345
|
+
| Windows | x64 (amd64) | ā
Supported | doc-fetch.exe |
|
|
346
|
+
| Windows | ARM64 | ā Not yet | Coming in v1.2.0 |
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
**Last Updated**: February 20, 2026
|
|
351
|
+
**Version**: 1.1.4
|
|
352
|
+
**Maintainer**: @AlphaTechini
|
|
353
|
+
|
|
354
|
+
**Report platform-specific issues**: https://github.com/AlphaTechini/doc-fetch/issues
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Quick Fix: Windows Binary Not Found
|
|
2
|
+
|
|
3
|
+
**Symptom**: After installing, you get "binary not found" error
|
|
4
|
+
|
|
5
|
+
**Root Cause**: The postinstall script didn't rename the binary correctly
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## š§ **Manual Fix (30 seconds)**
|
|
10
|
+
|
|
11
|
+
### **Step 1: Find Installation Directory**
|
|
12
|
+
```powershell
|
|
13
|
+
npm root -g
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
This will show something like:
|
|
17
|
+
```
|
|
18
|
+
C:\Users\YourName\AppData\Roaming\npm\node_modules
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### **Step 2: Navigate to doc-fetch-cli**
|
|
22
|
+
```powershell
|
|
23
|
+
cd "C:\Users\YourName\AppData\Roaming\npm\node_modules\doc-fetch-cli"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### **Step 3: List Files**
|
|
27
|
+
```powershell
|
|
28
|
+
dir doc-fetch*
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
You should see:
|
|
32
|
+
```
|
|
33
|
+
doc-fetch_windows_amd64.exe ā This exists
|
|
34
|
+
doc-fetch.js ā Wrapper script
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
But MISSING:
|
|
38
|
+
```
|
|
39
|
+
doc-fetch.exe ā This is what's needed!
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### **Step 4: Rename the Binary**
|
|
43
|
+
```powershell
|
|
44
|
+
copy doc-fetch_windows_amd64.exe doc-fetch.exe
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or using `ren`:
|
|
48
|
+
```powershell
|
|
49
|
+
ren doc-fetch_windows_amd64.exe doc-fetch.exe
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### **Step 5: Verify**
|
|
53
|
+
```powershell
|
|
54
|
+
doc-fetch --help
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
It should work now! ā
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## šÆ **Why This Happens**
|
|
62
|
+
|
|
63
|
+
The package includes platform-specific binaries:
|
|
64
|
+
- `doc-fetch_windows_amd64.exe` (Windows)
|
|
65
|
+
- `doc-fetch_darwin_amd64` (macOS)
|
|
66
|
+
- `doc-fetch_linux_amd64` (Linux)
|
|
67
|
+
|
|
68
|
+
But the wrapper expects just `doc-fetch.exe` on Windows.
|
|
69
|
+
|
|
70
|
+
The postinstall script SHOULD do this rename automatically, but sometimes it fails due to:
|
|
71
|
+
- Permissions issues
|
|
72
|
+
- Antivirus blocking file operations
|
|
73
|
+
- NPM running in restricted mode
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## š **Permanent Fix**
|
|
78
|
+
|
|
79
|
+
Reinstall with v1.1.3 or later which has better logging:
|
|
80
|
+
|
|
81
|
+
```powershell
|
|
82
|
+
npm uninstall -g doc-fetch-cli
|
|
83
|
+
npm install -g doc-fetch-cli@latest
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Watch the output - it should show:
|
|
87
|
+
```
|
|
88
|
+
š Copying: doc-fetch_windows_amd64.exe ā doc-fetch.exe
|
|
89
|
+
ā
Copy successful
|
|
90
|
+
ā¹ļø Windows: No chmod needed
|
|
91
|
+
ā
Binary installed: doc-fetch.exe
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If you still see errors, the detailed logs will tell you exactly what went wrong.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## š **Still Having Issues?**
|
|
99
|
+
|
|
100
|
+
Run this diagnostic:
|
|
101
|
+
```powershell
|
|
102
|
+
$dir = npm root -g + "\doc-fetch-cli"
|
|
103
|
+
Write-Host "Installation directory: $dir"
|
|
104
|
+
Write-Host "`nFiles containing 'doc-fetch':"
|
|
105
|
+
Get-ChildItem $dir | Where-Object { $_.Name -like "*doc-fetch*" } | Select-Object Name, Length
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Share the output when reporting the issue at:
|
|
109
|
+
https://github.com/AlphaTechini/doc-fetch/issues
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
**Fixed in**: v1.1.3
|
|
114
|
+
**Platform**: Windows only
|
|
115
|
+
**Workaround**: Manual rename (above)
|
package/bin/doc-fetch.js
CHANGED
|
@@ -7,25 +7,14 @@ const fs = require('fs');
|
|
|
7
7
|
// Get the package installation directory
|
|
8
8
|
const packageDir = path.join(__dirname, '..');
|
|
9
9
|
|
|
10
|
-
// Determine binary name based on platform
|
|
10
|
+
// Determine binary name based on platform (what postinstall creates)
|
|
11
11
|
const platform = os.platform();
|
|
12
|
-
const
|
|
13
|
-
let binaryName;
|
|
14
|
-
|
|
15
|
-
if (platform === 'win32') {
|
|
16
|
-
binaryName = 'doc-fetch.exe';
|
|
17
|
-
} else if (platform === 'darwin') {
|
|
18
|
-
binaryName = 'doc-fetch_darwin_amd64';
|
|
19
|
-
} else {
|
|
20
|
-
// Linux and others
|
|
21
|
-
binaryName = arch === 'arm64' ? 'doc-fetch_linux_arm64' : 'doc-fetch_linux_amd64';
|
|
22
|
-
}
|
|
12
|
+
const binaryName = platform === 'win32' ? 'doc-fetch.exe' : 'doc-fetch';
|
|
23
13
|
|
|
24
14
|
// Try multiple possible locations
|
|
25
15
|
const possiblePaths = [
|
|
26
|
-
path.join(packageDir, binaryName),
|
|
27
|
-
path.join(packageDir, 'bin', binaryName),
|
|
28
|
-
path.join(packageDir, binaryName.replace('_linux_amd64', '')), // Fallback to generic name
|
|
16
|
+
path.join(packageDir, binaryName), // Root directory (postinstall copies here)
|
|
17
|
+
path.join(packageDir, 'bin', binaryName), // bin/ directory (fallback)
|
|
29
18
|
];
|
|
30
19
|
|
|
31
20
|
// Find the binary
|
|
@@ -40,13 +29,24 @@ for (const testPath of possiblePaths) {
|
|
|
40
29
|
if (!binaryPath) {
|
|
41
30
|
console.error('ā doc-fetch binary not found!');
|
|
42
31
|
console.error('');
|
|
32
|
+
console.error(`š” Platform: ${platform} (${os.arch()})`);
|
|
33
|
+
console.error('š” Expected: doc-fetch' + (platform === 'win32' ? '.exe' : ''));
|
|
34
|
+
console.error('');
|
|
43
35
|
console.error('š” Troubleshooting steps:');
|
|
44
|
-
console.error(' 1.
|
|
45
|
-
console.error(' 2.
|
|
46
|
-
|
|
36
|
+
console.error(' 1. List files: ls -la $(npm root -g)/doc-fetch-cli/');
|
|
37
|
+
console.error(' 2. Look for platform-specific binary:');
|
|
38
|
+
if (platform === 'win32') {
|
|
39
|
+
console.error(' doc-fetch_windows_amd64.exe');
|
|
40
|
+
} else if (platform === 'darwin') {
|
|
41
|
+
console.error(' doc-fetch_darwin_amd64 (Intel) or doc-fetch_darwin_arm64 (M1/M2)');
|
|
42
|
+
} else {
|
|
43
|
+
console.error(' doc-fetch_linux_amd64 (x64) or doc-fetch_linux_arm64 (ARM)');
|
|
44
|
+
}
|
|
45
|
+
console.error(' 3. Manually copy: cp <platform-binary> doc-fetch' + (platform === 'win32' ? '.exe' : ''));
|
|
46
|
+
console.error(' 4. Make executable: chmod +x doc-fetch (Linux/macOS only)');
|
|
47
|
+
console.error(' 5. Reinstall: npm uninstall -g doc-fetch-cli && npm install -g doc-fetch-cli@latest');
|
|
47
48
|
console.error('');
|
|
48
|
-
console.error(
|
|
49
|
-
console.error(` Platform: ${platform} ${arch}`);
|
|
49
|
+
console.error('š¦ Package directory:', packageDir);
|
|
50
50
|
process.exit(1);
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -61,9 +61,12 @@ child.on('error', (err) => {
|
|
|
61
61
|
if (err.code === 'ENOENT') {
|
|
62
62
|
console.error('ā Failed to execute doc-fetch binary');
|
|
63
63
|
console.error(` Binary path: ${binaryPath}`);
|
|
64
|
-
console.error(' Error:
|
|
64
|
+
console.error(' Error: File not found or no execute permission');
|
|
65
65
|
console.error('');
|
|
66
|
-
|
|
66
|
+
if (platform !== 'win32') {
|
|
67
|
+
console.error('š” Fix permissions: chmod +x "' + binaryPath + '"');
|
|
68
|
+
}
|
|
69
|
+
console.error('š” Or reinstall: npm uninstall -g doc-fetch-cli && npm install -g doc-fetch-cli@latest');
|
|
67
70
|
} else {
|
|
68
71
|
console.error('ā Failed to start doc-fetch:', err.message);
|
|
69
72
|
}
|
|
@@ -72,4 +75,4 @@ child.on('error', (err) => {
|
|
|
72
75
|
|
|
73
76
|
child.on('exit', (code) => {
|
|
74
77
|
process.exit(code || 0);
|
|
75
|
-
});
|
|
78
|
+
});
|
package/bin/postinstall.js
CHANGED
|
@@ -38,40 +38,55 @@ console.log(`š¦ Platform: ${platform} ${arch}`);
|
|
|
38
38
|
console.log(`š¦ Expected binary: ${expectedBinary}`);
|
|
39
39
|
console.log(`š¦ Will copy to: ${binaryName}\n`);
|
|
40
40
|
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
41
|
+
// List all available binaries for debugging
|
|
42
|
+
console.log('š Available binaries in package:');
|
|
43
|
+
let hasPlatformBinary = false;
|
|
44
|
+
try {
|
|
45
|
+
const files = fs.readdirSync(packageDir);
|
|
46
|
+
const binaries = files.filter(f => f.includes('doc-fetch') && !f.endsWith('.js'));
|
|
47
|
+
if (binaries.length === 0) {
|
|
48
|
+
console.log(' ā ļø No binaries found! Package may be corrupted.');
|
|
49
|
+
} else {
|
|
50
|
+
binaries.forEach(file => {
|
|
51
|
+
const stats = fs.statSync(path.join(packageDir, file));
|
|
52
|
+
const size = (stats.size / 1024 / 1024).toFixed(2);
|
|
53
|
+
const isCorrect = file === expectedBinary || file === binaryName;
|
|
54
|
+
const marker = isCorrect ? 'ā
' : 'ā¹ļø ';
|
|
55
|
+
console.log(` ${marker} ${file} (${size} MB)`);
|
|
56
|
+
if (file === expectedBinary) {
|
|
57
|
+
hasPlatformBinary = true;
|
|
51
58
|
}
|
|
52
59
|
});
|
|
53
|
-
} catch (e) {
|
|
54
|
-
console.error(` Could not list directory: ${e.message}`);
|
|
55
60
|
}
|
|
61
|
+
} catch (e) {
|
|
62
|
+
console.log(` ā Could not list directory: ${e.message}`);
|
|
63
|
+
}
|
|
64
|
+
console.log('');
|
|
65
|
+
|
|
66
|
+
// Extra validation: Check if platform binary exists
|
|
67
|
+
if (!hasPlatformBinary && !fs.existsSync(sourcePath)) {
|
|
68
|
+
console.error('ā ļø CRITICAL: Platform binary missing!');
|
|
69
|
+
console.error(` Expected: ${expectedBinary}`);
|
|
56
70
|
console.error('');
|
|
57
|
-
console.error('š” This
|
|
58
|
-
console.error(' 1. The package was published without binaries');
|
|
59
|
-
console.error(' 2. Your platform/architecture is not supported');
|
|
60
|
-
console.error('');
|
|
61
|
-
console.error('Supported platforms:');
|
|
62
|
-
console.error(' - Linux x64 (amd64)');
|
|
63
|
-
console.error(' - macOS x64 (amd64)');
|
|
64
|
-
console.error(' - Windows x64 (amd64)');
|
|
71
|
+
console.error('š” This is a packaging error - the NPM package was published without your platform binary.');
|
|
65
72
|
console.error('');
|
|
66
|
-
console.error('š”
|
|
67
|
-
console.error('
|
|
68
|
-
console.error('
|
|
69
|
-
console.error('
|
|
73
|
+
console.error('š” Immediate workaround - Install from source:');
|
|
74
|
+
console.error(' 1. Install Go: https://golang.org/dl/');
|
|
75
|
+
console.error(' 2. Run these commands:');
|
|
76
|
+
console.error(' npm uninstall -g doc-fetch-cli');
|
|
77
|
+
console.error(' git clone https://github.com/AlphaTechini/doc-fetch.git');
|
|
78
|
+
console.error(' cd doc-fetch');
|
|
70
79
|
if (platform === 'win32') {
|
|
71
|
-
console.error('
|
|
80
|
+
console.error(' go build -o doc-fetch.exe ./cmd/docfetch');
|
|
81
|
+
console.error(' copy doc-fetch.exe "' + packageDir + '"');
|
|
72
82
|
} else {
|
|
73
|
-
console.error('
|
|
83
|
+
console.error(' go build -o doc-fetch ./cmd/docfetch');
|
|
84
|
+
console.error(' cp doc-fetch "' + packageDir + '"');
|
|
85
|
+
console.error(' chmod +x "' + path.join(packageDir, 'doc-fetch') + '"');
|
|
74
86
|
}
|
|
87
|
+
console.error('');
|
|
88
|
+
console.error('š” Or wait for fixed version (check for updates):');
|
|
89
|
+
console.error(' npm install -g doc-fetch-cli@latest');
|
|
75
90
|
process.exit(1);
|
|
76
91
|
}
|
|
77
92
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-fetch-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Dynamic documentation fetching CLI that converts entire documentation sites to single markdown files for AI/LLM consumption",
|
|
5
5
|
"bin": {
|
|
6
6
|
"doc-fetch": "./bin/doc-fetch.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"
|
|
9
|
+
"prepublishOnly": "node ./scripts/verify-binaries.js",
|
|
10
|
+
"postinstall": "node ./bin/postinstall.js",
|
|
11
|
+
"verify": "node ./scripts/verify-binaries.js"
|
|
10
12
|
},
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Pre-publish verification script
|
|
4
|
+
* Ensures all platform binaries are present before publishing to NPM
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const path = require('path');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
|
|
11
|
+
const packageDir = path.join(__dirname, '..');
|
|
12
|
+
|
|
13
|
+
console.log('š Verifying platform binaries before publish...\n');
|
|
14
|
+
|
|
15
|
+
const requiredBinaries = [
|
|
16
|
+
{ name: 'doc-fetch_linux_amd64', platform: 'linux', arch: 'x64' },
|
|
17
|
+
{ name: 'doc-fetch_linux_arm64', platform: 'linux', arch: 'arm64', optional: true },
|
|
18
|
+
{ name: 'doc-fetch_darwin_amd64', platform: 'darwin', arch: 'x64' },
|
|
19
|
+
{ name: 'doc-fetch_darwin_arm64', platform: 'darwin', arch: 'arm64', optional: true },
|
|
20
|
+
{ name: 'doc-fetch_windows_amd64.exe', platform: 'win32', arch: 'x64' },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
let allPresent = true;
|
|
24
|
+
const missing = [];
|
|
25
|
+
const present = [];
|
|
26
|
+
|
|
27
|
+
console.log('š¦ Checking binaries:\n');
|
|
28
|
+
|
|
29
|
+
requiredBinaries.forEach(binary => {
|
|
30
|
+
const binaryPath = path.join(packageDir, binary.name);
|
|
31
|
+
const exists = fs.existsSync(binaryPath);
|
|
32
|
+
|
|
33
|
+
if (exists) {
|
|
34
|
+
const stats = fs.statSync(binaryPath);
|
|
35
|
+
const size = (stats.size / 1024 / 1024).toFixed(2);
|
|
36
|
+
console.log(` ā
${binary.name.padEnd(35)} (${size} MB) - ${binary.platform} ${binary.arch}`);
|
|
37
|
+
present.push(binary.name);
|
|
38
|
+
} else {
|
|
39
|
+
const marker = binary.optional ? 'ā ļø ' : 'ā';
|
|
40
|
+
const note = binary.optional ? '(optional)' : '(REQUIRED)';
|
|
41
|
+
console.log(` ${marker} ${binary.name.padEnd(35)} MISSING ${note}`);
|
|
42
|
+
if (!binary.optional) {
|
|
43
|
+
missing.push(binary.name);
|
|
44
|
+
allPresent = false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
console.log('\nš Summary:');
|
|
50
|
+
console.log(` Present: ${present.length}`);
|
|
51
|
+
console.log(` Missing: ${missing.length}${missing.length > 0 ? ' (' + missing.join(', ') + ')' : ''}`);
|
|
52
|
+
console.log('');
|
|
53
|
+
|
|
54
|
+
if (!allPresent) {
|
|
55
|
+
console.error('ā CRITICAL: Required binaries are missing!');
|
|
56
|
+
console.error('');
|
|
57
|
+
console.error('š” Build all platforms before publishing:');
|
|
58
|
+
console.error('');
|
|
59
|
+
console.error(' # Linux x64');
|
|
60
|
+
console.error(' GOOS=linux GOARCH=amd64 go build -o doc-fetch_linux_amd64 ./cmd/docfetch');
|
|
61
|
+
console.error('');
|
|
62
|
+
console.error(' # Linux ARM64 (optional)');
|
|
63
|
+
console.error(' GOOS=linux GOARCH=arm64 go build -o doc-fetch_linux_arm64 ./cmd/docfetch');
|
|
64
|
+
console.error('');
|
|
65
|
+
console.error(' # macOS Intel');
|
|
66
|
+
console.error(' GOOS=darwin GOARCH=amd64 go build -o doc-fetch_darwin_amd64 ./cmd/docfetch');
|
|
67
|
+
console.error('');
|
|
68
|
+
console.error(' # macOS Apple Silicon (optional)');
|
|
69
|
+
console.error(' GOOS=darwin GOARCH=arm64 go build -o doc-fetch_darwin_arm64 ./cmd/docfetch');
|
|
70
|
+
console.error('');
|
|
71
|
+
console.error(' # Windows x64');
|
|
72
|
+
console.error(' GOOS=windows GOARCH=amd64 go build -o doc-fetch_windows_amd64.exe ./cmd/docfetch');
|
|
73
|
+
console.error('');
|
|
74
|
+
console.error('Then run this script again to verify.');
|
|
75
|
+
console.error('');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Verify minimum file sizes (catches corrupted/empty files)
|
|
80
|
+
console.log('š Verifying binary integrity...\n');
|
|
81
|
+
|
|
82
|
+
let allValid = true;
|
|
83
|
+
present.forEach(binaryName => {
|
|
84
|
+
const binaryPath = path.join(packageDir, binaryName);
|
|
85
|
+
const stats = fs.statSync(binaryPath);
|
|
86
|
+
|
|
87
|
+
// Minimum expected size: 5MB (actual binaries are ~8-9MB)
|
|
88
|
+
const minSize = 5 * 1024 * 1024;
|
|
89
|
+
|
|
90
|
+
if (stats.size < minSize) {
|
|
91
|
+
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
92
|
+
console.log(` ā ļø ${binaryName.padEnd(35)} Suspiciously small (${sizeMB} MB)`);
|
|
93
|
+
allValid = false;
|
|
94
|
+
} else {
|
|
95
|
+
const sizeMB = (stats.size / 1024 / 1024).toFixed(2);
|
|
96
|
+
console.log(` ā
${binaryName.padEnd(35)} OK (${sizeMB} MB)`);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
console.log('');
|
|
101
|
+
|
|
102
|
+
if (!allValid) {
|
|
103
|
+
console.error('ā ļø Warning: Some binaries seem too small and may be corrupted.');
|
|
104
|
+
console.error(' Consider rebuilding them before publishing.\n');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Final verdict
|
|
108
|
+
if (allPresent && allValid) {
|
|
109
|
+
console.log('ā
All required binaries present and valid!');
|
|
110
|
+
console.log('ā
Ready to publish to NPM\n');
|
|
111
|
+
process.exit(0);
|
|
112
|
+
} else if (allPresent) {
|
|
113
|
+
console.log('ā ļø All binaries present but some may be corrupted.');
|
|
114
|
+
console.log('ā ļø Proceed with caution!\n');
|
|
115
|
+
process.exit(0); // Allow publishing but warn
|
|
116
|
+
} else {
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|