opendraft 1.6.4 → 1.6.13

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/bin/opendraft.js CHANGED
@@ -169,29 +169,97 @@ main()
169
169
  });
170
170
  }
171
171
 
172
- function showInstallInstructions() {
172
+ function hasHomebrew() {
173
+ try {
174
+ execSync('which brew', { encoding: 'utf8', stdio: 'pipe' });
175
+ return true;
176
+ } catch (e) {
177
+ return false;
178
+ }
179
+ }
180
+
181
+ function askQuestion(question) {
182
+ const readline = require('readline');
183
+ const rl = readline.createInterface({
184
+ input: process.stdin,
185
+ output: process.stdout
186
+ });
187
+
188
+ return new Promise((resolve) => {
189
+ rl.question(question, (answer) => {
190
+ rl.close();
191
+ resolve(answer.toLowerCase().trim());
192
+ });
193
+ });
194
+ }
195
+
196
+ async function installPythonWithHomebrew() {
197
+ print(`${CYAN}Installing Python 3.11 via Homebrew...${RESET}`);
198
+ print(`${GRAY}This may take a few minutes.${RESET}`);
173
199
  console.log();
174
- print(`${RED}Python 3.10+ is required but not found.${RESET}`);
200
+
201
+ try {
202
+ execSync('brew install python@3.11', { stdio: 'inherit' });
203
+ print(`${GREEN}✓${RESET} Python installed successfully!`);
204
+ return true;
205
+ } catch (e) {
206
+ print(`${RED}✗${RESET} Installation failed`);
207
+ return false;
208
+ }
209
+ }
210
+
211
+ async function showInstallInstructions() {
212
+ console.log();
213
+ print(`${YELLOW}Python 3.10+ is needed to run OpenDraft.${RESET}`);
175
214
  console.log();
176
215
 
177
216
  const platform = os.platform();
178
217
 
179
- if (platform === 'darwin') {
180
- print(`${BOLD}Install Python on macOS:${RESET}`);
218
+ if (platform === 'darwin' && hasHomebrew()) {
219
+ // macOS with Homebrew - offer auto-install
220
+ print(`Good news! We can install Python automatically.`);
181
221
  console.log();
222
+
223
+ const answer = await askQuestion(` Install Python now? (Y/n): `);
224
+
225
+ if (answer === '' || answer === 'y' || answer === 'yes') {
226
+ console.log();
227
+ const success = await installPythonWithHomebrew();
228
+ if (success) {
229
+ console.log();
230
+ print(`${GREEN}Ready!${RESET} Run this command again:`);
231
+ print(` ${CYAN}npx opendraft${RESET}`);
232
+ console.log();
233
+ return;
234
+ }
235
+ }
236
+
237
+ // User declined or install failed
238
+ console.log();
239
+ print(`To install manually:`);
182
240
  print(` ${CYAN}brew install python@3.11${RESET}`);
241
+
242
+ } else if (platform === 'darwin') {
243
+ // macOS without Homebrew
244
+ print(`Download Python from:`);
245
+ console.log();
246
+ print(` ${CYAN}https://python.org/downloads${RESET}`);
183
247
  console.log();
184
- print(`Or download from: ${CYAN}https://www.python.org/downloads/${RESET}`);
248
+ print(`${GRAY}(Click the big yellow "Download Python" button)${RESET}`);
249
+
185
250
  } else if (platform === 'win32') {
186
- print(`${BOLD}Install Python on Windows:${RESET}`);
251
+ print(`${BOLD}Download Python:${RESET}`);
252
+ console.log();
253
+ print(` ${CYAN}https://python.org/downloads${RESET}`);
187
254
  console.log();
188
- print(` 1. Download from: ${CYAN}https://www.python.org/downloads/${RESET}`);
189
- print(` 2. ${YELLOW}Check "Add Python to PATH" during installation${RESET}`);
255
+ print(` ${YELLOW}Important:${RESET} Check "Add Python to PATH" during install!`);
256
+
190
257
  } else {
191
- print(`${BOLD}Install Python on Linux:${RESET}`);
258
+ // Linux
259
+ print(`${BOLD}Install with your package manager:${RESET}`);
192
260
  console.log();
193
- print(` ${CYAN}sudo apt install python3 python3-pip${RESET} # Debian/Ubuntu`);
194
- print(` ${CYAN}sudo dnf install python3 python3-pip${RESET} # Fedora`);
261
+ print(` ${CYAN}sudo apt install python3 python3-pip${RESET} (Ubuntu/Debian)`);
262
+ print(` ${CYAN}sudo dnf install python3 python3-pip${RESET} (Fedora)`);
195
263
  }
196
264
 
197
265
  console.log();
@@ -246,8 +314,7 @@ async function main() {
246
314
  const python = checkPython();
247
315
 
248
316
  if (!python) {
249
- console.log();
250
- showInstallInstructions();
317
+ await showInstallInstructions();
251
318
  process.exit(1);
252
319
  }
253
320
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opendraft",
3
- "version": "1.6.4",
3
+ "version": "1.6.13",
4
4
  "description": "AI-powered research paper draft generator",
5
5
  "bin": {
6
6
  "opendraft": "./bin/opendraft.js"
package/logs/errors.log DELETED
File without changes
File without changes