opendraft 1.5.0 → 1.6.1
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 +50 -17
- package/package.json +1 -1
package/bin/opendraft.js
CHANGED
|
@@ -48,19 +48,39 @@ ${PURPLE}${BOLD} ╔═══════════════════
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function checkPython() {
|
|
51
|
-
|
|
51
|
+
const home = os.homedir();
|
|
52
|
+
|
|
53
|
+
// Check various Python commands including conda, pyenv, Homebrew, python.org
|
|
52
54
|
const pythonCommands = [
|
|
53
55
|
'python3',
|
|
54
56
|
'python',
|
|
57
|
+
// Conda (common locations)
|
|
58
|
+
`${home}/anaconda3/bin/python`,
|
|
59
|
+
`${home}/miniconda3/bin/python`,
|
|
60
|
+
`${home}/miniforge3/bin/python`,
|
|
61
|
+
`${home}/mambaforge/bin/python`,
|
|
62
|
+
'/opt/anaconda3/bin/python',
|
|
63
|
+
'/opt/miniconda3/bin/python',
|
|
64
|
+
// pyenv
|
|
65
|
+
`${home}/.pyenv/shims/python3`,
|
|
66
|
+
`${home}/.pyenv/shims/python`,
|
|
67
|
+
// Homebrew
|
|
68
|
+
'/opt/homebrew/bin/python3',
|
|
69
|
+
'/opt/homebrew/bin/python3.13',
|
|
70
|
+
'/opt/homebrew/bin/python3.12',
|
|
71
|
+
'/opt/homebrew/bin/python3.11',
|
|
72
|
+
'/usr/local/bin/python3',
|
|
73
|
+
// python.org macOS installer
|
|
74
|
+
'/Library/Frameworks/Python.framework/Versions/3.13/bin/python3',
|
|
75
|
+
'/Library/Frameworks/Python.framework/Versions/3.12/bin/python3',
|
|
76
|
+
'/Library/Frameworks/Python.framework/Versions/3.11/bin/python3',
|
|
77
|
+
'/Library/Frameworks/Python.framework/Versions/3.10/bin/python3',
|
|
78
|
+
// Versioned commands (fallback)
|
|
55
79
|
'python3.13',
|
|
56
80
|
'python3.12',
|
|
57
81
|
'python3.11',
|
|
58
82
|
'python3.10',
|
|
59
83
|
'python3.9',
|
|
60
|
-
'/opt/homebrew/bin/python3',
|
|
61
|
-
'/opt/homebrew/bin/python3.11',
|
|
62
|
-
'/opt/homebrew/bin/python3.12',
|
|
63
|
-
'/usr/local/bin/python3',
|
|
64
84
|
];
|
|
65
85
|
|
|
66
86
|
for (const cmd of pythonCommands) {
|
|
@@ -237,33 +257,49 @@ async function main() {
|
|
|
237
257
|
if (args.includes('--help') || args.includes('-h')) {
|
|
238
258
|
printLogo();
|
|
239
259
|
print(`${BOLD}Usage:${RESET}`);
|
|
240
|
-
print(` ${CYAN}npx opendraft${RESET} Interactive mode`);
|
|
260
|
+
print(` ${CYAN}npx opendraft${RESET} Interactive mode (recommended)`);
|
|
241
261
|
print(` ${CYAN}npx opendraft "Your Topic"${RESET} Quick generate`);
|
|
242
262
|
print(` ${CYAN}npx opendraft --install${RESET} Install/update`);
|
|
243
263
|
console.log();
|
|
244
264
|
print(`${BOLD}Options:${RESET}`);
|
|
245
|
-
print(` --level, -l
|
|
246
|
-
print(` --style, -s
|
|
247
|
-
print(` --
|
|
265
|
+
print(` --level, -l Academic level (research_paper, bachelor, master, phd)`);
|
|
266
|
+
print(` --style, -s Citation style (apa, mla, chicago, ieee)`);
|
|
267
|
+
print(` --lang Language (en, de, es, fr, it, pt, zh, ja, ko, ru)`);
|
|
268
|
+
print(` --output, -o Output directory`);
|
|
248
269
|
console.log();
|
|
249
|
-
print(`${
|
|
270
|
+
print(`${BOLD}Cover Page (optional):${RESET}`);
|
|
271
|
+
print(` --author Your name`);
|
|
272
|
+
print(` --institution University/institution`);
|
|
273
|
+
print(` --department Department name`);
|
|
274
|
+
print(` --advisor Supervisor name`);
|
|
275
|
+
console.log();
|
|
276
|
+
print(`${BOLD}Examples:${RESET}`);
|
|
277
|
+
print(` ${CYAN}npx opendraft "AI in Healthcare" --level master${RESET}`);
|
|
278
|
+
print(` ${CYAN}npx opendraft "Climate Change" --lang de --author "Max Müller"${RESET}`);
|
|
279
|
+
console.log();
|
|
280
|
+
print(`${GRAY}https://opendraft.xyz/docs${RESET}`);
|
|
250
281
|
console.log();
|
|
251
282
|
return;
|
|
252
283
|
}
|
|
253
284
|
|
|
285
|
+
// Show logo immediately so user knows something is happening
|
|
286
|
+
printLogo();
|
|
287
|
+
print(`${GRAY}Checking environment...${RESET}`);
|
|
288
|
+
|
|
254
289
|
// Check Python
|
|
255
290
|
const python = checkPython();
|
|
256
291
|
|
|
257
292
|
if (!python) {
|
|
258
|
-
|
|
293
|
+
console.log();
|
|
259
294
|
showInstallInstructions();
|
|
260
295
|
process.exit(1);
|
|
261
296
|
}
|
|
262
297
|
|
|
298
|
+
print(`${GREEN}✓${RESET} Python ${python.version} found`);
|
|
299
|
+
|
|
263
300
|
// Handle --install
|
|
264
301
|
if (args.includes('--install')) {
|
|
265
|
-
|
|
266
|
-
print(`${GREEN}✓${RESET} Python ${python.version} found`);
|
|
302
|
+
print(`${GRAY}Installing OpenDraft...${RESET}`);
|
|
267
303
|
if (installOpendraft(python.cmd)) {
|
|
268
304
|
print(`${GREEN}✓${RESET} OpenDraft installed successfully`);
|
|
269
305
|
console.log();
|
|
@@ -278,15 +314,12 @@ async function main() {
|
|
|
278
314
|
|
|
279
315
|
// Check if opendraft is installed
|
|
280
316
|
if (!checkOpendraftInstalled(python.cmd)) {
|
|
281
|
-
|
|
282
|
-
print(`${YELLOW}First time setup...${RESET}`);
|
|
283
|
-
console.log();
|
|
317
|
+
print(`${YELLOW}First time setup - installing OpenDraft...${RESET}`);
|
|
284
318
|
if (!installOpendraft(python.cmd)) {
|
|
285
319
|
print(`${RED}✗${RESET} Failed to install OpenDraft`);
|
|
286
320
|
process.exit(1);
|
|
287
321
|
}
|
|
288
322
|
print(`${GREEN}✓${RESET} OpenDraft installed`);
|
|
289
|
-
console.log();
|
|
290
323
|
}
|
|
291
324
|
|
|
292
325
|
// Run opendraft
|