@myapihq/cli 2.2.0 → 2.4.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.
Files changed (51) hide show
  1. package/dist/commands/account.d.ts +1 -1
  2. package/dist/commands/account.js +1 -0
  3. package/dist/commands/authproduct.js +7 -3
  4. package/dist/commands/billing.js +7 -2
  5. package/dist/commands/container.js +4 -3
  6. package/dist/commands/database.js +4 -3
  7. package/dist/commands/domain.js +39 -14
  8. package/dist/commands/email/message.js +6 -3
  9. package/dist/commands/email/template.js +3 -3
  10. package/dist/commands/fn.js +4 -3
  11. package/dist/commands/funnel.js +33 -13
  12. package/dist/commands/git.js +108 -35
  13. package/dist/commands/image.js +7 -4
  14. package/dist/commands/keys-validation.test.js +5 -0
  15. package/dist/commands/keys.js +6 -2
  16. package/dist/commands/llm.js +41 -20
  17. package/dist/commands/login-validation.test.d.ts +1 -0
  18. package/dist/commands/login-validation.test.js +43 -0
  19. package/dist/commands/login.d.ts +14 -0
  20. package/dist/commands/login.js +447 -0
  21. package/dist/commands/org.d.ts +1 -1
  22. package/dist/commands/org.js +24 -7
  23. package/dist/commands/queue.js +4 -3
  24. package/dist/commands/setup.js +6 -1
  25. package/dist/commands/storage.js +1 -1
  26. package/dist/commands/workflow.js +5 -4
  27. package/dist/completion.js +3 -3
  28. package/dist/config.js +3 -0
  29. package/dist/errors.d.ts +3 -0
  30. package/dist/errors.js +62 -0
  31. package/dist/errors.test.d.ts +1 -0
  32. package/dist/errors.test.js +28 -0
  33. package/dist/exposes.test.js +1 -0
  34. package/dist/flags.js +5 -3
  35. package/dist/flags.test.js +1 -1
  36. package/dist/helpers.d.ts +1 -0
  37. package/dist/helpers.js +22 -0
  38. package/dist/index.js +10 -51
  39. package/dist/skills/my-api-hq/SKILL.md +2 -2
  40. package/dist/skills/my-domain-api/SKILL.md +5 -5
  41. package/dist/skills/my-email-verify-api/SKILL.md +6 -4
  42. package/dist/skills/my-funnel-api/SKILL.md +5 -4
  43. package/dist/skills/my-git-api/SKILL.md +14 -7
  44. package/dist/skills/my-image-api/SKILL.md +1 -1
  45. package/dist/skills/my-llm-api/SKILL.md +11 -11
  46. package/dist/skills/my-storage-api/SKILL.md +5 -5
  47. package/dist/skills/my-webhook-api/SKILL.md +1 -1
  48. package/dist/skills/my-workflow-api/SKILL.md +1 -1
  49. package/dist/utils.d.ts +1 -0
  50. package/dist/utils.js +13 -1
  51. package/package.json +3 -2
