run402 1.10.1 → 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 +13 -2
- package/lib/subdomains.mjs +12 -10
- package/package.json +1 -1
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
|
|
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(
|
|
62
|
+
process.exit(0);
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
switch (cmd) {
|
package/lib/subdomains.mjs
CHANGED
|
@@ -6,8 +6,8 @@ Usage:
|
|
|
6
6
|
run402 subdomains <subcommand> [args...]
|
|
7
7
|
|
|
8
8
|
Subcommands:
|
|
9
|
-
claim <deployment_id> <name>
|
|
10
|
-
delete <name>
|
|
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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