webjs-ai 1.0.0 → 1.1.0

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/index.js +26 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -6,6 +6,23 @@ const { spawnSync } = require('child_process');
6
6
  const path = require('path');
7
7
  const fs = require('fs');
8
8
 
9
+ function findBash() {
10
+ if (process.platform !== 'win32') return 'bash';
11
+
12
+ const candidates = [
13
+ 'C:\\Program Files\\Git\\bin\\bash.exe',
14
+ 'C:\\Program Files (x86)\\Git\\bin\\bash.exe',
15
+ 'C:\\Program Files\\Git\\usr\\bin\\bash.exe',
16
+ ];
17
+
18
+ for (const candidate of candidates) {
19
+ if (fs.existsSync(candidate)) return candidate;
20
+ }
21
+
22
+ // Last resort: bash in PATH (Cygwin, MSYS2, custom installs)
23
+ return 'bash';
24
+ }
25
+
9
26
  const [, , command, subcommand] = process.argv;
10
27
 
11
28
  if (command === 'init' && subcommand) {
@@ -22,11 +39,19 @@ if (command === 'init' && subcommand) {
22
39
  process.exit(clone.status ?? 1);
23
40
  }
24
41
 
25
- const build = spawnSync('bash', ['build-ai-rules.sh', target], {
42
+ const bash = findBash();
43
+ const build = spawnSync(bash, ['build-ai-rules.sh', target], {
26
44
  stdio: 'inherit',
27
45
  cwd: repoDir,
28
46
  });
29
47
 
48
+ if (build.error) {
49
+ console.error(
50
+ `Could not find bash. Install Git for Windows (https://git-scm.com) and retry.`
51
+ );
52
+ process.exit(1);
53
+ }
54
+
30
55
  process.exit(build.status ?? 1);
31
56
  } else {
32
57
  console.error('Usage: webjs-ai init <target>');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webjs-ai",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "webjs.co inner tool",
5
5
  "main": "index.js",
6
6
  "bin": {