Skip to content

feat: multi-entity documentation support#22

Merged
yumike merged 1 commit into
mainfrom
feat/multi-entity-support
Mar 23, 2026
Merged

feat: multi-entity documentation support#22
yumike merged 1 commit into
mainfrom
feat/multi-entity-support

Conversation

@yumike
Copy link
Copy Markdown
Contributor

@yumike yumike commented Mar 14, 2026

Summary

  • Add Hub class (LRU cache of RwSite instances) so the backend can serve docs for multiple Backstage entities from a single S3 bucket
  • Replace flat routes with entity-prefixed routes (/site/:namespace/:kind/:name/*)
  • Add rwdocs.org/ref annotation parsing — format: "<entity>[:<scope>]" where entity is an entity ref or . (self), scope is optional navigation scoping
  • Add RwEntityDocsViewer (reads annotation from catalog entity) and RwStandaloneViewer (uses rw.rootEntity config)
  • Documentation tab only appears on entities with the rwdocs.org/ref annotation
  • Extract toEntityPath utility (both frontend and backend) to deduplicate entity ref formatting
  • Use res.locals middleware pattern for injecting RwSite into route handlers

Test plan

  • 23 backend tests pass (Hub cache/eviction, entity-prefixed routes, toEntityPath, unknown entity 404)
  • 27 frontend tests pass (annotation parsing, viewer mounting, toEntityPath, error handling)
  • TypeScript typecheck clean
  • ESLint clean
  • Manual: configure rw.rootEntity and verify standalone /docs page
  • Manual: add rwdocs.org/ref: "." annotation to a component entity and verify docs tab
  • Manual: add rwdocs.org/ref: "default/component/arch:domains/billing" and verify scoped navigation

🤖 Generated with Claude Code

Refactor both plugins to serve and render docs per catalog entity
instead of a single global site.

Backend: add Hub class with LRU eviction for managing multiple RwSite
instances, entity-scoped routes (/site/:ns/:kind/:name/*), and support
for both local projectDir and S3 storage modes.

Frontend: split monolithic viewer into RwEntityDocsViewer (reads
rwdocs.org/ref annotation) and RwStandaloneViewer (reads rw.rootEntity
config), add cross-entity section ref resolution via catalog API
lookups with client-side caching, and wire scopePath into the RW
viewer for scope-relative URL handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yumike yumike force-pushed the feat/multi-entity-support branch from 34b8294 to 4eadae5 Compare March 23, 2026 17:25
@yumike yumike merged commit 924204a into main Mar 23, 2026
1 check passed
@yumike yumike deleted the feat/multi-entity-support branch March 23, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant