run402 1.36.0 → 1.37.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/lib/ai.mjs CHANGED
@@ -22,6 +22,32 @@ Notes:
22
22
  - usage shows translation word quota for the current billing period
23
23
  `;
24
24
 
25
+ const SUB_HELP = {
26
+ translate: `run402 ai translate — Translate text to another language
27
+
28
+ Usage:
29
+ run402 ai translate <project_id> <text> --to <lang> [--from <lang>] [--context <hint>]
30
+
31
+ Arguments:
32
+ <project_id> Project ID (defaults to the active project if omitted)
33
+ <text> Text to translate (quote it to preserve spaces)
34
+
35
+ Options:
36
+ --to <lang> Target language code (required, e.g. es, ja, fr)
37
+ --from <lang> Source language code (optional; auto-detected if omitted)
38
+ --context <hint> Optional translation hint (e.g. "formal business email")
39
+
40
+ Notes:
41
+ - Requires the AI Translation add-on on the project
42
+ - Counts against the project's translation word quota
43
+
44
+ Examples:
45
+ run402 ai translate proj-001 "Hello world" --to es
46
+ run402 ai translate proj-001 "Hello" --to ja --from en \\
47
+ --context "formal business email"
48
+ `,
49
+ };
50
+
25
51
  function parseFlag(args, flag) {
26
52
  for (let i = 0; i < args.length; i++) {
27
53
  if (args[i] === flag && args[i + 1]) return args[i + 1];
@@ -119,6 +145,7 @@ async function usage(args) {
119
145
 
120
146
  export async function run(sub, args) {
121
147
  if (!sub || sub === '--help' || sub === '-h') { console.log(HELP); process.exit(0); }
148
+ if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) { console.log(SUB_HELP[sub] || HELP); process.exit(0); }
122
149
  switch (sub) {
123
150
  case "translate": await translate(args); break;
124
151
  case "moderate": await moderate(args); break;
package/lib/allowance.mjs CHANGED
@@ -29,6 +29,33 @@ Examples:
29
29
  run402 allowance history --limit 10
30
30
  `;
31
31
 
32
+ const SUB_HELP = {
33
+ checkout: `run402 allowance checkout — Create a billing checkout session
34
+
35
+ Usage:
36
+ run402 allowance checkout --amount <usd_micros>
37
+
38
+ Options:
39
+ --amount <n> Amount in USD micros (required; e.g. 5000000 for $5)
40
+
41
+ Examples:
42
+ run402 allowance checkout --amount 5000000
43
+ run402 allowance checkout --amount 10000000
44
+ `,
45
+ history: `run402 allowance history — View billing transaction history
46
+
47
+ Usage:
48
+ run402 allowance history [--limit <n>]
49
+
50
+ Options:
51
+ --limit <n> Max entries to return (default: 20)
52
+
53
+ Examples:
54
+ run402 allowance history
55
+ run402 allowance history --limit 10
56
+ `,
57
+ };
58
+
32
59
  const USDC_ABI = [{ name: "balanceOf", type: "function", stateMutability: "view", inputs: [{ name: "account", type: "address" }], outputs: [{ name: "", type: "uint256" }] }];
33
60
  const USDC_MAINNET = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
34
61
  const USDC_SEPOLIA = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
@@ -213,6 +240,10 @@ export async function run(sub, args) {
213
240
  console.log(HELP);
214
241
  process.exit(0);
215
242
  }
