feat(api): library read endpoints — GET /libraries, GET /libraries/:id/specs#227
Merged
Conversation
…d/specs The web UI demo cannot bootstrap on main without listing libraries: creating its default project needs a source library id (POST /projects mandates sourceLibraryIds, #94), and seeded library UUIDs are only discoverable by listing. These reads existed in the DB layer but weren't exposed. - GET /libraries → Library[] (tier, name order), reusing listLibraries(). - GET /libraries/:id/specs → LibrarySpec[] with paragraph node counts; 404 on unknown library. New listLibrarySpecs query (specs ⋈ paragraphs). - openapi.yaml documents both; contract gate response-covers them. Closes #226 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds ChangesLibrary Read Endpoints
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This was referenced Jun 19, 2026
thewrz
added a commit
that referenced
this pull request
Jun 21, 2026
With GET /libraries (#227) and GET /projects (#229) on main, the demo now bootstraps. This conforms the rest of it to main's actual API: - features.js capability map: panels check a flag and degrade to a clear "not available in this build" state instead of calling endpoints that 404. libraries/projectsList on (landed); library writes, project settings/sources, coordination/required-sections, and hard-delete stay off. - Repoint getSpecTree -> GET /specs/:id (the single-spec read already returns the tree). Drop the explicit deleteReference call — references are derived from paragraph text, so the paragraph PATCH re-derives them. - Restore the reference-web arcs by fetching project-scoped outbound references (GET /projects/:id/specs/:specId/references, ADR-024) per loaded spec. Verified end-to-end with Playwright: clean boot, default project auto-created, all bootstrap calls 200/201, zero console 404s, gated endpoints never hit. Closes #230 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
examples/web_ui_demoboard cannot bootstrap onmain: creating its default project requires a source library id (POST /projectsmandatessourceLibraryIds≥1 by design, #94), and seeded library UUIDs are only discoverable by listing them. The DB layer already hadlistLibraries(); these were just never exposed over REST. First of the roadmap-first backend gaps that unblock the demo (spec:docs/superpowers/specs/2026-06-19-demo-backend-conformance.md).What
Two read endpoints, mirroring the existing
GET /conventionslist pattern and ADR-015 D1 (libraries are first-class):GET /libraries→ApiResponse<Library[]>, ordered by tier then name (reuseslistLibraries()).GET /libraries/:id/specs→ApiResponse<LibrarySpec[]>with each spec's paragraphnodeCount;404on unknown library,400on malformed id. NewlistLibrarySpecsquery.openapi.yamldocuments both withLibrary/LibrarySpecschemas; the contract gate response-covers them.Testing
src/api/libraries.integration.test.ts(list returns seeded built-ins ordered; specs list returns nodeCount; 404 + 400) — 5/5 passpnpm lintclean (eslint + tsc + prettier)🤖 Co-authored by Claude Opus 4.8. Closes #226.
Summary by CodeRabbit
New Features