create-skybridge 0.0.0-dev.98c13d6 → 0.0.0-dev.98f4db2

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.
Files changed (66) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.d.ts +1 -1
  3. package/dist/index.js +323 -120
  4. package/index.js +6 -1
  5. package/package.json +16 -12
  6. package/templates/blank/.dockerignore +4 -0
  7. package/templates/blank/AGENTS.md +1 -0
  8. package/templates/blank/Dockerfile +53 -0
  9. package/templates/blank/README.md +91 -0
  10. package/templates/blank/_gitignore +6 -0
  11. package/templates/blank/alpic.json +3 -0
  12. package/templates/blank/node_modules/.bin/alpic +21 -0
  13. package/templates/blank/node_modules/.bin/sb +21 -0
  14. package/templates/blank/node_modules/.bin/skybridge +21 -0
  15. package/templates/blank/node_modules/.bin/tsc +21 -0
  16. package/templates/blank/node_modules/.bin/tsserver +21 -0
  17. package/templates/blank/node_modules/.bin/vite +21 -0
  18. package/templates/blank/package.json +28 -0
  19. package/templates/blank/src/helpers.ts +4 -0
  20. package/templates/blank/src/server.ts +21 -0
  21. package/templates/blank/src/vite-manifest.d.ts +4 -0
  22. package/templates/blank/tsconfig.json +5 -0
  23. package/templates/blank/vite.config.ts +6 -0
  24. package/templates/demo/.dockerignore +4 -0
  25. package/templates/demo/AGENTS.md +1 -0
  26. package/templates/demo/Dockerfile +53 -0
  27. package/templates/demo/README.md +94 -0
  28. package/templates/demo/_gitignore +6 -0
  29. package/templates/demo/alpic.json +3 -0
  30. package/templates/demo/node_modules/.bin/alpic +21 -0
  31. package/templates/demo/node_modules/.bin/sb +21 -0
  32. package/templates/demo/node_modules/.bin/skybridge +21 -0
  33. package/templates/demo/node_modules/.bin/tsc +21 -0
  34. package/templates/demo/node_modules/.bin/tsserver +21 -0
  35. package/templates/demo/node_modules/.bin/tsx +21 -0
  36. package/templates/demo/node_modules/.bin/vite +21 -0
  37. package/templates/demo/package.json +41 -0
  38. package/templates/demo/src/helpers.ts +4 -0
  39. package/templates/demo/src/index.css +59 -0
  40. package/templates/demo/src/server.ts +77 -0
  41. package/templates/demo/src/views/components/doc-link.tsx +22 -0
  42. package/templates/demo/src/views/components/doc.tsx +21 -0
  43. package/templates/demo/src/views/components/nav.tsx +31 -0
  44. package/templates/demo/src/views/components/progress.tsx +35 -0
  45. package/templates/demo/src/views/components/steps/outro.tsx +68 -0
  46. package/templates/demo/src/views/components/steps/state.tsx +47 -0
  47. package/templates/demo/src/views/components/steps/tool-call.tsx +53 -0
  48. package/templates/demo/src/views/components/steps/tool-output.tsx +40 -0
  49. package/templates/demo/src/views/images/mascot/beret.png +0 -0
  50. package/templates/demo/src/views/images/mascot/chapka.png +0 -0
  51. package/templates/demo/src/views/images/mascot/cowboy-hat.png +0 -0
  52. package/templates/demo/src/views/images/mascot/fez.png +0 -0
  53. package/templates/demo/src/views/images/mascot/jester-hat.png +0 -0
  54. package/templates/demo/src/views/images/mascot/mitre.png +0 -0
  55. package/templates/demo/src/views/images/mascot/non-la.png +0 -0
  56. package/templates/demo/src/views/images/mascot/original.png +0 -0
  57. package/templates/demo/src/views/images/mascot/propeller-beanie.png +0 -0
  58. package/templates/demo/src/views/images/mascot/ski-mask.png +0 -0
  59. package/templates/demo/src/views/images/mascot/sombrero.png +0 -0
  60. package/templates/demo/src/views/images/mascot/top-hat.png +0 -0
  61. package/templates/demo/src/views/images/mascot/viking-helmet.png +0 -0
  62. package/templates/demo/src/views/onboarding.tsx +63 -0
  63. package/templates/demo/src/views/use-mascot.ts +60 -0
  64. package/templates/demo/src/vite-manifest.d.ts +4 -0
  65. package/templates/demo/tsconfig.json +11 -0
  66. package/templates/demo/vite.config.ts +14 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Alpic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export declare function init(args?: string[]): Promise<void>;
