@l4yercak3/cli 1.2.15 → 1.2.18

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.
@@ -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();