husky-ai 1.0.2 → 1.0.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.
- package/dist/commands/init.js +20 -10
- package/dist/commands/review.js +1 -0
- package/package.json +1 -1
package/dist/commands/init.js
CHANGED
|
@@ -42,20 +42,30 @@ export async function initCommand() {
|
|
|
42
42
|
]);
|
|
43
43
|
// Handle Installation
|
|
44
44
|
if (engine === 'install-opencode') {
|
|
45
|
-
const spinner = ora('Installing OpenCode
|
|
45
|
+
const spinner = ora('Installing OpenCode...').start();
|
|
46
46
|
try {
|
|
47
|
-
|
|
48
|
-
spinner.
|
|
47
|
+
// Try global install first
|
|
48
|
+
spinner.text = 'Attempting global install...';
|
|
49
|
+
await execa('npm', ['install', '-g', 'opencode-ai']);
|
|
50
|
+
spinner.succeed('OpenCode installed globally!');
|
|
49
51
|
engine = 'opencode';
|
|
50
52
|
}
|
|
51
53
|
catch (e) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
// Fallback to local install
|
|
55
|
+
spinner.text = 'Global install failed. Attempting local install...';
|
|
56
|
+
try {
|
|
57
|
+
await execa('npm', ['install', '--save-dev', 'opencode-ai']);
|
|
58
|
+
spinner.succeed('OpenCode installed locally (devDependencies).');
|
|
59
|
+
engine = 'opencode';
|
|
60
|
+
}
|
|
61
|
+
catch (innerError) {
|
|
62
|
+
spinner.fail('Installation failed.');
|
|
63
|
+
console.log(chalk.yellow('⚠️ We could not install OpenCode automatically.'));
|
|
64
|
+
console.log(chalk.yellow('Please run one of these commands manually:'));
|
|
65
|
+
console.log(chalk.bold(' npm install -g opencode-ai'));
|
|
66
|
+
console.log(chalk.bold(' npm install --save-dev opencode-ai'));
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
59
69
|
}
|
|
60
70
|
}
|
|
61
71
|
// 3. Verify Auth (Stub for now)
|
package/dist/commands/review.js
CHANGED
|
@@ -62,6 +62,7 @@ export async function reviewCommand() {
|
|
|
62
62
|
// console.log("Sending prompt to OpenCode...");
|
|
63
63
|
const { stdout } = await execa('opencode', ['run', prompt], {
|
|
64
64
|
input: '',
|
|
65
|
+
preferLocal: true,
|
|
65
66
|
env: { ...process.env, CI: 'true', NO_COLOR: 'true' }
|
|
66
67
|
});
|
|
67
68
|
// console.log("Got response length:", stdout.length);
|