@miloya/oc-minimax-status 0.1.0 → 0.1.2
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/bin/init.js +12 -8
- package/index.js +0 -46
- package/package.json +1 -1
package/bin/init.js
CHANGED
|
@@ -88,17 +88,21 @@ async function init() {
|
|
|
88
88
|
fs.copyFileSync(srcIndex, destIndex);
|
|
89
89
|
console.log(` [OK] Copied ${PLUGIN_NAME}.js`);
|
|
90
90
|
|
|
91
|
-
// Copy command
|
|
91
|
+
// Copy command files
|
|
92
92
|
const commandDir = getCommandDir();
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
|
|
94
|
+
if (!fs.existsSync(commandDir)) {
|
|
95
|
+
fs.mkdirSync(commandDir, { recursive: true });
|
|
96
|
+
}
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
const cmdFiles = ["minimax.md", "minimax-set.md"];
|
|
99
|
+
for (const cmdFile of cmdFiles) {
|
|
100
|
+
const srcCommand = path.join(packageDir, "commands", cmdFile);
|
|
101
|
+
const destCommand = path.join(commandDir, cmdFile);
|
|
102
|
+
if (fs.existsSync(srcCommand)) {
|
|
103
|
+
fs.copyFileSync(srcCommand, destCommand);
|
|
104
|
+
console.log(` [OK] Copied /${cmdFile.replace(".md", "")} command`);
|
|
99
105
|
}
|
|
100
|
-
fs.copyFileSync(srcCommand, destCommand);
|
|
101
|
-
console.log(` [OK] Copied /minimax command`);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
console.log("-- Installing dependencies...");
|
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)) {
|