CLAUDE.md@docs · diff
git:20260202.b5424a7 to git:20260603.1c0f82d
7 added, 4 removed. Audit A to A.
# CLAUDE.md - Docs
## Navbar
- The header navbar items must always be aligned to the left (next to the logo), not centered or spread across the header. This is achieved via CSS in `styles/custom.css`.
- Navbar order: Docs, Learn, Protocol, Self Host (controlled by key order in `pages/_meta.json`).
- ## SDK Query Parameter
+ ## SDK Selection (path-derived)
- - The `sdk` query parameter (e.g., `?sdk=go-gin`) must be sticky across all `/client` pages. When a user selects a framework, every sidebar link click and page navigation within `/client` must preserve the `sdk` param in the URL.
- - This is handled by the `SdkProvider` in `components/SdkContext.jsx` which listens to route changes and re-injects the `sdk` param if missing.
- - All internal links within `/client` pages should propagate `sdk` — do not create links that would drop the parameter.
+ - The URL **path is the single source of truth** for the active SDK. There is **no `?sdk=` query parameter** — do not reintroduce one, and never append `?sdk=` to internal `/client` links.
+ - `resolveSdkFromPath(pathname, lastSdk)` in `components/SdkContext.jsx` maps the first path segment after `/client/` to an SDK via `FOLDER_SDK`. Folders that map 1:1 to a framework (e.g. `gin-middleware` → `go-gin`, `react` → `js-react`) are authoritative.
+ - Two folders are shared/ambiguous (`SHARED_FOLDERS`): `sdk` (Go SDK Reference, any `go-*`) and `js-sdk` (JS SDK Reference, the JS frontend group). These disambiguate via the remembered framework in `localStorage['traceway-docs-sdk']` (`lastSdk`) when it belongs to the folder's group, otherwise fall back to `go-generic` / `js-generic`.
+ - `localStorage` stores only `lastSdk`. It is written when a specific SDK is resolved from the path, or when the user picks a framework from the dropdown (`SdkSelector`) or the `/client` picker (`FrameworkPicker`).
+ - Sidebar item visibility (`SDK_VISIBILITY` in `theme.config.jsx`) and the dropdown label both derive from the path-resolved SDK. `SDK_VISIBILITY` must stay complete (every `/client/<folder>` needs an entry) and matching is by exact first path segment, not substring.
+ - Stray `?sdk=` params on `/client` URLs are self-healed: `SdkProvider` strips them via a shallow `router.replace`, so old bookmarks/links correct themselves.