@yakumoryo/minimax-plan-usage 0.2.3 → 0.2.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 (2) hide show
  1. package/package.json +1 -1
  2. package/query.js +9 -1
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.4",
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>'));