@l4yercak3/cli 1.2.18 → 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.
@@ -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*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@l4yercak3/cli",
3
- "version": "1.2.18",
3
+ "version": "1.2.19",
4
4
  "description": "Icing on the L4yercak3 - The sweet finishing touch for your Layer Cake integration",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -232,6 +232,18 @@ async function handleLogin() {
232
232
  }
233
233
  }
234
234
 
235
+ /**
236
+ * Get friendly framework name for display
237
+ */
238
+ function getFrameworkDisplayName(frameworkType) {
239
+ const names = {
240
+ 'nextjs': 'Next.js',
241
+ 'expo': 'Expo',
242
+ 'react-native': 'React Native',
243
+ };
244
+ return names[frameworkType] || frameworkType;
245
+ }
246
+
235
247
  /**
236
248
  * Prompt user to run the setup wizard after login
237
249
  */
@@ -243,7 +255,7 @@ async function promptSetupWizard() {
243
255
  const isInProject = detection.framework.type !== null;
244
256
 
245
257
  if (isInProject) {
246
- const frameworkName = detection.framework.type === 'nextjs' ? 'Next.js' : detection.framework.type;
258
+ const frameworkName = getFrameworkDisplayName(detection.framework.type);
247
259
  console.log(chalk.cyan(` 🔍 Detected ${frameworkName} project in current directory\n`));
248
260
 
249
261
  // Check if project is already configured
@@ -280,6 +292,10 @@ async function promptSetupWizard() {
280
292
 
281
293
  if (!runWizard) {
282
294
  console.log('');
295
+ console.log(chalk.yellow(` ℹ️ To generate ${frameworkName}-specific code later, run:\n`));
296
+ console.log(chalk.cyan(' l4yercak3 spread\n'));
297
+ console.log(chalk.gray(' This will create components, hooks, and screens'));
298
+ console.log(chalk.gray(` optimized for ${frameworkName}.\n`));
283
299
  const action = await showPostLoginMenu({ isInProject: true, hasExistingConfig: false });
284
300
  await executeMenuAction(action);
285
301
  return;
@@ -294,14 +310,17 @@ async function promptSetupWizard() {
294
310
  } else {
295
311
  // Not in a project directory
296
312
  console.log(chalk.cyan(' 📋 What\'s Next?\n'));
297
- console.log(chalk.gray(' To integrate L4YERCAK3 with your Next.js project:'));
313
+ console.log(chalk.gray(' To integrate L4YERCAK3 with your project:\n'));
298
314
  console.log(chalk.gray(' 1. Navigate to your project directory'));
299
315
  console.log(chalk.gray(' 2. Run: l4yercak3 spread\n'));
300
- console.log(chalk.gray(' This will set up:'));
301
- console.log(chalk.gray(' • API client for backend communication'));
302
- console.log(chalk.gray(' • Environment variables'));
303
- console.log(chalk.gray(' OAuth authentication (optional)'));
304
- console.log(chalk.gray(' • CRM, Projects, and Invoices integration\n'));
316
+ console.log(chalk.gray(' Supported frameworks:'));
317
+ console.log(chalk.gray(' • Next.js (App Router & Pages Router)'));
318
+ console.log(chalk.gray(' • Expo / React Native\n'));
319
+ console.log(chalk.gray(' The spread command will:'));
320
+ console.log(chalk.gray(' • Detect your framework automatically'));
321
+ console.log(chalk.gray(' • Generate platform-specific components'));
322
+ console.log(chalk.gray(' • Set up API client & environment variables'));
323
+ console.log(chalk.gray(' • Configure OAuth authentication (optional)\n'));
305
324
  }
306
325
  }
307
326
 
@@ -5,6 +5,7 @@
5
5
 
6
6
  const fs = require('fs');
7
7
  const path = require('path');
8
+ const { execSync } = require('child_process');
8
9
  const configManager = require('../config/config-manager');
9
10
  const backendClient = require('../api/backend-client');
10
11
  const projectDetector = require('../detectors');
@@ -54,6 +55,124 @@ async function generateNewApiKey(organizationId) {
54
55
  return apiKey;
55
56
  }
56
57
 
58
+ /**
59
+ * Check if the project is a git repository
60
+ */
61
+ function isGitRepo(projectPath) {
62
+ try {
63
+ execSync('git rev-parse --is-inside-work-tree', {
64
+ cwd: projectPath,
65
+ stdio: 'pipe',
66
+ });
67
+ return true;
68
+ } catch {
69
+ return false;
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Get git status (uncommitted changes)
75
+ */
76
+ function getGitStatus(projectPath) {
77
+ try {
78
+ const status = execSync('git status --porcelain', {
79
+ cwd: projectPath,
80
+ encoding: 'utf8',
81
+ });
82
+ return status.trim();
83
+ } catch {
84
+ return '';
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Check for uncommitted changes and prompt user to commit first
90
+ * Returns true if we should proceed, false if user wants to abort
91
+ */
92
+ async function checkGitStatusBeforeGeneration(projectPath) {
93
+ // Skip if not a git repo
94
+ if (!isGitRepo(projectPath)) {
95
+ return true;
96
+ }
97
+
98
+ const status = getGitStatus(projectPath);
99
+
100
+ // No uncommitted changes - proceed
101
+ if (!status) {
102
+ return true;
103
+ }
104
+
105
+ // Count changes
106
+ const changes = status.split('\n').filter(line => line.trim());
107
+ const modifiedCount = changes.filter(line => line.startsWith(' M') || line.startsWith('M ')).length;
108
+ const untrackedCount = changes.filter(line => line.startsWith('??')).length;
109
+ const stagedCount = changes.filter(line => /^[MADRC]/.test(line)).length;
110
+
111
+ console.log(chalk.yellow(' ⚠️ Uncommitted changes detected\n'));
112
+
113
+ if (modifiedCount > 0) {
114
+ console.log(chalk.gray(` ${modifiedCount} modified file(s)`));
115
+ }
116
+ if (untrackedCount > 0) {
117
+ console.log(chalk.gray(` ${untrackedCount} untracked file(s)`));
118
+ }
119
+ if (stagedCount > 0) {
120
+ console.log(chalk.gray(` ${stagedCount} staged file(s)`));
121
+ }
122
+
123
+ console.log('');
124
+ console.log(chalk.gray(' We recommend committing your changes before generating'));
125
+ console.log(chalk.gray(' new files, so you can easily revert if needed.\n'));
126
+
127
+ const { action } = await inquirer.prompt([
128
+ {
129
+ type: 'list',
130
+ name: 'action',
131
+ message: 'How would you like to proceed?',
132
+ choices: [
133
+ {
134
+ name: 'Continue anyway - I\'ll handle it later',
135
+ value: 'continue',
136
+ },
137
+ {
138
+ name: 'Commit changes now - Create a checkpoint commit',
139
+ value: 'commit',
140
+ },
141
+ {
142
+ name: 'Abort - I\'ll commit manually first',
143
+ value: 'abort',
144
+ },
145
+ ],
146
+ },
147
+ ]);
148
+
149
+ if (action === 'abort') {
150
+ console.log(chalk.gray('\n No worries! Run "l4yercak3 spread" again after committing.\n'));
151
+ return false;
152
+ }
153
+
154
+ if (action === 'commit') {
155
+ try {
156
+ // Stage all changes
157
+ execSync('git add -A', { cwd: projectPath, stdio: 'pipe' });
158
+
159
+ // Create commit
160
+ const commitMessage = 'chore: checkpoint before L4YERCAK3 integration';
161
+ execSync(`git commit -m "${commitMessage}"`, { cwd: projectPath, stdio: 'pipe' });
162
+
163
+ console.log(chalk.green('\n ✅ Changes committed successfully'));
164
+ console.log(chalk.gray(` Message: "${commitMessage}"`));
165
+ console.log(chalk.gray(' You can revert with: git reset --soft HEAD~1\n'));
166
+ } catch (error) {
167
+ console.log(chalk.yellow('\n ⚠️ Could not create commit automatically'));
168
+ console.log(chalk.gray(` ${error.message}`));
169
+ console.log(chalk.gray(' Proceeding with file generation anyway...\n'));
170
+ }
171
+ }
172
+
173
+ return true;
174
+ }
175
+
57
176
  async function handleSpread() {
58
177
  // Check if logged in
59
178
  if (!configManager.isLoggedIn()) {
@@ -71,11 +190,17 @@ async function handleSpread() {
71
190
 
72
191
  // Display framework detection results
73
192
  if (detection.framework.type) {
74
- const frameworkName = detection.framework.type === 'nextjs' ? 'Next.js' : detection.framework.type;
193
+ const frameworkNames = {
194
+ 'nextjs': 'Next.js',
195
+ 'expo': 'Expo',
196
+ 'react-native': 'React Native',
197
+ };
198
+ const frameworkName = frameworkNames[detection.framework.type] || detection.framework.type;
75
199
  console.log(chalk.green(` ✅ Detected ${frameworkName} project`));
76
-
200
+
201
+ const meta = detection.framework.metadata || {};
202
+
77
203
  if (detection.framework.type === 'nextjs') {
78
- const meta = detection.framework.metadata;
79
204
  if (meta.version) {
80
205
  console.log(chalk.gray(` Version: ${meta.version}`));
81
206
  }
@@ -85,6 +210,21 @@ async function handleSpread() {
85
210
  if (meta.hasTypeScript) {
86
211
  console.log(chalk.gray(' TypeScript: Yes'));
87
212
  }
213
+ } else if (detection.framework.type === 'expo' || detection.framework.type === 'react-native') {
214
+ if (meta.expoVersion) {
215
+ console.log(chalk.gray(` Expo SDK: ${meta.expoVersion}`));
216
+ }
217
+ if (meta.reactNativeVersion) {
218
+ console.log(chalk.gray(` React Native: ${meta.reactNativeVersion}`));
219
+ }
220
+ if (meta.routerType) {
221
+ const routerName = meta.routerType === 'expo-router' ? 'Expo Router' :
222
+ meta.routerType === 'react-navigation' ? 'React Navigation' : 'Native';
223
+ console.log(chalk.gray(` Navigation: ${routerName}`));
224
+ }
225
+ if (meta.hasTypeScript) {
226
+ console.log(chalk.gray(' TypeScript: Yes'));
227
+ }
88
228
  }
89
229
 
90
230
  // Show supported features
@@ -534,7 +674,13 @@ async function handleSpread() {
534
674
  }
535
675
  }
536
676
 
537
- // Step 8: Generate files
677
+ // Step 8: Check for uncommitted changes before generating files
678
+ const shouldProceed = await checkGitStatusBeforeGeneration(detection.projectPath);
679
+ if (!shouldProceed) {
680
+ return;
681
+ }
682
+
683
+ // Step 9: Generate files
538
684
  console.log(chalk.cyan('\n 📝 Generating files...\n'));
539
685
 
540
686
  // Extract framework metadata for generation