@v1nvn/zai 0.23.0 → 0.24.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/README.md +56 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @v1nvn/zai
|
|
2
|
+
|
|
3
|
+
The CLI behind the zai plugin: it reports GLM Coding Plan quota and usage for
|
|
4
|
+
the current account, straight to the terminal — no model tokens, no browser.
|
|
5
|
+
|
|
6
|
+
User-facing docs: [root README](../../README.md).
|
|
7
|
+
|
|
8
|
+
## Quickstart
|
|
9
|
+
|
|
10
|
+
In Claude Code, the plugin is the way in — `/zai:usage` runs this CLI through
|
|
11
|
+
a `UserPromptExpansion` hook with zero model tokens:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
claude plugin marketplace add v1nvn/agentic
|
|
15
|
+
claude plugin install zai@agentic
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
In a terminal, bare:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npx -y @v1nvn/zai@0.24.0
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
| Invocation | Does |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `npx -y @v1nvn/zai@0.24.0` | usage report — models, quota window, remaining balance |
|
|
29
|
+
| `npx -y @v1nvn/zai@0.24.0 --auth-token TOKEN` | same, key on the command line (visible in `ps`) |
|
|
30
|
+
|
|
31
|
+
Auth resolves in order: `--auth-token` → `ZAI_AUTH_TOKEN` →
|
|
32
|
+
`ANTHROPIC_AUTH_TOKEN`. The key talks to `api.z.ai` — a Claude proxy var
|
|
33
|
+
pointing elsewhere is not zai config; set `ZAI_AUTH_TOKEN`.
|
|
34
|
+
|
|
35
|
+
## Develop
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
yarn workspace @v1nvn/zai build
|
|
39
|
+
yarn workspace @v1nvn/zai test
|
|
40
|
+
yarn lint && yarn typecheck # from the repo root
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Modules
|
|
44
|
+
|
|
45
|
+
| File | Role |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `src/index.ts` | bin entry (`zai-usage`) — dispatch, exit codes |
|
|
48
|
+
| `src/usage.ts` | the GLM API call and the report it builds |
|
|
49
|
+
| `src/resolve.ts` | auth-token resolution chain |
|
|
50
|
+
| `src/format.ts` | the printed table |
|
|
51
|
+
|
|
52
|
+
## Contracts
|
|
53
|
+
|
|
54
|
+
- One job: print the report, exit 0. Nothing is written anywhere.
|
|
55
|
+
- The hook path and the terminal path run the same bin — the hook only
|
|
56
|
+
feeds it the session's transcript context.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v1nvn/zai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "GLM Coding Plan usage and quota report — the zai-usage CLI behind the zai plugin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"node": ">=22"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@v1nvn/agentic-core": "^0.
|
|
37
|
+
"@v1nvn/agentic-core": "^0.24.0",
|
|
38
38
|
"commander": "^15.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|