243
+ if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) {
244
+ console.log(SUB_HELP[sub] || HELP);
245
+ process.exit(0);
246
+ }
216
247
  switch (sub) {
217
248
  case "status": await status(); break;
218
249
  case "create": await create(); break;
package/lib/apps.mjs CHANGED
@@ -28,6 +28,78 @@ Examples:
28
28
  run402 apps delete proj123 ver_abc123
29
29
  `;
30
30
 
31
+ const SUB_HELP = {
32
+ browse: `run402 apps browse — Browse public apps in the marketplace
33
+
34
+ Usage:
35
+ run402 apps browse [--tag <tag>]
36
+
37
+ Options:
38
+ --tag <tag> Filter by tag; repeat the flag to filter on multiple tags
39
+
40
+ Examples:
41
+ run402 apps browse
42
+ run402 apps browse --tag auth
43
+ run402 apps browse --tag todo --tag auth
44
+ `,
45
+ fork: `run402 apps fork — Fork a published app into your own project
46
+
47
+ Usage:
48
+ run402 apps fork <version_id> <name> [options]
49
+
50
+ Arguments:
51
+ <version_id> Published version ID (e.g. ver_abc123)
52
+ <name> Name for the forked project
53
+
54
+ Options:
55
+ --tier <tier> Tier for the new project (default: prototype)
56
+ --subdomain <name> Claim a subdomain for the forked project
57
+
58
+ Examples:
59
+ run402 apps fork ver_abc123 my-todo
60
+ run402 apps fork ver_abc123 my-todo --tier hobby --subdomain todo-v2
61
+ `,
62
+ publish: `run402 apps publish — Publish a project as an app
63
+
64
+ Usage:
65
+ run402 apps publish <id> [options]
66
+
67
+ Arguments:
68
+ <id> Project ID to publish
69
+
70
+ Options:
71
+ --description <d> Human-readable description of the app
72
+ --tags <t1,t2> Comma-separated list of tags
73
+ --visibility <v> Visibility: 'public' or 'private'
74
+ --fork-allowed Allow other users to fork this app
75
+
76
+ Examples:
77
+ run402 apps publish proj123 --description "Todo app" --tags todo,auth
78
+ run402 apps publish proj123 --visibility public --fork-allowed
79
+ `,
80
+ update: `run402 apps update — Update a published version's metadata
81
+
82
+ Usage:
83
+ run402 apps update <project_id> <version_id> [options]
84
+
85
+ Arguments:
86
+ <project_id> Project ID that owns the version
87
+ <version_id> Published version ID to update
88
+
89
+ Options:
90
+ --description <d> New description
91
+ --tags <t1,t2> New comma-separated list of tags
92
+ --visibility <v> New visibility ('public' or 'private')
93
+ --fork-allowed Enable forking for this version
94
+ --no-fork Disable forking for this version
95
+
96
+ Examples:
97
+ run402 apps update proj123 ver_abc123 --description "Updated"
98
+ run402 apps update proj123 ver_abc123 --tags todo,auth --fork-allowed
99
+ run402 apps update proj123 ver_abc123 --no-fork
100
+ `,
101
+ };
102
+
31
103
  async function browse(args) {
32
104
  let url = `${API}/apps/v1`;
33
105
  const tags = [];
@@ -152,6 +224,7 @@ async function deleteVersion(projectId, versionId) {
152
224
 
153
225
  export async function run(sub, args) {
154
226
  if (!sub || sub === '--help' || sub === '-h') { console.log(HELP); process.exit(0); }
227
+ if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) { console.log(SUB_HELP[sub] || HELP); process.exit(0); }
155
228
  switch (sub) {
156
229
  case "browse": await browse(args); break;
157
230
  case "fork": await fork(args[0], args[1], args.slice(2)); break;
package/lib/auth.mjs CHANGED
@@ -29,6 +29,84 @@ Examples:
29
29
  run402 auth providers
30
30
  `;
31
31
 
32
+ const SUB_HELP = {
33
+ "magic-link": `run402 auth magic-link — Send a passwordless login link
34
+
35
+ Usage:
36
+ run402 auth magic-link --email <addr> --redirect <url> [options]
37
+
38
+ Options:
39
+ --email <addr> Required: recipient email address
40
+ --redirect <url> Required: URL to redirect to after the user clicks
41
+ --project <id> Project ID (defaults to active project)
42
+
43
+ Notes:
44
+ Auto-creates the user on first use. Uses the project's anon_key.
45
+
46
+ Examples:
47
+ run402 auth magic-link --email user@example.com \\
48
+ --redirect https://myapp.run402.com/cb
49
+ `,
50
+ verify: `run402 auth verify — Exchange a magic-link token for session tokens
51
+
52
+ Usage:
53
+ run402 auth verify --token <token> [options]
54
+
55
+ Options:
56
+ --token <token> Required: the one-time magic-link token
57
+ --project <id> Project ID (defaults to active project)
58
+
59
+ Notes:
60
+ Returns an access_token + refresh_token pair on success.
61
+
62
+ Examples:
63
+ run402 auth verify --token abc123def456
64
+ `,
65
+ "set-password": `run402 auth set-password — Change, reset, or set a user's password
66
+
67
+ Usage:
68
+ run402 auth set-password --token <bearer> --new <password> [options]
69
+
70
+ Options:
71
+ --token <bearer> Required: the user's access_token (Bearer token)
72
+ --new <password> Required: new password
73
+ --current <pwd> Current password (required when one is already set)
74
+ --project <id> Project ID (defaults to active project)
75
+
76
+ Examples:
77
+ run402 auth set-password --token eyJ... --new "new-pass" \\
78
+ --current "old-pass"
79
+ `,
80
+ settings: `run402 auth settings — Update project auth settings
81
+
82
+ Usage:
83
+ run402 auth settings --allow-password-set <true|false> [options]
84
+
85
+ Options:
86
+ --allow-password-set <true|false> Required: toggle password-set flow
87
+ --project <id> Project ID (defaults to active project)
88
+
89
+ Notes:
90
+ Requires the project's service_key (admin-level).
91
+
92
+ Examples:
93
+ run402 auth settings --allow-password-set true
94
+ run402 auth settings --allow-password-set false --project abc123
95
+ `,
96
+ providers: `run402 auth providers — List available auth providers
97
+
98
+ Usage:
99
+ run402 auth providers [options]
100
+
101
+ Options:
102
+ --project <id> Project ID (defaults to active project)
103
+
104
+ Examples:
105
+ run402 auth providers
106
+ run402 auth providers --project abc123
107
+ `,
108
+ };
109
+
32
110
  function parseFlag(args, flag) {
33
111
  for (let i = 0; i < args.length; i++) {
34
112
  if (args[i] === flag && args[i + 1]) return args[i + 1];
@@ -90,6 +168,8 @@ async function setPassword(args) {
90
168
  const accessToken = parseFlag(args, "--token");
91
169
  const newPassword = parseFlag(args, "--new");
92
170
  const currentPassword = parseFlag(args, "--current");
171
+ const projectId = resolveProjectId(parseFlag(args, "--project"));
172
+ const p = findProject(projectId);
93
173
 
94
174
  if (!accessToken) { console.error(JSON.stringify({ status: "error", message: "Missing --token <bearer_token>" })); process.exit(1); }
95
175
  if (!newPassword) { console.error(JSON.stringify({ status: "error", message: "Missing --new <password>" })); process.exit(1); }
@@ -97,9 +177,16 @@ async function setPassword(args) {
97
177
  const body = { new_password: newPassword };
98
178
  if (currentPassword) body.current_password = currentPassword;
99
179
 
180
+ // /auth/v1/* is gated by apikeyAuth middleware: the `apikey` header must be
181
+ // the project's anon_key. `Authorization: Bearer <access_token>` stays as
182
+ // the user's identity so the server knows whose password to change.
100
183
  const res = await fetch(`${API}/auth/v1/user/password`, {
101
184
  method: "PUT",
102
- headers: { "Authorization": `Bearer ${accessToken}`, "Content-Type": "application/json" },
185
+ headers: {
186
+ "apikey": p.anon_key,
187
+ "Authorization": `Bearer ${accessToken}`,
188
+ "Content-Type": "application/json",
189
+ },
103
190
  body: JSON.stringify(body),
104
191
  });
105
192
  const data = await res.json();
@@ -155,7 +242,7 @@ async function providers(args) {
155
242
  export async function run(sub, args) {
156
243
  if (!sub || sub === "--help" || sub === "-h") { console.log(HELP); process.exit(0); }
157
244
  if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) {
158
- console.log(HELP);
245
+ console.log(SUB_HELP[sub] || HELP);
159
246
  process.exit(0);
160
247
  }
161
248
  switch (sub) {
package/lib/billing.mjs CHANGED
@@ -22,6 +22,69 @@ Examples:
22
22
  run402 billing balance user@example.com
23
23
  `;
24
24
 
25
+ const SUB_HELP = {
26
+ "tier-checkout": `run402 billing tier-checkout — Create a Stripe tier checkout session
27
+
28
+ Usage:
29
+ run402 billing tier-checkout <tier> [--email <e> | --wallet <w>]
30
+
31
+ Arguments:
32
+ <tier> Tier name (e.g. hobby, pro)
33
+
34
+ Options:
35
+ --email <e> Email billing account to charge
36
+ --wallet <w> Wallet address (0x...) to associate with the checkout
37
+
38
+ Examples:
39
+ run402 billing tier-checkout hobby --email user@example.com
40
+ run402 billing tier-checkout pro --wallet 0x1234...
41
+ `,
42
+ "buy-email-pack": `run402 billing buy-email-pack — Buy a $5 email pack (10,000 emails)
43
+
44
+ Usage:
45
+ run402 billing buy-email-pack [--email <e> | --wallet <w>]
46
+
47
+ Options:
48
+ --email <e> Email billing account to charge
49
+ --wallet <w> Wallet address (0x...) to associate with the purchase
50
+
51
+ Examples:
52
+ run402 billing buy-email-pack --email user@example.com
53
+ run402 billing buy-email-pack --wallet 0x1234...
54
+ `,
55
+ "auto-recharge": `run402 billing auto-recharge — Toggle email-pack auto-recharge
56
+
57
+ Usage:
58
+ run402 billing auto-recharge <account_id> <on|off> [--threshold <n>]
59
+
60
+ Arguments:
61
+ <account_id> Billing account ID
62
+ <on|off> Enable or disable auto-recharge
63
+
64
+ Options:
65
+ --threshold <n> Remaining-email threshold that triggers auto-recharge
66
+
67
+ Examples:
68
+ run402 billing auto-recharge acct_abc on --threshold 2000
69
+ run402 billing auto-recharge acct_abc off
70
+ `,
71
+ history: `run402 billing history — Show ledger history for an email or wallet
72
+
73
+ Usage:
74
+ run402 billing history <identifier> [--limit <n>]
75
+
76
+ Arguments:
77
+ <identifier> Email address or wallet (0x...)
78
+
79
+ Options:
80
+ --limit <n> Max entries to return (default: 50)
81
+
82
+ Examples:
83
+ run402 billing history user@example.com
84
+ run402 billing history 0x1234... --limit 100
85
+ `,
86
+ };
87
+
25
88
  function parseFlag(args, flag) {
26
89
  for (let i = 0; i < args.length; i++) {
27
90
  if (args[i] === flag && args[i + 1]) return args[i + 1];
@@ -153,6 +216,7 @@ async function history(args) {
153
216
 
154
217
  export async function run(sub, args) {
155
218
  if (!sub || sub === "--help" || sub === "-h") { console.log(HELP); process.exit(0); }
219
+ if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) { console.log(SUB_HELP[sub] || HELP); process.exit(0); }
156
220
  switch (sub) {
157
221
  case "create-email": await createEmail(args); break;
158
222
  case "link-wallet": await linkWallet(args); break;
package/lib/blob.mjs CHANGED
@@ -68,6 +68,89 @@ Examples:
68
68
  run402 blob sign images/logo.png --project abc123 --ttl 600
69
69
  `;
70
70
 
71
+ const SUB_HELP = {
72
+ put: `run402 blob put — Upload one or more files to blob storage
73
+
74
+ Usage:
75
+ run402 blob put <file> [files...] [options]
76
+
77
+ Arguments:
78
+ <file> Path to a file (or glob); pass multiple files to batch-upload
79
+
80
+ Options:
81
+ --project <id> Project ID (defaults to active project from 'run402 projects use')
82
+ --key <dest> Destination key; defaults to file basename. Use trailing '/' as prefix.
83
+ --private Upload as private (not served by CDN; apikey required to read)
84
+ --immutable Append content-hash suffix so overwrites produce distinct URLs
85
+ --concurrency N Concurrent part PUTs for multipart uploads (default 4)
86
+ --no-resume Ignore any cached resumable-upload state and start fresh
87
+ --json Emit NDJSON progress events on stdout (for agent consumption)
88
+
89
+ Examples:
90
+ run402 blob put ./artifact.tgz --project abc123
91
+ run402 blob put ./dist/**/*.png --project abc123 --key assets/
92
+ run402 blob put huge.bin --project abc123 --immutable --concurrency 8
93
+ `,
94
+ get: `run402 blob get — Download a blob by key
95
+
96
+ Usage:
97
+ run402 blob get <key> --output <file> [options]
98
+
99
+ Arguments:
100
+ <key> Blob key to download
101
+
102
+ Options:
103
+ --output <file> Local destination path (required)
104
+ --project <id> Project ID (defaults to active project)
105
+
106
+ Examples:
107
+ run402 blob get images/logo.png --output /tmp/logo.png --project abc123
108
+ `,
109
+ ls: `run402 blob ls — List blob keys in a project
110
+
111
+ Usage:
112
+ run402 blob ls [options]
113
+
114
+ Options:
115
+ --project <id> Project ID (defaults to active project)
116
+ --prefix <p> Only list keys starting with this prefix
117
+ --limit <n> Max results (default 100, max 1000)
118
+
119
+ Examples:
120
+ run402 blob ls --project abc123
121
+ run402 blob ls --project abc123 --prefix images/ --limit 500
122
+ `,
123
+ rm: `run402 blob rm — Delete a blob
124
+
125
+ Usage:
126
+ run402 blob rm <key> [options]
127
+
128
+ Arguments:
129
+ <key> Blob key to delete
130
+
131
+ Options:
132
+ --project <id> Project ID (defaults to active project)
133
+
134
+ Examples:
135
+ run402 blob rm images/logo.png --project abc123
136
+ `,
137
+ sign: `run402 blob sign — Create a presigned download URL for a blob
138
+
139
+ Usage:
140
+ run402 blob sign <key> [options]
141
+
142
+ Arguments:
143
+ <key> Blob key to sign
144
+
145
+ Options:
146
+ --project <id> Project ID (defaults to active project)
147
+ --ttl <seconds> Signed-URL TTL (default 3600, max 604800)
148
+
149
+ Examples:
150
+ run402 blob sign reports/2025-q4.pdf --project abc123 --ttl 600
151
+ `,
152
+ };
153
+
71
154
  const UPLOAD_STATE_DIR = join(homedir(), ".run402", "uploads");
72
155
 
73
156
  function die(msg, code = 1) {
@@ -428,7 +511,7 @@ export async function run(sub, args) {
428
511
  process.exit(0);
429
512
  }
430
513
  if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) {
431
- console.log(HELP);
514
+ console.log(SUB_HELP[sub] || HELP);
432
515
  process.exit(0);
433
516
  }
434
517
  const defaultProject = process.env.RUN402_PROJECT ?? null;
package/lib/contracts.mjs CHANGED
@@ -36,6 +36,144 @@ Examples:
36
36
  run402 contracts call proj_abc cwlt_xyz --to 0x1234... --abi '[{"type":"function","name":"ping","inputs":[],"outputs":[]}]' --fn ping --args '[]'
37
37
  `;
38
38
 
39
+ const SUB_HELP = {
40
+ "provision-wallet": `run402 contracts provision-wallet — Provision a KMS-backed wallet
41
+
42
+ Usage:
43
+ run402 contracts provision-wallet <project_id> --chain <chain> [options]
44
+
45
+ Arguments:
46
+ <project_id> Target project ID
47
+
48
+ Options:
49
+ --chain <chain> Required: base-mainnet or base-sepolia
50
+ --recovery 0x... Optional recovery address (can be set later)
51
+ --yes Skip confirmation when project already has a wallet
52
+
53
+ Pricing:
54
+ $0.04/day per wallet ($1.20/month). Creation requires $1.20 prepay
55
+ (30 days of rent). Non-custodial — see terms.html#non-custodial-kms-wallets.
56
+
57
+ Examples:
58
+ run402 contracts provision-wallet proj_abc --chain base-mainnet
59
+ run402 contracts provision-wallet proj_abc --chain base-sepolia --recovery 0xAbC...
60
+ `,
61
+ "set-recovery": `run402 contracts set-recovery — Set or clear the wallet recovery address
62
+
63
+ Usage:
64
+ run402 contracts set-recovery <project_id> <wallet_id> [options]
65
+
66
+ Arguments:
67
+ <project_id> Target project ID
68
+ <wallet_id> KMS wallet ID (cwlt_...)
69
+
70
+ Options:
71
+ --address 0x... New recovery address
72
+ --clear Clear the recovery address (mutually exclusive with --address)
73
+
74
+ Examples:
75
+ run402 contracts set-recovery proj_abc cwlt_xyz --address 0xAbC...
76
+ run402 contracts set-recovery proj_abc cwlt_xyz --clear
77
+ `,
78
+ "set-alert": `run402 contracts set-alert — Set the low-balance alert threshold
79
+
80
+ Usage:
81
+ run402 contracts set-alert <project_id> <wallet_id> --threshold-wei <n>
82
+
83
+ Arguments:
84
+ <project_id> Target project ID
85
+ <wallet_id> KMS wallet ID (cwlt_...)
86
+
87
+ Options:
88
+ --threshold-wei <n> Required: alert threshold in wei
89
+
90
+ Examples:
91
+ run402 contracts set-alert proj_abc cwlt_xyz --threshold-wei 1000000000000000
92
+ `,
93
+ call: `run402 contracts call — Submit a contract write call
94
+
95
+ Usage:
96
+ run402 contracts call <project_id> <wallet_id> --to 0x... --abi <json>
97
+ --fn <name> --args <json> [options]
98
+
99
+ Arguments:
100
+ <project_id> Target project ID
101
+ <wallet_id> KMS wallet ID (cwlt_...)
102
+
103
+ Options:
104
+ --to 0x... Required: contract address
105
+ --abi <json> Required: ABI fragment (JSON string)
106
+ --fn <name> Required: function name to invoke
107
+ --args <json> Required: function args (JSON array)
108
+ --value-wei <n> Native value to send (default 0)
109
+ --chain <chain> Chain override (default: base-mainnet)
110
+ --idempotency-key <k> Idempotency key for safe retries
111
+
112
+ Pricing:
113
+ Chain gas + $0.000005 KMS sign fee per call.
114
+
115
+ Examples:
116
+ run402 contracts call proj_abc cwlt_xyz --to 0x1234... \\
117
+ --abi '[{"type":"function","name":"ping","inputs":[],"outputs":[]}]' \\
118
+ --fn ping --args '[]'
119
+ `,
120
+ read: `run402 contracts read — Read-only contract call (free)
121
+
122
+ Usage:
123
+ run402 contracts read --chain <chain> --to 0x... --abi <json>
124
+ --fn <name> --args <json>
125
+
126
+ Options:
127
+ --chain <chain> Required: base-mainnet or base-sepolia
128
+ --to 0x... Required: contract address
129
+ --abi <json> Required: ABI fragment (JSON string)
130
+ --fn <name> Required: function name to invoke
131
+ --args <json> Required: function args (JSON array)
132
+
133
+ Examples:
134
+ run402 contracts read --chain base-mainnet --to 0x1234... \\
135
+ --abi '[{"type":"function","name":"balanceOf","inputs":[{"type":"address"}],"outputs":[{"type":"uint256"}]}]' \\
136
+ --fn balanceOf --args '["0xAbC..."]'
137
+ `,
138
+ drain: `run402 contracts drain — Drain native balance to a destination address
139
+
140
+ Usage:
141
+ run402 contracts drain <project_id> <wallet_id> --to 0x... --confirm
142
+
143
+ Arguments:
144
+ <project_id> Target project ID
145
+ <wallet_id> KMS wallet ID (cwlt_...)
146
+
147
+ Options:
148
+ --to 0x... Required: destination address
149
+ --confirm Required: explicit confirmation flag
150
+
151
+ Notes:
152
+ Works on suspended wallets. Cost: chain gas + $0.000005 KMS sign fee.
153
+
154
+ Examples:
155
+ run402 contracts drain proj_abc cwlt_xyz --to 0xAbC... --confirm
156
+ `,
157
+ delete: `run402 contracts delete — Schedule the KMS key for deletion
158
+
159
+ Usage:
160
+ run402 contracts delete <project_id> <wallet_id> --confirm
161
+
162
+ Arguments:
163
+ <project_id> Target project ID
164
+ <wallet_id> KMS wallet ID (cwlt_...)
165
+
166
+ Options:
167
+ --confirm Required: explicit confirmation flag
168
+
169
+ Notes:
170
+ Refused if wallet balance is greater than or equal to dust. Drain first.
171
+
172
+ Examples:
173
+ run402 contracts delete proj_abc cwlt_xyz --confirm
174
+ `,
175
+ };
176
+
39
177
  function parseFlag(args, flag) {
40
178
  for (let i = 0; i < args.length; i++) {
41
179
  if (args[i] === flag && args[i + 1]) return args[i + 1];
@@ -243,6 +381,7 @@ async function deleteWallet(projectId, walletId, args) {
243
381
 
244
382
  export async function run(sub, args) {
245
383
  if (!sub || sub === "--help" || sub === "-h") { console.log(HELP); process.exit(0); }
384
+ if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) { console.log(SUB_HELP[sub] || HELP); process.exit(0); }
246
385
  switch (sub) {
247
386
  case "provision-wallet": await provisionWallet(args[0], args.slice(1)); break;
248
387
  case "get-wallet": await getWallet(args[0], args[1]); break;
package/lib/domains.mjs CHANGED
@@ -92,6 +92,7 @@ async function deleteDomain(args) {
92
92
 
93
93
  export async function run(sub, args) {
94
94
  if (!sub || sub === '--help' || sub === '-h') { console.log(HELP); process.exit(0); }
95
+ if (Array.isArray(args) && (args.includes("--help") || args.includes("-h"))) { console.log(HELP); process.exit(0); }
95
96
  switch (sub) {
96
97
  case "add": await add(args); break;
97
98
  case "list": await list(args[0]); break;