@miloya/oc-minimax-status 0.1.5 → 0.1.6

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