Skip to content

Commit 9d7f67f

Browse files
committed
fix(workboard): hide archived cards from cli list
1 parent c654641 commit 9d7f67f

3 files changed

Lines changed: 62 additions & 7 deletions

File tree

docs/cli/workboard.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ openclaw gateway restart
2222
## Usage
2323

2424
```bash
25-
openclaw workboard list [--board <id>] [--status <status>] [--json]
25+
openclaw workboard list [--board <id>] [--status <status>] [--include-archived] [--json]
2626
openclaw workboard create <title...> [--notes <text>] [--status <status>] [--priority <priority>] [--agent <id>] [--board <id>] [--labels <items>] [--json]
2727
openclaw workboard show <id> [--json]
2828
openclaw workboard dispatch [--url <url>] [--token <token>] [--timeout <ms>] [--json]
@@ -37,6 +37,7 @@ unambiguous prefix when a command accepts a card id.
3737
```bash
3838
openclaw workboard list
3939
openclaw workboard list --board default --status ready
40+
openclaw workboard list --include-archived
4041
openclaw workboard list --json
4142
```
4243

@@ -47,14 +48,16 @@ Text output is compact:
4748
```
4849

4950
Columns are id prefix, status, priority, board id, optional agent id, and title.
51+
Archived cards are hidden by default; pass `--include-archived` to show them.
5052

5153
Flags:
5254

53-
| Flag | Purpose |
54-
| ------------------- | ---------------------------------------- |
55-
| `--board <id>` | Limit results to one board namespace |
56-
| `--status <status>` | Limit results to one Workboard status |
57-
| `--json` | Print the full card list as machine JSON |
55+
| Flag | Purpose |
56+
| -------------------- | ---------------------------------------- |
57+
| `--board <id>` | Limit results to one board namespace |
58+
| `--status <status>` | Limit results to one Workboard status |
59+
| `--include-archived` | Include archived cards |
60+
| `--json` | Print the full card list as machine JSON |
5861

5962
## `create`
6063

extensions/workboard/src/cli.test.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,48 @@ describe("registerWorkboardCli", () => {
106106
expect(showOutput).toContain("[redacted]");
107107
});
108108

109+
it("hides archived cards from list output by default", async () => {
110+
const store = new WorkboardStore(createMemoryStore());
111+
await store.create({ title: "Active card" });
112+
const archived = await store.create({ title: "Archived card" });
113+
await store.archive(archived.id, true);
114+
const program = createProgram(store);
115+
116+
const textOutput = await captureStdout(async () => {
117+
await program.parseAsync(["workboard", "list"], { from: "user" });
118+
});
119+
const jsonOutput = await captureStdout(async () => {
120+
await program.parseAsync(["workboard", "list", "--json"], { from: "user" });
121+
});
122+
123+
expect(textOutput).toContain("Active card");
124+
expect(textOutput).not.toContain("Archived card");
125+
expect(jsonOutput).toContain("Active card");
126+
expect(jsonOutput).not.toContain("Archived card");
127+
});
128+
129+
it("includes archived cards when list uses include-archived", async () => {
130+
const store = new WorkboardStore(createMemoryStore());
131+
await store.create({ title: "Active card" });
132+
const archived = await store.create({ title: "Archived card" });
133+
await store.archive(archived.id, true);
134+
const program = createProgram(store);
135+
136+
const textOutput = await captureStdout(async () => {
137+
await program.parseAsync(["workboard", "list", "--include-archived"], { from: "user" });
138+
});
139+
const jsonOutput = await captureStdout(async () => {
140+
await program.parseAsync(["workboard", "list", "--include-archived", "--json"], {
141+
from: "user",
142+
});
143+
});
144+
145+
expect(textOutput).toContain("Active card");
146+
expect(textOutput).toContain("Archived card");
147+
expect(jsonOutput).toContain("Active card");
148+
expect(jsonOutput).toContain("Archived card");
149+
});
150+
109151
it("does not fall back to local dispatch for explicit gateway targets", async () => {
110152
const store = new WorkboardStore(createMemoryStore());
111153
const card = await store.create({ title: "Remote target", status: "ready" });

extensions/workboard/src/cli.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ type JsonOptions = {
1111
json?: boolean;
1212
};
1313

14+
type WorkboardListOptions = JsonOptions & {
15+
board?: string;
16+
includeArchived?: boolean;
17+
status?: string;
18+
};
19+
1420
type GatewayOptions = JsonOptions & {
1521
url?: string;
1622
token?: string;
@@ -130,9 +136,13 @@ export function registerWorkboardCli(params: { program: Command; store: Workboar
130136
.description("List Workboard cards")
131137
.option("--board <id>", "Board id")
132138
.option("--status <status>", "Filter by status")
139+
.option("--include-archived", "Include archived cards", false)
133140
.option("--json", "Print JSON", false)
134-
.action(async (options: JsonOptions & { board?: string; status?: string }) => {
141+
.action(async (options: WorkboardListOptions) => {
135142
let cards = await params.store.list({ boardId: options.board });
143+
if (!options.includeArchived) {
144+
cards = cards.filter((card) => !card.metadata?.archivedAt);
145+
}
136146
if (options.status) {
137147
cards = cards.filter((card) => card.status === options.status);
138148
}

0 commit comments

Comments
 (0)