@l4yercak3/cli 1.0.6 → 1.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/bin/cli.js +6 -0
- package/docs/microsass_production_machine/CLI_API_REFERENCE.md +1197 -0
- package/docs/microsass_production_machine/CLI_PRODUCT_VISION.md +676 -0
- package/docs/microsass_production_machine/CLI_REQUIREMENTS.md +606 -0
- package/docs/microsass_production_machine/CONNECTED_APPLICATIONS_SPEC.md +390 -0
- package/docs/microsass_production_machine/IMPLEMENTATION_ROADMAP.md +725 -0
- package/docs/microsass_production_machine/OBJECT_MAPPINGS.md +808 -0
- package/docs/microsass_production_machine/REFERENCE_IMPLEMENTATION.md +532 -0
- package/package.json +1 -1
- package/src/api/backend-client.js +62 -0
- package/src/commands/spread.js +128 -11
- package/src/generators/api-client-generator.js +13 -6
- package/src/generators/env-generator.js +14 -1
- package/src/generators/index.js +4 -4
- package/src/generators/nextauth-generator.js +14 -9
- package/src/utils/file-utils.js +117 -0
- package/tests/api-client-generator.test.js +20 -13
- package/tests/backend-client.test.js +167 -0
- package/tests/file-utils.test.js +194 -0
- package/tests/generators-index.test.js +8 -0
- package/tests/nextauth-generator.test.js +38 -14
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
# L4YERCAK3 CLI - Implementation Roadmap
|
|
2
|
+
|
|
3
|
+
Detailed step-by-step implementation plan for CLI v2.0.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Current State
|
|
8
|
+
|
|
9
|
+
### Completed (CLI v1)
|
|
10
|
+
- [x] OAuth login flow with CSRF protection
|
|
11
|
+
- [x] Session management
|
|
12
|
+
- [x] API key generation/listing
|
|
13
|
+
- [x] Project detection (Next.js, GitHub)
|
|
14
|
+
- [x] Basic file generators (env, api-client, nextauth)
|
|
15
|
+
- [x] Upgrade flow for plan limits
|
|
16
|
+
|
|
17
|
+
### Ready in Backend
|
|
18
|
+
- [x] CLI session tables (cliSessions, cliLoginStates)
|
|
19
|
+
- [x] API key management with limits
|
|
20
|
+
- [x] Full REST API for most objects
|
|
21
|
+
- [x] Multi-tenant object system
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Phase 1: Foundation Enhancement
|
|
26
|
+
|
|
27
|
+
**Duration:** 2 weeks
|
|
28
|
+
**Goal:** Complete basic CLI with CRUD operations and backend registration
|
|
29
|
+
|
|
30
|
+
### Week 1: Backend Registration System
|
|
31
|
+
|
|
32
|
+
#### Task 1.1: Create cli_connected_apps Table
|
|
33
|
+
**File:** `convex/schemas/coreSchemas.ts`
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
cliConnectedApps: defineTable({
|
|
37
|
+
organizationId: v.id("organizations"),
|
|
38
|
+
name: v.string(),
|
|
39
|
+
projectPathHash: v.string(), // SHA256 of local path
|
|
40
|
+
framework: v.string(),
|
|
41
|
+
frameworkVersion: v.optional(v.string()),
|
|
42
|
+
apiKeyId: v.optional(v.id("apiKeys")),
|
|
43
|
+
modelMappings: v.array(v.object({
|
|
44
|
+
localModel: v.string(),
|
|
45
|
+
layerCakeType: v.string(),
|
|
46
|
+
syncDirection: v.union(
|
|
47
|
+
v.literal("bidirectional"),
|
|
48
|
+
v.literal("push"),
|
|
49
|
+
v.literal("pull")
|
|
50
|
+
),
|
|
51
|
+
fieldMappings: v.array(v.object({
|
|
52
|
+
localField: v.string(),
|
|
53
|
+
layerCakeField: v.string(),
|
|
54
|
+
transform: v.optional(v.string()),
|
|
55
|
+
})),
|
|
56
|
+
})),
|
|
57
|
+
features: v.array(v.string()),
|
|
58
|
+
productionDomain: v.optional(v.string()),
|
|
59
|
+
status: v.union(
|
|
60
|
+
v.literal("active"),
|
|
61
|
+
v.literal("paused"),
|
|
62
|
+
v.literal("disconnected")
|
|
63
|
+
),
|
|
64
|
+
lastSyncAt: v.optional(v.number()),
|
|
65
|
+
syncStats: v.optional(v.object({
|
|
66
|
+
totalSynced: v.number(),
|
|
67
|
+
lastSyncErrors: v.number(),
|
|
68
|
+
})),
|
|
69
|
+
createdAt: v.number(),
|
|
70
|
+
updatedAt: v.number(),
|
|
71
|
+
})
|
|
72
|
+
.index("by_organization", ["organizationId"])
|
|
73
|
+
.index("by_api_key", ["apiKeyId"])
|
|
74
|
+
.index("by_path_hash", ["projectPathHash", "organizationId"])
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
#### Task 1.2: Create Connected Apps API
|
|
78
|
+
**File:** `convex/api/v1/cliApps.ts`
|
|
79
|
+
|
|
80
|
+
Functions to implement:
|
|
81
|
+
- `registerConnectedApp` - Register new app
|
|
82
|
+
- `listConnectedApps` - List apps for org
|
|
83
|
+
- `getConnectedApp` - Get single app
|
|
84
|
+
- `updateConnectedApp` - Update app config
|
|
85
|
+
- `disconnectApp` - Remove app
|
|
86
|
+
|
|
87
|
+
#### Task 1.3: Create REST Routes
|
|
88
|
+
**Files:**
|
|
89
|
+
- `src/app/api/v1/cli/apps/route.ts` (list, create)
|
|
90
|
+
- `src/app/api/v1/cli/apps/[appId]/route.ts` (get, update, delete)
|
|
91
|
+
|
|
92
|
+
#### Task 1.4: Update CLI spread Command
|
|
93
|
+
**File:** `l4yercak3-cli/src/commands/spread.js`
|
|
94
|
+
|
|
95
|
+
Changes:
|
|
96
|
+
1. After successful setup, call `registerConnectedApp`
|
|
97
|
+
2. Generate project path hash
|
|
98
|
+
3. Store backend app ID in local config
|
|
99
|
+
4. Show registration confirmation
|
|
100
|
+
|
|
101
|
+
### Week 2: CRM Commands
|
|
102
|
+
|
|
103
|
+
#### Task 2.1: Implement contacts Command
|
|
104
|
+
**File:** `l4yercak3-cli/src/commands/crm/contacts.js`
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
// Commands to implement
|
|
108
|
+
l4yercak3 crm contacts list
|
|
109
|
+
l4yercak3 crm contacts create
|
|
110
|
+
l4yercak3 crm contacts get <id>
|
|
111
|
+
l4yercak3 crm contacts update <id>
|
|
112
|
+
l4yercak3 crm contacts delete <id>
|
|
113
|
+
l4yercak3 crm contacts import <file>
|
|
114
|
+
l4yercak3 crm contacts export
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### Task 2.2: Implement organizations Command
|
|
118
|
+
**File:** `l4yercak3-cli/src/commands/crm/orgs.js`
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
// Commands to implement
|
|
122
|
+
l4yercak3 crm orgs list
|
|
123
|
+
l4yercak3 crm orgs create
|
|
124
|
+
l4yercak3 crm orgs get <id>
|
|
125
|
+
l4yercak3 crm orgs update <id>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Task 2.3: Create Backend Routes (if missing)
|
|
129
|
+
**Files:**
|
|
130
|
+
- `src/app/api/v1/crm/contacts/route.ts`
|
|
131
|
+
- `src/app/api/v1/crm/contacts/[contactId]/route.ts`
|
|
132
|
+
- `src/app/api/v1/crm/organizations/route.ts`
|
|
133
|
+
|
|
134
|
+
#### Task 2.4: Add to Backend Client
|
|
135
|
+
**File:** `l4yercak3-cli/src/api/backend-client.js`
|
|
136
|
+
|
|
137
|
+
Add methods:
|
|
138
|
+
- `listContacts(orgId, options)`
|
|
139
|
+
- `createContact(orgId, data)`
|
|
140
|
+
- `getContact(contactId)`
|
|
141
|
+
- `updateContact(contactId, data)`
|
|
142
|
+
- `deleteContact(contactId)`
|
|
143
|
+
- Same for organizations
|
|
144
|
+
|
|
145
|
+
### Phase 1 Deliverables
|
|
146
|
+
- [ ] Connected apps appear in L4YERCAK3 dashboard
|
|
147
|
+
- [ ] CLI can CRUD contacts
|
|
148
|
+
- [ ] CLI can CRUD organizations
|
|
149
|
+
- [ ] Import/export contacts works
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Phase 2: Events & Commerce
|
|
154
|
+
|
|
155
|
+
**Duration:** 2 weeks
|
|
156
|
+
**Goal:** Full event lifecycle and payment processing
|
|
157
|
+
|
|
158
|
+
### Week 3: Events Commands
|
|
159
|
+
|
|
160
|
+
#### Task 3.1: Implement events Command
|
|
161
|
+
**File:** `l4yercak3-cli/src/commands/events.js`
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
// Commands to implement
|
|
165
|
+
l4yercak3 events list
|
|
166
|
+
l4yercak3 events create
|
|
167
|
+
l4yercak3 events get <id>
|
|
168
|
+
l4yercak3 events update <id>
|
|
169
|
+
l4yercak3 events publish <id>
|
|
170
|
+
l4yercak3 events delete <id>
|
|
171
|
+
l4yercak3 events stats <id>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### Task 3.2: Implement tickets Command
|
|
175
|
+
**File:** `l4yercak3-cli/src/commands/tickets.js`
|
|
176
|
+
|
|
177
|
+
```javascript
|
|
178
|
+
// Commands to implement
|
|
179
|
+
l4yercak3 tickets list --event <id>
|
|
180
|
+
l4yercak3 tickets get <id>
|
|
181
|
+
l4yercak3 tickets scan <qrCode>
|
|
182
|
+
l4yercak3 tickets export --event <id> --format csv
|
|
183
|
+
l4yercak3 tickets pdf <id>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### Task 3.3: Create Backend Routes
|
|
187
|
+
**Files:**
|
|
188
|
+
- `src/app/api/v1/events/route.ts`
|
|
189
|
+
- `src/app/api/v1/events/[eventId]/route.ts`
|
|
190
|
+
- `src/app/api/v1/tickets/route.ts`
|
|
191
|
+
- `src/app/api/v1/tickets/[ticketId]/route.ts`
|
|
192
|
+
- `src/app/api/v1/tickets/[ticketId]/redeem/route.ts`
|
|
193
|
+
- `src/app/api/v1/tickets/export/route.ts`
|
|
194
|
+
|
|
195
|
+
#### Task 3.4: Ticket QR Scanning
|
|
196
|
+
- Implement ticket lookup by QR code
|
|
197
|
+
- Mark as redeemed
|
|
198
|
+
- Return attendee info
|
|
199
|
+
|
|
200
|
+
### Week 4: Products & Checkout
|
|
201
|
+
|
|
202
|
+
#### Task 4.1: Implement products Command
|
|
203
|
+
**File:** `l4yercak3-cli/src/commands/products.js`
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
// Commands to implement
|
|
207
|
+
l4yercak3 products list
|
|
208
|
+
l4yercak3 products create
|
|
209
|
+
l4yercak3 products get <id>
|
|
210
|
+
l4yercak3 products update <id>
|
|
211
|
+
l4yercak3 products publish <id>
|
|
212
|
+
l4yercak3 products delete <id>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
#### Task 4.2: Implement checkout Command
|
|
216
|
+
**File:** `l4yercak3-cli/src/commands/checkout.js`
|
|
217
|
+
|
|
218
|
+
```javascript
|
|
219
|
+
// Commands to implement
|
|
220
|
+
l4yercak3 checkout create --product <id> --email <email>
|
|
221
|
+
l4yercak3 checkout verify <sessionId>
|
|
222
|
+
l4yercak3 checkout status <sessionId>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Task 4.3: Implement transactions Command
|
|
226
|
+
**File:** `l4yercak3-cli/src/commands/transactions.js`
|
|
227
|
+
|
|
228
|
+
```javascript
|
|
229
|
+
// Commands to implement
|
|
230
|
+
l4yercak3 transactions list
|
|
231
|
+
l4yercak3 transactions get <id>
|
|
232
|
+
l4yercak3 transactions export --format csv
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Phase 2 Deliverables
|
|
236
|
+
- [ ] Full event CRUD via CLI
|
|
237
|
+
- [ ] Ticket management including scan
|
|
238
|
+
- [ ] PDF ticket export
|
|
239
|
+
- [ ] Product management
|
|
240
|
+
- [ ] Checkout session creation
|
|
241
|
+
- [ ] Transaction listing
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Phase 3: Invoicing & Projects
|
|
246
|
+
|
|
247
|
+
**Duration:** 2 weeks
|
|
248
|
+
**Goal:** B2B operations support
|
|
249
|
+
|
|
250
|
+
### Week 5: Invoicing
|
|
251
|
+
|
|
252
|
+
#### Task 5.1: Implement invoices Command
|
|
253
|
+
**File:** `l4yercak3-cli/src/commands/invoices.js`
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
// Commands to implement
|
|
257
|
+
l4yercak3 invoices list
|
|
258
|
+
l4yercak3 invoices create
|
|
259
|
+
l4yercak3 invoices get <id>
|
|
260
|
+
l4yercak3 invoices update <id>
|
|
261
|
+
l4yercak3 invoices seal <id>
|
|
262
|
+
l4yercak3 invoices send <id>
|
|
263
|
+
l4yercak3 invoices mark-paid <id>
|
|
264
|
+
l4yercak3 invoices pdf <id>
|
|
265
|
+
l4yercak3 invoices consolidate
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
#### Task 5.2: Create Backend Routes (if missing)
|
|
269
|
+
- Verify all invoice endpoints exist
|
|
270
|
+
- Add PDF download endpoint
|
|
271
|
+
- Add mark-paid endpoint
|
|
272
|
+
|
|
273
|
+
#### Task 5.3: Invoice PDF Download
|
|
274
|
+
- Fetch PDF from backend
|
|
275
|
+
- Save to local file
|
|
276
|
+
- Option to open in browser
|
|
277
|
+
|
|
278
|
+
### Week 6: Projects & Forms
|
|
279
|
+
|
|
280
|
+
#### Task 6.1: Implement projects Command
|
|
281
|
+
**File:** `l4yercak3-cli/src/commands/projects.js`
|
|
282
|
+
|
|
283
|
+
```javascript
|
|
284
|
+
// Commands to implement
|
|
285
|
+
l4yercak3 projects list
|
|
286
|
+
l4yercak3 projects create
|
|
287
|
+
l4yercak3 projects get <id>
|
|
288
|
+
l4yercak3 projects update <id>
|
|
289
|
+
l4yercak3 projects tasks <id>
|
|
290
|
+
l4yercak3 projects add-task <id>
|
|
291
|
+
l4yercak3 projects complete-task <projectId> <taskId>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
#### Task 6.2: Implement forms Command
|
|
295
|
+
**File:** `l4yercak3-cli/src/commands/forms.js`
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
// Commands to implement
|
|
299
|
+
l4yercak3 forms list
|
|
300
|
+
l4yercak3 forms get <id>
|
|
301
|
+
l4yercak3 forms responses <id>
|
|
302
|
+
l4yercak3 forms export <id> --format csv
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Phase 3 Deliverables
|
|
306
|
+
- [ ] Full invoice workflow via CLI
|
|
307
|
+
- [ ] PDF download works
|
|
308
|
+
- [ ] Project management
|
|
309
|
+
- [ ] Task management
|
|
310
|
+
- [ ] Form response viewing/export
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Phase 4: Intelligence & Automation
|
|
315
|
+
|
|
316
|
+
**Duration:** 2 weeks
|
|
317
|
+
**Goal:** Smart features and automation
|
|
318
|
+
|
|
319
|
+
### Week 7: Model Detection
|
|
320
|
+
|
|
321
|
+
#### Task 7.1: Prisma Schema Detector
|
|
322
|
+
**File:** `l4yercak3-cli/src/detectors/prisma-detector.js`
|
|
323
|
+
|
|
324
|
+
Features:
|
|
325
|
+
- Parse `schema.prisma` file
|
|
326
|
+
- Extract model definitions
|
|
327
|
+
- Map fields to types
|
|
328
|
+
- Generate mapping suggestions
|
|
329
|
+
|
|
330
|
+
```javascript
|
|
331
|
+
// Prisma detection output
|
|
332
|
+
{
|
|
333
|
+
models: [
|
|
334
|
+
{
|
|
335
|
+
name: "User",
|
|
336
|
+
fields: [
|
|
337
|
+
{ name: "email", type: "String", required: true },
|
|
338
|
+
{ name: "name", type: "String", required: false },
|
|
339
|
+
{ name: "createdAt", type: "DateTime", required: true },
|
|
340
|
+
],
|
|
341
|
+
suggestedType: "contact",
|
|
342
|
+
confidence: 95,
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### Task 7.2: TypeScript Type Detector
|
|
349
|
+
**File:** `l4yercak3-cli/src/detectors/typescript-detector.js`
|
|
350
|
+
|
|
351
|
+
Features:
|
|
352
|
+
- Scan for interface/type definitions
|
|
353
|
+
- Parse field types
|
|
354
|
+
- Generate mapping suggestions
|
|
355
|
+
|
|
356
|
+
#### Task 7.3: Mapping Configuration Generator
|
|
357
|
+
**File:** `l4yercak3-cli/src/generators/mapping-generator.js`
|
|
358
|
+
|
|
359
|
+
Generate `.l4yercak3/mappings.yaml` file with detected mappings.
|
|
360
|
+
|
|
361
|
+
### Week 8: Workflows & AI
|
|
362
|
+
|
|
363
|
+
#### Task 8.1: Implement workflows Command
|
|
364
|
+
**File:** `l4yercak3-cli/src/commands/workflows.js`
|
|
365
|
+
|
|
366
|
+
```javascript
|
|
367
|
+
// Commands to implement
|
|
368
|
+
l4yercak3 workflows list
|
|
369
|
+
l4yercak3 workflows get <id>
|
|
370
|
+
l4yercak3 workflows run <id>
|
|
371
|
+
l4yercak3 workflows logs <id>
|
|
372
|
+
l4yercak3 workflows pause <id>
|
|
373
|
+
l4yercak3 workflows activate <id>
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
#### Task 8.2: Implement ai Command
|
|
377
|
+
**File:** `l4yercak3-cli/src/commands/ai.js`
|
|
378
|
+
|
|
379
|
+
```javascript
|
|
380
|
+
// Commands to implement
|
|
381
|
+
l4yercak3 ai "<prompt>" // One-shot command
|
|
382
|
+
l4yercak3 ai chat // Interactive mode
|
|
383
|
+
l4yercak3 ai tools // List available tools
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
#### Task 8.3: Implement webhooks Command
|
|
387
|
+
**File:** `l4yercak3-cli/src/commands/webhooks.js`
|
|
388
|
+
|
|
389
|
+
```javascript
|
|
390
|
+
// Commands to implement
|
|
391
|
+
l4yercak3 webhooks list
|
|
392
|
+
l4yercak3 webhooks create <url>
|
|
393
|
+
l4yercak3 webhooks delete <id>
|
|
394
|
+
l4yercak3 webhooks test <id>
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Phase 4 Deliverables
|
|
398
|
+
- [ ] Prisma schema detection works
|
|
399
|
+
- [ ] TypeScript type detection works
|
|
400
|
+
- [ ] Auto-generated mappings.yaml
|
|
401
|
+
- [ ] Workflow management via CLI
|
|
402
|
+
- [ ] Basic AI commands work
|
|
403
|
+
- [ ] Webhook configuration
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## Phase 5: Polish & Templates
|
|
408
|
+
|
|
409
|
+
**Duration:** 2 weeks
|
|
410
|
+
**Goal:** Production-ready with templates
|
|
411
|
+
|
|
412
|
+
### Week 9: Templates & Publishing
|
|
413
|
+
|
|
414
|
+
#### Task 9.1: Implement templates Command
|
|
415
|
+
**File:** `l4yercak3-cli/src/commands/templates.js`
|
|
416
|
+
|
|
417
|
+
```javascript
|
|
418
|
+
// Commands to implement
|
|
419
|
+
l4yercak3 templates list
|
|
420
|
+
l4yercak3 templates list --type email
|
|
421
|
+
l4yercak3 templates get <id>
|
|
422
|
+
l4yercak3 templates preview <id>
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
#### Task 9.2: Implement pages Command
|
|
426
|
+
**File:** `l4yercak3-cli/src/commands/pages.js`
|
|
427
|
+
|
|
428
|
+
```javascript
|
|
429
|
+
// Commands to implement
|
|
430
|
+
l4yercak3 pages list
|
|
431
|
+
l4yercak3 pages get <id>
|
|
432
|
+
l4yercak3 pages deploy <id>
|
|
433
|
+
l4yercak3 pages status <id>
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
#### Task 9.3: Implement sync Command
|
|
437
|
+
**File:** `l4yercak3-cli/src/commands/sync.js`
|
|
438
|
+
|
|
439
|
+
```javascript
|
|
440
|
+
// Commands to implement
|
|
441
|
+
l4yercak3 sync // Sync all mapped models
|
|
442
|
+
l4yercak3 sync contacts // Sync specific type
|
|
443
|
+
l4yercak3 sync --pull // Pull from L4YERCAK3
|
|
444
|
+
l4yercak3 sync --push // Push to L4YERCAK3
|
|
445
|
+
l4yercak3 sync --dry-run // Preview changes
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
### Week 10: Bulk Operations & Dev Tools
|
|
449
|
+
|
|
450
|
+
#### Task 10.1: Implement bulk Command
|
|
451
|
+
**File:** `l4yercak3-cli/src/commands/bulk.js`
|
|
452
|
+
|
|
453
|
+
```javascript
|
|
454
|
+
// Commands to implement
|
|
455
|
+
l4yercak3 bulk import <file> --type contacts
|
|
456
|
+
l4yercak3 bulk export contacts --format csv
|
|
457
|
+
l4yercak3 bulk update contacts --field status --value archived
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
#### Task 10.2: Implement dev Command
|
|
461
|
+
**File:** `l4yercak3-cli/src/commands/dev.js`
|
|
462
|
+
|
|
463
|
+
```javascript
|
|
464
|
+
// Commands to implement
|
|
465
|
+
l4yercak3 dev // Watch mode
|
|
466
|
+
l4yercak3 dev logs // Stream logs
|
|
467
|
+
l4yercak3 test api // Test connection
|
|
468
|
+
l4yercak3 test webhooks // Test webhooks
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
#### Task 10.3: Documentation
|
|
472
|
+
- Update README with all commands
|
|
473
|
+
- Add examples for each command
|
|
474
|
+
- Create troubleshooting guide
|
|
475
|
+
|
|
476
|
+
### Phase 5 Deliverables
|
|
477
|
+
- [ ] Template management
|
|
478
|
+
- [ ] Page deployment
|
|
479
|
+
- [ ] Data sync works
|
|
480
|
+
- [ ] Bulk import/export
|
|
481
|
+
- [ ] Dev mode with logs
|
|
482
|
+
- [ ] Complete documentation
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
## Technical Implementation Details
|
|
487
|
+
|
|
488
|
+
### CLI Command Structure
|
|
489
|
+
|
|
490
|
+
```
|
|
491
|
+
l4yercak3-cli/
|
|
492
|
+
├── bin/
|
|
493
|
+
│ └── l4yercak3.js # Entry point
|
|
494
|
+
├── src/
|
|
495
|
+
│ ├── commands/
|
|
496
|
+
│ │ ├── login.js
|
|
497
|
+
│ │ ├── logout.js
|
|
498
|
+
│ │ ├── status.js
|
|
499
|
+
│ │ ├── spread.js
|
|
500
|
+
│ │ ├── api-keys.js
|
|
501
|
+
│ │ ├── upgrade.js
|
|
502
|
+
│ │ ├── crm/
|
|
503
|
+
│ │ │ ├── contacts.js
|
|
504
|
+
│ │ │ └── orgs.js
|
|
505
|
+
│ │ ├── events.js
|
|
506
|
+
│ │ ├── tickets.js
|
|
507
|
+
│ │ ├── products.js
|
|
508
|
+
│ │ ├── checkout.js
|
|
509
|
+
│ │ ├── transactions.js
|
|
510
|
+
│ │ ├── invoices.js
|
|
511
|
+
│ │ ├── projects.js
|
|
512
|
+
│ │ ├── forms.js
|
|
513
|
+
│ │ ├── workflows.js
|
|
514
|
+
│ │ ├── webhooks.js
|
|
515
|
+
│ │ ├── templates.js
|
|
516
|
+
│ │ ├── pages.js
|
|
517
|
+
│ │ ├── sync.js
|
|
518
|
+
│ │ ├── bulk.js
|
|
519
|
+
│ │ ├── ai.js
|
|
520
|
+
│ │ └── dev.js
|
|
521
|
+
│ ├── detectors/
|
|
522
|
+
│ │ ├── index.js
|
|
523
|
+
│ │ ├── nextjs-detector.js
|
|
524
|
+
│ │ ├── prisma-detector.js # NEW
|
|
525
|
+
│ │ ├── typescript-detector.js # NEW
|
|
526
|
+
│ │ ├── github-detector.js
|
|
527
|
+
│ │ ├── oauth-detector.js
|
|
528
|
+
│ │ └── api-client-detector.js
|
|
529
|
+
│ ├── generators/
|
|
530
|
+
│ │ ├── index.js
|
|
531
|
+
│ │ ├── api-client-generator.js
|
|
532
|
+
│ │ ├── env-generator.js
|
|
533
|
+
│ │ ├── nextauth-generator.js
|
|
534
|
+
│ │ ├── mapping-generator.js # NEW
|
|
535
|
+
│ │ └── gitignore-generator.js
|
|
536
|
+
│ ├── api/
|
|
537
|
+
│ │ └── backend-client.js
|
|
538
|
+
│ ├── config/
|
|
539
|
+
│ │ └── config-manager.js
|
|
540
|
+
│ ├── utils/
|
|
541
|
+
│ │ ├── file-utils.js
|
|
542
|
+
│ │ ├── table-formatter.js # NEW - for CLI output
|
|
543
|
+
│ │ ├── csv-handler.js # NEW - import/export
|
|
544
|
+
│ │ └── progress-indicator.js # NEW - for long operations
|
|
545
|
+
│ └── logo.js
|
|
546
|
+
├── templates/
|
|
547
|
+
│ ├── api-client/
|
|
548
|
+
│ ├── nextauth/
|
|
549
|
+
│ └── mappings/
|
|
550
|
+
└── package.json
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
### Backend Client Extensions
|
|
554
|
+
|
|
555
|
+
```javascript
|
|
556
|
+
// Additional methods for BackendClient
|
|
557
|
+
|
|
558
|
+
// CRM
|
|
559
|
+
listContacts(orgId, { limit, offset, search })
|
|
560
|
+
createContact(orgId, data)
|
|
561
|
+
getContact(contactId)
|
|
562
|
+
updateContact(contactId, data)
|
|
563
|
+
deleteContact(contactId)
|
|
564
|
+
|
|
565
|
+
// Events
|
|
566
|
+
listEvents(orgId, { status })
|
|
567
|
+
createEvent(orgId, data)
|
|
568
|
+
getEvent(eventId)
|
|
569
|
+
updateEvent(eventId, data)
|
|
570
|
+
publishEvent(eventId)
|
|
571
|
+
|
|
572
|
+
// Tickets
|
|
573
|
+
listTickets(orgId, { eventId })
|
|
574
|
+
redeemTicket(ticketId)
|
|
575
|
+
getTicketPdf(ticketId)
|
|
576
|
+
exportTickets(eventId, format)
|
|
577
|
+
|
|
578
|
+
// Products
|
|
579
|
+
listProducts(orgId)
|
|
580
|
+
createProduct(orgId, data)
|
|
581
|
+
getProduct(productId)
|
|
582
|
+
updateProduct(productId, data)
|
|
583
|
+
|
|
584
|
+
// Checkout
|
|
585
|
+
createCheckoutSession(data)
|
|
586
|
+
verifyPayment(sessionId)
|
|
587
|
+
|
|
588
|
+
// Transactions
|
|
589
|
+
listTransactions(orgId, { status, startDate, endDate })
|
|
590
|
+
getTransaction(transactionId)
|
|
591
|
+
|
|
592
|
+
// Invoices
|
|
593
|
+
listInvoices(orgId, { status })
|
|
594
|
+
createInvoice(orgId, data)
|
|
595
|
+
getInvoice(invoiceId)
|
|
596
|
+
sealInvoice(invoiceId)
|
|
597
|
+
sendInvoice(invoiceId, recipientEmail)
|
|
598
|
+
markInvoicePaid(invoiceId, paymentData)
|
|
599
|
+
getInvoicePdf(invoiceId)
|
|
600
|
+
|
|
601
|
+
// Projects
|
|
602
|
+
listProjects(orgId)
|
|
603
|
+
createProject(orgId, data)
|
|
604
|
+
getProject(projectId)
|
|
605
|
+
addTask(projectId, taskData)
|
|
606
|
+
updateTask(projectId, taskId, data)
|
|
607
|
+
|
|
608
|
+
// Forms
|
|
609
|
+
listForms(orgId)
|
|
610
|
+
getFormResponses(formId)
|
|
611
|
+
exportFormResponses(formId, format)
|
|
612
|
+
|
|
613
|
+
// Workflows
|
|
614
|
+
listWorkflows(orgId)
|
|
615
|
+
runWorkflow(workflowId, context)
|
|
616
|
+
getWorkflowLogs(workflowId)
|
|
617
|
+
|
|
618
|
+
// Webhooks
|
|
619
|
+
listWebhooks(orgId)
|
|
620
|
+
createWebhook(orgId, data)
|
|
621
|
+
deleteWebhook(webhookId)
|
|
622
|
+
testWebhook(webhookId)
|
|
623
|
+
|
|
624
|
+
// Templates
|
|
625
|
+
listTemplates(orgId, { type })
|
|
626
|
+
getTemplate(templateId)
|
|
627
|
+
|
|
628
|
+
// Pages
|
|
629
|
+
listPages(orgId)
|
|
630
|
+
deployPage(pageId)
|
|
631
|
+
getDeploymentStatus(pageId)
|
|
632
|
+
|
|
633
|
+
// Sync
|
|
634
|
+
syncData(appId, direction, modelTypes)
|
|
635
|
+
|
|
636
|
+
// Bulk
|
|
637
|
+
bulkImport(orgId, type, data)
|
|
638
|
+
bulkExport(orgId, type, filters)
|
|
639
|
+
|
|
640
|
+
// AI
|
|
641
|
+
sendAiMessage(conversationId, message)
|
|
642
|
+
createAiConversation(orgId)
|
|
643
|
+
|
|
644
|
+
// Connected Apps
|
|
645
|
+
registerApp(orgId, data)
|
|
646
|
+
listApps(orgId)
|
|
647
|
+
updateApp(appId, data)
|
|
648
|
+
disconnectApp(appId)
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
---
|
|
652
|
+
|
|
653
|
+
## Testing Strategy
|
|
654
|
+
|
|
655
|
+
### Unit Tests
|
|
656
|
+
- Test each command handler
|
|
657
|
+
- Test detectors independently
|
|
658
|
+
- Test generators with mock data
|
|
659
|
+
|
|
660
|
+
### Integration Tests
|
|
661
|
+
- Test full CLI flows
|
|
662
|
+
- Mock backend responses
|
|
663
|
+
- Test error handling
|
|
664
|
+
|
|
665
|
+
### E2E Tests
|
|
666
|
+
- Test against staging backend
|
|
667
|
+
- Full workflow tests
|
|
668
|
+
- Performance benchmarks
|
|
669
|
+
|
|
670
|
+
---
|
|
671
|
+
|
|
672
|
+
## Release Plan
|
|
673
|
+
|
|
674
|
+
### v2.0.0-alpha.1 (After Phase 1)
|
|
675
|
+
- Backend registration
|
|
676
|
+
- CRM commands
|
|
677
|
+
|
|
678
|
+
### v2.0.0-alpha.2 (After Phase 2)
|
|
679
|
+
- Events & tickets
|
|
680
|
+
- Products & checkout
|
|
681
|
+
|
|
682
|
+
### v2.0.0-beta.1 (After Phase 3)
|
|
683
|
+
- Invoicing
|
|
684
|
+
- Projects
|
|
685
|
+
|
|
686
|
+
### v2.0.0-beta.2 (After Phase 4)
|
|
687
|
+
- Model detection
|
|
688
|
+
- AI commands
|
|
689
|
+
|
|
690
|
+
### v2.0.0 (After Phase 5)
|
|
691
|
+
- Full feature set
|
|
692
|
+
- Complete documentation
|
|
693
|
+
- Production ready
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
## Success Metrics by Phase
|
|
698
|
+
|
|
699
|
+
### Phase 1
|
|
700
|
+
- [ ] `spread` registers app in backend
|
|
701
|
+
- [ ] Contacts CRUD < 2s response
|
|
702
|
+
- [ ] Import 1000 contacts < 30s
|
|
703
|
+
|
|
704
|
+
### Phase 2
|
|
705
|
+
- [ ] Event creation works end-to-end
|
|
706
|
+
- [ ] Ticket scan < 500ms
|
|
707
|
+
- [ ] PDF generation < 5s
|
|
708
|
+
|
|
709
|
+
### Phase 3
|
|
710
|
+
- [ ] Invoice workflow complete via CLI
|
|
711
|
+
- [ ] Project task updates reflect immediately
|
|
712
|
+
|
|
713
|
+
### Phase 4
|
|
714
|
+
- [ ] Prisma detection > 90% accuracy
|
|
715
|
+
- [ ] AI responses < 10s
|
|
716
|
+
|
|
717
|
+
### Phase 5
|
|
718
|
+
- [ ] Bulk import 10k records < 2min
|
|
719
|
+
- [ ] Sync detects all changes
|
|
720
|
+
- [ ] Zero critical bugs
|
|
721
|
+
|
|
722
|
+
---
|
|
723
|
+
|
|
724
|
+
*Document Version: 1.0*
|
|
725
|
+
*Last Updated: January 2025*
|