Skip to content

Commit c2fec12

Browse files
committed
fix(workboard): preserve json list archive visibility
1 parent 9e5e3bd commit c2fec12

3 files changed

Lines changed: 38 additions & 25 deletions

File tree

docs/cli/workboard.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ Columns are id prefix, status, priority, board id, optional agent id, and title.
5050

5151
Flags:
5252

53-
| Flag | Purpose |
54-
| -------------------- | ------------------------------------------------------------- |
55-
| `--board <id>` | Limit results to one board namespace |
56-
| `--status <status>` | Limit results to one Workboard status |
57-
| `--include-archived` | Include archived cards (hidden by default, matching the tool) |
58-
| `--json` | Print the full card list as machine JSON |
59-
60-
Archived cards are hidden by default so the CLI matches the `workboard_list`
61-
agent tool and the `/workboard list` command. Pass `--include-archived` to show
62-
them.
53+
| Flag | Purpose |
54+
| -------------------- | --------------------------------------------- |
55+
| `--board <id>` | Limit results to one board namespace |
56+
| `--status <status>` | Limit results to one Workboard status |
57+
| `--include-archived` | Include archived cards in compact text output |
58+
| `--json` | Print the full card list as machine JSON |
59+
60+
Compact text output hides archived cards by default so the CLI matches the
61+
`/workboard list` command. Pass `--include-archived` to show them. JSON output
62+
keeps the full card list, including archived cards, for existing automation.
6363

6464
## `create`
6565

extensions/workboard/src/cli.test.ts

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

109-
it("hides archived cards by default and reveals them with --include-archived", async () => {
109+
it("hides archived cards from text output by default and reveals them with --include-archived", async () => {
110110
const store = new WorkboardStore(createMemoryStore());
111-
const active = await store.create({ title: "Active card" });
111+
await store.create({ title: "Active card" });
112112
const archived = await store.create({ title: "Archived card" });
113113
await store.archive(archived.id, true);
114114
const program = createProgram(store);
115115

116116
const defaultOutput = await captureStdout(async () => {
117-
await program.parseAsync(["workboard", "list", "--json"], { from: "user" });
117+
await program.parseAsync(["workboard", "list"], { from: "user" });
118118
});
119119
const includeOutput = await captureStdout(async () => {
120-
await program.parseAsync(["workboard", "list", "--include-archived", "--json"], {
121-
from: "user",
122-
});
120+
await program.parseAsync(["workboard", "list", "--include-archived"], { from: "user" });
121+
});
122+
123+
expect(defaultOutput).toContain("Active card");
124+
expect(defaultOutput).not.toContain("Archived card");
125+
expect(includeOutput).toContain("Active card");
126+
expect(includeOutput).toContain("Archived card");
127+
});
128+
129+
it("preserves archived cards in JSON list output by default", async () => {
130+
const store = new WorkboardStore(createMemoryStore());
131+
const archived = await store.create({ title: "Archived card" });
132+
await store.archive(archived.id, true);
133+
const program = createProgram(store);
134+
135+
const output = await captureStdout(async () => {
136+
await program.parseAsync(["workboard", "list", "--json"], { from: "user" });
123137
});
124138

125-
expect(defaultOutput).toContain(active.id);
126-
expect(defaultOutput).not.toContain(archived.id);
127-
expect(includeOutput).toContain(active.id);
128-
expect(includeOutput).toContain(archived.id);
139+
expect(output).toContain(archived.id);
140+
expect(output).toContain("archivedAt");
129141
});
130142

131143
it("does not fall back to local dispatch for explicit gateway targets", async () => {

extensions/workboard/src/cli.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ export function registerWorkboardCli(params: { program: Command; store: Workboar
140140
includeArchived?: boolean;
141141
},
142142
) => {
143-
// Hide archived cards by default to match the workboard_list tool and the
144-
// /workboard list command; --include-archived restores the full set.
145-
let cards = (await params.store.list({ boardId: options.board })).filter(
146-
(card) => options.includeArchived === true || !card.metadata?.archivedAt,
147-
);
143+
// Text output hides archived cards like /workboard list, while --json
144+
// keeps the shipped full-card contract for existing scripts.
145+
let cards = await params.store.list({ boardId: options.board });
146+
if (!options.json && options.includeArchived !== true) {
147+
cards = cards.filter((card) => !card.metadata?.archivedAt);
148+
}
148149
if (options.status) {
149150
cards = cards.filter((card) => card.status === options.status);
150151
}

0 commit comments

Comments
 (0)