@x-all-in-one/coding-helper 0.4.9 → 0.5.1
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} +17 -43
- package/dist/lib/tool-manager.js +2 -2
- package/dist/lib/tools/opencode-tool.d.ts +9 -21
- package/dist/lib/tools/opencode-tool.js +41 -45
- 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,29 @@ 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
|
|
11
|
-
name = 'oh-my-
|
|
12
|
-
displayName = 'Oh My
|
|
6
|
+
const PLUGIN_PATTERNS = ['oh-my-openagent', 'oh-my-opencode'];
|
|
7
|
+
function isPluginEntry(p) {
|
|
8
|
+
return typeof p === 'string' && PLUGIN_PATTERNS.some(pattern => p === pattern || p.startsWith(`${pattern}@`));
|
|
9
|
+
}
|
|
10
|
+
export class OhMyOpenAgentPlugin {
|
|
11
|
+
name = 'oh-my-openagent';
|
|
12
|
+
displayName = 'Oh My OpenAgent';
|
|
13
13
|
configPath;
|
|
14
14
|
constructor() {
|
|
15
15
|
this.configPath = join(homedir(), '.config', 'opencode', 'opencode.json');
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
18
|
-
* 检查 Oh My OpenCode 是否已安装
|
|
19
|
-
* 通过检查配置文件或 plugin 数组来判断
|
|
20
|
-
*/
|
|
21
17
|
isInstalled() {
|
|
22
|
-
|
|
18
|
+
const ohMyOpenAgentConfigPath = join(homedir(), '.config', 'opencode', 'oh-my-openagent.json');
|
|
23
19
|
const ohMyOpenCodeConfigPath = join(homedir(), '.config', 'opencode', 'oh-my-opencode.json');
|
|
24
|
-
if (existsSync(ohMyOpenCodeConfigPath)) {
|
|
20
|
+
if (existsSync(ohMyOpenAgentConfigPath) || existsSync(ohMyOpenCodeConfigPath)) {
|
|
25
21
|
return true;
|
|
26
22
|
}
|
|
27
|
-
// 或者检查是否已在 opencode.json 的 plugin 数组中
|
|
28
23
|
return this.isLoaded();
|
|
29
24
|
}
|
|
30
25
|
async install() {
|
|
31
26
|
const hasBun = await bunInstaller.ensureBun();
|
|
32
27
|
if (!hasBun) {
|
|
33
|
-
throw new Error('Bun is required for Oh My
|
|
28
|
+
throw new Error('Bun is required for Oh My OpenAgent. Please install bun first.');
|
|
34
29
|
}
|
|
35
30
|
const isWindows = process.platform === 'win32';
|
|
36
31
|
const bunxCommand = isWindows ? 'bunx.cmd' : 'bunx';
|
|
@@ -44,54 +39,37 @@ export class OhMyOpenCodePlugin {
|
|
|
44
39
|
if (code === 0)
|
|
45
40
|
resolve();
|
|
46
41
|
else
|
|
47
|
-
reject(new Error(`Oh My
|
|
42
|
+
reject(new Error(`Oh My OpenAgent install failed with code ${code}`));
|
|
48
43
|
});
|
|
49
44
|
child.on('error', reject);
|
|
50
45
|
});
|
|
51
46
|
}
|
|
52
|
-
/**
|
|
53
|
-
* 装载 Oh My OpenCode(添加到 OpenCode 配置)
|
|
54
|
-
*/
|
|
55
47
|
load() {
|
|
56
48
|
const config = this.getConfig();
|
|
57
|
-
// 初始化 plugin 数组
|
|
58
49
|
if (!config.plugin) {
|
|
59
50
|
config.plugin = [];
|
|
60
51
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
config.plugin.push('oh-my-opencode');
|
|
65
|
-
this.saveConfig(config);
|
|
66
|
-
}
|
|
52
|
+
config.plugin = config.plugin.filter((p) => !isPluginEntry(p));
|
|
53
|
+
config.plugin.push('oh-my-openagent@latest');
|
|
54
|
+
this.saveConfig(config);
|
|
67
55
|
}
|
|
68
|
-
/**
|
|
69
|
-
* 取消装载 Oh My OpenCode(从配置中移除)
|
|
70
|
-
*/
|
|
71
56
|
unload() {
|
|
72
57
|
const config = this.getConfig();
|
|
73
58
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
74
|
-
config.plugin = config.plugin.filter((p) => !(
|
|
75
|
-
// 如果 plugin 为空,删除整个 plugin 数组
|
|
59
|
+
config.plugin = config.plugin.filter((p) => !isPluginEntry(p));
|
|
76
60
|
if (config.plugin.length === 0) {
|
|
77
61
|
delete config.plugin;
|
|
78
62
|
}
|
|
79
63
|
this.saveConfig(config);
|
|
80
64
|
}
|
|
81
65
|
}
|
|
82
|
-
/**
|
|
83
|
-
* 检查 Oh My OpenCode 是否已装载到配置
|
|
84
|
-
*/
|
|
85
66
|
isLoaded() {
|
|
86
67
|
const config = this.getConfig();
|
|
87
68
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
88
|
-
return config.plugin.some(
|
|
69
|
+
return config.plugin.some(isPluginEntry);
|
|
89
70
|
}
|
|
90
71
|
return false;
|
|
91
72
|
}
|
|
92
|
-
/**
|
|
93
|
-
* 读取 OpenCode 配置
|
|
94
|
-
*/
|
|
95
73
|
getConfig() {
|
|
96
74
|
try {
|
|
97
75
|
if (existsSync(this.configPath)) {
|
|
@@ -104,12 +82,8 @@ export class OhMyOpenCodePlugin {
|
|
|
104
82
|
}
|
|
105
83
|
return {};
|
|
106
84
|
}
|
|
107
|
-
/**
|
|
108
|
-
* 保存 OpenCode 配置
|
|
109
|
-
*/
|
|
110
85
|
saveConfig(config) {
|
|
111
86
|
writeFileSync(this.configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
112
87
|
}
|
|
113
88
|
}
|
|
114
|
-
|
|
115
|
-
export const ohMyOpenCodePlugin = new OhMyOpenCodePlugin();
|
|
89
|
+
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;
|
|
@@ -78,7 +78,7 @@ export declare class OpenCodeTool extends BaseTool {
|
|
|
78
78
|
readonly command = "opencode";
|
|
79
79
|
readonly installCommand = "npm install -g opencode-ai";
|
|
80
80
|
readonly configPath: string;
|
|
81
|
-
private
|
|
81
|
+
private ohMyOpenAgentConfigPath;
|
|
82
82
|
private constructor();
|
|
83
83
|
static getInstance(): OpenCodeTool;
|
|
84
84
|
/**
|
|
@@ -116,25 +116,13 @@ export declare class OpenCodeTool extends BaseTool {
|
|
|
116
116
|
* 如果 provider 不存在但有 apiKey,则创建新的 provider
|
|
117
117
|
*/
|
|
118
118
|
syncModelsToConfig(modelInfos: ModelInfo[]): void;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
getOhMyOpenCodeConfig(): OhMyOpenCodeConfig;
|
|
127
|
-
/**
|
|
128
|
-
* Save oh-my-opencode config
|
|
129
|
-
*/
|
|
130
|
-
saveOhMyOpenCodeConfig(config: OhMyOpenCodeConfig): void;
|
|
131
|
-
private updateOhMyOpenCodeAgents;
|
|
132
|
-
private updateOhMyOpenCodeCategories;
|
|
133
|
-
/**
|
|
134
|
-
* Update oh-my-opencode agent and category models
|
|
135
|
-
* Only updates the model field, preserves other configurations
|
|
136
|
-
*/
|
|
137
|
-
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;
|
|
138
126
|
/**
|
|
139
127
|
* 获取所有已注册的插件
|
|
140
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',
|
|
@@ -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,21 @@ 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
|
-
|
|
329
|
+
const patterns = ['oh-my-openagent', 'oh-my-opencode'];
|
|
330
|
+
return config.plugin.some((p) => typeof p === 'string' && patterns.some(pattern => p === pattern || p.startsWith(`${pattern}@`)));
|
|
325
331
|
}
|
|
326
332
|
return false;
|
|
327
333
|
}
|
|
@@ -329,39 +335,33 @@ export class OpenCodeTool extends BaseTool {
|
|
|
329
335
|
return false;
|
|
330
336
|
}
|
|
331
337
|
}
|
|
332
|
-
|
|
333
|
-
* Get oh-my-opencode config
|
|
334
|
-
*/
|
|
335
|
-
getOhMyOpenCodeConfig() {
|
|
338
|
+
getOhMyOpenAgentConfig() {
|
|
336
339
|
try {
|
|
337
|
-
if (existsSync(this.
|
|
338
|
-
const content = readFileSync(this.
|
|
340
|
+
if (existsSync(this.ohMyOpenAgentConfigPath)) {
|
|
341
|
+
const content = readFileSync(this.ohMyOpenAgentConfigPath, 'utf-8');
|
|
339
342
|
return JSON.parse(content);
|
|
340
343
|
}
|
|
341
344
|
}
|
|
342
345
|
catch (error) {
|
|
343
|
-
console.warn('Failed to read oh-my-
|
|
346
|
+
console.warn('Failed to read oh-my-openagent config:', error);
|
|
344
347
|
}
|
|
345
348
|
return {};
|
|
346
349
|
}
|
|
347
|
-
|
|
348
|
-
* Save oh-my-opencode config
|
|
349
|
-
*/
|
|
350
|
-
saveOhMyOpenCodeConfig(config) {
|
|
350
|
+
saveOhMyOpenAgentConfig(config) {
|
|
351
351
|
try {
|
|
352
|
-
this.ensureDir(this.
|
|
353
|
-
writeFileSync(this.
|
|
352
|
+
this.ensureDir(this.ohMyOpenAgentConfigPath);
|
|
353
|
+
writeFileSync(this.ohMyOpenAgentConfigPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
354
354
|
}
|
|
355
355
|
catch (error) {
|
|
356
|
-
throw new Error(`Failed to save oh-my-
|
|
356
|
+
throw new Error(`Failed to save oh-my-openagent config: ${error}`);
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
updateOhMyOpenAgentAgents(config, model, smallModel) {
|
|
360
360
|
if (!config.agents) {
|
|
361
361
|
config.agents = {};
|
|
362
362
|
}
|
|
363
|
-
for (const agentName of
|
|
364
|
-
const targetModel =
|
|
363
|
+
for (const agentName of OH_MY_OPENAGENT_AGENTS) {
|
|
364
|
+
const targetModel = OH_MY_OPENAGENT_SMALL_AGENTS.includes(agentName)
|
|
365
365
|
? smallModel
|
|
366
366
|
: model;
|
|
367
367
|
if (config.agents[agentName]) {
|
|
@@ -372,12 +372,12 @@ export class OpenCodeTool extends BaseTool {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
|
|
375
|
+
updateOhMyOpenAgentCategories(config, model, smallModel) {
|
|
376
376
|
if (!config.categories) {
|
|
377
377
|
config.categories = {};
|
|
378
378
|
}
|
|
379
|
-
for (const categoryName of
|
|
380
|
-
const targetModel =
|
|
379
|
+
for (const categoryName of OH_MY_OPENAGENT_CATEGORIES) {
|
|
380
|
+
const targetModel = OH_MY_OPENAGENT_SMALL_CATEGORIES.includes(categoryName)
|
|
381
381
|
? smallModel
|
|
382
382
|
: model;
|
|
383
383
|
if (config.categories[categoryName]) {
|
|
@@ -388,20 +388,16 @@ export class OpenCodeTool extends BaseTool {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
|
|
392
|
-
* Update oh-my-opencode agent and category models
|
|
393
|
-
* Only updates the model field, preserves other configurations
|
|
394
|
-
*/
|
|
395
|
-
updateOhMyOpenCodeModels(model, smallModel) {
|
|
391
|
+
updateOhMyOpenAgentModels(model, smallModel) {
|
|
396
392
|
const prefixedModel = `${XAIO_PROVIDER_ID}/${model}`;
|
|
397
393
|
const prefixedSmallModel = `${XAIO_PROVIDER_ID}/${smallModel}`;
|
|
398
|
-
const currentConfig = this.
|
|
399
|
-
this.
|
|
400
|
-
this.
|
|
394
|
+
const currentConfig = this.getOhMyOpenAgentConfig();
|
|
395
|
+
this.updateOhMyOpenAgentAgents(currentConfig, prefixedModel, prefixedSmallModel);
|
|
396
|
+
this.updateOhMyOpenAgentCategories(currentConfig, prefixedModel, prefixedSmallModel);
|
|
401
397
|
if (!currentConfig.$schema) {
|
|
402
|
-
currentConfig.$schema = 'https://raw.githubusercontent.com/code-yeongyu/oh-my-
|
|
398
|
+
currentConfig.$schema = 'https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json';
|
|
403
399
|
}
|
|
404
|
-
this.
|
|
400
|
+
this.saveOhMyOpenAgentConfig(currentConfig);
|
|
405
401
|
}
|
|
406
402
|
// ==================== 插件管理 ====================
|
|
407
403
|
/**
|
|
@@ -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;
|