@benchsdk/cli

中文文档
0.9.1发布于 2026/10/28MITTypeScriptESM + CJS构建来源已验证近 30 天下载 6424

CLI for querying ComputeSDK benchmarks platform data

原始使用文档
文档目录8 节
  1. What it provides
  2. Install
  3. Authentication precedence
  4. Configuration files
  5. Environment variables
  6. Programmatic usage
  7. CLI commands
  8. License

@benchsdk/cli

Programmatic CLI for authenticating with and querying the ComputeSDK benchmarks platform.

You rarely need to install this package directly: it is bundled into the bench binary shipped by @benchsdk/runner. Use this package when you want to build your own CLI or script on top of the same auth, config, and platform-query primitives.

What it provides

  • run(argv) — parse and dispatch a bench invocation for the platform commands.
  • resolveAuth(override?) — resolve base URL and credentials from env vars, ~/.benchsdk/config.json, and ~/.benchsdk/credentials.json.
  • createApiClient(override?) — authenticated BenchmarkClient plus resolved CliAuth.
  • AuthError — thrown when no credentials can be found or a token cannot be refreshed.

Install

pnpm add @benchsdk/cli

Authentication precedence

  1. --api-key <key> (passed to resolveAuth / createApiClient)
  2. BENCHMARKS_PLATFORM_TOKEN
  3. BENCHMARKS_PLATFORM_API_KEY
  4. OAuth tokens saved by bench auth login in ~/.benchsdk/credentials.json

At least one credential is required for commands that touch the platform.

Configuration files

~/.benchsdk/config.json stores non-secret defaults:

{
  "baseUrl": "https://platform.computesdk.com",
  "org": "computesdk",
  "format": "table"
}

Credentials are stored separately in ~/.benchsdk/credentials.json with 0600 permissions.

Environment variables

  • BENCHMARKS_PLATFORM_URL — platform root URL (default: https://platform.computesdk.com)
  • BENCHMARKS_PLATFORM_API_KEY
  • BENCHMARKS_PLATFORM_TOKEN

Programmatic usage

import { resolveAuth, createApiClient } from '@benchsdk/cli';

const auth = await resolveAuth({ org: 'computesdk' });
const { api } = await createApiClient({ org: 'computesdk' });

const benchmarks = await api.listBenchmarks({ limit: 10 });

CLI commands

When installed with @benchsdk/runner, these are available through the bench binary:

  • bench auth login — OAuth device-code login
  • bench auth logout
  • bench auth status
  • bench org list
  • bench org use <slug>
  • bench benchmarks list [--limit N] [--offset N]
  • bench runs list <slug> [--limit N] [--offset N] [--participant <list>] [--since <when>] [--until <when>] [--day YYYY-MM-DD] [--tz <zone>] [--source-org <slug>]
  • bench runs show <slug> <runId>
  • bench results <slug> [--run <id>] [--format json|table] [--participant <list>] [--steps <list>|all] [--since <when>] [--until <when>] [--day YYYY-MM-DD] [--tz <zone>] [--source-org <slug>] [--limit N] [--offset N]
  • bench artifacts list <slug> <runId> [--worker <id>]
  • bench export <slug> [--run <id>] [--out <dir>]

See the benchsdk-cli skill for the full CLI reference, OAuth device-code flow, and CI/non-interactive use.

License

MIT

版本与发布记录

@benchsdk/cli 共发布 8 个版本,首次发布于 2026/09/09;过去 12 个月发布了 8 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.1latest2026/10/2811 天前
0.9.02026/10/2514 天前
0.8.02026/10/2315 天前
0.7.22026/10/2216 天前
0.7.12026/10/071 个月前
0.7.02026/10/061 个月前

关于 @benchsdk/cli 的常见问题

@benchsdk/cli 是什么?

CLI for querying ComputeSDK benchmarks platform data

如何安装 @benchsdk/cli?

在项目目录运行 npm install @benchsdk/cli,或使用 pnpm add / yarn add / bun add。

@benchsdk/cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@benchsdk/cli 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@benchsdk/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@benchsdk/cli 可以商用吗?

@benchsdk/cli 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@benchsdk/cli 的下载量有多少?

根据 npm 官方下载统计,@benchsdk/cli 在 2026/10/08 – 2026/11/06 这 30 天内被下载 6,424 次,日均约 214 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@benchsdk/cli 还在维护吗?

最新版本 0.9.1 发布于 2026/10/28(11 天前);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/09/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。