@miloya/oc-minimax-status 0.1.5 → 0.2.0

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.
Files changed (2) hide show
  1. package/index.js +0 -55
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -10,67 +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 syncPluginFiles() {
21
- try {
22
- let pkgDir;
23
- const home = process.env.HOME || process.env.USERPROFILE;
24
-
25
- // Try multiple ways to find package directory
26
- if (process.env.BUN_INSTALL_CACHE_DIR) {
27
- // Bun cache directory
28
- pkgDir = path.join(process.env.BUN_INSTALL_CACHE_DIR, "node_modules", "@miloya", "oc-minimax-status");
29
- } else if (process.env.npm_package_json) {
30
- pkgDir = path.dirname(process.env.npm_package_json);
31
- } else if (typeof import.meta !== "undefined" && import.meta.url) {
32
- pkgDir = path.dirname(fileURLToPath(import.meta.url));
33
- } else {
34
- // Fallback: OpenCode uses ~/.cache/opencode/
35
- pkgDir = path.join(home, ".cache", "opencode", "node_modules", "@miloya", "oc-minimax-status");
36
- }
37
-
38
- const plugins = path.join(home, ".config", "opencode", "plugins");
39
- const commands = path.join(home, ".config", "opencode", "commands");
40
-
41
- // Copy index.js to plugins
42
- const srcIndex = path.join(pkgDir, "index.js");
43
- const destIndex = path.join(plugins, "oc-minimax-status.js");
44
- if (fs.existsSync(srcIndex)) {
45
- if (!fs.existsSync(plugins)) {
46
- fs.mkdirSync(plugins, { recursive: true });
47
- }
48
- fs.copyFileSync(srcIndex, destIndex);
49
- }
50
-
51
- // Copy commands
52
- const srcCmdDir = path.join(pkgDir, "commands");
53
- if (fs.existsSync(srcCmdDir)) {
54
- if (!fs.existsSync(commands)) {
55
- fs.mkdirSync(commands, { recursive: true });
56
- }
57
- const files = fs.readdirSync(srcCmdDir);
58
- for (const file of files) {
59
- if (file.endsWith(".md")) {
60
- fs.copyFileSync(
61
- path.join(srcCmdDir, file),
62
- path.join(commands, file)
63
- );
64
- }
65
- }
66
- }
67
- } catch (e) {
68
- // Silent fail
69
- }
70
- }
71
-
72
- syncPluginFiles();
73
-
74
19
  function getCredentials() {
75
20
  try {
76
21
  if (fs.existsSync(CONFIG_PATH)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miloya/oc-minimax-status",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "description": "MiniMax Coding Plan 用量查询插件 for OpenCode - 一键安装自动配置",
5
5
  "main": "index.js",
6
6
  "type": "module",