package/dist/index.js CHANGED
@@ -1,156 +1,359 @@
1
- import { spawnSync } from "node:child_process";
2
1
  import fs from "node:fs";
3
2
  import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
4
  import * as prompts from "@clack/prompts";
5
+ import spawn from "cross-spawn";
5
6
  import mri from "mri";
6
- const argv = mri(process.argv.slice(2), {
7
- boolean: ["help", "overwrite"],
8
- alias: { h: "help" },
9
- });
10
- const cwd = process.cwd();
11
- const TEMPLATE_REPO = "https://github.com/alpic-ai/apps-sdk-template";
12
- const defaultProjectName = "skybridge-project";
13
- // prettier-ignore
14
- const helpMessage = `\
15
- Usage: create-skybridge [OPTION]... [DIRECTORY]
7
+ const DEFAULT_PROJECT_NAME = "skybridge-project";
8
+ const PACKAGE_MANAGERS = ["bun", "deno", "npm", "pnpm", "yarn"];
9
+ const TEMPLATES = ["demo", "blank"];
10
+ const pkg = JSON.parse(fs.readFileSync(fileURLToPath(new URL("../package.json", import.meta.url)), "utf-8"));
11
+ const version = pkg.version;
12
+ const HELP_MESSAGE = `Usage: skybridge create [path] [options]
16
13
 
17
- Create a new Skybridge project by cloning the starter template.
14
+ Skybridge v${version} - the fullstack framework for building MCP Apps
15
+
16
+ Arguments:
17
+ path Where the project will be created. Prompted when omitted.
18
18
 
19
19
  Options:
20
- -h, --help show this help message
21
- --overwrite remove existing files in target directory
20
+ --blank scaffold a minimal project without demo tools and views
21
+ --overwrite remove existing files if target directory is not empty
22
+ --pm <choice> package manager to use (choices: ${PACKAGE_MANAGERS.join(", ")}. default: npm)
23
+ --skip-skills skip installing coding agent skills
24
+ --start start dev server
25
+ --yes skip prompts and use default values for unprovided options
26
+ --help display this help message
22
27
 
