Skip to content

Add generated API documentation#59

Merged
kylemclaren merged 38 commits intomainfrom
feat/api-documentation
Jan 14, 2026
Merged

Add generated API documentation#59
kylemclaren merged 38 commits intomainfrom
feat/api-documentation

Conversation

@kylemclaren
Copy link
Collaborator

@kylemclaren kylemclaren commented Jan 8, 2026

Summary

  • Add build-time API documentation generator that fetches schema and SDK examples
  • Add React components for double-pane Stainless-style API documentation layout
  • Add code snippet selector with localStorage language persistence
  • Update sidebar to include API documentation pages
  • Add comprehensive CSS styling for API documentation

Changes

Build Infrastructure

  • Add tsx dev dependency for TypeScript script execution
  • Add scripts/generate-api-docs.ts that fetches API schema and SDK examples from remote sources
  • Integrate generate:api into dev/start/build commands
  • Ignore generated src/content/docs/api/ in .gitignore

Components

  • Add base API documentation components (EndpointCard, PropertyRow, etc.)
  • Add double-pane layout components (MethodPage, MethodHeader, PropertyTree, etc.)
  • Add SnippetSelector with cross-page language preference sync
  • Add shadcn/ui Card component
  • Add Elixir language support to CodeTabs

Configuration

  • Update sidebar with API documentation pages
  • Update LLMs text export to include generated API docs

Test plan

  • Run pnpm dev and verify API docs are generated
  • Navigate to /api and verify documentation renders
  • Test language selector persists preference across pages
  • Verify double-pane layout works on desktop and mobile

🤖 Generated with Claude Code

kylemclaren and others added 11 commits January 8, 2026 17:31
- Add tsx dev dependency for running TypeScript scripts
- Add generate:api script that fetches API schema and SDK examples
- Integrate generation into dev/start/build commands
- Ignore generated API docs in .gitignore (rebuilt on deploy)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
TypeScript type definitions for API schema, endpoints, SDK examples,
and utility functions for fetching and merging API data.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add Card component with variants: Card, CardHeader, CardTitle,
CardDescription, CardContent, CardFooter, CardAction.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add foundational React components for API documentation:
- WebSocketBadge: Visual indicator for WebSocket endpoints
- PropertyRow: Display property name, type, and description
- EndpointHeader: Header with method and path
- ParameterList: List of endpoint parameters
- ResponseExample: Code block for response examples
- TypeReference: Display type information
- EndpointCard: Card container for endpoints
- SnippetTabs: Tabbed code snippets
- CodeSnippet: Syntax-highlighted code display

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add Stainless-style double-pane layout components:
- MethodPage/MethodPageLeft/MethodPageRight: Two-column layout
- MethodBadge: HTTP method badge with colors
- MethodHeader: Endpoint title with method and path
- PropertyTree: Expandable property documentation
- SDKSelector: Language selector for code examples
- CollapsibleSnippet: Expandable code block
- SnippetPanel: Code snippet container

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- SnippetSelector: React component for selecting code language
- CodeSnippets.astro: Astro wrapper for multi-language code blocks
- Persists language preference to localStorage
- Syncs selection across all code snippets on page

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Export all API documentation components (legacy and double-pane)
from the central React components index for easy importing.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace external API link with in-site API documentation pages:
Overview, Exec, Checkpoints, Services, Proxy, Policy, Type Definitions.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update the LLMs full-text export to include the generated API
documentation pages instead of the removed rest.mdx.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add comprehensive CSS for API documentation including:
- HTTP method colors (GET, POST, PUT, DELETE, PATCH, WebSocket)
- Double-pane layout with sticky code snippets
- Property tree styling
- Method badges and headers
- Snippet container styling
- Full-width page layout for API pages
- Stainless-style snippet component styling

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@kylemclaren kylemclaren changed the title Add generated API documentation with double-pane layout Add generated API documentation Jan 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Preview Deployment

Name URL
Preview https://pr-59-superfly-sprites-docs.fly.dev

Commit: 5b53a9f

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Lighthouse Results

URL Performance Accessibility Best Practices SEO
/ 🟢 99 🟢 100 🟢 100 🟢 92

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

E2E Test Results

❌ Tests failure

Ran against: https://pr-59-superfly-sprites-docs.fly.dev

