@mdrv/opencode-quota 262.0.0 → 262.1.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.
package/bin/install.js CHANGED
@@ -36,6 +36,11 @@ const COPILOT_COMMAND_FILE = path.join(SOURCE_DIR, 'command', 'copilot_quota.md'
36
36
  const COPILOT_SKILL_FILE = path.join(SOURCE_DIR, 'skills', 'copilot-quota', 'SKILL.md')
37
37
  const COPILOT_AGENT_FILE = path.join(SOURCE_DIR, 'agents', 'copilot-quota-exec.md')
38
38
 
39
+ // Kimi Quota files
40
+ const KIMI_COMMAND_FILE = path.join(SOURCE_DIR, 'command', 'kimi_quota.md')
41
+ const KIMI_SKILL_FILE = path.join(SOURCE_DIR, 'skills', 'kimi-quota', 'SKILL.md')
42
+ const KIMI_AGENT_FILE = path.join(SOURCE_DIR, 'agents', 'kimi-quota-exec.md')
43
+
39
44
  const CONFIG_DIR = path.join(os.homedir(), '.config', 'opencode')
40
45
 
41
46
  // GLM Quota targets
@@ -48,6 +53,11 @@ const TARGET_COPILOT_COMMAND = path.join(CONFIG_DIR, 'command', 'copilot_quota.m
48
53
  const TARGET_COPILOT_SKILL = path.join(CONFIG_DIR, 'skills', 'copilot-quota', 'SKILL.md')
49
54
  const TARGET_COPILOT_AGENT = path.join(CONFIG_DIR, 'agents', 'copilot-quota-exec.md')
50
55
 
56
+ // Kimi Quota targets
57
+ const TARGET_KIMI_COMMAND = path.join(CONFIG_DIR, 'command', 'kimi_quota.md')
58
+ const TARGET_KIMI_SKILL = path.join(CONFIG_DIR, 'skills', 'kimi-quota', 'SKILL.md')
59
+ const TARGET_KIMI_AGENT = path.join(CONFIG_DIR, 'agents', 'kimi-quota-exec.md')
60
+
51
61
  // Check which config file exists (opencode.json or opencode.jsonc)
52
62
  const TARGET_CONFIG_JSON = path.join(CONFIG_DIR, 'opencode.json')
53
63
  const TARGET_CONFIG_JSONC = path.join(CONFIG_DIR, 'opencode.jsonc')
@@ -257,6 +267,53 @@ function installCopilotAgent(force) {
257
267
  console.log(` ✓ Created ${TARGET_COPILOT_AGENT}`)
258
268
  }
259
269
 
270
+ /**
271
+ * Install Kimi command file
272
+ */
273
+ function installKimiCommand(force) {
274
+ if (fileExists(TARGET_KIMI_COMMAND) && !force) {
275
+ if (!promptConfirm(`Kimi command file exists: ${TARGET_KIMI_COMMAND}\nOverwrite?`)) {
276
+ console.log(` ⊘ Skipped ${TARGET_KIMI_COMMAND}`)
277
+ return
278
+ }
279
+ }
280
+
281
+ copyFile(KIMI_COMMAND_FILE, TARGET_KIMI_COMMAND)
282
+ console.log(` ✓ Created ${TARGET_KIMI_COMMAND}`)
283
+ }
284
+
285
+ /**
286
+ * Install Kimi skill file
287
+ */
288
+ function installKimiSkill(force) {
289
+ if (fileExists(TARGET_KIMI_SKILL) && !force) {
290
+ if (!promptConfirm(`Kimi skill directory exists: ${path.dirname(TARGET_KIMI_SKILL)}\nOverwrite?`)) {
291
+ console.log(` ⊘ Skipped ${TARGET_KIMI_SKILL}`)
292
+ return
293
+ }
294
+ }
295
+
296
+ copyFile(KIMI_SKILL_FILE, TARGET_KIMI_SKILL)
297
+ console.log(
298
+ ` ✓ Created ${path.join(path.basename(path.dirname(TARGET_KIMI_SKILL)), path.basename(TARGET_KIMI_SKILL))}`,
299
+ )
300
+ }
301
+
302
+ /**
303
+ * Install Kimi agent file
304
+ */
305
+ function installKimiAgent(force) {
306
+ if (fileExists(TARGET_KIMI_AGENT) && !force) {
307
+ if (!promptConfirm(`Kimi agent file exists: ${TARGET_KIMI_AGENT}\nOverwrite?`)) {
308
+ console.log(` ⊘ Skipped ${TARGET_KIMI_AGENT}`)
309
+ return
310
+ }
311
+ }
312
+
313
+ copyFile(KIMI_AGENT_FILE, TARGET_KIMI_AGENT)
314
+ console.log(` ✓ Created ${TARGET_KIMI_AGENT}`)
315
+ }
316
+
260
317
  /**
261
318
  * Update plugin configuration and cleanup old JSON agent
262
319
  */
@@ -384,6 +441,11 @@ function uninstall(globalFlag) {
384
441
  removeDirectory(path.dirname(TARGET_COPILOT_SKILL), path.dirname(TARGET_COPILOT_SKILL))
385
442
  removeFile(TARGET_COPILOT_AGENT, TARGET_COPILOT_AGENT)
386
443
 
444
+ // Remove Kimi Quota files
445
+ removeFile(TARGET_KIMI_COMMAND, TARGET_KIMI_COMMAND)
446
+ removeDirectory(path.dirname(TARGET_KIMI_SKILL), path.dirname(TARGET_KIMI_SKILL))
447
+ removeFile(TARGET_KIMI_AGENT, TARGET_KIMI_AGENT)
448
+
387
449
  removeConfig()
388
450
  removePackage(globalFlag)
389
451
  }
@@ -423,11 +485,16 @@ function main() {
423
485
  installCopilotSkill(forceFlag)
424
486
  installCopilotAgent(forceFlag)
425
487
 
488
+ // Kimi Quota installation
489
+ installKimiCommand(forceFlag)
490
+ installKimiSkill(forceFlag)
491
+ installKimiAgent(forceFlag)
492
+
426
493
  updatePluginConfig()
427
494
 
428
495
  console.log()
429
496
  console.log('✓ Installation complete!')
430
- console.log('✓ Restart OpenCode to use /glm_quota and /copilot_quota commands')
497
+ console.log('✓ Restart OpenCode to use /glm_quota, /copilot_quota, and /kimi_quota commands')
431
498
  } catch (error) {
432
499
  console.error(`\n✗ Installation failed: ${error instanceof Error ? error.message : String(error)}`)
433
500
  console.error('✗ Check file permissions and try again')
File without changes
File without changes
File without changes
@@ -0,0 +1,27 @@
1
+ ---
2
+ description: Minimal executor for Kimi quota tool
3
+ mode: subagent
4
+ hidden: true
5
+ permissions:
6
+ edit: deny
7
+ bash: deny
8
+ ---
9
+
10
+ ## CRITICAL INSTRUCTION
11
+
12
+ You are a minimal tool executor for Kimi quota checking. Your only purpose is to execute the kimi_quota tool when requested.
13
+
14
+ When asked to check Kimi quota:
15
+
16
+ 1. Call the kimi_quota tool
17
+ 2. Return the tool's output EXACTLY as received
18
+
19
+ Do NOT:
20
+
21
+ - Explain the output
22
+ - Summarize or paraphrase
23
+ - Add any commentary or reasoning
24
+ - Modify the output in any way
25
+ - Interpret the results
26
+
27
+ Simply execute the tool and return its output verbatim.
@@ -0,0 +1,6 @@
1
+ ---
2
+ description: Execute Kimi quota check
3
+ agent: kimi-quota-exec
4
+ ---
5
+
6
+ Execute kimi_quota tool and return its output EXACTLY as received - do not modify, summarize, or change the output in any way.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: kimi-quota
3
+ description: Query Moonshot AI Kimi coding usage statistics
4
+ parameters:
5
+ detailed:
6
+ type: boolean
7
+ optional: true
8
+ description: Show detailed output with raw data
9
+ ---
10
+
11
+ Query Moonshot AI Kimi platform for coding usage statistics, including token usage, API calls, and quota limits.
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@mdrv/opencode-quota",
3
- "version": "v262.0.0",
3
+ "version": "v262.1.0",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for querying Z.AI GLM Coding Plan and GitHub Copilot usage statistics",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
9
- "glm-quota": "./bin/glm-quota.js",
10
- "copilot-quota": "./bin/copilot-quota.js",
11
- "kimi-quota": "./bin/kimi-quota.js"
9
+ "glm-quota": "./dist/bin/glm-quota.js",
10
+ "copilot-quota": "./dist/bin/copilot-quota.js",
11
+ "kimi-quota": "./dist/bin/kimi-quota.js"
12
12
  },
13
13
  "files": [
14
14
  "dist",