Skip to content

Commit f853a4f

Browse files
Merge pull request #9 from godaddy/feat/api-catalog-discovery
feat: add api catalog discovery with list, describe, and search subco…
2 parents 73dd957 + eb1cbfa commit f853a4f

File tree

18 files changed

+2679
-48
lines changed

18 files changed

+2679
-48
lines changed
Lines changed: 382 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,382 @@
1+
---
2+
name: godaddy-cli
3+
description: "Use the GoDaddy CLI (godaddy) to manage applications, authentication, environments, deployments, extensions, and webhooks on the GoDaddy Developer Platform. Load this skill when a task involves running godaddy commands, parsing their JSON output, managing GoDaddy applications, deploying extensions, or interacting with the GoDaddy commerce APIs."
4+
version: 1.0.0
5+
author: GoDaddy Commerce
6+
tags: [godaddy, cli, commerce, applications, deploy]
7+
---
8+
9+
# Using the GoDaddy CLI
10+
11+
The `godaddy` CLI is an agent-first tool. Every command returns a single JSON envelope to stdout. There is no plain text mode, no `--json` flag, and no table output. Parse stdout as JSON.
12+
13+
## Quick Start
14+
15+
```bash
16+
# Discover all commands and check current state
17+
godaddy
18+
19+
# Authenticate (opens browser for OAuth)
20+
godaddy auth login
21+
22+
# Check auth + environment
23+
godaddy auth status
24+
godaddy env get
25+
26+
# List applications
27+
godaddy application list
28+
29+
# Get details on one application
30+
godaddy application info <name>
31+
```
32+
33+
## Output Contract
34+
35+
### Every response is JSON
36+
37+
Every command writes exactly one JSON object to stdout followed by a newline. Parse it directly. Debug/verbose messages go to stderr only.
38+
39+
### Success
40+
41+
```json
42+
{
43+
"ok": true,
44+
"command": "godaddy application list",
45+
"result": { ... },
46+
"next_actions": [ ... ]
47+
}
48+
```
49+
50+
### Error
51+
52+
```json
53+
{
54+
"ok": false,
55+
"command": "godaddy application info demo",
56+
"error": {
57+
"message": "Application 'demo' not found",
58+
"code": "NOT_FOUND"
59+
},
60+
"fix": "Use discovery commands such as: godaddy application list or godaddy actions list.",
61+
"next_actions": [ ... ]
62+
}
63+
```
64+
65+
Check `ok` first. On failure, read `error.code` for programmatic handling and `fix` for the suggested recovery step.
66+
67+
Error codes: `NOT_FOUND`, `AUTH_REQUIRED`, `VALIDATION_ERROR`, `NETWORK_ERROR`, `CONFIG_ERROR`, `SECURITY_BLOCKED`, `COMMAND_NOT_FOUND`, `UNSUPPORTED_OPTION`, `UNEXPECTED_ERROR`.
68+
69+
### next_actions (HATEOAS)
70+
71+
Every response includes `next_actions` — an array of commands you can run next. These are contextual: they change based on what just happened.
72+
73+
```json
74+
{
75+
"next_actions": [
76+
{
77+
"command": "godaddy application validate <name>",
78+
"description": "Validate application configuration",
79+
"params": {
80+
"name": { "value": "wes-test-app-devs2", "required": true }
81+
}
82+
},
83+
{
84+
"command": "godaddy application release <name> --release-version <version>",
85+
"description": "Create a release",
86+
"params": {
87+
"name": { "value": "wes-test-app-devs2", "required": true },
88+
"version": { "required": true }
89+
}
90+
}
91+
]
92+
}
93+
```
94+
95+
How to read `next_actions`:
96+
- **No `params`**: the command is literal — run it as-is.
97+
- **`params` present**: the command is a template. Fill `<placeholders>` with values.
98+
- **`params.*.value`**: pre-filled from context. Use this value unless you have a reason to override.
99+
- **`params.*.default`**: value to use if the param is omitted.
100+
- **`params.*.enum`**: valid choices for this param.
101+
- **`params.*.required`**: must be provided (corresponds to `<positional>` args).
102+
103+
Template syntax: `<required>` for positional args, `[--flag <value>]` for optional flags, `[--flag]` for optional booleans.
104+
105+
### Truncated output
106+
107+
Large results are automatically truncated to protect context windows. When this happens:
108+
109+
```json
110+
{
111+
"result": {
112+
"events": [ ... ],
113+
"total": 190,
114+
"shown": 50,
115+
"truncated": true,
116+
"full_output": "/var/folders/.../godaddy-cli/1771947169904-webhook-events.json"
117+
}
118+
}
119+
```
120+
121+
If `truncated` is `true`, the complete data is at the `full_output` file path. Read that file if you need everything.
122+
123+
## Global Options
124+
125+
| Flag | Alias | Effect |
126+
|------|-------|--------|
127+
| `--pretty` | | Pretty-print JSON with 2-space indentation |
128+
| `--env <env>` | `-e` | Override environment for this command (`ote` or `prod`) |
129+
| `--verbose` | `-v` | Log HTTP requests/responses to stderr |
130+
| `--debug` | `-vv` | Full verbose output to stderr |
131+
132+
These can appear anywhere in the command. They do not affect the JSON structure — only formatting and stderr diagnostics.
133+
134+
## Discovery
135+
136+
Run any group command without a subcommand to get its command tree:
137+
138+
```bash
139+
godaddy # Full tree + environment + auth snapshot
140+
godaddy application # Application subcommands
141+
godaddy application add # Add configuration subcommands
142+
godaddy auth # Auth subcommands
143+
godaddy env # Environment subcommands
144+
godaddy actions # Action subcommands
145+
godaddy webhook # Webhook subcommands
146+
```
147+
148+
The root command (`godaddy` with no args) returns the complete `command_tree`, current environment, and authentication state — everything needed to decide what to do next.
149+
150+
## Environments
151+
152+
Two environments: `ote` (test, default) and `prod`.
153+
154+
```bash
155+
godaddy env get # Check current
156+
godaddy env set prod # Switch to production
157+
godaddy env list # List all with active first
158+
godaddy env info ote # Show config details for an environment
159+
godaddy --env prod app list # One-off override without switching
160+
```
161+
162+
The active environment determines which API endpoint and config file are used.
163+
164+
## Authentication
165+
166+
OAuth 2.0 PKCE flow. Opens a browser for login. Tokens are stored in the OS keychain.
167+
168+
```bash
169+
godaddy auth login # Standard login
170+
godaddy auth login --scope commerce.orders:read # Request additional scope
171+
godaddy auth status # Check token state
172+
godaddy auth logout # Clear credentials
173+
```
174+
175+
If a command fails with `AUTH_REQUIRED`, run `godaddy auth login` and retry.
176+
177+
The `godaddy api` command supports automatic re-auth: if a request returns 403 and `--scope` was provided, it re-authenticates with the requested scope and retries once.
178+
179+
## Commands
180+
181+
### Application Lifecycle
182+
183+
```bash
184+
# List and inspect
185+
godaddy application list
186+
godaddy application info <name>
187+
godaddy application validate <name>
188+
189+
# Create
190+
godaddy application init \
191+
--name my-app \
192+
--description "My application" \
193+
--url https://my-app.example.com \
194+
--proxy-url https://my-app.example.com/api \
195+
--scopes "apps.app-registry:read apps.app-registry:write"
196+
197+
# Update
198+
godaddy application update <name> --label "New Label"
199+
godaddy application update <name> --status INACTIVE
200+
godaddy application update <name> --description "Updated description"
201+
202+
# Enable/disable on a store
203+
godaddy application enable <name> --store-id <storeId>
204+
godaddy application disable <name> --store-id <storeId>
205+
206+
# Archive
207+
godaddy application archive <name>
208+
```
209+
210+
### Configuration (godaddy.toml)
211+
212+
Add actions, subscriptions, and extensions to the config file:
213+
214+
```bash
215+
# Actions
216+
godaddy application add action --name my-action --url /actions/handler
217+
218+
# Webhook subscriptions
219+
godaddy application add subscription \
220+
--name order-events \
221+
--events "commerce.order.created,commerce.order.updated" \
222+
--url /webhooks/orders
223+
224+
# Extensions
225+
godaddy application add extension embed \
226+
--name my-widget \
227+
--handle my-widget-ext \
228+
--source src/extensions/widget/index.tsx \
229+
--target admin.product.detail
230+
231+
godaddy application add extension checkout \
232+
--name my-checkout \
233+
--handle my-checkout-ext \
234+
--source src/extensions/checkout/index.tsx \
235+
--target checkout.cart.summary
236+
237+
godaddy application add extension blocks --source src/extensions/blocks/index.tsx
238+
```
239+
240+
All `add` commands accept `--config <path>` and `--environment <env>` to target a specific config file.
241+
242+
### Release and Deploy
243+
244+
```bash
245+
# Create a release (required before deploy)
246+
godaddy application release <name> --release-version 1.0.0
247+
godaddy application release <name> --release-version 1.0.0 --description "Initial release"
248+
249+
# Deploy
250+
godaddy application deploy <name>
251+
252+
# Deploy with streaming progress (NDJSON)
253+
godaddy application deploy <name> --follow
254+
```
255+
256+
Release and deploy accept `--config <path>` and `--environment <env>`.
257+
258+
### Raw API Requests
259+
260+
Make authenticated requests to any GoDaddy API endpoint:
261+
262+
```bash
263+
# GET request
264+
godaddy api /v1/commerce/catalog/products
265+
266+
# POST with inline fields
267+
godaddy api /v1/some/endpoint -X POST -f "name=value" -f "count=5"
268+
269+
# POST with body from file
270+
godaddy api /v1/some/endpoint -X POST -F body.json
271+
272+
# Custom headers
273+
godaddy api /v1/some/endpoint -H "X-Custom: value"
274+
275+
# Extract a field from the response
276+
godaddy api /v1/some/endpoint -q ".data[0].id"
277+
278+
# Include response headers in output
279+
godaddy api /v1/some/endpoint -i
280+
281+
# Auto re-auth on 403 with specific scope
282+
godaddy api /v1/commerce/orders -s commerce.orders:read
283+
```
284+
285+
### Actions
286+
287+
```bash
288+
# List all available actions
289+
godaddy actions list
290+
291+
# Describe an action's request/response contract
292+
godaddy actions describe location.address.verify
293+
godaddy actions describe commerce.taxes.calculate
294+
```
295+
296+
Available actions: `location.address.verify`, `commerce.taxes.calculate`, `commerce.shipping-rates.calculate`, `commerce.price-adjustment.apply`, `commerce.price-adjustment.list`, `notifications.email.send`, `commerce.payment.get`, `commerce.payment.cancel`, `commerce.payment.refund`, `commerce.payment.process`, `commerce.payment.auth`.
297+
298+
### Webhooks
299+
300+
```bash
301+
# List all available webhook event types
302+
godaddy webhook events
303+
```
304+
305+
Returns up to 50 events inline; use `full_output` path for the complete list (190+ events).
306+
307+
## NDJSON Streaming
308+
309+
When `--follow` is used (currently on `deploy`), output is multiple JSON lines instead of one envelope. Each line has a `type` field:
310+
311+
```
312+
{"type":"start","command":"godaddy application deploy my-app --follow","ts":"..."}
313+
{"type":"step","name":"security-scan","status":"started","ts":"..."}
314+
{"type":"step","name":"security-scan","status":"completed","ts":"..."}
315+
{"type":"step","name":"bundle","status":"started","extension_name":"my-widget","ts":"..."}
316+
{"type":"progress","name":"bundle","percent":50,"ts":"..."}
317+
{"type":"step","name":"bundle","status":"completed","ts":"..."}
318+
{"type":"result","ok":true,"command":"...","result":{...},"next_actions":[...]}
319+
```
320+
321+
The **last line is always terminal** (`type: "result"` or `type: "error"`). It has the same shape as a standard envelope. If you only care about the final outcome, read the last line.
322+
323+
Stream event types:
324+
| Type | Meaning | Terminal? |
325+
|------|---------|-----------|
326+
| `start` | Stream begun | No |
327+
| `step` | Step lifecycle (started/completed/failed) | No |
328+
| `progress` | Progress update (percent, message) | No |
329+
| `result` | Success envelope | Yes |
330+
| `error` | Error envelope | Yes |
331+
332+
## Typical Workflows
333+
334+
### Create and deploy a new application
335+
336+
```bash
337+
godaddy env get # 1. Check environment
338+
godaddy auth status # 2. Verify auth
339+
godaddy application init --name my-app \ # 3. Create app
340+
--description "My app" \
341+
--url https://my-app.example.com \
342+
--proxy-url https://my-app.example.com/api \
343+
--scopes "apps.app-registry:read apps.app-registry:write"
344+
godaddy application add action --name my-action \ # 4. Add action
345+
--url /actions/handler
346+
godaddy application validate my-app # 5. Validate
347+
godaddy application release my-app \ # 6. Release
348+
--release-version 1.0.0
349+
godaddy application deploy my-app --follow # 7. Deploy
350+
godaddy application enable my-app --store-id <storeId> # 8. Enable
351+
```
352+
353+
### Update and redeploy
354+
355+
```bash
356+
godaddy application info my-app # 1. Check current state
357+
godaddy application update my-app --description "New" # 2. Update
358+
godaddy application validate my-app # 3. Validate
359+
godaddy application release my-app \ # 4. Bump version
360+
--release-version 1.1.0
361+
godaddy application deploy my-app --follow # 5. Deploy
362+
```
363+
364+
### Diagnose failures
365+
366+
```bash
367+
godaddy # 1. Check overall state
368+
godaddy auth status # 2. Token expired? → godaddy auth login
369+
godaddy env info # 3. Config correct?
370+
godaddy application validate <n> # 4. Config issues?
371+
godaddy application info <n> # 5. App status?
372+
```
373+
374+
## Parsing Tips
375+
376+
1. **Always parse stdout as JSON.** The only non-JSON output is `--help` text.
377+
2. **Check `ok` first.** Branch on `true`/`false` before reading `result` or `error`.
378+
3. **Use `next_actions`** to discover what to do next. Fill template params from context.
379+
4. **Exit code**: 0 = success, 1 = error. But always prefer the JSON `ok` field.
380+
5. **stderr is diagnostic only.** Verbose/debug output goes there. Never parse stderr for data.
381+
6. **Truncated lists**: check `truncated` field. Read `full_output` file for complete data.
382+
7. **Streaming**: for `--follow` commands, parse each line as an independent JSON object. The last line is the final result.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Patch Changes
66

7+
- Add API catalog discovery commands (`api list`, `api describe`, `api search`) and preserve backward compatibility by routing legacy `godaddy api <endpoint>` usage to `godaddy api call <endpoint>`. Also add the public `godaddy-cli` agent skill documentation.
78
- b3cba2f: Security hardening: bind OAuth server to 127.0.0.1, sanitize headers in debug and --include output, HTML-escape OAuth error page, harden PowerShell keychain escaping, stop forwarding raw server errors to userMessage, redact sensitive fields in debug request body, add 120s OAuth timeout.
89

910
## 0.2.0

0 commit comments

Comments
 (0)