# @adinsure-ops/ops-cli 中文文档

规范地址：https://npmcn.com/package/%40adinsure-ops/ops-cli/

版本：5\.4\.2
npm 元数据更新时间：2026-10-19T07:59:37.582Z
中文译文更新时间：2026-11-05T21:50:33.105Z
软件包许可：SEE LICENSE IN LICENSE

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

原始 npm 页面：https://www.npmjs.com/package/%40adinsure-ops/ops-cli
原文对照：https://npmcn.com/package/%40adinsure-ops/ops-cli/?lang=original
项目主页：https://git.adacta-fintech.com/ops/ops-cli
源码仓库：https://github.com/ops/ops-cli

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

- 包体积（解压后）：370 kB，123 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=20
- 运行依赖：25 个
- peer 依赖：@types/node ^24\.0\.0
- 首次发布：2022-05-31T14:55:31.081Z
- 最新版本发布：2026-10-19T07:59:37.376Z
- 近 30 天下载量：15400（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：61（近 12 个月 15 个）

## 中文简介

与 AdInsure 合作的 CLI 操作

## 安装

```sh
npm install @adinsure-ops/ops-cli
```

也可以使用：`pnpm add @adinsure-ops/ops-cli`、`yarn add @adinsure-ops/ops-cli`、`bun add @adinsure-ops/ops-cli`

## README

# 业务CLI

支持AdInsure发展进程的业务CLI.

