Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion packages/sdk/generated/domain-map.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,38 @@
"index": 0
}
]
}
},
"errors": [
{
"name": "ValidationError",
"match": "VALIDATION_ERROR",
"schema": {
"type": "object",
"properties": {
"details": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": { "type": "string" },
"errorCode": { "type": "string" }
}
}
}
}
}
},
{
"name": "RateLimitError",
"match": "RATE_LIMITED",
"schema": {
"type": "object",
"properties": {
"retry_after_ms": { "type": "number" }
}
}
}
]
},
{
"tool": "edit_screens",
Expand Down
138 changes: 37 additions & 101 deletions packages/sdk/generated/src/designsystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,118 +2,54 @@
* AUTO-GENERATED by scripts/generate-sdk.ts
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:d831990b27e9...)
domain-map.json (sha256:715639788724...)
Generated: 2026-06-01T04:11:36.685Z
Source: tools-manifest.json (sha256:f20f91d571a1...)
domain-map.json (sha256:b40c073b3ab9...)
Generated: 2026-06-15T17:42:05.481Z
*/
import { type StitchToolClient } from "../../src/client.js";
import { StitchError } from "../../src/spec/errors.js";
import {
ComponentTokens,
DesignTheme,
File,
ProjectMetadata,
ScreenInstance,
Typography,
UserFeedback,
ProjectInput,
ScreenInput,
Asset,
BoundingBox,
ComponentRegion,
Design,
DesignSuggestion,
DesignSystemInput,
ProgressUpdate,
ProgressUpdates,
PrototypeLink,
PrototypeLinks,
PrototypeState,
PrototypeV2Spec,
Question,
QuestionsAsked,
ScreenMetadata,
SessionEvent,
SessionOutputComponent,
VariantOptions,
SelectedScreenInstance,
} from "./types.generated.js";
import {
UpdateDesignSystemResponse,
ApplyDesignSystemResponse,
} from "./responses.generated.js";
import { ComponentTokens, DesignTheme, File, ProjectMetadata, ScreenInstance, Typography, UserFeedback, ProjectInput, ScreenInput, Asset, BoundingBox, ComponentRegion, Design, DesignSuggestion, DesignSystemInput, ProgressUpdate, ProgressUpdates, PrototypeLink, PrototypeLinks, PrototypeState, PrototypeV2Spec, Question, QuestionsAsked, ScreenMetadata, SessionEvent, SessionOutputComponent, VariantOptions, SelectedScreenInstance } from "./types.generated.js";
import { UpdateDesignSystemResponse, ApplyDesignSystemResponse } from "./responses.generated.js";
import { Screen } from "./screen.js";

/** Represents a visual theme or branding applied to projects and screens. */
export class DesignSystem {
public readonly projectId!: string;
public readonly assetId!: string;
public data: any;
public readonly projectId!: string;
public readonly assetId!: string;
public data: any;

constructor(
private client: StitchToolClient,
data: any,
) {
this.data = typeof data === "object" ? data : undefined;
}
constructor(private client: StitchToolClient, data: any) {
this.data = typeof data === "object" ? data : undefined;
}

/** Convenience alias for assetId */
get id(): string {
return this.assetId;
}
/** Convenience alias for assetId */
get id(): string {
return this.assetId;
}

/**
* Updates a design system for a project. Use this tool when the user wants to change the overall visual theme, style, or branding of the application.
* Tool: update_design_system
*/
async update(designSystem: DesignSystemInput): Promise<DesignSystem> {
try {
const raw = await this.client.callTool<UpdateDesignSystemResponse>(
"update_design_system",
{
name: `assets/${this.assetId}`,
projectId: this.projectId,
designSystem,
},
);
return this.client.entities.resolve(
DesignSystem,
["projectId", "assetId"],
{ ...raw, projectId: this.projectId },
);
} catch (error) {
throw StitchError.fromUnknown(error);
/**
* Updates a design system for a project. Use this tool when the user wants to change the overall visual theme, style, or branding of the application.
* Tool: update_design_system
*/
async update(designSystem: DesignSystemInput): Promise<DesignSystem> {
try {
const raw = await this.client.callTool<UpdateDesignSystemResponse>("update_design_system", { name: `assets/${this.assetId}`, projectId: this.projectId, designSystem });
return this.client.entities.resolve(DesignSystem, ["projectId","assetId"], { ...raw, projectId: this.projectId });
} catch (error) {
throw StitchError.fromUnknown(error);
}
}
}

/**
* Applies a design system to a list of screens. Use this tool when the user wants to update one or more screens to match the style of a design system.
* Tool: apply_design_system
*/
async apply(
selectedScreenInstances: SelectedScreenInstance[],
): Promise<Screen[]> {
try {
const raw = await this.client.callTool<ApplyDesignSystemResponse>(
"apply_design_system",
{
assetId: this.assetId,
projectId: this.projectId,
selectedScreenInstances,
},
);
return (
(raw.outputComponents || []).flatMap(
(a: any) => a?.design?.screens || [],
) || []
).map((item) =>
this.client.entities.resolve(Screen, ["projectId", "screenId"], {
...item,
projectId: this.projectId,
}),
);
} catch (error) {
throw StitchError.fromUnknown(error);
/**
* Applies a design system to a list of screens. Use this tool when the user wants to update one or more screens to match the style of a design system.
* Tool: apply_design_system
*/
async apply(selectedScreenInstances: SelectedScreenInstance[]): Promise<Screen[]> {
try {
const raw = await this.client.callTool<ApplyDesignSystemResponse>("apply_design_system", { assetId: this.assetId, projectId: this.projectId, selectedScreenInstances });
return ((raw.outputComponents || []).flatMap((a: any) => a?.design?.screens || []) || []).map((item) => this.client.entities.resolve(Screen, ["projectId","screenId"], { ...item, projectId: this.projectId }));
} catch (error) {
throw StitchError.fromUnknown(error);
}
}
}
}
17 changes: 6 additions & 11 deletions packages/sdk/generated/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
* AUTO-GENERATED by scripts/generate-sdk.ts
DO NOT EDIT — changes will be overwritten.

Source: tools-manifest.json (sha256:d831990b27e9...)
domain-map.json (sha256:715639788724...)
Generated: 2026-06-01T04:11:36.685Z
Source: tools-manifest.json (sha256:f20f91d571a1...)
domain-map.json (sha256:b40c073b3ab9...)
Generated: 2026-06-15T17:42:05.481Z
*/
export { Stitch } from "./stitch.js";
export { Project } from "./project.js";
export { Screen } from "./screen.js";
export { DesignSystem } from "./designsystem.js";
export {
toolDefinitions,
type ToolDefinition,
type ToolInputSchema,
type ToolPropertySchema,
} from "./tool-definitions.js";
export type * from "./types.generated.js";
export type * from "./responses.generated.js";
export { toolDefinitions, type ToolDefinition, type ToolInputSchema, type ToolPropertySchema } from "./tool-definitions.js";
export * from "./types.generated.js";
export * from "./responses.generated.js";
Loading
Loading