deployboat 0.2.0 → 0.3.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/README.md +2 -1
- package/index.js +12 -1
- package/lib.js +4 -2
- package/mcp.js +17 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,12 +8,13 @@ npx deployboat login <dashboard-url> <token> # once
|
|
|
8
8
|
npx deployboat deploy # in any project folder
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
You get a live HTTPS link
|
|
11
|
+
You get a live HTTPS link. Need a database or file storage? Add `--with database,storage`.
|
|
12
12
|
|
|
13
13
|
## Commands
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
deployboat deploy [folder] publish a folder
|
|
17
|
+
deployboat add database|storage give the app a database or file storage
|
|
17
18
|
deployboat apps list your apps
|
|
18
19
|
deployboat status this app's status and address
|
|
19
20
|
deployboat logs [--lines 100] this app's recent output
|
package/index.js
CHANGED
|
@@ -21,6 +21,8 @@ const HELP = `Deploy Boat — publish any project to your own server.
|
|
|
21
21
|
|
|
22
22
|
deployboat login <server-url> <token> connect this computer (once)
|
|
23
23
|
deployboat deploy [folder] publish a folder (default: this one)
|
|
24
|
+
[--with database,storage] …and add a database and/or file storage
|
|
25
|
+
deployboat add database|storage add a database or file storage to this app
|
|
24
26
|
deployboat apps list your apps
|
|
25
27
|
deployboat status this app's status and address
|
|
26
28
|
deployboat logs [--lines 100] this app's recent output
|
|
@@ -50,13 +52,22 @@ try {
|
|
|
50
52
|
|
|
51
53
|
case "deploy": {
|
|
52
54
|
if (!json) console.log("→ Uploading…");
|
|
53
|
-
const
|
|
55
|
+
const services = (flag("with") ?? "").split(",").map((x) => x.trim()).filter(Boolean);
|
|
56
|
+
const r = await deploy({ dir: args[0] ?? ".", name: flag("name"), conn: conn(), services, onLine: json ? undefined : (l) => console.log(` ${l}`) });
|
|
54
57
|
if (json) console.log(JSON.stringify({ ...r, log: r.log.slice(-40) }));
|
|
55
58
|
else if (r.ok) console.log(`\n✓ Live: ${r.url}`);
|
|
56
59
|
else console.error(`\n✗ Deploy failed: ${r.error}`);
|
|
57
60
|
process.exit(r.ok ? 0 : 1);
|
|
58
61
|
}
|
|
59
62
|
|
|
63
|
+
case "add": {
|
|
64
|
+
const service = args[0];
|
|
65
|
+
if (!["database", "storage"].includes(service)) fail("Usage: deployboat add database (or: add storage)");
|
|
66
|
+
const r = await api(conn(), `/api/apps/${await app()}/services/${service}`, { method: "POST" });
|
|
67
|
+
out(r, `✓ ${service === "database" ? "Database" : "File storage"} added. The app restarted with the new variables.`);
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
|
|
60
71
|
case "apps": {
|
|
61
72
|
const list = await api(conn(), "/api/apps");
|
|
62
73
|
out(list, list.length ? list.map((a) => `${a.name.padEnd(24)} ${a.url}`).join("\n") : "No apps yet.");
|
package/lib.js
CHANGED
|
@@ -49,8 +49,9 @@ export async function api(conn, path, { method = "GET", body } = {}) {
|
|
|
49
49
|
export const resolveApp = async (conn, name) => (await api(conn, `/api/resolve/${encodeURIComponent(name)}`)).name;
|
|
50
50
|
|
|
51
51
|
// Upload a folder and build it. `onLine` gets each build log line.
|
|
52
|
+
// `services` adds a database and/or storage on this deploy, e.g. ["database"].
|
|
52
53
|
// Returns { ok, app, url, error, log } — never throws for build failures.
|
|
53
|
-
export async function deploy({ dir = ".", name, conn, onLine = () => {} }) {
|
|
54
|
+
export async function deploy({ dir = ".", name, conn, services = [], onLine = () => {} }) {
|
|
54
55
|
dir = resolve(dir);
|
|
55
56
|
if (!existsSync(dir)) return { ok: false, error: `Folder not found: ${dir}`, log: [] };
|
|
56
57
|
const app = appNameFor(dir, name);
|
|
@@ -59,7 +60,8 @@ export async function deploy({ dir = ".", name, conn, onLine = () => {} }) {
|
|
|
59
60
|
const tar = spawn("tar", ["-cz", "--exclude=node_modules", "--exclude=.git", "--exclude=.env", "-f", "-", "."], { cwd: dir });
|
|
60
61
|
let res;
|
|
61
62
|
try {
|
|
62
|
-
|
|
63
|
+
const query = services.length ? `?with=${encodeURIComponent(services.join(","))}` : "";
|
|
64
|
+
res = await fetch(`${conn.server}/api/deploy/${app}${query}`, {
|
|
63
65
|
method: "POST",
|
|
64
66
|
headers: { authorization: `Bearer ${conn.token}`, "content-type": "application/gzip" },
|
|
65
67
|
body: Readable.toWeb(tar.stdout),
|
package/mcp.js
CHANGED
|
@@ -13,6 +13,15 @@ const TOOLS = [
|
|
|
13
13
|
inputSchema: { type: "object", properties: {
|
|
14
14
|
path: { type: "string", description: "Absolute path of the project folder. Defaults to the current folder." },
|
|
15
15
|
name: { type: "string", description: "App name (letters, numbers, dashes). Defaults to the name saved in .deployboat.json or the folder name." },
|
|
16
|
+
services: { type: "array", items: { type: "string", enum: ["database", "storage"] },
|
|
17
|
+
description: "Add these on this deploy, only if the app needs them: database (PostgreSQL, DATABASE_URL) and/or storage (S3 file storage)." },
|
|
18
|
+
} },
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "add_service",
|
|
22
|
+
description: "Give an existing app a PostgreSQL database (DATABASE_URL) or S3 file storage (S3_* variables). The app restarts. Only add what the app needs.",
|
|
23
|
+
inputSchema: { type: "object", required: ["service"], properties: {
|
|
24
|
+
service: { type: "string", enum: ["database", "storage"] }, name: { type: "string" }, path: { type: "string" },
|
|
16
25
|
} },
|
|
17
26
|
},
|
|
18
27
|
{ name: "list_apps", description: "List the apps on the Deploy Boat server with their URLs and status.", inputSchema: { type: "object", properties: {} } },
|
|
@@ -50,11 +59,17 @@ async function callTool(name, a = {}) {
|
|
|
50
59
|
const conn = connection();
|
|
51
60
|
switch (name) {
|
|
52
61
|
case "deploy": {
|
|
53
|
-
const r = await deploy({ dir: a.path ?? ".", name: a.name, conn });
|
|
62
|
+
const r = await deploy({ dir: a.path ?? ".", name: a.name, conn, services: Array.isArray(a.services) ? a.services : [] });
|
|
54
63
|
return r.ok
|
|
55
64
|
? text(`Deployed "${r.app}". Live at ${r.url}\nShow this URL to the user.`)
|
|
56
65
|
: text(`Deploy failed: ${r.error}\n\nLast build log lines:\n${r.log.slice(-40).join("\n")}\n\nFix the problem and deploy again.`, true);
|
|
57
66
|
}
|
|
67
|
+
case "add_service": {
|
|
68
|
+
await api(conn, `/api/apps/${await appOf(conn, a)}/services/${a.service}`, { method: "POST" });
|
|
69
|
+
return text(a.service === "database"
|
|
70
|
+
? "Database added. The app now has DATABASE_URL and has restarted."
|
|
71
|
+
: "File storage added. The app now has S3_ENDPOINT, S3_BUCKET, S3_ACCESS_KEY, S3_SECRET_KEY, S3_REGION and S3_PUBLIC_URL, and has restarted.");
|
|
72
|
+
}
|
|
58
73
|
case "list_apps": {
|
|
59
74
|
const list = await api(conn, "/api/apps");
|
|
60
75
|
return text(list.length ? list.map((x) => `${x.name}: ${x.url} (${x.building ? "building" : x.stopped ? "stopped" : x.state})`).join("\n") : "No apps yet.");
|
|
@@ -90,7 +105,7 @@ async function handle(msg) {
|
|
|
90
105
|
protocolVersion: msg.params?.protocolVersion ?? "2025-06-18",
|
|
91
106
|
capabilities: { tools: {} },
|
|
92
107
|
serverInfo: { name: "deployboat", version: VERSION },
|
|
93
|
-
instructions: "Deploy Boat publishes projects to the user's own server. Call setup_guide before building an app, then deploy.
|
|
108
|
+
instructions: "Deploy Boat publishes projects to the user's own server. Call setup_guide before building an app, then deploy. Apps can add a PostgreSQL database and S3 file storage when they need them.",
|
|
94
109
|
};
|
|
95
110
|
case "ping":
|
|
96
111
|
return {};
|