Loading...
Loading...
Find bugs in the Stitch SDK using a real API key. Covers standard functional edges and tricky situations.
npx skill4agent add google-labs-code/stitch-sdk stitch-sdk-bug-bashStitchSTITCH_API_KEYStitchToolClientProjectstitch.project('invalid-id')project.listScreens()ScreenProject.generate()ScreenundefinedDesignSystemproject.designSystem('ds-id')projectIdds.apply(...)| Scenario | What to try | Expected Behavior |
|---|---|---|
| Stale Handles | Create a screen, delete the project, then try to edit the screen handle. | Clean API error indicating resource not found, wrapped in |
| Empty Prompts | Call | Safe rejection or clear API error, no crash in codegen. |
| Projections on null | Force an API call that returns a response without the expected projection field (if you can simulate or find such a tool fallback case). | The SDK should use optional chaining (e.g., |
| Massive arrays | Pass hundreds of screen IDs to | Check if it hits payload limits gracefully or fails with a clear message. |
try/catcherror.codeerror.nameStitchErrorTypeErrorimport { stitch } from "@google/stitch-sdk";
async function bash() {
const apiKey = process.env.STITCH_API_KEY;
if (!apiKey) throw new Error("STITCH_API_KEY is required");
console.log("🚀 Starting Bug Bash...");
let project;
try {
// 1. Create a fresh project
project = await stitch.createProject({
displayName: `Bug Bash ${new Date().toISOString()}`
});
console.log(`✓ Created Project: ${project.id}`);
// 2. Try to break generate with empty prompt
try {
await project.generate({ prompt: "" });
console.log("✗ BUG: Generate with empty prompt should have failed!");
} catch (e) {
console.log("✓ Generate with empty prompt failed safely as expected.");
}
// 3. Create a design system
const ds = await project.createDesignSystem({
name: "Bash Style",
variables: { primaryColor: "#ff0000" }
});
console.log(`✓ Created Design System: ${ds.id}`);
// 4. List screens (should be empty)
const screens = await project.listScreens();
console.log(`✓ Listed screens: found ${screens.length}`);
// 5. Apply design system to empty list
try {
await ds.apply({ selectedScreenIds: [] });
console.log("✓ Applied design system to empty list (handled).");
} catch (e) {
console.log("✗ Did applying to empty list fail? Inspect error.");
}
} catch (error) {
console.error("💥 Bash failed with error:", error);
} finally {
// 6. Cleanup
if (project) {
console.log(`🧹 Cleaning up project ${project.id}...`);
// Assuming we have a deleteProject binding or we just leave it if not available
// await project.delete();
}
}
}
bash();