23
- Examples:
24
- create-skybridge my-app
25
- create-skybridge . --overwrite
26
- `;
27
- function run([command, ...args], options) {
28
- if (!command) {
29
- throw new Error("Command is required");
30
- }
31
- const { status, error } = spawnSync(command, args, options);
32
- if (status != null && status > 0) {
33
- process.exit(status);
34
- }
35
- if (error) {
36
- console.error(`\n${command} ${args.join(" ")} error!`);
37
- console.error(error);
38
- process.exit(1);
39
- }
40
- }
41
- async function init() {
42
- const argTargetDir = argv._[0]
43
- ? formatTargetDir(String(argv._[0]))
44
- : undefined;
45
- const argOverwrite = argv.overwrite;
46
- const help = argv.help;
47
- if (help) {
48
- console.log(helpMessage);
28
+ Non-interactive usage:
29
+ Mandatory: path argument and --yes option
30
+ Example: skybridge create my-app --yes`;
31
+ const isTTY = process.stdout.isTTY;
32
+ const _spinner = prompts.spinner();
33
+ const Spinner = {
34
+ start(msg) {
35
+ if (!isTTY) {
36
+ prompts.log.info(msg);
37
+ }
38
+ else {
39
+ _spinner.clear();
40
+ _spinner.start(msg);
41
+ }
42
+ },
43
+ stop(msg) {
44
+ if (!isTTY) {
45
+ prompts.log.success(msg);
46
+ }
47
+ else {
48
+ _spinner.stop(msg);
49
+ }
50
+ },
51
+ error(msg) {
52
+ if (!isTTY) {
53
+ prompts.log.error(msg);
54
+ }
55
+ else {
56
+ _spinner.error(msg);
57
+ }
58
+ },
59
+ };
60
+ export async function init(args = process.argv.slice(2)) {
61
+ const argv = mri(args, {
62
+ boolean: ["help", "blank", "overwrite", "skip-skills", "start", "yes"],
63
+ string: ["pm"],
64
+ alias: { h: "help" },
65
+ });
66
+ if (argv.help) {
67
+ console.log(HELP_MESSAGE);
49
68
  return;
50
69
  }
51
- const interactive = process.stdin.isTTY;
52
- const cancel = () => prompts.cancel("Operation cancelled");
53
- // 1. Get project name and target dir
54
- let targetDir = argTargetDir;
70
+ const { yes } = argv;
71
+ let targetDir = argv._[0] ? sanitizeTargetDir(String(argv._[0])) : undefined;
72
+ if (yes && !targetDir) {
73
+ abort("The target directory is required in non-interactive mode.", "Example: skybridge create my-app --yes");
74
+ }
75
+ let pm = parsePackageManager(argv.pm || "");
76
+ if (argv.pm && !pm) {
77
+ abort(`Invalid --pm value "${argv.pm}". Expected one of: ${PACKAGE_MANAGERS.join(", ")}.`);
78
+ }
79
+ console.log(); // cosmetic line break
80
+ prompts.intro(`\x1b[1;36m⛰ Welcome to Skybridge v${version} \x1b[22m- the fullstack framework for building MCP Apps\x1b[0m`);
81
+ // 1. Target directory
55
82
  if (!targetDir) {
56
- if (interactive) {
57
- const projectName = await prompts.text({
58
- message: "Project name:",
59
- defaultValue: defaultProjectName,
60
- placeholder: defaultProjectName,
61
- validate: (value) => {
62
- return value.length === 0 || formatTargetDir(value).length > 0
63
- ? undefined
64
- : "Invalid project name";
65
- },
66
- });
67
- if (prompts.isCancel(projectName))
68
- return cancel();
69
- targetDir = formatTargetDir(projectName);
70
- }
71
- else {
72
- targetDir = defaultProjectName;
83
+ const choice = await prompts.text({
84
+ message: "Project directory:",
85
+ placeholder: DEFAULT_PROJECT_NAME,
86
+ defaultValue: DEFAULT_PROJECT_NAME,
87
+ validate: (value) => !value || sanitizeTargetDir(value).length > 0
88
+ ? undefined
89
+ : "Invalid project name",
90
+ });
91
+ if (prompts.isCancel(choice)) {
92
+ return cancel();
73
93
  }
94
+ targetDir = sanitizeTargetDir(choice);
74
95
  }
75
- // 2. Handle directory if exist and not empty
96
+ // 2. Existing-directory handling
76
97
  if (fs.existsSync(targetDir) && !isEmpty(targetDir)) {
77
- let overwrite = argOverwrite ? "yes" : undefined;
78
- if (!overwrite) {
79
- if (interactive) {
80
- const res = await prompts.select({
81
- message: (targetDir === "."
82
- ? "Current directory"
83
- : `Target directory "${targetDir}"`) +
84
- ` is not empty. Please choose how to proceed:`,
85
- options: [
86
- {
87
- label: "Cancel operation",
88
- value: "no",
89
- },
90
- {
91
- label: "Remove existing files and continue",
92
- value: "yes",
93
- },
94
- ],
95
- });
96
- if (prompts.isCancel(res))
97
- return cancel();
98
- overwrite = res;
99
- }
100
- else {
101
- overwrite = "no";
98
+ if (argv.overwrite) {
99
+ emptyDir(targetDir);
100
+ }
101
+ else if (yes) {
102
+ prompts.log.error(`Target directory "${targetDir}" is not empty. Use --overwrite to remove existing files.`);
103
+ process.exit(1);
104
+ }
105
+ else {
106
+ const ok = await prompts.confirm({
107
+ message: `Target directory "${targetDir}" is not empty. Remove existing files?`,
108
+ initialValue: true,
109
+ });
110
+ if (prompts.isCancel(ok) || !ok) {
111
+ return cancel();
102
112
  }
113
+ Spinner.start(`Cleaning up ${targetDir}`);
114
+ emptyDir(targetDir);
115
+ Spinner.stop(`Cleaned up ${targetDir}`);
103
116
  }
104
- switch (overwrite) {
105
- case "yes":
106
- emptyDir(targetDir);
107
- break;
108
- case "no":
109
- cancel();
110
- return;
117
+ }
118
+ // 3. Template
119
+ let template;
120
+ if (argv.blank) {
121
+ template = "blank";
122
+ }
123
+ else if (yes) {
124
+ template = "demo";
125
+ }
126
+ else {
127
+ const choice = await prompts.select({
128
+ message: "Choose a template:",
129
+ options: [
130
+ {
131
+ value: "demo",
132
+ label: "demo",
133
+ hint: "starter code with tools and UI",
134
+ },
135
+ {
136
+ value: "blank",
137
+ label: "blank",
138
+ hint: "minimal boilerplate without tools",
139
+ },
140
+ ],
141
+ initialValue: "demo",
142
+ });
143
+ if (prompts.isCancel(choice)) {
144
+ return cancel();
111
145
  }
146
+ template = choice;
112
147
  }
113
- const root = path.join(cwd, targetDir);
114
- // 3. Clone the repository
115
- prompts.log.step(`Cloning template from ${TEMPLATE_REPO}...`);
148
+ // 4. Copy template
149
+ const root = path.resolve(targetDir);
150
+ Spinner.start(`Copying ${template} template`);
116
151
  try {
117
- // Clone directly to target directory
118
- run(["git", "clone", "--depth", "1", TEMPLATE_REPO, root], {
119
- stdio: "inherit",
152
+ const templateDir = fileURLToPath(new URL(`../templates/${template}`, import.meta.url));
153
+ fs.cpSync(templateDir, root, {
154
+ recursive: true,
155
+ filter: (src) => [".npmrc"].every((file) => !src.endsWith(file)),
120
156
  });
121
- // Remove .git directory to start fresh
122
- const gitDir = path.join(root, ".git");
123
- if (fs.existsSync(gitDir)) {
124
- fs.rmSync(gitDir, { recursive: true, force: true });
157
+ const gitignoreSource = path.join(root, "_gitignore");
158
+ if (fs.existsSync(gitignoreSource)) {
159
+ fs.renameSync(gitignoreSource, path.join(root, ".gitignore"));
125
160
  }
126
- prompts.log.success(`Project created in ${root}`);
127
- prompts.outro(`Done! Next steps:\n\n cd ${targetDir}\n pnpm install\n pnpm dev`);
161
+ Spinner.stop(`Copied ${template} template`);
162
+ }
163
+ catch (error) {
164
+ Spinner.error("Failed to copy template");
165
+ abort(String(error));
166
+ }
167
+ // 5. Set package.json name to the project dir basename
168
+ try {
169
+ const pkgPath = path.join(root, "package.json");
170
+ const projectPkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
171
+ projectPkg.name = path.basename(root);
172
+ fs.writeFileSync(pkgPath, `${JSON.stringify(projectPkg, null, 2)}\n`);
128
173
  }
129
174
  catch (error) {
130
- prompts.log.error("Failed to clone repository");
131
- console.error(error);
132
- process.exit(1);
175
+ abort("Failed to update project name in package.json.", String(error));
133
176
  }
177
+ // 6. Skills install (single Y/n prompt)
178
+ let installSkills;
179
+ if (argv["skip-skills"]) {
180
+ installSkills = false;
181
+ }
182
+ else if (yes) {
183
+ installSkills = true;
184
+ }
185
+ else {
186
+ const choice = await prompts.confirm({
187
+ message: "Install coding agent skills? (recommended)",
188
+ initialValue: true,
189
+ });
190
+ if (prompts.isCancel(choice)) {
191
+ return cancel();
192
+ }
193
+ installSkills = choice;
194
+ }
195
+ if (installSkills) {
196
+ Spinner.start("Installing coding agent skills");
197
+ const status = await spawnAsync("npx", [
198
+ "--yes",
199
+ "skills",
200
+ "add",
201
+ "alpic-ai/skybridge",
202
+ "--skill",
203
+ "chatgpt-app-builder",
204
+ "--agent",
205
+ "universal",
206
+ "claude-code",
207
+ "--yes",
208
+ ], { stdio: "ignore", cwd: root });
209
+ if (status === 0) {
210
+ Spinner.stop("Installed coding agent skills");
211
+ }
212
+ else {
213
+ Spinner.error("Failed to install coding agent skills");
214
+ prompts.log.warn("Install them later with `npx skills add alpic-ai/skybridge`.");
215
+ }
216
+ }
217
+ // 7. Package manager — autodetect, prompt only if detection fails (interactive)
218
+ if (!pm) {
219
+ pm = detectPackageManager() || "npm";
220
+ }
221
+ if (!yes) {
222
+ const choice = await prompts.select({
223
+ message: "Choose a package manager:",
224
+ options: PACKAGE_MANAGERS.map((value) => ({ value })),
225
+ initialValue: pm,
226
+ });
227
+ if (prompts.isCancel(choice)) {
228
+ return cancel();
229
+ }
230
+ pm = choice;
231
+ }
232
+ // 8. Always install dependencies
233
+ Spinner.start(`Installing dependencies with ${pm}`);
234
+ const installStatus = await spawnAsync(pm, ["install"], {
235
+ stdio: "ignore",
236
+ cwd: root,
237
+ });
238
+ if (installStatus === 0) {
239
+ Spinner.stop(`Installed dependencies with ${pm}`);
240
+ }
241
+ else {
242
+ Spinner.error("Dependency installation failed");
243
+ abort(`Try manually: cd ${targetDir} && ${pm} install`);
244
+ }
245
+ // 9. Start dev server?
246
+ let start = false;
247
+ if (argv.start) {
248
+ start = true;
249
+ }
250
+ else if (!yes) {
251
+ const choice = await prompts.confirm({
252
+ message: "Start dev server now?",
253
+ initialValue: true,
254
+ });
255
+ if (prompts.isCancel(choice)) {
256
+ return cancel();
257
+ }
258
+ start = choice;
259
+ }
260
+ if (start) {
261
+ prompts.outro(`Starting dev server in ${targetDir}…`);
262
+ const devResult = spawn.sync(pm, scriptArgs(pm, "dev"), {
263
+ stdio: "inherit",
264
+ cwd: root,
265
+ });
266
+ process.exit(devResult.status ?? 0);
267
+ }
268
+ prompts.log.success("All set! Next steps:");
269
+ prompts.log.info(`Start:
270
+ cd ${targetDir}
271
+ ${scriptCommand(pm, "dev")}`);
272
+ prompts.log.info(`Deploy:
273
+ ${scriptCommand(pm, "deploy")}`);
274
+ prompts.outro(`🛟 Need help?
275
+ Chat: https://discord.alpic.ai
276
+ Docs: https://docs.skybridge.tech`);
277
+ }
278
+ function cancel() {
279
+ prompts.cancel("Operation cancelled");
280
+ process.exit(0);
281
+ }
282
+ function abort(...lines) {
283
+ for (const line of lines) {
284
+ prompts.log.error(line);
285
+ }
286
+ prompts.outro("Aborted");
287
+ process.exit(1);
288
+ }
289
+ // Async spawn wrapper used when we want a spinner to keep animating during
290
+ // the subprocess (cross-spawn.sync would block the event loop).
291
+ function spawnAsync(command, args, options) {
292
+ return new Promise((resolve) => {
293
+ const child = spawn(command, args, options);
294
+ child.on("close", (code) => resolve(code));
295
+ child.on("error", () => resolve(1));
296
+ });
134
297
  }
135
- function formatTargetDir(targetDir) {
298
+ function parsePackageManager(value) {
299
+ switch (value) {
300
+ case "bun":
301
+ return "bun";
302
+ case "deno":
303
+ return "deno";
304
+ case "npm":
305
+ return "npm";
306
+ case "pnpm":
307
+ return "pnpm";
308
+ case "yarn":
309
+ return "yarn";
310
+ default:
311
+ return undefined;
312
+ }
313
+ }
314
+ function detectPackageManager() {
315
+ const userAgent = process.env.npm_config_user_agent;
316
+ if (!userAgent) {
317
+ return undefined;
318
+ }
319
+ const name = userAgent.split(" ")[0]?.split("/")[0];
320
+ return parsePackageManager(name);
321
+ }
322
+ function scriptArgs(pm, script) {
323
+ switch (pm) {
324
+ case "yarn":
325
+ case "pnpm":
326
+ case "bun":
327
+ return [script];
328
+ case "deno":
329
+ return ["task", script];
330
+ case "npm":
331
+ return ["run", script];
332
+ }
333
+ }
334
+ function scriptCommand(pm, script) {
335
+ return [pm, ...scriptArgs(pm, script)].join(" ");
336
+ }
337
+ function sanitizeTargetDir(targetDir) {
136
338
  return targetDir.trim().replace(/\/+$/g, "");
137
339
  }
138
- function isEmpty(path) {
139
- const files = fs.readdirSync(path);
140
- return files.length === 0 || (files.length === 1 && files[0] === ".git");
340
+ // Skip user's SPEC.md and IDE/agent preferences (.idea, .claude, etc.)
341
+ function isSkippedEntry(entry) {
342
+ return ((entry.name.startsWith(".") && entry.isDirectory()) ||
343
+ entry.name === "SPEC.md");
344
+ }
345
+ function isEmpty(dirPath) {
346
+ const entries = fs.readdirSync(dirPath, { withFileTypes: true });
347
+ return entries.every(isSkippedEntry);
141
348
  }
142
349
  function emptyDir(dir) {
143
350
  if (!fs.existsSync(dir)) {
144
351
  return;
145
352
  }
146
- for (const file of fs.readdirSync(dir)) {
147
- if (file === ".git") {
353
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
354
+ if (isSkippedEntry(entry)) {
148
355
  continue;
149
356
  }
150
- fs.rmSync(path.resolve(dir, file), { recursive: true, force: true });
357
+ fs.rmSync(path.join(dir, entry.name), { recursive: true, force: true });
151
358
  }
152
359
  }
153
- init().catch((e) => {
154
- console.error(e);
155
- process.exit(1);
156
- });
package/index.js CHANGED
@@ -1,3 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import "./dist/index.js";
3
+ import { init } from "./dist/index.js";
4
+
5
+ init().catch((e) => {
6
+ console.error(e);
7
+ process.exit(1);
8
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-skybridge",
3
- "version": "0.0.0-dev.98c13d6",
3
+ "version": "0.0.0-dev.98f4db2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Alpic",
@@ -13,20 +13,24 @@
13
13
  },
14
14
  "files": [
15
15
  "index.js",
16
- "dist"
16
+ "dist",
17
+ "templates"
17
18
  ],
18
- "scripts": {
19
- "build": "tsc",
20
- "test:type": "tsc --noEmit",
21
- "test:format": "biome ci",
22
- "prepublishOnly": "pnpm run build"
23
- },
24
19
  "dependencies": {
25
- "@clack/prompts": "^0.11.0",
20
+ "@clack/prompts": "^1.1.0",
21
+ "cross-spawn": "^7.0.6",
26
22
  "mri": "^1.2.0"
27
23
  },
28
24
  "devDependencies": {
29
- "@types/node": "^25.0.3",
30
- "typescript": "^5.9.3"
25
+ "@types/cross-spawn": "^6.0.6",
26
+ "typescript": "^6.0.2",
27
+ "vitest": "^4.1.4"
28
+ },
29
+ "scripts": {
30
+ "build": "tsc",
31
+ "test": "pnpm run test:unit && pnpm run test:format",
32
+ "test:unit": "vitest run",
33
+ "format": "biome check --write --error-on-warnings",
34
+ "test:format": "biome ci"
31
35
  }
32
- }
36
+ }
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ .git
3
+ dist
4
+ .env*
@@ -0,0 +1 @@
1
+ This is a ChatGPT/MCP app built with Skybridge. ALWAYS use the `chatgpt-app-builder` skill when planning or updating the codebase.
@@ -0,0 +1,53 @@
1
+ # syntax=docker/dockerfile:1
2
+
3
+ # Dockerfile for a Skybridge MCP server.
4
+ #
5
+ # Detects npm, yarn, or pnpm from the lockfile in your project.
6
+ # (For bun or deno, adapt the install/build/prune commands below.)
7
+
8
+ # Build stage: install deps, compile the app, then prune dev deps.
9
+ FROM node:24-slim AS build
10
+ WORKDIR /app
11
+
12
+ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* .npmrc* ./
13
+ RUN --mount=type=cache,target=/root/.npm \
14
+ --mount=type=cache,target=/usr/local/share/.cache/yarn \
15
+ --mount=type=cache,target=/root/.local/share/pnpm/store \
16
+ if [ -f package-lock.json ]; then \
17
+ npm ci; \
18
+ elif [ -f yarn.lock ]; then \
19
+ corepack enable yarn && yarn install --frozen-lockfile; \
20
+ elif [ -f pnpm-lock.yaml ]; then \
21
+ corepack enable pnpm && pnpm install --frozen-lockfile; \
22
+ else \
23
+ echo "No lockfile found." && exit 1; \
24
+ fi
25
+
26
+ ENV NODE_ENV=production
27
+
28
+ COPY . .
29
+ RUN if [ -f package-lock.json ]; then \
30
+ npm run build && npm prune --omit=dev; \
31
+ elif [ -f yarn.lock ]; then \
32
+ corepack enable yarn && yarn build && yarn install --frozen-lockfile --production=true; \
33
+ elif [ -f pnpm-lock.yaml ]; then \
34
+ corepack enable pnpm && pnpm build && pnpm prune --prod; \
35
+ fi
36
+
37
+ # Runtime stage: copy built artifacts and prod deps, run as non-root.
38
+ FROM node:24-slim AS runtime
39
+ WORKDIR /app
40
+ ENV NODE_ENV=production
41
+
42
+ USER node
43
+
44
+ COPY --from=build --chown=node:node /app/node_modules ./node_modules
45
+ COPY --from=build --chown=node:node /app/dist ./dist
46
+ COPY --from=build --chown=node:node /app/package.json ./package.json
47
+
48
+ EXPOSE 3000
49
+
50
+ # Run the built server directly rather than via `npm start` / `skybridge start`.
51
+ # Each wrapper adds a process layer that can swallow SIGTERM, which makes
52
+ # graceful shutdowns time out on platforms like Cloud Run, Fly, and k8s.
53
+ CMD ["node", "dist/server.js"]