gufi-cli 0.1.50 → 0.1.52

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 (37) hide show
  1. package/dist/commands/docs.js +1 -5
  2. package/dist/index.js +1 -0
  3. package/dist/lib/docs-resolver.d.ts +8 -0
  4. package/dist/lib/docs-resolver.js +27 -0
  5. package/dist/mcp.d.ts +3 -1
  6. package/dist/mcp.js +232 -34
  7. package/docs/dev-guide/1-01-architecture.md +358 -0
  8. package/docs/dev-guide/1-02-multi-tenant.md +415 -0
  9. package/docs/dev-guide/1-03-column-types.md +594 -0
  10. package/docs/dev-guide/1-04-json-config.md +442 -0
  11. package/docs/dev-guide/1-05-authentication.md +427 -0
  12. package/docs/dev-guide/2-01-api-reference.md +564 -0
  13. package/docs/dev-guide/2-02-automations.md +508 -0
  14. package/docs/dev-guide/2-03-gufi-cli.md +568 -0
  15. package/docs/dev-guide/2-04-realtime.md +401 -0
  16. package/docs/dev-guide/2-05-permissions.md +497 -0
  17. package/docs/dev-guide/2-06-integrations-overview.md +104 -0
  18. package/docs/dev-guide/2-07-stripe.md +173 -0
  19. package/docs/dev-guide/2-08-nayax.md +297 -0
  20. package/docs/dev-guide/2-09-ourvend.md +226 -0
  21. package/docs/dev-guide/2-10-tns.md +177 -0
  22. package/docs/dev-guide/2-11-custom-http.md +268 -0
  23. package/docs/dev-guide/3-01-custom-views.md +555 -0
  24. package/docs/dev-guide/3-02-webhooks-api.md +446 -0
  25. package/docs/mcp/00-overview.md +329 -0
  26. package/docs/mcp/01-architecture.md +220 -0
  27. package/docs/mcp/02-modules.md +285 -0
  28. package/docs/mcp/03-fields.md +357 -0
  29. package/docs/mcp/04-views.md +613 -0
  30. package/docs/mcp/05-automations.md +461 -0
  31. package/docs/mcp/06-api.md +480 -0
  32. package/docs/mcp/07-packages.md +246 -0
  33. package/docs/mcp/08-common-errors.md +284 -0
  34. package/docs/mcp/09-examples.md +453 -0
  35. package/docs/mcp/README.md +71 -0
  36. package/docs/mcp/tool-descriptions.json +49 -0
  37. package/package.json +3 -2
