@myapihq/cli 2.6.1 → 2.7.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/dist/commands/container-deploy-safety.test.d.ts +1 -0
- package/dist/commands/container-deploy-safety.test.js +60 -0
- package/dist/commands/container.d.ts +4 -0
- package/dist/commands/container.js +188 -9
- package/dist/commands/crm/companies.js +6 -11
- package/dist/commands/crm/contacts.js +6 -11
- package/dist/commands/crm/pagination.d.ts +1 -4
- package/dist/commands/crm/pagination.js +24 -52
- package/dist/commands/crm/pagination.test.js +34 -70
- package/dist/commands/doctor-findings.test.js +57 -1
- package/dist/commands/doctor.d.ts +4 -0
- package/dist/commands/doctor.js +84 -2
- package/dist/commands/domain.js +6 -6
- package/dist/commands/fn.js +8 -8
- package/dist/commands/funnel.js +58 -0
- package/dist/errors.js +21 -5
- package/dist/sdk-container.test.js +58 -1
- package/dist/skills/my-container-api/SKILL.md +37 -5
- package/dist/skills/my-crm-api/SKILL.md +6 -7
- package/dist/skills/my-domain-api/SKILL.md +2 -2
- package/dist/skills/my-function-api/SKILL.md +7 -7
- package/package.json +3 -2
|
@@ -4,7 +4,7 @@ version: 1.0.0
|
|
|
4
4
|
description: >
|
|
5
5
|
Run containers on demand — long-running services, background workers, and scheduled jobs. The heavier-duty sibling of edge functions, for native deps and long execution.
|
|
6
6
|
triggers: [container, cloud run, dynamic app, custom domain app, service, worker, scheduled job, deploy container, docker image]
|
|
7
|
-
checksum: sha256-
|
|
7
|
+
checksum: sha256-4847ab675fa971bbd0fdd83f0039d9110ba4c38e406860fe9265dd540b7f299e
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MyContainerAPI
|
|
@@ -19,6 +19,23 @@ The lifecycle is **create → deploy → (optionally) bind a custom domain**.
|
|
|
19
19
|
- `deploy` ships a pre-built image reference to the runtime and makes the container live at a generated URL.
|
|
20
20
|
- `domain` puts the container on a **custom domain** — how you serve a dynamic app at `app.yourbrand.com`.
|
|
21
21
|
|
|
22
|
+
### Deploying safely
|
|
23
|
+
|
|
24
|
+
A deploy takes 100% of traffic the moment it lands, so a broken build is live
|
|
25
|
+
before you can look at it. Two ways to avoid that:
|
|
26
|
+
|
|
27
|
+
- `--smoke 'GET / contains assets/'` — the platform deploys the revision with
|
|
28
|
+
NO traffic, runs the assertion, and promotes only if it holds. A failure
|
|
29
|
+
leaves the previous revision serving. **Assert on content, not status**:
|
|
30
|
+
"returns 200" is true of a placeholder page too.
|
|
31
|
+
- `--no-promote` — build the revision and hold it back. You get a URL to
|
|
32
|
+
exercise it, then `myapi container promote <id> <revision>`.
|
|
33
|
+
|
|
34
|
+
`--health-check /livez` at create time makes the startup probe an HTTP request
|
|
35
|
+
instead of a bare TCP connect. `/healthz` is refused: the runtime intercepts
|
|
36
|
+
it, so the probe would never reach your container and would report success
|
|
37
|
+
regardless.
|
|
38
|
+
|
|
22
39
|
### Custom domains (dynamic apps)
|
|
23
40
|
|
|
24
41
|
`myapi container domain <id> <domain>` binds a custom domain to a **deployed** container, served over HTTPS automatically. This is the path for a dynamic backend on a real domain — distinct from `my-funnel-api`, which serves static sites.
|
|
@@ -36,7 +53,9 @@ Get it right:
|
|
|
36
53
|
| Command | What it does |
|
|
37
54
|
|---|---|
|
|
38
55
|
| `myapi container create --name <name> [--type service\|worker\|job] [--cron <expr>] [--cpu <n>] [--memory <size>] [--port <n>] [--env K=V,...]` | Register a container, get its scoped API key (once) |
|
|
39
|
-
| `myapi container deploy <id> <image-ref
|
|
56
|
+
| `myapi container deploy <id> <image-ref> [--no-promote] [--smoke '<assertion>']` | Ship a pre-built image (rotates the scoped key) |
|
|
57
|
+
| `myapi container revisions <id>` | List revisions and the traffic each takes |
|
|
58
|
+
| `myapi container promote <id> <revision>` | Move all traffic to a revision (seconds, no rebuild) |
|
|
40
59
|
| `myapi container list` | List containers in your org |
|
|
41
60
|
| `myapi container get <id>` | Inspect a container (status, URL, custom domain) |
|
|
42
61
|
| `myapi container logs <id> [--tail <n>] [--scope all]` | Recent runtime logs, newest first (`--scope all` adds platform audit records) |
|
|
@@ -47,13 +66,26 @@ Get it right:
|
|
|
47
66
|
## Examples
|
|
48
67
|
<!-- llm:start -->
|
|
49
68
|
```bash
|
|
50
|
-
# 1. Register a service container
|
|
51
|
-
|
|
69
|
+
# 1. Register a service container. --health-check makes the startup probe an
|
|
70
|
+
# HTTP request instead of a bare TCP connect.
|
|
71
|
+
myapi container create --name api --type service --port 8080 --health-check /livez
|
|
52
72
|
# → prints a scoped API key ONCE — save it if your code needs it
|
|
53
73
|
|
|
54
|
-
#
|
|
74
|
+
# 2a. Deploy. Plain form takes 100% of traffic immediately.
|
|
55
75
|
myapi container deploy <id> registry.example.com/my-app:v1
|
|
56
76
|
|
|
77
|
+
# 2b. SAFER: assert before any traffic moves. The revision is deployed with no
|
|
78
|
+
# traffic, checked, and promoted only if the check holds. Assert on
|
|
79
|
+
# CONTENT — a broken build still returns 200.
|
|
80
|
+
myapi container deploy <id> registry.example.com/my-app:v1 \
|
|
81
|
+
--smoke 'GET / contains assets/'
|
|
82
|
+
|
|
83
|
+
# 2c. Or hold it back and look yourself.
|
|
84
|
+
myapi container deploy <id> registry.example.com/my-app:v1 --no-promote
|
|
85
|
+
# → prints a revision URL serving 0% of traffic
|
|
86
|
+
myapi container revisions <id>
|
|
87
|
+
myapi container promote <id> <revision>
|
|
88
|
+
|
|
57
89
|
# 3. Serve it on a custom domain. The parent domain must already be
|
|
58
90
|
# registered: myapi domain register synthesisdaily.com
|
|
59
91
|
myapi container domain <id> app.synthesisdaily.com
|
|
@@ -4,7 +4,7 @@ version: 1.0.0
|
|
|
4
4
|
description: >
|
|
5
5
|
The canonical store of engaged contacts + companies for an org. Auto-ingests from inbound webhooks via a configurable dot-path. Fixed lifecycle_stage enum (cold | warm | qualified | customer | churned). Append-only event timeline with reserved kinds. Soft delete + restore. Promote-from-Goldfox closes the discovery → engagement loop.
|
|
6
6
|
triggers: [crm, contact, company, lead, engagement, pipeline, lifecycle, qualified, customer, webhook ingest, promote]
|
|
7
|
-
checksum: sha256-
|
|
7
|
+
checksum: sha256-50cbdd28ed2a901b7a75f1a6c1df1c225d256a8d281ad86cf1e3b42511edc2fe
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MyCRMAPI
|
|
@@ -91,7 +91,7 @@ A contact promoted from Goldfox carries a `goldfox_person_id`. In v2 the GET res
|
|
|
91
91
|
### Contacts
|
|
92
92
|
| Command | What it does |
|
|
93
93
|
|---|---|
|
|
94
|
-
| `myapi crm contacts list [--limit N]` | List all contacts (newest engagement first) |
|
|
94
|
+
| `myapi crm contacts list [--limit N] [--offset N]` | List all contacts (newest engagement first) |
|
|
95
95
|
| `myapi crm contacts search [--stage ...] [--source ...] [--email ...] [--min/max-last-engagement-days N]` | Filter contacts |
|
|
96
96
|
| `myapi crm contacts create <email> [--first-name ...] [--last-name ...] [--stage ...] [--custom-json ...]` | Manually create (source='manual') |
|
|
97
97
|
| `myapi crm contacts get <id>` | Fetch one contact (with embedded Goldfox enrichment when available) |
|
|
@@ -158,11 +158,10 @@ myapi crm contacts events <id> --kind webhook_received
|
|
|
158
158
|
|
|
159
159
|
## Notes
|
|
160
160
|
|
|
161
|
-
- **
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
narrow with filters.
|
|
161
|
+
- **Paginate with `--limit` + `--offset`.** `total` is the true match count
|
|
162
|
+
and the response carries `has_more`; branch on `has_more` rather than doing
|
|
163
|
+
arithmetic against `total`. (Both were broken until 2026-07-28. Cached
|
|
164
|
+
guidance saying the CRM cannot paginate is stale.)
|
|
166
165
|
- **Reserved event kinds — no custom events in v1.** If an agent needs custom state per contact, use `myapi database` keyed by contact id. The curated timeline stays the authoritative engagement record.
|
|
167
166
|
- **`external_id` on an event payload** is the backend's idempotency key — a duplicate of the action's natural id (`goldfox_person_id`, `delivery_id`). Read the semantic field instead; legacy `message_id` rows hold the same value.
|
|
168
167
|
- **Only `webhook_received` fires today.** Email and pixel auto-ingest are coming; the CLI surface will not change.
|
|
@@ -4,7 +4,7 @@ version: 1.0.0
|
|
|
4
4
|
description: >
|
|
5
5
|
Register new domains and manage edge settings. Required before a funnel can go live on a custom URL.
|
|
6
6
|
triggers: [domain, register domain, dns, custom domain, edge, cdn, security level, browser check, renew, namecheap]
|
|
7
|
-
checksum: sha256-
|
|
7
|
+
checksum: sha256-8f96d19c11c3591af71e9d73b2cea6d83f40abbfa1c58c5674dbe15db02efa3c
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MyDomainAPI
|
|
@@ -88,7 +88,7 @@ myapi domain update-settings example.com \
|
|
|
88
88
|
myapi domain import example.com
|
|
89
89
|
# → Returns nameservers; set them at your current registrar.
|
|
90
90
|
myapi domain status example.com --watch
|
|
91
|
-
# → Polls until active. Backend live-checks
|
|
91
|
+
# → Polls until active. Backend live-checks the DNS provider each poll.
|
|
92
92
|
|
|
93
93
|
# Fix a record after import (e.g. clean up SPF)
|
|
94
94
|
myapi domain records list example.com --type TXT
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
name: my-function-api
|
|
3
3
|
version: 1.0.0
|
|
4
4
|
description: >
|
|
5
|
-
Deploy JavaScript functions to the MyAPI edge runtime
|
|
5
|
+
Deploy JavaScript functions to the MyAPI edge runtime. Register a function, upload a single-file JS bundle, get a live HTTP invocation URL or run it on a cron schedule. Each function gets a scoped capability key for cross-slot calls.
|
|
6
6
|
triggers: [function, deploy function, edge function, serverless, cloudflare worker, cron, scoped api key, capability key, invocation url, bundle]
|
|
7
|
-
checksum: sha256-
|
|
7
|
+
checksum: sha256-610e16c931e44d43ee6ac94a32e6d852bb900cdf6f5eea61aaeae7bb95a0814e
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# MyFunctionAPI
|
|
11
11
|
|
|
12
|
-
Deploy backend code without running a server. Register a function, upload a single-file JS bundle, and it goes live on the MyAPI edge runtime
|
|
12
|
+
Deploy backend code without running a server. Register a function, upload a single-file JS bundle, and it goes live on the MyAPI edge runtime with a public invocation URL — or runs on a cron schedule. Each function carries a scoped capability key so it can call other MyAPI slots with its own authority.
|
|
13
13
|
|
|
14
14
|
The full loop is live: **create → deploy → invoke → inspect runs → set secrets**.
|
|
15
15
|
|
|
16
16
|
## Capabilities
|
|
17
17
|
<!-- llm:start -->
|
|
18
|
-
**Two-step lifecycle: register, then deploy.** `myapi fn create --name <slug>` persists the function record and mints a `scoped_api_key`, returned **exactly once** (save it if you need it). `myapi fn deploy <id> <bundle.js>` uploads a single-file JavaScript bundle (≤4MB); the backend wraps it with the MYAPI shim and ships it to
|
|
18
|
+
**Two-step lifecycle: register, then deploy.** `myapi fn create --name <slug>` persists the function record and mints a `scoped_api_key`, returned **exactly once** (save it if you need it). `myapi fn deploy <id> <bundle.js>` uploads a single-file JavaScript bundle (≤4MB); the backend wraps it with the MYAPI shim and ships it to the edge runtime. Propagation is typically 4-45s, so poll the invocation URL rather than redeploying. After deploy the function has a live `invocation_url`.
|
|
19
19
|
|
|
20
20
|
**Scoped key = capability key.** It is **org-locked**. By default it inherits the deployer's slot grants; narrow it at create time with `--scope <slot>[,<slot>...]` (comma-separated, e.g. `--scope email,storage`) — the primary way to deploy a deliberately narrow function. Grants can never exceed the caller's, so a function never out-reaches the credential that created it. It is rejected with `403 SCOPE_FORBIDDEN` at `/hq/*`, `/admin/*`, `/internal/*`. **Deploy rotates this key** — the fresh value is printed once on every deploy. (Minting a narrow account key first — `myapi keys create --grant ...` — is only needed when the *deploy credential itself* must be constrained, e.g. handing deploy rights to another system.)
|
|
21
21
|
|
|
22
22
|
**HTTP or cron triggers.** Default is `http` — the function gets a public invocation URL once deployed. Pass `--cron "<expr>"` at create time to run on a schedule (e.g. `"0 8 * * *"`) instead.
|
|
23
23
|
|
|
24
|
-
**Secrets
|
|
24
|
+
**Secrets are encrypted at rest.** `myapi fn env <id> <name> <value>` sets a secret (Stripe key, API token, …) on a deployed function. The value is encrypted at rest by the edge runtime and never stored or echoed by MyAPI. The function must already be deployed.
|
|
25
25
|
|
|
26
26
|
**Inspect invocations.** `myapi fn runs <id>` lists recent invocation records (most recent first, up to 100) with status, duration, and any error message.
|
|
27
27
|
|
|
@@ -36,7 +36,7 @@ Name rules (validated client- and server-side, kept identical):
|
|
|
36
36
|
|---|---|
|
|
37
37
|
| `myapi fn create --name <name> [--cron <expr>] [--scope <slot>[,<slot>...]]` | Register a function record + receive scoped API key (returned once). `--scope` narrows the key's slot grants |
|
|
38
38
|
| `myapi fn deploy <id> <bundle.js>` | Upload a single-file JS bundle (≤4MB) and go live; rotates the scoped key |
|
|
39
|
-
| `myapi fn env <id> <name> <value>` | Set
|
|
39
|
+
| `myapi fn env <id> <name> <value>` | Set an encrypted secret on a deployed function |
|
|
40
40
|
| `myapi fn runs <id>` | List recent invocation records (status, duration, errors) |
|
|
41
41
|
| `myapi fn list` | List functions in your org |
|
|
42
42
|
| `myapi fn get <id>` | Inspect a function (name, trigger, invocation URL) |
|
|
@@ -58,7 +58,7 @@ myapi fn deploy fn_abc123 ./dist/bundle.js
|
|
|
58
58
|
# Invocation URL: https://fn-abc123.<...>.workers.dev
|
|
59
59
|
# Scoped API key was rotated. New value (returned once): hq_live_...
|
|
60
60
|
|
|
61
|
-
# Set a secret (encrypted at rest
|
|
61
|
+
# Set a secret (encrypted at rest; never echoed)
|
|
62
62
|
myapi fn env fn_abc123 STRIPE_KEY sk_live_...
|
|
63
63
|
|
|
64
64
|
# Inspect recent invocations
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myapihq/cli",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.7.0",
|
|
5
5
|
"description": "MyAPI command-line interface",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,12 +35,13 @@
|
|
|
35
35
|
"lint:help-order": "node scripts/lint-help-order.js",
|
|
36
36
|
"lint:exposes": "node scripts/lint-exposes.js",
|
|
37
37
|
"lint:request-fields": "node scripts/lint-request-fields.js",
|
|
38
|
+
"audit:doctor": "npm run build && node scripts/audit-doctor.js",
|
|
38
39
|
"lint:docs": "node scripts/lint-docs.js",
|
|
39
40
|
"lint:skills": "node scripts/copy-skills.js && node scripts/lint-skills.js",
|
|
40
41
|
"lint:skills:strict": "node scripts/copy-skills.js && node scripts/lint-skills.js --strict"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@myapihq/sdk": "^2.
|
|
44
|
+
"@myapihq/sdk": "^2.7.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/node": "^25.6.0",
|