@postshiba/cli 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PostShiba
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,90 @@
1
- # Temporary Holding Version
1
+ # PostShiba CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Terminal app for the PostShiba API. Interactive prompts for humans. JSON for scripts.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install -g github:postshiba/postshiba-cli
9
+ ```
10
+
11
+ Node 20 or later. One-off: `npx github:postshiba/postshiba-cli`. Open pull requests on [postshiba/sdks](https://github.com/postshiba/sdks).
12
+
13
+ ## Sign in
14
+
15
+ ```sh
16
+ postshiba login
17
+ ```
18
+
19
+ The key can also come from `--api-key` or `POSTSHIBA_API_KEY`. Team id comes from `--team`, `POSTSHIBA_TEAM_ID`, or a prompt. Config is `$XDG_CONFIG_HOME/postshiba/config.json`, else `~/.config/postshiba/config.json`, mode `0600`.
20
+
21
+ ```sh
22
+ postshiba whoami
23
+ postshiba logout
24
+ ```
25
+
26
+ ## Send
27
+
28
+ ```sh
29
+ postshiba send --from hello@mail.example.com --to you@example.com --subject "Hi" --text "hello"
30
+ ```
31
+
32
+ `--cluster` sets `X-Capsule-Cluster-Id` on `POST /api/v1/emails`. `--sandbox` and `--idempotency-key` post to the cluster send path and need `--cluster`.
33
+
34
+ ```sh
35
+ postshiba send --cluster NmQpXr --sandbox --from hello@mail.example.com --to you@example.com --subject "Test" --text "sandbox"
36
+ ```
37
+
38
+ Template send. Pass `--template` and `--var`. Skip `--html` and `--text`.
39
+
40
+ ```sh
41
+ postshiba send --from hello@mail.example.com --to you@example.com --template welcome --var name=Ada
42
+ ```
43
+
44
+ ## Resources
45
+
46
+ ```
47
+ postshiba <resource> <action> [ids...] [--data JSON | --data @file.json | --data -]
48
+ ```
49
+
50
+ ```sh
51
+ postshiba clusters list
52
+ postshiba clusters get NmQpXr
53
+ postshiba sending-domains create --data '{"name":"mail.example.com"}'
54
+ postshiba messages download-attachment PqRzMn GxTyVu 1 --output photo.png
55
+ ```
56
+
57
+ `delete`, `suspend`, `release`, and `unassign` ask before they run. `--yes` skips the confirm. Plain mode needs `--yes`.
58
+
59
+ ## Plain mode
60
+
61
+ Scripts and agents should pass `--json`. `--no-input`, a non-TTY, or `CI` also force plain mode. Plain mode never prompts. Success prints 2-space API JSON. Missing input exits 2.
62
+
63
+ ```sh
64
+ postshiba doctor --json
65
+ postshiba clusters list --json
66
+ ```
67
+
68
+ ## Agent skill
69
+
70
+ ```sh
71
+ postshiba skills install
72
+ npx skills add postshiba/postshiba-cli
73
+ ```
74
+
75
+ `--global` writes under the home directory. `--target cursor|claude|agents` picks the skill folder.
76
+
77
+ ## Errors
78
+
79
+ Non-2xx responses print `Error: <message>` and, when present, `(field: <field>)`. Exit 1.
80
+
81
+ A `429` with `error` `throttled` is the cluster hourly send limit. The CLI prints that line and exits. Do not retry that send immediately. Wait until the next hour.
82
+
83
+ ## Contributing
84
+
85
+ ```sh
86
+ npm install
87
+ npm test
88
+ ```
89
+
90
+ Tests mock HTTP. They do not call production.
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ // @ts-check
3
+ import { main } from "../src/cli.js";
4
+
5
+ process.exitCode = await main(process.argv.slice(2), {
6
+ env: process.env,
7
+ stdout: process.stdout,
8
+ stderr: process.stderr,
9
+ stdin: process.stdin,
10
+ fetch,
11
+ });
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@postshiba/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "PostShiba command-line interface",
5
+ "license": "MIT",
6
+ "author": "PostShiba",
7
+ "homepage": "https://github.com/postshiba/postshiba-cli",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/postshiba/postshiba-cli.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/postshiba/postshiba-cli/issues"
14
+ },
15
+ "type": "module",
16
+ "bin": {
17
+ "postshiba": "bin/postshiba.js"
18
+ },
19
+ "files": [
20
+ "bin",
21
+ "src",
22
+ "skills",
23
+ "LICENSE",
24
+ "README.md"
25
+ ],
26
+ "engines": {
27
+ "node": ">=20"
28
+ },
29
+ "scripts": {
30
+ "test": "tsc --noEmit && node --test"
31
+ },
32
+ "dependencies": {
33
+ "@clack/prompts": "^1.8.1",
34
+ "picocolors": "^1.1.1"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^24.5.2",
38
+ "typescript": "^5.9.2"
39
+ }
40
+ }
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: postshiba-cli
3
+ description: Uses the PostShiba CLI to manage infrastructure and send mail from a terminal, script, or CI. Use when the user wants to manage PostShiba or send mail from a terminal, script, or CI, or when the `postshiba` command is installed or should be.
4
+ ---
5
+
6
+ # PostShiba CLI
7
+
8
+ Drive PostShiba from a terminal, script, or CI with the `postshiba` command. Always pass `--json` so the CLI never prompts. A non-TTY or set `CI` also forces plain mode.
9
+
10
+ For Cursor MCP workflows (first send, DNS walkthroughs, hosted inboxes), use the sibling skills in this plugin: `postshiba`, `postshiba-first-send`, `postshiba-create-cluster`, `postshiba-create-credentials`, `postshiba-send-test-email`, `postshiba-create-mailbox`, `postshiba-send-from-domain`, `postshiba-import-dkim`.
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm install -g github:postshiba/postshiba-cli
16
+ postshiba --version
17
+ ```
18
+
19
+ One-off: `npx github:postshiba/postshiba-cli`. If `--version` fails, install, then check again.
20
+
21
+ ## Credentials
22
+
23
+ Read credentials from the environment. Never echo the API key.
24
+
25
+ | Setting | Env |
26
+ | --- | --- |
27
+ | API key | `POSTSHIBA_API_KEY` |
28
+ | Team id | `POSTSHIBA_TEAM_ID` |
29
+ | Default cluster | `POSTSHIBA_CLUSTER_ID` |
30
+
31
+ Team-scoped commands need a team id. Never guess it. Prefer env over `postshiba login`. Login prompts.
32
+
33
+ ## Start
34
+
35
+ 1. Confirm the binary with `postshiba --version`.
36
+ 2. Run `postshiba doctor --json`.
37
+ 3. Fix what `doctor` reports before sending.
38
+
39
+ `doctor` checks the key, team id, a cluster with `sending_ready`, and a verified sending domain.
40
+
41
+ ## Resource commands
42
+
43
+ ```
44
+ postshiba <resource> <action> [ids...] --json [--data JSON | --data @file.json | --data -]
45
+ ```
46
+
47
+ Ids are public letter-only Hashids. Pass them in path order. Pass `--data` when the action has a request body (`create`, `update`, `boost`, `extend-boost`, `assign`, `unassign`, `switch`, `release`, `import`, `add-entry`).
48
+
49
+ | Resource | Actions |
50
+ | --- | --- |
51
+ | `clusters` | `list` `get` `create` `update` `suspend` `resume` `delete` `boost` `extend-boost` `cancel-boost` |
52
+ | `network` | `list` `create` `assign` `unassign` `switch` `release` |
53
+ | `sending-domains` | `list` `get` `create` `update` `refresh` `verify` `suspend` `resume` `make-primary` `delete` |
54
+ | `tenants` | `list` `get` `create` `delete` |
55
+ | `inboxes` | `list` `get` `create` `verify` `delete` |
56
+ | `messages` | `list` `get` `download-attachment` |
57
+ | `events` | `list-team` `list` `get` |
58
+ | `smtp-credentials` | `create` `delete` |
59
+ | `webhooks` | `list` `get` `create` `update` `delete` |
60
+ | `templates` | `list` `get` `create` `update` `publish` `duplicate` `delete` |
61
+ | `suppressions` | `list` `create` `import` `delete` |
62
+ | `firewall` | `get` `update` `add-entry` `delete-entry` |
63
+
64
+ Also: `whoami`, `send`, `doctor`, `help`, `skills install`. `messages download-attachment` writes bytes to `--output PATH`, else stdout.
65
+
66
+ ```bash
67
+ postshiba clusters list --json
68
+ postshiba clusters get NmQpXr --json
69
+ postshiba sending-domains create --json --data '{"name":"mail.example.com"}'
70
+ postshiba messages get PqRzMn GxTyVu --json
71
+ ```
72
+
73
+ ## Send
74
+
75
+ Required: `--from` and at least one `--to`.
76
+
77
+ Plain:
78
+
79
+ ```bash
80
+ postshiba send --json --from hello@mail.example.com --to you@example.com --subject "Hi" --text "Hello"
81
+ ```
82
+
83
+ Template. Pass `--var KEY=VALUE` for each Liquid variable. Do not also pass `--html` or `--text`.
84
+
85
+ ```bash
86
+ postshiba send --json --from hello@mail.example.com --to you@example.com --template welcome --var name=Ada
87
+ ```
88
+
89
+ Sandbox test. Requires `--cluster`. Success returns `queued: false`. The message is not delivered.
90
+
91
+ ```bash
92
+ postshiba send --json --cluster NmQpXr --sandbox --from hello@mail.example.com --to you@example.com --subject "Test" --text "Sandbox"
93
+ ```
94
+
95
+ Idempotent cluster send. Requires `--cluster`.
96
+
97
+ ```bash
98
+ postshiba send --json --cluster NmQpXr --idempotency-key run-1 --from hello@mail.example.com --to you@example.com --subject "Hi" --text "Hello"
99
+ ```
100
+
101
+ `--sandbox` and `--idempotency-key` post to the cluster send path. `--cluster` alone on a plain send sets the cluster header and keeps `POST /api/v1/emails`.
102
+
103
+ ## Exit codes
104
+
105
+ - `0` success. stdout is 2-space API JSON.
106
+ - `1` API error. stderr is `Error: <message>` and, when present, `(field: <field>)`. A `429` with `error` `throttled` is the hourly send cap. Wait until the next hour. Do not retry immediately.
107
+ - `2` usage error. Missing input, bad JSON, or a destructive action without `--yes`.
108
+
109
+ ## Destructive actions
110
+
111
+ `delete`, `suspend`, `release`, and `unassign` need `--yes` in plain mode. Pass `--yes` only when the user explicitly asked for that destructive action.
112
+
113
+ ## Secrets
114
+
115
+ Never echo the API key. Keep SMTP passwords and webhook secrets out of logs. An SMTP password appears once on create.