@l4yercak3/cli 1.1.12 → 1.2.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.
@@ -0,0 +1,326 @@
1
+ /**
2
+ * Core Domain Tools
3
+ *
4
+ * Discovery, authentication, and organization management tools.
5
+ * These are the foundational tools that help Claude Code understand
6
+ * what L4YERCAK3 can do and get the user set up.
7
+ *
8
+ * @module mcp/registry/domains/core
9
+ */
10
+
11
+ const backendClient = require('../../../api/backend-client');
12
+ const configManager = require('../../../config/config-manager');
13
+
14
+ /**
15
+ * Core domain definition
16
+ */
17
+ module.exports = {
18
+ name: 'core',
19
+ description: 'Discovery, authentication, and organization management',
20
+ tools: [
21
+ // ========================================
22
+ // Discovery Tools (No Auth Required)
23
+ // ========================================
24
+ {
25
+ name: 'l4yercak3_get_capabilities',
26
+ description: `Get a list of all L4YERCAK3 capabilities and features.
27
+ Use this first to understand what L4YERCAK3 can do and help the user choose features to integrate.
28
+
29
+ Returns capabilities organized by category:
30
+ - CRM: Contact management, organizations, pipelines
31
+ - Invoicing: Invoice creation, payment tracking
32
+ - Events: Event management, ticketing, attendees
33
+ - Forms: Form builder, registration forms
34
+ - Checkout: Payment processing, Stripe integration
35
+ - Workflows: Automation and triggers`,
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ category: {
40
+ type: 'string',
41
+ enum: ['all', 'crm', 'invoicing', 'events', 'forms', 'checkout', 'workflows'],
42
+ description: 'Filter capabilities by category (default: all)',
43
+ },
44
+ },
45
+ },
46
+ requiresAuth: false,
47
+ handler: async (params) => {
48
+ const allCapabilities = [
49
+ {
50
+ name: 'CRM',
51
+ category: 'crm',
52
+ description: 'Customer Relationship Management - contacts, organizations, pipelines',
53
+ features: [
54
+ 'contacts - Store and manage customer contacts',
55
+ 'organizations - Track companies and organizations',
56
+ 'pipelines - Sales pipelines with stages',
57
+ 'notes - Activity notes and interactions',
58
+ 'activities - Call, email, meeting tracking',
59
+ ],
60
+ tools: [
61
+ 'l4yercak3_crm_list_contacts',
62
+ 'l4yercak3_crm_create_contact',
63
+ 'l4yercak3_crm_get_contact',
64
+ 'l4yercak3_crm_update_contact',
65
+ 'l4yercak3_crm_list_organizations',
66
+ 'l4yercak3_crm_create_organization',
67
+ ],
68
+ },
69
+ {
70
+ name: 'Events',
71
+ category: 'events',
72
+ description: 'Event management with tickets and attendees',
73
+ features: [
74
+ 'events - Create and manage events (conferences, workshops, meetups)',
75
+ 'tickets - Ticket products with pricing',
76
+ 'attendees - Track event registrations',
77
+ 'sponsors - Link organizations as event sponsors',
78
+ 'agenda - Event schedules and sessions',
79
+ ],
80
+ tools: [
81
+ 'l4yercak3_events_list',
82
+ 'l4yercak3_events_create',
83
+ 'l4yercak3_events_get',
84
+ 'l4yercak3_events_update',
85
+ 'l4yercak3_events_get_attendees',
86
+ ],
87
+ },
88
+ {
89
+ name: 'Forms',
90
+ category: 'forms',
91
+ description: 'Form builder for registration and data collection',
92
+ features: [
93
+ 'forms - Create custom forms (registration, surveys, applications)',
94
+ 'fields - Text, email, select, checkbox, file upload fields',
95
+ 'responses - Collect and manage form submissions',
96
+ 'conditional - Conditional field logic',
97
+ 'analytics - Submission tracking and completion rates',
98
+ ],
99
+ tools: [
100
+ 'l4yercak3_forms_list',
101
+ 'l4yercak3_forms_create',
102
+ 'l4yercak3_forms_get',
103
+ 'l4yercak3_forms_get_responses',
104
+ ],
105
+ },
106
+ {
107
+ name: 'Invoicing',
108
+ category: 'invoicing',
109
+ description: 'Invoice generation and payment tracking',
110
+ features: [
111
+ 'invoices - Create and send invoices',
112
+ 'line_items - Multiple items per invoice',
113
+ 'payments - Track payment status',
114
+ 'pdf - Generate PDF invoices',
115
+ 'email - Send invoices via email',
116
+ ],
117
+ tools: ['Coming soon - use l4yercak3_get_capabilities to check for updates'],
118
+ },
119
+ {
120
+ name: 'Checkout',
121
+ category: 'checkout',
122
+ description: 'Payment processing with Stripe integration',
123
+ features: [
124
+ 'checkout_sessions - Create payment checkout flows',
125
+ 'products - Define purchasable products',
126
+ 'stripe - Stripe payment integration',
127
+ 'webhooks - Payment event webhooks',
128
+ ],
129
+ tools: ['Coming soon - use l4yercak3_get_capabilities to check for updates'],
130
+ },
131
+ {
132
+ name: 'Workflows',
133
+ category: 'workflows',
134
+ description: 'Automation and business process triggers',
135
+ features: [
136
+ 'triggers - Event-based automation triggers',
137
+ 'actions - Send emails, create records, webhooks',
138
+ 'conditions - Conditional workflow logic',
139
+ ],
140
+ tools: ['Coming soon - use l4yercak3_get_capabilities to check for updates'],
141
+ },
142
+ ];
143
+
144
+ // Filter by category if specified
145
+ const category = params.category || 'all';
146
+ const capabilities =
147
+ category === 'all'
148
+ ? allCapabilities
149
+ : allCapabilities.filter(c => c.category === category);
150
+
151
+ return {
152
+ capabilities,
153
+ documentation: 'https://docs.l4yercak3.com',
154
+ support: 'support@l4yercak3.com',
155
+ };
156
+ },
157
+ },
158
+
159
+ {
160
+ name: 'l4yercak3_check_auth_status',
161
+ description: `Check if the user is authenticated with L4YERCAK3.
162
+ Use this to determine if the user needs to login before using other tools.
163
+
164
+ If not authenticated, suggest running "l4yercak3 login" in the terminal.`,
165
+ inputSchema: {
166
+ type: 'object',
167
+ properties: {},
168
+ },
169
+ requiresAuth: false,
170
+ handler: async (params, authContext) => {
171
+ if (!authContext) {
172
+ return {
173
+ authenticated: false,
174
+ message: 'Not authenticated with L4YERCAK3.',
175
+ action: 'Run "l4yercak3 login" in the terminal to authenticate.',
176
+ };
177
+ }
178
+
179
+ return {
180
+ authenticated: true,
181
+ userId: authContext.userId,
182
+ email: authContext.email,
183
+ organizationId: authContext.organizationId,
184
+ organizationName: authContext.organizationName,
185
+ };
186
+ },
187
+ },
188
+
189
+ {
190
+ name: 'l4yercak3_get_login_instructions',
191
+ description: `Get instructions for how to authenticate with L4YERCAK3.
192
+ Use this when the user needs to login but hasn't yet.`,
193
+ inputSchema: {
194
+ type: 'object',
195
+ properties: {},
196
+ },
197
+ requiresAuth: false,
198
+ handler: async () => {
199
+ return {
200
+ instructions: [
201
+ '1. Open a terminal in this project directory',
202
+ '2. Run: l4yercak3 login',
203
+ '3. This will open a browser window for authentication',
204
+ '4. After logging in, you can use L4YERCAK3 tools',
205
+ ],
206
+ alternativeInstructions: [
207
+ 'If you don\'t have the CLI installed:',
208
+ '1. Run: npm install -g @l4yercak3/cli',
209
+ '2. Then run: l4yercak3 login',
210
+ ],
211
+ documentation: 'https://docs.l4yercak3.com/cli/authentication',
212
+ };
213
+ },
214
+ },
215
+
216
+ // ========================================
217
+ // Organization Tools (Auth Required)
218
+ // ========================================
219
+ {
220
+ name: 'l4yercak3_list_organizations',
221
+ description: `List all organizations the authenticated user has access to.
222
+ Use this to help users choose which organization to work with.`,
223
+ inputSchema: {
224
+ type: 'object',
225
+ properties: {},
226
+ },
227
+ requiresAuth: true,
228
+ handler: async (params, authContext) => {
229
+ const response = await backendClient.getOrganizations();
230
+
231
+ return {
232
+ organizations: response.organizations || [],
233
+ currentOrganizationId: authContext.organizationId,
234
+ currentOrganizationName: authContext.organizationName,
235
+ };
236
+ },
237
+ },
238
+
239
+ {
240
+ name: 'l4yercak3_switch_organization',
241
+ description: `Switch the current organization context.
242
+ Use this when the user wants to work with a different organization.`,
243
+ inputSchema: {
244
+ type: 'object',
245
+ properties: {
246
+ organizationId: {
247
+ type: 'string',
248
+ description: 'The organization ID to switch to',
249
+ },
250
+ },
251
+ required: ['organizationId'],
252
+ },
253
+ requiresAuth: true,
254
+ handler: async (params, authContext) => {
255
+ // Get current session
256
+ const session = configManager.getSession();
257
+ if (!session) {
258
+ throw new Error('No active session');
259
+ }
260
+
261
+ // Verify user has access to target org
262
+ const response = await backendClient.getOrganizations();
263
+ const targetOrg = (response.organizations || []).find(
264
+ org => org.id === params.organizationId
265
+ );
266
+
267
+ if (!targetOrg) {
268
+ throw new Error(
269
+ `Organization ${params.organizationId} not found or you don't have access`
270
+ );
271
+ }
272
+
273
+ // Update session with new organization
274
+ configManager.saveSession({
275
+ ...session,
276
+ organizationId: targetOrg.id,
277
+ organizationName: targetOrg.name,
278
+ });
279
+
280
+ return {
281
+ success: true,
282
+ organizationId: targetOrg.id,
283
+ organizationName: targetOrg.name,
284
+ message: `Switched to organization: ${targetOrg.name}`,
285
+ };
286
+ },
287
+ },
288
+
289
+ {
290
+ name: 'l4yercak3_create_organization',
291
+ description: `Create a new organization.
292
+ Use this when the user wants to set up a new organization for their project.`,
293
+ inputSchema: {
294
+ type: 'object',
295
+ properties: {
296
+ name: {
297
+ type: 'string',
298
+ description: 'Name for the new organization',
299
+ },
300
+ },
301
+ required: ['name'],
302
+ },
303
+ requiresAuth: true,
304
+ handler: async (params, authContext) => {
305
+ const response = await backendClient.createOrganization(params.name);
306
+
307
+ // Optionally switch to new org
308
+ const session = configManager.getSession();
309
+ if (session) {
310
+ configManager.saveSession({
311
+ ...session,
312
+ organizationId: response.id,
313
+ organizationName: response.name,
314
+ });
315
+ }
316
+
317
+ return {
318
+ success: true,
319
+ organizationId: response.id,
320
+ organizationName: response.name,
321
+ message: `Created and switched to organization: ${response.name}`,
322
+ };
323
+ },
324
+ },
325
+ ],
326
+ };