@adobe/aio-cli-plugin-telemetry

中文文档
2.2.0发布于 2026/06/11Apache-2.0近 30 天下载 2.4万

Adobe Developer cli telemetry

原始使用文档
文档目录7 节
  1. aio telemetry yes
  2. Configuration
  3. Overriding the telemetry POST URL
  4. Opting out via environment variable
  5. Flush architecture
  6. Agent detection
  7. POST data

aio-cli-plugin-telemetry

Adobe Developer cli usage telemetry

License oclif Version Downloads/week Codecov Coverage Github Issues Github Pull Requests

Commands

aio telemetry yes

Allow the cli to collect anonymous usage data

USAGE
  $ aio telemetry yes
  $ aio telemetry off
  $ aio telemetry

ARGUMENTS
  [STATE]  (on|off|yes|no) set telemetry state

DESCRIPTION
  Allow the cli to collect anonymous usage data

See code: src/commands/telemetry/index.js

Configuration

When this plugin is hosted by different CLIs:

  • aioTelemetry (optional object in the root package.json of the host CLI — the same pjson oclif passes into the init hook):
    • postUrl (optional string): HTTPS URL of the telemetry proxy that receives POSTed metric batches. Use this when your CLI should send telemetry to a different App Builder action or gateway than the plugin default.
    • fetchHeaders: Optional extra headers merged into telemetry requests (Content-Type is always set)
    • productPrivacyPolicyLink: A link shown in the one-time telemetry notice (what is collected and how to opt out)
  • productName: How to refer to the CLI in the telemetry notice (from displayName or name in package.json)
  • productBin: Shown in help text (from bin in package.json; if several bins exist, the first is used). Example: run ${productBin} telemetry on

Overriding the telemetry POST URL

Resolution order (first match wins):

  1. aioTelemetry.postUrl in the host CLI package.json
  2. AIO_TELEMETRY_POST_URL environment variable (non-empty string)
  3. Built-in default in the plugin (DEFAULT_TELEMETRY_POST_URL in src/telemetry-lib.js)

Host package.json example:

{
  "name": "my-cli",
  "bin": { "mycli": "./bin/run.js" },
  "aioTelemetry": {
    "postUrl": "https://<namespace>-<project>.adobeio-static.net/api/v1/web/<package>/<action>"
  }
}

Environment override (no package.json change; useful for CI, staging, or local proxy debugging):

export AIO_TELEMETRY_POST_URL='https://<namespace>-<project>.adobeio-static.net/api/v1/web/<package>/<action>'
mycli app deploy

The resolved URL is passed to the flush worker on each telemetry send; it applies for the rest of that CLI process after init runs.

Opting out via environment variable

Telemetry is suppressed when AIO_TELEMETRY_DISABLED is set to one of true, 1, or yes (exact match; case-sensitive). Other values such as 0, false, no, or an empty string do not disable telemetry via this variable.

This does not change the persisted opt-out state. Useful for CI pipelines and scripted environments.

AIO_TELEMETRY_DISABLED=true aio app deploy
AIO_TELEMETRY_DISABLED=1 aio app deploy
AIO_TELEMETRY_DISABLED=yes aio app deploy

Flush architecture

Telemetry is best-effort: events are not persisted when the proxy is down or the network fails.

A flush happens on a terminal event — postrun (command succeeded), command-error (command threw), or command-not-found. oclif runs postrun only on success, so command-error/command-not-found must flush on their own; otherwise error telemetry (the most valuable signal) would be buffered and silently dropped on exit. On a terminal event, any in-memory metrics from earlier hooks in the same command are merged with the terminal metric and the combined batch is handed off to a fire-and-forget detached subprocess (src/flush-worker.js). The parent CLI spawns the worker and immediately unref()s it, so the CLI can exit without waiting for the HTTP POST. If the POST fails (network error or non-2xx response), the batch is dropped; telemetry must not block or slow normal CLI use.

Non-terminal events (for example telemetry-notice) are held in an in-memory buffer until the next terminal event flushes them. If the process exits before any terminal event (crash, SIGKILL), buffered events are lost. The buffer is cleared when telemetry is disabled or when init runs again (new command session).

Agent detection

The plugin detects whether the CLI is being invoked by an AI agent or a human by inspecting environment variables at the time of the event. The detected context is included in every event as invocation_context ("agent" or "human") and agent_name.

Supported agents detected automatically:

Environment variableDetected agent name
AGENTvalue of the variable (or "generic" if 1/true)
AI_AGENTvalue of the variable (or "generic" if 1/true)
AIO_AGENTaio-opt-in
AIO_INVOCATION_CONTEXT=agentaio-opt-in
CURSOR_AGENTcursor
CLAUDECODE / CLAUDE_CODEclaude
GEMINI_CLIgemini
CODEX_SANDBOXcodex
AUGMENT_AGENTaugment
CLINE_ACTIVEcline
OPENCODE_CLIENTopencode
REPL_IDreplit
PATH containing github.copilot-chatgithub-copilot

To opt into agent tracking without setting a tool-specific variable, set AIO_INVOCATION_CONTEXT=agent.

POST data

The eventData attribute is always a string. Objects and arrays are stored as a JSON text (e.g. "{}", "{\"message\":\"…\"}"). String payloads (such as the telemetry notice outcome shown) are stored as that plain text without an extra layer of JSON quoting. Numbers and booleans use their usual string forms ("0", "false").

Example shape of the metric payload:

[{
  "metrics": [{
    "name": "aio.cli.telemetry",
    "type": "gauge",
    "value": 1,
    "timestamp": 1673404918437,
    "attributes": {
      "eventName": "postrun",
      "eventData": "{}",
      "cliVersion": "@adobe/[email protected]",
      "clientId": 264421030538,
      "command": "app:deploy",
      "commandDuration": 5661,
      "commandFlags": "",
      "commandSuccess": true,
      "nodeVersion": "v22.21.1",
      "osNameVersion": "macOS Sequoia 15.4",
      "invocation_context": "human",
      "agent_name": "unknown"
    }
  }]
}]

版本与发布记录

@adobe/aio-cli-plugin-telemetry 共发布 17 个版本,首次发布于 2022/03/29;过去 12 个月发布了 3 个版本。

版本发布日期距今
2.2.0latest2026/06/114 个月前
2.1.02026/05/075 个月前
2.0.32025/11/1211 个月前
2.0.22024/02/082 年前
2.0.12024/01/232 年前
2.0.02024/01/112 年前

其他发布通道:next → 1.2.0-pre.2024-01-09.sha-e30a7fd0。

关于 @adobe/aio-cli-plugin-telemetry 的常见问题

@adobe/aio-cli-plugin-telemetry 是什么?

Adobe Developer cli telemetry

如何安装 @adobe/aio-cli-plugin-telemetry?

在项目目录运行 npm install @adobe/aio-cli-plugin-telemetry,或使用 pnpm add / yarn add / bun add。

@adobe/aio-cli-plugin-telemetry 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adobe__aio-cli-plugin-telemetry 是否存在。

@adobe/aio-cli-plugin-telemetry 需要什么版本的 Node.js?

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

@adobe/aio-cli-plugin-telemetry 可以商用吗?

@adobe/aio-cli-plugin-telemetry 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/aio-cli-plugin-telemetry 的下载量有多少?

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

@adobe/aio-cli-plugin-telemetry 还在维护吗?

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