@x-all-in-one/coding-helper 0.5.1 → 0.5.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.
@@ -11,5 +11,6 @@ export declare class OhMyOpenAgentPlugin implements IPlugin {
11
11
  isLoaded(): boolean;
12
12
  private getConfig;
13
13
  private saveConfig;
14
+ private migrateConfigFile;
14
15
  }
15
16
  export declare const ohMyOpenAgentPlugin: OhMyOpenAgentPlugin;
@@ -1,5 +1,5 @@
1
- import { spawn } from 'node:child_process';
2
- import { existsSync, readFileSync, writeFileSync } from 'node:fs';
1
+ import { execSync, spawn } from 'node:child_process';
2
+ import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
3
3
  import { homedir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import { bunInstaller } from '../wizard/installers/bun-installer.js';
@@ -7,6 +7,19 @@ const PLUGIN_PATTERNS = ['oh-my-openagent', 'oh-my-opencode'];
7
7
  function isPluginEntry(p) {
8
8
  return typeof p === 'string' && PLUGIN_PATTERNS.some(pattern => p === pattern || p.startsWith(`${pattern}@`));
9
9
  }
10
+ function resolveBunxCommand() {
11
+ if (process.platform !== 'win32') {
12
+ return 'bunx';
13
+ }
14
+ for (const cmd of ['bunx.cmd', 'bunx.exe']) {
15
+ try {
16
+ execSync(`where ${cmd}`, { stdio: 'pipe' });
17
+ return cmd;
18
+ }
19
+ catch { }
20
+ }
21
+ return 'bunx.cmd';
22
+ }
10
23
  export class OhMyOpenAgentPlugin {
11
24
  name = 'oh-my-openagent';
12
25
  displayName = 'Oh My OpenAgent';
@@ -27,10 +40,9 @@ export class OhMyOpenAgentPlugin {
27
40
  if (!hasBun) {
28
41
  throw new Error('Bun is required for Oh My OpenAgent. Please install bun first.');
29
42
  }
30
- const isWindows = process.platform === 'win32';
31
- const bunxCommand = isWindows ? 'bunx.cmd' : 'bunx';
43
+ const bunxCommand = resolveBunxCommand();
32
44
  return new Promise((resolve, reject) => {
33
- const args = ['oh-my-opencode@latest', 'install', '--no-tui', '--claude=no', '--openai=no', '--gemini=no', '--copilot=no'];
45
+ const args = ['oh-my-openagent@latest', 'install', '--no-tui', '--claude=no', '--openai=no', '--gemini=no', '--copilot=no'];
34
46
  const child = spawn(bunxCommand, args, {
35
47
  stdio: 'inherit',
36
48
  shell: true,
@@ -52,6 +64,7 @@ export class OhMyOpenAgentPlugin {
52
64
  config.plugin = config.plugin.filter((p) => !isPluginEntry(p));
53
65
  config.plugin.push('oh-my-openagent@latest');
54
66
  this.saveConfig(config);
67
+ this.migrateConfigFile();
55
68
  }
56
69
  unload() {
57
70
  const config = this.getConfig();
@@ -85,5 +98,12 @@ export class OhMyOpenAgentPlugin {
85
98
  saveConfig(config) {
86
99
  writeFileSync(this.configPath, JSON.stringify(config, null, 2), 'utf-8');
87
100
  }
101
+ migrateConfigFile() {
102
+ const legacyPath = join(homedir(), '.config', 'opencode', 'oh-my-opencode.json');
103
+ const newPath = join(homedir(), '.config', 'opencode', 'oh-my-openagent.json');
104
+ if (existsSync(legacyPath) && !existsSync(newPath)) {
105
+ renameSync(legacyPath, newPath);
106
+ }
107
+ }
88
108
  }
89
109
  export const ohMyOpenAgentPlugin = new OhMyOpenAgentPlugin();
@@ -19,9 +19,18 @@ export class BunInstaller {
19
19
  * 检查 Bun 是否已安装
20
20
  */
21
21
  hasBun() {
22
- const isWindows = process.platform === 'win32';
22
+ if (process.platform === 'win32') {
23
+ for (const cmd of ['bun.cmd', 'bun.exe']) {
24
+ try {
25
+ execSync(`where ${cmd}`, { stdio: 'ignore' });
26
+ return true;
27
+ }
28
+ catch { }
29
+ }
30
+ return false;
31
+ }
23
32
  try {
24
- execSync(isWindows ? 'where bun' : 'which bun', { stdio: 'ignore' });
33
+ execSync('which bun', { stdio: 'ignore' });
25
34
  return true;
26
35
  }
27
36
  catch {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@x-all-in-one/coding-helper",
3
3
  "type": "module",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "description": "X All In One Coding Helper",
6
6
  "author": "X.AIO",
7
7
  "homepage": "https://docs.x-aio.com/zh/docs",