@@ -0,0 +1,442 @@
1
+ ---
2
+ id: json-config
3
+ title: "Module JSON Configuration"
4
+ description: "Define modules, entities, and fields"
5
+ icon: Code
6
+ category: dev
7
+ part: 1
8
+ ---
9
+
10
+ # Module JSON Configuration
11
+
12
+ Define modules, entities, and fields
13
+
14
+ ## Overview
15
+
16
+ Modules in Gufi are defined using JSON configuration. This declarative approach makes it easy to:
17
+
18
+ - Create complex data structures without SQL
19
+ - Version control your schema
20
+ - Share modules across companies
21
+ - Import/export configurations
22
+
23
+ ## Module Structure
24
+
25
+ ### Basic Module
26
+
27
+ ```json
28
+ {
29
+ "id": 360,
30
+ "name": "inventory",
31
+ "label": "Inventory",
32
+ "icon": "Package",
33
+ "description": "Manage products and stock",
34
+ "entities": [
35
+ {
36
+ "id": 4589,
37
+ "name": "products",
38
+ "label": "Products",
39
+ "kind": "table",
40
+ "icon": "Box",
41
+ "fields": [...]
42
+ }
43
+ ]
44
+ }
45
+ ```
46
+
47
+ ### Module Properties
48
+
49
+ | Property | Type | Required | Description |
50
+ |---|---|---|---|
51
+ | id | number | Yes | Unique module ID |
52
+ | name | string | Yes | Internal name (lowercase, no spaces) |
53
+ | label | string/i18n | Yes | Display name |
54
+ | icon | string | No | Lucide icon name |
55
+ | description | string | No | Module description |
56
+ | entities | array | Yes | Array of entity definitions |
57
+
58
+ ### Label Localization
59
+
60
+ ```json
61
+ {
62
+ "label": {
63
+ "es": "Inventario",
64
+ "en": "Inventory"
65
+ }
66
+ }
67
+ ```
68
+
69
+ ## Entity Definition
70
+
71
+ ### Basic Entity
72
+
73
+ ```json
74
+ {
75
+ "id": 4589,
76
+ "name": "products",
77
+ "label": "Products",
78
+ "kind": "table",
79
+ "icon": "Box",
80
+ "primaryField": "name",
81
+ "secondaryField": "sku",
82
+ "fields": [...]
83
+ }
84
+ ```
85
+
86
+ ### Entity Properties
87
+
88
+ | Property | Type | Required | Description |
89
+ |---|---|---|---|
90
+ | id | number | Yes | Unique entity ID |
91
+ | name | string | Yes | Internal name |
92
+ | label | string/i18n | Yes | Display name |
93
+ | kind | string | Yes | Entity type (see below) |
94
+ | icon | string | No | Lucide icon name |
95
+ | primaryField | string | No | Main display field |
96
+ | secondaryField | string | No | Secondary display field |
97
+ | fields | array | Yes | Array of field definitions |
98
+ | webhook | object | No | Webhook configuration |
99
+
100
+ ### Entity Kinds
101
+
102
+ | Kind | Description |
103
+ |---|---|
104
+ | table | Standard data table |
105
+ | calendar | Calendar view |
106
+ | kanban | Kanban board view |
107
+ | dashboard | Custom dashboard |
108
+
109
+ ## Field Definition
110
+
111
+ ### Basic Field
112
+
113
+ ```json
114
+ {
115
+ "name": "product_name",
116
+ "type": "text",
117
+ "label": "Product Name",
118
+ "required": true
119
+ }
120
+ ```
121
+
122
+ ### All Field Properties
123
+
124
+ ```json
125
+ {
126
+ "name": "price",
127
+ "type": "currency",
128
+ "label": {
129
+ "es": "Precio",
130
+ "en": "Price"
131
+ },
132
+ "required": true,
133
+ "unique": false,
134
+ "default": { "currency": "EUR", "amount": 0 },
135
+ "hidden": false,
136
+ "readonly": false,
137
+ "help": "Enter the product price",
138
+
139
+ // Type-specific options
140
+ "options": [...], // For select/multiselect
141
+ "ref": "module.entity", // For ref/multiref
142
+ "formula": "...", // For formula
143
+ "maxLength": 255, // For text
144
+ "min": 0, // For number
145
+ "max": 99999, // For number
146
+ "decimalPlaces": 2 // For number
147
+ }
148
+ ```
149
+
150
+ ## Complete Example
151
+
152
+ ### CRM Module
153
+
154
+ ```json
155
+ {
156
+ "id": 100,
157
+ "name": "crm",
158
+ "label": {
159
+ "es": "CRM",
160
+ "en": "CRM"
161
+ },
162
+ "icon": "Users",
163
+ "description": "Customer Relationship Management",
164
+ "entities": [
165
+ {
166
+ "id": 1001,
167
+ "name": "contacts",
168
+ "label": {
169
+ "es": "Contactos",
170
+ "en": "Contacts"
171
+ },
172
+ "kind": "table",
173
+ "icon": "User",
174
+ "primaryField": "name",
175
+ "secondaryField": "email",
176
+ "fields": [
177
+ {
178
+ "name": "name",
179
+ "type": "text",
180
+ "label": { "es": "Nombre", "en": "Name" },
181
+ "required": true
182
+ },
183
+ {
184
+ "name": "email",
185
+ "type": "email",
186
+ "label": { "es": "Email", "en": "Email" },
187
+ "unique": true
188
+ },
189
+ {
190
+ "name": "phone",
191
+ "type": "phone",
192
+ "label": { "es": "Teléfono", "en": "Phone" }
193
+ },
194
+ {
195
+ "name": "company",
196
+ "type": "ref",
197
+ "label": { "es": "Empresa", "en": "Company" },
198
+ "ref": "crm.companies"
199
+ },
200
+ {
201
+ "name": "status",
202
+ "type": "select",
203
+ "label": { "es": "Estado", "en": "Status" },
204
+ "options": [
205
+ { "value": "lead", "label": { "es": "Lead", "en": "Lead" }, "color": "blue" },
206
+ { "value": "customer", "label": { "es": "Cliente", "en": "Customer" }, "color": "green" },
207
+ { "value": "churned", "label": { "es": "Perdido", "en": "Churned" }, "color": "red" }
208
+ ],
209
+ "default": "lead"
210
+ },
211
+ {
212
+ "name": "notes",
213
+ "type": "longtext",
214
+ "label": { "es": "Notas", "en": "Notes" }
215
+ },
216
+ {
217
+ "name": "assigned_to",
218
+ "type": "user",
219
+ "label": { "es": "Asignado a", "en": "Assigned To" }
220
+ }
221
+ ]
222
+ },
223
+ {
224
+ "id": 1002,
225
+ "name": "companies",
226
+ "label": {
227
+ "es": "Empresas",
228
+ "en": "Companies"
229
+ },
230
+ "kind": "table",
231
+ "icon": "Building2",
232
+ "primaryField": "name",
233
+ "fields": [
234
+ {
235
+ "name": "name",
236
+ "type": "text",
237
+ "label": { "es": "Nombre", "en": "Name" },
238
+ "required": true
239
+ },
240
+ {
241
+ "name": "website",
242
+ "type": "url",
243
+ "label": { "es": "Web", "en": "Website" }
244
+ },
245
+ {
246
+ "name": "industry",
247
+ "type": "select",
248
+ "label": { "es": "Industria", "en": "Industry" },
249
+ "options": [
250
+ { "value": "tech", "label": "Technology" },
251
+ { "value": "retail", "label": "Retail" },
252
+ { "value": "services", "label": "Services" },
253
+ { "value": "manufacturing", "label": "Manufacturing" }
254
+ ]
255
+ },
256
+ {
257
+ "name": "annual_revenue",
258
+ "type": "currency",
259
+ "label": { "es": "Facturación anual", "en": "Annual Revenue" }
260
+ },
261
+ {
262
+ "name": "address",
263
+ "type": "location",
264
+ "label": { "es": "Dirección", "en": "Address" }
265
+ }
266
+ ]
267
+ },
268
+ {
269
+ "id": 1003,
270
+ "name": "deals",
271
+ "label": {
272
+ "es": "Oportunidades",
273
+ "en": "Deals"
274
+ },
275
+ "kind": "kanban",
276
+ "icon": "DollarSign",
277
+ "primaryField": "title",
278
+ "fields": [
279
+ {
280
+ "name": "title",
281
+ "type": "text",
282
+ "label": { "es": "Título", "en": "Title" },
283
+ "required": true
284
+ },
285
+ {
286
+ "name": "contact",
287
+ "type": "ref",
288
+ "label": { "es": "Contacto", "en": "Contact" },
289
+ "ref": "crm.contacts"
290
+ },
291
+ {
292
+ "name": "value",
293
+ "type": "currency",
294
+ "label": { "es": "Valor", "en": "Value" },
295
+ "required": true
296
+ },
297
+ {
298
+ "name": "stage",
299
+ "type": "select",
300
+ "label": { "es": "Etapa", "en": "Stage" },
301
+ "options": [
302
+ { "value": "qualified", "label": "Qualified", "color": "blue" },
303
+ { "value": "proposal", "label": "Proposal", "color": "yellow" },
304
+ { "value": "negotiation", "label": "Negotiation", "color": "orange" },
305
+ { "value": "won", "label": "Won", "color": "green" },
306
+ { "value": "lost", "label": "Lost", "color": "red" }
307
+ ]
308
+ },
309
+ {
310
+ "name": "expected_close",
311
+ "type": "date",
312
+ "label": { "es": "Cierre esperado", "en": "Expected Close" }
313
+ },
314
+ {
315
+ "name": "probability",
316
+ "type": "percentage",
317
+ "label": { "es": "Probabilidad", "en": "Probability" }
318
+ }
319
+ ]
320
+ }
321
+ ]
322
+ }
323
+ ```
324
+
325
+ ## Webhook Configuration
326
+
327
+ Enable API access for an entity:
328
+
329
+ ```json
330
+ {
331
+ "name": "products",
332
+ "webhook": {
333
+ "enabled": true
334
+ },
335
+ "fields": [...]
336
+ }
337
+ ```
338
+
339
+ This adds an "API" button in the UI that generates webhook URLs.
340
+
341
+ ## Validation Rules
342
+
343
+ ### Module Name
344
+
345
+ - Lowercase letters and underscores only
346
+ - Must start with letter
347
+ - Max 50 characters
348
+
349
+ ### Entity Name
350
+
351
+ - Lowercase letters and underscores only
352
+ - Unique within module
353
+ - Max 50 characters
354
+
355
+ ### Field Name
356
+
357
+ - Lowercase letters, numbers, underscores
358
+ - Must start with letter
359
+ - Unique within entity
360
+ - Max 50 characters
361
+ - Cannot be: id, created_at, updated_at, created_by, updated_by
362
+
363
+ ## CLI Management
364
+
365
+ ### View Module
366
+
367
+ ```bash
368
+ gufi module 360
369
+ ```
370
+
371
+ ### Edit Module
372
+
373
+ ```bash
374
+ gufi module 360 --edit
375
+ ```
376
+
377
+ Opens in $EDITOR, saves changes on close.
378
+
379
+ ### Create Module
380
+
381
+ ```bash
382
+ gufi module:create config.json -c 146
383
+ ```
384
+
385
+ ### Update Module
386
+
387
+ ```bash
388
+ gufi module:update 360 config.json
389
+ ```
390
+
391
+ ## Best Practices
392
+
393
+ ### Naming Conventions
394
+
395
+ ```json
396
+ // Good
397
+ "name": "purchase_orders"
398
+ "name": "product_categories"
399
+ "name": "customer_notes"
400
+
401
+ // Bad
402
+ "name": "PurchaseOrders" // No camelCase
403
+ "name": "po" // Too short
404
+ "name": "product-cats" // No hyphens
405
+ ```
406
+
407
+ ### Field Organization
408
+
409
+ Order fields logically:
410
+
411
+ 1. Primary identifier fields
412
+ 2. Main data fields
413
+ 3. Status/type fields
414
+ 4. Relationships
415
+ 5. Metadata fields
416
+ 6. Notes/comments
417
+
418
+ ### Use Proper Types
419
+
420
+ ```json
421
+ // Good
422
+ { "type": "currency", "name": "price" }
423
+ { "type": "email", "name": "contact_email" }
424
+ { "type": "phone", "name": "phone" }
425
+
426
+ // Bad
427
+ { "type": "text", "name": "price" } // Use currency
428
+ { "type": "text", "name": "email" } // Use email
429
+ { "type": "number", "name": "phone" } // Use phone
430
+ ```
431
+
432
+ ### Always Use Full Refs
433
+
434
+ ```json
435
+ // Good
436
+ "ref": "inventory.products"
437
+ "ref": "crm.contacts"
438
+
439
+ // Bad
440
+ "ref": "products" // Missing module
441
+ "ref": "4589" // Using ID instead of name
442
+ ```