feat(phase-5): WS5 — Developer Experience
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>
This commit is contained in:
@@ -57,7 +57,11 @@ export type AuditAction =
|
||||
| 'org.member_added'
|
||||
| 'webhook.created'
|
||||
| 'webhook.updated'
|
||||
| 'webhook.deleted';
|
||||
| 'webhook.deleted'
|
||||
| 'delegation.created'
|
||||
| 'delegation.verified'
|
||||
| 'delegation.revoked'
|
||||
| 'scaffold.generated';
|
||||
|
||||
/** Outcome of an audited action. */
|
||||
export type AuditOutcome = 'success' | 'failure';
|
||||
|
||||
28
src/types/scaffold.ts
Normal file
28
src/types/scaffold.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* TypeScript types for the scaffold generator (WS5 Developer Experience).
|
||||
*/
|
||||
|
||||
/** Supported target languages for scaffold generation. */
|
||||
export type ScaffoldLanguage = 'typescript' | 'python' | 'go' | 'java' | 'rust';
|
||||
|
||||
/** Options for generating a scaffold project. */
|
||||
export interface ScaffoldOptions {
|
||||
/** Agent UUID. */
|
||||
agentId: string;
|
||||
/** Human-readable agent name (used in filenames and README). */
|
||||
agentName: string;
|
||||
/** OAuth2 client ID pre-filled in .env.example. */
|
||||
clientId: string;
|
||||
/** Target programming language. */
|
||||
language: ScaffoldLanguage;
|
||||
/** API base URL injected into template files. */
|
||||
apiUrl: string;
|
||||
}
|
||||
|
||||
/** A single file within a scaffold template. */
|
||||
export interface ScaffoldTemplate {
|
||||
/** Path within the ZIP archive (relative to the project root directory). */
|
||||
archivePath: string;
|
||||
/** File content with template variables replaced. */
|
||||
content: string;
|
||||
}
|
||||
Reference in New Issue
Block a user