@miloya/oc-minimax-status 0.1.0 → 0.1.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/index.js +0 -46
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10,58 +10,12 @@ import { tool } from "@opencode-ai/plugin";
|
|
|
10
10
|
import axios from "axios";
|
|
11
11
|
import fs from "fs";
|
|
12
12
|
import path from "path";
|
|
13
|
-
import { fileURLToPath } from "url";
|
|
14
13
|
|
|
15
14
|
const CONFIG_PATH = path.join(
|
|
16
15
|
process.env.HOME || process.env.USERPROFILE,
|
|
17
16
|
".minimax-config.json"
|
|
18
17
|
);
|
|
19
18
|
|
|
20
|
-
function getGlobalDirs() {
|
|
21
|
-
const home = process.env.HOME || process.env.USERPROFILE;
|
|
22
|
-
return {
|
|
23
|
-
plugins: path.join(home, ".config", "opencode", "plugins"),
|
|
24
|
-
commands: path.join(home, ".config", "opencode", "commands"),
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function syncPluginFiles() {
|
|
29
|
-
try {
|
|
30
|
-
const currentFile = path.dirname(fileURLToPath(import.meta.url));
|
|
31
|
-
const home = process.env.HOME || process.env.USERPROFILE;
|
|
32
|
-
const plugins = path.join(home, ".config", "opencode", "plugins");
|
|
33
|
-
const commands = path.join(home, ".config", "opencode", "commands");
|
|
34
|
-
|
|
35
|
-
// Copy index.js to plugins
|
|
36
|
-
const srcIndex = path.join(currentFile, "index.js");
|
|
37
|
-
const destIndex = path.join(plugins, "oc-minimax-status.js");
|
|
38
|
-
if (fs.existsSync(srcIndex)) {
|
|
39
|
-
if (!fs.existsSync(plugins)) fs.mkdirSync(plugins, { recursive: true });
|
|
40
|
-
fs.copyFileSync(srcIndex, destIndex);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Copy commands
|
|
44
|
-
const srcCmdDir = path.join(currentFile, "commands");
|
|
45
|
-
if (fs.existsSync(srcCmdDir)) {
|
|
46
|
-
if (!fs.existsSync(commands)) fs.mkdirSync(commands, { recursive: true });
|
|
47
|
-
|
|
48
|
-
const files = fs.readdirSync(srcCmdDir);
|
|
49
|
-
for (const file of files) {
|
|
50
|
-
if (file.endsWith(".md")) {
|
|
51
|
-
fs.copyFileSync(
|
|
52
|
-
path.join(srcCmdDir, file),
|
|
53
|
-
path.join(commands, file)
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
} catch (e) {
|
|
59
|
-
console.error("Sync error:", e.message);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
syncPluginFiles();
|
|
64
|
-
|
|
65
19
|
function getCredentials() {
|
|
66
20
|
try {
|
|
67
21
|
if (fs.existsSync(CONFIG_PATH)) {
|