[https://www.npmjs.com/package/@adinsure-ops/ops-cli 页面存档备份,存于互联网档案馆](https://www.npmjs.com/package/@adinsure-ops/ops-cli)

## 安装

`npm install -g @adinsure-ops/ops-cli`

## CLI 发展

为了发展,你需要 **[节点.js](https://nodejs.org/en/)** (建议20 LTS,最低18.0.0)和 **[雅伦](https://yarnpkg.com/en/)** 已安装.

我们建议 **[视觉工作室代码](https://code.visualstudio.com/)** IDE (英语).

为快速启动开发:

-   克隆此仓库( C)`git clone https://git.adacta-fintech.com/ops/ops-cli.git`(中文(简体) )
-   在 VS 代码中打开
-   运行 `yarn install`
-   为方便调试, 请运行 `yarn link`

您可以通过运行从终端直接运行和调试命令 `ops [command]` (如果你说) `yarn link`\- 编辑软件包)或执行 `.\bin\run [command]` (如果你没有链接,例如. `.\bin\run.cmd sql schema` 非窗口环境和 `.\bin\dev.cmd sql schema` 用于 Windows 环境). 对于调试, 您可以跟踪 oclif 的文档, 以打开单个命令的调试模式 **[这里](https://oclif.io/docs/debugging/)**。 。 。 .

## 升级 guilde

### 升级到5.1.0版本

需要18个以上.

### 升级到5.0.0版本

需要节点16,18或20.

### 升级到4.0.0版本

我们改变了服务主登录方式 服务主登录不再需要调用登录命令(例如CI). 图标 `ops login --servicePrincipal -c ${AZURE_CLIENT_ID} -s ${AZURE_CLIENT_SECRET}` 应该删除,但 `AZURE_CLIENT_ID` 财务报告和审定财务报表 `AZURE_CLIENT_SECRET` 环境变量应该存在,因为OPS Cli在背景中使用.

## 图标

-   [`ops help [COMMAND]`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-help-command)
-   [`ops doctor`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-doctor)
-   [`ops download:client <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadclient-flags)
-   [`ops download:identity-server <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadidentity-server-flags)
-   [`ops download:platform <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadplatform-flags)
-   [`ops download:scheduler <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadscheduler-flags)
-   [`ops download:server <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadserver-flags)
-   [`ops download:signalr <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadsignalr-flags)
-   [`ops download:studio <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadstudio-flags)
-   [`ops download:keycloak-scim <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadkeycloak-scim-flags)
-   [`ops download:jmeter <flags>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-downloadstudio-flags)
-   [`ops gitlab:get-tag-pipeline`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-gitlabget-tag-pipeline)
-   [`ops gitlab:next-nightly-tag`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-gitlabnext-nightly-tag)
-   [`ops log <issue> -t <type> -c [component]`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-log-issue-t-type-c-component)
-   [`ops log:gen [options]`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-loggen-options)
-   [`ops log:validate [options]`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-logvalidate-options)
-   [`ops login`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-login)
-   [`ops login:ru`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-loginru---token-token)
-   [`ops npm:check-publish`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-npmcheck-publish)
-   [`ops npm:publish`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-npmpublish)
-   [`ops npm:dependency-update`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-npmdependency-update)
-   [`ops nuget:dependency-update`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-nugetdependency-update)
-   [`ops prepare-content`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-prepare-content-d-destination-s-source)
-   [`ops sql <type> <module> [flags]`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-sql-type-module-flags)
-   [`ops translate`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-translate)
-   [`ops version <type> [flags]`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-version-type)
-   [`ops config:set <type> <value>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-configset-type-value)
-   [`ops config:unset <type>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-configunset-type)
-   [`ops config:get <type>`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-configget-type)
-   [`ops config:list`](https://npmcn.com/package/%40adinsure-ops/ops-cli/#readme-ops-configlist)

## `ops help [COMMAND]`

显示操作的帮助

```txt
USAGE
  $ ops 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/v2.2.0/src/commands/help.ts)_

## `ops doctor`

检查是否安装了每端

```txt
USAGE
  $ ops doctor

OPTIONS
  -p, --fix  try to install missing packages.

EXAMPLE
  $ ops doctor
```

## `ops download:client <flags>`

从 Azure 存储器下载 AdInsure 客户端zip

```txt
USAGE
  $ ops download:client <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -v, --version=version  (required) version we want to download.
  -s, --source=source    [default: azure] artifact source. (can be configured via 'config:set endpoint')

EXAMPLE
  $ ops download:client -v 3.2.0 -o ~/Downloads
  $ ops download:client -v 3.2.0 -s gitlabru
```

## `ops download:identity-server <flags>`

从 Azure 存储器下载 AdInsure 身份服务器zip

```txt
USAGE
  $ ops download:identity-server <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -v, --version=version  (required) version we want to download.
  -s, --source=source    [default: azure] artifact source. (can be configured via 'config:set endpoint')


EXAMPLE
  $ ops download:identity-server -v 3.0.3 -o ~/Downloads
  $ ops download:identity-server -v 3.0.3 -s gitlabru
```

## `ops download:platform <flags>`

下载 AdInsure 平台捆绑, 包含客户端、 服务器身份服务器和信号R 从 azure 存储中

```txt
USAGE
  $ ops download <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -v, --version=version  (required) version we want to download.
  -s, --source=source    [default: azure] artifact source. (can be configured via 'config:set endpoint')


ALIASES
  $ ops download

EXAMPLE
  $ ops download -v 6.0.0 -o ~/Downloads
  $ ops download -v 6.0.0 -s gitlabru
```

## `ops download:scheduler <flags>`

从 Azure 存储器下载 AdInsure 调度拉链

```txt
USAGE
  $ ops download:scheduler <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -v, --version=version  (required) version we want to download.
  -s, --source=source    [default: azure] artifact source. (can be configured via 'config:set endpoint')


EXAMPLE
  $ ops download:scheduler -v 3.2.0 -o ~/Downloads
  $ ops download:scheduler -v 3.2.0 -s gitlabru
```

## `ops download:server <flags>`

从 Azure 存储器下载 AdInsure 服务器zip

```txt
USAGE
  $ ops download:server <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -v, --version=version  (required) version we want to download.
  -s, --source=source    [default: azure] artifact source. (can be configured via 'config:set endpoint')


EXAMPLE
  $ ops download:server -v 3.2.0 -o ~/Downloads
  $ ops download:server -v 3.2.0 -s gitlabru
```

## `ops download:signalr <flags>`

从 Azure 存储器下载 AdInsure SignalR zip

```txt
USAGE
  $ ops download:signalr <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -v, --version=version  (required) version we want to download.
  -s, --source=source    [default: azure] artifact source. (can be configured via 'config:set endpoint')


EXAMPLE
  $ ops download:signalr -v 18.0.0 -o ~/Downloads
  $ ops download:signalr -v 18.0.0 -s gitlabru
```

## `ops download:studio <flags>`

从 Azure 存储器下载 AdInsure Studio vsix

```txt
USAGE
  $ ops download:studio <flags>

OPTIONS
  -k, --keep             only with install. If passed, it will not remove the vsix file.
  -i, --install          install plugin to vscode. save to temp folder and remove vsix after.
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -s, --skip             only with install. If passed, and desired version is installed it will skip it.
  -v, --version=version  (required) version we want to download.
  -f, --force            Create output directory if it does not exist. By default this is false and it depends on the output switch.
  --source=source    [default: azure] artifact source. (can be configured via 'config:set endpoint')


EXAMPLES
  $ ops download:studio -v 15.0.0 -o ~/Downloads
  $ ops download:studio -v 15.0.0 -i
  $ ops download:studio -v 15.0.0 -i -s
  $ ops download:studio -v 15.0.0 --source=gitlabru
```

## `ops download:keycloak-scim <flags>`

为 AdInsure 服务器下载 Keycloak scim zip

```txt
USAGE
  $ ops download:keycloak-scim <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')
  -v, --version=version  (required) version we want to download.

EXAMPLES
  $ ops download:keycloak-scim -v 3.2.0 -o ~/Downloads
  $ ops download:keycloak-scim -v 3.0.0 
```

## `ops download:jmeter <flags>`

下载 Jmeter 示例

```txt
USAGE
  $ ops download:jmeter <flags>

OPTIONS
  -o, --output=output    [default: ./] output directory. (can be configured via 'config:set download_folder')

EXAMPLES
  $ ops download:jmeter -o ~/Downloads
```

## `ops gitlab:get-tag-pipeline`

获得标记的管道状态

```txt
USAGE
  $ ops gitlab:get-tag-pipeline <tag>

ARGUMENTS
  TAG  Tag

OPTIONS
  --delay=delay      [default: 5] Delay of check in seconds (defaults to 5 seconds).
  --host=host        (required) [default: https://git.adacta-fintech.com] Server hostname.
  --pat=pat          (required) Token from user that has permissions to list and create tags.
  --project=project  (required) [default: 413] Project ID.
  --timeout=timeout  [default: 120] Timeout for wait command in seconds (defaults to 120 seconds).
  --wait             Wait for pipeline to finish.
```

## `ops gitlab:next-nightly-tag`

创建新的 gitlab 标签

```txt
USAGE
  $ ops gitlab:next-nightly-tag <version>

ARGUMENTS
  VERSION  Tag version

OPTIONS
  --dryRun               Only printout version and don't create it.
  --host=host            (required) [default: https://git.adacta-fintech.com] Server hostname.
  --pat=pat              (required) Token from user that has permissions to list and create tags.
  --project=project      (required) [default: 413] Project ID.
  --reference=reference  (required) Reference to create tag on (branch, commit, tag).
```

## `ops jira:issue <issue>`

给吉拉发行

```txt
USAGE
  $ ops jira:issue <issue>

ARGUMENTS
  ISSUE  Jira issue number

OPTIONS
  --hostname=hostname  [default: https://jira.adacta-fintech.com] jira hostname.
  --password=password  (required) jira password.
  --username=username  (required) jira username.

EXAMPLE
  $ ops jira:issue LJADIRD-1337
```

## `ops jira:issue <issue> -a [label] -r [label]`

列表或编辑 Jira 议题上的标签

```txt
USAGE
  $ ops jira:labels <issue> -a [label] -r [label]

ARGUMENTS
  ISSUE  Jira issue number

OPTIONS
  -a, --add=add        add label.
  -r, --remove=remove  remove label.
  --hostname=hostname  [default: https://jira.adacta-fintech.com] jira hostname.
  --password=password  (required) jira password.
  --username=username  (required) jira username.

EXAMPLE
  $ ops jira:labels LJADIRD-1337
```

## `ops log <issue> -t <type> -c [component]`

创建新的更改日志条目

```txt
USAGE
  $ ops log <issue> -t <type> -c [component]

ARGUMENTS
  ISSUE      Jira issue number.
  TYPE       (feature|fixed|improve|breaking) Change type.
  COMPONENT  (Configuration|DevOps|Implementation|Platform) Component for which new changelog should be generated.


OPTIONS
  -c, --component=component                  Component for which new changelog should be generated.
  -t, --type=feature|fixed|improve|breaking  (required) type of changelog.
  -d, --description=description              Description of a changelog.
  -f, --force                                Create logs directory if it does not exist.

ALIASES
  $ ops log
  $ ops log:add

EXAMPLES
  $ ops log LJADIRD-1234 -t feature
  $ ops log LJADIRD-5678 -t fixed
  $ ops log LJADIRD-8765 -t breaking -c Platform
  $ ops log LJADIRD-5678 -t fixed -d "Fixed my bug"
  $ ops log LJADIRD-4321 -t improve -c Configuration
```

## `ops log:gen [options]`

从根上未释放的音符生成最终更改日志, 执行部分的最后变更日志列在基本/Changelog.md下

```txt
USAGE
  $ ops log:gen [options]

OPTIONS
  -c, --components=components  components separated by comma (,) to process for final changelog.
  -f, --file=file        [default: CHANGELOG.md] file to update with new changelogs.
  -p, --preview          generates a preview markdown of current unreleased changelogs.
  -v, --version=version  version for which you're generating changelogs.
  --force                update target file without prompting for confirmation.
  --ignore-no-changelogs generate final changelog even if no unreleased changelogs exist.

ALIASES
  $ ops log:gen

EXAMPLE
  $ ops log:gen
  $ ops log:gen -p
  $ ops log:gen -c Platform
  $ ops log:gen -c Platform,Configuration
  $ ops log:gen -c Implementation -f CHANGELOG.Implementation.md
```

## `ops log:validate [options]`

验证所有未释放的更改日志的格式:

-   2.4.2 - 添加一个退出声明,以便在更改日志验证错误时强制退出,并为CI做好准备

```tx
USAGE
  $ ops log:validate [options]

ALIASES
  $ ops log:validate

EXAMPLE
  $ ops log:validate
```

## `ops login`

登录以使用操作服务

```txt
USAGE
  $ ops login

OPTIONS
  --deviceFlow            authenticate using device flow
  --force                 Force a change of login token
  --npm                   register also for npm
  --skipCI=<value>        Skip login if environment variables is set

EXAMPLES
  $ ops login
  $ ops login --npm
  $ ops login --skipCi CI
  $ ops login --deviceFlow
```

## `ops login:ru --token <token>`

登录使用 GitLabRu 符号的 OPS 服务 .

```txt
USAGE
  $ ops login:ru --token <token> [--force]

OPTIONS
  --token=token  (required) The GitLabRu token to store.
  --force        Force update of the stored token.

ALIASES
  $ ops login:ru

EXAMPLES
  $ ops login:ru --token abc123
  $ ops login:ru --token xyz789 --force
```

## `ops npm:check-publish`

检查 npm 软件包是否发布

```txt
USAGE
  $ ops npm:check-publish [options]

OPTIONS
  -p, --package=package  package name filter you want to check.
  -v, --version=version  (required) version we want to check if published.
  -x, --exclude=exclude  exclude packages from filter.
  --pat=pat              PAT token or AZURE_DEVOPS_EXT_PAT environment variable.

EXAMPLES
  $ ops npm:check-publish -v 6.0.1
  $ ops npm:check-publish -p @adinsure/* -v 6.0.0
  $ ops npm:check-publish -p @adinsure/* -x @adisure/demo -v 6.0.0
```

## `ops npm:publish`

发布 npm 软件包

```txt
USAGE
  $ ops npm:publish [options]

OPTIONS
  -p, --package=package  package name filter you want to check.
  -v, --version=version  (required) version we want to check if published.
  -x, --exclude=exclude  exclude packages from filter.
  --pat=pat              PAT token or AZURE_DEVOPS_EXT_PAT environment variable.

EXAMPLES
  $ ops npm:publish -v 15.0.0
  $ ops npm:publish -v 15.0.0
  $ ops npm:publish -p @adinsure-tooling/* -v 15.0.0
  $ ops npm:publish -p @adinsure-tooling/* -x @adisure-tooling/studio-services -v 6.0.0
```

## `ops npm:dependency-update`

每个软件包过滤器更新 npm 依赖性

```txt
USAGE
  $ ops npm:dependency-update <type> [flags]

ARGUMENTS
  VERSION  Type of release

OPTIONS
  --exclude=exclude  exclude directories where to search for package.json.
  --filter=filter    (required) regular expression for which NPM packages to update.

EXAMPLE
  $ ops npm:dependency-update 3.4.3 --filter @adinsure/*
```

## `ops nuget:dependency-update`

更新每个包过滤器的核素依赖性

```txt
USAGE
  $ ops nuget:dependency-update <type> [flags]

ARGUMENTS
  VERSION  Type of release

OPTIONS
  --exclude=exclude  exclude directories where to search for csproj files.
  --filter=filter    (required) regular expression for which NuGet packages to update.

EXAMPLE
  $ ops nuget:dependency-update 3.4.3 --filter Adacta.AdInsure --exclude Scheduler
```

## `ops version <type>`

创造新发行所需的一切

```txt
USAGE
  $ ops version <type> [flags]

ARGUMENTS
  TYPE  (patch|minor|major|prerelease|preminor|premajor|new) Type of release

OPTIONS
  -i, --independent                      increment npm packages independent of VERSION file.
  -v, --version=version                  force version.
  --no-deps                              skip dependency update.
  --no-script                            skip creation of script.
  --only-npm-packages=only-npm-packages  [default: .*] regular expression for which NPM packages to include.
  --script-prefix=script-prefix          [default: 7.10] prefix for db script version creation.
  --exclude-dir                          exclude directories where to search for package.json.

EXAMPLES
  $ ops version minor
  $ ops version new-version -v 3.4.0
  $ ops version new-version -v 3.2.1 --script-prefix 7.10
  $ ops version patch --no-deps
  $ ops version patch --no-script
  $ ops version new -v 3.2.1 --only-npm-packages "@adinsure/"
```

-   _预释_ 由YearMonth增量数(例:201909.1)或RC(例:rc.0)生成. 同一个月生成的预放出将只有上个数字递增,下个月生成的首个预放出将撞出第一个数字并从0开始(例如:20191.0)
    
-   _补丁_ 第3个数字和释放前数字不计。 (例:3.4.0-201909.2 - > 3.4.0和3.3.11 - > 3.3.12)
    
-   _初级_ 第二位释放前的增量(例:3.2.3 - > 3.3.0-201910.0)
    
-   _小声_ 递增第二个数字(例如:3.4.3 - > 3.5.0)
    
-   _预主_ 第1个数的预放量递增(例:3.4.3 - > 4.0.0-201911.0)
    
-   _主要_ 增加数第一(例如:3.4.5- > 4.0.0)
    
-   _新版本_ 允许设置 VERSION 文件的自带版本. **在这种情况下,不支持单独增加国家预防机制版本。 国家防范机制的软件包也被压缩到指定的版本.**
    

> 注: 预放只应是用户 **师傅** 树枝. \\ 补丁 注意: 补丁是在 **发布/x.x** 创建补丁释放的分支 创建新时 **发布/x.x** 需要第2分节的步骤:
> 
> -   创建 _补丁_ 打开版本 **发布/x.x** 分支
> -   创建 _初级_ 或者说 _预主_ 打开版本 **师傅** 分支 \\ 软件包的依赖性在所有软件包.json文件中更新. 如果在指定的完整版本中指定了预释版本(例:4.0.0-201911.0),或者非预释版本以x结尾(例:3.5.x) \\ NPM软件包节点:Npm软件包需要适当更新 _wsrun - 转换_ 预设需要输入 _脚本_ 部分 _软件包.json_.(实例: `"wsrun-version": "yarn wsrun -p @adinsure-tools/* -p @adinsure/* -c"`(中文(简体) )

## `ops prepare-content -d <destination> -s [source]`

创建目录/文件结构 `/source` 改为 `/destination</source>` 定义 `.opsprepare` 文档。 实际 每个文件的目的地路径将被指定为目的路径,并带有从工作目录中附加的相对路径,在那里命令执行到指定的源目录或当前目录(如果未指定源). 当心使用 `..` 在目标和源路径上加注,因为相对路径解决可能导致不可预测的结果.

> 3.1.0版本介绍.

```txt
USAGE
  $ ops prepare-content -d <destination> -s [source]


OPTIONS
  -d, --destination=destination       path to target directory.
  -s, --source=source                 optional path to source directory containing .opsprepare file, (default: current directory).

EXAMPLES
$ ops prepare-content -d ./target_directory/
  copies everything defined in .opsprepare
  from current directory 
  to ./target_directory

$ ops prepare-content -d ./target_directory/ -s ./source_directory
  copies everything defined in ./source_directory/.opsprepare 
  from ./source_directory/
  to ./target_directory/source_directory

$ ops prepare-content -d C:\git\target_directory
  copies everything defined in .opsprepare 
  from current directory 
  to C:\git\target_directory

$ ops prepare-content -d C:\git\target_directory -s C:\git\subfolder\subfolder
  when executed in c:\git it copies everything defined in C:\git\subfolder\subfolder\.opsprepare 
  from C:\git\subfolder\subfolder
  to C:\git\target_directory\subfolder\subfolder
```

### .opsprepare 点文件

准备内容命令的使用 `.opsprepare` dotfile作为内容编写指令集. 语法类似于 `.gitignore` 但它的功能不同,不支持高级 模式匹配.

目前支持以下操作/转换:

-   复制:将文件/目录从源路径复制到同名目的路径
-   变形: 将源文件转换为同名目的文件
-   删除: 从目的路径去除文件/目录( 基于源路径)

在跳入实际语法和辅助符号之前,让我们看看一个例子 如何使用 `ops prepare-content` 创建带有文件的目标目录结构 根据指定的 `.opsprepare` 保存在源目录中的文件.

这是示例源目录结构 :

```ascii
src_data
├── .opsprepare
├── README.tpl
├── bin
│   ├── ops.sh
│   └── run
│       └── ops
├── dist
│   └── server
│       └── main.cs
├── src
│   ├── commands
│   │   ├── prepare.ts
│   │   └── version.ts
│   ├── config.ts
│   └── main.ts
└── transform
    └── render-tpl.js
```

目录 `.opsprepare` 文档中 `src_data` 目录 :

```txt
# Comment
src
dist/server
!src/commands
!src/config.ts
src/config.ts {cp:/src/configuration.ts}
# Another comment
!bin/run
README.md {js:/transform/render-tpl.js}
README.tpl {cp:/README.tpl.src}
```

运行 `ops -s src_data -d dst_data` 与 `src_data/.opsprepare` 包含以上内容 结果是:

```ascii
dst_data
└── src_data
    ├── README.md
    ├── README.tpl.src
    ├── dist
    │   └── server
    │       └── main.cs
    └── src
        ├── main.ts
        └── src
            └── configuration.ts
```

到底发生了什么:

1.  首先说明所有数据都被复制到 `dst_data/src_data` 因为 `.opsprepare` 文件相对 地点到 `ops` 执行指令是 `src_data`。 。 。 .
2.  `src` 目录被递归复制到目的地
3.  `dist/server` 目录被递归复制, 包括相对于 `src_data`
4.  `src/config.ts` 文件被转换( 复制) 为 `src/configuration.ts` 目标
5.  `README.md` 文件是因基于 JavaScript 的转换而在目的地创建的
6.  `README.tpl` 文件被转换( 复制) 为 `README.tpl.src` 目标
7.  `src/commands` 目录从目的地删除
8.  `src/config.ts` 文件从目的地删除
9.  `bin/run` 目录从目的地删除

请注意,复制和明确转换是在任何清除行动之前进行的.

#### 评论

任意行前缀 `#` 被视为评论,不会导致任何文件/目录操作.

#### 复制操作

任何没有前缀的文件/目录 `!` 或者说 `#` 明确转换的定义 `{...}` 之后 其名称将会被复制到目的地, 其路径相对于 `ops` 执行目录 转到目标目录.

#### 转型业务

变形操作总是在源文件名后使用卷曲括号来指定. 基础 语法是这样的:

```txt
{<transformation type>:<transformation parameters>}
```

支持两种类型的转换操作:

-   cp: 支持在目的地重命名源文件的复制转换
-   js: Javas 以 Sript 为主的转换, 其结果是包含字符串的文件由 : 转换模块中包含的转换函数.

**cp - 复制转换语法**

```txt
{cp:<destination path>}

Examples:
{cp:/dst/newfilename}
{cp:dst/newfilenames}
```

文件和目录都支持复制转换。 源文件或目录将会是 复制到带有新名称的目的地路径。 目的地永远是相对 整个目的路径 `prepare-content` 因此,转换块中的操作路径 可以开始于或没有 `/` 字符,但使用能使语法更可读取.

**js - JavaScript 变换语法**

```txt
{js:<transformation_module_path>}

Example:
{js:/transformations/templateRenderer.js}
```

JavaScript 转换只支持文件,而不是目录.

转换模块路径应当相对 `.opsprepare` 文件,但可以从 `/` 字符 为了更好的可读性。 它可以导出多种功能, 尽管只有一个功能可以单独使用 变换规格.

转换模块中定义的转换函数将使用单个调用 参数 - 源文件的绝对路径.

变形函数 MUSST 返回字符串 。 此字符串将成为文件的内容 目标.

目标文件将与源文件和内容的同名创建 转换函数。 实际源文件的存在不会被 `prepare-content` 操作(如果不存在警告,则显示警告),这种验证是责任 如果需要,则由转换函数构成.

示例转换模块 `transform.js` 具有导出函数,称为渲染:

```js
export default function render(path) {
    /*
    Some transformation happens in here and it's result which is
    a string is assigned to result variable which is returned.
    */
  return result;
}
```

> 需要注意的一点是,在一个模块中您只能导出一个默认函数,所以在一个互相调用的文件中定义多个函数是可能的, 然而,定义多重违约出口并不是,因此 **只有一个功能可以叫做** 在模块文件中.

#### 搬运作业

文件/目录前缀 `!` 将会根据目的地的完整路径被移除 相对 `ops` 执行目录到源文件/目录路径.

## `ops sql <type> <module> [flags]`

创建新的数据库脚本

```txt
USAGE
  $ ops sql <type> <module> [flags]

ARGUMENTS
  TYPE    (Schema|Data|Migration|Extend) Type of database scripts
  MODULE  (acc|claims|core|pas|reins|shared) Module of data database scripts

OPTIONS
  -d, --description=description  description of script to be used in filename for offline.
  -l, --layer=layer              name of the configuration layer for which you are generating database script.
  -m, --major                    generate script for major version.
  -o, --offline                  generate database script with timestamp.
  -v, --version=version          version for which you're generating database script.

Extend type options for extending DBs:
  --table-schema                 table schema name
  --table-name                   table name
  --column-name                  new column's name 
  --column-type                  new column's type 

EXAMPLES
  $ ops sql schema 
  $ ops sql data shared --layer basic
  $ ops sql data shared --major
  $ ops sql data shared --offline --description "this is script description"
  $ ops sql Extend -v 22.0.0 -l basic --table-schema "Table_Shema" --table-name "Table_Name" --column-name "New_Column_Name" --column-type "NEWTYPE"
```

> 注:如果不提供,则取自文件 `SQL_SCRIPTS_VERSION`, (中文(简体) ), `PLATFORM_VERSION` 或者说 `VERSION` 以顺序.

## `ops translate`

从AdDictionary服务翻译的下载

```txt
USAGE
  $ ops translate <language> [flags]

ARGUMENTS
  LANGUAGE  language id you want to download. Values must be semi-colon (;) separated.

OPTIONS
  -f, --format=json|xml    (required) translations format [xml - server translations, json - client translations].
  -m, --module=module      module name you want to download. Values must be semi-colon (;) separated.
  -o, --output=output      [default: .] absolute or relative destination path to a folder where translations are extracted.
  --filename=filename      specify filename of output (XML only).
  --respectServerFilename  respect filename that is returned from AdDictionary server (XML only).

EXAMPLES
  $ ops translate "en-US=en-US;ru-Ru=ru-RU" -f json -m "Client business accounting;Client business base;"
  $ ops translate "en-US=en-US;ru-Ru=ru-RU" -f xml -o translationDestination
```

## `ops config:set <type> <value>`

为OPS设定配置值.

```txt
USAGE
  $ ops config:set <type> <value>

OPTIONS
  type   (required) Type of OPS configuration. Available options: [endpoint, download_folder].
  value  (required) Possible configuration values. Available options for endpoint: [azure, gitlabru]. Expects a valid path for download_folder.

ALIASES
  $ ops config:set

EXAMPLES
  $ ops config:set endpoint gitlabru
  $ ops config:set endpoint azure
  $ ops config:set download_folder ./Downloads
```

## `ops config:unset <type>`

删除配置值以便使用系统默认值.

```txt
USAGE
  $ ops config:unset <type>

OPTIONS
  type   (required) Type of OPS configuration. Available options: [endpoint, download_folder].

ALIASES
  $ ops config:unset

EXAMPLES
  $ ops config:unset endpoint 
  $ ops config:unset download_folder
```

## `ops config:get <type>`

为OPS获取配置值.

```txt
USAGE
  $ ops config:get <type>

OPTIONS
  type   (required) Type of OPS configuration to retrieve. Available options: [endpoint, download_folder].

ALIASES
  $ ops config:get

EXAMPLES
  $ ops config:get endpoint
  $ ops config:get download_folder
```

## `ops config:list`

列出存储在配置文件中的所有 OPS 配置值 .

```txt
USAGE
  $ ops config:list
```

## 常见问题

### @adinsure-ops/ops-cli 是什么？

与 AdInsure 合作的 CLI 操作

### 如何安装 @adinsure-ops/ops-cli？

在项目目录运行 npm install @adinsure-ops/ops-cli，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：@types/node（^24\.0\.0）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。它还提供命令行工具 ops，可以用 npx ops 直接运行。

### @adinsure-ops/ops-cli 支持 TypeScript 吗？

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

### @adinsure-ops/ops-cli 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @adinsure-ops/ops-cli 需要什么版本的 Node\.js？

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

### @adinsure-ops/ops-cli 可以商用吗？

@adinsure-ops/ops-cli 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中，请阅读该文件确认可否商用。以上为概括，不构成法律意见，请以许可原文为准。

### @adinsure-ops/ops-cli 的下载量有多少？

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

### @adinsure-ops/ops-cli 还在维护吗？

最新版本 5\.4\.2 发布于 2026/10/19（19 天前）；至今共发布 61 个版本，其中过去 12 个月发布了 15 个；首次发布于 2022/05/31。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

