porkbun-cli 1.0.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 (3) hide show
  1. package/README.md +225 -0
  2. package/dist/cli.js +1418 -0
  3. package/package.json +56 -0
package/README.md ADDED
@@ -0,0 +1,225 @@
1
+ # Porkbun CLI
2
+
3
+ CLI for [Porkbun](https://porkbun.com) — manage domains, DNS, SSL and more from the terminal.
4
+
5
+ JSON output by default, ideal for AI agents and automation.
6
+
7
+ ## Features
8
+
9
+ - **Domains** — list, check availability, register, nameservers, auto-renew
10
+ - **DNS** — create, edit, delete, retrieve records (A, AAAA, CNAME, MX, TXT, NS, SRV, CAA, etc.)
11
+ - **DNSSEC** — manage DS records
12
+ - **SSL** — retrieve certificate bundles
13
+ - **URL Forwarding** — add, list, delete forwards
14
+ - **Glue Records** — create, update, delete
15
+ - **Multi-format** — output as JSON (default), table or CSV via `--format`
16
+ - **Dry-run** — preview any write operation before executing
17
+ - **Automatic retry** — retry with backoff on 429/5xx errors
18
+
19
+ ## Installation
20
+
21
+ ### Via npm
22
+
23
+ ```bash
24
+ npm install -g porkbun-cli
25
+ ```
26
+
27
+ ### From source
28
+
29
+ ```bash
30
+ git clone https://github.com/yabbal/porkbun.git
31
+ cd porkbun
32
+ pnpm install
33
+ pnpm build
34
+ pnpm link --global
35
+ ```
36
+
37
+ Verify the installation:
38
+
39
+ ```bash
40
+ porkbun --help
41
+ ```
42
+
43
+ ## Configuration
44
+
45
+ ### API keys
46
+
47
+ Get your API keys from [porkbun.com/account/api](https://porkbun.com/account/api).
48
+
49
+ Set them as environment variables:
50
+
51
+ ```bash
52
+ export PORKBUN_API_KEY=pk1_xxxxx
53
+ export PORKBUN_API_SECRET=sk1_xxxxx
54
+ ```
55
+
56
+ Or create a `.env` file in the working directory:
57
+
58
+ ```
59
+ PORKBUN_API_KEY=pk1_xxxxx
60
+ PORKBUN_API_SECRET=sk1_xxxxx
61
+ ```
62
+
63
+ Test your credentials:
64
+
65
+ ```bash
66
+ porkbun ping
67
+ ```
68
+
69
+ ## Usage
70
+
71
+ ### Ping (test authentication)
72
+
73
+ ```bash
74
+ porkbun ping
75
+ ```
76
+
77
+ ### Pricing
78
+
79
+ ```bash
80
+ porkbun pricing # All TLD pricing
81
+ porkbun pricing --tld com # Specific TLD
82
+ porkbun pricing --tld dev --format table
83
+ ```
84
+
85
+ ### Domains
86
+
87
+ ```bash
88
+ porkbun domain list # List all domains
89
+ porkbun domain list --format table # Table format
90
+ porkbun domain check example.com # Check availability
91
+ porkbun domain create example.com --cost 1108 # Register (cost in cents)
92
+ ```
93
+
94
+ ### Name servers
95
+
96
+ ```bash
97
+ porkbun domain ns get example.com
98
+ porkbun domain ns update example.com --ns "ns1.dns.com,ns2.dns.com"
99
+ ```
100
+
101
+ ### Auto-renew
102
+
103
+ ```bash
104
+ porkbun domain auto-renew example.com --status on
105
+ porkbun domain auto-renew example.com --status off
106
+ ```
107
+
108
+ ### URL forwarding
109
+
110
+ ```bash
111
+ porkbun domain forward list example.com
112
+ porkbun domain forward add example.com --location "https://target.com" --type permanent
113
+ porkbun domain forward delete example.com --id 12345
114
+ ```
115
+
116
+ ### Glue records
117
+
118
+ ```bash
119
+ porkbun domain glue list example.com
120
+ porkbun domain glue create example.com --subdomain ns1 --ips "1.2.3.4,5.6.7.8"
121
+ porkbun domain glue update example.com --subdomain ns1 --ips "9.10.11.12"
122
+ porkbun domain glue delete example.com --subdomain ns1
123
+ ```
124
+
125
+ ### DNS records
126
+
127
+ ```bash
128
+ # List
129
+ porkbun dns list example.com
130
+ porkbun dns list example.com --type A
131
+ porkbun dns list example.com --format table
132
+
133
+ # Create
134
+ porkbun dns create example.com --type A --content 1.2.3.4
135
+ porkbun dns create example.com --type A --content 1.2.3.4 --name www --ttl 3600
136
+ porkbun dns create example.com --type MX --content mail.example.com --prio 10
137
+
138
+ # Edit
139
+ porkbun dns edit example.com --id 12345 --type A --content 5.6.7.8
140
+ porkbun dns edit-by-name-type example.com --type A --subdomain www --content 5.6.7.8
141
+
142
+ # Delete
143
+ porkbun dns delete example.com --id 12345
144
+ porkbun dns delete-by-name-type example.com --type A --subdomain www
145
+ ```
146
+
147
+ ### DNSSEC
148
+
149
+ ```bash
150
+ porkbun dnssec list example.com
151
+ porkbun dnssec create example.com --key-tag 12345 --alg 13 --digest-type 2 --digest abc123
152
+ porkbun dnssec delete example.com --key-tag 12345
153
+ ```
154
+
155
+ ### SSL
156
+
157
+ ```bash
158
+ porkbun ssl example.com
159
+ ```
160
+
161
+ ### Output formats
162
+
163
+ All commands support `--format`:
164
+
165
+ ```bash
166
+ porkbun domain list --format json # JSON (default)
167
+ porkbun domain list --format table # ASCII table
168
+ porkbun domain list --format csv # CSV
169
+ porkbun dns list example.com --format csv > records.csv
170
+ ```
171
+
172
+ ### Dry-run
173
+
174
+ All write commands support `--dry-run`:
175
+
176
+ ```bash
177
+ porkbun dns create example.com --type A --content 1.2.3.4 --dry-run
178
+ ```
179
+
180
+ ### Pipe with jq
181
+
182
+ JSON output combines naturally with `jq`:
183
+
184
+ ```bash
185
+ # Domain names
186
+ porkbun domain list | jq '.[].domain'
187
+
188
+ # A records only
189
+ porkbun dns list example.com | jq '[.[] | select(.type == "A")]'
190
+
191
+ # Check availability
192
+ porkbun domain check example.com | jq '.response.avail'
193
+
194
+ # Pricing for .com
195
+ porkbun pricing | jq '.pricing.com'
196
+ ```
197
+
198
+ ## Environment variables
199
+
200
+ | Variable | Description |
201
+ |----------|-------------|
202
+ | `PORKBUN_API_KEY` | Porkbun API key (required) |
203
+ | `PORKBUN_API_SECRET` | Porkbun API secret key (required) |
204
+
205
+ ## Claude Code Skill
206
+
207
+ This CLI is designed to be used as a Claude Code skill. The agent can manage your Porkbun domains directly from a conversation:
208
+
209
+ - Structured JSON output, easily parseable by AI
210
+ - All commands are non-interactive
211
+ - Combinable with `jq` for complex analysis
212
+
213
+ ## Tech stack
214
+
215
+ | Tool | Role |
216
+ |------|------|
217
+ | [TypeScript](https://www.typescriptlang.org/) | Language |
218
+ | [citty](https://github.com/unjs/citty) | CLI framework |
219
+ | [cli-table3](https://github.com/cli-table/cli-table3) | Table rendering |
220
+ | [tsup](https://github.com/egoist/tsup) | Build |
221
+ | [Biome](https://biomejs.dev/) | Linter & formatter |
222
+
223
+ ## License
224
+
225
+ MIT — yabbal