gg-deploy 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.
- package/.env.example +7 -0
- package/LICENSE +661 -0
- package/README.md +251 -0
- package/config.sample.json +10 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +124 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/apply.d.ts +3 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +81 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +105 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +79 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +87 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server.d.ts +4 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +96 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/services/github.d.ts +18 -0
- package/dist/services/github.d.ts.map +1 -0
- package/dist/services/github.js +123 -0
- package/dist/services/github.js.map +1 -0
- package/dist/services/godaddy.d.ts +16 -0
- package/dist/services/godaddy.d.ts.map +1 -0
- package/dist/services/godaddy.js +69 -0
- package/dist/services/godaddy.js.map +1 -0
- package/dist/types.d.ts +52 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui-server.d.ts +2 -0
- package/dist/ui-server.d.ts.map +1 -0
- package/dist/ui-server.js +223 -0
- package/dist/ui-server.js.map +1 -0
- package/package.json +72 -0
- package/tsconfig.json +20 -0
- package/ui/dist/assets/index-DWy6cIAN.js +41 -0
- package/ui/dist/assets/index-DuQvusTC.css +1 -0
- package/ui/dist/index.html +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="img/Banner.png" alt="GG Deploy Banner" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# gg-deploy
|
|
6
|
+
|
|
7
|
+
**Free hosting deserves free tooling. Domain → GitHub Pages in 60 seconds.**
|
|
8
|
+
|
|
9
|
+
Configure and connect any domain to free hosting via GitHub Pages—DNS, SSL, CNAME—automated. One command. One click. One prompt. Works via CLI, desktop app, web UI, or AI assistant (MCP).
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx gg-deploy ui
|
|
15
|
+
# Opens http://localhost:3847
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or via CLI:
|
|
19
|
+
```bash
|
|
20
|
+
npx gg-deploy plan example.com user/repo # Preview (safe)
|
|
21
|
+
npx gg-deploy apply example.com user/repo # Deploy
|
|
22
|
+
npx gg-deploy status example.com user/repo # Health check
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- **Node.js 18+** — Check with `node --version`
|
|
28
|
+
- **GoDaddy account** with API access enabled
|
|
29
|
+
- **GitHub account** with a Personal Access Token
|
|
30
|
+
- **Domain on GoDaddy** you want to point to GitHub Pages
|
|
31
|
+
- **GitHub repo** with your site content (index.html or built site)
|
|
32
|
+
|
|
33
|
+
## Setup
|
|
34
|
+
|
|
35
|
+
Credentials are saved once to `~/.gg-deploy/config.json` and work across all projects.
|
|
36
|
+
|
|
37
|
+
### Option 1: Web UI (Recommended)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx gg-deploy ui
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The setup wizard walks you through:
|
|
44
|
+
1. Creating a GoDaddy API key
|
|
45
|
+
2. Creating a GitHub token
|
|
46
|
+
3. Testing and saving credentials
|
|
47
|
+
|
|
48
|
+
### Option 2: Manual Config
|
|
49
|
+
|
|
50
|
+
Create `~/.gg-deploy/config.json`:
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"godaddy": {
|
|
54
|
+
"apiKey": "YOUR_KEY",
|
|
55
|
+
"apiSecret": "YOUR_SECRET",
|
|
56
|
+
"environment": "production"
|
|
57
|
+
},
|
|
58
|
+
"github": {
|
|
59
|
+
"token": "ghp_YOUR_TOKEN"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Getting Credentials
|
|
65
|
+
|
|
66
|
+
**GoDaddy API Key:**
|
|
67
|
+
1. Go to https://developer.godaddy.com/keys
|
|
68
|
+
2. Click "Create New API Key"
|
|
69
|
+
3. Select **Production** (not OTE/Test)
|
|
70
|
+
4. Copy Key and Secret immediately (secret shown only once)
|
|
71
|
+
|
|
72
|
+
**GitHub Token:**
|
|
73
|
+
1. Go to https://github.com/settings/tokens/new?description=gg-deploy&scopes=repo
|
|
74
|
+
2. Click "Generate token"
|
|
75
|
+
3. Copy the token (starts with `ghp_`)
|
|
76
|
+
|
|
77
|
+
## Web Interface
|
|
78
|
+
|
|
79
|
+
### Main Screen
|
|
80
|
+
|
|
81
|
+
| Element | Description |
|
|
82
|
+
|---------|-------------|
|
|
83
|
+
| **Domain field** | Your GoDaddy domain (e.g., `example.com`) |
|
|
84
|
+
| **Repository field** | GitHub repo as `username/repo` |
|
|
85
|
+
| **Deploy button** | Starts the deployment process |
|
|
86
|
+
| **Status badges** | Show GoDaddy/GitHub connection status |
|
|
87
|
+
| **Settings gear** | Opens credential management |
|
|
88
|
+
|
|
89
|
+
### Status Indicators
|
|
90
|
+
|
|
91
|
+
| Color | Meaning |
|
|
92
|
+
|-------|---------|
|
|
93
|
+
| Green (glowing) | Connected and verified |
|
|
94
|
+
| Yellow (pulsing) | Testing connection... |
|
|
95
|
+
| Red | Error (hover for details) |
|
|
96
|
+
| Gray | Not tested yet |
|
|
97
|
+
|
|
98
|
+
Hover over badges for detailed status. Click the refresh button to re-test connections.
|
|
99
|
+
|
|
100
|
+
### Settings Screen
|
|
101
|
+
|
|
102
|
+
- **API Key / Secret / Token fields** — Pre-filled with saved values (masked)
|
|
103
|
+
- **Eye icon** — Click to reveal value for copying
|
|
104
|
+
- **Status indicators** — Show live verification status
|
|
105
|
+
- **Test button** — Re-verify API connections
|
|
106
|
+
- **Update Settings** — Save changes
|
|
107
|
+
|
|
108
|
+
### Deployment Flow
|
|
109
|
+
|
|
110
|
+
1. Enter domain and repo
|
|
111
|
+
2. Click Deploy
|
|
112
|
+
3. Watch real-time progress:
|
|
113
|
+
- Verify domain ownership
|
|
114
|
+
- Check repository access
|
|
115
|
+
- Configure DNS records
|
|
116
|
+
- Add CNAME file
|
|
117
|
+
- Enable GitHub Pages
|
|
118
|
+
- Provision SSL certificate
|
|
119
|
+
4. Get your live URL
|
|
120
|
+
|
|
121
|
+
## CLI Commands
|
|
122
|
+
|
|
123
|
+
| Command | Description | Safe |
|
|
124
|
+
|---------|-------------|------|
|
|
125
|
+
| `plan <domain> <repo>` | Preview changes | Yes |
|
|
126
|
+
| `apply <domain> <repo>` | Execute deployment | No |
|
|
127
|
+
| `status <domain> <repo>` | Check health | Yes |
|
|
128
|
+
| `ui` | Launch web interface | Yes |
|
|
129
|
+
| `mcp-serve` | Start MCP server | Yes |
|
|
130
|
+
| `describe` | Output tool schema | Yes |
|
|
131
|
+
|
|
132
|
+
Add `--output json` for machine-readable output.
|
|
133
|
+
|
|
134
|
+
## Claude Code / MCP
|
|
135
|
+
|
|
136
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"mcpServers": {
|
|
141
|
+
"gg-deploy": {
|
|
142
|
+
"command": "npx",
|
|
143
|
+
"args": ["-y", "gg-deploy", "mcp-serve"]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Then tell Claude: "Deploy example.com using user/repo"
|
|
150
|
+
|
|
151
|
+
## Troubleshooting
|
|
152
|
+
|
|
153
|
+
### Node.js Issues
|
|
154
|
+
|
|
155
|
+
| Problem | Solution |
|
|
156
|
+
|---------|----------|
|
|
157
|
+
| `node: command not found` | Install Node.js from https://nodejs.org |
|
|
158
|
+
| `unsupported engine` | Upgrade to Node.js 18+ |
|
|
159
|
+
| `EACCES permission denied` | Don't use `sudo`. Fix npm permissions or use nvm |
|
|
160
|
+
|
|
161
|
+
### GoDaddy API Issues
|
|
162
|
+
|
|
163
|
+
| Problem | Solution |
|
|
164
|
+
|---------|----------|
|
|
165
|
+
| `401 Unauthorized` | Wrong API key/secret. Regenerate at developer.godaddy.com |
|
|
166
|
+
| `403 Forbidden` | API key is for OTE (test). Create a **Production** key |
|
|
167
|
+
| `404 Not Found` | Domain not in your GoDaddy account |
|
|
168
|
+
| `422 Invalid` | Domain locked or has pending transfers |
|
|
169
|
+
| Red status dot | Hover for error. Usually auth issue |
|
|
170
|
+
|
|
171
|
+
### GitHub API Issues
|
|
172
|
+
|
|
173
|
+
| Problem | Solution |
|
|
174
|
+
|---------|----------|
|
|
175
|
+
| `401 Bad credentials` | Token expired or invalid. Generate new one |
|
|
176
|
+
| `403 Forbidden` | Token missing `repo` scope. Regenerate with correct scope |
|
|
177
|
+
| `404 Not Found` | Repo doesn't exist or token can't access it |
|
|
178
|
+
| Private repo fails | Need GitHub Pro for private repo Pages |
|
|
179
|
+
|
|
180
|
+
### DNS Issues
|
|
181
|
+
|
|
182
|
+
| Problem | Solution |
|
|
183
|
+
|---------|----------|
|
|
184
|
+
| Site not loading | Wait 10-60 min for DNS propagation |
|
|
185
|
+
| Wrong IP showing | Clear DNS cache: `sudo dscacheutil -flushcache` (Mac) |
|
|
186
|
+
| SSL not working | GitHub needs DNS to resolve first. Check Pages settings |
|
|
187
|
+
|
|
188
|
+
### Config Issues
|
|
189
|
+
|
|
190
|
+
| Problem | Solution |
|
|
191
|
+
|---------|----------|
|
|
192
|
+
| "Not configured" | Check `~/.gg-deploy/config.json` exists |
|
|
193
|
+
| Can't find config | It's in your home directory: `ls -la ~/.gg-deploy/` |
|
|
194
|
+
| Permission denied | Run `chmod 600 ~/.gg-deploy/config.json` |
|
|
195
|
+
|
|
196
|
+
### UI Issues
|
|
197
|
+
|
|
198
|
+
| Problem | Solution |
|
|
199
|
+
|---------|----------|
|
|
200
|
+
| Port 3847 in use | Kill existing: `lsof -i :3847` then `kill <PID>` |
|
|
201
|
+
| Blank page | Clear browser cache or try incognito |
|
|
202
|
+
| Eye icon not working | Click reveals value if credentials are saved |
|
|
203
|
+
|
|
204
|
+
### Common Fixes
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Check if config exists
|
|
208
|
+
cat ~/.gg-deploy/config.json
|
|
209
|
+
|
|
210
|
+
# Verify Node version
|
|
211
|
+
node --version # Should be 18+
|
|
212
|
+
|
|
213
|
+
# Test GoDaddy API manually
|
|
214
|
+
curl -H "Authorization: sso-key YOUR_KEY:YOUR_SECRET" \
|
|
215
|
+
https://api.godaddy.com/v1/domains
|
|
216
|
+
|
|
217
|
+
# Test GitHub API manually
|
|
218
|
+
curl -H "Authorization: Bearer ghp_YOUR_TOKEN" \
|
|
219
|
+
https://api.github.com/user
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## How It Works
|
|
223
|
+
|
|
224
|
+
1. **DNS** — Sets A records to GitHub IPs (185.199.108-111.153) + www CNAME
|
|
225
|
+
2. **CNAME** — Creates CNAME file in repo with your domain
|
|
226
|
+
3. **Pages** — Enables GitHub Pages on main branch
|
|
227
|
+
4. **SSL** — GitHub auto-provisions Let's Encrypt certificate
|
|
228
|
+
|
|
229
|
+
Total time: ~60 seconds. DNS propagation: 10-60 minutes.
|
|
230
|
+
|
|
231
|
+
## Security
|
|
232
|
+
|
|
233
|
+
- Credentials stored in `~/.gg-deploy/config.json` (permission 600)
|
|
234
|
+
- Never committed to git
|
|
235
|
+
- Eye icon reveals values only locally
|
|
236
|
+
- API calls made directly to GoDaddy/GitHub (no proxy)
|
|
237
|
+
|
|
238
|
+
## Limitations
|
|
239
|
+
|
|
240
|
+
- GoDaddy only (no Cloudflare/Namecheap yet)
|
|
241
|
+
- Public repos or GitHub Pro required for Pages
|
|
242
|
+
- Only www subdomain supported
|
|
243
|
+
- One domain per deployment
|
|
244
|
+
|
|
245
|
+
## License
|
|
246
|
+
|
|
247
|
+
AGPL-3.0 — Free to use, modify, and distribute. Forks must remain open source.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
Built by [Abe Diaz](https://abediaz.ai) | [GitHub](https://github.com/abe238)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import 'dotenv/config';
|
|
3
|
+
import { Command } from 'commander';
|
|
4
|
+
import { planCommand } from './commands/plan.js';
|
|
5
|
+
import { applyCommand } from './commands/apply.js';
|
|
6
|
+
import { statusCommand } from './commands/status.js';
|
|
7
|
+
import { startMcpServer } from './mcp-server.js';
|
|
8
|
+
import { startUiServer } from './ui-server.js';
|
|
9
|
+
const program = new Command();
|
|
10
|
+
program
|
|
11
|
+
.name('gg-deploy')
|
|
12
|
+
.description('Free hosting deserves free tooling. Domain → GitHub Pages in 60 seconds.')
|
|
13
|
+
.version('1.0.0');
|
|
14
|
+
program
|
|
15
|
+
.command('plan')
|
|
16
|
+
.description('Preview deployment without making changes (safe for AI agents)')
|
|
17
|
+
.argument('<domain>', 'Domain name (e.g., example.com)')
|
|
18
|
+
.argument('<repo>', 'GitHub repo (e.g., user/repo)')
|
|
19
|
+
.option('-o, --output <format>', 'Output format: human or json', 'human')
|
|
20
|
+
.action(async (domain, repo, opts) => {
|
|
21
|
+
const output = opts.output;
|
|
22
|
+
const result = await planCommand(domain, repo, output);
|
|
23
|
+
process.exit(result.status === 'success' ? 0 : 1);
|
|
24
|
+
});
|
|
25
|
+
program
|
|
26
|
+
.command('apply')
|
|
27
|
+
.description('Execute deployment (requires confirmation for AI agents)')
|
|
28
|
+
.argument('<domain>', 'Domain name (e.g., example.com)')
|
|
29
|
+
.argument('<repo>', 'GitHub repo (e.g., user/repo)')
|
|
30
|
+
.option('-o, --output <format>', 'Output format: human or json', 'human')
|
|
31
|
+
.action(async (domain, repo, opts) => {
|
|
32
|
+
const output = opts.output;
|
|
33
|
+
const result = await applyCommand(domain, repo, output);
|
|
34
|
+
const exitCode = result.status === 'success' ? 0 :
|
|
35
|
+
result.status === 'partial_success' ? 2 : 3;
|
|
36
|
+
process.exit(exitCode);
|
|
37
|
+
});
|
|
38
|
+
program
|
|
39
|
+
.command('status')
|
|
40
|
+
.description('Check deployment health (safe for AI agents)')
|
|
41
|
+
.argument('<domain>', 'Domain name (e.g., example.com)')
|
|
42
|
+
.argument('<repo>', 'GitHub repo (e.g., user/repo)')
|
|
43
|
+
.option('-o, --output <format>', 'Output format: human or json', 'human')
|
|
44
|
+
.action(async (domain, repo, opts) => {
|
|
45
|
+
const output = opts.output;
|
|
46
|
+
const result = await statusCommand(domain, repo, output);
|
|
47
|
+
process.exit(result.status === 'success' ? 0 : 1);
|
|
48
|
+
});
|
|
49
|
+
program
|
|
50
|
+
.command('describe')
|
|
51
|
+
.description('Output tool description for AI agent discovery')
|
|
52
|
+
.action(() => {
|
|
53
|
+
const description = {
|
|
54
|
+
name: 'gg-deploy',
|
|
55
|
+
version: '0.1.0',
|
|
56
|
+
description: 'Deploy any domain to GitHub Pages in one command',
|
|
57
|
+
commands: [
|
|
58
|
+
{
|
|
59
|
+
name: 'plan',
|
|
60
|
+
description: 'Preview deployment without making changes',
|
|
61
|
+
safe: true,
|
|
62
|
+
arguments: [
|
|
63
|
+
{ name: 'domain', required: true, description: 'Domain name' },
|
|
64
|
+
{ name: 'repo', required: true, description: 'GitHub repo (user/repo)' },
|
|
65
|
+
],
|
|
66
|
+
options: [
|
|
67
|
+
{ name: '--output', values: ['human', 'json'], default: 'human' },
|
|
68
|
+
],
|
|
69
|
+
example: 'gg-deploy plan example.com user/example --output json',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'apply',
|
|
73
|
+
description: 'Execute deployment',
|
|
74
|
+
safe: false,
|
|
75
|
+
requires_confirmation: true,
|
|
76
|
+
side_effects: ['Creates DNS records', 'Modifies GitHub Pages settings'],
|
|
77
|
+
rollback_available: true,
|
|
78
|
+
arguments: [
|
|
79
|
+
{ name: 'domain', required: true },
|
|
80
|
+
{ name: 'repo', required: true },
|
|
81
|
+
],
|
|
82
|
+
options: [
|
|
83
|
+
{ name: '--output', values: ['human', 'json'], default: 'human' },
|
|
84
|
+
],
|
|
85
|
+
example: 'gg-deploy apply example.com user/example --output json',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'status',
|
|
89
|
+
description: 'Check deployment health',
|
|
90
|
+
safe: true,
|
|
91
|
+
arguments: [
|
|
92
|
+
{ name: 'domain', required: true },
|
|
93
|
+
{ name: 'repo', required: true },
|
|
94
|
+
],
|
|
95
|
+
options: [
|
|
96
|
+
{ name: '--output', values: ['human', 'json'], default: 'human' },
|
|
97
|
+
],
|
|
98
|
+
example: 'gg-deploy status example.com user/example --output json',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
exit_codes: {
|
|
102
|
+
0: 'success',
|
|
103
|
+
1: 'validation_error',
|
|
104
|
+
2: 'partial_success',
|
|
105
|
+
3: 'failure',
|
|
106
|
+
4: 'rollback_needed',
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
console.log(JSON.stringify(description, null, 2));
|
|
110
|
+
});
|
|
111
|
+
program
|
|
112
|
+
.command('mcp-serve')
|
|
113
|
+
.description('Start MCP server for Claude Desktop/Code integration')
|
|
114
|
+
.action(async () => {
|
|
115
|
+
await startMcpServer();
|
|
116
|
+
});
|
|
117
|
+
program
|
|
118
|
+
.command('ui')
|
|
119
|
+
.description('Start local web interface')
|
|
120
|
+
.action(async () => {
|
|
121
|
+
await startUiServer();
|
|
122
|
+
});
|
|
123
|
+
program.parse();
|
|
124
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,WAAW,CAAC;KACjB,WAAW,CAAC,0EAA0E,CAAC;KACvF,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,gEAAgE,CAAC;KAC7E,QAAQ,CAAC,UAAU,EAAE,iCAAiC,CAAC;KACvD,QAAQ,CAAC,QAAQ,EAAE,+BAA+B,CAAC;KACnD,MAAM,CAAC,uBAAuB,EAAE,8BAA8B,EAAE,OAAO,CAAC;KACxE,MAAM,CAAC,KAAK,EAAE,MAAc,EAAE,IAAY,EAA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AAC,KAAK,IAAI,EAAE;IACjB,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI/D,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,aAAa,CAAC,CAqFxB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import ora from 'ora';
|
|
3
|
+
import { GoDaddyService } from '../services/godaddy.js';
|
|
4
|
+
import { GitHubService } from '../services/github.js';
|
|
5
|
+
export async function applyCommand(domain, repo, output) {
|
|
6
|
+
const result = {
|
|
7
|
+
status: 'success',
|
|
8
|
+
completed_steps: [],
|
|
9
|
+
failed_steps: [],
|
|
10
|
+
resources_created: [],
|
|
11
|
+
resources_modified: [],
|
|
12
|
+
next_action: null,
|
|
13
|
+
estimated_wait_seconds: null,
|
|
14
|
+
rollback_available: true,
|
|
15
|
+
};
|
|
16
|
+
const spinner = output === 'human' ? ora() : null;
|
|
17
|
+
const log = (msg) => output === 'human' && console.log(msg);
|
|
18
|
+
try {
|
|
19
|
+
const godaddy = new GoDaddyService();
|
|
20
|
+
const github = new GitHubService();
|
|
21
|
+
const githubUser = repo.split('/')[0];
|
|
22
|
+
log(chalk.blue('\n=== Deploying ===\n'));
|
|
23
|
+
spinner?.start('Verifying domain ownership...');
|
|
24
|
+
const domainExists = await godaddy.verifyDomain(domain);
|
|
25
|
+
if (!domainExists)
|
|
26
|
+
throw new Error(`Domain ${domain} not in GoDaddy account`);
|
|
27
|
+
spinner?.succeed('Domain verified');
|
|
28
|
+
result.completed_steps.push('verify_domain');
|
|
29
|
+
spinner?.start('Verifying repository access...');
|
|
30
|
+
const repoExists = await github.verifyRepo(repo);
|
|
31
|
+
if (!repoExists)
|
|
32
|
+
throw new Error(`Repository ${repo} not accessible`);
|
|
33
|
+
spinner?.succeed('Repository verified');
|
|
34
|
+
result.completed_steps.push('verify_repo');
|
|
35
|
+
spinner?.start('Configuring DNS A records...');
|
|
36
|
+
await godaddy.setGitHubPagesRecords(domain, githubUser);
|
|
37
|
+
spinner?.succeed('DNS records configured');
|
|
38
|
+
result.completed_steps.push('configure_dns');
|
|
39
|
+
result.resources_created.push(`A records for ${domain}`);
|
|
40
|
+
result.resources_created.push(`CNAME www.${domain}`);
|
|
41
|
+
spinner?.start('Adding CNAME file to repository...');
|
|
42
|
+
await github.addCnameFile(repo, domain);
|
|
43
|
+
spinner?.succeed('CNAME file added');
|
|
44
|
+
result.completed_steps.push('add_cname');
|
|
45
|
+
result.resources_created.push('CNAME file');
|
|
46
|
+
spinner?.start('Enabling GitHub Pages...');
|
|
47
|
+
await github.enablePages(repo);
|
|
48
|
+
spinner?.succeed('GitHub Pages enabled');
|
|
49
|
+
result.completed_steps.push('enable_pages');
|
|
50
|
+
result.resources_modified.push('GitHub Pages settings');
|
|
51
|
+
spinner?.start('Setting custom domain...');
|
|
52
|
+
await github.setCustomDomain(repo, domain);
|
|
53
|
+
spinner?.succeed('Custom domain set');
|
|
54
|
+
result.completed_steps.push('set_custom_domain');
|
|
55
|
+
log('');
|
|
56
|
+
log(chalk.green('=== Deployment Complete ==='));
|
|
57
|
+
log('');
|
|
58
|
+
log(`Site URL: ${chalk.cyan(`https://${domain}`)}`);
|
|
59
|
+
log('');
|
|
60
|
+
log(chalk.dim('DNS propagation may take 1-48 hours.'));
|
|
61
|
+
log(chalk.dim('HTTPS will be enabled automatically once DNS resolves.'));
|
|
62
|
+
log('');
|
|
63
|
+
log(chalk.dim(`Check status: gg-deploy status ${domain} ${repo}`));
|
|
64
|
+
result.next_action = 'wait_for_dns';
|
|
65
|
+
result.estimated_wait_seconds = 3600;
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
spinner?.fail('Deployment failed');
|
|
69
|
+
result.status = result.completed_steps.length > 0 ? 'partial_success' : 'failure';
|
|
70
|
+
result.failed_steps.push({
|
|
71
|
+
step: 'apply',
|
|
72
|
+
error: e instanceof Error ? e.message : String(e),
|
|
73
|
+
retriable: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (output === 'json') {
|
|
77
|
+
console.log(JSON.stringify(result, null, 2));
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,IAAY,EACZ,MAAoB;IAEpB,MAAM,MAAM,GAAkB;QAC5B,MAAM,EAAE,SAAS;QACjB,eAAe,EAAE,EAAE;QACnB,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,EAAE;QACrB,kBAAkB,EAAE,EAAE;QACtB,WAAW,EAAE,IAAI;QACjB,sBAAsB,EAAE,IAAI;QAC5B,kBAAkB,EAAE,IAAI;KACzB,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAClD,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,KAAK,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,C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 +1,105 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { GoDaddyService } from '../services/godaddy.js';
|
|
3
|
+
import { GitHubService } from '../services/github.js';
|
|
4
|
+
export async function planCommand(domain, repo, output) {
|
|
5
|
+
const result = {
|
|
6
|
+
status: 'success',
|
|
7
|
+
completed_steps: [],
|
|
8
|
+
failed_steps: [],
|
|
9
|
+
resources_created: [],
|
|
10
|
+
resources_modified: [],
|
|
11
|
+
next_action: null,
|
|
12
|
+
estimated_wait_seconds: null,
|
|
13
|
+
rollback_available: false,
|
|
14
|
+
};
|
|
15
|
+
const plan = {
|
|
16
|
+
domain,
|
|
17
|
+
repo,
|
|
18
|
+
dns_changes: [],
|
|
19
|
+
github_changes: [],
|
|
20
|
+
warnings: [],
|
|
21
|
+
};
|
|
22
|
+
try {
|
|
23
|
+
const godaddy = new GoDaddyService();
|
|
24
|
+
const github = new GitHubService();
|
|
25
|
+
if (output === 'human') {
|
|
26
|
+
console.log(chalk.blue('\n=== Deployment Plan ===\n'));
|
|
27
|
+
console.log(`Domain: ${chalk.cyan(domain)}`);
|
|
28
|
+
console.log(`Repo: ${chalk.cyan(repo)}\n`);
|
|
29
|
+
}
|
|
30
|
+
const domainExists = await godaddy.verifyDomain(domain);
|
|
31
|
+
if (!domainExists) {
|
|
32
|
+
result.status = 'failure';
|
|
33
|
+
result.failed_steps.push({
|
|
34
|
+
step: 'verify_domain',
|
|
35
|
+
error: `Domain ${domain} not found or not active in GoDaddy`,
|
|
36
|
+
retriable: false,
|
|
37
|
+
});
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
result.completed_steps.push('verify_domain');
|
|
41
|
+
const repoExists = await github.verifyRepo(repo);
|
|
42
|
+
if (!repoExists) {
|
|
43
|
+
result.status = 'failure';
|
|
44
|
+
result.failed_steps.push({
|
|
45
|
+
step: 'verify_repo',
|
|
46
|
+
error: `Repository ${repo} not found or no access`,
|
|
47
|
+
retriable: false,
|
|
48
|
+
});
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
result.completed_steps.push('verify_repo');
|
|
52
|
+
const isPublic = await github.isRepoPublic(repo);
|
|
53
|
+
if (!isPublic) {
|
|
54
|
+
plan.warnings.push('Repository is private. GitHub Pages requires public repos (or GitHub Pro).');
|
|
55
|
+
}
|
|
56
|
+
const githubUser = repo.split('/')[0];
|
|
57
|
+
plan.dns_changes = [
|
|
58
|
+
{ action: 'CREATE', record: { type: 'A', name: '@', data: '185.199.108.153', ttl: 600 } },
|
|
59
|
+
{ action: 'CREATE', record: { type: 'A', name: '@', data: '185.199.109.153', ttl: 600 } },
|
|
60
|
+
{ action: 'CREATE', record: { type: 'A', name: '@', data: '185.199.110.153', ttl: 600 } },
|
|
61
|
+
{ action: 'CREATE', record: { type: 'A', name: '@', data: '185.199.111.153', ttl: 600 } },
|
|
62
|
+
{ action: 'CREATE', record: { type: 'CNAME', name: 'www', data: `${githubUser}.github.io`, ttl: 600 } },
|
|
63
|
+
];
|
|
64
|
+
plan.github_changes = [
|
|
65
|
+
{ action: 'CREATE', resource: 'CNAME file', details: `Add CNAME with ${domain}` },
|
|
66
|
+
{ action: 'MODIFY', resource: 'GitHub Pages', details: 'Enable Pages with custom domain' },
|
|
67
|
+
];
|
|
68
|
+
if (output === 'human') {
|
|
69
|
+
console.log(chalk.yellow('DNS Changes:'));
|
|
70
|
+
for (const change of plan.dns_changes) {
|
|
71
|
+
const icon = change.action === 'CREATE' ? '+' : change.action === 'DELETE' ? '-' : '~';
|
|
72
|
+
console.log(` ${chalk.green(icon)} ${change.record.type} ${change.record.name} → ${change.record.data}`);
|
|
73
|
+
}
|
|
74
|
+
console.log();
|
|
75
|
+
console.log(chalk.yellow('GitHub Changes:'));
|
|
76
|
+
for (const change of plan.github_changes) {
|
|
77
|
+
const icon = change.action === 'CREATE' ? '+' : '~';
|
|
78
|
+
console.log(` ${chalk.green(icon)} ${change.resource}: ${change.details}`);
|
|
79
|
+
}
|
|
80
|
+
if (plan.warnings.length) {
|
|
81
|
+
console.log();
|
|
82
|
+
console.log(chalk.red('Warnings:'));
|
|
83
|
+
for (const w of plan.warnings)
|
|
84
|
+
console.log(` ! ${w}`);
|
|
85
|
+
}
|
|
86
|
+
console.log();
|
|
87
|
+
console.log(chalk.dim('Run with "apply" to execute this plan.'));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
console.log(JSON.stringify({ ...result, plan }, null, 2));
|
|
91
|
+
}
|
|
92
|
+
result.next_action = 'apply';
|
|
93
|
+
result.estimated_wait_seconds = 300;
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
result.status = 'failure';
|
|
97
|
+
result.failed_steps.push({
|
|
98
|
+
step: 'plan',
|
|
99
|
+
error: e instanceof Error ? e.message : String(e),
|
|
100
|
+
retriable: true,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,IAAY,EACZ,MAAoB;IAEpB,MAAM,MAAM,GAAkB;QAC5B,MAAM,EAAE,SAAS;QACjB,eAAe,EAAE,EAAE;QACnB,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,EAAE;QACrB,kBAAkB,EAAE,EAAE;QACtB,WAAW,EAAE,IAAI;QACjB,sBAAsB,EAAE,IAAI;QAC5B,kBAAkB,EAAE,KAAK;KAC1B,CAAC;IAEF,MAAM,IAAI,GAAe;QACvB,MAAM;QACN,IAAI;QACJ,WAAW,EAAE,EAAE;QACf,cAAc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