feat: add atbb category add and board add commands with init seeding (#43)
* docs: CLI categories and boards design
* docs: CLI categories and boards implementation plan
* feat: add createCategory step module (ATB-28)
Implements TDD createCategory step with idempotent PDS write and DB insert,
slug derivation from name, and skipping when a category with the same name exists.
* feat: add createBoard step module (ATB-28)
* feat: add atbb category add command (ATB-28)
* feat: add atbb board add command (ATB-28)
Implements the `atbb board add` subcommand with interactive category
selection when --category-uri is not provided, validating the chosen
category against the database before creating the board record.
* fix: add try/catch around category resolution and URI validation in board add command (ATB-28)
- Wrap entire category resolution block (DB queries + interactive select prompt)
in try/catch so connection drops after the SELECT 1 probe properly call
forumAgent.shutdown() and cleanup() before process.exit(1)
- Validate AT URI format before parsing: reject URIs that don't start with
at:// or have fewer than 5 path segments, with an actionable error message
* feat: extend init with optional category/board seeding step (ATB-28)
* fix: remove dead catch blocks in step modules and add categoryId guard in init (ATB-28)
- create-category.ts / create-board.ts: both branches of the try/catch
re-threw unconditionally, making the catch a no-op; replaced with a
direct await assignment and removed the unused isProgrammingError import
- init.ts: added an explicit error-and-exit guard after the categoryId DB
lookup so a missing row causes a loud failure instead of silently
skipping board creation
* fix: address ATB-28 code review feedback
- Extract deriveSlug to packages/cli/src/lib/slug.ts (Issue 9 — dedup)
- Add isProgrammingError to packages/cli/src/lib/errors.ts and re-throw
in all three command handler catch blocks: category.ts, board.ts,
init.ts Step 4 (Issues 7/1)
- Wrap forumAgent.initialize() in try/catch in category.ts and board.ts
so PDS-unreachable errors call cleanup() before exit (Issue 6)
- Validate AT URI collection segment in board.ts: parts[3] must be
space.atbb.forum.category (Issue 4)
- Add forumDid and resource name context to all catch block error logs
using JSON.stringify (Issue 10)
- Fix misleading comment "Step 6 (label 4)" → "Step 4" in init.ts
- Remove dead guard (categoryUri && categoryId && categoryCid) in init.ts
Step 4 — guaranteed non-null by the !categoryId exit above (Suggestion)
- Add DB insert failure tests to create-category.test.ts and
create-board.test.ts (Issue 2)
- Add sortOrder include/omit tests to both step module test files (Suggestion)
- Add category-command.test.ts: command integration tests for category add
including prompt path, PDS init failure, error/programming-error handling
(Issue 3)
- Add board-command.test.ts: command integration tests for board add
including collection-segment validation, DB category lookup, error
handling (Issues 3/4)
- Add init-step4.test.ts: tests for Step 4 seeding — skip path, full
create path, !categoryId guard, createBoard failure, programming error
re-throw (Issue 5)
* fix: address second round of review feedback on ATB-28
- create-category.ts: warn when forumId is null (silent failure → visible warning)
- category.ts, board.ts: best-effort forumAgent.shutdown() in initialize() failure path
- init.ts: split combined try block so DB re-query failure doesn't report as
"Failed to create category" (the PDS write already succeeded by that point)
- Tests: add isAuthenticated()=false branch for category and board commands
- Tests: add interactive select and empty-categories paths for board command
- Tests: add createBoard programming error re-throw and DB re-query throw for init Step 4