husky-ai 1.0.0 → 1.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.
@@ -32,7 +32,7 @@ export async function initCommand() {
32
32
  choices.push(new inquirer.Separator());
33
33
  choices.push({ name: 'Install OpenCode', value: 'install-opencode' });
34
34
  // 2. Select Engine
35
- const { engine } = await inquirer.prompt([
35
+ let { engine } = await inquirer.prompt([
36
36
  {
37
37
  type: 'list',
38
38
  name: 'engine',
@@ -42,8 +42,21 @@ export async function initCommand() {
42
42
  ]);
43
43
  // Handle Installation
44
44
  if (engine === 'install-opencode') {
45
- console.log(chalk.yellow('\nPlease install OpenCode manually: https://opencode.dev'));
46
- return;
45
+ const spinner = ora('Installing OpenCode globally...').start();
46
+ try {
47
+ await execa('npm', ['install', '-g', 'opencode']);
48
+ spinner.succeed('OpenCode installed successfully!');
49
+ engine = 'opencode';
50
+ }
51
+ catch (e) {
52
+ spinner.fail('Installation failed.');
53
+ console.log(chalk.yellow('⚠️ We could not install OpenCode automatically (permission error?).'));
54
+ console.log(chalk.yellow('Please run this command manually:'));
55
+ console.log(chalk.bold('npm install -g opencode'));
56
+ console.log(chalk.yellow('\nOr use the official install script:'));
57
+ console.log(chalk.bold('curl -fsSL https://opencode.ai/install | bash'));
58
+ return;
59
+ }
47
60
  }
48
61
  // 3. Verify Auth (Stub for now)
49
62
  // TODO: Add actual auth check command here
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "husky-ai",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Zero-config AI code review hook for git commits",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -27,18 +27,20 @@
27
27
  "type": "git",
28
28
  "url": "git+https://github.com/saurav/husky-ai.git"
29
29
  },
30
- "devDependencies": {
31
- "@types/chalk": "^2.2.4",
32
- "@types/inquirer": "^9.0.9",
33
- "@types/node": "^25.0.9",
30
+ "dependencies": {
34
31
  "boxen": "^5.1.2",
35
32
  "chalk": "^4.1.2",
36
33
  "commander": "^14.0.2",
37
34
  "execa": "^5.1.1",
38
35
  "inquirer": "^9.2.12",
39
36
  "ora": "^5.4.1",
40
- "ts-node": "^10.9.2",
41
- "typescript": "^5.9.3",
42
37
  "zod": "^4.3.5"
38
+ },
39
+ "devDependencies": {
40
+ "@types/chalk": "^2.2.4",
41
+ "@types/inquirer": "^9.0.9",
42
+ "@types/node": "^25.0.9",
43
+ "ts-node": "^10.9.2",
44
+ "typescript": "^5.9.3"
43
45
  }
44
46
  }
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "test-npm-install",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "test-npm-install",
9
+ "version": "1.0.0",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "husky-ai": "^1.0.0"
13
+ }
14
+ },
15
+ "node_modules/husky-ai": {
16
+ "version": "1.0.0",
17
+ "resolved": "https://registry.npmjs.org/husky-ai/-/husky-ai-1.0.0.tgz",
18
+ "integrity": "sha512-HEA8QGjELP6jtOyFxGrdSMz75wZuPnZ98xWZN9w8W965eVFWaSrHDX48Idis+OgKtkjTjFQBSMVtqoATo3t8Jg==",
19
+ "bin": {
20
+ "husky-ai": "bin/husky-ai.js"
21
+ }
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "test-npm-install",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "husky-ai": "^1.0.0"
14
+ }
15
+ }