opendraft 1.6.1 → 1.6.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.
Files changed (2) hide show
  1. package/bin/opendraft.js +26 -27
  2. package/package.json +1 -1
package/bin/opendraft.js CHANGED
@@ -50,10 +50,21 @@ ${PURPLE}${BOLD} ╔═══════════════════
50
50
  function checkPython() {
51
51
  const home = os.homedir();
52
52
 
53
- // Check various Python commands including conda, pyenv, Homebrew, python.org
53
+ // Check Python commands - prefer stable versions (3.9-3.13), avoid dev versions (3.14+)
54
+ // Order matters: check specific stable versions first before generic python3
54
55
  const pythonCommands = [
55
- 'python3',
56
- 'python',
56
+ // Homebrew (stable versions first)
57
+ '/opt/homebrew/bin/python3.13',
58
+ '/opt/homebrew/bin/python3.12',
59
+ '/opt/homebrew/bin/python3.11',
60
+ '/opt/homebrew/bin/python3.10',
61
+ '/opt/homebrew/bin/python3',
62
+ '/usr/local/bin/python3',
63
+ // python.org macOS installer
64
+ '/Library/Frameworks/Python.framework/Versions/3.13/bin/python3',
65
+ '/Library/Frameworks/Python.framework/Versions/3.12/bin/python3',
66
+ '/Library/Frameworks/Python.framework/Versions/3.11/bin/python3',
67
+ '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3',
57
68
  // Conda (common locations)
58
69
  `${home}/anaconda3/bin/python`,
59
70
  `${home}/miniconda3/bin/python`,
@@ -64,23 +75,16 @@ function checkPython() {
64
75
  // pyenv
65
76
  `${home}/.pyenv/shims/python3`,
66
77
  `${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)
78
+ // Generic (last resort - may pick dev versions)
79
79
  'python3.13',
80
80
  'python3.12',
81
81
  'python3.11',
82
82
  'python3.10',
83
83
  'python3.9',
84
+ 'python3',
85
+ 'python',
86
+ // System Python (macOS)
87
+ '/usr/bin/python3',
84
88
  ];
85
89
 
86
90
  for (const cmd of pythonCommands) {
@@ -90,7 +94,8 @@ function checkPython() {
90
94
  if (match) {
91
95
  const major = parseInt(match[1]);
92
96
  const minor = parseInt(match[2]);
93
- if (major >= 3 && minor >= 9) {
97
+ // Require Python 3.9-3.13 (3.14+ is dev/unstable, packages may not work)
98
+ if (major === 3 && minor >= 9 && minor <= 13) {
94
99
  return { cmd, version: `${major}.${minor}` };
95
100
  }
96
101
  }
@@ -156,9 +161,9 @@ function runOpendraft(pythonCmd, args) {
156
161
  pyVersion = versionOutput;
157
162
  } catch (e) {}
158
163
 
159
- // Common locations for pip-installed commands
164
+ // Common locations for pip-installed Python opendraft command
165
+ // NOTE: Do NOT include bare 'opendraft' - it may resolve to this npm wrapper and cause infinite loop
160
166
  const possiblePaths = [
161
- 'opendraft', // In PATH
162
167
  `${home}/.local/bin/opendraft`, // pip --user on Linux/Mac
163
168
  `${home}/Library/Python/${pyVersion}/bin/opendraft`, // macOS user install for detected version
164
169
  `${home}/Library/Python/3.13/bin/opendraft`, // macOS Python 3.13
@@ -166,24 +171,18 @@ function runOpendraft(pythonCmd, args) {
166
171
  `${home}/Library/Python/3.11/bin/opendraft`, // macOS Python 3.11
167
172
  `${home}/Library/Python/3.10/bin/opendraft`, // macOS Python 3.10
168
173
  `${home}/Library/Python/3.9/bin/opendraft`, // macOS Python 3.9
169
- '/opt/homebrew/bin/opendraft', // Homebrew
170
- '/usr/local/bin/opendraft', // System-wide
171
174
  '/Library/Frameworks/Python.framework/Versions/3.13/bin/opendraft',
172
175
  '/Library/Frameworks/Python.framework/Versions/3.12/bin/opendraft',
173
176
  '/Library/Frameworks/Python.framework/Versions/3.11/bin/opendraft',
177
+ '/Library/Frameworks/Python.framework/Versions/3.10/bin/opendraft',
174
178
  ];
175
179
 
176
180
  // Try each possible path
177
181
  for (const cmdPath of possiblePaths) {
178
182
  try {
179
- if (cmdPath === 'opendraft') {
180
- execSync('which opendraft', { encoding: 'utf8', stdio: 'pipe' });
181
- } else {
182
- execSync(`test -x "${cmdPath}"`, { encoding: 'utf8', stdio: 'pipe' });
183
- }
183
+ execSync(`test -x "${cmdPath}"`, { encoding: 'utf8', stdio: 'pipe' });
184
184
 
185
- const actualCmd = cmdPath === 'opendraft' ? 'opendraft' : cmdPath;
186
- const proc = spawn(actualCmd, args, {
185
+ const proc = spawn(cmdPath, args, {
187
186
  stdio: 'inherit',
188
187
  env: process.env
189
188
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opendraft",
3
- "version": "1.6.1",
3
+ "version": "1.6.3",
4
4
  "description": "AI-powered research paper draft generator",
5
5
  "bin": {
6
6
  "opendraft": "./bin/opendraft.js"