refactor(cli): Phase 4 cleanup — dedup, extract, deprecate
- bundle-store.ts: remove private pathExists, import from fs-utils - thread-scan.ts: extract parseFirstJsonLineObject helper, dedup first-line parsing - commands/workflow/add-argv.ts: extract parseAddArgv from add.ts - commands/thread/fork-argv.ts: extract parseForkArgv from fork.ts - commands/cas/*.ts: remove unused _threadId params from cmdCas* functions - cli-dispatch.ts: add deprecation warning to help command - commands/init/templates.ts: extract template strings from template.ts - cli-color.ts: extract shouldUseColor, highlightLiveRole, dimGreyLine from live.ts - 242 tests pass, biome clean Closes #97
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { ParsedAddArgv } from "../src/commands/workflow/add.js";
|
||||
import type { ParsedAddArgv } from "../src/commands/workflow/add-argv.js";
|
||||
|
||||
export function addCliArgs(name: string, filePath: string): ParsedAddArgv {
|
||||
return { name, filePath, typesPath: null };
|
||||
|
||||
@@ -402,7 +402,7 @@ export const run = async function* (input, options) {
|
||||
});
|
||||
|
||||
test("cas put/get/list/rm use global cas dir (thread id not required for storage)", async () => {
|
||||
const put = await cmdCasPut(storageRoot, "nonexistent-thread-id", "phase doc");
|
||||
const put = await cmdCasPut(storageRoot, "phase doc");
|
||||
expect(put.ok).toBe(true);
|
||||
if (!put.ok) {
|
||||
return;
|
||||
@@ -411,24 +411,24 @@ export const run = async function* (input, options) {
|
||||
const blobPath = join(getGlobalCasDir(storageRoot), `${hash}.txt`);
|
||||
expect(await readFile(blobPath, "utf8")).toBe("phase doc");
|
||||
|
||||
const got = await cmdCasGet(storageRoot, "other-thread", hash);
|
||||
const got = await cmdCasGet(storageRoot, hash);
|
||||
expect(got.ok).toBe(true);
|
||||
if (!got.ok) {
|
||||
return;
|
||||
}
|
||||
expect(got.value).toBe("phase doc");
|
||||
|
||||
const listed = await cmdCasList(storageRoot, "another-thread");
|
||||
const listed = await cmdCasList(storageRoot);
|
||||
expect(listed.ok).toBe(true);
|
||||
if (!listed.ok) {
|
||||
return;
|
||||
}
|
||||
expect(listed.value).toContain(hash);
|
||||
|
||||
const removed = await cmdCasRm(storageRoot, "rm-thread", hash);
|
||||
const removed = await cmdCasRm(storageRoot, hash);
|
||||
expect(removed.ok).toBe(true);
|
||||
|
||||
const missing = await cmdCasGet(storageRoot, "after-rm", hash);
|
||||
const missing = await cmdCasGet(storageRoot, hash);
|
||||
expect(missing.ok).toBe(false);
|
||||
});
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ describe("cli thread commands", () => {
|
||||
const runningPath = join(dirname(dataPath), `${threadId}.running`);
|
||||
await waitUntilRunningFileAbsent(runningPath, 120);
|
||||
|
||||
const put = await cmdCasPut(storageRoot, threadId, "keep-after-thread-rm");
|
||||
const put = await cmdCasPut(storageRoot, "keep-after-thread-rm");
|
||||
expect(put.ok).toBe(true);
|
||||
if (!put.ok) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user