RFC-31 Phase 3: CLI 重写 — var 子命令适配 (name, schema) 模型 #34

Closed
opened 2026-05-30 14:10:04 +00:00 by xiaoju · 0 comments
Owner

Parent: #31

目标

CLI 的 var 子命令适配新的 (name, schema) 复合主键模型。

变更

命令重写

旧命令 新命令
var create --scope <scope> --value <hash> var set <name> <hash>
var get <ulid> var get <name> --schema <hash>
var update <ulid> <hash> 删除(set 覆盖)
var delete <ulid> var delete <name> [--schema <hash>]
var list --scope <prefix> var list [prefix]
var tag <ulid> ... var tag <name> --schema <hash> ...

详细说明

var set <name> <hash> [--tag key=value...] [--label name...]

  • upsert 语义,调用 varStore.set(name, value, { tags, labels })
  • 输出创建/更新后的 Variable JSON envelope

var get <name> --schema <hash>

  • schema 必填
  • 输出 Variable JSON envelope
  • 不存在则 exit 1 + stderr

var delete <name> [--schema <hash>]

  • 无 schema:删除该 name 下所有变体,调用 varStore.remove(name)
  • 有 schema:精确删除,调用 varStore.remove(name, schema)
  • 输出被删除的 Variable(s)

var list [prefix] [--schema <hash>] [--tag key=value] [--label name]

  • prefix 可选,前缀匹配
  • 输出 Variable[] JSON envelope

var tag <name> --schema <hash> <operations...>

  • 同现有 tag 语法,但用 name+schema 定位

文件变更

文件 变更
cli-json-cas/src/index.ts var 子命令全部重写
cli-json-cas/src/var.test.ts 已删除(上轮),需新建 CLI 测试

验证步骤

  • bun test 全部通过
  • bun run build 构建成功
  • bun run check lint 通过
  • var set workflow/config/agent <hash> 创建变量
  • var set workflow/config/agent <hash2> 更新同 schema 变量
  • var get workflow/config/agent --schema <hash> 精确获取
  • var delete workflow/config/agent 删除所有变体
  • var delete workflow/config/agent --schema <hash> 精确删除
  • var list workflow/ 前缀列表
  • var tag workflow/config/agent --schema <hash> env=prod 打标签

Ref: #31

— 小橘 🍊(NEKO Team)

Parent: #31 ## 目标 CLI 的 var 子命令适配新的 (name, schema) 复合主键模型。 ## 变更 ### 命令重写 | 旧命令 | 新命令 | |--------|--------| | `var create --scope <scope> --value <hash>` | `var set <name> <hash>` | | `var get <ulid>` | `var get <name> --schema <hash>` | | `var update <ulid> <hash>` | 删除(set 覆盖) | | `var delete <ulid>` | `var delete <name> [--schema <hash>]` | | `var list --scope <prefix>` | `var list [prefix]` | | `var tag <ulid> ...` | `var tag <name> --schema <hash> ...` | ### 详细说明 **`var set <name> <hash> [--tag key=value...] [--label name...]`** - upsert 语义,调用 `varStore.set(name, value, { tags, labels })` - 输出创建/更新后的 Variable JSON envelope **`var get <name> --schema <hash>`** - schema 必填 - 输出 Variable JSON envelope - 不存在则 exit 1 + stderr **`var delete <name> [--schema <hash>]`** - 无 schema:删除该 name 下所有变体,调用 `varStore.remove(name)` - 有 schema:精确删除,调用 `varStore.remove(name, schema)` - 输出被删除的 Variable(s) **`var list [prefix] [--schema <hash>] [--tag key=value] [--label name]`** - prefix 可选,前缀匹配 - 输出 Variable[] JSON envelope **`var tag <name> --schema <hash> <operations...>`** - 同现有 tag 语法,但用 name+schema 定位 ### 文件变更 | 文件 | 变更 | |------|------| | `cli-json-cas/src/index.ts` | var 子命令全部重写 | | `cli-json-cas/src/var.test.ts` | 已删除(上轮),需新建 CLI 测试 | ## 验证步骤 - [ ] `bun test` 全部通过 - [ ] `bun run build` 构建成功 - [ ] `bun run check` lint 通过 - [ ] `var set workflow/config/agent <hash>` 创建变量 - [ ] `var set workflow/config/agent <hash2>` 更新同 schema 变量 - [ ] `var get workflow/config/agent --schema <hash>` 精确获取 - [ ] `var delete workflow/config/agent` 删除所有变体 - [ ] `var delete workflow/config/agent --schema <hash>` 精确删除 - [ ] `var list workflow/` 前缀列表 - [ ] `var tag workflow/config/agent --schema <hash> env=prod` 打标签 Ref: #31 — 小橘 🍊(NEKO Team)
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#34