opendraft 1.4.4 → 1.4.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.
Files changed (2) hide show
  1. package/bin/opendraft.js +23 -1
  2. package/package.json +1 -1
package/bin/opendraft.js CHANGED
@@ -104,7 +104,29 @@ function installOpendraft(pythonCmd) {
104
104
  }
105
105
 
106
106
  function runOpendraft(pythonCmd, args) {
107
- const proc = spawn(pythonCmd, ['-m', 'opendraft', ...args], {
107
+ // Try running the opendraft command directly first (installed by pip)
108
+ try {
109
+ execSync('which opendraft', { encoding: 'utf8', stdio: 'pipe' });
110
+ const proc = spawn('opendraft', args, {
111
+ stdio: 'inherit',
112
+ env: process.env
113
+ });
114
+ proc.on('close', (code) => {
115
+ process.exit(code);
116
+ });
117
+ return;
118
+ } catch (e) {
119
+ // opendraft not in PATH, run via Python
120
+ }
121
+
122
+ // Fallback: run via Python with proper argument handling
123
+ const script = `
124
+ import sys
125
+ sys.argv = ['opendraft'] + ${JSON.stringify(args)}
126
+ from opendraft.cli import main
127
+ main()
128
+ `;
129
+ const proc = spawn(pythonCmd, ['-c', script], {
108
130
  stdio: 'inherit',
109
131
  env: process.env
110
132
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opendraft",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "AI-powered research paper draft generator",
5
5
  "bin": {
6
6
  "opendraft": "./bin/opendraft.js"