feat(cli): thread list defaults to active threads only
CI / check (pull_request) Successful in 2m52s
CI / check (pull_request) Successful in 2m52s
Closes #147. Changes default behavior of `uwf thread list` to show only active threads (idle + running). Adds `--all` flag to opt into the previous full-list behavior. Explicit `--status` still wins over `--all`. - cmdThreadList gains a `showAll: boolean` parameter (default false) - CLI registers `--all` option and passes it through - Test suite includes new `default behavior (issue #147)` describe block covering 9 scenarios; existing tests updated where they implicitly relied on the old "show everything" behavior - README, cli-reference, and usage-reference updated to document the new default and the `--all` flag Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -650,18 +650,25 @@ export async function cmdThreadList(
|
||||
beforeMs: number | null,
|
||||
skip: number | null,
|
||||
take: number | null,
|
||||
showAll: boolean = false,
|
||||
): Promise<ThreadListItemWithStatus[]> {
|
||||
const uwf = await createUwfStore(storageRoot);
|
||||
const index = loadActiveThreads(uwf.varStore);
|
||||
|
||||
// Resolve the effective filter:
|
||||
// - explicit --status wins (showAll has no effect)
|
||||
// - otherwise: --all → no filter; default → ["idle", "running"]
|
||||
const effectiveFilter: ThreadStatus[] | null =
|
||||
statusFilter !== null ? statusFilter : showAll ? null : ["idle", "running"];
|
||||
|
||||
// Collect active threads
|
||||
let items = await collectActiveThreads(storageRoot, uwf, index);
|
||||
|
||||
// Collect completed threads (if relevant for status filter)
|
||||
const includeCompleted =
|
||||
statusFilter === null ||
|
||||
statusFilter.includes("completed") ||
|
||||
statusFilter.includes("cancelled");
|
||||
effectiveFilter === null ||
|
||||
effectiveFilter.includes("completed") ||
|
||||
effectiveFilter.includes("cancelled");
|
||||
if (includeCompleted) {
|
||||
const activeIds = new Set(items.map((i) => i.thread));
|
||||
const completedItems = collectCompletedThreads(uwf, activeIds);
|
||||
@@ -669,8 +676,8 @@ export async function cmdThreadList(
|
||||
}
|
||||
|
||||
// Apply status filter
|
||||
if (statusFilter !== null) {
|
||||
items = items.filter((item) => statusFilter.includes(item.status));
|
||||
if (effectiveFilter !== null) {
|
||||
items = items.filter((item) => effectiveFilter.includes(item.status));
|
||||
}
|
||||
|
||||
// Apply time range filters
|
||||
|
||||
Reference in New Issue
Block a user