create-skybridge 0.0.0-dev.a05e8da → 0.0.0-dev.a08278b
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/index.js +102 -16
- package/package.json +1 -1
- package/templates/blank/AGENTS.md +1 -1
- package/templates/blank/README.md +2 -2
- package/templates/blank/package.json +6 -5
- package/templates/demo/AGENTS.md +1 -1
- package/templates/demo/README.md +2 -2
- package/templates/demo/package.json +7 -7
- package/templates/ecom/README.md +2 -2
- package/templates/ecom/node_modules/.bin/ladle +2 -2
- package/templates/ecom/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
2
3
|
import path from "node:path";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
5
|
import * as prompts from "@clack/prompts";
|
|
@@ -8,6 +9,7 @@ const OUTPUT_TAIL_LINES = 10;
|
|
|
8
9
|
const DEFAULT_PROJECT_NAME = "skybridge-project";
|
|
9
10
|
const PACKAGE_MANAGERS = ["bun", "deno", "npm", "pnpm", "yarn"];
|
|
10
11
|
const TEMPLATES = ["demo", "blank", "ecom"];
|
|
12
|
+
const REPO = "alpic-ai/skybridge";
|
|
11
13
|
const pkg = JSON.parse(fs.readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf-8"));
|
|
12
14
|
const version = pkg.version;
|
|
13
15
|
const HELP_MESSAGE = `Usage: skybridge create [path] [options]
|
|
@@ -18,14 +20,15 @@ Arguments:
|
|
|
18
20
|
path Where the project will be created. Prompted when omitted.
|
|
19
21
|
|
|
20
22
|
Options:
|
|
21
|
-
--blank
|
|
22
|
-
--ecom
|
|
23
|
-
--
|
|
24
|
-
--
|
|
25
|
-
--
|
|
26
|
-
--
|
|
27
|
-
--
|
|
28
|
-
--
|
|
23
|
+
--blank scaffold a minimal project without demo tools and views
|
|
24
|
+
--ecom scaffold the ecommerce template (search products, render carousel)
|
|
25
|
+
--example <name> scaffold a copy of examples/<name> from the latest Skybridge release
|
|
26
|
+
--overwrite remove existing files if target directory is not empty
|
|
27
|
+
--pm <choice> package manager to use (choices: ${PACKAGE_MANAGERS.join(", ")}. default to npm when none is provided or infered)
|
|
28
|
+
--skip-skills skip installing coding agent skills
|
|
29
|
+
--start start dev server
|
|
30
|
+
--yes skip prompts and use default values for unprovided options
|
|
31
|
+
--help display this help message
|
|
29
32
|
|
|
30
33
|
Non-interactive usage:
|
|
31
34
|
Mandatory: path argument and --yes option
|
|
@@ -70,7 +73,7 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
70
73
|
"start",
|
|
71
74
|
"yes",
|
|
72
75
|
],
|
|
73
|
-
string: ["pm"],
|
|
76
|
+
string: ["pm", "example"],
|
|
74
77
|
alias: { h: "help" },
|
|
75
78
|
});
|
|
76
79
|
if (argv.help) {
|
|
@@ -82,6 +85,13 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
82
85
|
if (yes && !targetDir) {
|
|
83
86
|
abort("The target directory is required in non-interactive mode.", "Example: skybridge create my-app --yes");
|
|
84
87
|
}
|
|
88
|
+
if (argv.example !== undefined && !/^[\w.-]+$/.test(argv.example)) {
|
|
89
|
+
abort("--example requires a name, e.g. --example auth-descope.");
|
|
90
|
+
}
|
|
91
|
+
if (argv.example && (argv.blank || argv.ecom)) {
|
|
92
|
+
abort("Cannot combine --example with --blank or --ecom.");
|
|
93
|
+
}
|
|
94
|
+
const example = argv.example;
|
|
85
95
|
let pm = parsePackageManager(argv.pm || "");
|
|
86
96
|
if (argv.pm && !pm) {
|
|
87
97
|
abort(`Invalid --pm value "${argv.pm}". Expected one of: ${PACKAGE_MANAGERS.join(", ")}.`);
|
|
@@ -104,6 +114,18 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
104
114
|
targetDir = sanitizeTargetDir(choice);
|
|
105
115
|
}
|
|
106
116
|
// 2. Existing-directory handling
|
|
117
|
+
let downloaded;
|
|
118
|
+
if (example) {
|
|
119
|
+
Spinner.start(`Downloading ${example} example`);
|
|
120
|
+
try {
|
|
121
|
+
downloaded = await downloadExample(example);
|
|
122
|
+
Spinner.stop(`Downloaded ${example} example`);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
Spinner.error(`Failed to download ${example} example`);
|
|
126
|
+
abort(error instanceof Error ? error.message : String(error));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
107
129
|
if (fs.existsSync(targetDir) && !isEmpty(targetDir)) {
|
|
108
130
|
if (argv.overwrite) {
|
|
109
131
|
emptyDir(targetDir);
|
|
@@ -136,7 +158,7 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
136
158
|
}
|
|
137
159
|
template = "ecom";
|
|
138
160
|
}
|
|
139
|
-
if (!template) {
|
|
161
|
+
if (!template && !example) {
|
|
140
162
|
if (yes) {
|
|
141
163
|
template = "demo";
|
|
142
164
|
}
|
|
@@ -170,23 +192,31 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
170
192
|
}
|
|
171
193
|
// 4. Copy template
|
|
172
194
|
const root = path.resolve(targetDir);
|
|
173
|
-
|
|
195
|
+
const templatesDir = fileURLToPath(new URL("../templates", import.meta.url));
|
|
196
|
+
const source = downloaded?.source ?? path.join(templatesDir, template ?? "demo");
|
|
197
|
+
Spinner.start(`Copying ${example ?? template} template`);
|
|
174
198
|
try {
|
|
175
|
-
|
|
176
|
-
fs.cpSync(templateDir, root, {
|
|
199
|
+
fs.cpSync(source, root, {
|
|
177
200
|
recursive: true,
|
|
178
201
|
filter: (src) => [".npmrc"].every((file) => !src.endsWith(file)),
|
|
179
202
|
});
|
|
203
|
+
const gitignore = path.join(root, ".gitignore");
|
|
180
204
|
const gitignoreSource = path.join(root, "_gitignore");
|
|
181
205
|
if (fs.existsSync(gitignoreSource)) {
|
|
182
|
-
fs.renameSync(gitignoreSource,
|
|
206
|
+
fs.renameSync(gitignoreSource, gitignore);
|
|
207
|
+
}
|
|
208
|
+
else if (!fs.existsSync(gitignore)) {
|
|
209
|
+
fs.copyFileSync(path.join(templatesDir, "demo", "_gitignore"), gitignore);
|
|
183
210
|
}
|
|
184
|
-
Spinner.stop(`Copied ${template} template`);
|
|
211
|
+
Spinner.stop(`Copied ${example ?? template} template`);
|
|
185
212
|
}
|
|
186
213
|
catch (error) {
|
|
187
214
|
Spinner.error("Failed to copy template");
|
|
188
215
|
abort(String(error));
|
|
189
216
|
}
|
|
217
|
+
finally {
|
|
218
|
+
downloaded?.cleanup();
|
|
219
|
+
}
|
|
190
220
|
// 5. Set package.json name to the project dir basename
|
|
191
221
|
try {
|
|
192
222
|
const pkgPath = path.join(root, "package.json");
|
|
@@ -294,7 +324,7 @@ export async function init(args = process.argv.slice(2)) {
|
|
|
294
324
|
}
|
|
295
325
|
// 8. pnpm ≥10 fails installs unless esbuild's build script is allow-listed
|
|
296
326
|
if (pm === "pnpm") {
|
|
297
|
-
fs.writeFileSync(path.join(root, "pnpm-workspace.yaml"), 'packages:\n - "."\nonlyBuiltDependencies:\n - esbuild\nallowBuilds:\n esbuild: true\n');
|
|
327
|
+
fs.writeFileSync(path.join(root, "pnpm-workspace.yaml"), 'packages:\n - "."\nonlyBuiltDependencies:\n - esbuild\nallowBuilds:\n esbuild: true\n "@swc/core": false\n msw: false\n');
|
|
298
328
|
}
|
|
299
329
|
// 9. Always install dependencies
|
|
300
330
|
Spinner.start(`Installing dependencies with ${pm}`);
|
|
@@ -340,6 +370,62 @@ ${scriptCommand(pm, "deploy")}`);
|
|
|
340
370
|
Chat: https://discord.alpic.ai
|
|
341
371
|
Docs: https://docs.skybridge.tech`);
|
|
342
372
|
}
|
|
373
|
+
async function fetchJson(url) {
|
|
374
|
+
const res = await fetch(url, {
|
|
375
|
+
headers: { accept: "application/vnd.github+json" },
|
|
376
|
+
});
|
|
377
|
+
if (!res.ok) {
|
|
378
|
+
throw new Error(`GitHub returned ${res.status} for ${url}.`);
|
|
379
|
+
}
|
|
380
|
+
return res.json();
|
|
381
|
+
}
|
|
382
|
+
async function downloadExample(name) {
|
|
383
|
+
const api = `https://api.github.com/repos/${REPO}`;
|
|
384
|
+
const { tag_name: tag } = await fetchJson(`${api}/releases/latest`);
|
|
385
|
+
const entries = await fetchJson(`${api}/contents/examples?ref=${tag}`);
|
|
386
|
+
const available = entries
|
|
387
|
+
.filter((entry) => entry.type === "dir")
|
|
388
|
+
.map((entry) => entry.name);
|
|
389
|
+
if (!available.includes(name)) {
|
|
390
|
+
throw new Error(`Unknown example "${name}". Available examples:\n ${available.join("\n ")}`);
|
|
391
|
+
}
|
|
392
|
+
const res = await fetch(`https://codeload.github.com/${REPO}/tar.gz/${tag}`);
|
|
393
|
+
if (!res.ok) {
|
|
394
|
+
throw new Error(`GitHub returned ${res.status} while fetching ${REPO}.`);
|
|
395
|
+
}
|
|
396
|
+
const archive = Buffer.from(await res.arrayBuffer());
|
|
397
|
+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "skybridge-example-"));
|
|
398
|
+
const cleanup = () => fs.rmSync(tmp, { recursive: true, force: true });
|
|
399
|
+
try {
|
|
400
|
+
const tar = spawn("tar", ["-xz", "-C", tmp], {
|
|
401
|
+
stdio: ["pipe", "ignore", "pipe"],
|
|
402
|
+
});
|
|
403
|
+
let stderr = "";
|
|
404
|
+
tar.stderr?.on("data", (chunk) => {
|
|
405
|
+
stderr += chunk.toString();
|
|
406
|
+
});
|
|
407
|
+
const exit = new Promise((resolve, reject) => {
|
|
408
|
+
tar.on("error", (error) => reject(error.code === "ENOENT"
|
|
409
|
+
? new Error("`tar` is required to extract the example.")
|
|
410
|
+
: error));
|
|
411
|
+
tar.on("close", (status) => status === 0
|
|
412
|
+
? resolve()
|
|
413
|
+
: reject(new Error(`tar exited with ${status}: ${stderr.trim()}`)));
|
|
414
|
+
});
|
|
415
|
+
tar.stdin?.on("error", () => { });
|
|
416
|
+
tar.stdin?.end(archive);
|
|
417
|
+
await exit;
|
|
418
|
+
const [extracted] = fs.readdirSync(tmp);
|
|
419
|
+
if (!extracted) {
|
|
420
|
+
throw new Error("Downloaded archive is empty.");
|
|
421
|
+
}
|
|
422
|
+
return { source: path.join(tmp, extracted, "examples", name), cleanup };
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
cleanup();
|
|
426
|
+
throw error;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
343
429
|
function cancel() {
|
|
344
430
|
prompts.cancel("Operation cancelled");
|
|
345
431
|
process.exit(0);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This is a ChatGPT/MCP
|
|
1
|
+
This is a ChatGPT/MCP App built with Skybridge. ALWAYS use the `chatgpt-app-builder` skill when planning or updating the codebase.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Skybridge Boilerplate
|
|
2
2
|
|
|
3
|
-
A minimal TypeScript boilerplate for building MCP and ChatGPT
|
|
3
|
+
A minimal TypeScript boilerplate for building MCP Apps and ChatGPT plugins with the [Skybridge](https://docs.skybridge.tech) framework.
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
@@ -87,7 +87,7 @@ The simplest way to deploy your app is by running the `deploy` command, which wi
|
|
|
87
87
|
|
|
88
88
|
## Resources
|
|
89
89
|
- [Skybridge Documentation](https://docs.skybridge.tech/)
|
|
90
|
-
- [
|
|
90
|
+
- [ChatGPT Plugins Documentation](https://developers.openai.com/plugins)
|
|
91
91
|
- [MCP Apps Documentation](https://github.com/modelcontextprotocol/ext-apps/tree/main)
|
|
92
92
|
- [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
|
|
93
93
|
- [Alpic Documentation](https://docs.alpic.ai/)
|
|
@@ -12,18 +12,19 @@
|
|
|
12
12
|
"deploy": "alpic deploy"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"skybridge": "^0.0.0-dev.
|
|
16
|
-
"vite": "^8.1.5"
|
|
15
|
+
"skybridge": "^0.0.0-dev.a08278b",
|
|
16
|
+
"vite": "^8.1.5",
|
|
17
|
+
"zod": "^4.4.3"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@skybridge/devtools": "^0.0.0-dev.
|
|
20
|
-
"@skybridge/vite-plugin": "^0.0.0-dev.
|
|
20
|
+
"@skybridge/devtools": "^0.0.0-dev.a08278b",
|
|
21
|
+
"@skybridge/vite-plugin": "^0.0.0-dev.a08278b",
|
|
21
22
|
"@types/node": "^24.13.3",
|
|
22
23
|
"alpic": "^1.155.0",
|
|
23
24
|
"tsx": "^4.23.1",
|
|
24
25
|
"typescript": "^6.0.3"
|
|
25
26
|
},
|
|
26
27
|
"engines": {
|
|
27
|
-
"node": ">=24.
|
|
28
|
+
"node": ">=24.0.0"
|
|
28
29
|
}
|
|
29
30
|
}
|
package/templates/demo/AGENTS.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This is a ChatGPT/MCP
|
|
1
|
+
This is a ChatGPT/MCP App built with Skybridge. ALWAYS use the `chatgpt-app-builder` skill when planning or updating the codebase.
|
package/templates/demo/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Skybridge Template
|
|
2
2
|
|
|
3
|
-
A starter TypeScript template for building MCP and ChatGPT
|
|
3
|
+
A starter TypeScript template for building MCP Apps and ChatGPT plugins with the [Skybridge](https://docs.skybridge.tech) framework.
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
@@ -91,7 +91,7 @@ The simplest way to deploy your app is by running the `deploy` command, which wi
|
|
|
91
91
|
|
|
92
92
|
## Resources
|
|
93
93
|
- [Skybridge Documentation](https://docs.skybridge.tech/)
|
|
94
|
-
- [
|
|
94
|
+
- [ChatGPT Plugins Documentation](https://developers.openai.com/plugins)
|
|
95
95
|
- [MCP Apps Documentation](https://github.com/modelcontextprotocol/ext-apps/tree/main)
|
|
96
96
|
- [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
|
|
97
97
|
- [Alpic Documentation](https://docs.alpic.ai/)
|
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
"lucide-react": "^1.25.0",
|
|
19
19
|
"react": "^19.2.7",
|
|
20
20
|
"react-dom": "^19.2.7",
|
|
21
|
-
"skybridge": "^0.0.0-dev.
|
|
21
|
+
"skybridge": "^0.0.0-dev.a08278b",
|
|
22
22
|
"sonner": "^2.0.7",
|
|
23
23
|
"tw-animate-css": "^1.4.0",
|
|
24
24
|
"vite": "^8.1.5",
|
|
25
25
|
"zod": "^4.4.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@ai-sdk/anthropic": "^
|
|
29
|
-
"@skybridge/devtools": "^0.0.0-dev.
|
|
30
|
-
"@skybridge/test": "
|
|
31
|
-
"@skybridge/vite-plugin": "^0.0.0-dev.
|
|
28
|
+
"@ai-sdk/anthropic": "^4.0.0",
|
|
29
|
+
"@skybridge/devtools": "^0.0.0-dev.a08278b",
|
|
30
|
+
"@skybridge/test": "^0.0.0-dev.a08278b",
|
|
31
|
+
"@skybridge/vite-plugin": "^0.0.0-dev.a08278b",
|
|
32
32
|
"@tailwindcss/vite": "^4.3.3",
|
|
33
33
|
"@types/node": "^24.13.3",
|
|
34
34
|
"@types/react": "^19.2.17",
|
|
35
35
|
"@types/react-dom": "^19.2.3",
|
|
36
36
|
"@vitejs/plugin-react": "^6.0.3",
|
|
37
|
-
"ai": "^
|
|
37
|
+
"ai": "^7.0.0",
|
|
38
38
|
"alpic": "^1.155.0",
|
|
39
39
|
"tailwindcss": "^4.3.3",
|
|
40
40
|
"tsx": "^4.23.1",
|
|
@@ -42,6 +42,6 @@
|
|
|
42
42
|
"vitest": "^4.1.10"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": ">=24.
|
|
45
|
+
"node": ">=24.0.0"
|
|
46
46
|
}
|
|
47
47
|
}
|
package/templates/ecom/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Skybridge Boilerplate
|
|
2
2
|
|
|
3
|
-
A minimal TypeScript boilerplate for building MCP and ChatGPT
|
|
3
|
+
A minimal TypeScript boilerplate for building MCP Apps and ChatGPT plugins with the [Skybridge](https://docs.skybridge.tech) framework.
|
|
4
4
|
|
|
5
5
|
## Getting Started
|
|
6
6
|
|
|
@@ -87,7 +87,7 @@ The simplest way to deploy your app is by running the `deploy` command, which wi
|
|
|
87
87
|
|
|
88
88
|
## Resources
|
|
89
89
|
- [Skybridge Documentation](https://docs.skybridge.tech/)
|
|
90
|
-
- [
|
|
90
|
+
- [ChatGPT Plugins Documentation](https://developers.openai.com/plugins)
|
|
91
91
|
- [MCP Apps Documentation](https://github.com/modelcontextprotocol/ext-apps/tree/main)
|
|
92
92
|
- [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
|
|
93
93
|
- [Alpic Documentation](https://docs.alpic.ai/)
|
|
@@ -10,9 +10,9 @@ case `uname` in
|
|
|
10
10
|
esac
|
|
11
11
|
|
|
12
12
|
if [ -z "$NODE_PATH" ]; then
|
|
13
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@ladle+react@5.1.1_@types+node@24.13.3_@types+react@19.2.17_jiti@2.
|
|
13
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@ladle+react@5.1.1_@swc+helpers@0.5.23_@types+node@24.13.3_@types+react@19.2.17_jiti@2._9105ecfa2ac4b29fe87a036530c3844f/node_modules/@ladle/react/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@ladle+react@5.1.1_@swc+helpers@0.5.23_@types+node@24.13.3_@types+react@19.2.17_jiti@2._9105ecfa2ac4b29fe87a036530c3844f/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules"
|
|
14
14
|
else
|
|
15
|
-
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@ladle+react@5.1.1_@types+node@24.13.3_@types+react@19.2.17_jiti@2.
|
|
15
|
+
export NODE_PATH="/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@ladle+react@5.1.1_@swc+helpers@0.5.23_@types+node@24.13.3_@types+react@19.2.17_jiti@2._9105ecfa2ac4b29fe87a036530c3844f/node_modules/@ladle/react/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/@ladle+react@5.1.1_@swc+helpers@0.5.23_@types+node@24.13.3_@types+react@19.2.17_jiti@2._9105ecfa2ac4b29fe87a036530c3844f/node_modules:/home/runner/work/skybridge/skybridge/node_modules/.pnpm/node_modules:$NODE_PATH"
|
|
16
16
|
fi
|
|
17
17
|
if [ -x "$basedir/node" ]; then
|
|
18
18
|
exec "$basedir/node" "$basedir/../@ladle/react/lib/cli/cli.js" "$@"
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"react": "^19.2.4",
|
|
18
18
|
"react-dom": "^19.2.4",
|
|
19
|
-
"skybridge": "^0.0.0-dev.
|
|
19
|
+
"skybridge": "^0.0.0-dev.a08278b",
|
|
20
20
|
"vite": "^8.1.3",
|
|
21
21
|
"zod": "^4.4.3"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@ladle/react": "^5.1.1",
|
|
25
|
-
"@skybridge/devtools": "^0.0.0-dev.
|
|
26
|
-
"@skybridge/vite-plugin": "^0.0.0-dev.
|
|
25
|
+
"@skybridge/devtools": "^0.0.0-dev.a08278b",
|
|
26
|
+
"@skybridge/vite-plugin": "^0.0.0-dev.a08278b",
|
|
27
27
|
"@types/node": "^24.13.2",
|
|
28
28
|
"@types/react": "^19.2.14",
|
|
29
29
|
"@types/react-dom": "^19.2.3",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"typescript": "^6.0.3"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
|
-
"node": ">=24.
|
|
40
|
+
"node": ">=24.0.0"
|
|
41
41
|
}
|
|
42
42
|
}
|