ezhst 1.1.0 → 1.3.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/dist/commands/auth.js +35 -5
- package/dist/commands/billing.js +37 -0
- package/dist/commands/db.js +4 -1
- package/dist/commands/projects.js +1 -1
- package/dist/commands/skill.js +2 -2
- package/dist/commands/storage.js +7 -4
- package/dist/index.js +11 -41
- package/dist/lib/api.js +10 -1
- package/dist/lib/config.js +1 -1
- package/package.json +2 -2
- package/skill/SKILL.md +17 -24
package/dist/commands/auth.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { input, password } from "@inquirer/prompts";
|
|
2
|
-
import { json, request } from "../lib/api.js";
|
|
2
|
+
import { ApiError, json, request } from "../lib/api.js";
|
|
3
3
|
import { clearConfig, readConfig, writeConfig } from "../lib/config.js";
|
|
4
|
-
import { log, output, required } from "../lib/ui.js";
|
|
4
|
+
import { isInteractive, log, output, required } from "../lib/ui.js";
|
|
5
5
|
const apiUrlFrom = (api) => (api ?? readConfig().apiUrl).replace(/\/$/, "");
|
|
6
6
|
const askEmail = () => input({ message: "Email" });
|
|
7
7
|
const askPassword = () => password({ message: "Password", mask: "*" });
|
|
@@ -9,11 +9,35 @@ const saveSession = (apiUrl, token, user, message) => {
|
|
|
9
9
|
writeConfig({ apiUrl, token });
|
|
10
10
|
output({ user, token }, () => {
|
|
11
11
|
log.success(`${message} ${user.name} <${user.email}>`);
|
|
12
|
-
if (!user.verified) {
|
|
13
|
-
log.warn("Verify your email
|
|
12
|
+
if (!user.verified && !isInteractive()) {
|
|
13
|
+
log.warn("Verify your email before using Reverhost: run `ezhst verify <code>` with the 6-digit code we emailed you.");
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
|
+
const askForCode = async (user) => {
|
|
18
|
+
if (user.verified || !isInteractive()) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
log.info(`We emailed a 6-digit code to ${user.email}. Enter it to finish (press Enter to skip for now).`);
|
|
22
|
+
while (true) {
|
|
23
|
+
const code = (await input({ message: "Verification code" })).trim();
|
|
24
|
+
if (!code) {
|
|
25
|
+
log.warn("Skipped. Run `ezhst verify <code>` before using other commands.");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const result = await request("/auth/verify-email", json("POST", { code }));
|
|
30
|
+
log.success(result.message);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
if (!(error instanceof ApiError)) {
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
log.error(error.message);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
17
41
|
export const register = async (options) => {
|
|
18
42
|
const apiUrl = apiUrlFrom(options.api);
|
|
19
43
|
writeConfig({ apiUrl });
|
|
@@ -22,6 +46,7 @@ export const register = async (options) => {
|
|
|
22
46
|
const secret = await required(options.password, "--password", askPassword);
|
|
23
47
|
const { token, user } = await request("/auth/register", json("POST", { name, email, password: secret }));
|
|
24
48
|
saveSession(apiUrl, token, user, "Account created for");
|
|
49
|
+
await askForCode(user);
|
|
25
50
|
};
|
|
26
51
|
export const login = async (options) => {
|
|
27
52
|
const apiUrl = apiUrlFrom(options.api);
|
|
@@ -30,6 +55,7 @@ export const login = async (options) => {
|
|
|
30
55
|
const secret = await required(options.password, "--password", askPassword);
|
|
31
56
|
const { token, user } = await request("/auth/login", json("POST", { email, password: secret }));
|
|
32
57
|
saveSession(apiUrl, token, user, "Logged in as");
|
|
58
|
+
await askForCode(user);
|
|
33
59
|
};
|
|
34
60
|
export const logout = () => {
|
|
35
61
|
clearConfig();
|
|
@@ -41,11 +67,15 @@ export const whoami = async () => {
|
|
|
41
67
|
output({ user, apiUrl }, () => {
|
|
42
68
|
log.info(`${user.name} <${user.email}>`);
|
|
43
69
|
if (!user.verified) {
|
|
44
|
-
log.warn("Email not verified");
|
|
70
|
+
log.warn("Email not verified. Run `ezhst verify <code>`.");
|
|
45
71
|
}
|
|
46
72
|
log.dim(apiUrl);
|
|
47
73
|
});
|
|
48
74
|
};
|
|
75
|
+
export const verify = async (code) => {
|
|
76
|
+
const result = await request("/auth/verify-email", json("POST", { code }));
|
|
77
|
+
output(result, () => log.success(result.message));
|
|
78
|
+
};
|
|
49
79
|
export const resendVerification = async () => {
|
|
50
80
|
const result = await request("/auth/resend-verification", { method: "POST" });
|
|
51
81
|
output(result, () => log.success(result.message));
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import pc from "picocolors";
|
|
2
|
+
import { request } from "../lib/api.js";
|
|
3
|
+
import { formatBytes, log, output } from "../lib/ui.js";
|
|
4
|
+
export const showBilling = async () => {
|
|
5
|
+
const overview = await request("/billing");
|
|
6
|
+
output(overview, () => {
|
|
7
|
+
const { plan } = overview;
|
|
8
|
+
log.info(`${pc.bold("Plan")} ${plan.name} ($${plan.price}/mo)`);
|
|
9
|
+
if (overview.subscription) {
|
|
10
|
+
log.info(`${pc.bold("Status")} ${overview.subscription.status.toLowerCase().replace("_", " ")}`);
|
|
11
|
+
}
|
|
12
|
+
if (overview.subscription?.renewsAt) {
|
|
13
|
+
log.info(`${pc.bold("Renews")} ${new Date(overview.subscription.renewsAt).toLocaleDateString()}`);
|
|
14
|
+
}
|
|
15
|
+
log.info(`${pc.bold("Tokens")} ${overview.tokenBalance}`);
|
|
16
|
+
log.info(`${pc.bold("Projects")} ${overview.projects.length} / ${plan.projects}`);
|
|
17
|
+
for (const project of overview.projects) {
|
|
18
|
+
let paused = "";
|
|
19
|
+
if (!project.allowed) {
|
|
20
|
+
paused = pc.red(" paused");
|
|
21
|
+
}
|
|
22
|
+
log.info(` ${project.slug.padEnd(40)} apps ${project.usage.apps}/${plan.apps} db ${formatBytes(project.usage.dbBytes)}/${formatBytes(plan.dbBytes)} storage ${formatBytes(project.usage.storageBytes)}/${formatBytes(plan.storageBytes)}${paused}`);
|
|
23
|
+
}
|
|
24
|
+
if (plan.id === "FREE") {
|
|
25
|
+
const pro = overview.plans.pro;
|
|
26
|
+
log.info(`Upgrade to Pro ($${pro.price}/mo, ${pro.projects} projects, ${pro.monthlyTokens} AI tokens a month) with \`ezhst billing upgrade\`.`);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
export const upgradeBilling = async () => {
|
|
31
|
+
const { url } = await request("/billing/checkout", { method: "POST" });
|
|
32
|
+
output({ url }, () => log.info(`Finish checkout in your browser: ${url}`));
|
|
33
|
+
};
|
|
34
|
+
export const billingPortal = async () => {
|
|
35
|
+
const { url } = await request("/billing/portal");
|
|
36
|
+
output({ url }, () => log.info(`Manage billing: ${url}`));
|
|
37
|
+
};
|
package/dist/commands/db.js
CHANGED
|
@@ -17,7 +17,10 @@ export const databaseInfo = async (options) => {
|
|
|
17
17
|
const detail = await request(`/databases/${database.id}`, {}, project.id);
|
|
18
18
|
output(detail, () => {
|
|
19
19
|
const info = detail.database;
|
|
20
|
-
log.info(`${pc.bold(info.name)} ${pc.dim(`(${info.dbName}, ${formatBytes(info.sizeBytes)})`)}`);
|
|
20
|
+
log.info(`${pc.bold(info.name)} ${pc.dim(`(${info.dbName}, ${formatBytes(info.sizeBytes)} of ${formatBytes(info.limitBytes)} used)`)}`);
|
|
21
|
+
if (info.blocked) {
|
|
22
|
+
log.warn("Blocked: the database is over its size limit. Truncate or drop tables in the dashboard to free space.");
|
|
23
|
+
}
|
|
21
24
|
log.info(`DATABASE_URL: ${info.connectionString}`);
|
|
22
25
|
log.info(`SHADOW_DATABASE_URL: ${info.shadowConnectionString}`);
|
|
23
26
|
log.info(`Tables: ${detail.tables.length}`);
|
|
@@ -38,7 +38,7 @@ export const renameProject = async (name, options) => {
|
|
|
38
38
|
};
|
|
39
39
|
export const deleteProject = async (options) => {
|
|
40
40
|
const project = await resolveProject(options);
|
|
41
|
-
confirmed(options.yes, `Deleting ${project.slug} removes all apps, deployments,
|
|
41
|
+
confirmed(options.yes, `Deleting ${project.slug} removes all apps, deployments, storage and database.`);
|
|
42
42
|
const result = await request(`/projects/${project.id}`, { method: "DELETE" });
|
|
43
43
|
output(result, () => log.success(`Deleted ${project.slug}`));
|
|
44
44
|
};
|
package/dist/commands/skill.js
CHANGED
|
@@ -46,7 +46,7 @@ export const installSkill = async (options) => {
|
|
|
46
46
|
mkdirSync(directory, { recursive: true });
|
|
47
47
|
copyFileSync(SKILL_SOURCE, target);
|
|
48
48
|
output({ agent: agentKey, scope, path: target }, () => {
|
|
49
|
-
log.success(`Installed the
|
|
50
|
-
log.info('Ask your agent: "Deploy this app to
|
|
49
|
+
log.success(`Installed the Reverhost skill for ${agent.name} at ${target}`);
|
|
50
|
+
log.info('Ask your agent: "Deploy this app to Reverhost."');
|
|
51
51
|
});
|
|
52
52
|
};
|
package/dist/commands/storage.js
CHANGED
|
@@ -6,12 +6,12 @@ import { resolveProject } from "../lib/project.js";
|
|
|
6
6
|
import { confirmed, fail, formatBytes, log, output } from "../lib/ui.js";
|
|
7
7
|
const findBucket = async (options) => {
|
|
8
8
|
const project = await resolveProject(options);
|
|
9
|
-
const { buckets } = await request("/storage/buckets", {}, project.id);
|
|
9
|
+
const { buckets, usedBytes, limitBytes } = await request("/storage/buckets", {}, project.id);
|
|
10
10
|
const bucket = buckets[0];
|
|
11
11
|
if (!bucket) {
|
|
12
12
|
return fail("This project has no storage yet. Create it with `ezhst storage create <name>`.");
|
|
13
13
|
}
|
|
14
|
-
return { project, bucket };
|
|
14
|
+
return { project, bucket, usedBytes, limitBytes };
|
|
15
15
|
};
|
|
16
16
|
const listObjects = async (projectId, bucketId, prefix = "") => {
|
|
17
17
|
const query = new URLSearchParams({ prefix });
|
|
@@ -28,9 +28,12 @@ const printCredentials = (bucket) => {
|
|
|
28
28
|
log.dim("Use path-style addressing (forcePathStyle: true).");
|
|
29
29
|
};
|
|
30
30
|
export const storageInfo = async (options) => {
|
|
31
|
-
const { project, bucket } = await findBucket(options);
|
|
31
|
+
const { project, bucket, usedBytes, limitBytes } = await findBucket(options);
|
|
32
32
|
const { bucket: detail } = await listObjects(project.id, bucket.id);
|
|
33
|
-
output({ bucket: detail }, () =>
|
|
33
|
+
output({ bucket: detail, usedBytes, limitBytes }, () => {
|
|
34
|
+
printCredentials(detail);
|
|
35
|
+
log.info(`Used: ${formatBytes(usedBytes)} of ${formatBytes(limitBytes)}`);
|
|
36
|
+
});
|
|
34
37
|
};
|
|
35
38
|
export const createStorage = async (name, options) => {
|
|
36
39
|
const project = await resolveProject(options);
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
|
-
import { forgotPassword, login, logout, register, resendVerification, whoami } from "./commands/auth.js";
|
|
4
|
+
import { forgotPassword, login, logout, register, resendVerification, verify, whoami } from "./commands/auth.js";
|
|
5
5
|
import { createApp, deleteApp, listApps } from "./commands/apps.js";
|
|
6
|
-
import { createSchedule, deleteSchedule, listSchedules, scheduleLogs, setScheduleState, updateSchedule } from "./commands/schedules.js";
|
|
7
6
|
import { createProject, deleteProject, link, listProjects, logs, projectInfo, renameProject, start, stop } from "./commands/projects.js";
|
|
8
7
|
import { deploy, deploymentLog, listDeployments, redeploy } from "./commands/deploy.js";
|
|
9
8
|
import { importEnv, listEnv, setEnv, unsetEnv } from "./commands/env.js";
|
|
@@ -11,10 +10,9 @@ import { resetBuild, setBuild, showBuild } from "./commands/build.js";
|
|
|
11
10
|
import { addDomain, listDomains, removeDomain, verifyDomain } from "./commands/domains.js";
|
|
12
11
|
import { createStorage, deleteStorage, downloadStorage, listStorage, removeStorageObject, rotateStorageKeys, storageInfo, uploadStorage, } from "./commands/storage.js";
|
|
13
12
|
import { createDatabase, databaseInfo, deleteDatabase, queryDatabase, resetDatabasePassword, tableRows } from "./commands/db.js";
|
|
14
|
-
import { createSender, deleteSender, emailInfo, emailLogs, sendEmail } from "./commands/email.js";
|
|
15
|
-
import { createKey, listKeys, revokeKey } from "./commands/keys.js";
|
|
16
13
|
import { acceptInvite, inviteMember, leaveProject, listMembers, removeMember, revokeInvite } from "./commands/members.js";
|
|
17
14
|
import { installSkill } from "./commands/skill.js";
|
|
15
|
+
import { billingPortal, showBilling, upgradeBilling } from "./commands/billing.js";
|
|
18
16
|
import { fail, setJsonMode } from "./lib/ui.js";
|
|
19
17
|
const packageMetadata = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
20
18
|
if (!packageMetadata || typeof packageMetadata !== "object" || !("version" in packageMetadata) || typeof packageMetadata.version !== "string") {
|
|
@@ -23,7 +21,7 @@ if (!packageMetadata || typeof packageMetadata !== "object" || !("version" in pa
|
|
|
23
21
|
const program = new Command();
|
|
24
22
|
program
|
|
25
23
|
.name("ezhst")
|
|
26
|
-
.description("
|
|
24
|
+
.description("Reverhost from the terminal: deploy apps and manage storage and databases")
|
|
27
25
|
.version(packageMetadata.version)
|
|
28
26
|
.option("--json", "Print machine-readable JSON")
|
|
29
27
|
.hook("preAction", (_command, action) => {
|
|
@@ -48,7 +46,8 @@ program
|
|
|
48
46
|
.action(login);
|
|
49
47
|
program.command("logout").description("Log out").action(logout);
|
|
50
48
|
program.command("whoami").description("Show the logged in user").action(whoami);
|
|
51
|
-
program.command("
|
|
49
|
+
program.command("verify").description("Verify your email with the 6-digit code").argument("<code>").action(verify);
|
|
50
|
+
program.command("resend-verification").description("Email a new verification code").action(resendVerification);
|
|
52
51
|
program.command("forgot-password").description("Email a password reset link").option("--email <email>").action(forgotPassword);
|
|
53
52
|
const projects = program.command("projects").description("Manage projects");
|
|
54
53
|
projects.command("list").description("List projects").action(listProjects);
|
|
@@ -91,25 +90,14 @@ appScoped(domains.command("list").description("List domains and the DNS target")
|
|
|
91
90
|
appScoped(domains.command("add").description("Add a domain").argument("<hostname>")).action(addDomain);
|
|
92
91
|
appScoped(domains.command("verify").description("Check DNS and issue HTTPS").argument("<hostname>")).action(verifyDomain);
|
|
93
92
|
appScoped(domains.command("remove").description("Remove a domain").argument("<hostname>")).action(removeDomain);
|
|
94
|
-
const apps = program.command("apps").description("Manage
|
|
93
|
+
const apps = program.command("apps").description("Manage the apps in a project (2 per project)");
|
|
95
94
|
scoped(apps.command("list").description("List apps in a project")).action(listApps);
|
|
96
95
|
scoped(apps.command("create").description("Create an app").argument("<name>")).action(createApp);
|
|
97
96
|
appScoped(apps.command("delete").description("Delete one app and its deployments").option("--yes", "Confirm")).action(deleteApp);
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
.option("--every <minutes>", "Interval in minutes, 1 to 43200")
|
|
103
|
-
.option("--method <method>", "HTTP method")
|
|
104
|
-
.option("--headers <json>", "Headers as a JSON object")
|
|
105
|
-
.option("--body <text>", "Request body")
|
|
106
|
-
.option("--paused", "Save the schedule paused");
|
|
107
|
-
scheduleOptions(schedules.command("create").description("Create a schedule").argument("<name>")).action(createSchedule);
|
|
108
|
-
scheduleOptions(schedules.command("update").description("Edit a schedule").argument("<id>").option("--name <name>")).action(updateSchedule);
|
|
109
|
-
scoped(schedules.command("pause").description("Pause a schedule").argument("<id>")).action((id, options) => setScheduleState(id, false, options));
|
|
110
|
-
scoped(schedules.command("resume").description("Resume a schedule").argument("<id>")).action((id, options) => setScheduleState(id, true, options));
|
|
111
|
-
scoped(schedules.command("logs").description("Show recent runs").argument("<id>")).action(scheduleLogs);
|
|
112
|
-
scoped(schedules.command("delete").description("Delete a schedule").argument("<id>").option("--yes", "Confirm")).action(deleteSchedule);
|
|
97
|
+
const billing = program.command("billing").description("Plan, usage and the Pro subscription");
|
|
98
|
+
billing.command("show", { isDefault: true }).description("Show your plan, limits and usage").action(showBilling);
|
|
99
|
+
billing.command("upgrade").description("Print a checkout link for Pro ($10/mo)").action(upgradeBilling);
|
|
100
|
+
billing.command("portal").description("Print the link to manage or cancel your subscription").action(billingPortal);
|
|
113
101
|
const storage = program.command("storage").description("S3 compatible storage");
|
|
114
102
|
scoped(storage.command("info").description("Show the bucket and S3 credentials")).action(storageInfo);
|
|
115
103
|
scoped(storage.command("create").description("Create the project's bucket").argument("<name>")).action(createStorage);
|
|
@@ -126,24 +114,6 @@ scoped(db.command("query").description("Run SQL").argument("[sql]").option("--fi
|
|
|
126
114
|
scoped(db.command("rows").description("Browse a table").argument("<table>").option("--page <n>", "Page", "1")).action(tableRows);
|
|
127
115
|
scoped(db.command("reset-password").description("Rotate the database password")).action(resetDatabasePassword);
|
|
128
116
|
scoped(db.command("delete").description("Delete the database and its data").option("--yes", "Confirm")).action(deleteDatabase);
|
|
129
|
-
const email = program.command("email").description("Transactional email");
|
|
130
|
-
scoped(email.command("info").description("Show the sender address and usage")).action(emailInfo);
|
|
131
|
-
const sender = email.command("sender").description("Sender address");
|
|
132
|
-
scoped(sender.command("create").description("Create <username>@easyhost.fun").argument("<username>")).action(createSender);
|
|
133
|
-
scoped(sender.command("delete").description("Delete the sender address")).action(deleteSender);
|
|
134
|
-
scoped(email
|
|
135
|
-
.command("send")
|
|
136
|
-
.description("Send an email")
|
|
137
|
-
.option("--from <address>")
|
|
138
|
-
.option("--to <addresses...>")
|
|
139
|
-
.option("--subject <text>")
|
|
140
|
-
.option("--text <body>")
|
|
141
|
-
.option("--html <html>")).action(sendEmail);
|
|
142
|
-
scoped(email.command("logs").description("Show sent emails").option("--page <n>", "Page", "1")).action(emailLogs);
|
|
143
|
-
const keys = program.command("keys").description("API keys for the HTTP API");
|
|
144
|
-
scoped(keys.command("list").description("List API keys")).action(listKeys);
|
|
145
|
-
scoped(keys.command("create").description("Create an API key").argument("<name>")).action(createKey);
|
|
146
|
-
scoped(keys.command("revoke").description("Revoke an API key").argument("<id>")).action(revokeKey);
|
|
147
117
|
const members = program.command("members").description("Project members and invites");
|
|
148
118
|
scoped(members.command("list").description("List the owner, members and pending invites")).action(listMembers);
|
|
149
119
|
scoped(members.command("invite").description("Invite someone by email (owner only)").argument("<email>")).action(inviteMember);
|
|
@@ -154,7 +124,7 @@ program.command("accept-invite").description("Accept a project invite").argument
|
|
|
154
124
|
const skill = program.command("skill").description("Agent skill");
|
|
155
125
|
skill
|
|
156
126
|
.command("install")
|
|
157
|
-
.description("Install the
|
|
127
|
+
.description("Install the Reverhost agent skill")
|
|
158
128
|
.option("--agent <agent>", "Target agent: claude, codex or cursor")
|
|
159
129
|
.option("--global", "Install to the agent's home skills folder for all projects")
|
|
160
130
|
.option("--local", "Install to the agent's skills folder in the current project")
|
package/dist/lib/api.js
CHANGED
|
@@ -29,7 +29,16 @@ export const request = async (pathname, init = {}, projectId) => {
|
|
|
29
29
|
if (res.status === 401 && !pathname.startsWith("/auth/")) {
|
|
30
30
|
throw new ApiError("Not logged in. Run `ezhst login` or set EZHST_TOKEN.", 401);
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
if (data.code === "EMAIL_NOT_VERIFIED") {
|
|
33
|
+
throw new ApiError("Your email is not verified. Run `ezhst verify <code>` with the 6-digit code from your inbox, or `ezhst resend-verification` to get a new code.", res.status);
|
|
34
|
+
}
|
|
35
|
+
if (typeof data.error === "string") {
|
|
36
|
+
throw new ApiError(data.error, res.status);
|
|
37
|
+
}
|
|
38
|
+
if (res.status >= 500) {
|
|
39
|
+
throw new ApiError(`Reverhost is having trouble right now (status ${res.status}). Try again in a minute.`, res.status);
|
|
40
|
+
}
|
|
41
|
+
throw new ApiError(`Request failed with status ${res.status}.`, res.status);
|
|
33
42
|
}
|
|
34
43
|
return data;
|
|
35
44
|
};
|
package/dist/lib/config.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from "node:path";
|
|
|
4
4
|
const CONFIG_DIR = path.join(homedir(), ".easyhost");
|
|
5
5
|
const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
6
6
|
const PROJECT_FILE = ".easyhost.json";
|
|
7
|
-
const PRODUCTION_API_URL = "https://api.
|
|
7
|
+
const PRODUCTION_API_URL = "https://api.reverhost.com";
|
|
8
8
|
export const readConfig = () => {
|
|
9
9
|
let config = { apiUrl: PRODUCTION_API_URL };
|
|
10
10
|
if (existsSync(CONFIG_FILE)) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ezhst",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.3.1",
|
|
4
|
+
"description": "Reverhost CLI: agent-first hosting for Node.js apps with storage and databases",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ezhst": "dist/index.js"
|
package/skill/SKILL.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: easyhost
|
|
3
|
-
description: Deploy and manage apps on
|
|
3
|
+
description: Deploy and manage apps on Reverhost (free hosting) with the ezhst CLI. Use when the user asks to deploy, host, publish or ship a Node.js app to Reverhost, or to manage its environment variables, build settings, logs, custom domains, S3 storage or Postgres database.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Reverhost
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Reverhost is free hosting for Node.js apps with built-in S3 storage and Postgres. It is in beta. Everything is done through the `ezhst` CLI. Run it with `npx ezhst <command>` (or `ezhst` if installed globally with `npm i -g ezhst`).
|
|
9
9
|
|
|
10
10
|
## Rules for agents
|
|
11
11
|
|
|
12
12
|
- Always pass `--json` and parse stdout. Progress and hints go to stderr. On failure the process exits with code 1 and prints `{"error": "..."}`.
|
|
13
13
|
- The CLI never prompts without a TTY. Pass every value as a flag.
|
|
14
14
|
- Commands that act on a project use the project linked in `.easyhost.json`, or `--project <slug>`. App commands also use `--app <slug-or-id>` or the linked app. With multiple apps, select one explicitly.
|
|
15
|
-
- Destructive commands (`projects delete`, `apps delete`, `
|
|
16
|
-
- Never print secrets (passwords, S3 secret keys,
|
|
15
|
+
- Destructive commands (`projects delete`, `apps delete`, `storage delete`, `db delete`) need `--yes`. Only run them when the user explicitly asks.
|
|
16
|
+
- Never print secrets (passwords, S3 secret keys, connection strings) back to the user unless they ask. Put them in env vars with `ezhst env set` instead.
|
|
17
17
|
- `.env` files are never uploaded. Environment variables must be set with `ezhst env set` or `ezhst env import .env`.
|
|
18
18
|
|
|
19
19
|
## 1. Authenticate
|
|
@@ -21,12 +21,12 @@ EasyHost is free hosting for Node.js apps with built-in S3 storage, Postgres and
|
|
|
21
21
|
Check first: `npx ezhst whoami --json`. If it fails with "Not logged in":
|
|
22
22
|
|
|
23
23
|
- Existing account: ask the user for email and password, then `npx ezhst login --email <email> --password <password> --json`
|
|
24
|
-
- New account: ask for name, email and password, then `npx ezhst register --name <name> --email <email> --password <password> --json`.
|
|
24
|
+
- New account: ask for name, email and password, then `npx ezhst register --name <name> --email <email> --password <password> --json`. Verification is mandatory: ask the user for the 6-digit code from their inbox and run `npx ezhst verify <code> --json` before any other command (`npx ezhst resend-verification` sends a new code).
|
|
25
25
|
- CI: set `EZHST_TOKEN` instead of logging in.
|
|
26
26
|
|
|
27
27
|
## 2. Pick or create a project
|
|
28
28
|
|
|
29
|
-
A project contains up to
|
|
29
|
+
A project contains up to 2 apps, and shared storage and database. Each app has its own slug and URL: `https://<app-slug>.easyhost.fun`. Existing project apps retain their URLs.
|
|
30
30
|
|
|
31
31
|
```
|
|
32
32
|
npx ezhst projects list --json
|
|
@@ -79,35 +79,28 @@ Custom domains:
|
|
|
79
79
|
|
|
80
80
|
Storage (S3 compatible, one bucket per project, files are public by URL):
|
|
81
81
|
- `storage create <name> | info | rotate-keys | ls [prefix] | upload <files...> [--prefix dir/] | download <key> [output] | rm <key> | delete --yes`
|
|
82
|
-
- In app code use any S3 client with endpoint `https://storage.
|
|
82
|
+
- In app code use any S3 client with endpoint `https://storage.reverhost.com`, region `us-east-1`, `forcePathStyle: true`, and the bucket name and keys from `storage info`. Public file URL: `https://storage.reverhost.com/<bucket>/<key>`.
|
|
83
83
|
- Typical setup: `storage create files`, then `env set S3_ENDPOINT=... S3_BUCKET=... S3_ACCESS_KEY_ID=... S3_SECRET_ACCESS_KEY=...` from `storage info --json`.
|
|
84
84
|
|
|
85
85
|
Database (Postgres, one per project):
|
|
86
86
|
- `db create <name> | info | query "<sql>" | query --file <file.sql> | rows <table> [--page n] | reset-password | delete --yes`
|
|
87
87
|
- `db info --json` returns `connectionString` and `shadowConnectionString` (for `prisma migrate dev`). Set `DATABASE_URL` with `env set`, and run migrations from the local machine against it (for Prisma: `prisma migrate deploy`).
|
|
88
88
|
|
|
89
|
-
Email (from `<username>@easyhost.fun`, 20 emails a day):
|
|
90
|
-
- `email sender create <username>`, `email info`, `email send --from <address> --to <address> --subject <text> --text <body>` (or `--html`), `email logs`, `email sender delete`
|
|
91
|
-
- From app code: `POST https://api.easyhost.fun/api/v1/email/send` with header `Authorization: Bearer <api key>` and JSON `{ "from", "to", "subject", "text" | "html" }`. Create the key with `keys create <name>` and store it with `env set EASYHOST_API_KEY=...`.
|
|
92
|
-
|
|
93
|
-
Schedules (up to five per project, intervals in minutes):
|
|
94
|
-
- `schedules list`, `schedules create <name> --url <url> --every <minutes> [--method POST] [--headers '<json>'] [--body '<text>'] [--paused]`
|
|
95
|
-
- `schedules update <id> [--name <name>] [--url <url>] [--every <minutes>] [--method <method>] [--headers '<json>'] [--body '<text>']`
|
|
96
|
-
- `schedules pause <id>`, `schedules resume <id>`, `schedules logs <id>`, `schedules delete <id> --yes`
|
|
97
|
-
- Public HTTP/HTTPS URLs only, intervals 1 to 43200 minutes, 30-second timeout, no redirects. First call follows one interval; saving/resuming restarts it. Latest 100 runs retained, latest 10 shown. Missed intervals are skipped; execution has up to 10 seconds of polling delay. Requests in progress may finish after pausing/deleting.
|
|
98
|
-
|
|
99
|
-
API keys:
|
|
100
|
-
- `keys list | create <name> | revoke <id>` (a key is shown only once)
|
|
101
|
-
|
|
102
89
|
Members:
|
|
103
90
|
- `members list | invite <email> | revoke <email> | remove <email> --yes | leave --yes`. Only the owner can invite, revoke, remove, rename or delete the project. Members can do everything else.
|
|
104
91
|
- `accept-invite <link-or-token>` joins a project. The logged-in email must match the invited email.
|
|
105
92
|
|
|
106
93
|
Account:
|
|
107
|
-
- `whoami`, `logout`, `resend-verification`, `forgot-password --email <email>`
|
|
94
|
+
- `whoami`, `logout`, `verify <code>`, `resend-verification`, `forgot-password --email <email>`
|
|
95
|
+
- If a command fails with "Your email is not verified", ask the user for the 6-digit code from their inbox and run `verify <code>`. Codes expire after 10 minutes; `resend-verification` sends a new one (once a minute).
|
|
96
|
+
- Limit errors ("You can have 3 projects on the Free plan...", "This project can have 2 apps.") are plan limits: suggest deleting something the user no longer needs, or Pro for more projects.
|
|
97
|
+
- "This app is paused" or "This database is over its size limit": the project is over its plan, so its apps are stopped. Free space (drop tables or delete files) or, for paused projects, upgrade to Pro.
|
|
98
|
+
|
|
99
|
+
Billing:
|
|
100
|
+
- `billing` shows the plan, limits and usage per project. `billing upgrade` prints a Pro checkout link for the user to open (never pay for them). `billing portal` prints the link to manage or cancel.
|
|
108
101
|
|
|
109
102
|
## Limits
|
|
110
103
|
|
|
111
|
-
Free:
|
|
104
|
+
Free: 3 projects. Pro ($10/mo): 10 projects and the AI token balance topped up to 1,000 every month. Per project on both: 2 apps, one bucket (256 MB) and one database (128 MB). One build at a time; 512 MB RAM and 1 CPU per app. A full bucket rejects uploads; a database over its size is blocked and the project's apps stop.
|
|
112
105
|
|
|
113
|
-
Docs: https://
|
|
106
|
+
Docs: https://reverhost.com/docs
|