@_davideast/stitch-mcp 0.7.0 → 0.8.0
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.
- package/dist/chunk-2awe04td.js +506 -0
- package/dist/chunk-2awe04td.js.map +21 -0
- package/dist/chunk-633ma50k.js +371 -0
- package/dist/chunk-633ma50k.js.map +16 -0
- package/dist/chunk-7z5z40ar.js +165 -0
- package/dist/chunk-7z5z40ar.js.map +10 -0
- package/dist/chunk-9ckyz47q.js +518 -0
- package/dist/chunk-9ckyz47q.js.map +12 -0
- package/dist/chunk-b9atzag0.js +67 -0
- package/dist/chunk-b9atzag0.js.map +10 -0
- package/dist/chunk-c5dtqvff.js +11 -0
- package/dist/chunk-c5dtqvff.js.map +9 -0
- package/dist/chunk-ef355a3f.js +20 -0
- package/dist/chunk-ef355a3f.js.map +9 -0
- package/dist/chunk-hgv5frj1.js +256 -0
- package/dist/chunk-hgv5frj1.js.map +11 -0
- package/dist/chunk-jn5pcnz9.js +270 -0
- package/dist/chunk-jn5pcnz9.js.map +10 -0
- package/dist/chunk-mzyqavzd.js +736 -0
- package/dist/chunk-mzyqavzd.js.map +16 -0
- package/dist/chunk-nh14pn95.js +137 -0
- package/dist/chunk-nh14pn95.js.map +10 -0
- package/dist/commands/screens/command.js +1 -1
- package/dist/commands/serve/command.js +2 -2
- package/dist/commands/site/command.js +1 -1
- package/dist/commands/snapshot/command.js +1 -1
- package/dist/commands/tool/command.js +1 -1
- package/dist/commands/view/command.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/commands/serve/json-server/handler.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Stitch } from '@google/stitch-sdk';\nimport pLimit from 'p-limit';\nimport { StitchViteServer } from '../../../lib/server/vite/StitchViteServer.js';\nimport { downloadText } from '../../../ui/copy-behaviors/clipboard.js';\nimport type { JsonServerSpec, JsonServerInput, JsonServerResult } from './spec.js';\n\nexport class JsonServerHandler implements JsonServerSpec {\n constructor(\n private readonly client: Stitch,\n private readonly downloadHtml: (url: string) => Promise<string> = downloadText,\n ) {}\n\n async execute(input: JsonServerInput): Promise<JsonServerResult> {\n let sdkScreens: any[];\n\n try {\n const project = this.client.project(input.projectId);\n sdkScreens = await project.screens();\n } catch (e: any) {\n return {\n success: false,\n error: { code: 'SCREENS_FETCH_FAILED', message: e.message, recoverable: false },\n };\n }\n\n const server = new StitchViteServer();\n let baseUrl: string;\n\n try {\n baseUrl = await server.start(0);\n } catch (e: any) {\n return {\n success: false,\n error: { code: 'SERVER_START_FAILED', message: e.message, recoverable: false },\n };\n }\n\n // Mount screens concurrently\n const limit = pLimit(3);\n const screens: Array<{ screenId: string; title: string; url: string }> = [];\n\n await Promise.all(\n sdkScreens.map((s: any) => limit(async () => {\n try {\n const codeUrl = await s.getHtml();\n if (codeUrl) {\n const html = await this.downloadHtml(codeUrl);\n server.mount(`/screens/${s.screenId}`, html);\n }\n screens.push({\n screenId: s.screenId,\n title: s.title ?? s.screenId,\n url: `${baseUrl}/screens/${s.screenId}`,\n });\n } catch {\n // Skip screens that fail to load\n }\n }))\n );\n\n screens.sort((a, b) => a.title.localeCompare(b.title));\n\n return { success: true, url: baseUrl, screens };\n }\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;AAMO,MAAM,kBAA4C;AAAA,EAEpC;AAAA,EACA;AAAA,EAFnB,WAAW,CACQ,QACA,eAAiD,cAClE;AAAA,IAFiB;AAAA,IACA;AAAA;AAAA,OAGb,QAAO,CAAC,OAAmD;AAAA,IAC/D,IAAI;AAAA,IAEJ,IAAI;AAAA,MACF,MAAM,UAAU,KAAK,OAAO,QAAQ,MAAM,SAAS;AAAA,MACnD,aAAa,MAAM,QAAQ,QAAQ;AAAA,MACnC,OAAO,GAAQ;AAAA,MACf,OAAO;AAAA,QACL,SAAS;AAAA,QACT,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js";
|
|
6
|
+
import"./chunk-mp1sf8x6.js";
|
|
7
|
+
import"./chunk-9ckyz47q.js";
|
|
8
|
+
import"./chunk-sqhdg0mf.js";
|
|
9
|
+
import"./chunk-5jbenaez.js";
|
|
10
|
+
import"./chunk-vcp9fp2w.js";
|
|
11
|
+
import"./chunk-543135qd.js";
|
|
12
|
+
import"./chunk-nq68kghz.js";
|
|
13
|
+
import"./chunk-hst78da7.js";
|
|
14
|
+
import"./chunk-3sfn889r.js";
|
|
15
|
+
import"./chunk-9wyra8hs.js";
|
|
16
|
+
export {
|
|
17
|
+
SiteBuilder
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//# debugId=CDBCAFF7B7D033B964756E2164756E21
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import {
|
|
2
|
+
require_lib
|
|
3
|
+
} from "./chunk-sqhdg0mf.js";
|
|
4
|
+
import {
|
|
5
|
+
theme
|
|
6
|
+
} from "./chunk-kbtqrkwh.js";
|
|
7
|
+
import"./chunk-3sfn889r.js";
|
|
8
|
+
import {
|
|
9
|
+
__require,
|
|
10
|
+
__toESM
|
|
11
|
+
} from "./chunk-9wyra8hs.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/snapshot/handler.ts
|
|
14
|
+
var import_fs_extra = __toESM(require_lib(), 1);
|
|
15
|
+
|
|
16
|
+
// src/framework/MockUI.ts
|
|
17
|
+
class MockUI {
|
|
18
|
+
data;
|
|
19
|
+
constructor(data) {
|
|
20
|
+
this.data = data;
|
|
21
|
+
}
|
|
22
|
+
async promptMcpClient() {
|
|
23
|
+
if (!this.data.mcpClient) {
|
|
24
|
+
throw new Error("MockUI: Missing data for mcpClient");
|
|
25
|
+
}
|
|
26
|
+
return this.data.mcpClient;
|
|
27
|
+
}
|
|
28
|
+
async promptAuthMode() {
|
|
29
|
+
if (!this.data.authMode) {
|
|
30
|
+
throw new Error("MockUI: Missing data for authMode");
|
|
31
|
+
}
|
|
32
|
+
return this.data.authMode;
|
|
33
|
+
}
|
|
34
|
+
async promptTransportType(authMode) {
|
|
35
|
+
if (this.data.transportType) {
|
|
36
|
+
return this.data.transportType;
|
|
37
|
+
}
|
|
38
|
+
throw new Error("MockUI: Missing data for transportType");
|
|
39
|
+
}
|
|
40
|
+
async promptApiKeyStorage() {
|
|
41
|
+
if (!this.data.apiKeyStorage) {
|
|
42
|
+
throw new Error("MockUI: Missing data for apiKeyStorage");
|
|
43
|
+
}
|
|
44
|
+
return this.data.apiKeyStorage;
|
|
45
|
+
}
|
|
46
|
+
async promptApiKey() {
|
|
47
|
+
if (!this.data.apiKey) {
|
|
48
|
+
throw new Error("MockUI: Missing data for apiKey");
|
|
49
|
+
}
|
|
50
|
+
return this.data.apiKey;
|
|
51
|
+
}
|
|
52
|
+
async promptConfirm(message, defaultYes) {
|
|
53
|
+
if (typeof this.data.confirm === "boolean") {
|
|
54
|
+
return this.data.confirm;
|
|
55
|
+
}
|
|
56
|
+
return defaultYes ?? false;
|
|
57
|
+
}
|
|
58
|
+
log(message) {
|
|
59
|
+
console.log(message);
|
|
60
|
+
}
|
|
61
|
+
warn(message) {
|
|
62
|
+
console.log(`WARN: ${message}`);
|
|
63
|
+
}
|
|
64
|
+
error(message) {
|
|
65
|
+
console.error(`ERROR: ${message}`);
|
|
66
|
+
}
|
|
67
|
+
success(message) {
|
|
68
|
+
console.log(`SUCCESS: ${message}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/commands/snapshot/handler.ts
|
|
73
|
+
var SCHEMAS = {
|
|
74
|
+
init: {
|
|
75
|
+
description: "Data schema for 'init' command",
|
|
76
|
+
type: "object",
|
|
77
|
+
properties: {
|
|
78
|
+
mcpClient: { type: "string", enum: ["vscode", "cursor", "claude-code", "gemini-cli", "codex", "opencode"] },
|
|
79
|
+
authMode: { type: "string", enum: ["apiKey", "oauth"] },
|
|
80
|
+
transportType: { type: "string", enum: ["http", "stdio"] },
|
|
81
|
+
apiKeyStorage: { type: "string", enum: ["config", "skip", ".env"] },
|
|
82
|
+
apiKey: { type: "string" },
|
|
83
|
+
confirm: { type: "boolean" },
|
|
84
|
+
inputArgs: {
|
|
85
|
+
type: "object",
|
|
86
|
+
description: "Arguments to pass to the command execution",
|
|
87
|
+
properties: {
|
|
88
|
+
local: { type: "boolean" },
|
|
89
|
+
defaults: { type: "boolean" },
|
|
90
|
+
autoVerify: { type: "boolean" },
|
|
91
|
+
client: { type: "string" },
|
|
92
|
+
transport: { type: "string" }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
required: ["mcpClient", "authMode"]
|
|
97
|
+
},
|
|
98
|
+
doctor: {
|
|
99
|
+
description: "Data schema for 'doctor' command",
|
|
100
|
+
type: "object",
|
|
101
|
+
properties: {
|
|
102
|
+
confirm: { type: "boolean" },
|
|
103
|
+
inputArgs: {
|
|
104
|
+
type: "object",
|
|
105
|
+
description: "Arguments to pass to the command execution",
|
|
106
|
+
properties: {
|
|
107
|
+
verbose: { type: "boolean" }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
site: {
|
|
113
|
+
description: "Data schema for 'site' command",
|
|
114
|
+
type: "object",
|
|
115
|
+
properties: {
|
|
116
|
+
screens: {
|
|
117
|
+
type: "array",
|
|
118
|
+
items: {
|
|
119
|
+
type: "object",
|
|
120
|
+
properties: {
|
|
121
|
+
id: { type: "string" },
|
|
122
|
+
title: { type: "string" },
|
|
123
|
+
description: { type: "string" },
|
|
124
|
+
type: { type: "string" },
|
|
125
|
+
content: { type: "string" }
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
inputArgs: {
|
|
130
|
+
type: "object",
|
|
131
|
+
properties: {
|
|
132
|
+
projectId: { type: "string" },
|
|
133
|
+
outputDir: { type: "string" }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
class SnapshotHandler {
|
|
141
|
+
services;
|
|
142
|
+
constructor(services) {
|
|
143
|
+
this.services = services;
|
|
144
|
+
}
|
|
145
|
+
async execute(input) {
|
|
146
|
+
if (input.schema) {
|
|
147
|
+
if (input.command) {
|
|
148
|
+
const schema = SCHEMAS[input.command];
|
|
149
|
+
if (!schema) {
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
error: { message: `No schema found for command '${input.command}'` }
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
console.log(JSON.stringify(schema, null, 2));
|
|
156
|
+
} else {
|
|
157
|
+
console.log(JSON.stringify(Object.keys(SCHEMAS), null, 2));
|
|
158
|
+
}
|
|
159
|
+
return { success: true };
|
|
160
|
+
}
|
|
161
|
+
if (!input.command) {
|
|
162
|
+
return { success: false, error: { message: "Command (-c) is required unless using -s" } };
|
|
163
|
+
}
|
|
164
|
+
if (!input.data) {
|
|
165
|
+
return { success: false, error: { message: "Data file (-d) is required unless using -s" } };
|
|
166
|
+
}
|
|
167
|
+
let data;
|
|
168
|
+
try {
|
|
169
|
+
if (await import_fs_extra.default.pathExists(input.data)) {
|
|
170
|
+
data = await import_fs_extra.default.readJson(input.data);
|
|
171
|
+
} else {
|
|
172
|
+
try {
|
|
173
|
+
data = JSON.parse(input.data);
|
|
174
|
+
} catch {
|
|
175
|
+
return { success: false, error: { message: `Data file not found at '${input.data}' and content is not valid JSON` } };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
} catch (e) {
|
|
179
|
+
return { success: false, error: { message: `Failed to read data: ${e instanceof Error ? e.message : String(e)}` } };
|
|
180
|
+
}
|
|
181
|
+
const mockUI = new MockUI(data);
|
|
182
|
+
try {
|
|
183
|
+
switch (input.command) {
|
|
184
|
+
case "init": {
|
|
185
|
+
const { InitHandler } = await import("./chunk-8hgrrc49.js");
|
|
186
|
+
const handler = new InitHandler(this.services?.gcloud, this.services?.mcpConfig, this.services?.project, this.services?.stitch, mockUI);
|
|
187
|
+
const initInput = {
|
|
188
|
+
local: false,
|
|
189
|
+
defaults: false,
|
|
190
|
+
autoVerify: true,
|
|
191
|
+
...data.inputArgs
|
|
192
|
+
};
|
|
193
|
+
const result = await handler.execute(initInput);
|
|
194
|
+
if (!result.success) {
|
|
195
|
+
console.error("Init failed:", result.error);
|
|
196
|
+
}
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case "doctor": {
|
|
200
|
+
const { DoctorHandler } = await import("./chunk-1v5q6d3n.js");
|
|
201
|
+
const handler = new DoctorHandler(this.services?.gcloud, this.services?.stitch, mockUI);
|
|
202
|
+
const doctorInput = {
|
|
203
|
+
verbose: false,
|
|
204
|
+
...data.inputArgs
|
|
205
|
+
};
|
|
206
|
+
const result = await handler.execute(doctorInput);
|
|
207
|
+
if (!result.success) {
|
|
208
|
+
console.error("Doctor failed:", result.error);
|
|
209
|
+
}
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
case "site": {
|
|
213
|
+
const { SiteBuilder } = await import("./chunk-ef355a3f.js");
|
|
214
|
+
const { createMockStitch, createMockProject, createMockScreen } = await import("./chunk-98trrxk2.js");
|
|
215
|
+
const mockScreens = (data.screens || []).map((s) => createMockScreen({
|
|
216
|
+
screenId: s.name,
|
|
217
|
+
title: s.title,
|
|
218
|
+
getHtml: () => Promise.resolve(s.htmlCode?.downloadUrl || null)
|
|
219
|
+
}));
|
|
220
|
+
const mockClient = createMockStitch(createMockProject(data.inputArgs?.projectId || "mock-project", mockScreens));
|
|
221
|
+
try {
|
|
222
|
+
const { render } = await import("./chunk-1wcg0pjg.js");
|
|
223
|
+
const React = await import("./chunk-k86st2r8.js");
|
|
224
|
+
const projectId = data.inputArgs?.projectId || "mock-project";
|
|
225
|
+
const { lastFrame, unmount } = render(React.createElement(SiteBuilder, {
|
|
226
|
+
projectId,
|
|
227
|
+
client: mockClient,
|
|
228
|
+
onExit: () => {}
|
|
229
|
+
}));
|
|
230
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
231
|
+
console.log(lastFrame());
|
|
232
|
+
unmount();
|
|
233
|
+
} catch (e) {
|
|
234
|
+
if (e.code === "ERR_MODULE_NOT_FOUND") {
|
|
235
|
+
console.warn(theme.yellow("ink-testing-library not found. Install dev dependencies to snapshot site command."));
|
|
236
|
+
} else {
|
|
237
|
+
throw e;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
default:
|
|
243
|
+
return { success: false, error: { message: `Unsupported command '${input.command}'` } };
|
|
244
|
+
}
|
|
245
|
+
} catch (error) {
|
|
246
|
+
console.error(theme.red("Command execution failed:"), error);
|
|
247
|
+
return { success: true };
|
|
248
|
+
}
|
|
249
|
+
return { success: true };
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
export {
|
|
253
|
+
SnapshotHandler
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
//# debugId=F78CBF4C733E0A4464756E2164756E21
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/commands/snapshot/handler.ts", "../src/framework/MockUI.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import fs from 'fs-extra';\nimport { type SnapshotCommand, type SnapshotInput, type SnapshotResult } from './spec.js';\nimport { MockUI } from '../../framework/MockUI.js';\nimport { theme } from '../../ui/theme.js';\nimport { type GcloudService } from '../../services/gcloud/spec.js';\nimport { type StitchService } from '../../services/stitch/spec.js';\nimport { type McpConfigService } from '../../services/mcp-config/spec.js';\nimport { type ProjectService } from '../../services/project/spec.js';\n\ninterface SnapshotServices {\n gcloud?: GcloudService;\n stitch?: StitchService;\n mcpConfig?: McpConfigService;\n project?: ProjectService;\n}\n\n// Schemas for the commands to be printed with -s\nconst SCHEMAS: Record<string, any> = {\n init: {\n description: \"Data schema for 'init' command\",\n type: \"object\",\n properties: {\n mcpClient: { type: \"string\", enum: [\"vscode\", \"cursor\", \"claude-code\", \"gemini-cli\", \"codex\", \"opencode\"] },\n authMode: { type: \"string\", enum: [\"apiKey\", \"oauth\"] },\n transportType: { type: \"string\", enum: [\"http\", \"stdio\"] },\n apiKeyStorage: { type: \"string\", enum: [\"config\", \"skip\", \".env\"] },\n apiKey: { type: \"string\" },\n confirm: { type: \"boolean\" },\n inputArgs: {\n type: \"object\",\n description: \"Arguments to pass to the command execution\",\n properties: {\n local: { type: \"boolean\" },\n defaults: { type: \"boolean\" },\n autoVerify: { type: \"boolean\" },\n client: { type: \"string\" },\n transport: { type: \"string\" }\n }\n }\n },\n required: [\"mcpClient\", \"authMode\"]\n },\n doctor: {\n description: \"Data schema for 'doctor' command\",\n type: \"object\",\n properties: {\n confirm: { type: \"boolean\" },\n inputArgs: {\n type: \"object\",\n description: \"Arguments to pass to the command execution\",\n properties: {\n verbose: { type: \"boolean\" }\n }\n }\n }\n },\n site: {\n description: \"Data schema for 'site' command\",\n type: \"object\",\n properties: {\n screens: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n id: { type: \"string\" },\n title: { type: \"string\" },\n description: { type: \"string\" },\n type: { type: \"string\" },\n content: { type: \"string\" }\n }\n }\n },\n inputArgs: {\n type: \"object\",\n properties: {\n projectId: { type: \"string\" },\n outputDir: { type: \"string\" }\n }\n }\n }\n }\n};\n\nexport class SnapshotHandler implements SnapshotCommand {\n constructor(private readonly services?: SnapshotServices) {}\n\n async execute(input: SnapshotInput): Promise<SnapshotResult> {\n if (input.schema) {\n if (input.command) {\n const schema = SCHEMAS[input.command];\n if (!schema) {\n return {\n success: false,\n error: { message: `No schema found for command '${input.command}'` }\n };\n }\n console.log(JSON.stringify(schema, null, 2));\n } else {\n console.log(JSON.stringify(Object.keys(SCHEMAS), null, 2));\n }\n return { success: true };\n }\n\n if (!input.command) {\n return { success: false, error: { message: \"Command (-c) is required unless using -s\" } };\n }\n if (!input.data) {\n return { success: false, error: { message: \"Data file (-d) is required unless using -s\" } };\n }\n\n // Load data\n let data: any;\n try {\n if (await fs.pathExists(input.data)) {\n data = await fs.readJson(input.data);\n } else {\n // Try parsing as JSON string\n try {\n data = JSON.parse(input.data);\n } catch {\n return { success: false, error: { message: `Data file not found at '${input.data}' and content is not valid JSON` } };\n }\n }\n } catch (e) {\n return { success: false, error: { message: `Failed to read data: ${e instanceof Error ? e.message : String(e)}` } };\n }\n\n const mockUI = new MockUI(data);\n\n try {\n switch (input.command) {\n case 'init': {\n const { InitHandler } = await import('../init/handler.js');\n const handler = new InitHandler(\n this.services?.gcloud,\n this.services?.mcpConfig,\n this.services?.project,\n this.services?.stitch,\n mockUI\n );\n const initInput = {\n local: false,\n defaults: false,\n autoVerify: true,\n ...data.inputArgs\n };\n const result = await handler.execute(initInput);\n if (!result.success) {\n console.error('Init failed:', result.error);\n }\n break;\n }\n case 'doctor': {\n const { DoctorHandler } = await import('../doctor/handler.js');\n const handler = new DoctorHandler(\n this.services?.gcloud,\n this.services?.stitch,\n mockUI\n );\n const doctorInput = {\n verbose: false,\n ...data.inputArgs\n };\n const result = await handler.execute(doctorInput);\n if (!result.success) {\n console.error('Doctor failed:', result.error);\n }\n break;\n }\n case 'site': {\n const { SiteBuilder } = await import('../site/ui/SiteBuilder.js');\n const { createMockStitch, createMockProject, createMockScreen } = await import('../../services/stitch-sdk/MockStitchSDK.js');\n\n const mockScreens = (data.screens || []).map((s: any) => createMockScreen({\n screenId: s.name,\n title: s.title,\n getHtml: (() => Promise.resolve(s.htmlCode?.downloadUrl || null)) as any,\n }));\n const mockClient = createMockStitch(createMockProject(data.inputArgs?.projectId || 'mock-project', mockScreens));\n\n // Use ink-testing-library to render and snapshot the UI\n try {\n // We use require to avoid type checking issues if it's not installed in prod build env,\n // although this command is a dev tool.\n const { render } = await import('ink-testing-library');\n const React = await import('react');\n\n const projectId = data.inputArgs?.projectId || 'mock-project';\n\n const { lastFrame, unmount } = render(\n React.createElement(SiteBuilder, {\n projectId,\n client: mockClient,\n onExit: () => {}\n })\n );\n\n // Wait for async operations (loading screens)\n // Simple delay for now, or check frame content until \"Loading\" is gone\n // Since we can't easily wait for a specific state without more complex logic,\n // let's try a short delay to allow useEffect to run.\n await new Promise(resolve => setTimeout(resolve, 1000));\n\n console.log(lastFrame());\n unmount();\n } catch (e) {\n if ((e as any).code === 'ERR_MODULE_NOT_FOUND') {\n console.warn(theme.yellow('ink-testing-library not found. Install dev dependencies to snapshot site command.'));\n } else {\n throw e;\n }\n }\n break;\n }\n default:\n return { success: false, error: { message: `Unsupported command '${input.command}'` } };\n }\n } catch (error) {\n console.error(theme.red('Command execution failed:'), error);\n // Return success: true because the snapshotting process ran, even if the command failed.\n // The error is part of the snapshot.\n return { success: true };\n }\n\n return { success: true };\n }\n}\n",
|
|
6
|
+
"import { type UserInterface } from './UserInterface.js';\nimport type { McpClient } from '../ui/wizard.js';\n\nexport class MockUI implements UserInterface {\n constructor(private readonly data: Record<string, any>) {}\n\n async promptMcpClient(): Promise<McpClient> {\n if (!this.data.mcpClient) {\n throw new Error('MockUI: Missing data for mcpClient');\n }\n return this.data.mcpClient;\n }\n\n async promptAuthMode(): Promise<'apiKey' | 'oauth'> {\n if (!this.data.authMode) {\n throw new Error('MockUI: Missing data for authMode');\n }\n return this.data.authMode;\n }\n\n async promptTransportType(authMode?: 'apiKey' | 'oauth'): Promise<'http' | 'stdio'> {\n if (this.data.transportType) {\n return this.data.transportType;\n }\n throw new Error('MockUI: Missing data for transportType');\n }\n\n async promptApiKeyStorage(): Promise<'config' | 'skip' | '.env'> {\n if (!this.data.apiKeyStorage) {\n throw new Error('MockUI: Missing data for apiKeyStorage');\n }\n return this.data.apiKeyStorage;\n }\n\n async promptApiKey(): Promise<string> {\n if (!this.data.apiKey) {\n throw new Error('MockUI: Missing data for apiKey');\n }\n return this.data.apiKey;\n }\n\n async promptConfirm(message: string, defaultYes?: boolean): Promise<boolean> {\n if (typeof this.data.confirm === 'boolean') {\n return this.data.confirm;\n }\n // If specific confirm keys are provided in data, could use that too.\n // For now, default to defaultYes or false.\n return defaultYes ?? false;\n }\n\n log(message: string): void {\n console.log(message);\n }\n\n warn(message: string): void {\n console.log(`WARN: ${message}`);\n }\n\n error(message: string): void {\n console.error(`ERROR: ${message}`);\n }\n\n success(message: string): void {\n console.log(`SUCCESS: ${message}`);\n }\n}\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;;;;;;;;;;;;AAAA;;;ACGO,MAAM,OAAgC;AAAA,EACd;AAAA,EAA7B,WAAW,CAAkB,MAA2B;AAAA,IAA3B;AAAA;AAAA,OAEvB,gBAAe,GAAuB;AAAA,IAC1C,IAAI,CAAC,KAAK,KAAK,WAAW;AAAA,MACxB,MAAM,IAAI,MAAM,oCAAoC;AAAA,IACtD;AAAA,IACA,OAAO,KAAK,KAAK;AAAA;AAAA,OAGb,eAAc,GAAgC;AAAA,IAClD,IAAI,CAAC,KAAK,KAAK,UAAU;AAAA,MACvB,MAAM,IAAI,MAAM,mCAAmC;AAAA,IACrD;AAAA,IACA,OAAO,KAAK,KAAK;AAAA;AAAA,OAGb,oBAAmB,CAAC,UAA0D;AAAA,IAClF,IAAI,KAAK,KAAK,eAAe;AAAA,MAC3B,OAAO,KAAK,KAAK;AAAA,IACnB;AAAA,IACA,MAAM,IAAI,MAAM,wCAAwC;AAAA;AAAA,OAGpD,oBAAmB,GAAwC;AAAA,IAC/D,IAAI,CAAC,KAAK,KAAK,eAAe;AAAA,MAC5B,MAAM,IAAI,MAAM,wCAAwC;AAAA,IAC1D;AAAA,IACA,OAAO,KAAK,KAAK;AAAA;AAAA,OAGb,aAAY,GAAoB;AAAA,IACpC,IAAI,CAAC,KAAK,KAAK,QAAQ;AAAA,MACrB,MAAM,IAAI,MAAM,iCAAiC;AAAA,IACnD;AAAA,IACA,OAAO,KAAK,KAAK;AAAA;AAAA,OAGb,cAAa,CAAC,SAAiB,YAAwC;AAAA,IAC3E,IAAI,OAAO,KAAK,KAAK,YAAY,WAAW;AAAA,MAC1C,OAAO,KAAK,KAAK;AAAA,IACnB;AAAA,IA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AK,MAAM,OAAO,mFAAmF,CAAC;AAAA,YAClH,EAAO;AAAA,cACH,MAAM;AAAA;AAAA;AAAA,UAGb;AAAA,QACF;AAAA;AAAA,UAEE,OAAO,EAAE,SAAS,OAAO,OAAO,EAAE,SAAS,wBAAwB,MAAM,WAAW,EAAE;AAAA;AAAA,MAE1F,OAAO,OAAO;AAAA,MACb,QAAQ,MAAM,MAAM,IAAI,2BAA2B,GAAG,KAAK;AAAA,MAG3D,OAAO,EAAE,SAAS,KAAK;AAAA;AAAA,IAG1B,OAAO,EAAE,SAAS,KAAK;AAAA;AAE3B;",
|
|
9
|
+
"debugId": "F78CBF4C733E0A4464756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import {
|
|
2
|
+
openUrl,
|
|
3
|
+
require_jsx_dev_runtime
|
|
4
|
+
} from "./chunk-mp1sf8x6.js";
|
|
5
|
+
import {
|
|
6
|
+
StitchViteServer
|
|
7
|
+
} from "./chunk-9ckyz47q.js";
|
|
8
|
+
import"./chunk-sqhdg0mf.js";
|
|
9
|
+
import {
|
|
10
|
+
Box_default,
|
|
11
|
+
Text,
|
|
12
|
+
use_app_default,
|
|
13
|
+
use_input_default
|
|
14
|
+
} from "./chunk-5jbenaez.js";
|
|
15
|
+
import {
|
|
16
|
+
require_react
|
|
17
|
+
} from "./chunk-vcp9fp2w.js";
|
|
18
|
+
import {
|
|
19
|
+
copyText,
|
|
20
|
+
downloadText
|
|
21
|
+
} from "./chunk-fkzq5m59.js";
|
|
22
|
+
import"./chunk-543135qd.js";
|
|
23
|
+
import"./chunk-hst78da7.js";
|
|
24
|
+
import"./chunk-3sfn889r.js";
|
|
25
|
+
import {
|
|
26
|
+
__toESM
|
|
27
|
+
} from "./chunk-9wyra8hs.js";
|
|
28
|
+
|
|
29
|
+
// src/commands/screens/ScreensView.tsx
|
|
30
|
+
var import_react = __toESM(require_react(), 1);
|
|
31
|
+
var jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
32
|
+
function ScreensView({ projectId, projectTitle, screens }) {
|
|
33
|
+
const { exit } = use_app_default();
|
|
34
|
+
const [selectedIndex, setSelectedIndex] = import_react.useState(0);
|
|
35
|
+
const [windowStart, setWindowStart] = import_react.useState(0);
|
|
36
|
+
const [status, setStatus] = import_react.useState("");
|
|
37
|
+
const [serverUrl, setServerUrl] = import_react.useState(null);
|
|
38
|
+
const serverRef = import_react.useRef(null);
|
|
39
|
+
const VIEW_HEIGHT = 10;
|
|
40
|
+
import_react.default.useEffect(() => {
|
|
41
|
+
if (selectedIndex < windowStart) {
|
|
42
|
+
setWindowStart(selectedIndex);
|
|
43
|
+
} else if (selectedIndex >= windowStart + VIEW_HEIGHT) {
|
|
44
|
+
setWindowStart(selectedIndex - VIEW_HEIGHT + 1);
|
|
45
|
+
}
|
|
46
|
+
}, [selectedIndex, windowStart, VIEW_HEIGHT]);
|
|
47
|
+
import_react.useEffect(() => {
|
|
48
|
+
return () => {
|
|
49
|
+
if (serverRef.current)
|
|
50
|
+
serverRef.current.stop();
|
|
51
|
+
};
|
|
52
|
+
}, []);
|
|
53
|
+
async function serveScreen(screen) {
|
|
54
|
+
if (!screen.hasCode || !screen.codeUrl) {
|
|
55
|
+
setStatus("No HTML to serve");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setStatus("Preparing server...");
|
|
59
|
+
let srv = serverRef.current;
|
|
60
|
+
let url = serverUrl;
|
|
61
|
+
let justStarted = false;
|
|
62
|
+
if (!srv) {
|
|
63
|
+
srv = new StitchViteServer;
|
|
64
|
+
url = await srv.start(0);
|
|
65
|
+
serverRef.current = srv;
|
|
66
|
+
setServerUrl(url);
|
|
67
|
+
justStarted = true;
|
|
68
|
+
}
|
|
69
|
+
if (!url)
|
|
70
|
+
return;
|
|
71
|
+
try {
|
|
72
|
+
const html = await downloadText(screen.codeUrl);
|
|
73
|
+
const route = `/screens/${screen.screenId}`;
|
|
74
|
+
srv.mount(route, html);
|
|
75
|
+
const fullUrl = `${url}${route}`;
|
|
76
|
+
if (justStarted) {
|
|
77
|
+
openUrl(fullUrl);
|
|
78
|
+
} else {
|
|
79
|
+
srv.navigate(fullUrl);
|
|
80
|
+
}
|
|
81
|
+
setStatus(`Serving at ${fullUrl}`);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
setStatus("Error serving screen");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
use_input_default((input, key) => {
|
|
87
|
+
if (input === "q") {
|
|
88
|
+
exit();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (key.upArrow || input === "k") {
|
|
92
|
+
setSelectedIndex((prev) => Math.max(0, prev - 1));
|
|
93
|
+
setStatus("");
|
|
94
|
+
}
|
|
95
|
+
if (key.downArrow || input === "j") {
|
|
96
|
+
setSelectedIndex((prev) => Math.min(screens.length - 1, prev + 1));
|
|
97
|
+
setStatus("");
|
|
98
|
+
}
|
|
99
|
+
if (input === "c") {
|
|
100
|
+
const screen = screens[selectedIndex];
|
|
101
|
+
if (screen?.hasCode && screen.codeUrl) {
|
|
102
|
+
setStatus("Copying...");
|
|
103
|
+
downloadText(screen.codeUrl).then((code) => {
|
|
104
|
+
copyText(code);
|
|
105
|
+
setStatus("HTML copied!");
|
|
106
|
+
}).catch(() => setStatus("Failed to copy"));
|
|
107
|
+
} else {
|
|
108
|
+
setStatus("No HTML available");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
if (input === "i") {
|
|
112
|
+
const screen = screens[selectedIndex];
|
|
113
|
+
if (screen?.hasImage) {
|
|
114
|
+
setStatus("Image copy not implemented");
|
|
115
|
+
} else {
|
|
116
|
+
setStatus("No image available");
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (input === "s") {
|
|
120
|
+
const screen = screens[selectedIndex];
|
|
121
|
+
if (screen) {
|
|
122
|
+
serveScreen(screen);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
const visibleScreens = screens.slice(windowStart, windowStart + VIEW_HEIGHT);
|
|
127
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
128
|
+
flexDirection: "column",
|
|
129
|
+
padding: 1,
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
132
|
+
bold: true,
|
|
133
|
+
children: [
|
|
134
|
+
projectTitle,
|
|
135
|
+
" (",
|
|
136
|
+
screens.length,
|
|
137
|
+
" screens)"
|
|
138
|
+
]
|
|
139
|
+
}, undefined, true, undefined, this),
|
|
140
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
141
|
+
dimColor: true,
|
|
142
|
+
children: [
|
|
143
|
+
"projectId: ",
|
|
144
|
+
projectId
|
|
145
|
+
]
|
|
146
|
+
}, undefined, true, undefined, this),
|
|
147
|
+
serverUrl && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
148
|
+
dimColor: true,
|
|
149
|
+
children: [
|
|
150
|
+
"Server: ",
|
|
151
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
152
|
+
color: "green",
|
|
153
|
+
children: serverUrl
|
|
154
|
+
}, undefined, false, undefined, this)
|
|
155
|
+
]
|
|
156
|
+
}, undefined, true, undefined, this),
|
|
157
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
158
|
+
children: " "
|
|
159
|
+
}, undefined, false, undefined, this),
|
|
160
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
161
|
+
flexDirection: "column",
|
|
162
|
+
borderStyle: "single",
|
|
163
|
+
borderColor: "yellow",
|
|
164
|
+
paddingX: 1,
|
|
165
|
+
children: [
|
|
166
|
+
windowStart > 0 && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
167
|
+
dimColor: true,
|
|
168
|
+
children: [
|
|
169
|
+
"... ",
|
|
170
|
+
windowStart,
|
|
171
|
+
" more above ..."
|
|
172
|
+
]
|
|
173
|
+
}, undefined, true, undefined, this),
|
|
174
|
+
visibleScreens.map((screen, index) => {
|
|
175
|
+
const absoluteIndex = windowStart + index;
|
|
176
|
+
const isSelected = absoluteIndex === selectedIndex;
|
|
177
|
+
const num = String(absoluteIndex + 1).padStart(2, " ");
|
|
178
|
+
const selector = isSelected ? "▸" : " ";
|
|
179
|
+
return /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
180
|
+
flexDirection: "column",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
183
|
+
justifyContent: "space-between",
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
188
|
+
dimColor: true,
|
|
189
|
+
children: num
|
|
190
|
+
}, undefined, false, undefined, this),
|
|
191
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
192
|
+
color: isSelected ? "cyan" : undefined,
|
|
193
|
+
children: [
|
|
194
|
+
" ",
|
|
195
|
+
selector,
|
|
196
|
+
" "
|
|
197
|
+
]
|
|
198
|
+
}, undefined, true, undefined, this),
|
|
199
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
200
|
+
color: isSelected ? "cyan" : undefined,
|
|
201
|
+
bold: isSelected,
|
|
202
|
+
children: screen.title.slice(0, 28)
|
|
203
|
+
}, undefined, false, undefined, this)
|
|
204
|
+
]
|
|
205
|
+
}, undefined, true, undefined, this),
|
|
206
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Box_default, {
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
209
|
+
dimColor: true,
|
|
210
|
+
children: "html"
|
|
211
|
+
}, undefined, false, undefined, this),
|
|
212
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
213
|
+
color: screen.hasCode ? "green" : "gray",
|
|
214
|
+
children: screen.hasCode ? "[✓]" : "[ ]"
|
|
215
|
+
}, undefined, false, undefined, this),
|
|
216
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
217
|
+
children: " "
|
|
218
|
+
}, undefined, false, undefined, this),
|
|
219
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
220
|
+
dimColor: true,
|
|
221
|
+
children: "img"
|
|
222
|
+
}, undefined, false, undefined, this),
|
|
223
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
224
|
+
color: screen.hasImage ? "green" : "gray",
|
|
225
|
+
children: screen.hasImage ? "[✓]" : "[ ]"
|
|
226
|
+
}, undefined, false, undefined, this)
|
|
227
|
+
]
|
|
228
|
+
}, undefined, true, undefined, this)
|
|
229
|
+
]
|
|
230
|
+
}, undefined, true, undefined, this),
|
|
231
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
232
|
+
dimColor: true,
|
|
233
|
+
color: "gray",
|
|
234
|
+
children: [
|
|
235
|
+
" screenId: ",
|
|
236
|
+
screen.screenId
|
|
237
|
+
]
|
|
238
|
+
}, undefined, true, undefined, this),
|
|
239
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
240
|
+
children: " "
|
|
241
|
+
}, undefined, false, undefined, this)
|
|
242
|
+
]
|
|
243
|
+
}, screen.screenId, true, undefined, this);
|
|
244
|
+
}),
|
|
245
|
+
windowStart + VIEW_HEIGHT < screens.length && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
246
|
+
dimColor: true,
|
|
247
|
+
children: [
|
|
248
|
+
"... ",
|
|
249
|
+
screens.length - (windowStart + VIEW_HEIGHT),
|
|
250
|
+
" more below ..."
|
|
251
|
+
]
|
|
252
|
+
}, undefined, true, undefined, this)
|
|
253
|
+
]
|
|
254
|
+
}, undefined, true, undefined, this),
|
|
255
|
+
/* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
256
|
+
dimColor: true,
|
|
257
|
+
children: "[c]opy html [i]mage [s]erve [q]uit"
|
|
258
|
+
}, undefined, false, undefined, this),
|
|
259
|
+
status && /* @__PURE__ */ jsx_dev_runtime.jsxDEV(Text, {
|
|
260
|
+
color: "yellow",
|
|
261
|
+
children: status
|
|
262
|
+
}, undefined, false, undefined, this)
|
|
263
|
+
]
|
|
264
|
+
}, undefined, true, undefined, this);
|
|
265
|
+
}
|
|
266
|
+
export {
|
|
267
|
+
ScreensView
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
//# debugId=960621E15D89B58B64756E2164756E21
|