This file provides guidance to Claude Code when working with this repository.
Z.ai GLM Usage Tracker - A VS Code/Cursor extension to monitor Z.ai API usage in the status bar.
Publisher: melon-hub
| Platform | URL | Used By |
|---|---|---|
| VS Code Marketplace | https://marketplace.visualstudio.com/items?itemName=melon-hub.zai-usage-tracker | VS Code |
| Open VSX | https://open-vsx.org/extension/melon-hub/zai-usage-tracker | Windsurf, VSCodium, other forks |
| GitHub | https://github.com/melon-hub/zai-usage-tracker | Source code |
Note: Cursor uses a curated marketplace - requires manual VSIX install.
Tokens are stored securely in home directory:
~/.vsce-token- VS Code Marketplace PAT~/.ovsx-token- Open VSX token
Use command substitution: $(cat ~/.vsce-token)
-
Update version in
package.json -
Update changelog.md with changes
-
Commit and push to GitHub:
git add -A && git commit -m "v1.x.x - description" && git push
-
Publish to VS Code Marketplace:
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && nvm use 20 npx vsce publish -p $(cat ~/.vsce-token)
-
Publish to Open VSX:
npx ovsx publish -p $(cat ~/.ovsx-token)
npx vsce publish -p $(cat ~/.vsce-token) && npx ovsx publish -p $(cat ~/.ovsx-token)# Setup Node 20 (required for vsce)
export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && nvm use 20
# Compile TypeScript
npm run compile
# Watch mode
npm run watch
# Package without publishing
npx vsce package
# Lint
npm run lintzai-usage-tracker/
├── src/
│ ├── extension.ts # Entry point
│ ├── api/
│ │ └── zaiService.ts # Z.ai API client
│ ├── config/
│ │ └── configuration.ts # Settings management
│ └── statusBar/
│ └── usageIndicator.ts # Status bar UI
├── out/ # Compiled JS (gitignored)
├── package.json # Extension manifest
├── .vscodeignore # Files excluded from VSIX
└── .gitignore # Files excluded from git
VS Code Marketplace:
- https://dev.azure.com → Profile → Personal access tokens
- New Token → Scopes: Marketplace > Manage
- Save:
echo "TOKEN" > ~/.vsce-token && chmod 600 ~/.vsce-token
Open VSX:
- https://open-vsx.org → Profile → Access Tokens
- Create token
- Save:
echo "TOKEN" > ~/.ovsx-token && chmod 600 ~/.ovsx-token
# Check file exists
[ -f ~/.vsce-token ] && echo "VSCE token: $(wc -c < ~/.vsce-token) bytes"
[ -f ~/.ovsx-token ] && echo "OVSX token: $(wc -c < ~/.ovsx-token) bytes"
# Verify VSCE token works
npx vsce verify-pat melon-hub -p $(cat ~/.vsce-token)- Never commit tokens to git
- Never grep/cat token files in shared sessions
- Token files should have 600 permissions
- Revoke and regenerate tokens if exposed
- All debug files are in .gitignore
- Running in WSL on Windows
- Requires Node 20+ for vsce (use nvm)
- Git config: user.name = "melon-hub", user.email = "melon-hub@users.noreply.github.com"