@@ -15,7 +15,7 @@ Per-org asset storage with edge CDN delivery. Two ways in: direct upload (local
15
15
  <!-- llm:start -->
16
16
  Storage is the asset layer. Anything you upload or ingest is served from the edge under a permanent public URL — embed it in funnel pages, email templates, anywhere.
17
17
 
18
- `upload` accepts `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp` from the local filesystem. For other formats (PDF, mp4, webm, svg) host the file somewhere public and use `ingest` instead — the server fetches it for you.
18
+ `upload` accepts `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.svg`, `.pdf`, `.mp4`, `.webm` from the local filesystem. For any other extension, host the file somewhere public and use `ingest` instead — the server fetches it for you.
19
19
 
20
20
  Generated images from **myimageapi** automatically land here; they appear in `storage list` under their job id.
21
21
 
@@ -27,7 +27,7 @@ Use `get` for a round-trip metadata fetch. Use `get-url` when you just need the
27
27
  | Command | What it does |
28
28
  |---|---|
29
29
  | `myapi storage list` | List all stored assets |
30
- | `myapi storage upload <file>` | Direct multipart upload of a local image |
30
+ | `myapi storage upload <file>` | Direct multipart upload of a local file (image/svg/pdf/mp4/webm) |
31
31
  | `myapi storage ingest <url>` | Server fetches a public URL into storage |
32
32
  | `myapi storage get <asset_id>` | Round-trip the API for full metadata (`--json` or human block) |
33
33
  | `myapi storage get-url <asset_id>` | Pure local URL constructor — no API call, no auth |
@@ -59,8 +59,8 @@ myapi storage delete <asset_id>
59
59
 
60
60
  ## Upload vs Ingest
61
61
 
62
- - **`upload`** — file is on your machine. Multipart POST. Image types only: `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`.
63
- - **`ingest`** — file is at a public HTTP(S) URL. Server downloads and stores. Useful for migrating assets, pulling in third-party images you have rights to, or for non-image types (`image/svg+xml`, `application/pdf`, `video/mp4`, `video/webm`).
62
+ - **`upload`** — file is on your machine. Multipart POST. Supported extensions: `.png`, `.jpg`, `.jpeg`, `.gif`, `.webp`, `.svg`, `.pdf`, `.mp4`, `.webm`.
63
+ - **`ingest`** — file is at a public HTTP(S) URL. Server downloads and stores. Useful for migrating assets, pulling in third-party files you have rights to, or for extensions `upload` doesn't accept.
64
64
 
65
65
  Both produce identical asset records — `list` doesn't distinguish.
66
66
 
@@ -72,7 +72,7 @@ Both produce identical asset records — `list` doesn't distinguish.
72
72
  ## Notes
73
73
 
74
74
  - Assets are public by default — don't store sensitive files.
75
- - Delete is immediate and unrecoverable.
75
+ - Delete is immediate and unrecoverable — run `myapi storage list` first to confirm the asset, pass `--org` explicitly, and pass `--yes` in non-interactive runs.
76
76
  - The URL is permanent until you `myapi storage delete <id>` — embed it freely.
77
77
 
78
78
  Run `myapi storage --help` for full flag reference.
@@ -89,7 +89,7 @@ The form sends `{name, email, message}` → webhook stores it → workflow runs
89
89
  ## Notes
90
90
 
91
91
  - The inbound URL is public — anyone with it can POST. Treat the slug as a secret.
92
- - Deliveries are kept indefinitely. Delete the endpoint to purge them.
92
+ - Deliveries are kept indefinitely. Delete the endpoint to purge them. Look before you delete: `myapi webhook list` first, pass `--org` explicitly; delete verbs require `--yes` in non-interactive runs.
93
93
  - Failed workflow runs don't affect the delivery record — the inbound POST is always saved.
94
94
  - Inbound responses: `200` on success, `4xx` if the endpoint is missing or body isn't valid JSON.
95
95
 
@@ -95,7 +95,7 @@ myapi workflow enable <id>
95
95
  - Workflows fire on every webhook delivery. Failed runs don't block subsequent runs.
96
96
  - Each run records attempt number, started_at/finished_at, and any error.
97
97
  - Disable to stop firing without losing the configuration.
98
- - Deleting a workflow purges its run history; the webhook endpoint remains.
98
+ - Deleting a workflow purges its run history; the webhook endpoint remains. Look before you delete: `myapi workflow list` first, pass `--org` explicitly; delete asks for confirmation — `--yes` required in non-interactive runs.
99
99
 
100
100
  ## See also
101
101
 
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export declare function sleep(ms: number): Promise<unknown>;
2
+ export declare function retryFunds<T>(call: () => Promise<T>): Promise<T>;
2
3
  /**
3
4
  * Formats an ISO/Go timestamp string to "YYYY-MM-DD HH:mm" (UTC).
4
5
  * Strips Go's " +0000 UTC" suffix before parsing.
package/dist/utils.js CHANGED
@@ -1,7 +1,19 @@
1
- import { spinnerFrame, spinnerWrite, clearLine, error } from './output.js';
1
+ import { withFundsRetry } from '@myapihq/sdk';
2
+ import { spinnerFrame, spinnerWrite, clearLine, error, banner } from './output.js';
2
3
  export function sleep(ms) {
3
4
  return new Promise(resolve => setTimeout(resolve, ms));
4
5
  }
6
+ // Wrap a billable SDK call: when the wallet is empty but an auto-recharge is
7
+ // already in flight (the 402 split), wait the server-hinted interval and
8
+ // retry instead of failing — so an unattended agent isn't killed by a refill
9
+ // that's seconds away. Every other 402 state (capped / no_pm / failed /
10
+ // disabled, spend-cap) still fails fast into the tailored guidance in
11
+ // index.ts. Progress goes to stderr so --json stdout stays clean.
12
+ export function retryFunds(call) {
13
+ return withFundsRetry(call, {
14
+ onRetry: (attempt, waitSec) => banner(`› Wallet empty — auto-recharge in flight; waiting ${waitSec}s and retrying (attempt ${attempt}/3)…`),
15
+ });
16
+ }
5
17
  /**
6
18
  * Formats an ISO/Go timestamp string to "YYYY-MM-DD HH:mm" (UTC).
7
19
  * Strips Go's " +0000 UTC" suffix before parsing.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
3
  "license": "Apache-2.0",
4
- "version": "2.2.0",
4
+ "version": "2.4.0",
5
5
  "description": "MyAPI command-line interface",
6
6
  "type": "module",
7
7
  "files": [
@@ -24,6 +24,7 @@
24
24
  "test:all": "npm run build && MYAPI_RUN_RESET=1 vitest run src test/smoke test/scripts test/online",
25
25
  "check-coverage": "npm run build && node scripts/check-coverage.js",
26
26
  "check-coverage:live": "npm run build && node scripts/check-coverage.js --live",
27
+ "typecheck:tests": "tsc -p tsconfig.tests.json",
27
28
  "update-schema": "node scripts/update-schema.js",
28
29
  "lint:changelog": "node ../../scripts/lint-changelog.js",
29
30
  "lint:help-order": "node scripts/lint-help-order.js",
@@ -31,7 +32,7 @@
31
32
  "lint:skills:strict": "node scripts/copy-skills.js && node scripts/lint-skills.js --strict"
32
33
  },
33
34
  "dependencies": {
34
- "@myapihq/sdk": "^2.2.0"
35
+ "@myapihq/sdk": "^2.4.0"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@types/node": "^25.6.0",