Implements scaffold ZIP generator, Stoplight Elements API explorer, and CLI scaffold command: Scaffold API: - 25 template files for TypeScript/Python/Go/Java/Rust in src/templates/scaffold/ - ScaffoldService: in-memory ZIP via archiver, variable injection (AGENT_ID/NAME/CLIENT_ID/API_URL) - ScaffoldController: tenant ownership check (403), language validation (400), ZIP stream response - Route GET /sdk/scaffold/:agentId with rate limiter (10 req/min per tenant) - Prometheus: scaffold_generated_total + scaffold_generation_duration_ms histogram Portal: - Replaced swagger-ui-react with @stoplight/elements API component - Dynamic import (ssr: false) for browser-only DOM dependency - Type declarations for @stoplight/elements and CSS module CLI: - sentryagent scaffold --agent-id <id> [--language typescript] [--out .] - Raw fetch for binary ZIP stream → unzipper.Extract() → prints next steps - Human-readable 400/403/404 error messages Tests: 19 tests (unit + integration), ScaffoldService 80%+ branch coverage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
713 B
TypeScript
29 lines
713 B
TypeScript
'use client';
|
|
|
|
import dynamic from 'next/dynamic';
|
|
|
|
// @stoplight/elements accesses `document` at module load time,
|
|
// so it must be imported client-side only (ssr: false).
|
|
const ElementsAPI = dynamic(
|
|
async () => {
|
|
await import('@stoplight/elements/styles.min.css');
|
|
const mod = await import('@stoplight/elements');
|
|
return mod.API;
|
|
},
|
|
{ ssr: false },
|
|
);
|
|
|
|
export default function ApiExplorerPage() {
|
|
return (
|
|
<main className="h-screen w-full">
|
|
<ElementsAPI
|
|
apiDescriptionUrl={`${process.env.NEXT_PUBLIC_API_URL}/openapi.json`}
|
|
router="hash"
|
|
layout="sidebar"
|
|
hideSchemas={false}
|
|
tryItCredentialsPolicy="same-origin"
|
|
/>
|
|
</main>
|
|
);
|
|
}
|