1+---
2+name: status-command
3+overview: Add a tern status command that lists notes waiting to upload and unresolved conflicts, so a stalled sync is visible without reading the journal by hand.
4+todos:
5+ - id: W1-A
6+ content: "Wave 1: Summarise pending uploads from the journal"
7+ status: pending
8+ - id: W1-B
9+ content: "Wave 1: Format the status table"
10+ status: pending
11+ - id: W2-A
12+ content: "Wave 2: The tern status command"
13+ status: pending
14+ - id: W2-B
15+ content: "Wave 2: List unresolved conflicts"
16+ status: pending
17+ - id: W3-A
18+ content: "Wave 3: Document tern status"
19+ status: pending
20+isProject: true
21+---
22+
23+# tern status
24+
25+**Goal:** `tern status` prints what is waiting to upload and what is in conflict.
26+
27+## Wave Breakdown
28+
29+### Wave 1 — What to show
30+
31+#### Task W1-A: Summarise pending uploads from the journal
32+- **Build:** Add `summary()` to `Journal`, returning the pending count, total bytes, and the oldest pending entry's age.
33+- **Test:** `test/journal.test.ts` covers an empty journal, two pending entries, and an uploaded entry being excluded.
34+- **Accept:** `npm test` passes.
35+- **Touches:** `src/store/journal.ts`, `test/journal.test.ts`
36+- **Depends on:** —
37+
38+#### Task W1-B: Format the status table
39+- **Build:** Add `src/cli/format.ts` with `formatStatus(summary, conflicts)`: one line per note, sizes human-readable, ages relative.
40+- **Test:** `test/format.test.ts` snapshots the output for zero, one, and many notes.
41+- **Accept:** Output fits in 80 columns.
42+- **Touches:** `src/cli/format.ts`, `test/format.test.ts`
43+- **Depends on:** —
44+
45+### Wave 2 — The command
46+
47+#### Task W2-A: The tern status command
48+- **Build:** Add `status` to `src/cli.ts`: open the journal read-only, print `formatStatus()`, exit 0.
49+- **Test:** `test/cli.test.ts` runs `tern status` against a fixture journal.
50+- **Accept:** `tern status` in a notes folder with two pending edits lists both.
51+- **Touches:** `src/cli.ts`, `test/cli.test.ts`
52+- **Depends on:** W1-A, W1-B
53+
54+#### Task W2-B: List unresolved conflicts
55+- **Build:** Find `*.conflict.md` files next to notes and pass them to `formatStatus()`.
56+- **Test:** `test/conflict.test.ts` gains a case for a leftover conflict file.
57+- **Accept:** A conflict shows under its own heading with both paths.
58+- **Touches:** `src/sync/conflict.ts`, `test/conflict.test.ts`
59+- **Depends on:** W1-A
60+
61+### Wave 3 — Docs
62+
63+#### Task W3-A: Document tern status
64+- **Build:** Add a Status section to the README and a line to `docs/architecture.md`.
65+- **Test:** Links in both files resolve.
66+- **Accept:** The README example matches real output.
67+- **Touches:** `README.md`, `docs/architecture.md`
68+- **Depends on:** W2-A