@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.
- package/.claude/settings.local.json +3 -1
- package/docs/CRM-PIPELINES-SEQUENCES-SPEC.md +429 -0
- package/docs/INTEGRATION_PATHS_ARCHITECTURE.md +1543 -0
- package/package.json +1 -1
- package/src/commands/login.js +26 -7
- package/src/commands/spread.js +251 -10
- package/src/detectors/database-detector.js +245 -0
- package/src/detectors/expo-detector.js +4 -4
- package/src/detectors/index.js +17 -4
- package/src/generators/api-only/client.js +683 -0
- package/src/generators/api-only/index.js +96 -0
- package/src/generators/api-only/types.js +618 -0
- package/src/generators/api-only/webhooks.js +377 -0
- package/src/generators/env-generator.js +23 -8
- package/src/generators/expo-auth-generator.js +1009 -0
- package/src/generators/index.js +88 -2
- package/src/generators/mcp-guide-generator.js +256 -0
- package/src/generators/quickstart/components/index.js +1699 -0
- package/src/generators/quickstart/components-mobile/index.js +1440 -0
- package/src/generators/quickstart/database/convex.js +1257 -0
- package/src/generators/quickstart/database/index.js +34 -0
- package/src/generators/quickstart/database/supabase.js +1132 -0
- package/src/generators/quickstart/hooks/index.js +1065 -0
- package/src/generators/quickstart/index.js +177 -0
- package/src/generators/quickstart/pages/index.js +1466 -0
- package/src/generators/quickstart/screens/index.js +1498 -0
- package/src/mcp/registry/domains/benefits.js +798 -0
- package/src/mcp/registry/index.js +2 -0
- package/tests/database-detector.test.js +221 -0
- package/tests/expo-detector.test.js +3 -4
- package/tests/generators-index.test.js +215 -3
package/src/generators/index.js
CHANGED
|
@@ -5,6 +5,11 @@
|
|
|
5
5
|
* Supports multiple frameworks:
|
|
6
6
|
* - nextjs: Next.js (App Router and Pages Router)
|
|
7
7
|
* - expo: Expo/React Native
|
|
8
|
+
*
|
|
9
|
+
* Supports multiple integration paths:
|
|
10
|
+
* - quickstart: Full-stack with UI components & database
|
|
11
|
+
* - api-only: Just the typed API client
|
|
12
|
+
* - mcp-assisted: AI-powered custom generation
|
|
8
13
|
*/
|
|
9
14
|
|
|
10
15
|
const apiClientGenerator = require('./api-client-generator');
|
|
@@ -12,6 +17,9 @@ const envGenerator = require('./env-generator');
|
|
|
12
17
|
const nextauthGenerator = require('./nextauth-generator');
|
|
13
18
|
const oauthGuideGenerator = require('./oauth-guide-generator');
|
|
14
19
|
const gitignoreGenerator = require('./gitignore-generator');
|
|
20
|
+
const apiOnlyGenerator = require('./api-only');
|
|
21
|
+
const mcpGuideGenerator = require('./mcp-guide-generator');
|
|
22
|
+
const quickstartGenerator = require('./quickstart');
|
|
15
23
|
|
|
16
24
|
class FileGenerator {
|
|
17
25
|
/**
|
|
@@ -32,6 +40,86 @@ class FileGenerator {
|
|
|
32
40
|
* Generate all files based on configuration
|
|
33
41
|
*/
|
|
34
42
|
async generate(options) {
|
|
43
|
+
const integrationPath = options.integrationPath || 'api-only';
|
|
44
|
+
|
|
45
|
+
// Route to the appropriate generator based on integration path
|
|
46
|
+
switch (integrationPath) {
|
|
47
|
+
case 'api-only':
|
|
48
|
+
return this.generateApiOnly(options);
|
|
49
|
+
case 'mcp-assisted':
|
|
50
|
+
return this.generateMcpAssisted(options);
|
|
51
|
+
case 'quickstart':
|
|
52
|
+
return this.generateQuickStart(options);
|
|
53
|
+
default:
|
|
54
|
+
return this.generateLegacy(options);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* API-Only path: Generate typed API client and types
|
|
60
|
+
*/
|
|
61
|
+
async generateApiOnly(options) {
|
|
62
|
+
const results = {
|
|
63
|
+
apiClient: null,
|
|
64
|
+
types: null,
|
|
65
|
+
webhooks: null,
|
|
66
|
+
index: null,
|
|
67
|
+
envFile: null,
|
|
68
|
+
gitignore: null,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Generate the full typed API client package
|
|
72
|
+
const apiOnlyResults = await apiOnlyGenerator.generate(options);
|
|
73
|
+
results.apiClient = apiOnlyResults.client;
|
|
74
|
+
results.types = apiOnlyResults.types;
|
|
75
|
+
results.webhooks = apiOnlyResults.webhooks;
|
|
76
|
+
results.index = apiOnlyResults.index;
|
|
77
|
+
|
|
78
|
+
// Generate environment file
|
|
79
|
+
results.envFile = envGenerator.generate(options);
|
|
80
|
+
|
|
81
|
+
// Update .gitignore
|
|
82
|
+
results.gitignore = gitignoreGenerator.generate(options);
|
|
83
|
+
|
|
84
|
+
return results;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* MCP-Assisted path: Generate MCP config and guide
|
|
89
|
+
*/
|
|
90
|
+
async generateMcpAssisted(options) {
|
|
91
|
+
const results = {
|
|
92
|
+
mcpConfig: null,
|
|
93
|
+
mcpGuide: null,
|
|
94
|
+
envFile: null,
|
|
95
|
+
gitignore: null,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Generate MCP configuration and guide
|
|
99
|
+
const mcpResults = await mcpGuideGenerator.generate(options);
|
|
100
|
+
results.mcpConfig = mcpResults.config;
|
|
101
|
+
results.mcpGuide = mcpResults.guide;
|
|
102
|
+
|
|
103
|
+
// Generate environment file
|
|
104
|
+
results.envFile = envGenerator.generate(options);
|
|
105
|
+
|
|
106
|
+
// Update .gitignore
|
|
107
|
+
results.gitignore = gitignoreGenerator.generate(options);
|
|
108
|
+
|
|
109
|
+
return results;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Quick Start path: Full-stack generation with database, hooks, and components
|
|
114
|
+
*/
|
|
115
|
+
async generateQuickStart(options) {
|
|
116
|
+
return quickstartGenerator.generate(options);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Legacy generation (backward compatibility)
|
|
121
|
+
*/
|
|
122
|
+
async generateLegacy(options) {
|
|
35
123
|
const results = {
|
|
36
124
|
apiClient: null,
|
|
37
125
|
envFile: null,
|
|
@@ -57,12 +145,10 @@ class FileGenerator {
|
|
|
57
145
|
if (isNextJs) {
|
|
58
146
|
results.nextauth = await nextauthGenerator.generate(options);
|
|
59
147
|
}
|
|
60
|
-
// For mobile, OAuth is handled differently (expo-auth-session, etc.)
|
|
61
148
|
}
|
|
62
149
|
|
|
63
150
|
// Generate OAuth guide if OAuth is enabled
|
|
64
151
|
if (options.features && options.features.includes('oauth') && options.oauthProviders) {
|
|
65
|
-
// Pass framework info so guide can be customized
|
|
66
152
|
results.oauthGuide = oauthGuideGenerator.generate({
|
|
67
153
|
...options,
|
|
68
154
|
isMobile,
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Guide Generator
|
|
3
|
+
* Generates MCP configuration and guide for AI-powered development
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { ensureDir, writeFileWithBackup, checkFileOverwrite } = require('../utils/file-utils');
|
|
9
|
+
|
|
10
|
+
class McpGuideGenerator {
|
|
11
|
+
/**
|
|
12
|
+
* Generate MCP configuration and guide files
|
|
13
|
+
* @param {Object} options - Generation options
|
|
14
|
+
* @returns {Promise<Object>} - Generated file paths
|
|
15
|
+
*/
|
|
16
|
+
async generate(options) {
|
|
17
|
+
const results = {
|
|
18
|
+
config: null,
|
|
19
|
+
guide: null,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
results.config = await this.generateConfig(options);
|
|
23
|
+
results.guide = await this.generateGuide(options);
|
|
24
|
+
|
|
25
|
+
return results;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generate .claude/mcp.json configuration
|
|
30
|
+
*/
|
|
31
|
+
async generateConfig(options) {
|
|
32
|
+
const { projectPath } = options;
|
|
33
|
+
|
|
34
|
+
const claudeDir = path.join(projectPath, '.claude');
|
|
35
|
+
ensureDir(claudeDir);
|
|
36
|
+
|
|
37
|
+
const outputPath = path.join(claudeDir, 'mcp.json');
|
|
38
|
+
|
|
39
|
+
// Check if file exists
|
|
40
|
+
let existingConfig = {};
|
|
41
|
+
if (fs.existsSync(outputPath)) {
|
|
42
|
+
try {
|
|
43
|
+
existingConfig = JSON.parse(fs.readFileSync(outputPath, 'utf8'));
|
|
44
|
+
} catch {
|
|
45
|
+
// Ignore parse errors
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Merge with existing config
|
|
50
|
+
const config = {
|
|
51
|
+
...existingConfig,
|
|
52
|
+
mcpServers: {
|
|
53
|
+
...existingConfig.mcpServers,
|
|
54
|
+
l4yercak3: {
|
|
55
|
+
command: 'npx',
|
|
56
|
+
args: ['@l4yercak3/cli', 'mcp', 'start'],
|
|
57
|
+
env: {
|
|
58
|
+
L4YERCAK3_CONFIG_PATH: '${workspaceFolder}/.l4yercak3',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const action = await checkFileOverwrite(outputPath);
|
|
65
|
+
if (action === 'skip') {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return writeFileWithBackup(outputPath, JSON.stringify(config, null, 2), action);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Generate MCP integration guide
|
|
74
|
+
*/
|
|
75
|
+
async generateGuide(options) {
|
|
76
|
+
const {
|
|
77
|
+
projectPath,
|
|
78
|
+
organizationName,
|
|
79
|
+
features,
|
|
80
|
+
} = options;
|
|
81
|
+
|
|
82
|
+
const docsDir = path.join(projectPath, 'docs');
|
|
83
|
+
ensureDir(docsDir);
|
|
84
|
+
|
|
85
|
+
const outputPath = path.join(docsDir, 'L4YERCAK3_MCP_GUIDE.md');
|
|
86
|
+
|
|
87
|
+
const action = await checkFileOverwrite(outputPath);
|
|
88
|
+
if (action === 'skip') {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const content = this.generateGuideContent({
|
|
93
|
+
organizationName,
|
|
94
|
+
features,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
return writeFileWithBackup(outputPath, content, action);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
generateGuideContent({ organizationName, features }) {
|
|
101
|
+
const featureList = features || ['crm'];
|
|
102
|
+
|
|
103
|
+
return `# L4YERCAK3 MCP Integration Guide
|
|
104
|
+
|
|
105
|
+
Your project is connected to L4YERCAK3! You can now use Claude Code to build
|
|
106
|
+
custom integrations using natural language.
|
|
107
|
+
|
|
108
|
+
## Getting Started
|
|
109
|
+
|
|
110
|
+
The L4YERCAK3 MCP server has been configured in \`.claude/mcp.json\`. When you
|
|
111
|
+
use Claude Code in this project, it will have access to L4YERCAK3 tools.
|
|
112
|
+
|
|
113
|
+
## Available MCP Tools
|
|
114
|
+
|
|
115
|
+
### CRM Tools (contacts:read, contacts:write)
|
|
116
|
+
${featureList.includes('crm') ? `
|
|
117
|
+
- \`l4yercak3_crm_list_contacts\` - List and search contacts
|
|
118
|
+
- \`l4yercak3_crm_create_contact\` - Create new contacts
|
|
119
|
+
- \`l4yercak3_crm_get_contact\` - Get contact details
|
|
120
|
+
- \`l4yercak3_crm_update_contact\` - Update contacts
|
|
121
|
+
- \`l4yercak3_crm_delete_contact\` - Delete contacts
|
|
122
|
+
- \`l4yercak3_crm_add_tags\` - Add tags to contacts
|
|
123
|
+
- \`l4yercak3_crm_list_organizations\` - List organizations
|
|
124
|
+
- \`l4yercak3_crm_create_organization\` - Create organizations
|
|
125
|
+
` : '*Not enabled*'}
|
|
126
|
+
|
|
127
|
+
### Events Tools (events:read, events:write)
|
|
128
|
+
${featureList.includes('events') ? `
|
|
129
|
+
- \`l4yercak3_events_list\` - List events
|
|
130
|
+
- \`l4yercak3_events_create\` - Create events
|
|
131
|
+
- \`l4yercak3_events_get\` - Get event details with products/sponsors
|
|
132
|
+
- \`l4yercak3_events_get_attendees\` - List attendees
|
|
133
|
+
- \`l4yercak3_events_check_in\` - Check in attendees
|
|
134
|
+
` : '*Not enabled*'}
|
|
135
|
+
|
|
136
|
+
### Forms Tools (forms:read, forms:write)
|
|
137
|
+
${featureList.includes('forms') ? `
|
|
138
|
+
- \`l4yercak3_forms_list\` - List forms
|
|
139
|
+
- \`l4yercak3_forms_get\` - Get form with fields
|
|
140
|
+
- \`l4yercak3_forms_submit\` - Submit form responses
|
|
141
|
+
- \`l4yercak3_forms_get_responses\` - Get form submissions
|
|
142
|
+
` : '*Not enabled*'}
|
|
143
|
+
|
|
144
|
+
### Products Tools (products:read)
|
|
145
|
+
${featureList.includes('products') ? `
|
|
146
|
+
- \`l4yercak3_products_list\` - List products
|
|
147
|
+
- \`l4yercak3_products_get\` - Get product details
|
|
148
|
+
` : '*Not enabled*'}
|
|
149
|
+
|
|
150
|
+
### Checkout Tools (checkout:write)
|
|
151
|
+
${featureList.includes('checkout') ? `
|
|
152
|
+
- \`l4yercak3_checkout_create_session\` - Create checkout session
|
|
153
|
+
- \`l4yercak3_checkout_get_session\` - Get checkout status
|
|
154
|
+
- \`l4yercak3_orders_list\` - List orders
|
|
155
|
+
- \`l4yercak3_orders_get\` - Get order details
|
|
156
|
+
` : '*Not enabled*'}
|
|
157
|
+
|
|
158
|
+
### Invoicing Tools (invoices:read, invoices:write)
|
|
159
|
+
${featureList.includes('invoicing') ? `
|
|
160
|
+
- \`l4yercak3_invoices_list\` - List invoices
|
|
161
|
+
- \`l4yercak3_invoices_create\` - Create invoices
|
|
162
|
+
- \`l4yercak3_invoices_get\` - Get invoice details
|
|
163
|
+
- \`l4yercak3_invoices_send\` - Send invoice to customer
|
|
164
|
+
- \`l4yercak3_invoices_mark_paid\` - Mark invoice as paid
|
|
165
|
+
- \`l4yercak3_invoices_get_pdf\` - Get invoice PDF URL
|
|
166
|
+
` : '*Not enabled*'}
|
|
167
|
+
|
|
168
|
+
### Benefits Tools (benefits:read, benefits:write)
|
|
169
|
+
${featureList.includes('benefits') ? `
|
|
170
|
+
- \`l4yercak3_benefits_list_claims\` - List benefit claims
|
|
171
|
+
- \`l4yercak3_benefits_create_claim\` - Submit a benefit claim
|
|
172
|
+
- \`l4yercak3_benefits_approve_claim\` - Approve a claim
|
|
173
|
+
- \`l4yercak3_benefits_reject_claim\` - Reject a claim
|
|
174
|
+
- \`l4yercak3_benefits_list_commissions\` - List commission payouts
|
|
175
|
+
` : '*Not enabled*'}
|
|
176
|
+
|
|
177
|
+
### Code Generation Tools
|
|
178
|
+
- \`l4yercak3_generate_api_client\` - Generate typed API client
|
|
179
|
+
- \`l4yercak3_generate_component\` - Generate React components
|
|
180
|
+
- \`l4yercak3_generate_hook\` - Generate React hooks
|
|
181
|
+
- \`l4yercak3_generate_page\` - Generate Next.js pages
|
|
182
|
+
|
|
183
|
+
## Example Prompts
|
|
184
|
+
|
|
185
|
+
Here are some things you can ask Claude Code to do:
|
|
186
|
+
|
|
187
|
+
### CRM & Contacts
|
|
188
|
+
1. "Create a contact management page with search, filtering by tags, and the ability to add notes"
|
|
189
|
+
2. "Build a contact detail view that shows all activities and related organizations"
|
|
190
|
+
3. "Generate a contact import feature that reads from CSV"
|
|
191
|
+
|
|
192
|
+
### Events & Registrations
|
|
193
|
+
4. "Build an event registration flow with ticket selection and Stripe checkout"
|
|
194
|
+
5. "Create an event listing page with filters for date, location, and category"
|
|
195
|
+
6. "Build a mobile-friendly check-in scanner for event attendees"
|
|
196
|
+
|
|
197
|
+
### Forms
|
|
198
|
+
7. "Generate a form builder that lets admins create custom forms and view submissions"
|
|
199
|
+
8. "Create a contact form that saves to L4YERCAK3 CRM"
|
|
200
|
+
9. "Build a survey results dashboard with charts"
|
|
201
|
+
|
|
202
|
+
### E-commerce
|
|
203
|
+
10. "Create a product catalog with categories and search"
|
|
204
|
+
11. "Build a shopping cart with quantity controls"
|
|
205
|
+
12. "Generate an order history page for customers"
|
|
206
|
+
|
|
207
|
+
### Invoicing
|
|
208
|
+
13. "Create an invoice dashboard showing pending, paid, and overdue invoices"
|
|
209
|
+
14. "Build a send invoice flow with email preview"
|
|
210
|
+
15. "Generate an invoice PDF viewer component"
|
|
211
|
+
|
|
212
|
+
### Dashboard & Analytics
|
|
213
|
+
16. "Create a dashboard showing CRM contacts, recent events, and pending invoices"
|
|
214
|
+
17. "Build a revenue analytics chart from order data"
|
|
215
|
+
18. "Generate a customer lifetime value report"
|
|
216
|
+
|
|
217
|
+
## Your Configuration
|
|
218
|
+
|
|
219
|
+
- **Organization:** ${organizationName || 'Your Organization'}
|
|
220
|
+
- **Features Enabled:** ${featureList.join(', ')}
|
|
221
|
+
- **API Key:** Stored in .env.local
|
|
222
|
+
|
|
223
|
+
## Tips for Best Results
|
|
224
|
+
|
|
225
|
+
1. **Be specific about your UI framework** - Tell Claude if you're using Tailwind, shadcn/ui, Material UI, etc.
|
|
226
|
+
|
|
227
|
+
2. **Reference existing patterns** - Say "match the style of my existing components" so Claude reads your code first.
|
|
228
|
+
|
|
229
|
+
3. **Start with data** - Ask Claude to show what data is available from the API before designing UI.
|
|
230
|
+
|
|
231
|
+
4. **Iterate incrementally** - Start simple and add features one at a time.
|
|
232
|
+
|
|
233
|
+
5. **Ask for explanations** - Claude can explain what MCP tools are available and how they work.
|
|
234
|
+
|
|
235
|
+
## Webhook Integration
|
|
236
|
+
|
|
237
|
+
You can also ask Claude to set up webhooks for real-time updates:
|
|
238
|
+
|
|
239
|
+
- "Set up a webhook handler for new contact creation"
|
|
240
|
+
- "Create a webhook endpoint that syncs orders to our local database"
|
|
241
|
+
- "Build a notification system triggered by invoice.paid webhooks"
|
|
242
|
+
|
|
243
|
+
## Need Help?
|
|
244
|
+
|
|
245
|
+
- Ask Claude: "What L4YERCAK3 MCP tools are available?"
|
|
246
|
+
- Ask Claude: "Show me an example of using the contacts API"
|
|
247
|
+
- Ask Claude: "Help me debug this L4YERCAK3 integration"
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
Generated by @l4yercak3/cli
|
|
252
|
+
`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
module.exports = new McpGuideGenerator();
|