# @amplitude/ampli 中文文档

规范地址：https://npmcn.com/package/%40amplitude/ampli/

版本：1\.36\.6
npm 元数据更新时间：2026-07-10T19:21:05.570Z
中文译文更新时间：2026-11-06T01:20:30.906Z
软件包许可：UNLICENSED

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40amplitude/ampli
原文对照：https://npmcn.com/package/%40amplitude/ampli/?lang=original
项目主页：https://amplitude.com/

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：5.5 MB，390 个文件
- 模块格式：CommonJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=12\.0\.0
- 运行依赖：51 个
- 首次发布：2021-10-01T18:09:27.533Z
- 最新版本发布：2026-07-10T19:21:05.428Z
- 近 30 天下载量：806874（2026-10-06 至 2026-11-04，npm 官方下载统计）
- 已发布版本数：66（近 12 个月 4 个）

## 中文简介

振幅 CLI

## 安装

```sh
npm install @amplitude/ampli
```

也可以使用：`pnpm add @amplitude/ampli`、`yarn add @amplitude/ampli`、`bun add @amplitude/ampli`

## README

# 语义

振幅 CLI

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io/) [![Version](https://img.shields.io/npm/v/@amplitude/ampli.svg)](https://www.npmjs.com/package/@amplitude/ampli) [![Downloads/week](https://img.shields.io/npm/dw/@amplitude/ampli.svg)](https://npmjs.org/package/@amplitude/ampli) [![License](https://img.shields.io/npm/l/@amplitude/ampli.svg)](https://npmjs.org/package/@amplitude/ampli)

-   [所需资源](https://npmcn.com/package/%40amplitude/ampli/#readme-requirements)
-   [使用量](https://npmcn.com/package/%40amplitude/ampli/#readme-usage)
-   [图标](https://npmcn.com/package/%40amplitude/ampli/#readme-commands)

# 所需资源

高度 CLI 需要节点 12+

# 使用量

```sh-session
$ npm install -g @amplitude/ampli
$ ampli COMMAND
running command...
$ ampli (-v|--version|version)
@amplitude/ampli/1.36.6 linux-x64 node-v24.18.0
$ ampli --help [COMMAND]
USAGE
  $ ampli COMMAND
...
```

# 图标

-   [`ampli autocomplete [SHELL]`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-autocomplete-shell)
-   [`ampli branch`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-branch)
-   [`ampli checkout [<branch>]`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-checkout-branch)
-   [`ampli configure [--deprecated-runtimes]`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-configure---deprecated-runtimes)
-   [`ampli help [COMMAND]`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-help-command)
-   [`ampli init`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-init)
-   [`ampli login`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-login)
-   [`ampli logout`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-logout)
-   [`ampli pull [<source>] [-p <path>] [-b <branch>]`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-pull-source--p-path--b-branch)
-   [`ampli refresh`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-refresh)
-   [`ampli setup`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-setup)
-   [`ampli source`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-source)
-   [`ampli status`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-status)
-   [`ampli whoami`](https://npmcn.com/package/%40amplitude/ampli/#readme-ampli-whoami)

## `ampli autocomplete [SHELL]`

显示自动完成安装指令

```
USAGE
  $ ampli autocomplete [SHELL]

ARGUMENTS
  SHELL  shell type

OPTIONS
  -r, --refresh-cache  Refresh cache (ignores displaying instructions)

EXAMPLES
  $ ampli autocomplete
  $ ampli autocomplete bash
  $ ampli autocomplete zsh
  $ ampli autocomplete --refresh-cache
```

_参见代码 : [@oclif/ plugin- auto 完成](https://github.com/oclif/plugin-autocomplete/blob/v0.3.0/src/commands/autocomplete/index.ts)_

## `ampli branch`

列出所有分支

```
USAGE
  $ ampli branch

OPTIONS
  -t, --token=token  personal API token to authenticate with
```

## `ampli checkout [<branch>]`

检查当前源的分支

```
USAGE
  $ ampli checkout [<branch>]

OPTIONS
  -t, --token=token      personal API token to authenticate with
  -v, --version=version  the version to checkout

EXAMPLES
  $ ampli checkout develop
  $ ampli checkout
```

## `ampli configure [--deprecated-runtimes]`

配置并更新源运行时间

```
USAGE
  $ ampli configure [--deprecated-runtimes]

OPTIONS
  -t, --token=token      personal API token to authenticate with
  --deprecated-runtimes  show deprecated SDK options for source configuration (for Itly users).

EXAMPLES
  $ ampli configure
  $ ampli configure --deprecated-runtimes
```

## `ampli help [COMMAND]`

显示 anpli 的帮助

```
USAGE
  $ ampli help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI
```

_参见代码 : [@oclif/plugin-帮助](https://github.com/oclif/plugin-help/blob/v3.3.1/src/commands/help.ts)_

## `ampli init`

初始化您的工作空间

```
USAGE
  $ ampli init

OPTIONS
  -o, --org=org              organization
  -w, --workspace=workspace  workspace
  -z, --zone=us|eu           regional zone
  --user=user                user email

EXAMPLES
  $ ampli init [--org ORGANIZATION] [--workspace WORKSPACE]
  $ ampli init [--user username@some.domain]
```

## `ampli login`

登录到高度

```
USAGE
  $ ampli login

OPTIONS
  -z, --zone=us|eu  regional zone

EXAMPLE
  $ ampli login
```

## `ampli logout`

从宽度记录

```
USAGE
  $ ampli logout

OPTIONS
  -z, --zone=us|eu  regional zone
  --user=user       user email

EXAMPLES
  $ ampli logout
  $ ampli logout --user username@some.domain
```

## `ampli pull [<source>] [-p <path>] [-b <branch>]`

降低最新的跟踪计划并创建跟踪库

```
USAGE
  $ ampli pull [<source>] [-p <path>] [-b <branch>]

OPTIONS
  -b, --branch=branch    the branch to pull
  -p, --path=path        where the tracking library will be created
  -t, --token=token      personal API token to authenticate with
  -v, --version=version  the version to pull
  --deprecated-runtimes  show deprecated SDK options for source configuration (for Itly users).
  --include-api-keys     include api keys to the tracking library
  --omit-api-keys        omit api keys from the tracking library

EXAMPLES
  $ ampli pull web
  $ ampli pull web -p ./ampli -b develop
  $ ampli pull web -p ./ampli -b develop -v 2.1.1
  $ ampli pull --omit-api-keys web
  $ ampli pull --include-api-keys web
  $ ampli pull --deprecated-runtimes
```

## `ampli refresh`

刷新当前分支, 并更改主分支

```
USAGE
  $ ampli refresh

OPTIONS
  -t, --token=token  personal API token to authenticate with

EXAMPLE
  $ ampli refresh
```

## `ampli setup`

显示当前源代码的设置指令

```
USAGE
  $ ampli setup

OPTIONS
  -t, --token=token  personal API token to authenticate with

EXAMPLE
  $ ampli setup
```

## `ampli source`

列出所有来源

```
USAGE
  $ ampli source

OPTIONS
  -t, --token=token  personal API token to authenticate with
```

## `ampli status`

校验(lint)您的分析源代码

```
USAGE
  $ ampli status

OPTIONS
  -b, --branch=branch                enforces source is on provided the branch
  -t, --token=token                  personal API token to authenticate with
  -u, --update                       update tracking plan with latest implementation status
  --instanceNames=instanceNames      Ampli instance name(s) to check
  --is-latest                        check if current version is the latest
  --is-latest-if-not-default-branch  check if current version is the latest (do not check if on default branch)
  --is-merged                        check if current branch/version has been merged into default branch
  --skip-update-on-default-branch    prevents updating implementation status on default branch
  --sourceDirs=sourceDirs            source code location

EXAMPLES
  $ ampli status
  $ ampli status -u
  $ ampli status -b main
  $ ampli status -u --skip-update-on-default-branch
  $ ampli status --sourceDirs ./src ./util
  $ ampli status --is-merged
  $ ampli status --is-latest
  $ ampli status --is-latest-if-not-default-branch
  $ ampli status --instanceNames myAmpliInstanceName ampli itly foo
```

## `ampli whoami`

显示用户信息

```
USAGE
  $ ampli whoami

OPTIONS
  -z, --zone=us|eu  regional zone
```

## 常见问题

### @amplitude/ampli 是什么？

振幅 CLI

### 如何安装 @amplitude/ampli？

在项目目录运行 npm install @amplitude/ampli，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ampli，可以用 npx ampli 直接运行。

### @amplitude/ampli 支持 TypeScript 吗？

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

### @amplitude/ampli 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @amplitude/ampli 需要什么版本的 Node\.js？

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

### @amplitude/ampli 可以商用吗？

@amplitude/ampli 使用 UNLICENSED 许可。作者声明为 UNLICENSED，即不授予公开使用许可（与公共领域的 Unlicense 不同）。使用前需获得作者授权。以上为概括，不构成法律意见，请以许可原文为准。

### @amplitude/ampli 的下载量有多少？

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

### @amplitude/ampli 还在维护吗？

最新版本 1\.36\.6 发布于 2026/07/11（3 个月前）；至今共发布 66 个版本，其中过去 12 个月发布了 4 个；首次发布于 2021/10/02。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

