rdev/sdk/README.md
jordan 002c32aedb feat: add album generation system to skeleton
Adds anchor-based image album generation across docs, skeleton, and rendered
full-monorepo. One subject description + one anchor image + N directed shots,
covering personas, products, characters, and brand assets out of the box.

## What ships

**Skeleton packages:**
- pkg/album/types.go — Album, Shot, ShotStatus, ShotTemplate, AlbumUpdater
- pkg/album/templates.go — PortraitSession, ProductShoot, CharacterSheet built-ins
- pkg/album/handler.go — AnchorHandler + ShotHandler queue job handlers
- packages/realtime/src/useAlbumGeneration.ts — SSE hook owning all album state
- packages/ui/src/components/AlbumGrid.tsx — responsive shot grid with shimmer
- packages/ui/src/components/ShotCard.tsx — pending/generating/complete/failed states
- packages/ui/src/components/AnchorPreview.tsx — anchor CTA + image with controls

**Component service template:**
- internal/port/album.go — AlbumRepository interface
- internal/adapter/memory/album.go — in-memory repo for standalone dev
- internal/service/album.go — create, list, get, generateAnchor, generateAllShots
- internal/api/handlers/album.go — HTTP handlers (CRUD + 202 generation endpoints)
- Routes: GET/POST /albums, GET/DELETE /albums/{id}, POST /albums/{id}/anchor,
  POST/DELETE /albums/{id}/shots, POST /albums/{id}/shots/{index}

**Documentation:**
- .claude/guides/album.md — full guide with API, SSE events, frontend usage

**Key architecture decisions:**
- Anchor bytes never stored in queue payload — workers fetch AnchorURL at runtime
- Generation order enforced: POST /shots returns 422 if no anchor exists
- All album SSE events on existing user:<userId> channel (no new channel)
- AlbumUpdater interface lets job handlers update repo from inside queue workers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 23:57:21 -07:00

83 lines
2.0 KiB
Markdown

# @orchard9/rdev-sdk
TypeScript SDK for the [rdev Remote Developer API](https://rdev.masq-ops.orchard9.ai/docs) — run Claude Code instances in isolated Kubernetes pods via REST.
## Prerequisites
- Go 1.25+ (to export the spec)
- [Speakeasy CLI](https://www.speakeasy.com/docs/speakeasy-cli/getting-started)
- Node.js 20+
## Regenerating the SDK
The SDK is generated from the live OpenAPI spec embedded in the rdev binary. No server required.
```bash
./scripts/generate-sdk.sh
```
This will:
1. Export the OpenAPI spec from the Go binary (pure, no DB/K8s needed)
2. Validate the spec with Speakeasy
3. Generate the TypeScript SDK into `sdk/typescript/`
4. Build and type-check the SDK
The generated `sdk/openapi.json` is gitignored (regenerated each time). The `sdk/typescript/` output is committed.
## Installation
Until published to npm, install directly from git:
```bash
npm install github:orchard9/rdev#main --workspace sdk/typescript
```
Or copy `sdk/typescript/` into your project.
## Usage
```typescript
import { Rdev } from "@orchard9/rdev-sdk";
const client = new Rdev({
apiKey: process.env.RDEV_API_KEY,
serverURL: "https://rdev.masq-ops.orchard9.ai",
});
// List projects
const projects = await client.projects.list();
console.log(projects);
// Run a Claude command
const cmd = await client.projects.runClaude("my-project", {
prompt: "fix the bug in auth handler",
});
console.log(cmd.streamUrl);
// Stream events
const events = new EventSource(
`https://rdev.masq-ops.orchard9.ai${cmd.streamUrl}`,
{ headers: { "X-API-Key": process.env.RDEV_API_KEY } }
);
events.addEventListener("complete", (e) => {
console.log("Done:", JSON.parse(e.data));
events.close();
});
```
## Authentication
All endpoints (except `/health`, `/ready`, `/docs`) require an API key.
```typescript
const client = new Rdev({
apiKey: "rdev_sk_xxxxxxxx_...",
});
```
Or set `RDEV_API_KEY` environment variable.
## API Reference
See the [API docs](https://rdev.masq-ops.orchard9.ai/docs) for full endpoint documentation.