@l4yercak3/cli 1.2.16 → 1.2.19

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.
Files changed (31) hide show
  1. package/.claude/settings.local.json +3 -1
  2. package/docs/CRM-PIPELINES-SEQUENCES-SPEC.md +429 -0
  3. package/docs/INTEGRATION_PATHS_ARCHITECTURE.md +1543 -0
  4. package/package.json +1 -1
  5. package/src/commands/login.js +26 -7
  6. package/src/commands/spread.js +251 -10
  7. package/src/detectors/database-detector.js +245 -0
  8. package/src/detectors/expo-detector.js +4 -4
  9. package/src/detectors/index.js +17 -4
  10. package/src/generators/api-only/client.js +683 -0
  11. package/src/generators/api-only/index.js +96 -0
  12. package/src/generators/api-only/types.js +618 -0
  13. package/src/generators/api-only/webhooks.js +377 -0
  14. package/src/generators/env-generator.js +23 -8
  15. package/src/generators/expo-auth-generator.js +1009 -0
  16. package/src/generators/index.js +88 -2
  17. package/src/generators/mcp-guide-generator.js +256 -0
  18. package/src/generators/quickstart/components/index.js +1699 -0
  19. package/src/generators/quickstart/components-mobile/index.js +1440 -0
  20. package/src/generators/quickstart/database/convex.js +1257 -0
  21. package/src/generators/quickstart/database/index.js +34 -0
  22. package/src/generators/quickstart/database/supabase.js +1132 -0
  23. package/src/generators/quickstart/hooks/index.js +1065 -0
  24. package/src/generators/quickstart/index.js +177 -0
  25. package/src/generators/quickstart/pages/index.js +1466 -0
  26. package/src/generators/quickstart/screens/index.js +1498 -0
  27. package/src/mcp/registry/domains/benefits.js +798 -0
  28. package/src/mcp/registry/index.js +2 -0
  29. package/tests/database-detector.test.js +221 -0
  30. package/tests/expo-detector.test.js +3 -4
  31. package/tests/generators-index.test.js +215 -3
@@ -21,7 +21,9 @@
21
21
  "Bash(npm run lint:fix:*)",
22
22
  "Bash(cat:*)",
23
23
  "Bash(node:*)",
24
- "Bash(node -c:*)"
24
+ "Bash(node -c:*)",
25
+ "Bash(grep:*)",
26
+ "Bash(git stash:*)"
25
27
  ]
26
28
  }
27
29
  }