- Remove unused imports
- Fix import ordering
- Apply formatting fixes
- Use optional chaining where appropriate
- Fix useEffect dependency issues with useCallback
- Remove non-null assertions

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Remove overflow:hidden from .method-page-right
- Remove overflow-y:auto and max-height from .code-snippets
- Move overflow-hidden to only the code blocks section
- Add explicit border-radius to header and code blocks

The dropdown was being clipped by multiple overflow containers.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Kyle McLaren and others added 2 commits January 13, 2026 10:48
Change from incorrect $SPRITE_NAME.sprites.app to api.sprites.dev

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Adds formatType() function that converts Go types to readable
TypeScript/JSON-like notation:
- bool → boolean
- int/int64 → number
- []string → string[]
- *int → number?
- time.Time → string (ISO 8601)
- map[string]interface{} → object

Applied to all field type displays: markdown tables, PropertyTree
components, and example placeholders.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add version configuration in src/lib/api-versions.ts
- Create VersionSelector component for switching between API versions
- Update generator to output versioned docs to /api/{version}/
- Add root /api/ redirect to default version
- Update sidebar to use versioned API paths
- Add VersionSelector to PageTitle for API pages

When additional versions are published to S3, add them to api-versions.ts
and regenerate. The version dropdown appears when 2+ versions exist.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The script in CodeSnippets.astro was being processed/bundled by Astro,
which prevented it from running on each page. Adding `is:inline` ensures
the script runs inline on every page that uses CodeSnippets.

Converted TypeScript to plain JavaScript since is:inline scripts aren't
processed by the build system.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add manually-created sprites.mdx with CRUD endpoints (create, list, get, update, delete)
- Update generator to preserve manual pages during regeneration
- Add Sprites to sidebar navigation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Navigate to /api/dev-latest/sprites/ instead of #create-sprite
- Use setAttribute('open', '') to properly expand the group

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix CSS selector to properly target .large class in nested details
- Auto-expand sidebar group when navigating to that page
- Click group heading navigates to page top (not anchor)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add data-current attribute to sidebar links matching current URL hash
- Show green accent border for current endpoint link
- Update on hashchange for smooth navigation
- Rename "Policy" to "Network Policy" and "HTTP Proxy" to "Proxy"

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Production URLs have trailing slashes (/api/dev-latest/sprites/)
but link hrefs don't (/api/dev-latest/sprites). Normalize both
paths by removing trailing slashes before comparison.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Previously all links on the same page were highlighted because
the condition `linkPath === currentPath` matched all of them.
Now only highlight when:
- Link has hash AND matches current URL exactly (path + hash)
- Link has no hash AND we're on page with no hash

Co-Authored-By: Claude Opus 4.5 <[email protected]>
On API pages, breadcrumbs return null because the sidebar links
have anchor hashes but the page path doesn't. Add margin-left: auto
to ensure the actions container stays on the right regardless.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Delete 13 unused React components (~730 lines)
- Create shared language-config.ts for labels/syntax mappings
- Update CodeTabs, CodeSnippets, and SnippetSelector to use shared config
- Remove dead _generateBinaryProtocolDocs function from build script

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add generateWebsocatExample() for WebSocket endpoints
- Route WSS endpoints through new generateHttpExample() dispatcher
- Rename 'cURL' label to 'HTTP' in language config

Co-Authored-By: Claude Opus 4.5 <[email protected]>
API docs are generated from schema, not editable source files,
so the GitHub link is disabled with explanatory text.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The anchor links are positioned to the left of headings, which
requires the method-page container to have padding/margin to
prevent clipping.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Align with Starlight's exact anchor HTML structure so the
custom anchor script in Head.astro can enhance all anchors
uniformly with link-icon-wrapper and check-icon-wrapper.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
The MethodHeader React component renders h2 headings with anchor links,
but these appear after React island hydration. The initCodeBlocks script
that sets up anchor link icons was running before hydration completed.

Added a MutationObserver to detect when new .sl-anchor-link elements are
added to the DOM and re-run the initialization to set up the dual-icon
structure (link icon + checkmark for copy feedback).

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@kylemclaren kylemclaren merged commit 63a05e7 into main Jan 14, 2026
3 of 5 checks passed
@kylemclaren kylemclaren deleted the feat/api-documentation branch January 14, 2026 08:23
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

Comments