primcli 1.2.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/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # @primitivedotdev/cli
2
+
3
+ Official Primitive CLI. Deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal.
4
+
5
+ ```bash
6
+ brew install primitivedotdev/tap/primitive
7
+ primitive whoami
8
+ ```
9
+
10
+ Or with npm:
11
+
12
+ ```bash
13
+ npm install -g @primitivedotdev/cli
14
+ primitive whoami
15
+ # `prim` is installed as a short alias for the same CLI.
16
+ prim whoami
17
+ ```
18
+
19
+ The same CLI is also published unscoped as [`primitivecli`](https://www.npmjs.com/package/primitivecli) — `npm install -g primitivecli` installs an identical build with the same `primitive`/`prim` commands. Use whichever name you prefer; they track the same version.
20
+
21
+ Or with no install:
22
+
23
+ ```bash
24
+ npx @primitivedotdev/cli@latest <command>
25
+ ```
26
+
27
+ This package wraps the [@primitivedotdev/sdk](https://www.npmjs.com/package/@primitivedotdev/sdk) runtime client with one-shot commands. For in-handler use (calling Primitive from inside a Function), import `createPrimitiveClient` from `@primitivedotdev/sdk/api` directly; the CLI is for operator and deploy workflows.
28
+
29
+ ## Quickstart
30
+
31
+ ```bash
32
+ primitive signin
33
+ primitive whoami
34
+ primitive functions templates
35
+ primitive functions init my-fn
36
+ cd my-fn && npm install && npm run build
37
+ primitive functions deploy --name my-fn --file ./dist/handler.js
38
+
39
+ primitive send --to alice@example.com --body "Hello!" --wait
40
+ primitive emails latest --limit 5
41
+ ```
42
+
43
+ Run `primitive --help` for the full command list. Per-command help (`primitive functions deploy --help`) carries enough detail that an agent can compose any operation without leaving the terminal.
44
+
45
+ ## Authentication
46
+
47
+ Use `primitive signin` or `primitive login` for existing accounts. With no email, both use browser approval; `primitive signin browser` and `primitive login browser` are the explicit browser forms.
48
+
49
+ Use `primitive signin <email> --signup-code <code> --accept-terms`, then `primitive signin confirm <email> <code>` for email-code sign-in. `primitive login <email>` and `primitive otp <email>` support the same email-code flow with matching `confirm` and `resend` subcommands.
50
+
51
+ Use `primitive logout --force` to remove local CLI credentials, pending email-code auth state, and stale credential locks without contacting Primitive. This is the recovery command when an interrupted auth command leaves the CLI saying another credential operation is already in progress.
52
+
53
+ Use `primitive signup <email>` for new account creation, then `primitive signup confirm <email> <code>` with the emailed verification code. Non-interactive signup is available with `--accept-terms` (pass `--signup-code <code>` too if you have one).
54
+
55
+ ## Command style
56
+
57
+ Use task-oriented commands for normal workflows:
58
+
59
+ ```bash
60
+ primitive send --to alice@example.com --body "Hello"
61
+ primitive reply --id <inbound-email-id> --body "Thanks"
62
+ primitive reply --id <inbound-email-id> --body "See attached" --attachment ./report.pdf
63
+ primitive chat reply "See attached" --attachment ./report.pdf
64
+ primitive emails list
65
+ primitive emails get --id <inbound-email-id>
66
+ primitive sent list
67
+ primitive domains list
68
+ primitive functions templates
69
+ primitive functions init my-fn --template email-reply
70
+ primitive functions logs --id <function-id>
71
+ primitive deliveries replay --id <delivery-id>
72
+ ```
73
+
74
+ Generated API commands remain available for compatibility and full schema parity, for example `primitive emails:list-emails` and `primitive sending:reply-to-email`.
75
+
76
+ ## Migrating from `@primitivedotdev/sdk` CLI
77
+
78
+ The CLI previously shipped inside `@primitivedotdev/sdk`. The shipped surface area is identical; only the package name changes.
79
+
80
+ | Before | After |
81
+ |--------|-------|
82
+ | `npm install -g @primitivedotdev/sdk` | `npm install -g @primitivedotdev/cli` |
83
+ | `npx @primitivedotdev/sdk@latest <cmd>` | `npx @primitivedotdev/cli@latest <cmd>` |
84
+
85
+ `@primitivedotdev/sdk` continues to ship the runtime SDK (webhook, API client, contract, parser, openapi). Use it in your application code; use `@primitivedotdev/cli` in your shell and CI.
86
+
87
+ ## License
88
+
89
+ MIT
package/bin/run.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { restartWithProxyEnvIfNeeded } from "../dist/oclif/proxy-auto-detect.js";
4
+
5
+ // Auto-restart with NODE_USE_ENV_PROXY=1 when HTTP(S)_PROXY is in the env.
6
+ // Node reads NODE_USE_ENV_PROXY during process startup, so mutating
7
+ // process.env inside this process is too late for built-in fetch.
8
+ restartWithProxyEnvIfNeeded();
9
+
10
+ const { writeRootAuthContextIfNeeded } = await import(
11
+ "../dist/oclif/root-signup-hint.js"
12
+ );
13
+ await writeRootAuthContextIfNeeded();
14
+
15
+ const { execute } = await import("@oclif/core");
16
+ await execute({ dir: import.meta.url });