@@ -0,0 +1,429 @@
1
+ # CRM Pipelines & Sequences Integration Spec
2
+
3
+ ## Executive Summary
4
+
5
+ **Current State:** The L4YERCAK3 CRM integration supports contacts, organizations, notes, and activities. However, **pipelines are mentioned in documentation but not implemented**, and **sequences do not exist at all**.
6
+
7
+ **Gap Analysis:**
8
+ - Pipelines referenced in [crm.js:5](src/mcp/registry/domains/crm.js#L5) and [core.js:30](src/mcp/registry/domains/core.js#L30) but no tools exist
9
+ - No sequence infrastructure anywhere in the codebase
10
+ - No API endpoints for pipelines or sequences
11
+ - No UI components, hooks, or pages for pipeline/sequence management
12
+
13
+ ---
14
+
15
+ ## Part 1: Backend API Requirements
16
+
17
+ ### 1.1 Pipeline Endpoints (Priority: HIGH)
18
+
19
+ The backend team needs to implement these endpoints:
20
+
21
+ | Method | Endpoint | Description |
22
+ |--------|----------|-------------|
23
+ | `GET` | `/api/v1/crm/pipelines` | List all pipelines for organization |
24
+ | `POST` | `/api/v1/crm/pipelines` | Create a new pipeline |
25
+ | `GET` | `/api/v1/crm/pipelines/{pipelineId}` | Get pipeline with stages |
26
+ | `PATCH` | `/api/v1/crm/pipelines/{pipelineId}` | Update pipeline |
27
+ | `DELETE` | `/api/v1/crm/pipelines/{pipelineId}` | Archive/delete pipeline |
28
+ | `GET` | `/api/v1/crm/pipelines/{pipelineId}/stages` | List stages in pipeline |
29
+ | `POST` | `/api/v1/crm/pipelines/{pipelineId}/stages` | Create stage |
30
+ | `PATCH` | `/api/v1/crm/pipelines/{pipelineId}/stages/{stageId}` | Update stage |
31
+ | `DELETE` | `/api/v1/crm/pipelines/{pipelineId}/stages/{stageId}` | Delete stage |
32
+ | `POST` | `/api/v1/crm/pipelines/{pipelineId}/stages/reorder` | Reorder stages |
33
+
34
+ #### Pipeline Data Model
35
+
36
+ **Note to Backend Team:** Use the existing ontology-based object system (like contacts/organizations use with `subtype` and `customProperties`). The fields below are conceptual - implement using the standard L4YERCAK3 object pattern.
37
+
38
+ **Pipeline object should support:**
39
+ - Name, description, type (sales/support/onboarding/custom)
40
+ - Linked stages (ordered)
41
+ - Default stage reference
42
+ - Active/archived status
43
+
44
+ **Stage object should support:**
45
+ - Name, description, order, color
46
+ - Probability (0-100 for sales forecasting)
47
+ - Rotten after days (stale deal threshold)
48
+ - Automation triggers (notify, assign, tag, webhook, sequence)
49
+
50
+ ### 1.2 Deal/Opportunity Endpoints (Priority: HIGH)
51
+
52
+ Deals link contacts to pipeline stages:
53
+
54
+ | Method | Endpoint | Description |
55
+ |--------|----------|-------------|
56
+ | `GET` | `/api/v1/crm/deals` | List deals (filterable by pipeline, stage, owner) |
57
+ | `POST` | `/api/v1/crm/deals` | Create deal |
58
+ | `GET` | `/api/v1/crm/deals/{dealId}` | Get deal details |
59
+ | `PATCH` | `/api/v1/crm/deals/{dealId}` | Update deal |
60
+ | `DELETE` | `/api/v1/crm/deals/{dealId}` | Archive deal |
61
+ | `POST` | `/api/v1/crm/deals/{dealId}/move` | Move deal to different stage |
62
+ | `GET` | `/api/v1/crm/deals/{dealId}/history` | Get stage movement history |
63
+
64
+ #### Deal Data Model
65
+
66
+ **Note to Backend Team:** Use the existing ontology-based object system. Deals are objects that link contacts to pipeline stages.
67
+
68
+ **Deal object should support:**
69
+ - Name, value, currency
70
+ - Pipeline reference, current stage reference
71
+ - Contact reference, organization reference (optional)
72
+ - Owner (assigned team member)
73
+ - Priority (low/medium/high)
74
+ - Expected close date
75
+ - Status (open/won/lost) with won/lost timestamps
76
+ - Lost reason (when applicable)
77
+ - Tags and custom fields via standard `customProperties`
78
+
79
+ **Deal Stage History** - Track stage movements:
80
+ - From/to stage references
81
+ - Who moved it, when
82
+ - Time spent in previous stage (for velocity metrics)
83
+
84
+ ### 1.3 Sequence Endpoints (Priority: MEDIUM - Future Feature)
85
+
86
+ Sequences automate outreach based on triggers:
87
+
88
+ | Method | Endpoint | Description |
89
+ |--------|----------|-------------|
90
+ | `GET` | `/api/v1/crm/sequences` | List sequences |
91
+ | `POST` | `/api/v1/crm/sequences` | Create sequence |
92
+ | `GET` | `/api/v1/crm/sequences/{sequenceId}` | Get sequence with steps |
93
+ | `PATCH` | `/api/v1/crm/sequences/{sequenceId}` | Update sequence |
94
+ | `DELETE` | `/api/v1/crm/sequences/{sequenceId}` | Archive sequence |
95
+ | `POST` | `/api/v1/crm/sequences/{sequenceId}/steps` | Add step to sequence |
96
+ | `PATCH` | `/api/v1/crm/sequences/{sequenceId}/steps/{stepId}` | Update step |
97
+ | `DELETE` | `/api/v1/crm/sequences/{sequenceId}/steps/{stepId}` | Remove step |
98
+ | `POST` | `/api/v1/crm/sequences/{sequenceId}/enroll` | Enroll contact(s) |
99
+ | `POST` | `/api/v1/crm/sequences/{sequenceId}/unenroll` | Remove contact(s) |
100
+ | `GET` | `/api/v1/crm/sequences/{sequenceId}/enrollments` | List enrolled contacts |
101
+ | `GET` | `/api/v1/crm/contacts/{contactId}/sequences` | Get contact's sequences |
102
+
103
+ #### Sequence Data Model
104
+
105
+ **Note to Backend Team:** Use the existing ontology-based object system. Sequences are automation workflows.
106
+
107
+ **Sequence object should support:**
108
+ - Name, description
109
+ - Trigger type (manual, stage_enter, tag_added, form_submit, api) with config
110
+ - Linked steps (ordered)
111
+ - Exit conditions
112
+ - Enrollment limit, timezone, sending schedule
113
+ - Status (draft/active/paused/archived)
114
+ - Stats (enrolled, completed, replied, bounced counts)
115
+
116
+ **Sequence Step object should support:**
117
+ - Order, type (email, sms, wait, task, webhook, condition)
118
+ - Delay (days/hours)
119
+ - Type-specific config (email subject/body with template vars, etc.)
120
+
121
+ **Sequence Enrollment object should support:**
122
+ - Contact reference, sequence reference
123
+ - Current step index
124
+ - Status (active/completed/exited/paused)
125
+ - Enrolled by, enrolled at, completed at
126
+ - Exit reason (if applicable)
127
+ - Step results history
128
+
129
+ ### 1.4 Permissions Required
130
+
131
+ Add these to the existing permission system:
132
+
133
+ ```typescript
134
+ // Pipeline permissions
135
+ 'pipelines:read' // View pipelines and stages
136
+ 'pipelines:write' // Create/edit pipelines
137
+ 'pipelines:delete' // Archive/delete pipelines
138
+
139
+ // Deal permissions
140
+ 'deals:read' // View deals
141
+ 'deals:write' // Create/edit deals
142
+ 'deals:delete' // Archive deals
143
+ 'deals:move' // Move deals between stages
144
+
145
+ // Sequence permissions (future)
146
+ 'sequences:read' // View sequences
147
+ 'sequences:write' // Create/edit sequences
148
+ 'sequences:delete' // Archive sequences
149
+ 'sequences:enroll' // Enroll/unenroll contacts
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Part 2: CLI Implementation Requirements
155
+
156
+ ### 2.1 MCP Tool Additions
157
+
158
+ **File:** [src/mcp/registry/domains/crm.js](src/mcp/registry/domains/crm.js)
159
+
160
+ Add these MCP tools after the existing contact/organization tools:
161
+
162
+ #### Pipeline Tools
163
+
164
+ ```javascript
165
+ // List pipelines
166
+ {
167
+ name: 'l4yercak3_crm_list_pipelines',
168
+ description: 'List CRM pipelines with their stages',
169
+ handler: async (args, context) => {
170
+ return context.apiClient.request('GET', '/api/v1/crm/pipelines', {
171
+ params: { type: args.type, status: args.status || 'active' }
172
+ });
173
+ },
174
+ parameters: {
175
+ type: { type: 'string', enum: ['sales', 'support', 'onboarding', 'custom'] },
176
+ status: { type: 'string', enum: ['active', 'archived'], default: 'active' }
177
+ },
178
+ requiresAuth: true,
179
+ permissions: ['pipelines:read']
180
+ }
181
+
182
+ // Create pipeline
183
+ {
184
+ name: 'l4yercak3_crm_create_pipeline',
185
+ description: 'Create a new CRM pipeline with stages',
186
+ handler: async (args, context) => { /* ... */ },
187
+ parameters: {
188
+ name: { type: 'string', required: true },
189
+ type: { type: 'string', enum: ['sales', 'support', 'onboarding', 'custom'], required: true },
190
+ stages: { type: 'array', items: { type: 'object' }, description: 'Initial stages' }
191
+ },
192
+ requiresAuth: true,
193
+ permissions: ['pipelines:write']
194
+ }
195
+
196
+ // Get pipeline
197
+ // Update pipeline
198
+ // Delete pipeline
199
+ // Add stage
200
+ // Update stage
201
+ // Reorder stages
202
+ ```
203
+
204
+ #### Deal Tools
205
+
206
+ ```javascript
207
+ // List deals
208
+ {
209
+ name: 'l4yercak3_crm_list_deals',
210
+ description: 'List deals with filtering by pipeline, stage, status',
211
+ parameters: {
212
+ pipelineId: { type: 'string' },
213
+ stageId: { type: 'string' },
214
+ status: { type: 'string', enum: ['open', 'won', 'lost'] },
215
+ ownerId: { type: 'string' },
216
+ contactId: { type: 'string' }
217
+ }
218
+ }
219
+
220
+ // Create deal
221
+ // Get deal
222
+ // Update deal
223
+ // Move deal (change stage)
224
+ // Get deal history
225
+ ```
226
+
227
+ #### Sequence Tools (Future)
228
+
229
+ ```javascript
230
+ // List sequences
231
+ // Create sequence
232
+ // Get sequence
233
+ // Update sequence
234
+ // Add step
235
+ // Enroll contact
236
+ // Unenroll contact
237
+ // Get enrollments
238
+ ```
239
+
240
+ ### 2.2 Quickstart Generator Updates
241
+
242
+ **Files to modify:**
243
+
244
+ 1. **[src/generators/quickstart/hooks/index.js](src/generators/quickstart/hooks/index.js)**
245
+ - Add `usePipelines()` hook
246
+ - Add `useDeals()` hook
247
+ - Add `usePipelineBoard()` hook for Kanban view
248
+ - Future: Add `useSequences()` hook
249
+
250
+ 2. **[src/generators/quickstart/components/index.js](src/generators/quickstart/components/index.js)**
251
+ - Add `PipelineBoard` - Kanban-style deal board
252
+ - Add `PipelineSelector` - Dropdown to switch pipelines
253
+ - Add `DealCard` - Individual deal display
254
+ - Add `DealForm` - Create/edit deal modal
255
+ - Add `StageColumn` - Column in Kanban board
256
+
257
+ 3. **[src/generators/quickstart/pages/index.js](src/generators/quickstart/pages/index.js)**
258
+ - Add `/crm/pipelines` - Pipeline management
259
+ - Add `/crm/deals` - Deal board (Kanban view)
260
+ - Add `/crm/deals/[id]` - Deal detail page
261
+
262
+ ### 2.3 Feature Detection Update
263
+
264
+ **File:** [src/commands/spread.js](src/commands/spread.js)
265
+
266
+ Update feature selection to clarify CRM includes pipelines:
267
+
268
+ ```javascript
269
+ {
270
+ name: 'CRM (contacts, organizations, pipelines)',
271
+ value: 'crm',
272
+ checked: true
273
+ }
274
+ ```
275
+
276
+ ### 2.4 Environment Variables
277
+
278
+ No additional env vars needed - pipelines use same auth as other CRM features.
279
+
280
+ ---
281
+
282
+ ## Part 3: Implementation Checklist
283
+
284
+ ### Backend Team
285
+
286
+ - [ ] Create `pipelines` table/collection in Convex
287
+ - [ ] Create `stages` table/collection
288
+ - [ ] Create `deals` table/collection
289
+ - [ ] Create `dealStageHistory` table/collection
290
+ - [ ] Implement pipeline CRUD endpoints
291
+ - [ ] Implement stage management endpoints
292
+ - [ ] Implement deal CRUD endpoints
293
+ - [ ] Implement deal stage movement with history tracking
294
+ - [ ] Add pipeline/deal permissions to auth system
295
+ - [ ] Write API documentation for new endpoints
296
+ - [ ] **Future:** Create `sequences` table
297
+ - [ ] **Future:** Create `sequenceSteps` table
298
+ - [ ] **Future:** Create `sequenceEnrollments` table
299
+ - [ ] **Future:** Implement sequence execution engine
300
+ - [ ] **Future:** Implement sequence API endpoints
301
+
302
+ ### CLI Team
303
+
304
+ - [ ] Add pipeline MCP tools to [crm.js](src/mcp/registry/domains/crm.js)
305
+ - [ ] Add deal MCP tools to [crm.js](src/mcp/registry/domains/crm.js)
306
+ - [ ] Create `usePipelines()` hook generator
307
+ - [ ] Create `useDeals()` hook generator
308
+ - [ ] Create `PipelineBoard` component generator
309
+ - [ ] Create `DealCard` component generator
310
+ - [ ] Create `DealForm` component generator
311
+ - [ ] Create pipeline pages generator
312
+ - [ ] Update feature description in spread command
313
+ - [ ] Write tests for new MCP tools
314
+ - [ ] Update CLAUDE.md with pipeline commands
315
+ - [ ] **Future:** Add sequence MCP tools
316
+ - [ ] **Future:** Create sequence hooks/components
317
+
318
+ ---
319
+
320
+ ## Part 4: API Examples
321
+
322
+ ### Create a Sales Pipeline
323
+
324
+ ```bash
325
+ # Request
326
+ POST /api/v1/crm/pipelines
327
+ {
328
+ "name": "Enterprise Sales",
329
+ "type": "sales",
330
+ "stages": [
331
+ { "name": "Lead", "order": 0, "probability": 10 },
332
+ { "name": "Qualified", "order": 1, "probability": 25 },
333
+ { "name": "Demo", "order": 2, "probability": 50 },
334
+ { "name": "Proposal", "order": 3, "probability": 75 },
335
+ { "name": "Negotiation", "order": 4, "probability": 90 },
336
+ { "name": "Closed Won", "order": 5, "probability": 100 },
337
+ { "name": "Closed Lost", "order": 6, "probability": 0 }
338
+ ]
339
+ }
340
+
341
+ # Response
342
+ {
343
+ "_id": "pipeline_abc123",
344
+ "name": "Enterprise Sales",
345
+ "type": "sales",
346
+ "stages": [...],
347
+ "isDefault": true,
348
+ "status": "active",
349
+ "createdAt": 1736700000000
350
+ }
351
+ ```
352
+
353
+ ### Create a Deal
354
+
355
+ ```bash
356
+ # Request
357
+ POST /api/v1/crm/deals
358
+ {
359
+ "pipelineId": "pipeline_abc123",
360
+ "stageId": "stage_lead",
361
+ "contactId": "contact_xyz789",
362
+ "name": "Acme Corp - Enterprise License",
363
+ "value": 50000,
364
+ "currency": "USD",
365
+ "expectedCloseDate": 1739000000000,
366
+ "priority": "high"
367
+ }
368
+ ```
369
+
370
+ ### Move Deal to Next Stage
371
+
372
+ ```bash
373
+ # Request
374
+ POST /api/v1/crm/deals/deal_123/move
375
+ {
376
+ "stageId": "stage_qualified",
377
+ "note": "Initial call completed, they're interested"
378
+ }
379
+
380
+ # Response includes updated deal + history entry
381
+ ```
382
+
383
+ ### Enroll Contact in Sequence (Future)
384
+
385
+ ```bash
386
+ # Request
387
+ POST /api/v1/crm/sequences/seq_456/enroll
388
+ {
389
+ "contactIds": ["contact_xyz789", "contact_abc123"],
390
+ "skipWeekends": true
391
+ }
392
+ ```
393
+
394
+ ---
395
+
396
+ ## Part 5: Timeline Recommendation
397
+
398
+ ### Phase 1: Pipelines Foundation
399
+ - Backend: Pipeline & Stage CRUD
400
+ - Backend: Basic deal management
401
+ - CLI: Pipeline MCP tools
402
+
403
+ ### Phase 2: Pipelines UI
404
+ - CLI: Deal MCP tools
405
+ - CLI: Hooks & components
406
+ - CLI: Pages generator
407
+
408
+ ### Phase 3: Sequences (Future)
409
+ - Backend: Sequence data model
410
+ - Backend: Enrollment logic
411
+ - Backend: Execution engine
412
+ - CLI: Sequence MCP tools
413
+ - CLI: Sequence UI components
414
+
415
+ ---
416
+
417
+ ## Questions for Backend Team
418
+
419
+ 1. **Default Pipeline:** Should new organizations get a default sales pipeline automatically?
420
+ 2. **Stage Limits:** Should we limit the number of stages per pipeline?
421
+ 3. **Deal Limits:** Any limits on deals per pipeline or organization?
422
+ 4. **Webhooks:** Should stage transitions trigger webhooks?
423
+ 5. **Sequence Execution:** Will sequences run on Convex scheduled functions or separate workers?
424
+ 6. **Email Provider:** What email service will sequences use (SendGrid, Resend, etc.)?
425
+
426
+ ---
427
+
428
+ *Generated: January 2026*
429
+ *CLI Version: 1.2.18*