modellab-cli 0.0.0-stage → 0.1.1

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 CHANGED
@@ -1,3 +1,96 @@
1
- # Temporary Holding Version
1
+ # ModelLab CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 独立 Node.js 24 命令行客户端,使用版本化公共契约和 SDK,不引用服务端或 Web 源码。
4
+
5
+ ```sh
6
+ npx modellab-cli@0.1.1 install
7
+ modellab --version
8
+ ```
9
+
10
+ 一键安装将 CLI 全局安装,并将包内所有操作 Skill 同步到 `~/.agents/skills`。Claude Code 从 `~/.claude/skills` 中的逐个目录软链接读取同一份内容。
11
+
12
+ ```sh
13
+ # 只安装 CLI
14
+ npm install -g modellab-cli@0.1.1
15
+ # 使用已安装的 CLI,把操作 Skill 装到当前项目
16
+ modellab install --skip-cli --target .agents/skills
17
+ ```
18
+
19
+ ## 本地构建
20
+
21
+ ```sh
22
+ pnpm install --frozen-lockfile
23
+ pnpm check
24
+ pnpm test
25
+ pnpm skill:pack
26
+ npm pack --pack-destination release
27
+ npm install -g ./release/modellab-cli-0.1.1.tgz
28
+ modellab --version
29
+ ```
30
+
31
+ 构建将运行依赖打包进 Node ESM 可执行文件,npm 安装后不需要本地 TypeScript、其他仓库或依赖注册表。Node.js 内置模块仍由用户安装的 Node.js 提供。
32
+
33
+ ```sh
34
+ modellab profile add local --server http://127.0.0.1:8080
35
+ modellab auth login --profile local --feishu
36
+ # 无系统凭证存储时显式选择受限文件:
37
+ modellab auth login --profile local --feishu --credential-store file
38
+ modellab context use --project PROJECT_UUID
39
+ modellab doctor --json
40
+ modellab schema list --json
41
+ modellab flows catalog --json
42
+ modellab schema get runs.create --json
43
+ modellab runs create --file run.json --dry-run --json
44
+ modellab runs create --file run.json --idempotency-key UNIQUE_KEY --json
45
+ modellab runs follow RUN_UUID --json
46
+ modellab runs wait RUN_UUID --timeout 1800 --json
47
+ modellab runs call RUN_UUID CALL_UUID --json
48
+ modellab runs respond RUN_UUID INPUT_UUID --action send --message "继续上一个问题" --json
49
+ modellab runs respond RUN_UUID INPUT_UUID --action finish --json
50
+ ```
51
+
52
+ 飞书登录时,在浏览器打开终端给出的工作台链接,输入登录码并确认。使用 ModelLab 账号时,省略 `--feishu`;非交互登录通过 `--stdin` 读取 JSON `{login,password}`。CLI 登录凭证有效期为 7 天。macOS 默认使用系统钥匙串;`--credential-store file` 使用 0700 配置目录和 0600 凭证文件。`MODELLAB_TOKEN` 可提供运行时令牌。
53
+
54
+ 模型和连接属于当前项目,使用 `context use --project <项目 ID>` 设置默认项目,也可以在 `models` 或 `connections` 子命令传入 `--project`。
55
+
56
+ `--json` 的 stdout 仅含 JSON,事件跟踪是 NDJSON。全局 --project / --profile / --no-input / --timeout 适用于子命令。草稿修改带 --if-revision;异步运行提交后立即返回 ID,Ctrl-C 停止本地跟踪,取消服务端任务使用 runs cancel。
57
+
58
+ 公开操作均可使用通用入口,Schema 与权限仍由服务端验证:
59
+
60
+ ```sh
61
+ modellab api call resources.get --params '{"id":"RESOURCE_UUID"}' --json
62
+ modellab api call datasets.import.preview --params '{"id":"DATASET_UUID"}' --file mapping.json --json
63
+ modellab api call budgets.set --file budget.json --json
64
+ ```
65
+
66
+ 退出码:0 成功;1 服务或网络;2 参数;3 权限;4 运行失败;5 修订或幂等冲突;6 本地等待超时;7 不兼容;8 写入结果未知;9 取消。
67
+
68
+ ## 独立操作 Skill
69
+
70
+ ```sh
71
+ modellab integrations skills install --skill-version 0.1.0
72
+ # 或手工解压 release/modellab-operations-0.1.0.tgz 到目标工具的 Skill 目录。
73
+ ```
74
+
75
+ 操作包名为 `modellab-operations`,类型为 `operation-skill-package`。项目内的 `.agents/skills` 会在同一项目的 `.claude/skills` 建立链接。自定义目录可以用 `--directory` 或 `install --target` 指定。安装会校验文件哈希,迁移未修改的旧 Claude 副本,并保留本地修改和其他 Skill。可在新目录安装后比较差异。
76
+
77
+ `tests/standalone-smoke.mjs` 从 npm tarball 安装到全新临时目录,再连接指定测试服务验证登录、项目创建、运行、SSE、等待、重评和 Skill 安装。需要已完成本地浏览器假模型配置,或按测试脚本提供自己的测试环境。
78
+
79
+ ### 导入 Buz 聊天回归测试集
80
+
81
+ ```sh
82
+ modellab datasets import-buz /path/to/buz_eval/data/cases.json --dry-run --json
83
+ modellab datasets import-buz /path/to/buz_eval/data/cases.json --project PROJECT_UUID --json
84
+ ```
85
+
86
+ 导入会发布固定脚本测试集,保留原始用例编号、角色、逐轮用户消息和评分预期。相同名称和来源的已发布导入可安全重试。项目首页和测试集详情均可发起测试。Buz 回归项目的「Buz · ALoHa 聊天回归」和「Buz · 自定义角色聊天回归」各有独立的资源及版本 ID。
87
+
88
+ 运行配置使用 `flow.version` 指定已发布流程,用 `dataset.version` 指定发布测试集。可选的 `dataset.caseIds` 和 `dataset.mapping` 用于选择样本及映射输入。各步骤在流程里声明模型、Prompt、消息来源及入参。用 `parameters` 设置流程公开参数,用 `variants[].steps` 按步骤 ID 设定未绑定配置。先用 `runs create --file run.json --dry-run` 预检,再提交整个流程。`runs get` 返回最终输出、步骤轨迹、等待项和调用详情。
89
+
90
+ ### 设置本次评分的裁判参数
91
+
92
+ 使用 `modellab api call evaluations.plan.create --file scoring-request.json --project PROJECT_UUID --json` 提交已发布方案的评分。请求包含 `runId`、`plan` 版本引用,可选 `judge` 版本引用。提供 `judgeParameters` 时,它是本次替代方案参数的完整对象,例如 `{"reasoning_effort":"low"}`。省略沿用方案,传 `{}` 仅使用所选模型的预设。可选的 `judgeMaxOutputTokens` 设置本次输出上限,传 `null` 采用供应商默认值。
93
+
94
+ 临时模型评分或两两盲评使用 `evaluations.model.create`,模型参数放在 `judge.parameters`,输出上限放在 `limits.maxOutputTokens`。通过 `modellab schema get <操作名> --json` 查看请求结构。
95
+
96
+ 批量评分自动整理公共请求前缀。通过 `modellab evaluations get <批次 ID> --json` 读取 `judgeCache`,其中 `reportedCalls`、`hitCalls` 和 `inputTokens` 分别是报告缓存用量的调用数、命中次数和实际复用的输入 Token 数。