run402 1.10.0 → 1.10.2

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/cli.mjs CHANGED
@@ -4,9 +4,15 @@
4
4
  * https://run402.com
5
5
  */
6
6
 
7
+ import { readFileSync } from "node:fs";
8
+
7
9
  const [,, cmd, sub, ...rest] = process.argv;
8
10
 
9
- const HELP = `run402 v1.0.0 — Full-stack backend infra for AI agents
11
+ const { version } = JSON.parse(
12
+ readFileSync(new URL("./package.json", import.meta.url), "utf8")
13
+ );
14
+
15
+ const HELP = `run402 v${version} — Full-stack backend infra for AI agents
10
16
  https://run402.com
11
17
 
12
18
  Usage:
@@ -46,9 +52,14 @@ Getting started:
46
52
  run402 deploy --manifest app.json
47
53
  `;
48
54
 
55
+ if (cmd === '--version' || cmd === '-v') {
56
+ console.log(version);
57
+ process.exit(0);
58
+ }
59
+
49
60
  if (!cmd || cmd === '--help' || cmd === '-h') {
50
61
  console.log(HELP);
51
- process.exit(cmd ? 0 : 0);
62
+ process.exit(0);
52
63
  }
53
64
 
54
65
  switch (cmd) {
package/lib/deploy.mjs CHANGED
@@ -15,7 +15,7 @@ Manifest format (JSON):
15
15
  {
16
16
  "name": "my-app",
17
17
  "migrations": "CREATE TABLE items ...",
18
- "site": [{ "file": "index.html", "data": "<html>...</html>" }],
18
+ "files": [{ "file": "index.html", "data": "<html>...</html>" }],
19
19
  "subdomain": "my-app"
20
20
  }
21
21
 
@@ -6,8 +6,8 @@ Usage:
6
6
  run402 subdomains <subcommand> [args...]
7
7
 
8
8
  Subcommands:
9
- claim <deployment_id> <name> [--project <id>] Claim a subdomain for a deployment
10
- delete <name> [--project <id>] Release a subdomain
9
+ claim <deployment_id> <name> --project <id> Claim a subdomain for a deployment
10
+ delete <name> --project <id> Release a subdomain
11
11
  list <id> List subdomains for a project
12
12
 
13
13
  Examples:
@@ -26,11 +26,12 @@ async function claim(deploymentId, name, args) {
26
26
  for (let i = 0; i < args.length; i++) {
27
27
  if (args[i] === "--project" && args[i + 1]) opts.project = args[++i];
28
28
  }
29
- const headers = { "Content-Type": "application/json" };
30
- if (opts.project) {
31
- const p = findProject(opts.project);
32
- headers["Authorization"] = `Bearer ${p.service_key}`;
29
+ if (!opts.project) {
30
+ console.error("Error: --project <id> is required for subdomain claim.");
31
+ process.exit(1);
33
32
  }
33
+ const p = findProject(opts.project);
34
+ const headers = { "Content-Type": "application/json", "Authorization": `Bearer ${p.service_key}` };
34
35
  const res = await fetch(`${API}/subdomains/v1`, {
35
36
  method: "POST",
36
37
  headers,
@@ -46,11 +47,12 @@ async function deleteSubdomain(name, args) {
46
47
  for (let i = 0; i < args.length; i++) {
47
48
  if (args[i] === "--project" && args[i + 1]) opts.project = args[++i];
48
49
  }
49
- const headers = {};
50
- if (opts.project) {
51
- const p = findProject(opts.project);
52
- headers["Authorization"] = `Bearer ${p.service_key}`;
50
+ if (!opts.project) {
51
+ console.error("Error: --project <id> is required for subdomain delete.");
52
+ process.exit(1);
53
53
  }
54
+ const p = findProject(opts.project);
55
+ const headers = { "Authorization": `Bearer ${p.service_key}` };
54
56
  const res = await fetch(`${API}/subdomains/v1/${encodeURIComponent(name)}`, {
55
57
  method: "DELETE",
56
58
  headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 micropayments.",
5
5
  "type": "module",
6
6
  "bin": {