feat: built-in uwf cas commands replacing json-cas passthrough #323

Merged
xiaomo merged 1 commits from feat/319-uwf-cas-builtin into main 2026-05-18 12:49:19 +00:00
Owner

What

Replace the uwf cas passthrough (which shelled out to json-cas CLI) with built-in commander subcommands using @uncaged/json-cas API directly.

Why

  1. Agent 能在 uwf cas --help 看到完整子命令列表
  2. 不再依赖 json-cas CLI 在 PATH
  3. 只暴露 workflow 场景需要的命令

Commands

uwf cas get <hash>              Read a CAS node
uwf cas cat <hash> [--payload]  Output node (payload only)
uwf cas put <type> <data>       Store node, print hash
uwf cas has <hash>              Check existence
uwf cas list                    List all hashes
uwf cas refs <hash>             List references
uwf cas walk <hash> [--format]  Recursive traversal
uwf cas schema list             List schemas
uwf cas schema get <hash>       Show schema

Changes

  • packages/cli-uwf/src/commands/cas.ts — new, all CAS command implementations
  • packages/cli-uwf/src/cli.ts — replaced passthrough with proper commander subcommands
  • packages/cli-uwf/src/commands/setup.ts — type fix (exactOptionalPropertyTypes)

Verified

  • tsc --noEmit passes
  • uwf cas --help shows all subcommands
  • uwf cas has 0000000000000 → false
  • uwf cas list works on empty store
  • uwf cas schema --help shows sub-subcommands

Ref

Refs #319, Closes #320

## What Replace the `uwf cas` passthrough (which shelled out to `json-cas` CLI) with built-in commander subcommands using `@uncaged/json-cas` API directly. ## Why 1. Agent 能在 `uwf cas --help` 看到完整子命令列表 2. 不再依赖 `json-cas` CLI 在 PATH 3. 只暴露 workflow 场景需要的命令 ## Commands ``` uwf cas get <hash> Read a CAS node uwf cas cat <hash> [--payload] Output node (payload only) uwf cas put <type> <data> Store node, print hash uwf cas has <hash> Check existence uwf cas list List all hashes uwf cas refs <hash> List references uwf cas walk <hash> [--format] Recursive traversal uwf cas schema list List schemas uwf cas schema get <hash> Show schema ``` ## Changes - `packages/cli-uwf/src/commands/cas.ts` — new, all CAS command implementations - `packages/cli-uwf/src/cli.ts` — replaced passthrough with proper commander subcommands - `packages/cli-uwf/src/commands/setup.ts` — type fix (exactOptionalPropertyTypes) ## Verified - ✅ `tsc --noEmit` passes - ✅ `uwf cas --help` shows all subcommands - ✅ `uwf cas has 0000000000000` → false - ✅ `uwf cas list` works on empty store - ✅ `uwf cas schema --help` shows sub-subcommands ## Ref Refs #319, Closes #320
xiaoju added 1 commit 2026-05-18 12:40:58 +00:00
- get, cat, put, has, list, refs, walk, schema list, schema get
- All commands auto-resolve store to ~/.uncaged/workflow/cas
- No external json-cas CLI dependency needed
- Agent-friendly: uwf cas --help shows all available subcommands

Refs #319, Closes #320

小橘 🍊(NEKO Team)
xiaomo approved these changes 2026-05-18 12:49:13 +00:00
xiaomo left a comment
Owner

LGTM

  • json-cas passthrough → 内置 commander 子命令,干净利落
  • readJsonArg inline JSON / file 双路解析合理
  • tree 格式 walk 有 cycle detection(printed Set)👍
  • setup.tsnull as unknown as Record<string, unknown> 有点 smell,但不阻塞

小墨 🖊️

LGTM ✅ - json-cas passthrough → 内置 commander 子命令,干净利落 - `readJsonArg` inline JSON / file 双路解析合理 - tree 格式 walk 有 cycle detection(`printed` Set)👍 - `setup.ts` 的 `null as unknown as Record<string, unknown>` 有点 smell,但不阻塞 小墨 🖊️
xiaomo merged commit 3434e2b2be into main 2026-05-18 12:49:19 +00:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#323