@godaddy/cli 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
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 GoDaddy Operating Company, LLC.
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 ADDED
@@ -0,0 +1,400 @@
1
+ # GoDaddy CLI
2
+
3
+ A powerful command-line interface for interacting with GoDaddy's developer ecosystem. Manage your applications, handle authentication, and work with webhooks effortlessly.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Install the CLI globally from npm
9
+ npm install -g @godaddy/cli
10
+
11
+ # Verify installation
12
+ godaddy --help
13
+ ```
14
+
15
+ ## Development
16
+
17
+ ```bash
18
+ # Watch mode for development using tsx
19
+ pnpm tsx --watch index.ts
20
+
21
+ # Quick command execution during development
22
+ pnpm tsx src/index.tsx application <command>
23
+ ```
24
+
25
+ ## Features
26
+
27
+ - **Application Management**: Create, view, and release applications
28
+ - **Authentication**: Secure OAuth-based authentication with GoDaddy
29
+ - **Webhook Management**: List available webhook event types
30
+ - **Environment Management**: Work across different GoDaddy environments
31
+ - **Actions Management**: List and describe available application actions
32
+
33
+ ## Command Reference
34
+
35
+ ### Global Options
36
+
37
+ ```bash
38
+ godaddy --help # Display help information
39
+ godaddy --version # Display version information
40
+ godaddy -e, --env <environment> # Set target environment (ote, prod)
41
+ godaddy --debug # Enable debug logging for HTTP requests and responses
42
+ ```
43
+
44
+ ### Environment Commands
45
+
46
+ ```bash
47
+ # List all available environments
48
+ godaddy env list
49
+ Options:
50
+ -o, --output <format> # Output format: json or text (default: text)
51
+
52
+ # Get current environment details
53
+ godaddy env get
54
+ Options:
55
+ -o, --output <format> # Output format: json or text (default: text)
56
+
57
+ # Switch to a different environment
58
+ godaddy env set <environment> # <environment> is one of: ote, prod
59
+ Options:
60
+ -o, --output <format> # Output format: json or text (default: text)
61
+
62
+ # View detailed environment configuration
63
+ godaddy env info [environment] # [environment] is one of: ote, prod (defaults to current)
64
+ Options:
65
+ -o, --output <format> # Output format: json or text (default: text)
66
+ ```
67
+
68
+ ### Authentication Commands
69
+
70
+ ```bash
71
+ # Login to GoDaddy Developer Platform
72
+ godaddy auth login # Opens browser for OAuth authentication
73
+ Options:
74
+ -o, --output <format> # Output format: json or text (default: text)
75
+
76
+ # Logout and clear stored credentials
77
+ godaddy auth logout
78
+ Options:
79
+ -o, --output <format> # Output format: json or text (default: text)
80
+
81
+ # Check current authentication status
82
+ godaddy auth status
83
+ Options:
84
+ -o, --output <format> # Output format: json or text (default: text)
85
+ ```
86
+
87
+ ### Application Commands
88
+
89
+ > **Note**: `godaddy app` can be used as a shorthand alias for `godaddy application`
90
+
91
+ ```bash
92
+ # List all applications
93
+ godaddy application list # Alias: godaddy app ls
94
+ Options:
95
+ -o, --output <format> # Output format: json or text (default: text)
96
+
97
+ # Show application information
98
+ godaddy application info <name> # Shows info for the named application
99
+ Options:
100
+ -o, --output <format> # Output format: json or text (default: text)
101
+
102
+ # Initialize a new application
103
+ godaddy application init
104
+ Options:
105
+ --name <name> # Application name
106
+ --description <description> # Application description
107
+ --url <url> # Application URL
108
+ --proxy-url <proxyUrl> # Proxy URL for API endpoints
109
+ --scopes <scopes> # Authorization scopes (space-separated)
110
+ -c, --config <path> # Path to configuration file
111
+ --environment <env> # Environment (ote|prod)
112
+ -o, --output <format> # Output format: json or text (default: text)
113
+
114
+ # Validate application configuration
115
+ godaddy application validate <name>
116
+ Options:
117
+ -o, --output <format> # Output format: json or text (default: text)
118
+
119
+ # Update existing application
120
+ godaddy application update <name>
121
+ Options:
122
+ --label <label> # Application label
123
+ --description <description> # Application description
124
+ --status <status> # Application status (ACTIVE|INACTIVE)
125
+ -o, --output <format> # Output format: json or text (default: text)
126
+
127
+ # Create a new release of your application
128
+ godaddy application release <name>
129
+ Options:
130
+ --release-version <version> # Release version (required)
131
+ --description <description> # Release description
132
+ --config <path> # Path to configuration file
133
+ --environment <env> # Environment (ote|prod)
134
+ -o, --output <format> # Output format: json or text (default: text)
135
+
136
+ # Deploy your application to the platform
137
+ godaddy application deploy <name>
138
+ Options:
139
+ --config <path> # Path to configuration file
140
+ --environment <env> # Environment (ote|prod)
141
+ -o, --output <format> # Output format: json or text (default: text)
142
+
143
+ # Enable an application on a store
144
+ godaddy application enable <name>
145
+ Options:
146
+ --store-id <storeId> # Store ID (required)
147
+ -o, --output <format> # Output format: json or text (default: text)
148
+
149
+ # Disable an application on a store
150
+ godaddy application disable <name>
151
+ Options:
152
+ --store-id <storeId> # Store ID (required)
153
+ -o, --output <format> # Output format: json or text (default: text)
154
+
155
+ # Archive an application
156
+ godaddy application archive <name>
157
+ Options:
158
+ -o, --output <format> # Output format: json or text (default: text)
159
+
160
+ # Add components to your application
161
+ godaddy application add <type>
162
+ <type> can be one of: # action, subscription, extension
163
+ ```
164
+
165
+ #### Adding Actions
166
+
167
+ ```bash
168
+ godaddy application add action
169
+ Options:
170
+ --name <name> # Action name (required)
171
+ --url <url> # Action endpoint URL (required)
172
+ --config <path> # Path to configuration file
173
+ --environment <env> # Environment (ote|prod)
174
+ -o, --output <format> # Output format: json or text (default: text)
175
+ ```
176
+
177
+ #### Adding Subscriptions
178
+
179
+ ```bash
180
+ godaddy application add subscription
181
+ Options:
182
+ --name <name> # Subscription name (required)
183
+ --events <events> # Comma-separated list of events (required)
184
+ --url <url> # Webhook endpoint URL (required)
185
+ --config <path> # Path to configuration file
186
+ --environment <env> # Environment (ote|prod)
187
+ -o, --output <format> # Output format: json or text (default: text)
188
+ ```
189
+
190
+ #### Adding Extensions
191
+
192
+ ```bash
193
+ # Add an embed extension (injected UI at specific page locations)
194
+ godaddy application add extension embed
195
+ Options:
196
+ --name <name> # Extension name (required)
197
+ --handle <handle> # Extension handle/unique identifier (required)
198
+ --source <source> # Path to extension source file (required)
199
+ --target <targets> # Comma-separated list of target locations (required)
200
+ --config <path> # Path to configuration file
201
+ --environment <env> # Environment (ote|prod)
202
+ -o, --output <format> # Output format: json or text (default: text)
203
+
204
+ # Add a checkout extension (checkout flow UI)
205
+ godaddy application add extension checkout
206
+ Options:
207
+ --name <name> # Extension name (required)
208
+ --handle <handle> # Extension handle/unique identifier (required)
209
+ --source <source> # Path to extension source file (required)
210
+ --target <targets> # Comma-separated list of checkout target locations (required)
211
+ --config <path> # Path to configuration file
212
+ --environment <env> # Environment (ote|prod)
213
+ -o, --output <format> # Output format: json or text (default: text)
214
+
215
+ # Set the blocks extension source (consolidated UI blocks package)
216
+ godaddy application add extension blocks
217
+ Options:
218
+ --source <source> # Path to blocks extension source file (required)
219
+ --config <path> # Path to configuration file
220
+ --environment <env> # Environment (ote|prod)
221
+ -o, --output <format> # Output format: json or text (default: text)
222
+ ```
223
+
224
+ ### Webhook Commands
225
+
226
+ ```bash
227
+ # List available webhook event types
228
+ godaddy webhook events # Lists all available webhook event types you can subscribe to
229
+ Options:
230
+ -o, --output <format> # Output format: json or text (default: text)
231
+ ```
232
+
233
+ ### Actions Commands
234
+
235
+ ```bash
236
+ # List all available actions
237
+ godaddy actions list # Lists all available actions an application can hook into
238
+ Options:
239
+ -o, --output <format> # Output format: json or text (default: text)
240
+
241
+ # Show detailed interface information for a specific action
242
+ godaddy actions describe <action> # Displays request/response schemas for the action
243
+ Options:
244
+ -o, --output <format> # Output format: json or text (default: text)
245
+ ```
246
+
247
+ #### Available Actions
248
+
249
+ The following actions are available for applications to hook into:
250
+
251
+ - `location.address.verify` - Verify and standardize a physical address
252
+ - `commerce.taxes.calculate` - Calculate taxes for a purchase
253
+ - `commerce.shipping-rates.calculate` - Calculate shipping rates
254
+ - `commerce.price-adjustment.apply` - Apply price adjustments
255
+ - `commerce.price-adjustment.list` - List price adjustments
256
+ - `notifications.email.send` - Send email notifications
257
+ - `commerce.payment.get` - Get payment details
258
+ - `commerce.payment.cancel` - Cancel a payment
259
+ - `commerce.payment.refund` - Refund a payment
260
+ - `commerce.payment.process` - Process a payment
261
+ - `commerce.payment.auth` - Authorize a payment
262
+
263
+ ## Automation Examples
264
+
265
+ ### Complete Application Setup
266
+
267
+ Create and configure an application without interactive prompts:
268
+
269
+ ```bash
270
+ # Create application
271
+ godaddy application init \
272
+ --name "my-ecommerce-app" \
273
+ --description "Advanced e-commerce integration" \
274
+ --url "https://app.mystore.com" \
275
+ --proxy-url "https://api.mystore.com" \
276
+ --scopes "domains orders customers" \
277
+ --config ./config/godaddy.prod.toml \
278
+ --environment prod \
279
+ --output json \
280
+ --env prod
281
+
282
+ # Add action
283
+ godaddy application add action \
284
+ --name "order.completed" \
285
+ --url "https://api.mystore.com/actions/order-completed" \
286
+ --config ./config/godaddy.prod.toml \
287
+ --environment prod \
288
+ --output json
289
+
290
+ # Add webhook subscription
291
+ godaddy application add subscription \
292
+ --name "order-events" \
293
+ --events "order.created,order.completed,order.cancelled" \
294
+ --url "https://api.mystore.com/webhooks/orders" \
295
+ --config ./config/godaddy.prod.toml \
296
+ --environment prod \
297
+ --output json
298
+
299
+ # Add embed extension
300
+ godaddy application add extension embed \
301
+ --name "my-widget" \
302
+ --handle "my-widget-handle" \
303
+ --source "./extensions/embed/index.tsx" \
304
+ --target "body.end" \
305
+ --config ./config/godaddy.prod.toml \
306
+ --environment prod \
307
+ --output json
308
+
309
+ # Create a release
310
+ godaddy application release my-ecommerce-app \
311
+ --release-version "1.0.0" \
312
+ --description "Initial release" \
313
+ --config ./config/godaddy.prod.toml \
314
+ --environment prod \
315
+ --output json
316
+
317
+ # Deploy the application
318
+ godaddy application deploy my-ecommerce-app \
319
+ --config ./config/godaddy.prod.toml \
320
+ --environment prod \
321
+ --output json
322
+
323
+ # Enable on a store
324
+ godaddy application enable my-ecommerce-app \
325
+ --store-id "12345" \
326
+ --output json
327
+ ```
328
+
329
+ ## Environment Management
330
+
331
+ The CLI supports multiple GoDaddy environments:
332
+
333
+ - **ote**: Pre-production environment that mirrors production
334
+ - **prod**: Production environment for live applications
335
+
336
+ You can specify the environment in two ways:
337
+
338
+ 1. Using the global `-e, --env` flag with any command: `godaddy application info my-app --env ote`
339
+ 2. Setting a default environment: `godaddy env set prod`
340
+
341
+ Use `godaddy env info` to view detailed configuration for your current environment.
342
+
343
+ ## Application Configuration
344
+
345
+ The CLI uses a configuration file (`godaddy.toml`) to store your application settings. You can provide a custom configuration file path using the `--config` option with commands that support it.
346
+
347
+ Environment-specific configuration files can be used by naming them `godaddy.<environment>.toml` (e.g., `godaddy.dev.toml`).
348
+
349
+ Example configuration:
350
+
351
+ ```toml
352
+ name = "my-app"
353
+ client_id = "your-client-id"
354
+ description = "My GoDaddy Application"
355
+ url = "https://myapp.example.com"
356
+ proxy_url = "https://proxy.example.com"
357
+ authorization_scopes = ["domains", "shopper"]
358
+ version = "0.0.0"
359
+ actions = []
360
+
361
+ [[subscriptions.webhook]]
362
+ name = "domain-events"
363
+ events = ["example:v1:domain:created", "example:v1:domain:updated"]
364
+ url = "https://myapp.example.com/webhooks"
365
+
366
+ [extensions]
367
+ ui_extension = "value"
368
+
369
+ [dependencies]
370
+ app = [{name = "required-app", version = "^1.0.0"}]
371
+ feature = [{name = "required-feature"}]
372
+ ```
373
+
374
+ ## Application Deployment
375
+
376
+ The deployment process consists of several steps:
377
+
378
+ 1. **Initialize**: Create your application with `godaddy application init`
379
+ 2. **Configure**: Add components with the `application add` commands
380
+ 3. **Validate**: Ensure your configuration is valid with `godaddy application validate`
381
+ 4. **Release**: Create a new version with `godaddy application release`
382
+ 5. **Deploy**: Deploy your application with `godaddy application deploy`
383
+ 6. **Enable**: Enable your application on stores with `godaddy application enable`
384
+
385
+ ## Authentication
386
+
387
+ Authentication is handled securely using OAuth. The CLI will:
388
+
389
+ 1. Open a browser for authentication with GoDaddy
390
+ 2. Store tokens securely in your system keychain
391
+ 3. Automatically use the stored token for future commands
392
+
393
+ ## Requirements
394
+
395
+ - Node.js 16+
396
+ - Access to GoDaddy Developer Account
397
+
398
+ ## License
399
+
400
+ Copyright GoDaddy Inc. All rights reserved.