@adep/cli 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -10
- package/dist/index.js +1351 -955
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,17 +114,21 @@ adep --json whoami
|
|
|
114
114
|
|
|
115
115
|
### `adep init`
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
初始化项目(脚手架),模板支持生成**单个函数 / 单个 Widget / 单个 Page**:
|
|
118
118
|
|
|
119
|
-
| 模板 | 说明
|
|
120
|
-
| ---------- |
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
119
|
+
| 模板 | 说明 |
|
|
120
|
+
| ---------- | ------------------------------------------------------------- |
|
|
121
|
+
| `function` | 生成一个示例函数 `functions/hello.ts`(默认) |
|
|
122
|
+
| `widget` | 生成单个 Widget(微前端组件,落 `widgets/<name>/`) |
|
|
123
|
+
| `page` | 生成单个 Page(静态页面,落 `web/index.html`) |
|
|
124
|
+
| `empty` | 仅项目骨架(`adep.config.ts` + 类型提示入口,不生成示例产物) |
|
|
123
125
|
|
|
124
126
|
```bash
|
|
125
|
-
adep init my-app
|
|
126
|
-
adep init my-app -t
|
|
127
|
-
adep init
|
|
127
|
+
adep init my-app # 默认 function 模板(单个函数)
|
|
128
|
+
adep init my-app -t widget # 单个 Widget
|
|
129
|
+
adep init my-app -t page # 单个 Page
|
|
130
|
+
adep init my-app -t empty # 空模板
|
|
131
|
+
adep init --list # 从平台 GET /api/v1/templates 列出可用模板
|
|
128
132
|
adep init --list -s https://platform.example.com
|
|
129
133
|
```
|
|
130
134
|
|
|
@@ -133,6 +137,8 @@ adep init --list -s https://platform.example.com
|
|
|
133
137
|
```
|
|
134
138
|
my-app/
|
|
135
139
|
├── adep.config.ts # 项目标识(dev / deploy 按此识别)
|
|
140
|
+
├── tsconfig.json # 云函数 TypeScript 编辑器配置(strict + noEmit)
|
|
141
|
+
├── adep.d.ts # 云函数上下文环境类型声明(ctx: AdepContext 补全)
|
|
136
142
|
├── functions/
|
|
137
143
|
│ ├── hello.ts # 示例函数(deploy 后经 /hello 触发)
|
|
138
144
|
│ └── README.md
|
|
@@ -140,6 +146,10 @@ my-app/
|
|
|
140
146
|
└── .gitignore # 已忽略 node_modules/ data/ .adep/
|
|
141
147
|
```
|
|
142
148
|
|
|
149
|
+
**类型提示**:`adep init` 产出的项目自带 `tsconfig.json` 与 `adep.d.ts`,用 VSCode 打开即可在
|
|
150
|
+
`functions/` 下获得 `AdepContext` / `ctx.cloud.*` 补全,无需本机安装 `@adep/types`。
|
|
151
|
+
函数签名写 `export default async (ctx: AdepContext) => {...}` 即可。
|
|
152
|
+
|
|
143
153
|
> 目录已存在时会拒绝覆盖(fail loud),不会静默改写你的代码。
|
|
144
154
|
|
|
145
155
|
### `adep dev`
|
|
@@ -182,6 +192,7 @@ adep serve --static web # 指定静态托管目录(缺省 public/)
|
|
|
182
192
|
```
|
|
183
193
|
|
|
184
194
|
- 缺省值优先级为「命令行旗标 > 环境变量(`PORT` / `HOST` / `ADEP_SERVE_STATIC_DIR`)> 内置缺省」,容器编排注入的 `PORT` / `HOST` 不会被命令行缺省盖掉。
|
|
195
|
+
|
|
185
196
|
- 绑定非回环地址时给出对外暴露警告(它不带生产级加固)。
|
|
186
197
|
|
|
187
198
|
### `adep deploy`
|
|
@@ -219,7 +230,9 @@ adep projects info game-arcade # id \t slug \t name \t url
|
|
|
219
230
|
```
|
|
220
231
|
|
|
221
232
|
- `--name` 缺省取 slug:一行命令即可建项目。
|
|
233
|
+
|
|
222
234
|
- 目标 slug 已占用 → 平台返回 `PROJECT_SLUG_TAKEN`,CLI 原样透传并退出码 1。
|
|
235
|
+
|
|
223
236
|
- 未登录 / 会话失效 → 打印错误后附带 `提示:先执行 adep login`。
|
|
224
237
|
|
|
225
238
|
### `adep functions`
|
|
@@ -234,6 +247,7 @@ adep functions logs hello -p my-app --tail 50
|
|
|
234
247
|
```
|
|
235
248
|
|
|
236
249
|
- `deploy` 与 `adep deploy` 共用同一执行体,输出逐字一致(两个入口各写一遍迟早只有一处有汇总行)。
|
|
250
|
+
|
|
237
251
|
- 日志缓冲在平台进程内(环形),**未执行过的函数为空**——命令会如实说明而非报错。
|
|
238
252
|
|
|
239
253
|
### `adep mcp`
|
|
@@ -249,8 +263,11 @@ adep mcp list # 打印端点地址 + 已
|
|
|
249
263
|
```
|
|
250
264
|
|
|
251
265
|
- `--function` 是**函数名**,`--name` 是可选的**注册 Tool 名**(缺省取函数名);目标项目缺省取 `adep.config.ts` 的 `name`,也可用 `-p <slug>` 指定。
|
|
266
|
+
|
|
252
267
|
- 服务端错误原样透出:函数入参无法映射为 JSON Schema 时返回 `MCP_SCHEMA_UNSERIALIZABLE` 并以退出码 1 结束(CLI 不改写、不兜底,原因由服务端指出)。
|
|
253
|
-
|
|
268
|
+
|
|
269
|
+
- `mcp list` 读的是**项目** **`/mcp`** **端点的** **`tools/list`**(与外部 Agent 同一条路径):项目 MCP 鉴权模式为 `public` 时可直接读取;为 `api-key` 时未带 Key 会返回 `MCP_UNAUTHORIZED`。
|
|
270
|
+
|
|
254
271
|
- `unpublish` 默认按函数名移除;若曾以别名发布,需加 `--name <tool>` 指向该别名。取消一个不存在的工具会如实说明、不报成功也不报错。
|
|
255
272
|
|
|
256
273
|
### `adep doctor`
|
|
@@ -263,7 +280,9 @@ adep doctor --json # { server, credentials, network, serverHealth, offlineCom
|
|
|
263
280
|
```
|
|
264
281
|
|
|
265
282
|
- 已登录时体检的是**凭据里记录的那个平台**(`login --server` 可指到任意环境),未登录才回退 `ADEP_SERVER` 缺省。
|
|
283
|
+
|
|
266
284
|
- 平台可达性 = 对 `GET /api/v1/health` 的一次真实探测;拿到任何 HTTP 应答都算可达。
|
|
285
|
+
|
|
267
286
|
- 凭据文件权限宽于 `0600` 会给告警;命令本身**不因体检结论失败**(它是诊断,不是门)。
|
|
268
287
|
|
|
269
288
|
### `adep db`
|
|
@@ -335,6 +354,7 @@ adep export --out ./dist-export # 指定输出目录(缺省 ./exports)
|
|
|
335
354
|
```
|
|
336
355
|
|
|
337
356
|
- `--with-data` 附带行数据,`--with-source` 附带函数源码(平台缺省已含,显式给出不改变默认)。
|
|
357
|
+
|
|
338
358
|
- `--json` 输出单个结果信封;导出失败(长任务未产出 / 自检不过)以退出码 1 + `EXPORT_FAILED` 结束,不静默给半截产物。
|
|
339
359
|
|
|
340
360
|
### `adep widget`
|
|
@@ -397,7 +417,7 @@ export ADEP_HOME=~/.adep
|
|
|
397
417
|
// adep 项目配置:CLI(dev / deploy)按 default export 读取(name / functionsDir)。
|
|
398
418
|
export default {
|
|
399
419
|
name: 'my-app', // 项目名(deploy 的默认 slug)
|
|
400
|
-
template: 'function', // 模板:empty | function
|
|
420
|
+
template: 'function', // 模板:empty | function | widget | page
|
|
401
421
|
}
|
|
402
422
|
```
|
|
403
423
|
|
|
@@ -469,3 +489,5 @@ adep --json deploy -p my-app
|
|
|
469
489
|
## 相关
|
|
470
490
|
|
|
471
491
|
- `@adep/runtime` —— 平台运行时内核(执行器 + 本地模拟运行时 + 能力装配),`adep dev` 复用其保证本地/线上语义一致。
|
|
492
|
+
|
|
493
|
+
<br />
|