jstar-reviewer 2.0.0 → 2.0.2
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/jstar.js +28 -5
- package/package.json +2 -2
package/bin/jstar.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* jstar setup - Set up config in current project
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
const { spawn } = require('child_process');
|
|
12
|
+
const { spawn, execSync } = require('child_process');
|
|
13
13
|
const path = require('path');
|
|
14
14
|
const fs = require('fs');
|
|
15
15
|
|
|
@@ -57,6 +57,18 @@ ${COLORS.dim}Report issues: https://github.com/JStaRFilms/jstar-code-review${COL
|
|
|
57
57
|
`);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* Check if a command exists
|
|
62
|
+
*/
|
|
63
|
+
function commandExists(cmd) {
|
|
64
|
+
try {
|
|
65
|
+
execSync(process.platform === 'win32' ? `where ${cmd}` : `which ${cmd}`, { stdio: 'ignore' });
|
|
66
|
+
return true;
|
|
67
|
+
} catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
60
72
|
function runScript(scriptName) {
|
|
61
73
|
const scriptsDir = path.join(__dirname, '..', 'scripts');
|
|
62
74
|
const scriptPath = path.join(scriptsDir, scriptName);
|
|
@@ -66,14 +78,25 @@ function runScript(scriptName) {
|
|
|
66
78
|
process.exit(1);
|
|
67
79
|
}
|
|
68
80
|
|
|
69
|
-
//
|
|
70
|
-
const
|
|
81
|
+
// Prioritize pnpm if available
|
|
82
|
+
const hasPnpm = commandExists('pnpm');
|
|
83
|
+
let runner = hasPnpm ? 'pnpm' : 'npx';
|
|
84
|
+
const runnerArgs = hasPnpm ? ['dlx', 'ts-node'] : ['ts-node'];
|
|
85
|
+
|
|
86
|
+
// On Windows, global commands like pnpm/npx are often .cmd files
|
|
87
|
+
// spawn without shell: true requires the full path or extension on Windows
|
|
88
|
+
if (process.platform === 'win32') {
|
|
89
|
+
runner += '.cmd';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
log(`${COLORS.dim}Using ${runner.replace('.cmd', '')} to run ${scriptName}...${COLORS.reset}`);
|
|
93
|
+
|
|
94
|
+
// Run without shell: true to avoid security warnings
|
|
95
|
+
const child = spawn(runner, [...runnerArgs, scriptPath, ...process.argv.slice(3)], {
|
|
71
96
|
cwd: process.cwd(),
|
|
72
97
|
stdio: 'inherit',
|
|
73
|
-
shell: true,
|
|
74
98
|
env: {
|
|
75
99
|
...process.env,
|
|
76
|
-
// Pass through the working directory for the scripts
|
|
77
100
|
JSTAR_CWD: process.cwd()
|
|
78
101
|
}
|
|
79
102
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jstar-reviewer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Local-First, Context-Aware AI Code Reviewer - Works with any language",
|
|
5
5
|
"bin": {
|
|
6
6
|
"jstar": "bin/jstar.js"
|
|
@@ -61,4 +61,4 @@
|
|
|
61
61
|
"bugs": {
|
|
62
62
|
"url": "https://github.com/JStaRFilms/jstar-code-review/issues"
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|