@wraps.dev/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/README.md +322 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +5063 -0
- package/dist/cli.js.map +1 -0
- package/dist/console/assets/index-De4fp0hs.css +1 -0
- package/dist/console/assets/index-R43NIXvY.js +371 -0
- package/dist/console/index.html +20 -0
- package/dist/lambda/event-processor/__tests__/index.test.ts +932 -0
- package/dist/lambda/event-processor/index.ts +165 -0
- package/dist/lambda/event-processor/package.json +13 -0
- package/package.json +88 -0
package/README.md
ADDED
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Wraps CLI
|
|
2
|
+
|
|
3
|
+
> Deploy production-ready email infrastructure to your AWS account in 30 seconds.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Zero Configuration**: One command deploys everything you need
|
|
8
|
+
- **OIDC Support**: Vercel integration with no AWS credentials needed
|
|
9
|
+
- **Non-Destructive**: Never modifies existing resources
|
|
10
|
+
- **Beautiful UX**: Built with Bomb.sh stack (@clack/prompts) - beautiful interactive prompts and spinners
|
|
11
|
+
- **Lightweight**: Uses args (<1kB) for blazing-fast CLI parsing
|
|
12
|
+
- **Type-Safe**: Built with strict TypeScript
|
|
13
|
+
- **Tab Completion**: Shell completion support (coming soon)
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- **Node.js 20+**
|
|
18
|
+
- **AWS CLI** - Configured with valid credentials
|
|
19
|
+
```bash
|
|
20
|
+
aws configure
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Note:** Pulumi CLI will be automatically installed on first run if not already present. You can also pre-install it manually:
|
|
24
|
+
```bash
|
|
25
|
+
# macOS
|
|
26
|
+
brew install pulumi/tap/pulumi
|
|
27
|
+
|
|
28
|
+
# Linux
|
|
29
|
+
curl -fsSL https://get.pulumi.com | sh
|
|
30
|
+
|
|
31
|
+
# Windows
|
|
32
|
+
choco install pulumi
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g @wraps/cli
|
|
39
|
+
# or
|
|
40
|
+
pnpm add -g @wraps/cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
### 1. Deploy New Infrastructure
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
wraps init
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This will:
|
|
52
|
+
- ✅ Validate your AWS credentials
|
|
53
|
+
- ✅ Prompt for configuration (provider, region, domain)
|
|
54
|
+
- ✅ Deploy IAM roles, SES config, DynamoDB, Lambda, SNS
|
|
55
|
+
- ✅ Display next steps with role ARN and DNS records
|
|
56
|
+
|
|
57
|
+
### 2. Install the SDK
|
|
58
|
+
|
|
59
|
+
After deploying, install the TypeScript SDK to send emails:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install @wraps-js/email
|
|
63
|
+
# or
|
|
64
|
+
pnpm add @wraps-js/email
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Send your first email:**
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { Wraps } from '@wraps-js/email';
|
|
71
|
+
|
|
72
|
+
const wraps = new Wraps();
|
|
73
|
+
|
|
74
|
+
await wraps.emails.send({
|
|
75
|
+
from: 'hello@yourapp.com',
|
|
76
|
+
to: 'user@example.com',
|
|
77
|
+
subject: 'Welcome!',
|
|
78
|
+
html: '<h1>Hello from Wraps!</h1>',
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Learn more: [SDK Documentation](https://github.com/wraps-team/wraps-js) | [npm](https://www.npmjs.com/package/@wraps-js/email)
|
|
83
|
+
|
|
84
|
+
### 3. Check Status
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
wraps status
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Shows:
|
|
91
|
+
- Integration level (dashboard-only or enhanced)
|
|
92
|
+
- AWS region
|
|
93
|
+
- Verified domains
|
|
94
|
+
- Deployed resources
|
|
95
|
+
|
|
96
|
+
## Commands
|
|
97
|
+
|
|
98
|
+
### `wraps init`
|
|
99
|
+
|
|
100
|
+
Deploy new email infrastructure to your AWS account.
|
|
101
|
+
|
|
102
|
+
**Options:**
|
|
103
|
+
- `-p, --provider <provider>` - Hosting provider (vercel, aws, railway, other)
|
|
104
|
+
- `-r, --region <region>` - AWS region (default: us-east-1)
|
|
105
|
+
- `-d, --domain <domain>` - Domain to verify (optional)
|
|
106
|
+
|
|
107
|
+
**Examples:**
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Interactive mode (recommended)
|
|
111
|
+
wraps init
|
|
112
|
+
|
|
113
|
+
# With flags
|
|
114
|
+
wraps init --provider vercel --region us-east-1 --domain myapp.com
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### `wraps status`
|
|
118
|
+
|
|
119
|
+
Show current infrastructure status.
|
|
120
|
+
|
|
121
|
+
**Options:**
|
|
122
|
+
- `--account <account>` - AWS account ID or alias (optional)
|
|
123
|
+
|
|
124
|
+
**Example:**
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
wraps status
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### `wraps completion`
|
|
131
|
+
|
|
132
|
+
Generate shell completion script.
|
|
133
|
+
|
|
134
|
+
**Example:**
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
wraps completion
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This will display tab completion information for your shell.
|
|
141
|
+
|
|
142
|
+
## Configuration
|
|
143
|
+
|
|
144
|
+
### Vercel Integration (Recommended)
|
|
145
|
+
|
|
146
|
+
For Vercel projects, Wraps uses OIDC federation so you never need to store AWS credentials:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
wraps init --provider vercel
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
You'll be prompted for:
|
|
153
|
+
- Vercel team slug
|
|
154
|
+
- Vercel project name
|
|
155
|
+
|
|
156
|
+
### AWS Native
|
|
157
|
+
|
|
158
|
+
For Lambda, ECS, or EC2 deployments:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
wraps init --provider aws
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Uses IAM roles automatically.
|
|
165
|
+
|
|
166
|
+
### Other Providers
|
|
167
|
+
|
|
168
|
+
For Railway, Render, or other platforms:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
wraps init --provider other
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Note: Will require AWS access keys.
|
|
175
|
+
|
|
176
|
+
## Integration Levels
|
|
177
|
+
|
|
178
|
+
### Enhanced (Recommended)
|
|
179
|
+
|
|
180
|
+
Creates full email tracking infrastructure:
|
|
181
|
+
- ✅ IAM role with send permissions
|
|
182
|
+
- ✅ SES configuration set
|
|
183
|
+
- ✅ DynamoDB table for email history
|
|
184
|
+
- ✅ Lambda functions for event processing
|
|
185
|
+
- ✅ SNS topics for bounce/complaint handling
|
|
186
|
+
|
|
187
|
+
### Dashboard-Only
|
|
188
|
+
|
|
189
|
+
Read-only access for dashboard integration:
|
|
190
|
+
- ✅ IAM role with read-only permissions
|
|
191
|
+
- ❌ No sending capabilities
|
|
192
|
+
- ❌ No email history tracking
|
|
193
|
+
|
|
194
|
+
## Development
|
|
195
|
+
|
|
196
|
+
### Prerequisites
|
|
197
|
+
|
|
198
|
+
- Node.js 20+
|
|
199
|
+
- pnpm
|
|
200
|
+
- AWS CLI configured with valid credentials
|
|
201
|
+
|
|
202
|
+
### Local Development
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Install dependencies
|
|
206
|
+
pnpm install
|
|
207
|
+
|
|
208
|
+
# Build CLI
|
|
209
|
+
pnpm build
|
|
210
|
+
|
|
211
|
+
# Test locally
|
|
212
|
+
node dist/cli.js init
|
|
213
|
+
|
|
214
|
+
# Watch mode (for development)
|
|
215
|
+
pnpm dev
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Testing
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Run tests
|
|
222
|
+
pnpm test
|
|
223
|
+
|
|
224
|
+
# Watch mode
|
|
225
|
+
pnpm test:watch
|
|
226
|
+
|
|
227
|
+
# Type checking
|
|
228
|
+
pnpm typecheck
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Project Structure
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
packages/cli/
|
|
235
|
+
├── src/
|
|
236
|
+
│ ├── cli.ts # Entry point
|
|
237
|
+
│ ├── commands/ # CLI commands
|
|
238
|
+
│ │ ├── init.ts # Deploy new infrastructure
|
|
239
|
+
│ │ └── status.ts # Show current setup
|
|
240
|
+
│ ├── infrastructure/ # Pulumi stacks
|
|
241
|
+
│ │ ├── email-stack.ts # Main stack
|
|
242
|
+
│ │ ├── vercel-oidc.ts # Vercel OIDC setup
|
|
243
|
+
│ │ └── resources/ # Resource definitions
|
|
244
|
+
│ │ ├── iam.ts
|
|
245
|
+
│ │ ├── ses.ts
|
|
246
|
+
│ │ └── dynamodb.ts
|
|
247
|
+
│ ├── utils/ # Utilities
|
|
248
|
+
│ │ ├── aws.ts
|
|
249
|
+
│ │ ├── prompts.ts
|
|
250
|
+
│ │ ├── errors.ts
|
|
251
|
+
│ │ └── output.ts
|
|
252
|
+
│ └── types/
|
|
253
|
+
│ └── index.ts
|
|
254
|
+
└── dist/ # Build output
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Troubleshooting
|
|
258
|
+
|
|
259
|
+
### AWS Credentials Not Found
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Configure AWS CLI
|
|
263
|
+
aws configure
|
|
264
|
+
|
|
265
|
+
# Or set environment variables
|
|
266
|
+
export AWS_PROFILE=your-profile
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Invalid Region
|
|
270
|
+
|
|
271
|
+
Make sure you're using a valid AWS region:
|
|
272
|
+
- `us-east-1`, `us-east-2`, `us-west-1`, `us-west-2`
|
|
273
|
+
- `eu-west-1`, `eu-west-2`, `eu-central-1`
|
|
274
|
+
- `ap-southeast-1`, `ap-southeast-2`, `ap-northeast-1`
|
|
275
|
+
|
|
276
|
+
### Stack Already Exists
|
|
277
|
+
|
|
278
|
+
If you've already deployed infrastructure:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# Check status
|
|
282
|
+
wraps status
|
|
283
|
+
|
|
284
|
+
# To redeploy, destroy the existing stack first
|
|
285
|
+
# (coming in Phase 3)
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
## Roadmap
|
|
289
|
+
|
|
290
|
+
### Phase 1: MVP ✅
|
|
291
|
+
- [x] Basic CLI structure
|
|
292
|
+
- [x] AWS credential validation
|
|
293
|
+
- [x] Interactive prompts
|
|
294
|
+
- [x] Pulumi stack deployment
|
|
295
|
+
- [x] Success output formatting
|
|
296
|
+
|
|
297
|
+
### Phase 2: Core Deployment (Next)
|
|
298
|
+
- [ ] Lambda function bundling
|
|
299
|
+
- [ ] Enhanced error handling
|
|
300
|
+
- [ ] Vercel environment variable setup
|
|
301
|
+
- [ ] CloudWatch alarms
|
|
302
|
+
|
|
303
|
+
### Phase 3: Existing SES Support
|
|
304
|
+
- [ ] `wraps connect` command
|
|
305
|
+
- [ ] Resource detection
|
|
306
|
+
- [ ] Non-destructive deployment
|
|
307
|
+
|
|
308
|
+
### Phase 4: Polish
|
|
309
|
+
- [ ] `wraps verify` command (DNS verification)
|
|
310
|
+
- [ ] `wraps upgrade` command
|
|
311
|
+
- [ ] Comprehensive tests
|
|
312
|
+
- [ ] Publishing to npm
|
|
313
|
+
|
|
314
|
+
## License
|
|
315
|
+
|
|
316
|
+
MIT
|
|
317
|
+
|
|
318
|
+
## Support
|
|
319
|
+
|
|
320
|
+
- Documentation: https://docs.wraps.dev
|
|
321
|
+
- Issues: https://github.com/wraps-team/wraps/issues
|
|
322
|
+
- Dashboard: https://dashboard.wraps.dev
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|