@primitivedotdev/cli 0.26.1 → 0.26.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.
|
@@ -81,6 +81,10 @@ function checkProxy() {
|
|
|
81
81
|
return { status: "ok", message: present.join(", ") };
|
|
82
82
|
}
|
|
83
83
|
function checkApiKey(opts) {
|
|
84
|
+
// Take env explicitly so the unit test can inject a clean
|
|
85
|
+
// environment without mutating process.env across cases. Default to
|
|
86
|
+
// the live process env for real runs.
|
|
87
|
+
const env = opts.env ?? process.env;
|
|
84
88
|
if (opts.apiKey?.startsWith("prim_")) {
|
|
85
89
|
return { status: "ok", message: "provided via flag/env (prim_ prefix)" };
|
|
86
90
|
}
|
|
@@ -91,6 +95,25 @@ function checkApiKey(opts) {
|
|
|
91
95
|
hint: "Verify the key is a Primitive API key, not a value from another service.",
|
|
92
96
|
};
|
|
93
97
|
}
|
|
98
|
+
// PRIMITIVE_KEY rename detection. AGX feedback: users on older docs
|
|
99
|
+
// (or coming from other tools) set PRIMITIVE_KEY and then can't
|
|
100
|
+
// figure out why the CLI says "no API key found". The CLI reads
|
|
101
|
+
// PRIMITIVE_API_KEY only. Surface the rename hint when PRIMITIVE_KEY
|
|
102
|
+
// is set but PRIMITIVE_API_KEY is not, before falling through to
|
|
103
|
+
// the credentials.json / no-key checks. The hint runs before the
|
|
104
|
+
// credentials.json branch on purpose: if both PRIMITIVE_KEY and a
|
|
105
|
+
// valid credentials file are present, the credentials file wins
|
|
106
|
+
// silently and the user never sees the rename suggestion, which is
|
|
107
|
+
// the same trap by another name.
|
|
108
|
+
const primitiveKey = env.PRIMITIVE_KEY;
|
|
109
|
+
const primitiveApiKey = env.PRIMITIVE_API_KEY;
|
|
110
|
+
if ((primitiveKey?.length ?? 0) > 0 && (primitiveApiKey?.length ?? 0) === 0) {
|
|
111
|
+
return {
|
|
112
|
+
status: "fail",
|
|
113
|
+
message: "PRIMITIVE_KEY is set but the CLI reads PRIMITIVE_API_KEY",
|
|
114
|
+
hint: "Rename your env var, or re-run with PRIMITIVE_API_KEY=$PRIMITIVE_KEY.",
|
|
115
|
+
};
|
|
116
|
+
}
|
|
94
117
|
const credsPath = join(opts.configDir, "credentials.json");
|
|
95
118
|
if (existsSync(credsPath)) {
|
|
96
119
|
let parsed = null;
|
|
@@ -18,7 +18,7 @@ import { Args, Command, Errors, Flags } from "@oclif/core";
|
|
|
18
18
|
// the CLI's own @primitivedotdev/sdk dep range in cli-node/package.json
|
|
19
19
|
// so scaffolded projects use the same SDK version the CLI was built
|
|
20
20
|
// and tested against.
|
|
21
|
-
const SDK_VERSION_RANGE = "^0.
|
|
21
|
+
const SDK_VERSION_RANGE = "^0.26.0";
|
|
22
22
|
// The CLI version range that ships in the scaffolded devDependencies.
|
|
23
23
|
// Pinned separately from SDK_VERSION_RANGE because @primitivedotdev/cli
|
|
24
24
|
// and @primitivedotdev/sdk are independent packages on independent
|
|
@@ -184,11 +184,9 @@ export function renderPackageJson(name) {
|
|
|
184
184
|
devDependencies: {
|
|
185
185
|
// @primitivedotdev/cli ships the primitive bin. Including it as
|
|
186
186
|
// a devDep here means `node_modules/.bin/primitive` resolves to
|
|
187
|
-
// the real CLI inside the scaffolded project
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
// "CLI moved" stderr banner. Pinned via CLI_VERSION_RANGE, a
|
|
191
|
-
// dedicated constant so the version is decoupled from the SDK
|
|
187
|
+
// the real CLI inside the scaffolded project so `npm run deploy`
|
|
188
|
+
// works without a global install. Pinned via CLI_VERSION_RANGE,
|
|
189
|
+
// a dedicated constant so the version is decoupled from the SDK
|
|
192
190
|
// range and bumps are explicit on both ends.
|
|
193
191
|
"@primitivedotdev/cli": CLI_VERSION_RANGE,
|
|
194
192
|
esbuild: ESBUILD_VERSION_RANGE,
|
package/oclif.manifest.json
CHANGED
|
@@ -3192,7 +3192,7 @@
|
|
|
3192
3192
|
"functions:create-function": {
|
|
3193
3193
|
"aliases": [],
|
|
3194
3194
|
"args": {},
|
|
3195
|
-
"description": "Creates and deploys a new function. The handler must be a single\nESM module
|
|
3195
|
+
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). The gateway\nHMAC-verifies the POST against the org's webhook secret before\ninvoking the handler; the request body parses to an\n`email.received` event (see `EmailReceivedEvent` and the\nWebhook payload section for the full schema). Code is bundled\nbefore being uploaded; ship a single self-contained file rather\nthan relying on external imports.\n\n**Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`\n(optional) is capped at 5 MiB UTF-8 and is stored only on the\nedge runtime side; it is not persisted in Primitive's database.\n\n**Auto-wiring.** On successful deploy, Primitive automatically\ncreates a webhook endpoint that delivers inbound mail to the\nfunction. There is nothing to configure on the Endpoints API\nfor this to work; the gateway URL returned here is for\nreference only and is not directly callable from outside.\n\n**Secrets.** New functions ship with the managed secrets\n(`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`) already\nbound. Add user-set secrets via\n`POST /functions/{id}/secrets`; secret writes only land in the\nrunning handler on the next redeploy.\n\n\nTip: prefer `primitive functions:deploy --name <name> --file <bundle>` for file-input ergonomics. This raw command exists for callers passing JSON.",
|
|
3196
3196
|
"flags": {
|
|
3197
3197
|
"api-key": {
|
|
3198
3198
|
"description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
|
|
@@ -3532,6 +3532,78 @@
|
|
|
3532
3532
|
"summary": "Get a function",
|
|
3533
3533
|
"enableJsonFlag": false
|
|
3534
3534
|
},
|
|
3535
|
+
"functions:list-function-logs": {
|
|
3536
|
+
"aliases": [],
|
|
3537
|
+
"args": {},
|
|
3538
|
+
"description": "Returns the most recent `function_logs` rows for the function,\nnewest first. Each row is a single `console.log` / `console.error`\ninvocation captured from the running handler.\n\nPage through history with the opaque `cursor` returned as\n`next_cursor`; pass it back as the `cursor` query param on the\nnext call. `next_cursor` is `null` when there are no further\nrows. The cursor format is an implementation detail and should\nnot be parsed by callers.\n",
|
|
3539
|
+
"flags": {
|
|
3540
|
+
"api-key": {
|
|
3541
|
+
"description": "Primitive API key (defaults to PRIMITIVE_API_KEY or saved `primitive login` credentials)",
|
|
3542
|
+
"env": "PRIMITIVE_API_KEY",
|
|
3543
|
+
"name": "api-key",
|
|
3544
|
+
"hasDynamicHelp": false,
|
|
3545
|
+
"multiple": false,
|
|
3546
|
+
"type": "option"
|
|
3547
|
+
},
|
|
3548
|
+
"api-base-url-1": {
|
|
3549
|
+
"description": "Override the primary API base URL. Internal testing only; not documented to customers.",
|
|
3550
|
+
"env": "PRIMITIVE_API_BASE_URL_1",
|
|
3551
|
+
"hidden": true,
|
|
3552
|
+
"name": "api-base-url-1",
|
|
3553
|
+
"hasDynamicHelp": false,
|
|
3554
|
+
"multiple": false,
|
|
3555
|
+
"type": "option"
|
|
3556
|
+
},
|
|
3557
|
+
"api-base-url-2": {
|
|
3558
|
+
"description": "Override the attachments-supporting send host base URL. Internal testing only; not documented to customers.",
|
|
3559
|
+
"env": "PRIMITIVE_API_BASE_URL_2",
|
|
3560
|
+
"hidden": true,
|
|
3561
|
+
"name": "api-base-url-2",
|
|
3562
|
+
"hasDynamicHelp": false,
|
|
3563
|
+
"multiple": false,
|
|
3564
|
+
"type": "option"
|
|
3565
|
+
},
|
|
3566
|
+
"time": {
|
|
3567
|
+
"description": "Print the wall-clock duration of this command to stderr after it completes (e.g. `[time: 1.34s]`). Useful for measuring `--wait` send latency, comparing CLI overhead, or capturing timing in scripts.",
|
|
3568
|
+
"name": "time",
|
|
3569
|
+
"allowNo": false,
|
|
3570
|
+
"type": "boolean"
|
|
3571
|
+
},
|
|
3572
|
+
"id": {
|
|
3573
|
+
"description": "Resource UUID",
|
|
3574
|
+
"name": "id",
|
|
3575
|
+
"required": true,
|
|
3576
|
+
"hasDynamicHelp": false,
|
|
3577
|
+
"multiple": false,
|
|
3578
|
+
"type": "option"
|
|
3579
|
+
},
|
|
3580
|
+
"limit": {
|
|
3581
|
+
"description": "Maximum number of rows to return. Clamped to 1..200; default\n50.\n",
|
|
3582
|
+
"name": "limit",
|
|
3583
|
+
"required": false,
|
|
3584
|
+
"hasDynamicHelp": false,
|
|
3585
|
+
"multiple": false,
|
|
3586
|
+
"type": "option"
|
|
3587
|
+
},
|
|
3588
|
+
"cursor": {
|
|
3589
|
+
"description": "Opaque pagination cursor from a previous response's\n`next_cursor`. Omit on the first call.\n",
|
|
3590
|
+
"name": "cursor",
|
|
3591
|
+
"required": false,
|
|
3592
|
+
"hasDynamicHelp": false,
|
|
3593
|
+
"multiple": false,
|
|
3594
|
+
"type": "option"
|
|
3595
|
+
}
|
|
3596
|
+
},
|
|
3597
|
+
"hasDynamicHelp": false,
|
|
3598
|
+
"hiddenAliases": [],
|
|
3599
|
+
"id": "functions:list-function-logs",
|
|
3600
|
+
"pluginAlias": "@primitivedotdev/cli",
|
|
3601
|
+
"pluginName": "@primitivedotdev/cli",
|
|
3602
|
+
"pluginType": "core",
|
|
3603
|
+
"strict": true,
|
|
3604
|
+
"summary": "List a function's execution logs",
|
|
3605
|
+
"enableJsonFlag": false
|
|
3606
|
+
},
|
|
3535
3607
|
"functions:list-function-secrets": {
|
|
3536
3608
|
"aliases": [],
|
|
3537
3609
|
"args": {},
|
|
@@ -4386,5 +4458,5 @@
|
|
|
4386
4458
|
"enableJsonFlag": false
|
|
4387
4459
|
}
|
|
4388
4460
|
},
|
|
4389
|
-
"version": "0.26.
|
|
4461
|
+
"version": "0.26.2"
|
|
4390
4462
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primitivedotdev/cli",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "Official Primitive CLI: deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal. Wraps the @primitivedotdev/sdk runtime client with one-shot commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"@oclif/core": "^4.10.5",
|
|
93
93
|
"@oclif/plugin-autocomplete": "^3.2.45",
|
|
94
94
|
"@oclif/plugin-help": "^6.2.44",
|
|
95
|
-
"@primitivedotdev/sdk": "^0.
|
|
95
|
+
"@primitivedotdev/sdk": "^0.26.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@biomejs/biome": "^2.4.10",
|