Loading...
Loading...
Design the domain model for the Stitch SDK. Use when mapping MCP tools to domain classes and bindings in domain-map.json. This is Stage 2 of the generation pipeline.
npx skill4agent add google-labs-code/stitch-sdk stitch-sdk-domain-designdomain-map.jsontools-manifest.jsonoutputSchemair-schema.tsdomain-map.jsonstitch-sdk-developmentdomain-map.jsonclassesbindingsir-schema.ts[!IMPORTANT] Your output is validated twice by the codegen: structurally (Zod IR schema) and semantically (projection steps verified againstfrom the tools-manifest).outputSchema
{
"Stitch": {
"description": "Main entry point. Manages projects.",
"constructorParams": [],
"isRoot": true,
"factories": [
{ "method": "project", "returns": "Project", "description": "Create a Project handle from an ID." }
]
}
}| Field | Purpose | Example |
|---|---|---|
| Fields stored on the instance | |
| Per-field data source mapping with optional | See below |
| Which param is injected from a parent class | |
| Which param the | |
| Local factory methods (no API call) | |
fieldMapping{
"constructorParams": ["projectId", "screenId"],
"fieldMapping": {
"projectId": { "from": "name", "stripPrefix": "projects/" },
"screenId": { "from": "id", "fallback": { "field": "name", "splitOn": "/screens/" } }
}
}stripPrefixfallback| Type | Meaning | Code generated |
|---|---|---|
| From | |
| From method parameter | |
| Template interpolation | |
| Wrap self field as array | |
"optional": true"rename": "newName"returns.projectionProjectionStep{ prop: string; index?: number; each?: boolean; fallback?: string }| Projection | Generated code | Use when |
|---|---|---|
| | Direct return (whole response) |
| | Array inside object |
| | Deeply nested single item |
| | Collect all items across arrays |
| | Navigate nested properties |
"index": 0"each": true[!TIP] Everyin a projection is validated against the tool'spropat codegen time. If you typo a property name, codegen will fail with a diagnostic listing the available properties.outputSchema
returns.class{ "returns": { "class": "Screen", "projection": [{ "prop": "screens" }], "array": true } }parentFieldcacheprojectionthis.data{
"cache": {
"projection": [{ "prop": "htmlCode" }, { "prop": "downloadUrl" }],
"description": "Use cached HTML download URL from generation response if available"
}
}FiledownloadUrlif (this.data?.htmlCode?.downloadUrl) return this.data?.htmlCode?.downloadUrl;
// ... else call APIprojectIdselfProjectScreenStitchgenerate_screen_from_textgenerateedit_screenseditselfparamoutputSchematools-manifest.jsonprojectiondomain-map.jsonbun scripts/generate-sdk.ts # Validates IR + projections, then generates
npx tsc --noEmit # Type check
npx vitest run # Unit tests
bun scripts/e2e-test.ts # E2E tests
bun scripts/validate-generated.ts # Lock integrity❌ Binding "Project.generate" projection step 2:
property "screenz" not found in outputSchema.
Available properties: screens, components, metadata