ezhst 1.3.3 → 1.3.5

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.
@@ -1,6 +1,7 @@
1
1
  import { json, request } from "../lib/api.js";
2
+ import { readLinkedProject, writeLinkedProject } from "../lib/config.js";
2
3
  import { resolveApp, resolveProject } from "../lib/project.js";
3
- import { confirmed, log, output } from "../lib/ui.js";
4
+ import { confirmed, fail, log, output } from "../lib/ui.js";
4
5
  export const listApps = async (options) => {
5
6
  await resolveProject(options);
6
7
  const result = await request("/apps");
@@ -22,3 +23,23 @@ export const deleteApp = async (options) => {
22
23
  const result = await request(`/apps/${app.id}`, { method: "DELETE" });
23
24
  output(result, () => log.success(`Deleted ${app.slug}`));
24
25
  };
26
+ export const renameApp = async (name, options) => {
27
+ const current = await resolveApp(options);
28
+ const { app } = await request(`/apps/${current.id}`, json("PUT", { name }));
29
+ output({ app }, () => log.success(`Renamed to ${app.name}`));
30
+ };
31
+ export const transferApp = async (options) => {
32
+ const app = await resolveApp(options);
33
+ const { projects } = await request("/projects");
34
+ const target = projects.find((project) => project.slug === options.to || project.id === options.to);
35
+ if (!target) {
36
+ return fail(`Project ${options.to} not found. List projects with \`ezhst projects list\`.`);
37
+ }
38
+ confirmed(options.yes, `Transferring ${app.slug} moves it, its deployments, environment variables and domains to ${target.slug}.`);
39
+ const result = await request(`/apps/${app.id}/transfer`, json("POST", { projectId: target.id }));
40
+ const linked = readLinkedProject();
41
+ if (linked?.appId === app.id) {
42
+ writeLinkedProject({ projectId: target.id, slug: target.slug, appId: app.id });
43
+ }
44
+ output(result, () => log.success(result.message));
45
+ };
@@ -76,9 +76,9 @@ export const setDockerfile = async (options) => {
76
76
  export const dockerfileTemplate = async (id, options) => {
77
77
  const templates = await listTemplates();
78
78
  if (!id) {
79
- output({ templates: templates.map((template) => ({ id: template.id, label: template.label })) }, () => {
79
+ output({ templates: templates.map((template) => ({ id: template.id, group: template.group, label: template.label })) }, () => {
80
80
  for (const template of templates) {
81
- log.info(`${template.id.padEnd(8)} ${template.label}`);
81
+ log.info(`${template.id.padEnd(14)} ${template.group.padEnd(9)} ${template.label}`);
82
82
  }
83
83
  });
84
84
  return;
@@ -99,20 +99,32 @@ export const ensureDockerfile = async (project) => {
99
99
  if (project.dockerfile) {
100
100
  return project;
101
101
  }
102
- const hint = "This app has no Dockerfile. Write one and run `ezhst build dockerfile set -f Dockerfile`, or start from a template with `ezhst build dockerfile template <id> --apply`.";
102
+ const hint = "This app has no Dockerfile. Pipe one in with `ezhst build dockerfile set -f -`, or start from a template with `ezhst build dockerfile template <id> --apply`.";
103
103
  if (!isInteractive()) {
104
104
  fail(hint);
105
105
  }
106
106
  const templates = await listTemplates();
107
- const choice = await select({
107
+ const groups = [...new Set(templates.map((template) => template.group))];
108
+ const group = await select({
108
109
  message: "This app has no Dockerfile. Start from a template?",
109
- choices: [...templates.map((template) => ({ name: template.label, value: template.id })), { name: "Cancel", value: "" }],
110
+ choices: [...groups.map((name) => ({ name, value: name })), { name: "Cancel", value: "" }],
110
111
  });
112
+ const options = templates.filter((item) => item.group === group);
113
+ let choice = "";
114
+ if (options.length === 1) {
115
+ choice = options[0].id;
116
+ }
117
+ else if (options.length > 1) {
118
+ choice = await select({
119
+ message: "Which framework?",
120
+ choices: options.map((template) => ({ name: template.label, value: template.id })),
121
+ });
122
+ }
111
123
  const template = templates.find((item) => item.id === choice);
112
124
  if (!template) {
113
125
  return fail(hint);
114
126
  }
115
127
  const app = await saveSettings(project, { dockerfile: template.content });
116
- log.success(`${template.label} Dockerfile saved. Edit it later with \`ezhst build dockerfile set -f <file>\`.`);
128
+ log.success(`${template.label} Dockerfile saved. Edit it later in the Build tab or with \`ezhst build dockerfile set -f -\`.`);
117
129
  return app;
118
130
  };
@@ -25,7 +25,7 @@ const IGNORED_DIRS = new Set([
25
25
  ".zig-cache",
26
26
  "zig-cache",
27
27
  ]);
28
- const IGNORED_FILES = new Set([".DS_Store", ".easyhost.json"]);
28
+ const IGNORED_FILES = new Set([".DS_Store", ".reverhost.json"]);
29
29
  const isIgnored = (entry) => {
30
30
  const parts = entry.replace(/^\.\//, "").split("/");
31
31
  if (parts.some((part) => IGNORED_DIRS.has(part))) {
@@ -38,7 +38,7 @@ const isIgnored = (entry) => {
38
38
  return name.startsWith(".env") && name !== ".env.example";
39
39
  };
40
40
  const packSource = async (cwd) => {
41
- const stage = mkdtempSync(path.join(tmpdir(), "easyhost-"));
41
+ const stage = mkdtempSync(path.join(tmpdir(), "reverhost-"));
42
42
  const archive = path.join(stage, "app.tgz");
43
43
  await tar.create({ gzip: true, cwd, file: archive, portable: true, filter: (entry) => !isIgnored(entry) }, ["."]);
44
44
  return { stage, archive };
@@ -41,7 +41,7 @@ export const installSkill = async (options) => {
41
41
  if (scope === "global") {
42
42
  base = homedir();
43
43
  }
44
- const directory = path.join(base, agent.folder, "skills", "easyhost");
44
+ const directory = path.join(base, agent.folder, "skills", "reverhost");
45
45
  const target = path.join(directory, "SKILL.md");
46
46
  mkdirSync(directory, { recursive: true });
47
47
  copyFileSync(SKILL_SOURCE, target);
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { Command } from "commander";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { forgotPassword, login, logout, register, resendVerification, verify, whoami } from "./commands/auth.js";
5
- import { createApp, deleteApp, listApps } from "./commands/apps.js";
5
+ import { createApp, deleteApp, listApps, renameApp, transferApp } from "./commands/apps.js";
6
6
  import { createProject, deleteProject, link, listProjects, logs, projectInfo, renameProject, start, stop } from "./commands/projects.js";
7
7
  import { deploy, deploymentLog, listDeployments, redeploy } from "./commands/deploy.js";
8
8
  import { importEnv, listEnv, setEnv, unsetEnv } from "./commands/env.js";
@@ -94,6 +94,12 @@ appScoped(domains.command("remove").description("Remove a domain").argument("<ho
94
94
  const apps = program.command("apps").description("Manage the apps in a project (2 per project)");
95
95
  scoped(apps.command("list").description("List apps in a project")).action(listApps);
96
96
  scoped(apps.command("create").description("Create an app").argument("<name>")).action(createApp);
97
+ appScoped(apps.command("rename").description("Rename an app").argument("<name>")).action(renameApp);
98
+ appScoped(apps
99
+ .command("transfer")
100
+ .description("Move an app to another project you own")
101
+ .requiredOption("--to <project>", "Target project slug or ID")
102
+ .option("--yes", "Confirm")).action(transferApp);
97
103
  appScoped(apps.command("delete").description("Delete one app and its deployments").option("--yes", "Confirm")).action(deleteApp);
98
104
  const billing = program.command("billing").description("Plan, usage and the Pro subscription");
99
105
  billing.command("show", { isDefault: true }).description("Show your plan, limits and usage").action(showBilling);
@@ -1,9 +1,9 @@
1
1
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
3
  import path from "node:path";
4
- const CONFIG_DIR = path.join(homedir(), ".easyhost");
4
+ const CONFIG_DIR = path.join(homedir(), ".reverhost");
5
5
  const CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
6
- const PROJECT_FILE = ".easyhost.json";
6
+ const PROJECT_FILE = ".reverhost.json";
7
7
  const PRODUCTION_API_URL = "https://api.reverhost.com";
8
8
  export const readConfig = () => {
9
9
  let config = { apiUrl: PRODUCTION_API_URL };
@@ -37,7 +37,7 @@ export const linkProject = async (slug) => {
37
37
  return fail("Missing --project <slug>. List projects with `ezhst projects list`.");
38
38
  }
39
39
  writeLinkedProject({ projectId: project.id, slug: project.slug });
40
- log.dim("Saved project link in .easyhost.json");
40
+ log.dim("Saved project link in .reverhost.json");
41
41
  return project;
42
42
  };
43
43
  export const resolveProject = async (options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ezhst",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Reverhost CLI: agent-first hosting for Node.js apps with storage and databases",
5
5
  "type": "module",
6
6
  "bin": {
package/skill/SKILL.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: easyhost
2
+ name: reverhost
3
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 an app (any language, built from a Dockerfile) to Reverhost, or to manage its environment variables, build settings, logs, custom domains, S3 storage or Postgres database.
4
4
  ---
5
5
 
@@ -11,8 +11,8 @@ Reverhost is free hosting for apps in any language, built from a Dockerfile you
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
- - 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`, `storage delete`, `db delete`) need `--yes`. Only run them when the user explicitly asks.
14
+ - Commands that act on a project use the project linked in `.reverhost.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`, `apps transfer`, `storage delete`, `db delete`) need `--yes`. Only run them when the user explicitly asks.
16
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
 
@@ -38,7 +38,7 @@ npx ezhst link --project <slug> --json
38
38
 
39
39
  Every app builds from a Dockerfile stored on the app, not from a file in the repo. Never create, edit or upload a `Dockerfile` file in the user's project. Always write the Dockerfile straight to the app through the CLI. Run inside the app folder:
40
40
 
41
- 1. Inspect the repo and pick a template: `npx ezhst build dockerfile template --json` lists them, `npx ezhst build dockerfile template <id> --json` returns one. Ids include node, express, nestjs, nextjs, nuxt, sveltekit, react-router, astro, bun, elysia, fastapi, flask, django, streamlit, rails, ruby, laravel, php, go, rust, zig, vite, static. A Dockerfile already in the repo is only a reference: read it, adapt it, and send the result through the CLI like any other.
41
+ 1. Inspect the repo, then always fetch the current template list from the API with `npx ezhst build dockerfile template --json` and pick the id that matches the framework. `npx ezhst build dockerfile template <id> --json` returns one template with its Dockerfile. A Dockerfile already in the repo is only a reference: read it, adapt it, and send the result through the CLI like any other.
42
42
  2. Adapt the template to the repo, then save it to the app by piping it through stdin with a quoted heredoc (`<<'EOF'`, so the shell does not expand `$PORT` or `$(...)`). If the template fits unchanged, `npx ezhst build dockerfile template <id> --apply --json` saves it directly.
43
43
  3. The app must listen on `0.0.0.0` and `$PORT` (3000).
44
44
  4. Env vars are runtime env. If the build step needs them, use `RUN --mount=type=secret,id=appenv,target=/run/secrets/appenv sh -c 'set -a; . /run/secrets/appenv; set +a; <build command>'`. Never put secrets in `ARG` or `ENV`.
@@ -76,7 +76,7 @@ After changing env vars or build settings, run `npx ezhst redeploy --json` (rebu
76
76
 
77
77
  Projects and runtime:
78
78
  - `projects list | info | rename <name> | delete --yes`, `projects create <name> [--link]`, `link --project <slug>`
79
- - `apps list | create <name> | delete --yes`
79
+ - `apps list | create <name> | rename <name> | transfer --to <project-slug> --yes | delete --yes` (transfer moves an app to another project you own; only when the user asks)
80
80
  - `deploy [--verbose] [--app <slug>]`, `redeploy`, `start`, `stop`
81
81
  - `logs [--tail 200]` runtime logs
82
82
  - `deployments list`, `deployments log [deploymentId]` build logs
@@ -114,6 +114,6 @@ Billing:
114
114
 
115
115
  ## Limits
116
116
 
117
- 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.
117
+ Free: 3 projects. Pro ($10/mo): 10 projects and the AI token balance topped up to 500 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.
118
118
 
119
119
  Docs: https://reverhost.com/docs