@x-all-in-one/coding-helper 0.4.7 → 0.5.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.
- package/dist/lib/plugins/index.d.ts +1 -1
- package/dist/lib/plugins/index.js +1 -1
- package/dist/lib/plugins/oh-my-openagent-plugin.d.ts +15 -0
- package/dist/lib/plugins/{oh-my-opencode-plugin.js → oh-my-openagent-plugin.js} +12 -40
- package/dist/lib/tool-manager.js +2 -2
- package/dist/lib/tools/opencode-tool.d.ts +10 -21
- package/dist/lib/tools/opencode-tool.js +41 -46
- package/dist/lib/wizard/installers/bun-installer.js +1 -1
- package/dist/lib/wizard/menus/plugin-menu.js +3 -3
- package/dist/lib/wizard/menus/tool-menu.js +5 -5
- package/dist/locales/en_US.json +7 -7
- package/dist/locales/zh_CN.json +7 -7
- package/package.json +1 -1
- package/dist/lib/plugins/oh-my-opencode-plugin.d.ts +0 -38
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './ccline-plugin.js';
|
|
2
|
-
export * from './oh-my-
|
|
2
|
+
export * from './oh-my-openagent-plugin.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IPlugin } from '../tools/base-tool.js';
|
|
2
|
+
export declare class OhMyOpenAgentPlugin implements IPlugin {
|
|
3
|
+
readonly name = "oh-my-openagent";
|
|
4
|
+
readonly displayName = "Oh My OpenAgent";
|
|
5
|
+
private configPath;
|
|
6
|
+
constructor();
|
|
7
|
+
isInstalled(): boolean;
|
|
8
|
+
install(): Promise<void>;
|
|
9
|
+
load(): void;
|
|
10
|
+
unload(): void;
|
|
11
|
+
isLoaded(): boolean;
|
|
12
|
+
private getConfig;
|
|
13
|
+
private saveConfig;
|
|
14
|
+
}
|
|
15
|
+
export declare const ohMyOpenAgentPlugin: OhMyOpenAgentPlugin;
|
|
@@ -3,34 +3,25 @@ import { existsSync, readFileSync, 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';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*/
|
|
10
|
-
export class OhMyOpenCodePlugin {
|
|
11
|
-
name = 'oh-my-opencode';
|
|
12
|
-
displayName = 'Oh My OpenCode';
|
|
6
|
+
export class OhMyOpenAgentPlugin {
|
|
7
|
+
name = 'oh-my-openagent';
|
|
8
|
+
displayName = 'Oh My OpenAgent';
|
|
13
9
|
configPath;
|
|
14
10
|
constructor() {
|
|
15
11
|
this.configPath = join(homedir(), '.config', 'opencode', 'opencode.json');
|
|
16
12
|
}
|
|
17
|
-
/**
|
|
18
|
-
* 检查 Oh My OpenCode 是否已安装
|
|
19
|
-
* 通过检查配置文件或 plugin 数组来判断
|
|
20
|
-
*/
|
|
21
13
|
isInstalled() {
|
|
22
|
-
|
|
14
|
+
const ohMyOpenAgentConfigPath = join(homedir(), '.config', 'opencode', 'oh-my-openagent.json');
|
|
23
15
|
const ohMyOpenCodeConfigPath = join(homedir(), '.config', 'opencode', 'oh-my-opencode.json');
|
|
24
|
-
if (existsSync(ohMyOpenCodeConfigPath)) {
|
|
16
|
+
if (existsSync(ohMyOpenAgentConfigPath) || existsSync(ohMyOpenCodeConfigPath)) {
|
|
25
17
|
return true;
|
|
26
18
|
}
|
|
27
|
-
// 或者检查是否已在 opencode.json 的 plugin 数组中
|
|
28
19
|
return this.isLoaded();
|
|
29
20
|
}
|
|
30
21
|
async install() {
|
|
31
22
|
const hasBun = await bunInstaller.ensureBun();
|
|
32
23
|
if (!hasBun) {
|
|
33
|
-
throw new Error('Bun is required for Oh My
|
|
24
|
+
throw new Error('Bun is required for Oh My OpenAgent. Please install bun first.');
|
|
34
25
|
}
|
|
35
26
|
const isWindows = process.platform === 'win32';
|
|
36
27
|
const bunxCommand = isWindows ? 'bunx.cmd' : 'bunx';
|
|
@@ -44,54 +35,39 @@ export class OhMyOpenCodePlugin {
|
|
|
44
35
|
if (code === 0)
|
|
45
36
|
resolve();
|
|
46
37
|
else
|
|
47
|
-
reject(new Error(`Oh My
|
|
38
|
+
reject(new Error(`Oh My OpenAgent install failed with code ${code}`));
|
|
48
39
|
});
|
|
49
40
|
child.on('error', reject);
|
|
50
41
|
});
|
|
51
42
|
}
|
|
52
|
-
/**
|
|
53
|
-
* 装载 Oh My OpenCode(添加到 OpenCode 配置)
|
|
54
|
-
*/
|
|
55
43
|
load() {
|
|
56
44
|
const config = this.getConfig();
|
|
57
|
-
// 初始化 plugin 数组
|
|
58
45
|
if (!config.plugin) {
|
|
59
46
|
config.plugin = [];
|
|
60
47
|
}
|
|
61
|
-
|
|
62
|
-
const hasPlugin = config.plugin.some((p) => typeof p === 'string' && p.startsWith('oh-my-opencode'));
|
|
48
|
+
const hasPlugin = config.plugin.some((p) => typeof p === 'string' && (p.startsWith('oh-my-openagent') || p.startsWith('oh-my-opencode')));
|
|
63
49
|
if (!hasPlugin) {
|
|
64
|
-
config.plugin.push('oh-my-
|
|
50
|
+
config.plugin.push('oh-my-openagent');
|
|
65
51
|
this.saveConfig(config);
|
|
66
52
|
}
|
|
67
53
|
}
|
|
68
|
-
/**
|
|
69
|
-
* 取消装载 Oh My OpenCode(从配置中移除)
|
|
70
|
-
*/
|
|
71
54
|
unload() {
|
|
72
55
|
const config = this.getConfig();
|
|
73
56
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
74
|
-
config.plugin = config.plugin.filter((p) => !(typeof p === 'string' && p.startsWith('oh-my-opencode')));
|
|
75
|
-
// 如果 plugin 为空,删除整个 plugin 数组
|
|
57
|
+
config.plugin = config.plugin.filter((p) => !(typeof p === 'string' && (p.startsWith('oh-my-openagent') || p.startsWith('oh-my-opencode'))));
|
|
76
58
|
if (config.plugin.length === 0) {
|
|
77
59
|
delete config.plugin;
|
|
78
60
|
}
|
|
79
61
|
this.saveConfig(config);
|
|
80
62
|
}
|
|
81
63
|
}
|
|
82
|
-
/**
|
|
83
|
-
* 检查 Oh My OpenCode 是否已装载到配置
|
|
84
|
-
*/
|
|
85
64
|
isLoaded() {
|
|
86
65
|
const config = this.getConfig();
|
|
87
66
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
88
|
-
return config.plugin.some((p) => typeof p === 'string' && p.startsWith('oh-my-opencode'));
|
|
67
|
+
return config.plugin.some((p) => typeof p === 'string' && (p.startsWith('oh-my-openagent') || p.startsWith('oh-my-opencode')));
|
|
89
68
|
}
|
|
90
69
|
return false;
|
|
91
70
|
}
|
|
92
|
-
/**
|
|
93
|
-
* 读取 OpenCode 配置
|
|
94
|
-
*/
|
|
95
71
|
getConfig() {
|
|
96
72
|
try {
|
|
97
73
|
if (existsSync(this.configPath)) {
|
|
@@ -104,12 +80,8 @@ export class OhMyOpenCodePlugin {
|
|
|
104
80
|
}
|
|
105
81
|
return {};
|
|
106
82
|
}
|
|
107
|
-
/**
|
|
108
|
-
* 保存 OpenCode 配置
|
|
109
|
-
*/
|
|
110
83
|
saveConfig(config) {
|
|
111
84
|
writeFileSync(this.configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
112
85
|
}
|
|
113
86
|
}
|
|
114
|
-
|
|
115
|
-
export const ohMyOpenCodePlugin = new OhMyOpenCodePlugin();
|
|
87
|
+
export const ohMyOpenAgentPlugin = new OhMyOpenAgentPlugin();
|
package/dist/lib/tool-manager.js
CHANGED
|
@@ -4,7 +4,7 @@ import inquirer from 'inquirer';
|
|
|
4
4
|
import terminalLink from 'terminal-link';
|
|
5
5
|
import { i18n } from './i18n.js';
|
|
6
6
|
import { cclinePlugin } from './plugins/ccline-plugin.js';
|
|
7
|
-
import {
|
|
7
|
+
import { ohMyOpenAgentPlugin } from './plugins/oh-my-openagent-plugin.js';
|
|
8
8
|
import { claudeCodeTool } from './tools/claude-code-tool.js';
|
|
9
9
|
import { codexTool } from './tools/codex-tool.js';
|
|
10
10
|
import { openCodeTool } from './tools/opencode-tool.js';
|
|
@@ -22,7 +22,7 @@ export class ToolRegistry {
|
|
|
22
22
|
this.registerTool(codexTool);
|
|
23
23
|
// 注册插件
|
|
24
24
|
claudeCodeTool.registerPlugin(cclinePlugin);
|
|
25
|
-
openCodeTool.registerPlugin(
|
|
25
|
+
openCodeTool.registerPlugin(ohMyOpenAgentPlugin);
|
|
26
26
|
}
|
|
27
27
|
static getInstance() {
|
|
28
28
|
if (!ToolRegistry.instance) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModelInfo } from '../utils/fetch-models.js';
|
|
2
2
|
import type { IPlugin } from './base-tool.js';
|
|
3
3
|
import { BaseTool } from './base-tool.js';
|
|
4
|
-
export interface
|
|
4
|
+
export interface OhMyOpenAgentConfig {
|
|
5
5
|
$schema?: string;
|
|
6
6
|
agents?: Record<string, {
|
|
7
7
|
model?: string;
|
|
@@ -40,6 +40,7 @@ export interface OpenCodeModelEntry {
|
|
|
40
40
|
};
|
|
41
41
|
provider?: {
|
|
42
42
|
npm: string;
|
|
43
|
+
api?: string;
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
export interface OpenCodeProviderConfig {
|
|
@@ -77,7 +78,7 @@ export declare class OpenCodeTool extends BaseTool {
|
|
|
77
78
|
readonly command = "opencode";
|
|
78
79
|
readonly installCommand = "npm install -g opencode-ai";
|
|
79
80
|
readonly configPath: string;
|
|
80
|
-
private
|
|
81
|
+
private ohMyOpenAgentConfigPath;
|
|
81
82
|
private constructor();
|
|
82
83
|
static getInstance(): OpenCodeTool;
|
|
83
84
|
/**
|
|
@@ -115,25 +116,13 @@ export declare class OpenCodeTool extends BaseTool {
|
|
|
115
116
|
* 如果 provider 不存在但有 apiKey,则创建新的 provider
|
|
116
117
|
*/
|
|
117
118
|
syncModelsToConfig(modelInfos: ModelInfo[]): void;
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
getOhMyOpenCodeConfig(): OhMyOpenCodeConfig;
|
|
126
|
-
/**
|
|
127
|
-
* Save oh-my-opencode config
|
|
128
|
-
*/
|
|
129
|
-
saveOhMyOpenCodeConfig(config: OhMyOpenCodeConfig): void;
|
|
130
|
-
private updateOhMyOpenCodeAgents;
|
|
131
|
-
private updateOhMyOpenCodeCategories;
|
|
132
|
-
/**
|
|
133
|
-
* Update oh-my-opencode agent and category models
|
|
134
|
-
* Only updates the model field, preserves other configurations
|
|
135
|
-
*/
|
|
136
|
-
updateOhMyOpenCodeModels(model: string, smallModel: string): void;
|
|
119
|
+
private resolveOhMyOpenAgentConfigPath;
|
|
120
|
+
hasOhMyOpenAgentPlugin(): boolean;
|
|
121
|
+
getOhMyOpenAgentConfig(): OhMyOpenAgentConfig;
|
|
122
|
+
saveOhMyOpenAgentConfig(config: OhMyOpenAgentConfig): void;
|
|
123
|
+
private updateOhMyOpenAgentAgents;
|
|
124
|
+
private updateOhMyOpenAgentCategories;
|
|
125
|
+
updateOhMyOpenAgentModels(model: string, smallModel: string): void;
|
|
137
126
|
/**
|
|
138
127
|
* 获取所有已注册的插件
|
|
139
128
|
*/
|
|
@@ -7,8 +7,8 @@ import { modelService } from '../model-service.js';
|
|
|
7
7
|
import { BaseTool } from './base-tool.js';
|
|
8
8
|
// X-AIO Provider ID
|
|
9
9
|
const XAIO_PROVIDER_ID = 'xaio';
|
|
10
|
-
// oh-my-
|
|
11
|
-
const
|
|
10
|
+
// oh-my-openagent agent names (latest version)
|
|
11
|
+
const OH_MY_OPENAGENT_AGENTS = [
|
|
12
12
|
'sisyphus',
|
|
13
13
|
'hephaestus',
|
|
14
14
|
'oracle',
|
|
@@ -22,13 +22,13 @@ const OH_MY_OPENCODE_AGENTS = [
|
|
|
22
22
|
'frontend-ui-ux-engineer',
|
|
23
23
|
'document-writer',
|
|
24
24
|
];
|
|
25
|
-
const
|
|
25
|
+
const OH_MY_OPENAGENT_SMALL_AGENTS = [
|
|
26
26
|
'librarian',
|
|
27
27
|
'explore',
|
|
28
28
|
'document-writer',
|
|
29
29
|
];
|
|
30
|
-
// oh-my-
|
|
31
|
-
const
|
|
30
|
+
// oh-my-openagent category names
|
|
31
|
+
const OH_MY_OPENAGENT_CATEGORIES = [
|
|
32
32
|
'visual-engineering',
|
|
33
33
|
'ultrabrain',
|
|
34
34
|
'deep',
|
|
@@ -38,7 +38,7 @@ const OH_MY_OPENCODE_CATEGORIES = [
|
|
|
38
38
|
'unspecified-high',
|
|
39
39
|
'writing',
|
|
40
40
|
];
|
|
41
|
-
const
|
|
41
|
+
const OH_MY_OPENAGENT_SMALL_CATEGORIES = [
|
|
42
42
|
'quick',
|
|
43
43
|
'unspecified-low',
|
|
44
44
|
'writing',
|
|
@@ -110,7 +110,7 @@ export function buildOpenCodeModelEntry(info) {
|
|
|
110
110
|
entry.reasoning = true;
|
|
111
111
|
}
|
|
112
112
|
if (isResponsesModel) {
|
|
113
|
-
entry.provider = { npm: '@ai-sdk/openai' };
|
|
113
|
+
entry.provider = { npm: '@ai-sdk/openai', api: '' };
|
|
114
114
|
}
|
|
115
115
|
return entry;
|
|
116
116
|
}
|
|
@@ -125,15 +125,15 @@ export class OpenCodeTool extends BaseTool {
|
|
|
125
125
|
command = 'opencode';
|
|
126
126
|
installCommand = 'npm install -g opencode-ai';
|
|
127
127
|
configPath;
|
|
128
|
-
|
|
128
|
+
ohMyOpenAgentConfigPath;
|
|
129
129
|
constructor() {
|
|
130
130
|
super();
|
|
131
131
|
// OpenCode config file paths (cross-platform support)
|
|
132
132
|
// - macOS/Linux: ~/.config/opencode/opencode.json
|
|
133
133
|
// - Windows: %USERPROFILE%\.config\opencode\opencode.json
|
|
134
134
|
this.configPath = join(homedir(), '.config', 'opencode', 'opencode.json');
|
|
135
|
-
// oh-my-
|
|
136
|
-
this.
|
|
135
|
+
// oh-my-openagent config path (also detects legacy oh-my-opencode.json)
|
|
136
|
+
this.ohMyOpenAgentConfigPath = this.resolveOhMyOpenAgentConfigPath();
|
|
137
137
|
}
|
|
138
138
|
static getInstance() {
|
|
139
139
|
if (!OpenCodeTool.instance) {
|
|
@@ -313,15 +313,20 @@ export class OpenCodeTool extends BaseTool {
|
|
|
313
313
|
xaioProvider.models = deepmerge(xaioProvider.models || {}, modelsConfig);
|
|
314
314
|
this.saveConfig(currentConfig);
|
|
315
315
|
}
|
|
316
|
-
// ==================== Oh My
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
316
|
+
// ==================== Oh My OpenAgent 相关方法 ====================
|
|
317
|
+
resolveOhMyOpenAgentConfigPath() {
|
|
318
|
+
const newConfigPath = join(homedir(), '.config', 'opencode', 'oh-my-openagent.json');
|
|
319
|
+
const legacyConfigPath = join(homedir(), '.config', 'opencode', 'oh-my-opencode.json');
|
|
320
|
+
if (existsSync(newConfigPath)) {
|
|
321
|
+
return newConfigPath;
|
|
322
|
+
}
|
|
323
|
+
return legacyConfigPath;
|
|
324
|
+
}
|
|
325
|
+
hasOhMyOpenAgentPlugin() {
|
|
321
326
|
try {
|
|
322
327
|
const config = this.getConfig();
|
|
323
328
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
324
|
-
return config.plugin.some((p) => typeof p === 'string' && p.startsWith('oh-my-opencode'));
|
|
329
|
+
return config.plugin.some((p) => typeof p === 'string' && (p.startsWith('oh-my-openagent') || p.startsWith('oh-my-opencode')));
|
|
325
330
|
}
|
|
326
331
|
return false;
|
|
327
332
|
}
|
|
@@ -329,39 +334,33 @@ export class OpenCodeTool extends BaseTool {
|
|
|
329
334
|
return false;
|
|
330
335
|
}
|
|
331
336
|
}
|
|
332
|
-
|
|
333
|
-
* Get oh-my-opencode config
|
|
334
|
-
*/
|
|
335
|
-
getOhMyOpenCodeConfig() {
|
|
337
|
+
getOhMyOpenAgentConfig() {
|
|
336
338
|
try {
|
|
337
|
-
if (existsSync(this.
|
|
338
|
-
const content = readFileSync(this.
|
|
339
|
+
if (existsSync(this.ohMyOpenAgentConfigPath)) {
|
|
340
|
+
const content = readFileSync(this.ohMyOpenAgentConfigPath, 'utf-8');
|
|
339
341
|
return JSON.parse(content);
|
|
340
342
|
}
|
|
341
343
|
}
|
|
342
344
|
catch (error) {
|
|
343
|
-
console.warn('Failed to read oh-my-
|
|
345
|
+
console.warn('Failed to read oh-my-openagent config:', error);
|
|
344
346
|
}
|
|
345
347
|
return {};
|
|
346
348
|
}
|
|
347
|
-
|
|
348
|
-
* Save oh-my-opencode config
|
|
349
|
-
*/
|
|
350
|
-
saveOhMyOpenCodeConfig(config) {
|
|
349
|
+
saveOhMyOpenAgentConfig(config) {
|
|
351
350
|
try {
|
|
352
|
-
this.ensureDir(this.
|
|
353
|
-
writeFileSync(this.
|
|
351
|
+
this.ensureDir(this.ohMyOpenAgentConfigPath);
|
|
352
|
+
writeFileSync(this.ohMyOpenAgentConfigPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
354
353
|
}
|
|
355
354
|
catch (error) {
|
|
356
|
-
throw new Error(`Failed to save oh-my-
|
|
355
|
+
throw new Error(`Failed to save oh-my-openagent config: ${error}`);
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
|
-
|
|
358
|
+
updateOhMyOpenAgentAgents(config, model, smallModel) {
|
|
360
359
|
if (!config.agents) {
|
|
361
360
|
config.agents = {};
|
|
362
361
|
}
|
|
363
|
-
for (const agentName of
|
|
364
|
-
const targetModel =
|
|
362
|
+
for (const agentName of OH_MY_OPENAGENT_AGENTS) {
|
|
363
|
+
const targetModel = OH_MY_OPENAGENT_SMALL_AGENTS.includes(agentName)
|
|
365
364
|
? smallModel
|
|
366
365
|
: model;
|
|
367
366
|
if (config.agents[agentName]) {
|
|
@@ -372,12 +371,12 @@ export class OpenCodeTool extends BaseTool {
|
|
|
372
371
|
}
|
|
373
372
|
}
|
|
374
373
|
}
|
|
375
|
-
|
|
374
|
+
updateOhMyOpenAgentCategories(config, model, smallModel) {
|
|
376
375
|
if (!config.categories) {
|
|
377
376
|
config.categories = {};
|
|
378
377
|
}
|
|
379
|
-
for (const categoryName of
|
|
380
|
-
const targetModel =
|
|
378
|
+
for (const categoryName of OH_MY_OPENAGENT_CATEGORIES) {
|
|
379
|
+
const targetModel = OH_MY_OPENAGENT_SMALL_CATEGORIES.includes(categoryName)
|
|
381
380
|
? smallModel
|
|
382
381
|
: model;
|
|
383
382
|
if (config.categories[categoryName]) {
|
|
@@ -388,20 +387,16 @@ export class OpenCodeTool extends BaseTool {
|
|
|
388
387
|
}
|
|
389
388
|
}
|
|
390
389
|
}
|
|
391
|
-
|
|
392
|
-
* Update oh-my-opencode agent and category models
|
|
393
|
-
* Only updates the model field, preserves other configurations
|
|
394
|
-
*/
|
|
395
|
-
updateOhMyOpenCodeModels(model, smallModel) {
|
|
390
|
+
updateOhMyOpenAgentModels(model, smallModel) {
|
|
396
391
|
const prefixedModel = `${XAIO_PROVIDER_ID}/${model}`;
|
|
397
392
|
const prefixedSmallModel = `${XAIO_PROVIDER_ID}/${smallModel}`;
|
|
398
|
-
const currentConfig = this.
|
|
399
|
-
this.
|
|
400
|
-
this.
|
|
393
|
+
const currentConfig = this.getOhMyOpenAgentConfig();
|
|
394
|
+
this.updateOhMyOpenAgentAgents(currentConfig, prefixedModel, prefixedSmallModel);
|
|
395
|
+
this.updateOhMyOpenAgentCategories(currentConfig, prefixedModel, prefixedSmallModel);
|
|
401
396
|
if (!currentConfig.$schema) {
|
|
402
|
-
currentConfig.$schema = 'https://raw.githubusercontent.com/code-yeongyu/oh-my-
|
|
397
|
+
currentConfig.$schema = 'https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json';
|
|
403
398
|
}
|
|
404
|
-
this.
|
|
399
|
+
this.saveOhMyOpenAgentConfig(currentConfig);
|
|
405
400
|
}
|
|
406
401
|
// ==================== 插件管理 ====================
|
|
407
402
|
/**
|
|
@@ -73,7 +73,7 @@ export class BunInstaller {
|
|
|
73
73
|
if (this.hasBun()) {
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
|
-
console.log(chalk.yellow(`\n${i18n.t('wizard.
|
|
76
|
+
console.log(chalk.yellow(`\n${i18n.t('wizard.oh_my_openagent_requires_bun')}`));
|
|
77
77
|
// 询问用户是否安装
|
|
78
78
|
const shouldInstall = await promptHelper.confirm(i18n.t('wizard.bun_install_confirm'), true);
|
|
79
79
|
if (!shouldInstall) {
|
|
@@ -85,8 +85,8 @@ export class PluginMenu {
|
|
|
85
85
|
try {
|
|
86
86
|
await plugin.install();
|
|
87
87
|
console.log(chalk.green(`\n✓ ${i18n.t('wizard.plugin_installed', { plugin: plugin.displayName })}`));
|
|
88
|
-
// oh-my-
|
|
89
|
-
if (plugin.name === 'oh-my-
|
|
88
|
+
// oh-my-openagent 安装后提示刷新模型列表
|
|
89
|
+
if (plugin.name === 'oh-my-openagent') {
|
|
90
90
|
await this.promptRefreshModels();
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -118,7 +118,7 @@ export class PluginMenu {
|
|
|
118
118
|
if (result.success) {
|
|
119
119
|
const modelConfig = openCodeTool.getModelConfig();
|
|
120
120
|
if (modelConfig?.model && modelConfig.smallModel) {
|
|
121
|
-
openCodeTool.
|
|
121
|
+
openCodeTool.updateOhMyOpenAgentModels(modelConfig.model, modelConfig.smallModel);
|
|
122
122
|
}
|
|
123
123
|
spinner.succeed(chalk.green(i18n.t('wizard.models_refreshed', { count: String(result.count) })));
|
|
124
124
|
}
|
|
@@ -361,12 +361,12 @@ export class ToolMenu {
|
|
|
361
361
|
openCodeSmallModel,
|
|
362
362
|
codexModel,
|
|
363
363
|
});
|
|
364
|
-
// Update oh-my-
|
|
365
|
-
if (toolName === 'opencode' && openCodeTool.
|
|
366
|
-
spinner.text = i18n.t('wizard.
|
|
367
|
-
openCodeTool.
|
|
364
|
+
// Update oh-my-openagent agent models if plugin is installed
|
|
365
|
+
if (toolName === 'opencode' && openCodeTool.hasOhMyOpenAgentPlugin()) {
|
|
366
|
+
spinner.text = i18n.t('wizard.oh_my_openagent_detected');
|
|
367
|
+
openCodeTool.updateOhMyOpenAgentModels(openCodeModel, openCodeSmallModel);
|
|
368
368
|
await new Promise(resolve => setTimeout(resolve, 500));
|
|
369
|
-
console.log(chalk.gray(` ${i18n.t('wizard.
|
|
369
|
+
console.log(chalk.gray(` ${i18n.t('wizard.oh_my_openagent_models_updated')}`));
|
|
370
370
|
}
|
|
371
371
|
await new Promise(resolve => setTimeout(resolve, 800));
|
|
372
372
|
spinner.succeed(chalk.green(i18n.t('wizard.config_loaded', { tool: toolRegistry.getTool(toolName)?.displayName })));
|
package/dist/locales/en_US.json
CHANGED
|
@@ -165,13 +165,13 @@
|
|
|
165
165
|
"directory_not_exist": "Directory does not exist",
|
|
166
166
|
"press_ctrl_c_to_exit": "Press Ctrl+C to go back",
|
|
167
167
|
"nav_go_back": "Go back",
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
168
|
+
"action_install_oh_my_openagent": "Install oh-my-openagent Plugin",
|
|
169
|
+
"oh_my_openagent_installing": "Installing oh-my-openagent...",
|
|
170
|
+
"oh_my_openagent_installed": "oh-my-openagent installed successfully!",
|
|
171
|
+
"oh_my_openagent_install_failed": "Failed to install oh-my-openagent",
|
|
172
|
+
"oh_my_openagent_detected": "oh-my-openagent plugin detected, updating agent models...",
|
|
173
|
+
"oh_my_openagent_models_updated": "oh-my-openagent agent models updated",
|
|
174
|
+
"oh_my_openagent_requires_bun": "oh-my-openagent requires Bun to be installed",
|
|
175
175
|
"bun_install_hint": "Please install Bun first:",
|
|
176
176
|
"bun_install_confirm": "Would you like to install Bun now?",
|
|
177
177
|
"bun_installing": "Installing Bun...",
|
package/dist/locales/zh_CN.json
CHANGED
|
@@ -165,13 +165,13 @@
|
|
|
165
165
|
"directory_not_exist": "目录不存在",
|
|
166
166
|
"press_ctrl_c_to_exit": "按 Ctrl+C 可退出返回",
|
|
167
167
|
"nav_go_back": "返回上一步",
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
168
|
+
"action_install_oh_my_openagent": "安装 oh-my-openagent 插件",
|
|
169
|
+
"oh_my_openagent_installing": "正在安装 oh-my-openagent...",
|
|
170
|
+
"oh_my_openagent_installed": "oh-my-openagent 安装成功!",
|
|
171
|
+
"oh_my_openagent_install_failed": "oh-my-openagent 安装失败",
|
|
172
|
+
"oh_my_openagent_detected": "检测到 oh-my-openagent 插件,正在更新 Agent 模型...",
|
|
173
|
+
"oh_my_openagent_models_updated": "oh-my-openagent Agent 模型已更新",
|
|
174
|
+
"oh_my_openagent_requires_bun": "oh-my-openagent 需要先安装 Bun",
|
|
175
175
|
"bun_install_hint": "请先安装 Bun:",
|
|
176
176
|
"bun_install_confirm": "是否需要帮您安装 Bun?",
|
|
177
177
|
"bun_installing": "正在安装 Bun...",
|
package/package.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { IPlugin } from '../tools/base-tool.js';
|
|
2
|
-
/**
|
|
3
|
-
* Oh My OpenCode 插件实现
|
|
4
|
-
* Oh My OpenCode 是 OpenCode 的增强插件
|
|
5
|
-
*/
|
|
6
|
-
export declare class OhMyOpenCodePlugin implements IPlugin {
|
|
7
|
-
readonly name = "oh-my-opencode";
|
|
8
|
-
readonly displayName = "Oh My OpenCode";
|
|
9
|
-
private configPath;
|
|
10
|
-
constructor();
|
|
11
|
-
/**
|
|
12
|
-
* 检查 Oh My OpenCode 是否已安装
|
|
13
|
-
* 通过检查配置文件或 plugin 数组来判断
|
|
14
|
-
*/
|
|
15
|
-
isInstalled(): boolean;
|
|
16
|
-
install(): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* 装载 Oh My OpenCode(添加到 OpenCode 配置)
|
|
19
|
-
*/
|
|
20
|
-
load(): void;
|
|
21
|
-
/**
|
|
22
|
-
* 取消装载 Oh My OpenCode(从配置中移除)
|
|
23
|
-
*/
|
|
24
|
-
unload(): void;
|
|
25
|
-
/**
|
|
26
|
-
* 检查 Oh My OpenCode 是否已装载到配置
|
|
27
|
-
*/
|
|
28
|
-
isLoaded(): boolean;
|
|
29
|
-
/**
|
|
30
|
-
* 读取 OpenCode 配置
|
|
31
|
-
*/
|
|
32
|
-
private getConfig;
|
|
33
|
-
/**
|
|
34
|
-
* 保存 OpenCode 配置
|
|
35
|
-
*/
|
|
36
|
-
private saveConfig;
|
|
37
|
-
}
|
|
38
|
-
export declare const ohMyOpenCodePlugin: OhMyOpenCodePlugin;
|