bone-agent 2.4.3 → 2.4.5

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/bin/bone.js +20 -1
  2. package/package.json +6 -6
package/bin/bone.js CHANGED
@@ -13,12 +13,28 @@ const packages = {
13
13
 
14
14
  const key = `${process.platform}-${process.arch}`;
15
15
  const packageName = packages[key];
16
+ const args = process.argv.slice(2);
16
17
 
17
18
  if (!packageName) {
18
19
  console.error(`bone-agent does not support ${key}`);
19
20
  process.exit(1);
20
21
  }
21
22
 
23
+ // Windows cannot replace a running executable. Handle npm updates in the
24
+ // launcher before starting bone.exe so npm can atomically replace the native
25
+ // package without hitting a file lock.
26
+ if (process.platform === 'win32' && args[0] === 'update') {
27
+ console.log('Updating bone through npm...');
28
+ const update = spawnSync('npm.cmd', ['install', '-g', 'bone-agent@latest'], {
29
+ stdio: 'inherit'
30
+ });
31
+ if (update.error) {
32
+ console.error(update.error.message);
33
+ process.exit(1);
34
+ }
35
+ process.exit(update.status ?? 1);
36
+ }
37
+
22
38
  let packageJson;
23
39
  try {
24
40
  packageJson = require.resolve(`${packageName}/package.json`);
@@ -29,7 +45,10 @@ try {
29
45
 
30
46
  const exe = process.platform === 'win32' ? 'bone.exe' : 'bone';
31
47
  const bin = path.join(path.dirname(packageJson), 'bin', exe);
32
- const result = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
48
+ const result = spawnSync(bin, args, {
49
+ stdio: 'inherit',
50
+ env: { ...process.env, BONE_INSTALL_KIND: 'npm' }
51
+ });
33
52
 
34
53
  if (result.error) {
35
54
  console.error(result.error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bone-agent",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "description": "A terminal-based AI coding assistant",
5
5
  "bin": {
6
6
  "bone": "bin/bone.js"
@@ -9,11 +9,11 @@
9
9
  "bin"
10
10
  ],
11
11
  "optionalDependencies": {
12
- "bone-agent-linux-x64": "2.4.3",
13
- "bone-agent-linux-arm64": "2.4.3",
14
- "bone-agent-darwin-x64": "2.4.3",
15
- "bone-agent-darwin-arm64": "2.4.3",
16
- "bone-agent-windows-x64": "2.4.3"
12
+ "bone-agent-linux-x64": "2.4.5",
13
+ "bone-agent-linux-arm64": "2.4.5",
14
+ "bone-agent-darwin-x64": "2.4.5",
15
+ "bone-agent-darwin-arm64": "2.4.5",
16
+ "bone-agent-windows-x64": "2.4.5"
17
17
  },
18
18
  "engines": {
19
19
  "node": ">=18"