jstar-reviewer 2.0.0 → 2.0.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/jstar.js +23 -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,20 @@ 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
|
+
const runner = hasPnpm ? 'pnpm' : 'npx';
|
|
84
|
+
const runnerArgs = hasPnpm ? ['dlx', 'ts-node'] : ['ts-node'];
|
|
85
|
+
|
|
86
|
+
log(`${COLORS.dim}Using ${runner} to run ${scriptName}...${COLORS.reset}`);
|
|
87
|
+
|
|
88
|
+
// Run without shell: true to avoid security warnings
|
|
89
|
+
// On Windows, pnpm/npx are .cmd files, handled normally by spawn without shell if extension is omitted
|
|
90
|
+
const child = spawn(runner, [...runnerArgs, scriptPath, ...process.argv.slice(3)], {
|
|
71
91
|
cwd: process.cwd(),
|
|
72
92
|
stdio: 'inherit',
|
|
73
|
-
shell: true,
|
|
74
93
|
env: {
|
|
75
94
|
...process.env,
|
|
76
|
-
// Pass through the working directory for the scripts
|
|
77
95
|
JSTAR_CWD: process.cwd()
|
|
78
96
|
}
|
|
79
97
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jstar-reviewer",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
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
|
+
}
|