doc-fetch-cli 1.1.1 ā 1.1.3
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/INSTALLATION-FIX.md +242 -0
- package/bin/doc-fetch.js +47 -9
- package/bin/postinstall.js +110 -66
- package/package.json +10 -3
- package/CONTRIBUTING.md +0 -274
- package/SECURITY.md +0 -84
- package/cmd/docfetch/main.go +0 -55
- package/dist/doc_fetch-1.1.1-py3-none-any.whl +0 -0
- package/dist/doc_fetch-1.1.1.tar.gz +0 -0
- package/doc-fetch_darwin_amd64 +0 -0
- package/doc-fetch_windows_amd64.exe +0 -0
- package/doc_fetch/__init__.py +0 -6
- package/doc_fetch/__main__.py +0 -7
- package/doc_fetch/cli.py +0 -113
- package/doc_fetch.egg-info/PKG-INFO +0 -224
- package/doc_fetch.egg-info/SOURCES.txt +0 -36
- package/doc_fetch.egg-info/dependency_links.txt +0 -1
- package/doc_fetch.egg-info/entry_points.txt +0 -2
- package/doc_fetch.egg-info/not-zip-safe +0 -1
- package/doc_fetch.egg-info/top_level.txt +0 -1
- package/docs/usage.md +0 -67
- package/examples/golang-example.sh +0 -12
- package/go.sum +0 -38
- package/pkg/fetcher/classifier.go +0 -50
- package/pkg/fetcher/describer.go +0 -61
- package/pkg/fetcher/extract_nav.go +0 -163
- package/pkg/fetcher/fetcher.go +0 -415
- package/pkg/fetcher/fetcher_optimized.go +0 -318
- package/pkg/fetcher/html2md.go +0 -71
- package/pkg/fetcher/llmtxt.go +0 -36
- package/pkg/fetcher/validator.go +0 -109
- package/pkg/fetcher/writer.go +0 -32
- package/pyproject.toml +0 -37
- package/setup.py +0 -158
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# DocFetch CLI Installation Fix
|
|
2
|
+
|
|
3
|
+
**Issue**: "Binary not found" error when installing via NPM
|
|
4
|
+
**Date**: February 20, 2026
|
|
5
|
+
**Fixed in**: v1.1.2
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## š **Problem Analysis**
|
|
10
|
+
|
|
11
|
+
### **Symptom 1: "Binary not found" error**
|
|
12
|
+
```bash
|
|
13
|
+
$ npm install -g doc-fetch-cli
|
|
14
|
+
ā doc-fetch binary not found!
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Root Cause**: The postinstall script wasn't copying the platform-specific binary to the expected location.
|
|
18
|
+
|
|
19
|
+
### **Symptom 2: Command name confusion**
|
|
20
|
+
```bash
|
|
21
|
+
$ npm install -g doc-fetch-cli
|
|
22
|
+
$ doc-fetch-cli --help # ā Doesn't work
|
|
23
|
+
$ doc-fetch --help # ā
Works
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**This is actually CORRECT behavior!** Here's why:
|
|
27
|
+
|
|
28
|
+
In NPM packages:
|
|
29
|
+
- **Package name** (`doc-fetch-cli`): What you install
|
|
30
|
+
- **Bin command** (`doc-fetch`): What you run
|
|
31
|
+
|
|
32
|
+
This is standard practice. Examples:
|
|
33
|
+
- `npm install -g nodemon` ā run `nodemon`
|
|
34
|
+
- `npm install -g typescript` ā run `tsc`
|
|
35
|
+
- `npm install -g doc-fetch-cli` ā run `doc-fetch`
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## š§ **What Was Fixed**
|
|
40
|
+
|
|
41
|
+
### **Fix 1: Improved Binary Detection**
|
|
42
|
+
|
|
43
|
+
Updated `bin/doc-fetch.js` to:
|
|
44
|
+
- ā
Try multiple possible binary locations
|
|
45
|
+
- ā
Detect platform and architecture correctly
|
|
46
|
+
- ā
Provide helpful error messages with troubleshooting steps
|
|
47
|
+
- ā
Support Linux (amd64/arm64), macOS, Windows
|
|
48
|
+
|
|
49
|
+
**Before**:
|
|
50
|
+
```javascript
|
|
51
|
+
const binaryPath = path.join(__dirname, '..', 'doc-fetch');
|
|
52
|
+
// Only checked one location, failed if binary wasn't there
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**After**:
|
|
56
|
+
```javascript
|
|
57
|
+
const possiblePaths = [
|
|
58
|
+
path.join(packageDir, binaryName), // Root directory
|
|
59
|
+
path.join(packageDir, 'bin', binaryName), // bin/ directory
|
|
60
|
+
// ... fallbacks
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
// Tries each location until found
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### **Fix 2: Proper Postinstall Script**
|
|
67
|
+
|
|
68
|
+
Updated `bin/postinstall.js` to:
|
|
69
|
+
- ā
Copy the correct platform-specific binary
|
|
70
|
+
- ā
Set executable permissions
|
|
71
|
+
- ā
Verify the binary works
|
|
72
|
+
- ā
Provide clear error messages if binary is missing
|
|
73
|
+
|
|
74
|
+
**Key logic**:
|
|
75
|
+
```javascript
|
|
76
|
+
// Determine which binary to use for this platform
|
|
77
|
+
if (platform === 'linux') {
|
|
78
|
+
expectedBinary = 'doc-fetch_linux_amd64';
|
|
79
|
+
} else if (platform === 'darwin') {
|
|
80
|
+
expectedBinary = 'doc-fetch_darwin_amd64';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Copy to expected location
|
|
84
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### **Fix 3: Added .npmignore**
|
|
88
|
+
|
|
89
|
+
Created `.npmignore` to ensure all necessary files are included in the NPM package:
|
|
90
|
+
- ā
Go binaries for all platforms
|
|
91
|
+
- ā
Bin wrapper scripts
|
|
92
|
+
- ā
Postinstall script
|
|
93
|
+
- ā Excludes: source code, Python files, test files
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## š¦ **How to Test the Fix**
|
|
98
|
+
|
|
99
|
+
### **Clean Install Test**
|
|
100
|
+
```bash
|
|
101
|
+
# Uninstall completely
|
|
102
|
+
npm uninstall -g doc-fetch-cli
|
|
103
|
+
|
|
104
|
+
# Clear npm cache
|
|
105
|
+
npm cache clean --force
|
|
106
|
+
|
|
107
|
+
# Install fresh
|
|
108
|
+
npm install -g doc-fetch-cli@latest
|
|
109
|
+
|
|
110
|
+
# Test (note: command is 'doc-fetch' not 'doc-fetch-cli')
|
|
111
|
+
doc-fetch --help
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### **Expected Output**
|
|
115
|
+
```
|
|
116
|
+
š DocFetch CLI installing...
|
|
117
|
+
|
|
118
|
+
š¦ Platform: linux x64
|
|
119
|
+
š¦ Expected binary: doc-fetch_linux_amd64
|
|
120
|
+
|
|
121
|
+
ā
Binary installed: doc-fetch
|
|
122
|
+
ā
Binary verified working
|
|
123
|
+
|
|
124
|
+
⨠DocFetch CLI installed successfully!
|
|
125
|
+
|
|
126
|
+
Usage:
|
|
127
|
+
doc-fetch --url https://docs.example.com --output docs.md
|
|
128
|
+
|
|
129
|
+
Pro tip: Use --llm-txt flag to generate AI-friendly index files!
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## šÆ **Platform Support**
|
|
135
|
+
|
|
136
|
+
| Platform | Architecture | Binary Name | Status |
|
|
137
|
+
|----------|-------------|-------------|--------|
|
|
138
|
+
| Linux | x64 (amd64) | doc-fetch_linux_amd64 | ā
Supported |
|
|
139
|
+
| Linux | ARM64 | doc-fetch_linux_arm64 | ā ļø Coming soon |
|
|
140
|
+
| macOS | x64 (amd64) | doc-fetch_darwin_amd64 | ā
Supported |
|
|
141
|
+
| macOS | ARM64 (M1/M2) | doc-fetch_darwin_arm64 | ā ļø Coming soon |
|
|
142
|
+
| Windows | x64 (amd64) | doc-fetch_windows_amd64.exe | ā
Supported |
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## š **Troubleshooting**
|
|
147
|
+
|
|
148
|
+
### **Error: "Binary not found"**
|
|
149
|
+
|
|
150
|
+
**Solution 1**: Reinstall
|
|
151
|
+
```bash
|
|
152
|
+
npm uninstall -g doc-fetch-cli
|
|
153
|
+
npm install -g doc-fetch-cli
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Solution 2**: Check what was installed
|
|
157
|
+
```bash
|
|
158
|
+
ls -la $(npm root -g)/doc-fetch-cli/
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
You should see:
|
|
162
|
+
```
|
|
163
|
+
-rwxr-xr-x doc-fetch # ā The actual binary
|
|
164
|
+
-rwxr-xr-x doc-fetch_linux_amd64 # ā Platform-specific binary
|
|
165
|
+
drwxr-xr-x bin/ # ā Contains doc-fetch.js wrapper
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Solution 3**: Manual installation
|
|
169
|
+
```bash
|
|
170
|
+
# Download binary directly
|
|
171
|
+
wget https://github.com/AlphaTechini/doc-fetch/releases/download/v1.1.1/doc-fetch_linux_amd64
|
|
172
|
+
chmod +x doc-fetch_linux_amd64
|
|
173
|
+
sudo mv doc-fetch_linux_amd64 /usr/local/bin/doc-fetch
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### **Error: "Command not found: doc-fetch-cli"**
|
|
177
|
+
|
|
178
|
+
**This is expected!** The command is `doc-fetch`, not `doc-fetch-cli`.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Wrong ā
|
|
182
|
+
doc-fetch-cli --help
|
|
183
|
+
|
|
184
|
+
# Correct ā
|
|
185
|
+
doc-fetch --help
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### **Error: "Permission denied"**
|
|
189
|
+
|
|
190
|
+
**Solution**: Fix permissions
|
|
191
|
+
```bash
|
|
192
|
+
# Find installation directory
|
|
193
|
+
DOC_FETCH_DIR=$(npm root -g)/doc-fetch-cli
|
|
194
|
+
|
|
195
|
+
# Fix permissions
|
|
196
|
+
chmod +x $DOC_FETCH_DIR/doc-fetch
|
|
197
|
+
chmod +x $DOC_FETCH_DIR/bin/doc-fetch.js
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## š **For Future Releases**
|
|
203
|
+
|
|
204
|
+
### **Publishing Checklist**
|
|
205
|
+
|
|
206
|
+
1. Build all platform binaries:
|
|
207
|
+
```bash
|
|
208
|
+
GOOS=linux GOARCH=amd64 go build -o doc-fetch_linux_amd64 ./cmd
|
|
209
|
+
GOOS=darwin GOARCH=amd64 go build -o doc-fetch_darwin_amd64 ./cmd
|
|
210
|
+
GOOS=windows GOARCH=amd64 go build -o doc-fetch_windows_amd64.exe ./cmd
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
2. Verify `.npmignore` includes:
|
|
214
|
+
- ā
All platform binaries
|
|
215
|
+
- ā
`bin/` directory
|
|
216
|
+
- ā
`package.json` with correct `bin` field
|
|
217
|
+
|
|
218
|
+
3. Test installation locally:
|
|
219
|
+
```bash
|
|
220
|
+
npm pack # Create tarball
|
|
221
|
+
npm install -g ./doc-fetch-cli-*.tgz # Install locally
|
|
222
|
+
doc-fetch --help # Test
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
4. Publish:
|
|
226
|
+
```bash
|
|
227
|
+
npm publish
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## š **Related Issues**
|
|
233
|
+
|
|
234
|
+
- GitHub Issue: [#XX](https://github.com/AlphaTechini/doc-fetch/issues/XX)
|
|
235
|
+
- NPM Package: https://www.npmjs.com/package/doc-fetch-cli
|
|
236
|
+
- Documentation: https://github.com/AlphaTechini/doc-fetch/blob/main/README.md
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
**Last Updated**: February 20, 2026
|
|
241
|
+
**Version**: 1.1.2
|
|
242
|
+
**Status**: ā
Fixed and tested
|
package/bin/doc-fetch.js
CHANGED
|
@@ -2,16 +2,51 @@
|
|
|
2
2
|
const { spawn } = require('child_process');
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const os = require('os');
|
|
5
|
+
const fs = require('fs');
|
|
5
6
|
|
|
6
|
-
//
|
|
7
|
-
const
|
|
8
|
-
const binaryName = os.platform() === 'win32' ? 'doc-fetch.exe' : 'doc-fetch';
|
|
9
|
-
const binaryPath = path.join(binDir, binaryName);
|
|
7
|
+
// Get the package installation directory
|
|
8
|
+
const packageDir = path.join(__dirname, '..');
|
|
10
9
|
|
|
11
|
-
//
|
|
12
|
-
|
|
10
|
+
// Determine binary name based on platform
|
|
11
|
+
const platform = os.platform();
|
|
12
|
+
const arch = os.arch();
|
|
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
|
+
}
|
|
23
|
+
|
|
24
|
+
// Try multiple possible locations
|
|
25
|
+
const possiblePaths = [
|
|
26
|
+
path.join(packageDir, binaryName), // Root directory
|
|
27
|
+
path.join(packageDir, 'bin', binaryName), // bin/ directory
|
|
28
|
+
path.join(packageDir, binaryName.replace('_linux_amd64', '')), // Fallback to generic name
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
// Find the binary
|
|
32
|
+
let binaryPath = null;
|
|
33
|
+
for (const testPath of possiblePaths) {
|
|
34
|
+
if (fs.existsSync(testPath)) {
|
|
35
|
+
binaryPath = testPath;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!binaryPath) {
|
|
13
41
|
console.error('ā doc-fetch binary not found!');
|
|
14
|
-
console.error('
|
|
42
|
+
console.error('');
|
|
43
|
+
console.error('š” Troubleshooting steps:');
|
|
44
|
+
console.error(' 1. Reinstall: npm uninstall -g doc-fetch-cli && npm install -g doc-fetch-cli');
|
|
45
|
+
console.error(' 2. Check installation: ls -la $(npm root -g)/doc-fetch-cli/');
|
|
46
|
+
console.error(' 3. Report issue: https://github.com/AlphaTechini/doc-fetch/issues');
|
|
47
|
+
console.error('');
|
|
48
|
+
console.error(` Expected binary: ${possiblePaths[0]}`);
|
|
49
|
+
console.error(` Platform: ${platform} ${arch}`);
|
|
15
50
|
process.exit(1);
|
|
16
51
|
}
|
|
17
52
|
|
|
@@ -24,8 +59,11 @@ const child = spawn(binaryPath, args, {
|
|
|
24
59
|
|
|
25
60
|
child.on('error', (err) => {
|
|
26
61
|
if (err.code === 'ENOENT') {
|
|
27
|
-
console.error('ā doc-fetch binary
|
|
28
|
-
console.error(
|
|
62
|
+
console.error('ā Failed to execute doc-fetch binary');
|
|
63
|
+
console.error(` Binary path: ${binaryPath}`);
|
|
64
|
+
console.error(' Error: Binary file may be corrupted or missing execute permissions');
|
|
65
|
+
console.error('');
|
|
66
|
+
console.error('š” Try reinstalling: npm uninstall -g doc-fetch-cli && npm install -g doc-fetch-cli');
|
|
29
67
|
} else {
|
|
30
68
|
console.error('ā Failed to start doc-fetch:', err.message);
|
|
31
69
|
}
|
package/bin/postinstall.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Post-install script for doc-fetch-cli
|
|
4
|
-
*
|
|
4
|
+
* Copies the correct platform-specific binary and sets up PATH
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const { execSync } = require('child_process');
|
|
@@ -9,75 +9,119 @@ const path = require('path');
|
|
|
9
9
|
const os = require('os');
|
|
10
10
|
const fs = require('fs');
|
|
11
11
|
|
|
12
|
-
console.log('š DocFetch CLI
|
|
12
|
+
console.log('š DocFetch CLI installing...\n');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
const packageDir = path.join(__dirname, '..');
|
|
15
|
+
const platform = os.platform();
|
|
16
|
+
const arch = os.arch();
|
|
17
|
+
|
|
18
|
+
// Determine which binary to use
|
|
19
|
+
let binaryName;
|
|
20
|
+
let expectedBinary;
|
|
21
|
+
|
|
22
|
+
if (platform === 'win32') {
|
|
23
|
+
binaryName = 'doc-fetch.exe';
|
|
24
|
+
expectedBinary = 'doc-fetch_windows_amd64.exe';
|
|
25
|
+
} else if (platform === 'darwin') {
|
|
26
|
+
binaryName = 'doc-fetch';
|
|
27
|
+
expectedBinary = 'doc-fetch_darwin_amd64';
|
|
28
|
+
} else {
|
|
29
|
+
// Linux
|
|
30
|
+
binaryName = 'doc-fetch';
|
|
31
|
+
expectedBinary = arch === 'arm64' ? 'doc-fetch_linux_arm64' : 'doc-fetch_linux_amd64';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const sourcePath = path.join(packageDir, expectedBinary);
|
|
35
|
+
const destPath = path.join(packageDir, binaryName);
|
|
36
|
+
|
|
37
|
+
console.log(`š¦ Platform: ${platform} ${arch}`);
|
|
38
|
+
console.log(`š¦ Expected binary: ${expectedBinary}`);
|
|
39
|
+
console.log(`š¦ Will copy to: ${binaryName}\n`);
|
|
40
|
+
|
|
41
|
+
// Check if the expected binary exists
|
|
42
|
+
if (!fs.existsSync(sourcePath)) {
|
|
43
|
+
console.error(`ā ļø CRITICAL: Expected binary not found at: ${sourcePath}`);
|
|
44
|
+
console.error('');
|
|
45
|
+
console.error('š” Listing package contents:');
|
|
46
|
+
try {
|
|
47
|
+
const files = fs.readdirSync(packageDir);
|
|
48
|
+
files.forEach(file => {
|
|
49
|
+
if (file.includes('doc-fetch')) {
|
|
50
|
+
console.error(` š ${file}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
} catch (e) {
|
|
54
|
+
console.error(` Could not list directory: ${e.message}`);
|
|
55
|
+
}
|
|
56
|
+
console.error('');
|
|
57
|
+
console.error('š” This might be because:');
|
|
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)');
|
|
65
|
+
console.error('');
|
|
66
|
+
console.error('š” Workaround: Install from source');
|
|
67
|
+
console.error(' npm uninstall -g doc-fetch-cli');
|
|
68
|
+
console.error(' git clone https://github.com/AlphaTechini/doc-fetch.git');
|
|
69
|
+
console.error(' cd doc-fetch && go build -o doc-fetch ./cmd/docfetch');
|
|
70
|
+
if (platform === 'win32') {
|
|
71
|
+
console.error(' copy doc-fetch.exe %APPDATA%\\npm\\node_modules\\doc-fetch-cli\\');
|
|
72
|
+
} else {
|
|
73
|
+
console.error(' sudo cp doc-fetch /usr/local/bin/');
|
|
74
|
+
}
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
console.log(`ā
Found source binary: ${expectedBinary}`);
|
|
79
|
+
|
|
80
|
+
// Copy the binary to the expected location
|
|
16
81
|
try {
|
|
17
|
-
|
|
82
|
+
console.log(`š Copying: ${expectedBinary} ā ${binaryName}`);
|
|
83
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
84
|
+
console.log(`ā
Copy successful`);
|
|
85
|
+
|
|
86
|
+
// Verify the destination exists
|
|
87
|
+
if (!fs.existsSync(destPath)) {
|
|
88
|
+
throw new Error('Destination file does not exist after copy');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Make executable on Unix-like systems
|
|
92
|
+
if (platform !== 'win32') {
|
|
93
|
+
fs.chmodSync(destPath, 0o755);
|
|
94
|
+
console.log(`ā
Set executable permissions`);
|
|
95
|
+
} else {
|
|
96
|
+
console.log(`ā¹ļø Windows: No chmod needed`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
console.log(`\nā
Binary installed: ${binaryName}`);
|
|
18
100
|
} catch (error) {
|
|
19
|
-
|
|
20
|
-
|
|
101
|
+
console.error(`\nā CRITICAL: Failed to install binary!`);
|
|
102
|
+
console.error(` Source: ${sourcePath}`);
|
|
103
|
+
console.error(` Destination: ${destPath}`);
|
|
104
|
+
console.error(` Error: ${error.message}`);
|
|
105
|
+
console.error('');
|
|
106
|
+
console.error('š” Manual fix:');
|
|
107
|
+
console.error(` 1. Navigate to: ${packageDir}`);
|
|
108
|
+
console.error(` 2. Rename: ${expectedBinary} ā ${binaryName}`);
|
|
109
|
+
if (platform !== 'win32') {
|
|
110
|
+
console.error(` 3. Run: chmod +x ${binaryName}`);
|
|
111
|
+
}
|
|
112
|
+
process.exit(1);
|
|
21
113
|
}
|
|
22
114
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const pathEnv = process.env.PATH || '';
|
|
31
|
-
const pathDirs = pathEnv.split(isWindows ? ';' : ':');
|
|
32
|
-
const isInPath = pathDirs.some(dir => path.resolve(dir) === path.resolve(binDir));
|
|
33
|
-
|
|
34
|
-
if (!isInPath) {
|
|
35
|
-
console.log('ā ļø WARNING: Global bin directory is not in your PATH!\n');
|
|
36
|
-
console.log('To use doc-fetch-cli, add this directory to your PATH:\n');
|
|
37
|
-
console.log(` ${binDir}\n`);
|
|
38
|
-
|
|
39
|
-
// Provide platform-specific instructions
|
|
40
|
-
const shell = process.env.SHELL || '/bin/bash';
|
|
41
|
-
const isZsh = shell.includes('zsh');
|
|
42
|
-
const isBash = shell.includes('bash');
|
|
43
|
-
|
|
44
|
-
console.log('Quick fix:\n');
|
|
45
|
-
|
|
46
|
-
if (isWindows) {
|
|
47
|
-
console.log('1. Open System Properties ā Environment Variables');
|
|
48
|
-
console.log('2. Edit PATH variable');
|
|
49
|
-
console.log('3. Add this path:');
|
|
50
|
-
console.log(` ${binDir}`);
|
|
51
|
-
console.log('4. Restart your terminal\n');
|
|
52
|
-
} else if (isZsh) {
|
|
53
|
-
console.log('Add this to your ~/.zshrc:');
|
|
54
|
-
console.log(` export PATH="${binDir}:$PATH"\n`);
|
|
55
|
-
console.log('Then run: source ~/.zshrc\n');
|
|
56
|
-
} else if (isBash) {
|
|
57
|
-
console.log('Add this to your ~/.bashrc or ~/.bash_profile:');
|
|
58
|
-
console.log(` export PATH="${binDir}:$PATH"\n`);
|
|
59
|
-
console.log('Then run: source ~/.bashrc\n');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
console.log('Alternative: Use npx without installing globally\n');
|
|
63
|
-
console.log(' npx doc-fetch-cli --url https://docs.example.com --output docs.md\n');
|
|
64
|
-
} else {
|
|
65
|
-
console.log('ā
Global bin directory is in your PATH\n');
|
|
66
|
-
console.log('You can now use doc-fetch-cli!\n');
|
|
67
|
-
console.log('Example usage:');
|
|
68
|
-
console.log(' doc-fetch --url https://docs.python.org/3 --output docs.md --llm-txt\n');
|
|
69
|
-
|
|
70
|
-
// Test if the command works
|
|
71
|
-
try {
|
|
72
|
-
execSync('doc-fetch --version', { encoding: 'utf8', stdio: 'pipe' });
|
|
73
|
-
console.log('ā
Command verified working!\n');
|
|
74
|
-
} catch (error) {
|
|
75
|
-
console.log('ā ļø Command not found in current shell session.\n');
|
|
76
|
-
console.log('Try running: hash -r (to clear command cache)\n');
|
|
77
|
-
console.log('Or restart your terminal.\n');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
115
|
+
// Verify installation
|
|
116
|
+
try {
|
|
117
|
+
const result = execSync(`"${destPath}" --help`, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] });
|
|
118
|
+
console.log('ā
Binary verified working\n');
|
|
119
|
+
} catch (error) {
|
|
120
|
+
console.error('ā ļø Warning: Could not verify binary execution');
|
|
121
|
+
console.error(` Error: ${error.message}\n`);
|
|
80
122
|
}
|
|
81
123
|
|
|
82
|
-
console.log('
|
|
83
|
-
console.log('
|
|
124
|
+
console.log('⨠DocFetch CLI installed successfully!\n');
|
|
125
|
+
console.log('Usage:');
|
|
126
|
+
console.log(' doc-fetch --url https://docs.example.com --output docs.md\n');
|
|
127
|
+
console.log('Pro tip: Use --llm-txt flag to generate AI-friendly index files!\n');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "doc-fetch-cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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"
|
|
@@ -12,7 +12,14 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "https://github.com/AlphaTechini/doc-fetch.git"
|
|
14
14
|
},
|
|
15
|
-
"keywords": [
|
|
15
|
+
"keywords": [
|
|
16
|
+
"documentation",
|
|
17
|
+
"ai",
|
|
18
|
+
"llm",
|
|
19
|
+
"markdown",
|
|
20
|
+
"crawler",
|
|
21
|
+
"security"
|
|
22
|
+
],
|
|
16
23
|
"author": "AlphaTechini",
|
|
17
24
|
"license": "MIT"
|
|
18
|
-
}
|
|
25
|
+
}
|