sunpeak 0.10.7 → 0.12.1
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/README.md +117 -20
- package/bin/commands/build.mjs +1 -11
- package/bin/commands/deploy.mjs +7 -1
- package/bin/commands/dev.mjs +175 -12
- package/bin/commands/new.mjs +211 -0
- package/bin/commands/pull.mjs +1 -1
- package/bin/commands/push.mjs +36 -13
- package/bin/lib/patterns.mjs +25 -0
- package/bin/sunpeak.js +15 -232
- package/dist/chatgpt/index.cjs +1 -1
- package/dist/chatgpt/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/mcp/entry.cjs +1 -1
- package/dist/mcp/entry.js +1 -1
- package/dist/mcp/favicon.d.ts +2 -0
- package/dist/mcp/index.cjs +3 -1
- package/dist/mcp/index.cjs.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.js +3 -1
- package/dist/{server-BLKltt88.js → server-BI9Y531R.js} +31 -3
- package/dist/{server-BLKltt88.js.map → server-BI9Y531R.js.map} +1 -1
- package/dist/{server-D_oRdZjX.cjs → server-CcLDAGBE.cjs} +31 -3
- package/dist/{server-D_oRdZjX.cjs.map → server-CcLDAGBE.cjs.map} +1 -1
- package/dist/{simulator-url-B6DZi3vV.cjs → simulator-url-CYMOGoB1.cjs} +5 -5
- package/dist/{simulator-url-B6DZi3vV.cjs.map → simulator-url-CYMOGoB1.cjs.map} +1 -1
- package/dist/{simulator-url-izFV6mji.js → simulator-url-DG79-dU3.js} +4 -4
- package/dist/{simulator-url-izFV6mji.js.map → simulator-url-DG79-dU3.js.map} +1 -1
- package/package.json +1 -1
- package/template/.sunpeak/dev.tsx +4 -4
- package/template/README.md +25 -27
- package/template/_gitignore +4 -0
- package/template/dist/albums/albums.json +1 -1
- package/template/dist/carousel/carousel.json +1 -1
- package/template/dist/map/map.json +1 -1
- package/template/dist/review/review.json +1 -1
- package/template/index.html +0 -1
- package/template/node_modules/.vite/deps/_metadata.json +22 -22
- package/template/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Avatar.js +96 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Avatar.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Button.js +625 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Button.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Checkbox.js +33 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Checkbox.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Icon.js +1498 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Icon.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Input.js +13 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Input.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_SegmentedControl.js +103 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_SegmentedControl.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Select.js +3680 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Select.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Textarea.js +95 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_components_Textarea.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_theme.js +45 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/@openai_apps-sdk-ui_theme.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-2UDYPUBJ.js +15201 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-2UDYPUBJ.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-6QVG4F2X.js +93 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-6QVG4F2X.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-BUOVMFCD.js +1004 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-BUOVMFCD.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-CNYJBM5F.js +21 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-CNYJBM5F.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-EGRHWZRV.js +1 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-EGRHWZRV.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-ILHRZGIS.js +46 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-ILHRZGIS.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-JAGHY6H6.js +231 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-JAGHY6H6.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-JGVISENQ.js +292 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-JGVISENQ.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-P5LK4A7U.js +112 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-P5LK4A7U.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-QPJAV452.js +13 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-QPJAV452.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-RYYR2YMB.js +111 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-RYYR2YMB.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-UM3ZGDFR.js +4480 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-UM3ZGDFR.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-XZTIOEPG.js +280 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/chunk-XZTIOEPG.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/clsx.js +10 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/clsx.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/embla-carousel-react.js +1712 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/embla-carousel-react.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/embla-carousel-wheel-gestures.js +589 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/embla-carousel-wheel-gestures.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/mapbox-gl.js +32835 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/mapbox-gl.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/package.json +3 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react-dom.js +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react-dom.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react-dom_client.js +20217 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react-dom_client.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react.js +6 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react_jsx-dev-runtime.js +278 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react_jsx-dev-runtime.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react_jsx-runtime.js +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/react_jsx-runtime.js.map +7 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/tailwind-merge.js +3095 -0
- package/template/node_modules/.vite-mcp/deps_temp_992accd8/tailwind-merge.js.map +7 -0
- package/template/package.json +0 -1
- package/template/vitest.config.ts +1 -1
- package/bin/commands/mcp.mjs +0 -244
- package/template/public/favicon.ico +0 -0
- package/template/src/resources/albums/albums-show-simulation.json +0 -131
- package/template/src/resources/carousel/carousel-show-simulation.json +0 -68
- package/template/src/resources/map/map-show-simulation.json +0 -123
- package/template/src/resources/review/review-diff-simulation.json +0 -80
- package/template/src/resources/review/review-post-simulation.json +0 -56
- package/template/src/resources/review/review-purchase-simulation.json +0 -88
- /package/template/{src/test → tests}/setup.ts +0 -0
- /package/template/{dist → tests/simulations}/albums/albums-show-simulation.json +0 -0
- /package/template/{dist → tests/simulations}/carousel/carousel-show-simulation.json +0 -0
- /package/template/{dist → tests/simulations}/map/map-show-simulation.json +0 -0
- /package/template/{dist → tests/simulations}/review/review-diff-simulation.json +0 -0
- /package/template/{dist → tests/simulations}/review/review-post-simulation.json +0 -0
- /package/template/{dist → tests/simulations}/review/review-purchase-simulation.json +0 -0
package/bin/commands/push.mjs
CHANGED
|
@@ -61,23 +61,24 @@ export const defaultDeps = {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* Find simulation files for a resource in
|
|
65
|
-
* Expects files
|
|
64
|
+
* Find simulation files for a resource in the simulations directory
|
|
65
|
+
* Expects files in: tests/simulations/{resourceName}/{resourceName}-*-simulation.json
|
|
66
66
|
* Returns array of parsed simulation objects
|
|
67
67
|
*/
|
|
68
|
-
function findSimulations(
|
|
68
|
+
function findSimulations(simulationsDir, resourceName, deps = defaultDeps) {
|
|
69
69
|
const d = { ...defaultDeps, ...deps };
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
const resourceSimDir = join(simulationsDir, resourceName);
|
|
72
|
+
if (!d.existsSync(resourceSimDir)) {
|
|
72
73
|
return [];
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
const entries = d.readdirSync(
|
|
76
|
+
const entries = d.readdirSync(resourceSimDir);
|
|
76
77
|
const simulations = [];
|
|
77
78
|
|
|
78
79
|
for (const entry of entries) {
|
|
79
80
|
if (isSimulationFile(entry, resourceName)) {
|
|
80
|
-
const simPath = join(
|
|
81
|
+
const simPath = join(resourceSimDir, entry);
|
|
81
82
|
try {
|
|
82
83
|
const simData = JSON.parse(d.readFileSync(simPath, 'utf-8'));
|
|
83
84
|
const simName = extractSimulationName(entry, resourceName);
|
|
@@ -94,9 +95,10 @@ function findSimulations(resourceDir, resourceName, deps = defaultDeps) {
|
|
|
94
95
|
/**
|
|
95
96
|
* Find all resources in a directory
|
|
96
97
|
* Expects folder structure: dist/{resource}/{resource}.js
|
|
98
|
+
* Simulations are loaded from tests/simulations/{resource}/
|
|
97
99
|
* Returns array of { name, jsPath, metaPath, meta, simulations }
|
|
98
100
|
*/
|
|
99
|
-
export function findResources(distDir, deps = defaultDeps) {
|
|
101
|
+
export function findResources(distDir, simulationsDir, deps = defaultDeps) {
|
|
100
102
|
const d = { ...defaultDeps, ...deps };
|
|
101
103
|
|
|
102
104
|
if (!d.existsSync(distDir)) {
|
|
@@ -120,7 +122,7 @@ export function findResources(distDir, deps = defaultDeps) {
|
|
|
120
122
|
} catch {
|
|
121
123
|
d.console.warn(`Warning: Could not parse ${resourceName}.json`);
|
|
122
124
|
}
|
|
123
|
-
const simulations = findSimulations(
|
|
125
|
+
const simulations = findSimulations(simulationsDir, resourceName, d);
|
|
124
126
|
resources.push({ name: resourceName, dir: resourceDir, jsPath, metaPath, meta, simulations });
|
|
125
127
|
}
|
|
126
128
|
}
|
|
@@ -132,9 +134,10 @@ export function findResources(distDir, deps = defaultDeps) {
|
|
|
132
134
|
/**
|
|
133
135
|
* Build a resource from a resource directory path
|
|
134
136
|
* Expects structure: dir/{name}.js, dir/{name}.json
|
|
137
|
+
* Simulations are loaded from tests/simulations/{name}/
|
|
135
138
|
* Returns { name, jsPath, metaPath, meta, simulations }
|
|
136
139
|
*/
|
|
137
|
-
function buildResourceFromDir(resourceDir, deps = defaultDeps) {
|
|
140
|
+
function buildResourceFromDir(resourceDir, simulationsDir, deps = defaultDeps) {
|
|
138
141
|
const d = { ...defaultDeps, ...deps };
|
|
139
142
|
|
|
140
143
|
// Remove trailing slash if present
|
|
@@ -167,7 +170,7 @@ function buildResourceFromDir(resourceDir, deps = defaultDeps) {
|
|
|
167
170
|
d.console.warn(`Warning: Could not parse ${name}.json`);
|
|
168
171
|
}
|
|
169
172
|
|
|
170
|
-
const simulations = findSimulations(
|
|
173
|
+
const simulations = findSimulations(simulationsDir, name, d);
|
|
171
174
|
|
|
172
175
|
return { name, jsPath, metaPath, meta, simulations };
|
|
173
176
|
}
|
|
@@ -281,6 +284,7 @@ Usage:
|
|
|
281
284
|
Options:
|
|
282
285
|
-r, --repository <owner/repo> Repository name (defaults to git remote origin)
|
|
283
286
|
-t, --tag <name> Tag to assign (can be specified multiple times)
|
|
287
|
+
--no-simulations Skip pushing simulations, only push resources
|
|
284
288
|
-h, --help Show this help message
|
|
285
289
|
|
|
286
290
|
Arguments:
|
|
@@ -293,6 +297,7 @@ Examples:
|
|
|
293
297
|
sunpeak push -r myorg/my-app Push to "myorg/my-app" repository
|
|
294
298
|
sunpeak push -t v1.0.0 Push with a version tag
|
|
295
299
|
sunpeak push -t v1.0.0 -t prod Push with multiple tags
|
|
300
|
+
sunpeak push --no-simulations Push resources without simulations
|
|
296
301
|
`);
|
|
297
302
|
return;
|
|
298
303
|
}
|
|
@@ -314,10 +319,11 @@ Examples:
|
|
|
314
319
|
}
|
|
315
320
|
|
|
316
321
|
// Find resources - either a specific directory or all from dist directory
|
|
322
|
+
const simulationsDir = join(projectRoot, 'tests/simulations');
|
|
317
323
|
let resources;
|
|
318
324
|
if (options.dir) {
|
|
319
325
|
// Push a single specific resource from directory
|
|
320
|
-
resources = [buildResourceFromDir(options.dir, d)];
|
|
326
|
+
resources = [buildResourceFromDir(options.dir, simulationsDir, d)];
|
|
321
327
|
} else {
|
|
322
328
|
// Default: find all resources in dist directory
|
|
323
329
|
const distDir = join(projectRoot, 'dist');
|
|
@@ -327,7 +333,7 @@ Examples:
|
|
|
327
333
|
d.process.exit(1);
|
|
328
334
|
}
|
|
329
335
|
|
|
330
|
-
resources = findResources(distDir, d);
|
|
336
|
+
resources = findResources(distDir, simulationsDir, d);
|
|
331
337
|
if (resources.length === 0) {
|
|
332
338
|
d.console.error(`Error: No resources found in dist/`);
|
|
333
339
|
d.console.error('Run "sunpeak build" first to build your resources.');
|
|
@@ -335,10 +341,20 @@ Examples:
|
|
|
335
341
|
}
|
|
336
342
|
}
|
|
337
343
|
|
|
344
|
+
// Clear simulations if --no-simulations flag is set
|
|
345
|
+
if (options.noSimulations) {
|
|
346
|
+
for (const resource of resources) {
|
|
347
|
+
resource.simulations = [];
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
338
351
|
d.console.log(`Pushing ${resources.length} resource(s) to repository "${repository}"...`);
|
|
339
352
|
if (options.tags && options.tags.length > 0) {
|
|
340
353
|
d.console.log(`Tags: ${options.tags.join(', ')}`);
|
|
341
354
|
}
|
|
355
|
+
if (options.noSimulations) {
|
|
356
|
+
d.console.log('Simulations: skipped');
|
|
357
|
+
}
|
|
342
358
|
d.console.log();
|
|
343
359
|
|
|
344
360
|
// Push each resource
|
|
@@ -354,6 +370,9 @@ Examples:
|
|
|
354
370
|
successCount++;
|
|
355
371
|
} catch (error) {
|
|
356
372
|
d.console.error(`✗ Failed to push ${resource.name}: ${error.message}`);
|
|
373
|
+
if (error.message.includes('Uri must be unique')) {
|
|
374
|
+
d.console.error(' You are trying to push a build that has already been pushed.');
|
|
375
|
+
}
|
|
357
376
|
}
|
|
358
377
|
}
|
|
359
378
|
|
|
@@ -369,7 +388,7 @@ Examples:
|
|
|
369
388
|
/**
|
|
370
389
|
* Parse command line arguments
|
|
371
390
|
*/
|
|
372
|
-
function parseArgs(args) {
|
|
391
|
+
export function parseArgs(args) {
|
|
373
392
|
const options = { tags: [] };
|
|
374
393
|
let i = 0;
|
|
375
394
|
|
|
@@ -380,6 +399,8 @@ function parseArgs(args) {
|
|
|
380
399
|
options.repository = args[++i];
|
|
381
400
|
} else if (arg === '--tag' || arg === '-t') {
|
|
382
401
|
options.tags.push(args[++i]);
|
|
402
|
+
} else if (arg === '--no-simulations') {
|
|
403
|
+
options.noSimulations = true;
|
|
383
404
|
} else if (arg === '--help' || arg === '-h') {
|
|
384
405
|
console.log(`
|
|
385
406
|
sunpeak push - Push resources to the Sunpeak repository
|
|
@@ -390,6 +411,7 @@ Usage:
|
|
|
390
411
|
Options:
|
|
391
412
|
-r, --repository <owner/repo> Repository name (defaults to git remote origin)
|
|
392
413
|
-t, --tag <name> Tag to assign (can be specified multiple times)
|
|
414
|
+
--no-simulations Skip pushing simulations, only push resources
|
|
393
415
|
-h, --help Show this help message
|
|
394
416
|
|
|
395
417
|
Arguments:
|
|
@@ -402,6 +424,7 @@ Examples:
|
|
|
402
424
|
sunpeak push -r myorg/my-app Push to "myorg/my-app" repository
|
|
403
425
|
sunpeak push -t v1.0.0 Push with a version tag
|
|
404
426
|
sunpeak push -t v1.0.0 -t prod Push with multiple tags
|
|
427
|
+
sunpeak push --no-simulations Push resources without simulations
|
|
405
428
|
`);
|
|
406
429
|
process.exit(0);
|
|
407
430
|
} else if (!arg.startsWith('-')) {
|
package/bin/lib/patterns.mjs
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
* These mirror the patterns in src/lib/discovery.ts for consistency.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { existsSync, readdirSync } from 'fs';
|
|
7
|
+
import { join, dirname } from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Auto-discover available resources from template/src/resources directories.
|
|
14
|
+
* Each subdirectory containing a {name}-resource.tsx file is a valid resource.
|
|
15
|
+
* @returns {string[]} Array of resource names
|
|
16
|
+
*/
|
|
17
|
+
export function discoverResources() {
|
|
18
|
+
const resourcesDir = join(__dirname, '..', '..', 'template', 'src', 'resources');
|
|
19
|
+
if (!existsSync(resourcesDir)) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
return readdirSync(resourcesDir, { withFileTypes: true })
|
|
23
|
+
.filter((entry) => entry.isDirectory())
|
|
24
|
+
.filter((entry) => {
|
|
25
|
+
const resourceFile = join(resourcesDir, entry.name, `${entry.name}-resource.tsx`);
|
|
26
|
+
return existsSync(resourceFile);
|
|
27
|
+
})
|
|
28
|
+
.map((entry) => entry.name);
|
|
29
|
+
}
|
|
30
|
+
|
|
6
31
|
/**
|
|
7
32
|
* Convert a kebab-case string to PascalCase
|
|
8
33
|
* @param {string} str
|
package/bin/sunpeak.js
CHANGED
|
@@ -1,49 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
mkdirSync,
|
|
6
|
-
cpSync,
|
|
7
|
-
readFileSync,
|
|
8
|
-
writeFileSync,
|
|
9
|
-
renameSync,
|
|
10
|
-
readdirSync,
|
|
11
|
-
} from 'fs';
|
|
12
|
-
import { join, dirname, basename } from 'path';
|
|
3
|
+
import { existsSync, readFileSync } from 'fs';
|
|
4
|
+
import { join, dirname } from 'path';
|
|
13
5
|
import { fileURLToPath } from 'url';
|
|
14
|
-
import {
|
|
6
|
+
import { discoverResources } from './lib/patterns.mjs';
|
|
15
7
|
|
|
16
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
9
|
const COMMANDS_DIR = join(__dirname, 'commands');
|
|
18
10
|
|
|
19
|
-
/**
|
|
20
|
-
* Auto-discover available resources from template/src/resources directories.
|
|
21
|
-
* Each subdirectory containing a {name}-resource.tsx file is a valid resource.
|
|
22
|
-
*/
|
|
23
|
-
function discoverResources() {
|
|
24
|
-
const resourcesDir = join(__dirname, '..', 'template', 'src', 'resources');
|
|
25
|
-
if (!existsSync(resourcesDir)) {
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
return readdirSync(resourcesDir, { withFileTypes: true })
|
|
29
|
-
.filter((entry) => entry.isDirectory())
|
|
30
|
-
.filter((entry) => {
|
|
31
|
-
const resourceFile = join(resourcesDir, entry.name, `${entry.name}-resource.tsx`);
|
|
32
|
-
return existsSync(resourceFile);
|
|
33
|
-
})
|
|
34
|
-
.map((entry) => entry.name);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function prompt(question) {
|
|
38
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
39
|
-
return new Promise((resolve) => {
|
|
40
|
-
rl.question(question, (answer) => {
|
|
41
|
-
rl.close();
|
|
42
|
-
resolve(answer.trim());
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
11
|
function checkPackageJson() {
|
|
48
12
|
const pkgPath = join(process.cwd(), 'package.json');
|
|
49
13
|
if (!existsSync(pkgPath)) {
|
|
@@ -53,149 +17,6 @@ function checkPackageJson() {
|
|
|
53
17
|
}
|
|
54
18
|
}
|
|
55
19
|
|
|
56
|
-
function parseResourcesInput(input, validResources) {
|
|
57
|
-
// If no input, return all resources
|
|
58
|
-
if (!input || input.trim() === '') {
|
|
59
|
-
return validResources;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Split by comma or space and trim
|
|
63
|
-
const tokens = input
|
|
64
|
-
.toLowerCase()
|
|
65
|
-
.split(/[,\s]+/)
|
|
66
|
-
.map((s) => s.trim())
|
|
67
|
-
.filter((s) => s.length > 0);
|
|
68
|
-
|
|
69
|
-
// Validate tokens
|
|
70
|
-
const invalid = tokens.filter((t) => !validResources.includes(t));
|
|
71
|
-
if (invalid.length > 0) {
|
|
72
|
-
console.error(`Error: Invalid resource(s): ${invalid.join(', ')}`);
|
|
73
|
-
console.error(`Valid resources are: ${validResources.join(', ')}`);
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Remove duplicates
|
|
78
|
-
return [...new Set(tokens)];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async function init(projectName, resourcesArg) {
|
|
82
|
-
// Discover available resources from template
|
|
83
|
-
const availableResources = discoverResources();
|
|
84
|
-
if (availableResources.length === 0) {
|
|
85
|
-
console.error('Error: No resources found in template/src/resources/');
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (!projectName) {
|
|
90
|
-
projectName = await prompt('☀️ 🏔️ Project name [my-app]: ');
|
|
91
|
-
if (!projectName) {
|
|
92
|
-
projectName = 'my-app';
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (projectName === 'template') {
|
|
97
|
-
console.error('Error: "template" is a reserved name. Please choose another name.');
|
|
98
|
-
process.exit(1);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Use resources from args or ask for them
|
|
102
|
-
let resourcesInput;
|
|
103
|
-
if (resourcesArg) {
|
|
104
|
-
resourcesInput = resourcesArg;
|
|
105
|
-
console.log(`☀️ 🏔️ Resources: ${resourcesArg}`);
|
|
106
|
-
} else {
|
|
107
|
-
resourcesInput = await prompt(
|
|
108
|
-
`☀️ 🏔️ Resources (UIs) to include [${availableResources.join(', ')}]: `
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
const selectedResources = parseResourcesInput(resourcesInput, availableResources);
|
|
112
|
-
|
|
113
|
-
const targetDir = join(process.cwd(), projectName);
|
|
114
|
-
|
|
115
|
-
if (existsSync(targetDir)) {
|
|
116
|
-
console.error(`Error: Directory "${projectName}" already exists`);
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
const templateDir = join(__dirname, '..', 'template');
|
|
121
|
-
|
|
122
|
-
console.log(`☀️ 🏔️ Creating ${projectName}...`);
|
|
123
|
-
|
|
124
|
-
mkdirSync(targetDir, { recursive: true });
|
|
125
|
-
|
|
126
|
-
// Filter resource directories based on selection
|
|
127
|
-
const excludedResources = availableResources.filter((r) => !selectedResources.includes(r));
|
|
128
|
-
|
|
129
|
-
cpSync(templateDir, targetDir, {
|
|
130
|
-
recursive: true,
|
|
131
|
-
filter: (src) => {
|
|
132
|
-
const name = basename(src);
|
|
133
|
-
|
|
134
|
-
// Skip node_modules and lock file
|
|
135
|
-
if (name === 'node_modules' || name === 'pnpm-lock.yaml') {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
for (const resource of excludedResources) {
|
|
140
|
-
// Skip entire resource directory: src/resources/{resource}/
|
|
141
|
-
if (src.includes('/resources/') && name === resource) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
// Skip e2e test files for excluded resources
|
|
145
|
-
if (src.includes('/tests/e2e/') && name === `${resource}.spec.ts`) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return true;
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
// Rename underscore-prefixed files to dotfiles
|
|
155
|
-
const dotfiles = ['_gitignore', '_prettierignore', '_prettierrc'];
|
|
156
|
-
for (const file of dotfiles) {
|
|
157
|
-
const srcPath = join(targetDir, file);
|
|
158
|
-
const destPath = join(targetDir, file.replace(/^_/, '.'));
|
|
159
|
-
if (existsSync(srcPath)) {
|
|
160
|
-
renameSync(srcPath, destPath);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Read sunpeak version from root package.json
|
|
165
|
-
const rootPkgPath = join(__dirname, '..', 'package.json');
|
|
166
|
-
const rootPkg = JSON.parse(readFileSync(rootPkgPath, 'utf-8'));
|
|
167
|
-
const sunpeakVersion = `^${rootPkg.version}`;
|
|
168
|
-
|
|
169
|
-
// Update project package.json
|
|
170
|
-
const pkgPath = join(targetDir, 'package.json');
|
|
171
|
-
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
172
|
-
pkg.name = projectName;
|
|
173
|
-
|
|
174
|
-
// Replace workspace:* with actual version
|
|
175
|
-
if (pkg.dependencies?.sunpeak === 'workspace:*') {
|
|
176
|
-
pkg.dependencies.sunpeak = sunpeakVersion;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
180
|
-
|
|
181
|
-
console.log(`
|
|
182
|
-
Done! To get started:
|
|
183
|
-
|
|
184
|
-
cd ${projectName}
|
|
185
|
-
pnpm install
|
|
186
|
-
sunpeak dev
|
|
187
|
-
|
|
188
|
-
That's it! Your project commands:
|
|
189
|
-
|
|
190
|
-
sunpeak dev # Start development server
|
|
191
|
-
sunpeak build # Build for production
|
|
192
|
-
sunpeak mcp # Start MCP server
|
|
193
|
-
pnpm test # Run tests
|
|
194
|
-
|
|
195
|
-
See README.md for more details.
|
|
196
|
-
`);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
20
|
const [, , command, ...args] = process.argv;
|
|
200
21
|
|
|
201
22
|
/**
|
|
@@ -207,40 +28,6 @@ function getVersion() {
|
|
|
207
28
|
return pkg.version;
|
|
208
29
|
}
|
|
209
30
|
|
|
210
|
-
/**
|
|
211
|
-
* Parse arguments for resource commands (push, pull, deploy)
|
|
212
|
-
*/
|
|
213
|
-
function parseResourceArgs(args) {
|
|
214
|
-
const options = { tags: [] };
|
|
215
|
-
let i = 0;
|
|
216
|
-
|
|
217
|
-
while (i < args.length) {
|
|
218
|
-
const arg = args[i];
|
|
219
|
-
|
|
220
|
-
if (arg === '--repository' || arg === '-r') {
|
|
221
|
-
options.repository = args[++i];
|
|
222
|
-
} else if (arg === '--tag' || arg === '-t') {
|
|
223
|
-
options.tags.push(args[++i]);
|
|
224
|
-
} else if (arg === '--name' || arg === '-n') {
|
|
225
|
-
options.name = args[++i];
|
|
226
|
-
} else if (arg === '--output' || arg === '-o') {
|
|
227
|
-
options.output = args[++i];
|
|
228
|
-
} else if (arg === '--help' || arg === '-h') {
|
|
229
|
-
options.help = true;
|
|
230
|
-
} else if (!arg.startsWith('-')) {
|
|
231
|
-
// Positional argument - treat as file path
|
|
232
|
-
options.file = arg;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
i++;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Set singular tag for commands that expect it (e.g., pull)
|
|
239
|
-
options.tag = options.tags[0];
|
|
240
|
-
|
|
241
|
-
return options;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
31
|
// Main CLI handler
|
|
245
32
|
(async () => {
|
|
246
33
|
// Handle --version / -v flags early
|
|
@@ -268,7 +55,10 @@ function parseResourceArgs(args) {
|
|
|
268
55
|
|
|
269
56
|
switch (command) {
|
|
270
57
|
case 'new':
|
|
271
|
-
|
|
58
|
+
{
|
|
59
|
+
const { init } = await import(join(COMMANDS_DIR, 'new.mjs'));
|
|
60
|
+
await init(args[0], args[1]);
|
|
61
|
+
}
|
|
272
62
|
break;
|
|
273
63
|
|
|
274
64
|
case 'dev':
|
|
@@ -285,13 +75,6 @@ function parseResourceArgs(args) {
|
|
|
285
75
|
}
|
|
286
76
|
break;
|
|
287
77
|
|
|
288
|
-
case 'mcp':
|
|
289
|
-
{
|
|
290
|
-
const { mcp } = await import(join(COMMANDS_DIR, 'mcp.mjs'));
|
|
291
|
-
await mcp(process.cwd(), args);
|
|
292
|
-
}
|
|
293
|
-
break;
|
|
294
|
-
|
|
295
78
|
case 'login':
|
|
296
79
|
{
|
|
297
80
|
const { login } = await import(join(COMMANDS_DIR, 'login.mjs'));
|
|
@@ -308,22 +91,22 @@ function parseResourceArgs(args) {
|
|
|
308
91
|
|
|
309
92
|
case 'push':
|
|
310
93
|
{
|
|
311
|
-
const { push } = await import(join(COMMANDS_DIR, 'push.mjs'));
|
|
312
|
-
await push(process.cwd(),
|
|
94
|
+
const { push, parseArgs } = await import(join(COMMANDS_DIR, 'push.mjs'));
|
|
95
|
+
await push(process.cwd(), parseArgs(args));
|
|
313
96
|
}
|
|
314
97
|
break;
|
|
315
98
|
|
|
316
99
|
case 'pull':
|
|
317
100
|
{
|
|
318
|
-
const { pull } = await import(join(COMMANDS_DIR, 'pull.mjs'));
|
|
319
|
-
await pull(process.cwd(),
|
|
101
|
+
const { pull, parseArgs } = await import(join(COMMANDS_DIR, 'pull.mjs'));
|
|
102
|
+
await pull(process.cwd(), parseArgs(args));
|
|
320
103
|
}
|
|
321
104
|
break;
|
|
322
105
|
|
|
323
106
|
case 'deploy':
|
|
324
107
|
{
|
|
325
|
-
const { deploy } = await import(join(COMMANDS_DIR, 'deploy.mjs'));
|
|
326
|
-
await deploy(process.cwd(),
|
|
108
|
+
const { deploy, parseArgs } = await import(join(COMMANDS_DIR, 'deploy.mjs'));
|
|
109
|
+
await deploy(process.cwd(), parseArgs(args));
|
|
327
110
|
}
|
|
328
111
|
break;
|
|
329
112
|
|
|
@@ -350,9 +133,9 @@ Install:
|
|
|
350
133
|
|
|
351
134
|
Usage:
|
|
352
135
|
sunpeak new [name] [resources] Create a new project
|
|
353
|
-
sunpeak dev Start dev server
|
|
136
|
+
sunpeak dev Start dev server + MCP endpoint
|
|
137
|
+
--no-begging Suppress GitHub star message
|
|
354
138
|
sunpeak build Build resources
|
|
355
|
-
sunpeak mcp Start MCP server
|
|
356
139
|
sunpeak login Log in to Sunpeak
|
|
357
140
|
sunpeak logout Log out of Sunpeak
|
|
358
141
|
sunpeak push Push resources to repository
|
package/dist/chatgpt/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const simulatorUrl = require("../simulator-url-
|
|
3
|
+
const simulatorUrl = require("../simulator-url-CYMOGoB1.cjs");
|
|
4
4
|
exports.ChatGPTSimulator = simulatorUrl.ChatGPTSimulator;
|
|
5
5
|
exports.IframeResource = simulatorUrl.IframeResource;
|
|
6
6
|
exports.ThemeProvider = simulatorUrl.ThemeProvider;
|
package/dist/chatgpt/index.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const simulatorUrl = require("./simulator-url-
|
|
3
|
+
const simulatorUrl = require("./simulator-url-CYMOGoB1.cjs");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as clsx } from "./simulator-url-
|
|
2
|
-
import { C, I, S, T, c, v, s, q, i, r, w, t, e, f, g, h, j, u, k, l, m, n, d, b, o, p } from "./simulator-url-
|
|
1
|
+
import { a as clsx } from "./simulator-url-DG79-dU3.js";
|
|
2
|
+
import { C, I, S, T, c, v, s, q, i, r, w, t, e, f, g, h, j, u, k, l, m, n, d, b, o, p } from "./simulator-url-DG79-dU3.js";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
const MOBILE_BREAKPOINT = 768;
|
|
5
5
|
function useIsMobile() {
|
package/dist/mcp/entry.cjs
CHANGED
package/dist/mcp/entry.js
CHANGED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const FAVICON_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAOKAAADigGnjPUfAAA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rj6/kQHcgKxgxSEfQHFIAIrjYwAJIFQlgS0PXbzC4FGwoRjaKGdvAedL9nt7cy09lzPoA+5dAeB0M+wxHNszCtHqcZABXKWLEzc8HnzRBWAxFtC2N3HOroIEoH9wdO8ofLYt4TkPAfvwOE/vyr1y17p0VmHMd4RpWtg/y/MHRV/Q+tJSF8GqYX/9C4hs+Qe2hibBDXAH1e6Y37C5ZdxMM58VlTH8ILJAm8gCJ0BSMDOgICI141AbnM6YIDDgvb+/B8+Gil01b2yBsY4/9MdHDAFUaDs1H08OQhZRF5yC4MYZY18jFEjw/RkoLZwzNrnaIN5XjkVgMF9N5xifMZ3jTtvG+1iBUZcPv8iXO+ArSDJf1aj+SGeLX8ieBQjzMM4ujQw9bsbPS0ZQHsy2iks6EFkO0/N8ha2Lfy0JQNdjiSRju0kE2QzTMca6/mDJ/FtmBRt1Akt+SSLIRpgRW4zxsm9Xu3W+UcjvA3ANiCxgvuSvDD6y6mAQ3pjPXtczxi8BITXY4MtnhfWrBd+4nuofGNkAkq3CLm4EQgqMAT7Grs0Ba3tX4N+61xyatss/C/8e4pDcJX60TQhCk809zFbmA46DeiwmevgP86D4xtsNvbX4D3pTwkq/VSHSAAAAAElFTkSuQmCC";
|
|
2
|
+
export declare const FAVICON_BUFFER: Buffer<ArrayBuffer>;
|
package/dist/mcp/index.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const server = require("../server-
|
|
3
|
+
const server = require("../server-CcLDAGBE.cjs");
|
|
4
|
+
exports.FAVICON_BASE64 = server.FAVICON_BASE64;
|
|
5
|
+
exports.FAVICON_BUFFER = server.FAVICON_BUFFER;
|
|
4
6
|
exports.runMCPServer = server.runMCPServer;
|
|
5
7
|
//# sourceMappingURL=index.cjs.map
|
package/dist/mcp/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/dist/mcp/index.d.ts
CHANGED
package/dist/mcp/index.js
CHANGED
|
@@ -5,6 +5,8 @@ import path from "node:path";
|
|
|
5
5
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
6
|
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
const FAVICON_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAAOKAAADigGnjPUfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAf/SURBVHgB7Z1NTFRXFMfPHb4CFBxSG4gzg48mQgsmDgutM5tqNGqTmtqFbMGoqy5EWTUxERPTrlRcdaFE3DQpMamJLsD4uQFNFw6p2JYm8gJDS1KqIxSoIHN7z+MjQpF5j3nz3rtzzy+ZzDDvDYt3/vfce//3i4FJNG2XfxYmDwH4PuWchxlwjQPzA+E6IhYJEQudcRYDX/JhHhTf0PUHCXO/TYGm7dRmk/wEsGQTBVwehBg68nzsrK4/0te8710XjBKfnDzDGWsGQloY520jQz+dfOf11b7EUj/Dk/fxIxDZgJ7PfLtXywa+lV8EtO1hCn7WYRTogBYNr7ywLANQyc96/pcJlgSAdf4Mn3oCFPxsR4igqH6xl7BUBWCDDyj4KqAtxNrAyAALqX8QsoTSojkIvf8a6kJTEBTvIeM1Y7wb1wvnxD1vlv1mfCoXxqdz4JV44efhv/PFqwD640UQHxPvw0WQTYiqoAqrglz8Q/Tzz6R2BLwLBvxA+CXUioBHq8ehLjgFVkFB4Cu48HdklXtQDP3DxdA7UAK9v5UaIpEVEXPs3jczTQuLuj//JUhGpGbCCPZ+Efj1BNwOUBA9A6XQHSsTgigByUiItkAVE92+Js7ZVZAALOnH94xCQ2TMSO1eAquLrr4yaL9T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ON_BASE64, "base64");
|
|
8
10
|
function $constructor(name, initializer2, params) {
|
|
9
11
|
function init(inst, def) {
|
|
10
12
|
var _a;
|
|
@@ -4864,7 +4866,6 @@ function getViteResourceHtml(srcPath) {
|
|
|
4864
4866
|
<\/script>
|
|
4865
4867
|
<script type="module" src="${devServerUrl}/@vite/client"><\/script>
|
|
4866
4868
|
<script type="module">
|
|
4867
|
-
// Local network access check (matching skybridge)
|
|
4868
4869
|
(async () => {
|
|
4869
4870
|
if (!navigator.permissions?.query) return;
|
|
4870
4871
|
const protocol = window.location.protocol;
|
|
@@ -5096,6 +5097,32 @@ function runMCPServer(config2) {
|
|
|
5096
5097
|
res.end();
|
|
5097
5098
|
return;
|
|
5098
5099
|
}
|
|
5100
|
+
if (req.method === "GET" && url.pathname === "/") {
|
|
5101
|
+
res.writeHead(200, {
|
|
5102
|
+
"Content-Type": "text/html",
|
|
5103
|
+
"Access-Control-Allow-Origin": "*"
|
|
5104
|
+
});
|
|
5105
|
+
res.end(`<!DOCTYPE html>
|
|
5106
|
+
<html>
|
|
5107
|
+
<head>
|
|
5108
|
+
<meta charset="UTF-8" />
|
|
5109
|
+
<link rel="icon" type="image/png" href="/favicon.ico" />
|
|
5110
|
+
<title>Sunpeak MCP Server</title>
|
|
5111
|
+
</head>
|
|
5112
|
+
<body><h1>Sunpeak MCP Server</h1><p>Connect via <a href="/mcp">/mcp</a></p></body>
|
|
5113
|
+
</html>`);
|
|
5114
|
+
return;
|
|
5115
|
+
}
|
|
5116
|
+
if (req.method === "GET" && url.pathname === "/favicon.ico") {
|
|
5117
|
+
res.writeHead(200, {
|
|
5118
|
+
"Content-Type": "image/png",
|
|
5119
|
+
"Content-Length": FAVICON_BUFFER.length,
|
|
5120
|
+
"Cache-Control": "public, max-age=86400",
|
|
5121
|
+
"Access-Control-Allow-Origin": "*"
|
|
5122
|
+
});
|
|
5123
|
+
res.end(FAVICON_BUFFER);
|
|
5124
|
+
return;
|
|
5125
|
+
}
|
|
5099
5126
|
if (req.method === "GET" && url.pathname === ssePath) {
|
|
5100
5127
|
console.log(`[HTTP] ${req.method} ${url.pathname}`);
|
|
5101
5128
|
await handleSseRequest(res, config2, simulations, viteMode);
|
|
@@ -5127,7 +5154,6 @@ function runMCPServer(config2) {
|
|
|
5127
5154
|
httpServer.listen(port, () => {
|
|
5128
5155
|
console.log(`Sunpeak MCP server listening on http://localhost:${port}`);
|
|
5129
5156
|
console.log(` SSE stream: GET http://localhost:${port}${ssePath}`);
|
|
5130
|
-
console.log(` Message post endpoint: POST http://localhost:${port}${postPath}?sessionId=...`);
|
|
5131
5157
|
if (viteMode) {
|
|
5132
5158
|
console.log(` Vite HMR: enabled (source files served with hot reload)`);
|
|
5133
5159
|
}
|
|
@@ -5147,6 +5173,8 @@ function runMCPServer(config2) {
|
|
|
5147
5173
|
process.on("SIGINT", () => void shutdown());
|
|
5148
5174
|
}
|
|
5149
5175
|
export {
|
|
5176
|
+
FAVICON_BASE64 as F,
|
|
5177
|
+
FAVICON_BUFFER as a,
|
|
5150
5178
|
runMCPServer as r
|
|
5151
5179
|
};
|
|
5152
|
-
//# sourceMappingURL=server-
|
|
5180
|
+
//# sourceMappingURL=server-BI9Y531R.js.map
|