@x-all-in-one/coding-helper 0.5.0 → 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.
|
@@ -3,6 +3,10 @@ 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
|
+
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
|
+
}
|
|
6
10
|
export class OhMyOpenAgentPlugin {
|
|
7
11
|
name = 'oh-my-openagent';
|
|
8
12
|
displayName = 'Oh My OpenAgent';
|
|
@@ -45,16 +49,14 @@ export class OhMyOpenAgentPlugin {
|
|
|
45
49
|
if (!config.plugin) {
|
|
46
50
|
config.plugin = [];
|
|
47
51
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
this.saveConfig(config);
|
|
52
|
-
}
|
|
52
|
+
config.plugin = config.plugin.filter((p) => !isPluginEntry(p));
|
|
53
|
+
config.plugin.push('oh-my-openagent@latest');
|
|
54
|
+
this.saveConfig(config);
|
|
53
55
|
}
|
|
54
56
|
unload() {
|
|
55
57
|
const config = this.getConfig();
|
|
56
58
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
57
|
-
config.plugin = config.plugin.filter((p) => !(
|
|
59
|
+
config.plugin = config.plugin.filter((p) => !isPluginEntry(p));
|
|
58
60
|
if (config.plugin.length === 0) {
|
|
59
61
|
delete config.plugin;
|
|
60
62
|
}
|
|
@@ -64,7 +66,7 @@ export class OhMyOpenAgentPlugin {
|
|
|
64
66
|
isLoaded() {
|
|
65
67
|
const config = this.getConfig();
|
|
66
68
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
67
|
-
return config.plugin.some(
|
|
69
|
+
return config.plugin.some(isPluginEntry);
|
|
68
70
|
}
|
|
69
71
|
return false;
|
|
70
72
|
}
|
|
@@ -326,7 +326,8 @@ export class OpenCodeTool extends BaseTool {
|
|
|
326
326
|
try {
|
|
327
327
|
const config = this.getConfig();
|
|
328
328
|
if (config.plugin && Array.isArray(config.plugin)) {
|
|
329
|
-
|
|
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}@`)));
|
|
330
331
|
}
|
|
331
332
|
return false;
|
|
332
333
|
}
|