Phase 2: template CLI 子命令 #38

Closed
opened 2026-05-31 03:37:23 +00:00 by xiaoju · 0 comments
Owner

目标

提供模板管理的快捷命令,封装底层 put + var set

交付物

2.1 ucas template set <schema-hash> <file>

  • 读取模板文件内容
  • store.put(@string hash, content) 存入 CAS
  • var.set("@ucas/template/text/<schema-hash>", contentHash) 绑定变量
  • 支持 --inline '<template>' 直接传内容

2.2 ucas template get <schema-hash>

  • 查找 @ucas/template/text/<schema-hash> 变量
  • 输出模板内容(纯文本,非 JSON)

2.3 ucas template list

  • 列出所有 @ucas/template/text/* 变量
  • 显示 schema-hash + 模板内容摘要

2.4 ucas template delete <schema-hash>

  • 删除对应变量绑定

验证

# 注册模板
echo '{{ payload.name }}' > my-template.liquid
ucas template set <some-schema-hash> my-template.liquid

# 查看
ucas template get <some-schema-hash>   # 输出: {{ payload.name }}

# 列表
ucas template list                      # 显示已注册模板

# 删除
ucas template delete <some-schema-hash>
ucas template get <some-schema-hash>    # 报错: not found

依赖

Phase 1(@ 前缀变量名 + @string schema)

Refs #36


小橘 🍊(NEKO Team)

## 目标 提供模板管理的快捷命令,封装底层 `put` + `var set`。 ## 交付物 ### 2.1 `ucas template set <schema-hash> <file>` - 读取模板文件内容 - `store.put(@string hash, content)` 存入 CAS - `var.set("@ucas/template/text/<schema-hash>", contentHash)` 绑定变量 - 支持 `--inline '<template>'` 直接传内容 ### 2.2 `ucas template get <schema-hash>` - 查找 `@ucas/template/text/<schema-hash>` 变量 - 输出模板内容(纯文本,非 JSON) ### 2.3 `ucas template list` - 列出所有 `@ucas/template/text/*` 变量 - 显示 schema-hash + 模板内容摘要 ### 2.4 `ucas template delete <schema-hash>` - 删除对应变量绑定 ## 验证 ```bash # 注册模板 echo '{{ payload.name }}' > my-template.liquid ucas template set <some-schema-hash> my-template.liquid # 查看 ucas template get <some-schema-hash> # 输出: {{ payload.name }} # 列表 ucas template list # 显示已注册模板 # 删除 ucas template delete <some-schema-hash> ucas template get <some-schema-hash> # 报错: not found ``` ## 依赖 Phase 1(@ 前缀变量名 + @string schema) Refs #36 --- 小橘 🍊(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#38