From 7c3e14c4732173d1d38ae1a67a2ca8ddee92b9ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E6=9C=88?= Date: Fri, 8 May 2026 09:23:39 +0800 Subject: [PATCH] chore(cli): remove unused from CAS commands CAS is global (not per-thread). The underlying cmdCas* functions already dropped threadId in #103, but the CLI dispatch layer still required it from users. Now cleaned up: - cas get (was: cas get ) - cas put (was: cas put ) - cas list (was: cas list ) - cas rm (was: cas rm ) - skill.ts develop topic updated to match --- .../cli-workflow/src/commands/cas/dispatch.ts | 40 +++++++++---------- packages/cli-workflow/src/skill.ts | 8 ++-- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/packages/cli-workflow/src/commands/cas/dispatch.ts b/packages/cli-workflow/src/commands/cas/dispatch.ts index a807a86..2199d82 100644 --- a/packages/cli-workflow/src/commands/cas/dispatch.ts +++ b/packages/cli-workflow/src/commands/cas/dispatch.ts @@ -30,10 +30,9 @@ export async function dispatchGc(storageRoot: string, argv: string[]): Promise { - const threadId = rest[0]; - const hash = rest[1]; - if (threadId === undefined || hash === undefined || rest.length > 2) { - printCliError(`${usageText()}\n\nerror: cas get requires `); + const hash = rest[0]; + if (hash === undefined || rest.length > 1) { + printCliError(`${usageText()}\n\nerror: cas get requires `); return 1; } const result = await cmdCasGet(storageRoot, hash); @@ -46,10 +45,9 @@ export async function dispatchCasGet(storageRoot: string, rest: string[]): Promi } export async function dispatchCasPut(storageRoot: string, rest: string[]): Promise { - const threadId = rest[0]; - const content = rest[1]; - if (threadId === undefined || content === undefined || rest.length > 2) { - printCliError(`${usageText()}\n\nerror: cas put requires `); + const content = rest[0]; + if (content === undefined || rest.length > 1) { + printCliError(`${usageText()}\n\nerror: cas put requires `); return 1; } const result = await cmdCasPut(storageRoot, content); @@ -62,9 +60,8 @@ export async function dispatchCasPut(storageRoot: string, rest: string[]): Promi } export async function dispatchCasList(storageRoot: string, rest: string[]): Promise { - const threadId = rest[0]; - if (threadId === undefined || rest.length > 1) { - printCliError(`${usageText()}\n\nerror: cas list requires `); + if (rest.length > 0) { + printCliError(`${usageText()}\n\nerror: cas list takes no arguments`); return 1; } const result = await cmdCasList(storageRoot); @@ -79,10 +76,9 @@ export async function dispatchCasList(storageRoot: string, rest: string[]): Prom } export async function dispatchCasRm(storageRoot: string, rest: string[]): Promise { - const threadId = rest[0]; - const hash = rest[1]; - if (threadId === undefined || hash === undefined || rest.length > 2) { - printCliError(`${usageText()}\n\nerror: cas rm requires `); + const hash = rest[0]; + if (hash === undefined || rest.length > 1) { + printCliError(`${usageText()}\n\nerror: cas rm requires `); return 1; } const result = await cmdCasRm(storageRoot, hash); @@ -97,20 +93,20 @@ export async function dispatchCasRm(storageRoot: string, rest: string[]): Promis export const CAS_SUBCOMMAND_TABLE: Record = { get: { handler: dispatchCasGet, - args: " ", - description: "Retrieve content by hash from a thread's CAS", + args: "", + description: "Retrieve content by hash from CAS", }, put: { handler: dispatchCasPut, - args: " ", - description: "Store content in a thread's CAS, returns hash", + args: "", + description: "Store content in CAS, prints hash", }, list: { handler: dispatchCasList, - args: "", - description: "List all CAS entries for a thread", + args: "", + description: "List all hashes in CAS", }, - rm: { handler: dispatchCasRm, args: " ", description: "Remove a CAS entry" }, + rm: { handler: dispatchCasRm, args: "", description: "Remove a CAS entry by hash" }, gc: { handler: dispatchGc, args: "", description: "Garbage-collect unreferenced CAS entries" }, }; diff --git a/packages/cli-workflow/src/skill.ts b/packages/cli-workflow/src/skill.ts index a1501c1..ac70c92 100644 --- a/packages/cli-workflow/src/skill.ts +++ b/packages/cli-workflow/src/skill.ts @@ -126,13 +126,13 @@ uncaged-workflow thread list ## CAS (Content-Addressable Storage) -Store and retrieve content by hash, scoped to the current thread. +Store and retrieve content by hash in workflow storage (global CAS directory). | Operation | Command | |-----------|---------| -| **Store** | \`uncaged-workflow cas put ''\` → prints hash | -| **Read** | \`uncaged-workflow cas get \` → prints content | -| **List** | \`uncaged-workflow cas list \` | +| **Store** | \`uncaged-workflow cas put ''\` → prints hash | +| **Read** | \`uncaged-workflow cas get \` → prints content | +| **List** | \`uncaged-workflow cas list\` | CAS is the **only** supported way to persist structured data (phase plans, review notes, etc.) within a thread. Do not use temp files.