@miloya/oc-minimax-status 0.0.9 → 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 -40
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10,52 +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(path.dirname(fileURLToPath(import.meta.url)));
|
|
31
|
-
const { plugins, commands } = getGlobalDirs();
|
|
32
|
-
|
|
33
|
-
const srcIndex = path.join(currentFile, "index.js");
|
|
34
|
-
const destIndex = path.join(plugins, "oc-minimax-status.js");
|
|
35
|
-
if (fs.existsSync(srcIndex)) {
|
|
36
|
-
fs.copyFileSync(srcIndex, destIndex);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const srcCmd = path.join(currentFile, "commands", "minimax.md");
|
|
40
|
-
const destCmd = path.join(commands, "minimax.md");
|
|
41
|
-
if (fs.existsSync(srcCmd)) {
|
|
42
|
-
if (!fs.existsSync(commands)) fs.mkdirSync(commands, { recursive: true });
|
|
43
|
-
fs.copyFileSync(srcCmd, destCmd);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const srcSetCmd = path.join(currentFile, "commands", "minimax-set.md");
|
|
47
|
-
const destSetCmd = path.join(commands, "minimax-set.md");
|
|
48
|
-
if (fs.existsSync(srcSetCmd)) {
|
|
49
|
-
if (!fs.existsSync(commands)) fs.mkdirSync(commands, { recursive: true });
|
|
50
|
-
fs.copyFileSync(srcSetCmd, destSetCmd);
|
|
51
|
-
}
|
|
52
|
-
} catch (e) {
|
|
53
|
-
// Ignore sync errors
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
syncPluginFiles();
|
|
58
|
-
|
|
59
19
|
function getCredentials() {
|
|
60
20
|
try {
|
|
61
21
|
if (fs.existsSync(CONFIG_PATH)) {
|