> ## Documentation Index
> Fetch the complete documentation index at: https://docs.veadk.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# 构建产品 CLI

在项目目录中用 product.yaml 声明产品，以模块、目录和传输绑定定义命令。以下示例创建一个最小 HTTP 项目，对其做离线校验、构建和打包。构建产物位于 dist/，可以用 node dist/index.js --help 验证。打包生成 npm 压缩包和已声明的技能包，技能默认调用已安装的产品命令。

> [!WARNING]
>
> 发布命令会向配置的 npm 注册表上传包。示例使用 --dry-run 检查发布内容。

## cli init

`agentkit cli init <name>`

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--dir <dir>` | 项目生成目录，省略时使用当前目录下的项目名 | — |
| `--force` | 允许覆盖现有模板文件 | 未启用 |
| `--template <template>` | default 包含 HTTP 和 MCP，http 为最小 HTTP 模板 | default |
| `--json` | 输出 JSON | 未启用 |

```bash theme={null}
agentkit cli init answers-cli --template http
```

## cli validate

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--dir <dir>` | 项目目录 | — |
| `--contracts` | 执行 tests/contracts.json 中显式声明的只读契约用例 | 未启用 |
| `--json` | 输出 JSON | 未启用 |

```bash theme={null}
agentkit cli validate --dir ./answers-cli
```

## cli build

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--dir <dir>` | 项目目录 | — |
| `--out-dir <dir>` | 相对于项目根目录的输出目录，默认 dist | — |
| `--json` | 输出 JSON | 未启用 |

```bash theme={null}
agentkit cli build --dir ./answers-cli
```

## cli pack

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--dir <dir>` | 项目目录 | — |
| `--bundle-cli` | 在每个技能包中附带一份 CLI | 未启用 |
| `--manifest` | 为每个技能包写入可选的 manifest.json | 未启用 |
| `--json` | 输出 JSON | 未启用 |

```bash theme={null}
agentkit cli pack --dir ./answers-cli
```

## cli publish

| 选项 | 说明 | 默认值 |
| - | - | - |
| `--dir <dir>` | 项目目录 | — |
| `--registry <url>` | 发布到指定 npm 注册表 | — |
| `--dry-run` | 检查待发布的包，不上传注册表 | 未启用 |
| `--json` | 输出 JSON | 未启用 |

```bash theme={null}
agentkit cli publish --dir ./answers-cli --dry-run
```

cli init 生成的 README 给出构建、调用和打包命令。从项目根目录运行以下命令可检查生成的入口。

```bash theme={null}
node dist/index.js --help
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.