Skip to content

feat(usage): add token plan usage view - #140

Open
sonicg83 wants to merge 1 commit into
modelstudioai:mainfrom
sonicg83:feat/usage-token-plan
Open

feat(usage): add token plan usage view#140
sonicg83 wants to merge 1 commit into
modelstudioai:mainfrom
sonicg83:feat/usage-token-plan

Conversation

@sonicg83

@sonicg83 sonicg83 commented Aug 5, 2026

Copy link
Copy Markdown

No description provided.

@sonicg83 sonicg83 closed this Aug 5, 2026
@sonicg83

sonicg83 commented Aug 5, 2026

Copy link
Copy Markdown
Author

Summary

新增 bl usage token-plan,用于查看 Token Plan 的个人套餐用量。

  • 新增 --json:仅输出接口返回的四个核心字段。
  • 新增 --view:输出终端友好的用量视图,展示本地时区的生成/重置时间。
  • 通过 Console Gateway 调用 zeldaHttp.apikeyMgr./tokenplan/personal/api/v2/usage,复用既有 auth: "console" 鉴权路径。
  • 进度条颜色:使用率 < 75% 为绿色,75%–89.99% 为黄色,>= 90% 为红色。
  • 补充命令注册、usage --help、Skill reference 与 E2E / 单元测试。
  • 服务端错误保持原样透传;仅对本地可权威判断的响应格式异常进行本地报错。
  • 未修改任何包版本号。

Validation

  • pnpm check
    • 582 个文件格式检查通过
    • 0 errors;保留 3 条与本改动无关的既有 lint/type warnings
  • pnpm --filter bailian-cli-commands exec vp test tests/token-plan-usage.test.ts tests/e2e/usage-token-plan.e2e.test.ts --maxWorkers=1 --no-file-parallelism
  • 使用已登录的 Console 凭证验证 bl usage token-plan --jsonbl usage token-plan --view
  • 验证 bl usage --help 包含 token-plan

Notes

完整 pnpm ready 在 WSL 并行执行 E2E 时曾遇到 tsx/esbuildspawn EBUSY 环境资源冲突;改为单 worker 顺序执行后,相关测试通过。该问题未涉及本次命令逻辑。

@sonicg83 sonicg83 reopened this Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant