@miloya/oc-minimax-status 0.0.3 → 0.0.4

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 (4) hide show
  1. package/README.md +120 -97
  2. package/bin/init.js +111 -111
  3. package/index.js +1 -1
  4. package/package.json +38 -38
package/README.md CHANGED
@@ -1,97 +1,120 @@
1
- # @miloya/oc-minimax-status
2
-
3
- > MiniMax Claude Code 用量查询插件 for OpenCode - 一键安装自动配置
4
-
5
- ## 功能特性
6
-
7
- - 实时用量查询 - 查询 MiniMax Claude Code 套餐使用状态
8
- - 安全认证 - 安全的 token 和 groupId 管理,配置文件与 CLI 版共享
9
- - 美观输出 - 终端友好的进度条展示
10
- - 一键安装 - 自动安装到全局插件目录,无需手动配置
11
-
12
- ## 安装
13
-
14
- ```bash
15
- npm install @miloya/oc-minimax-status
16
- ```
17
-
18
- 安装过程会自动:
19
- 1. 复制插件到全局插件目录 (~/.config/opencode/plugins)
20
- 2. 添加插件到 opencode.json 配置
21
- 3. 显示使用说明
22
-
23
- ## 配置认证
24
-
25
- 插件会复用 Claude Code 版 minimax-status 的配置文件 `~/.minimax-config.json`,如果已配置过则无需重复配置。
26
-
27
- 如需手动配置,创建 `~/.minimax-config.json`:
28
-
29
- ```json
30
- {
31
- "token": "your-api-token",
32
- "groupId": "your-group-id"
33
- }
34
- ```
35
-
36
- ### 如何获取 token groupId
37
-
38
- 1. 登录 [https://platform.minimaxi.com/user-center/payment/coding-plan](https://platform.minimaxi.com/user-center/payment/coding-plan)
39
- 2. 获取 API Key 和 Group ID
40
-
41
- ## 使用方法
42
-
43
- 在 OpenCode 中直接说:
44
-
45
- ### 查询用量
46
- ```
47
- @minimax 查看用量
48
- @minimax status
49
- minimax_status
50
- ```
51
-
52
- ### 管理认证
53
- ```
54
- @minimax auth get
55
- @minimax auth set <token> <groupId>
56
- ```
57
-
58
- ## 输出示例
59
-
60
- ### 用量查询成功
61
-
62
- ```
63
- MiniMax Claude Code 用量状态
64
- ==============================
65
- Model: MiniMax-M2
66
- 已用: 1,500 / 10,000
67
- 进度: [███░░░░░░] 15%
68
- 剩余: 8,500
69
- 重置: 2026/02/26 14:30 (2h 30m)
70
- ==============================
71
- ```
72
-
73
- ### 未配置认证
74
-
75
- ```
76
- 请先配置认证信息!
77
-
78
- 配置方式:
79
- 1. 如果已安装 Claude Code 版 minimax-status,配置文件已自动共享,无需重复配置
80
- 2. 或手动创建 ~/.minimax-config.json:
81
- {
82
- "token": "your-api-token",
83
- "groupId": "your-group-id"
84
- }
85
-
86
- 获取 token 和 groupId:
87
- 1. 登录 https://platform.minimaxi.com/user-center/payment/coding-plan
88
- 2. 获取 API Key 和 Group ID
89
- ```
90
-
91
- ## 相关项目
92
-
93
- - [minimax-status](https://github.com/JochenYang/minimax-status) - CLI 版用量查询工具
94
-
95
- ## License
96
-
97
- MIT
1
+ <h1 align="center">MiniMax Status - OpenCode 插件</h1>
2
+
3
+ <p align="center">
4
+ <a href="https://www.npmjs.com/package/@miloya/oc-minimax-status"><img src="https://img.shields.io/npm/v/@miloya/oc-minimax-status?color=blue" alt="npm version"></a>
5
+ <a href="https://www.npmjs.com/package/@miloya/oc-minimax-status"><img src="https://img.shields.io/npm/dw/@miloya/oc-minimax-status?color=green" alt="npm downloads"></a>
6
+ <a href="LICENSE"><img src="https://img.shields.io/npm/l/@miloya/oc-minimax-status?color=orange" alt="license"></a>
7
+ <a href="https://opencode.ai"><img src="https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-blue?color=blue" alt="Platform"></a>
8
+ </p>
9
+
10
+ <p align="center">
11
+ <em>MiniMax Coding Plan 用量查询插件 for OpenCode - 一键安装自动配置</em>
12
+ </p>
13
+
14
+ ---
15
+
16
+ ## 功能特性
17
+
18
+ - 实时用量查询 - 查询 MiniMax Coding Plan 使用状态
19
+ - 安全认证 - 安全的 token 和 groupId 管理,配置文件与 Claude Code CLI 状态栏版共享(Windows: `%USERPROFILE%\.minimax-config.json`,macOS/Linux: `~/.minimax-config.json`)
20
+ - 美观输出 - 终端友好的进度条展示
21
+ - 一键安装 - 自动安装到全局插件目录,无需手动配置
22
+
23
+ ## 安装
24
+
25
+ ```bash
26
+ npm install @miloya/oc-minimax-status
27
+ ```
28
+
29
+ 安装过程会自动:
30
+ 1. 复制插件到全局插件目录 (~/.config/opencode/plugins)
31
+ 2. 添加插件到 opencode.json 配置
32
+ 3. 显示使用说明
33
+
34
+ ## 配置认证
35
+
36
+ 插件会复用 Claude Code CLI 版 minimax-status 的配置文件,如果已配置过则无需重复配置。
37
+
38
+ 配置文件路径:
39
+ - Windows: `%USERPROFILE%\.minimax-config.json`
40
+ - macOS/Linux: `~/.minimax-config.json`
41
+
42
+ 如需手动配置,创建上述文件:
43
+
44
+ ```json
45
+ {
46
+ "token": "your-api-token",
47
+ "groupId": "your-group-id"
48
+ }
49
+ ```
50
+
51
+ ### 如何获取 token 和 groupId
52
+
53
+ 1. 登录 [https://platform.minimaxi.com/user-center/payment/coding-plan](https://platform.minimaxi.com/user-center/payment/coding-plan)
54
+ 2. 获取 API Key 和 Group ID
55
+
56
+ ## 使用方法
57
+
58
+ OpenCode 对话框中直接说**自然语言**即可(不是命令行),插件会自动识别并调用对应功能:
59
+
60
+ ### 查询用量(自然语言)
61
+ ```
62
+ 查看 minimax 用量
63
+ 我的用量还有多少
64
+ minimax 状态
65
+ ```
66
+
67
+ ### 管理认证(自然语言)
68
+ ```
69
+ 查看 minimax 认证
70
+ 设置 minimax 认证 tokenxxx groupIdxxx
71
+ ```
72
+
73
+ ### 直接调用工具名
74
+ ```
75
+ minimax_status
76
+ minimax_auth action=get
77
+ minimax_auth action=set token=xxx groupId=xxx
78
+ ```
79
+
80
+ ## 输出示例
81
+
82
+ ### 用量查询成功
83
+
84
+ ```
85
+ MiniMax Claude Code 用量状态
86
+ ==============================
87
+ Model: MiniMax-M2
88
+ 已用: 1,500 / 4,500
89
+ 进度: [███░░░░░░] 33%
90
+ 剩余: 3,000
91
+ 重置: 2026/02/26 14:30 (2h 30m)
92
+ ==============================
93
+ ```
94
+
95
+ ### 未配置认证
96
+
97
+ ```
98
+ 请先配置认证信息!
99
+
100
+ 配置方式:
101
+ 1. 如果已安装 Claude Code 版 minimax-status,配置文件已自动共享,无需重复配置
102
+ 2. 或手动创建 ~/.minimax-config.json:
103
+ {
104
+ "token": "your-api-token",
105
+ "groupId": "your-group-id"
106
+ }
107
+
108
+ 获取 token 和 groupId:
109
+ 1. 登录 https://platform.minimaxi.com/user-center/payment/coding-plan
110
+ 2. 获取 API Key 和 Group ID
111
+ ```
112
+
113
+ ## 相关项目
114
+
115
+ - [oc-minimax-status](https://github.com/JochenYang/oc-minimax-status) - OpenCode 插件版(本项目)
116
+ - [minimax-status](https://github.com/JochenYang/minimax-status) - CLI 版用量查询工具
117
+
118
+ ## License
119
+
120
+ MIT License - see [LICENSE](LICENSE) file for details.
package/bin/init.js CHANGED
@@ -1,111 +1,111 @@
1
- /**
2
- * Post-install auto-configuration script
3
- *
4
- * Functions:
5
- * 1. Copy plugin files to global plugins directory
6
- * 2. Add plugin to opencode.json
7
- */
8
-
9
- import fs from "fs";
10
- import path from "path";
11
- import { execSync } from "child_process";
12
-
13
- const PLUGIN_NAME = "oc-minimax-status";
14
- const PLUGIN_PACKAGE_NAME = "@miloya/oc-minimax-status";
15
-
16
- function getGlobalPluginsDir() {
17
- const home = process.env.HOME || process.env.USERPROFILE;
18
- return path.join(home, ".config", "opencode", "plugins");
19
- }
20
-
21
- function getOpencodeConfigPath() {
22
- const home = process.env.HOME || process.env.USERPROFILE;
23
- return path.join(home, ".config", "opencode", "opencode.json");
24
- }
25
-
26
- function getPackageDir() {
27
- return process.cwd();
28
- }
29
-
30
- function updateOpencodeConfig() {
31
- const configPath = getOpencodeConfigPath();
32
- let config = {};
33
-
34
- // Only read existing config, do NOT create new file if not exists
35
- if (fs.existsSync(configPath)) {
36
- try {
37
- config = JSON.parse(fs.readFileSync(configPath, "utf8"));
38
- } catch (e) {
39
- console.warn("Warning: Failed to parse opencode.json, skipping config update");
40
- return;
41
- }
42
- } else {
43
- console.warn("Warning: opencode.json not found, skipping config update");
44
- return;
45
- }
46
-
47
- if (!config.plugin) {
48
- config.plugin = [];
49
- }
50
-
51
- // Use @latest to ensure latest version on each startup
52
- const pluginWithLatest = `${PLUGIN_PACKAGE_NAME}@latest`;
53
-
54
- // Remove old plugin config if exists
55
- config.plugin = config.plugin.filter(p => !p.startsWith("@miloya/oc-minimax"));
56
-
57
- // Add latest version config
58
- if (!config.plugin.includes(pluginWithLatest)) {
59
- config.plugin.push(pluginWithLatest);
60
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
61
- console.log(" [OK] Added to opencode.json plugins (with @latest)");
62
- } else {
63
- console.log(" [OK] Already in opencode.json plugins");
64
- }
65
- }
66
-
67
- async function init() {
68
- console.log("\n-- MiniMax Status Plugin Installing --\n");
69
-
70
- const globalPluginsDir = getGlobalPluginsDir();
71
- const packageDir = getPackageDir();
72
-
73
- if (!fs.existsSync(globalPluginsDir)) {
74
- fs.mkdirSync(globalPluginsDir, { recursive: true });
75
- console.log("[OK] Created global plugins directory");
76
- }
77
-
78
- console.log("-- Copying plugin files...");
79
-
80
- // Copy index.js to plugins directory
81
- const srcIndex = path.join(packageDir, "index.js");
82
- const destIndex = path.join(globalPluginsDir, `${PLUGIN_NAME}.js`);
83
- fs.copyFileSync(srcIndex, destIndex);
84
- console.log(` [OK] Copied ${PLUGIN_NAME}.js`);
85
-
86
- console.log("-- Installing dependencies...");
87
- try {
88
- execSync("npm install axios", {
89
- cwd: globalPluginsDir,
90
- stdio: "pipe"
91
- });
92
- console.log(" [OK] Installed axios");
93
- } catch (e) {
94
- console.log(" [SKIP] axios already installed");
95
- }
96
-
97
- console.log("-- Updating OpenCode config...");
98
- updateOpencodeConfig();
99
-
100
- console.log("\n-- Installation complete --\n");
101
-
102
- console.log("Usage:");
103
- console.log(" 1. Restart OpenCode");
104
- console.log(" 2. In OpenCode, just say:");
105
- console.log(" '@minimax status'");
106
- console.log(" or '@minimax 查看用量'");
107
- console.log("");
108
- console.log(" For more info, see README.md\n");
109
- }
110
-
111
- init().catch(console.error);
1
+ /**
2
+ * Post-install auto-configuration script
3
+ *
4
+ * Functions:
5
+ * 1. Copy plugin files to global plugins directory
6
+ * 2. Add plugin to opencode.json
7
+ */
8
+
9
+ import fs from "fs";
10
+ import path from "path";
11
+ import { execSync } from "child_process";
12
+
13
+ const PLUGIN_NAME = "oc-minimax-status";
14
+ const PLUGIN_PACKAGE_NAME = "@miloya/oc-minimax-status";
15
+
16
+ function getGlobalPluginsDir() {
17
+ const home = process.env.HOME || process.env.USERPROFILE;
18
+ return path.join(home, ".config", "opencode", "plugins");
19
+ }
20
+
21
+ function getOpencodeConfigPath() {
22
+ const home = process.env.HOME || process.env.USERPROFILE;
23
+ return path.join(home, ".config", "opencode", "opencode.json");
24
+ }
25
+
26
+ function getPackageDir() {
27
+ return process.cwd();
28
+ }
29
+
30
+ function updateOpencodeConfig() {
31
+ const configPath = getOpencodeConfigPath();
32
+ let config = {};
33
+
34
+ // Only read existing config, do NOT create new file if not exists
35
+ if (fs.existsSync(configPath)) {
36
+ try {
37
+ config = JSON.parse(fs.readFileSync(configPath, "utf8"));
38
+ } catch (e) {
39
+ console.warn("Warning: Failed to parse opencode.json, skipping config update");
40
+ return;
41
+ }
42
+ } else {
43
+ console.warn("Warning: opencode.json not found, skipping config update");
44
+ return;
45
+ }
46
+
47
+ if (!config.plugin) {
48
+ config.plugin = [];
49
+ }
50
+
51
+ // Use @latest to ensure latest version on each startup
52
+ const pluginWithLatest = `${PLUGIN_PACKAGE_NAME}@latest`;
53
+
54
+ // Remove old plugin config if exists
55
+ config.plugin = config.plugin.filter(p => !p.startsWith("@miloya/oc-minimax"));
56
+
57
+ // Add latest version config
58
+ if (!config.plugin.includes(pluginWithLatest)) {
59
+ config.plugin.push(pluginWithLatest);
60
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
61
+ console.log(" [OK] Added to opencode.json plugins (with @latest)");
62
+ } else {
63
+ console.log(" [OK] Already in opencode.json plugins");
64
+ }
65
+ }
66
+
67
+ async function init() {
68
+ console.log("\n-- MiniMax Status Plugin Installing --\n");
69
+
70
+ const globalPluginsDir = getGlobalPluginsDir();
71
+ const packageDir = getPackageDir();
72
+
73
+ if (!fs.existsSync(globalPluginsDir)) {
74
+ fs.mkdirSync(globalPluginsDir, { recursive: true });
75
+ console.log("[OK] Created global plugins directory");
76
+ }
77
+
78
+ console.log("-- Copying plugin files...");
79
+
80
+ // Copy index.js to plugins directory
81
+ const srcIndex = path.join(packageDir, "index.js");
82
+ const destIndex = path.join(globalPluginsDir, `${PLUGIN_NAME}.js`);
83
+ fs.copyFileSync(srcIndex, destIndex);
84
+ console.log(` [OK] Copied ${PLUGIN_NAME}.js`);
85
+
86
+ console.log("-- Installing dependencies...");
87
+ try {
88
+ execSync("npm install axios", {
89
+ cwd: globalPluginsDir,
90
+ stdio: "pipe"
91
+ });
92
+ console.log(" [OK] Installed axios");
93
+ } catch (e) {
94
+ console.log(" [SKIP] axios already installed");
95
+ }
96
+
97
+ console.log("-- Updating OpenCode config...");
98
+ updateOpencodeConfig();
99
+
100
+ console.log("\n-- Installation complete --\n");
101
+
102
+ console.log("Usage:");
103
+ console.log(" 1. Restart OpenCode");
104
+ console.log(" 2. In OpenCode, just say:");
105
+ console.log(" '@minimax status'");
106
+ console.log(" or '@minimax 查看用量'");
107
+ console.log("");
108
+ console.log(" For more info, see README.md\n");
109
+ }
110
+
111
+ init().catch(console.error);
package/index.js CHANGED
@@ -103,7 +103,7 @@ export const MiniMaxStatusPlugin = async (ctx) => {
103
103
  return {
104
104
  tool: {
105
105
  minimax_status: tool({
106
- description: "查询 MiniMax Claude Code 套餐使用状态,包括已用次数、剩余次数、进度条和重置时间",
106
+ description: "查询 MiniMax Coding Plan 使用状态,包括已用次数、剩余次数、进度条和重置时间",
107
107
  args: {
108
108
  refresh: tool.schema.boolean().optional().describe("强制刷新缓存"),
109
109
  },
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
- {
2
- "name": "@miloya/oc-minimax-status",
3
- "version": "0.0.3",
4
- "description": "MiniMax Claude Code 用量查询插件 for OpenCode - 一键安装自动配置",
5
- "main": "index.js",
6
- "type": "module",
7
- "keywords": ["opencode", "plugin", "minimax", "claude-code", "usage"],
8
- "author": "Jochen",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/JochenYang/minimax-status"
13
- },
14
- "files": [
15
- "index.js",
16
- "bin/",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "dependencies": {
21
- "axios": "^1.6.0"
22
- },
23
- "peerDependencies": {
24
- "@opencode-ai/plugin": "*"
25
- },
26
- "engines": {
27
- "opencode": ">=1.0.0"
28
- },
29
- "scripts": {
30
- "postinstall": "node bin/init.js"
31
- },
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
- "bin": {
36
- "minimax-status-init": "./bin/init.js"
37
- }
38
- }
1
+ {
2
+ "name": "@miloya/oc-minimax-status",
3
+ "version": "0.0.4",
4
+ "description": "MiniMax Coding Plan 用量查询插件 for OpenCode - 一键安装自动配置",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "keywords": ["opencode", "plugin", "minimax", "claude-code", "usage"],
8
+ "author": "Jochen",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/JochenYang/oc-minimax-status"
13
+ },
14
+ "files": [
15
+ "index.js",
16
+ "bin/",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "dependencies": {
21
+ "axios": "^1.6.0"
22
+ },
23
+ "peerDependencies": {
24
+ "@opencode-ai/plugin": "*"
25
+ },
26
+ "engines": {
27
+ "opencode": ">=1.0.0"
28
+ },
29
+ "scripts": {
30
+ "postinstall": "node bin/init.js"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "bin": {
36
+ "minimax-status-init": "./bin/init.js"
37
+ }
38
+ }