@kvasar/google-stitch 0.1.17 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-google-stitch",
3
3
  "name": "Google Stitch MCP",
4
- "version": "0.1.17",
4
+ "version": "0.1.19",
5
5
  "description": "Integrates Google Stitch MCP services into OpenClaw",
6
6
  "skills": ["skills"],
7
7
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvasar/google-stitch",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "OpenClaw plugin for Google Stitch UI generation, screen design, variants, and design systems",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/skills/SKILL.md CHANGED
@@ -164,8 +164,8 @@ Example prompts:
164
164
  - List the generated UI screens for project 12345
165
165
 
166
166
  Returns:
167
- - Array of `Screen` objects
168
- - Includes fields such as `name`, `title`, `prompt`, `deviceType`, `width`, `height`, and grouping metadata
167
+ - A visual list of generated screens in the project
168
+ - Each screen is rendered with title, prompt, device type, dimensions, and preview image/HTML when available
169
169
 
170
170
  ---
171
171
 
@@ -1,9 +1,36 @@
1
1
  import { StitchMCPClient } from "../services/stitch-mcp-client.js";
2
+ import fs from "node:fs";
3
+ import os from "node:os";
4
+ import path from "node:path";
2
5
 
3
6
  interface ListScreensParams {
4
7
  projectId: string;
5
8
  }
6
9
 
10
+ type StitchFile = {
11
+ name?: string;
12
+ downloadUrl?: string;
13
+ mimeType?: string;
14
+ fileContentBase64?: string;
15
+ };
16
+
17
+ type Screen = {
18
+ name?: string;
19
+ id?: string;
20
+ title?: string;
21
+ prompt?: string;
22
+ screenshot?: StitchFile;
23
+ htmlCode?: StitchFile;
24
+ figmaExport?: StitchFile;
25
+ deviceType?: string;
26
+ width?: string;
27
+ height?: string;
28
+ groupId?: string;
29
+ groupName?: string;
30
+ generatedBy?: string;
31
+ isCreatedByClient?: boolean;
32
+ };
33
+
7
34
  export const listScreensTool = (client: StitchMCPClient) => ({
8
35
  name: "list_screens",
9
36
  description: "Lists all screens within a given Stitch project",
@@ -13,8 +40,95 @@ export const listScreensTool = (client: StitchMCPClient) => ({
13
40
  throw new Error("projectId is required");
14
41
  }
15
42
 
16
- return client.request("list_screens", {
17
- projectId: params.projectId,
18
- });
19
- },
43
+ const screens = (await client.request("list_screens", {
44
+ projectId: params.projectId
45
+ })) as unknown as Screen[];
46
+
47
+ const content: Array<{ type: string; [key: string]: any }> = [];
48
+
49
+ if (!screens?.length) {
50
+ return {
51
+ content: [
52
+ {
53
+ type: "text",
54
+ text: "No screens found in this project."
55
+ }
56
+ ]
57
+ };
58
+ }
59
+
60
+ for (const screen of screens) {
61
+ content.push({
62
+ type: "text",
63
+ text: `## ${screen.title || "Untitled screen"}
64
+ Prompt: ${screen.prompt || "-"}
65
+ Device: ${screen.deviceType || "-"}
66
+ Size: ${screen.width || "?"} × ${screen.height || "?"}`
67
+ });
68
+
69
+ // Prefer embedded image
70
+ if (screen.screenshot?.fileContentBase64) {
71
+ const tempFilePath = path.join(
72
+ os.tmpdir(),
73
+ `stitch-screen-${Date.now()}-${Math.random()
74
+ .toString(36)
75
+ .slice(2)}.png`
76
+ );
77
+
78
+ fs.writeFileSync(
79
+ tempFilePath,
80
+ Buffer.from(
81
+ screen.screenshot.fileContentBase64,
82
+ "base64"
83
+ )
84
+ );
85
+
86
+ content.push({
87
+ type: "image",
88
+ path: tempFilePath,
89
+ caption: screen.title || "Generated screen"
90
+ });
91
+
92
+ continue;
93
+ }
94
+
95
+ // Fallback URL
96
+ if (screen.screenshot?.downloadUrl) {
97
+ content.push({
98
+ type: "image",
99
+ url: screen.screenshot.downloadUrl,
100
+ caption: screen.title || "Generated screen"
101
+ });
102
+
103
+ continue;
104
+ }
105
+
106
+ // HTML fallback
107
+ if (screen.htmlCode?.fileContentBase64) {
108
+ const html = Buffer.from(
109
+ screen.htmlCode.fileContentBase64,
110
+ "base64"
111
+ ).toString("utf-8");
112
+
113
+ content.push({
114
+ type: "html",
115
+ html
116
+ });
117
+
118
+ continue;
119
+ }
120
+
121
+ if (screen.htmlCode?.downloadUrl) {
122
+ content.push({
123
+ type: "html",
124
+ html: `<iframe
125
+ src="${screen.htmlCode.downloadUrl}"
126
+ style="width:100%;height:600px;border:none;"
127
+ ></iframe>`
128
+ });
129
+ }
130
+ }
131
+
132
+ return { content };
133
+ }
20
134
  });
@@ -1,7 +0,0 @@
1
- export const getScreenTool = (client:any) => ({
2
- name: "get_screen",
3
- description: "get screen",
4
- async execute(_: string, params: any) {
5
- return await client.request?.("get_screen", params);
6
- },
7
- });