@yakumoryo/minimax-plan-usage 0.2.3 → 0.2.5

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimax-plan-usage",
3
3
  "description": "Query MiniMax Coding Plan usage statistics",
4
- "version": "0.1.0",
4
+ "version": "0.2.5",
5
5
  "owner": "user"
6
6
  }
@@ -1,4 +1,5 @@
1
1
  ---
2
+ name: usage-query
2
3
  allowed-tools: all
3
4
  description: Query MiniMax Coding Plan usage statistics
4
5
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yakumoryo/minimax-plan-usage",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "MiniMax Coding Plan setup helper and usage query tool",
5
5
  "type": "module",
6
6
  "keywords": [
package/query.js CHANGED
@@ -74,7 +74,15 @@ function setup(token) {
74
74
  function queryUsage() {
75
75
  return new Promise((resolve, reject) => {
76
76
  const apiUrl = `${API_HOST}/v1/api/openplatform/coding_plan/remains`;
77
- const authToken = process.env.ANTHROPIC_AUTH_TOKEN;
77
+ let authToken = process.env.ANTHROPIC_AUTH_TOKEN;
78
+
79
+ // Fallback to settings.json if env var not set
80
+ if (!authToken) {
81
+ try {
82
+ const settings = JSON.parse(readFileSync(SETTINGS_PATH, 'utf-8'));
83
+ authToken = settings.env?.ANTHROPIC_AUTH_TOKEN;
84
+ } catch {}
85
+ }
78
86
 
79
87
  if (!authToken) {
80
88
  return reject(new Error('ANTHROPIC_AUTH_TOKEN not set. Run: npx @yakumoryo/minimax-plan-usage setup <token>'));
@@ -69,7 +69,7 @@ const queryUsage = () => {
69
69
  }
70
70
 
71
71
  const m = json.model_remains[0];
72
- const remaining = m.current_interval_usage_count;
72
+ const remaining = m.current_interval_remaining_count;
73
73
  const total = m.current_interval_total_count;
74
74
  const used = total - remaining;
75
75
  const percentage = Math.round((used / total) * 100);
@@ -87,7 +87,7 @@ const queryUsage = () => {
87
87
  minute: '2-digit',
88
88
  });
89
89
 
90
- const weeklyRemaining = m.current_weekly_usage_count;
90
+ const weeklyRemaining = m.current_weekly_remaining_count;
91
91
  const weeklyTotal = m.current_weekly_total_count;
92
92
  const weeklyUsed = weeklyTotal - weeklyRemaining;
93
93
  const weeklyPercentage = Math.floor((weeklyUsed / weeklyTotal) * 100);