@stellisoft/stellify-mcp 0.1.28 → 0.1.30

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/dist/index.js CHANGED
@@ -23,7 +23,7 @@ const STELLIFY_FRAMEWORK_API = {
23
23
  // Data & Forms
24
24
  Form: ['create', 'set', 'get', 'getData', 'validate', 'isValid', 'getErrors', 'getError', 'reset', 'store', 'update', 'delete'],
25
25
  Table: ['create', 'setData', 'addColumn', 'removeColumn', 'sort', 'filter', 'clearFilter', 'paginate', 'page', 'getData', 'getAllData', 'getColumns', 'getColumn', 'getTotalRows', 'getTotalPages', 'getCurrentPage', 'getPageSize', 'getSortKey', 'getSortDirection'],
26
- List: ['create', 'from', 'range', 'add', 'remove', 'removeWhere', 'set', 'get', 'first', 'last', 'sort', 'sortBy', 'reverse', 'filter', 'find', 'findIndex', 'map', 'reduce', 'forEach', 'includes', 'indexOf', 'every', 'some', 'slice', 'take', 'skip', 'chunk', 'unique', 'uniqueBy', 'groupBy', 'flatten', 'concat', 'isEmpty', 'isNotEmpty', 'count', 'clear', 'toArray', 'toJSON', 'clone', 'sum', 'avg', 'min', 'max'],
26
+ Collection: ['create', 'collect', 'from', 'range', 'add', 'remove', 'removeWhere', 'set', 'get', 'first', 'last', 'sort', 'sortBy', 'reverse', 'filter', 'find', 'findIndex', 'map', 'reduce', 'forEach', 'includes', 'indexOf', 'every', 'some', 'slice', 'take', 'skip', 'chunk', 'unique', 'uniqueBy', 'groupBy', 'flatten', 'concat', 'isEmpty', 'isNotEmpty', 'count', 'clear', 'toArray', 'toJSON', 'clone', 'sum', 'avg', 'min', 'max'],
27
27
  Tree: ['create', 'setRoot', 'addChild', 'removeNode', 'getNode', 'getRoot', 'getChildren', 'getParent', 'getSiblings', 'getAncestors', 'getDescendants', 'getDepth', 'getPath', 'traverse', 'find', 'findAll', 'move', 'toArray', 'size'],
28
28
  // Network
29
29
  Http: ['create', 'get', 'post', 'put', 'patch', 'delete', 'items', 'withHeaders', 'withToken', 'withTimeout'],
@@ -63,29 +63,7 @@ const STELLIFY_FRAMEWORK_API = {
63
63
  const tools = [
64
64
  {
65
65
  name: 'get_stellify_framework_api',
66
- description: `Get the complete Stellify Framework API reference for Vue/JS development.
67
-
68
- Returns all modules and their methods for AI-friendly frontend code generation.
69
-
70
- Use this tool when you need to:
71
- - Look up available methods for a Stellify module
72
- - Verify method names before generating code
73
- - Understand the full API surface
74
-
75
- IMPORTANT - Stellify Framework Import:
76
- The npm package is "stellify-framework" (NOT @stellify/core).
77
- Import like: import { Http, List, Form } from 'stellify-framework';
78
-
79
- IMPORTANT - List class and Vue reactivity:
80
- List is iterable and works directly with Vue's v-for directive.
81
- Use List.from() to wrap arrays for chainable operations (filter, map, sort, etc.).
82
-
83
- Example response:
84
- {
85
- "Form": ["create", "set", "get", "validate", "store", "update", "delete", ...],
86
- "Http": ["create", "get", "post", "put", "delete", "withToken", ...],
87
- ...
88
- }`,
66
+ description: `Get Stellify Framework API reference. Import from "stellify-framework" (not @stellify/core). Collection is iterable with v-for.`,
89
67
  inputSchema: {
90
68
  type: 'object',
91
69
  properties: {
@@ -98,18 +76,7 @@ Example response:
98
76
  },
99
77
  {
100
78
  name: 'get_project',
101
- description: `Get the active Stellify project for the authenticated user.
102
-
103
- IMPORTANT: Call this first before any other operations.
104
-
105
- Returns:
106
- - uuid: Project UUID (needed for most operations)
107
- - name: Project name
108
- - branch/branches: Git branch info
109
- - directories: Array of {uuid, name} for existing directories (js, controllers, models, etc.)
110
-
111
- Use the directories array to find existing directories before creating new ones.
112
- For example, look for a "js" directory before creating Vue components.`,
79
+ description: `Get active project. Returns uuid, name, branches, and directories array.`,
113
80
  inputSchema: {
114
81
  type: 'object',
115
82
  properties: {},
@@ -117,33 +84,12 @@ For example, look for a "js" directory before creating Vue components.`,
117
84
  },
118
85
  {
119
86
  name: 'create_file',
120
- description: `Create a new file in a Stellify project.
121
-
122
- This creates an EMPTY file shell - no methods, statements, or template yet. The file exists but has no content.
123
-
124
- COMPLETE WORKFLOW:
125
- 1. create_file → creates empty shell, returns file UUID
126
- 2. create_statement_with_code → add variables/imports in ONE call (returns statement UUIDs)
127
- 3. create_method with body param → add functions in ONE call (returns method UUIDs)
128
- 4. html_to_elements → create template elements (returns element UUIDs)
129
- 5. save_file → FINALIZE by wiring template/data arrays with all collected UUIDs
87
+ description: `Create an empty file shell in a Stellify project. Returns file UUID.
130
88
 
131
- LEGACY (still supported but prefer combined tools above):
132
- - create_statement + add_statement_code (2 calls instead of 1)
133
- - create_method + add_method_body + save_method for is_async (3 calls instead of 1)
89
+ For PHP: type='class', 'model', 'controller', or 'middleware'.
90
+ For Vue: type='js', extension='vue'. Auto-creates app.js and template route.
134
91
 
135
- For PHP: Use type='class', 'model', 'controller', or 'middleware'.
136
- For Vue: Use type='js' and extension='vue'. Place in the 'js' directory.
137
- - Auto-creates app.js (check response.appJs)
138
- - Auto-creates template route for visual editor (check response.templateRoute.uuid)
139
-
140
- DEPENDENCY RESOLUTION (automatic):
141
- Pass 'includes' as an array of namespace strings for FRAMEWORK classes (e.g., ["Illuminate\\Http\\Request", "Illuminate\\Support\\Facades\\Hash"]).
142
- The system resolves these to UUIDs automatically:
143
- - Illuminate\\*/Laravel\\* → fetches from Laravel API, creates in Application DB
144
- - Vendor packages → fetches from vendor, creates in Application DB
145
-
146
- NOTE: For controllers that use PROJECT models (Feedback, Vote, etc.), add those to the 'models' array in save_file instead. Do NOT put project models in includes - this causes duplicate use statement errors.`,
92
+ Pass 'includes' array for framework class dependencies (auto-resolved to UUIDs). Use 'models' array in save_file for project models.`,
147
93
  inputSchema: {
148
94
  type: 'object',
149
95
  properties: {
@@ -183,42 +129,7 @@ NOTE: For controllers that use PROJECT models (Feedback, Vote, etc.), add those
183
129
  },
184
130
  {
185
131
  name: 'create_method',
186
- description: `Create a method in a file. Can optionally include the body and async flag in a single call.
187
-
188
- **NEW: Combined creation** - Pass 'body' to create the complete method in ONE call. Async is auto-detected when body contains \`await\`.
189
-
190
- **Nested code is handled correctly.** The parser tracks brace/bracket/paren depth and only splits statements on semicolons at the top level. This means computed properties, arrow functions with block bodies, and other nested constructs work correctly as single statements.
191
-
192
- Parameters are automatically created as clauses. The response includes the clause UUIDs for each parameter.
193
-
194
- Example request (simple - signature only):
195
- {
196
- "file": "file-uuid",
197
- "name": "verify",
198
- "visibility": "public",
199
- "returnType": "object",
200
- "nullable": true,
201
- "parameters": [
202
- { "name": "credentials", "datatype": "array" }
203
- ]
204
- }
205
-
206
- Example request (combined - with body, async auto-detected):
207
- {
208
- "file": "file-uuid",
209
- "name": "fetchData",
210
- "body": "const response = await Http.get('/api/data');\\nreturn response.data;"
211
- }
212
-
213
- Example response includes:
214
- {
215
- "uuid": "method-uuid",
216
- "name": "fetchData",
217
- "is_async": true,
218
- "parameters": ["clause-uuid-for-credentials"],
219
- "statements": {...}, // Only if body was provided
220
- "clauses": {...} // Only if body was provided
221
- }`,
132
+ description: `Create a method in a file. Pass 'body' to include implementation. Async auto-detected from \`await\`. For significant methods, include context fields.`,
222
133
  inputSchema: {
223
134
  type: 'object',
224
135
  properties: {
@@ -237,11 +148,11 @@ Example response includes:
237
148
  },
238
149
  is_static: {
239
150
  type: 'boolean',
240
- description: 'Whether the method is static (PHP only)',
151
+ description: 'Static method (PHP only)',
241
152
  },
242
153
  is_async: {
243
154
  type: 'boolean',
244
- description: 'Whether the method is async (JavaScript/Vue only). Set to true for methods that use await.',
155
+ description: 'Async method (JS/Vue). Auto-detected if body contains await.',
245
156
  },
246
157
  returnType: {
247
158
  type: 'string',
@@ -249,37 +160,43 @@ Example response includes:
249
160
  },
250
161
  nullable: {
251
162
  type: 'boolean',
252
- description: 'Whether the return type is nullable (e.g., ?object)',
163
+ description: 'Nullable return type (e.g., ?object)',
253
164
  },
254
165
  parameters: {
255
166
  type: 'array',
256
- description: 'Array of method parameters. Each parameter is created as a clause.',
167
+ description: 'Method parameters (created as clauses)',
257
168
  items: {
258
169
  type: 'object',
259
170
  properties: {
260
- name: {
261
- type: 'string',
262
- description: 'Parameter name (e.g., "credentials", "id")',
263
- },
264
- datatype: {
265
- type: 'string',
266
- description: 'Parameter data type (e.g., "array", "int", "string", "Request")',
267
- },
268
- type: {
269
- type: 'string',
270
- description: 'Clause type, defaults to "variable"',
271
- },
272
- value: {
273
- type: 'string',
274
- description: 'Parameter value, defaults to the name',
275
- },
171
+ name: { type: 'string', description: 'Parameter name' },
172
+ datatype: { type: 'string', description: 'Data type' },
173
+ type: { type: 'string', description: 'Clause type (default: variable)' },
174
+ value: { type: 'string', description: 'Default value' },
276
175
  },
277
176
  required: ['name'],
278
177
  },
279
178
  },
280
179
  body: {
281
180
  type: 'string',
282
- description: 'Method body code (optional). If provided, automatically parses and adds the code. Example: "const response = await Http.get(\\"/api/data\\");\\nreturn response.data;"',
181
+ description: 'Method body code. Auto-parses statements.',
182
+ },
183
+ summary: {
184
+ type: 'string',
185
+ description: 'Context: What this method does',
186
+ },
187
+ rationale: {
188
+ type: 'string',
189
+ description: 'Context: Why built this way',
190
+ },
191
+ references: {
192
+ type: 'array',
193
+ description: 'Context: Related entities [{uuid, type, relationship, note}]',
194
+ items: { type: 'object' },
195
+ },
196
+ decisions: {
197
+ type: 'array',
198
+ description: 'Context: Design decisions',
199
+ items: { type: 'string' },
283
200
  },
284
201
  },
285
202
  required: ['file', 'name'],
@@ -287,16 +204,17 @@ Example response includes:
287
204
  },
288
205
  {
289
206
  name: 'add_method_body',
290
- description: `Parse and add PHP code to a method body. Provide the method implementation code (without the function declaration). Stellify will parse it into structured statements.
207
+ description: `Append code to an existing method. Use this when you need to ADD MORE code to a method that already has statements.
208
+
209
+ **For new methods:** Use \`create_method\` with the \`body\` parameter instead - it creates the method with code in one call.
291
210
 
292
211
  **Nested code is handled correctly.** The parser tracks brace/bracket/paren depth and only splits on semicolons at the top level. Arrow functions with block bodies, computed properties, and other nested constructs work as single statements.
293
212
 
294
- IMPORTANT: This APPENDS to existing method statements. To REPLACE a method's code:
295
- 1. Create a NEW method with create_method
296
- 2. Add body with add_method_body
297
- 3. Update the file's 'data' array to include new method UUID (remove old one)
298
- 4. Update any element click handlers to reference the new method UUID
299
- 5. Optionally delete the old method with delete_method`,
213
+ IMPORTANT: This APPENDS to existing method statements. To REPLACE a method's code entirely:
214
+ 1. Create a NEW method with create_method (with body parameter)
215
+ 2. Update the file's 'data' array to include new method UUID (remove old one)
216
+ 3. Update any element click handlers to reference the new method UUID
217
+ 4. Delete the old method with delete_method`,
300
218
  inputSchema: {
301
219
  type: 'object',
302
220
  properties: {
@@ -318,32 +236,9 @@ IMPORTANT: This APPENDS to existing method statements. To REPLACE a method's cod
318
236
  },
319
237
  {
320
238
  name: 'save_method',
321
- description: `Update an existing method's properties (name, visibility, returnType, nullable, parameters, data, is_async).
239
+ description: `Update a method's properties. Use add_method_body to append code.
322
240
 
323
- Use this to modify a method after creation. For updating the method body, use add_method_body instead.
324
-
325
- Parameters:
326
- - data: Array of statement UUIDs that form the method body. Use this to reorder statements or remove unwanted statements from the method.
327
- - is_async: Set to true for JavaScript/Vue methods that use await.
328
-
329
- Example - Update return type:
330
- {
331
- "uuid": "method-uuid",
332
- "returnType": "object",
333
- "nullable": true
334
- }
335
-
336
- Example - Mark method as async (for methods using await):
337
- {
338
- "uuid": "method-uuid",
339
- "is_async": true
340
- }
341
-
342
- Example - Remove duplicate/unwanted statements:
343
- {
344
- "uuid": "method-uuid",
345
- "data": ["statement-uuid-1", "statement-uuid-2"] // Only keep these statements
346
- }`,
241
+ For significant changes, include context fields: summary, rationale, references, decisions.`,
347
242
  inputSchema: {
348
243
  type: 'object',
349
244
  properties: {
@@ -386,6 +281,32 @@ Example - Remove duplicate/unwanted statements:
386
281
  type: 'boolean',
387
282
  description: 'Whether the method is async (JavaScript/Vue only). Set to true for methods that use await.',
388
283
  },
284
+ summary: {
285
+ type: 'string',
286
+ description: 'Context: Brief description of what this method does',
287
+ },
288
+ rationale: {
289
+ type: 'string',
290
+ description: 'Context: Why it was built this way',
291
+ },
292
+ references: {
293
+ type: 'array',
294
+ description: 'Context: Links to related entities [{uuid, type, relationship, note}]',
295
+ items: {
296
+ type: 'object',
297
+ properties: {
298
+ uuid: { type: 'string' },
299
+ type: { type: 'string', enum: ['model', 'route', 'method', 'file', 'setting', 'element'] },
300
+ relationship: { type: 'string', enum: ['uses', 'creates', 'updates', 'calls', 'contains', 'triggers'] },
301
+ note: { type: 'string' },
302
+ },
303
+ },
304
+ },
305
+ decisions: {
306
+ type: 'array',
307
+ description: 'Context: Design decisions made',
308
+ items: { type: 'string' },
309
+ },
389
310
  },
390
311
  required: ['uuid'],
391
312
  },
@@ -528,27 +449,7 @@ Use this to look up a route you created or to find existing routes in the projec
528
449
  },
529
450
  {
530
451
  name: 'save_route',
531
- description: `Update an existing route/page. Use this to wire a route to a controller method.
532
-
533
- IMPORTANT: This is how you connect API routes to controller methods!
534
- IMPORTANT: You MUST provide BOTH controller AND controller_method together - they are a pair.
535
-
536
- Example - Wire an API route to a controller method:
537
- {
538
- "uuid": "route-uuid",
539
- "controller": "controller-file-uuid",
540
- "controller_method": "method-uuid"
541
- }
542
-
543
- Available fields:
544
- - controller: UUID of the controller file (MUST be paired with controller_method)
545
- - controller_method: UUID of the method to execute (MUST be paired with controller)
546
- - path: URL path
547
- - name: Route name
548
- - type: "web" or "api"
549
- - method: HTTP method (GET, POST, PUT, DELETE, PATCH)
550
- - middleware: Array of middleware names
551
- - public: Whether the route is public (no auth required)`,
452
+ description: `Update a route/page. Wire to controller with both controller and controller_method UUIDs. For significant routes, include context fields.`,
552
453
  inputSchema: {
553
454
  type: 'object',
554
455
  properties: {
@@ -558,11 +459,11 @@ Available fields:
558
459
  },
559
460
  controller: {
560
461
  type: 'string',
561
- description: 'UUID of the controller file. MUST be provided together with controller_method.',
462
+ description: 'Controller file UUID. Requires controller_method.',
562
463
  },
563
464
  controller_method: {
564
465
  type: 'string',
565
- description: 'UUID of the method to execute. MUST be provided together with controller.',
466
+ description: 'Method UUID. Requires controller.',
566
467
  },
567
468
  path: {
568
469
  type: 'string',
@@ -575,21 +476,36 @@ Available fields:
575
476
  type: {
576
477
  type: 'string',
577
478
  enum: ['web', 'api'],
578
- description: 'Route type',
579
479
  },
580
480
  method: {
581
481
  type: 'string',
582
482
  enum: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
583
- description: 'HTTP method',
584
483
  },
585
484
  middleware: {
586
485
  type: 'array',
587
486
  items: { type: 'string' },
588
- description: 'Array of middleware names',
589
487
  },
590
488
  public: {
591
489
  type: 'boolean',
592
- description: 'Whether the route is public (no auth required)',
490
+ description: 'Public route (no auth)',
491
+ },
492
+ summary: {
493
+ type: 'string',
494
+ description: 'Context: What this endpoint does',
495
+ },
496
+ rationale: {
497
+ type: 'string',
498
+ description: 'Context: Why built this way',
499
+ },
500
+ references: {
501
+ type: 'array',
502
+ description: 'Context: Related entities [{uuid, type, relationship, note}]',
503
+ items: { type: 'object' },
504
+ },
505
+ decisions: {
506
+ type: 'array',
507
+ description: 'Context: Design decisions',
508
+ items: { type: 'string' },
593
509
  },
594
510
  },
595
511
  required: ['uuid'],
@@ -638,23 +554,7 @@ Use the returned UUID with html_to_elements (page parameter) or get_route for fu
638
554
  },
639
555
  {
640
556
  name: 'create_element',
641
- description: `Create a new UI element on a page (for Elements v2). Provide either page (route UUID) for root elements, or parent (element UUID) for child elements.
642
-
643
- Valid element types:
644
- - HTML5: s-wrapper, s-input, s-form, s-svg, s-shape, s-media, s-iframe
645
- - Components: s-loop, s-transition, s-freestyle, s-motion
646
- - Blade: s-directive
647
- - Shadcn/ui: s-chart, s-table, s-combobox, s-accordion, s-calendar, s-contiguous
648
-
649
- s-loop ELEMENT TYPE:
650
- Use s-loop for elements that should render with v-for directive.
651
- Required attributes (set via update_element after creation):
652
- - loop: The v-for expression (e.g., "note in notes", "item in items")
653
- - key: The :key binding (e.g., "note.id", "item.id")
654
-
655
- Example: After creating s-loop, update it with:
656
- { "tag": "div", "loop": "note in notes", "key": "note.id", "classes": ["card", "p-4"] }
657
- Generates: <div class="card p-4" v-for="note in notes" :key="note.id">`,
557
+ description: `Create a UI element. Provide page (route UUID) for root elements, or parent (element UUID) for children. Use s-loop for v-for elements.`,
658
558
  inputSchema: {
659
559
  type: 'object',
660
560
  properties: {
@@ -682,24 +582,7 @@ Generates: <div class="card p-4" v-for="note in notes" :key="note.id">`,
682
582
  },
683
583
  {
684
584
  name: 'update_element',
685
- description: `Update a UI element's attributes.
686
-
687
- Pass data object with: tag, classes (array), text, variable (for v-model), and event handlers.
688
-
689
- Key fields: inputType (not 'type') for button/input HTML type. clickArgs for handler arguments in v-for loops.
690
-
691
- EVENT HANDLERS - Use method UUIDs:
692
- { "click": "method-uuid" } → @click="methodName"
693
- { "click": "method-uuid", "clickArgs": "item" } → @click="methodName(item)"
694
-
695
- Create methods for all handlers, including simple state changes like opening modals or toggling flags.
696
-
697
- Event types: click, submit, change, input, focus, blur, keydown, keyup, mouseenter, mouseleave.
698
-
699
- EFFICIENCY - Prefer updates over delete/recreate:
700
- - Move between routes: change \`routeParent\` attribute
701
- - Reparent elements: change \`parent\` attribute
702
- - Reorder children: update parent's \`data\` array with new UUID order`,
585
+ description: `Update a UI element. Data object: tag, classes, text, event handlers (method UUIDs), classBindings. Include context for significant UI components.`,
703
586
  inputSchema: {
704
587
  type: 'object',
705
588
  properties: {
@@ -709,7 +592,7 @@ EFFICIENCY - Prefer updates over delete/recreate:
709
592
  },
710
593
  data: {
711
594
  type: 'object',
712
- description: 'Flat object with HTML attributes and Stellify fields (name, type, locked, tag, classes, text)',
595
+ description: 'HTML attributes and Stellify fields (tag, classes, text, classBindings, click, submit). Context fields: summary, rationale, references, decisions.',
713
596
  },
714
597
  },
715
598
  required: ['uuid', 'data'],
@@ -841,19 +724,7 @@ Prefer SVG icons over emoji (encoding issues).`,
841
724
  },
842
725
  {
843
726
  name: 'create_statement',
844
- description: `Create an empty statement in a file. This is step 1 of 2 - you MUST call add_statement_code next to add the actual code.
845
-
846
- **ALTERNATIVE:** Use create_statement_with_code for a single-call approach that combines both steps.
847
-
848
- IMPORTANT: This is a TWO-STEP process:
849
- 1. create_statement → returns statement UUID
850
- 2. add_statement_code → adds the actual code to that statement
851
-
852
- Use cases:
853
- - PHP: Class properties, use statements, constants
854
- - JS/Vue: Variable declarations, imports, reactive refs
855
-
856
- For Vue components, include the returned statement UUID in save_file's 'statements' array (NOT 'data' - that's for methods).`,
727
+ description: `Create empty statement (step 1 of 2). Call add_statement_code next. Prefer create_statement_with_code for single call.`,
857
728
  inputSchema: {
858
729
  type: 'object',
859
730
  properties: {
@@ -870,17 +741,7 @@ For Vue components, include the returned statement UUID in save_file's 'statemen
870
741
  },
871
742
  {
872
743
  name: 'create_statement_with_code',
873
- description: `Create a statement with code in a SINGLE call. This combines create_statement and add_statement_code.
874
-
875
- **PREFERRED:** Use this instead of the two-step create_statement → add_statement_code process.
876
-
877
- **Nested code is handled correctly.** The parser tracks brace/bracket/paren depth and only splits on top-level semicolons. Computed properties, arrow functions with block bodies, and other nested constructs are kept as single statements.
878
-
879
- Examples:
880
- - PHP: "use Illuminate\\Http\\Request;" or "private $items = [];"
881
- - JS/Vue: "const count = ref(0);" or "import { ref } from 'vue';"
882
-
883
- For Vue components, include the returned statement UUIDs in save_file's 'statements' array (NOT 'data' - that's for methods).`,
744
+ description: `Create a statement with code in one call. Preferred over two-step create_statement + add_statement_code.`,
884
745
  inputSchema: {
885
746
  type: 'object',
886
747
  properties: {
@@ -972,38 +833,9 @@ Examples:
972
833
  },
973
834
  {
974
835
  name: 'save_file',
975
- description: `Save/update a file with its full configuration. This FINALIZES the file after create_file.
976
-
977
- WORKFLOW: create_file creates an empty shell → add methods/statements → save_file wires everything together.
978
-
979
- IMPORTANT: This is a full replacement, not a partial update. To update an existing file:
980
- 1. Call get_file to fetch current state
981
- 2. Modify the returned object
982
- 3. Call save_file with the complete object
983
-
984
- Required fields: uuid, name, type
985
-
986
- IMPORTANT - data vs statements:
987
- - 'data' array = METHOD UUIDs only (functions)
988
- - 'statements' array = STATEMENT UUIDs (imports, variables, refs - code outside methods)
836
+ description: `Finalize a file. Full replacement - call get_file first to update existing files.
989
837
 
990
- Vue SFC example:
991
- save_file({
992
- uuid: fileUuid,
993
- name: "Counter",
994
- type: "js",
995
- extension: "vue",
996
- template: [rootElementUuid], // From html_to_elements
997
- data: [methodUuid], // Method UUIDs only
998
- statements: [importStmtUuid, refStmtUuid] // Statement UUIDs (imports, refs)
999
- })
1000
-
1001
- For <script setup> content, the order in statements array determines output order.
1002
-
1003
- DEPENDENCY RESOLUTION (includes array):
1004
- The 'includes' array accepts BOTH UUIDs and namespace strings.
1005
- Namespace strings (e.g., "Illuminate\\Http\\JsonResponse") are automatically resolved to UUIDs.
1006
- This works the same as create_file's dependency resolution.`,
838
+ Required: uuid, name, type. For significant changes, include context fields: summary, rationale, references, decisions.`,
1007
839
  inputSchema: {
1008
840
  type: 'object',
1009
841
  properties: {
@@ -1027,27 +859,45 @@ This works the same as create_file's dependency resolution.`,
1027
859
  template: {
1028
860
  type: 'array',
1029
861
  items: { type: 'string' },
1030
- description: 'Array of root element UUIDs for Vue <template> section (from html_to_elements)',
862
+ description: 'Root element UUIDs for Vue <template>',
1031
863
  },
1032
864
  data: {
1033
865
  type: 'array',
1034
866
  items: { type: 'string' },
1035
- description: 'Array of METHOD UUIDs only (functions created via create_method)',
867
+ description: 'Method UUIDs (from create_method)',
1036
868
  },
1037
869
  statements: {
1038
870
  type: 'array',
1039
871
  items: { type: 'string' },
1040
- description: 'Array of STATEMENT UUIDs (imports, variables, refs - created via create_statement)',
872
+ description: 'Statement UUIDs (imports, variables, refs)',
1041
873
  },
1042
874
  includes: {
1043
875
  type: 'array',
1044
876
  items: { type: 'string' },
1045
- description: 'Array of file UUIDs OR namespace strings for FRAMEWORK classes only (Request, JsonResponse, etc.). Do NOT put project models here - use the models array instead.',
877
+ description: 'Framework class UUIDs or namespaces. Use models array for project models.',
1046
878
  },
1047
879
  models: {
1048
880
  type: 'array',
1049
881
  items: { type: 'string' },
1050
- description: 'Array of model file UUIDs for PROJECT models (Feedback, Vote, etc.). These get sandbox namespace automatically. Do NOT also add these to includes or you will get duplicate use statement errors.',
882
+ description: 'Project model UUIDs (auto-namespaced). Do NOT duplicate in includes.',
883
+ },
884
+ summary: {
885
+ type: 'string',
886
+ description: 'Context: What this file does and why it exists',
887
+ },
888
+ rationale: {
889
+ type: 'string',
890
+ description: 'Context: Why it was built this way',
891
+ },
892
+ references: {
893
+ type: 'array',
894
+ description: 'Context: Related entities [{uuid, type, relationship, note}]',
895
+ items: { type: 'object' },
896
+ },
897
+ decisions: {
898
+ type: 'array',
899
+ description: 'Context: Design decisions',
900
+ items: { type: 'string' },
1051
901
  },
1052
902
  },
1053
903
  required: ['uuid', 'name', 'type'],
@@ -1184,15 +1034,7 @@ Changes are EPHEMERAL (not saved). For persistent changes, use update_element or
1184
1034
  },
1185
1035
  {
1186
1036
  name: 'create_resources',
1187
- description: `Scaffold Model, Controller, Service, and Migration in ONE operation.
1188
-
1189
- Creates: Model ($fillable, $casts, relationships), Controller (CRUD actions), Service (optional), Migration.
1190
-
1191
- IMPORTANT: Routes are NOT auto-wired. After creation, use create_route with the returned controller UUID and method UUIDs.
1192
-
1193
- IMPORTANT: After creation, check the controller methods for return types and parameter types. If methods use classes not already in includes (e.g., JsonResponse), add those class UUIDs to the controller's includes via save_file.
1194
-
1195
- Response includes controller.methods array with {uuid, name} for each action (index, store, update, destroy).`,
1037
+ description: `Scaffold Model, Controller, Service, and Migration. Routes are NOT auto-wired - use create_route after.`,
1196
1038
  inputSchema: {
1197
1039
  type: 'object',
1198
1040
  properties: {
@@ -1291,40 +1133,7 @@ Response includes controller.methods array with {uuid, name} for each action (in
1291
1133
  },
1292
1134
  {
1293
1135
  name: 'run_code',
1294
- description: `Execute a method in the Stellify project environment and return the output.
1295
-
1296
- This tool allows you to run methods you've created and see the results. Use this for:
1297
- - Testing methods you've created
1298
- - Verifying code behavior
1299
- - Debugging issues
1300
- - Getting real feedback on code execution
1301
-
1302
- REQUIRED: Both file and method UUIDs must be provided.
1303
-
1304
- EXAMPLES:
1305
-
1306
- Run a method:
1307
- {
1308
- "file": "file-uuid",
1309
- "method": "method-uuid",
1310
- "args": []
1311
- }
1312
-
1313
- Run with benchmarking enabled:
1314
- {
1315
- "file": "file-uuid",
1316
- "method": "method-uuid",
1317
- "benchmark": true
1318
- }
1319
-
1320
- RESPONSE includes:
1321
- - output: The return value or printed output
1322
- - success: Whether execution succeeded
1323
- - error: Error message if failed
1324
- - execution_time: Time taken (if benchmark enabled)
1325
- - memory_usage: Memory used (if benchmark enabled)
1326
-
1327
- SECURITY: Code runs in a sandboxed environment with limited permissions.`,
1136
+ description: `Execute a method in sandboxed environment. Requires file and method UUIDs. Returns output, success, error, and optional benchmark data.`,
1328
1137
  inputSchema: {
1329
1138
  type: 'object',
1330
1139
  properties: {
@@ -1355,18 +1164,7 @@ SECURITY: Code runs in a sandboxed environment with limited permissions.`,
1355
1164
  },
1356
1165
  {
1357
1166
  name: 'request_capability',
1358
- description: `Log a missing system-level capability request.
1359
-
1360
- Use this when you encounter a user requirement that needs framework-level functionality
1361
- that doesn't exist in Stellify. This creates a ticket in the Stellify backlog.
1362
-
1363
- DO NOT try to build system capabilities yourself - log them here instead.
1364
-
1365
- Examples of capability requests:
1366
- - "Need WebSocket support for real-time chat"
1367
- - "Need S3 file upload with signed URLs"
1368
- - "Need scheduled task runner for daily reports"
1369
- - "Need OAuth2 social login (Google, GitHub)"`,
1167
+ description: `Log a missing framework-level capability. Creates a ticket in the Stellify backlog.`,
1370
1168
  inputSchema: {
1371
1169
  type: 'object',
1372
1170
  properties: {
@@ -1397,33 +1195,7 @@ Examples of capability requests:
1397
1195
  },
1398
1196
  {
1399
1197
  name: 'analyze_performance',
1400
- description: `Analyze code execution performance from logs. Identifies slow methods, N+1 query patterns, high memory usage, and failure rates.
1401
-
1402
- Use this tool PROACTIVELY to:
1403
- - Review performance after creating new methods
1404
- - Identify optimization opportunities
1405
- - Detect N+1 query patterns (high query counts)
1406
- - Find methods that need caching or refactoring
1407
- - Check failure rates and error patterns
1408
-
1409
- ANALYSIS TYPES:
1410
- - full: Comprehensive report with all issues, recommendations, and statistics
1411
- - slow_methods: Methods exceeding 500ms execution time
1412
- - high_query_methods: Methods with >10 queries (potential N+1 problems)
1413
- - high_memory_methods: Methods using >50MB memory
1414
- - failure_rates: Methods with high error rates
1415
- - trend: Performance trend over time (daily averages)
1416
-
1417
- EXAMPLE - Full analysis:
1418
- { "type": "full", "days": 7 }
1419
-
1420
- EXAMPLE - Check for N+1 queries:
1421
- { "type": "high_query_methods", "limit": 10 }
1422
-
1423
- The response includes actionable recommendations like:
1424
- - "Consider eager loading relationships" for N+1 patterns
1425
- - "Add database indexes" for slow queries
1426
- - "Use chunking" for high memory usage`,
1198
+ description: `Analyze execution performance from logs. Types: full, slow_methods, high_query_methods, high_memory_methods, failure_rates, trend.`,
1427
1199
  inputSchema: {
1428
1200
  type: 'object',
1429
1201
  properties: {
@@ -1445,32 +1217,7 @@ The response includes actionable recommendations like:
1445
1217
  },
1446
1218
  {
1447
1219
  name: 'analyze_quality',
1448
- description: `Analyze Laravel code structure for quality issues. Detects missing relationships, fillables, casts, and route problems.
1449
-
1450
- Use this tool PROACTIVELY to:
1451
- - Review code quality after creating models or controllers
1452
- - Detect missing Eloquent relationships (belongsTo, hasMany)
1453
- - Find migration fields not in $fillable
1454
- - Suggest type casts for columns (json → array, datetime → datetime)
1455
- - Identify broken route bindings (orphaned methods, missing controllers)
1456
-
1457
- ANALYSIS TYPES:
1458
- - full: Comprehensive analysis of all categories with recommendations
1459
- - relationships: Missing belongsTo/hasMany based on foreign keys
1460
- - fillables: Migration fields not in Model $fillable array
1461
- - casts: Columns that should have type casts
1462
- - routes: Orphaned controller methods, routes pointing to missing methods
1463
-
1464
- EXAMPLE - Full analysis:
1465
- { "type": "full" }
1466
-
1467
- EXAMPLE - Check relationships only:
1468
- { "type": "relationships" }
1469
-
1470
- The response includes actionable suggestions like:
1471
- - "Add belongsTo relationship: public function user() { return $this->belongsTo(User::class); }"
1472
- - "Add 'published_at' to $fillable array"
1473
- - "Add cast: 'metadata' => 'array'"`,
1220
+ description: `Analyze Laravel code for quality issues. Types: full, relationships, fillables, casts, routes. Returns actionable suggestions.`,
1474
1221
  inputSchema: {
1475
1222
  type: 'object',
1476
1223
  properties: {
@@ -1484,27 +1231,7 @@ The response includes actionable suggestions like:
1484
1231
  },
1485
1232
  {
1486
1233
  name: 'get_setting',
1487
- description: `Get a setting/config value from the tenant's settings table.
1488
-
1489
- These settings are read by the config() function in sandbox code execution.
1490
- Use this to check existing configuration values before modifying them.
1491
-
1492
- EXAMPLE:
1493
- { "name": "app" }
1494
-
1495
- Returns the setting data as key-value pairs, e.g.:
1496
- {
1497
- "name": "My App",
1498
- "timezone": "UTC",
1499
- "locale": "en"
1500
- }
1501
-
1502
- Common setting profiles:
1503
- - "app": Application settings (name, timezone, locale)
1504
- - "database": Database connection settings
1505
- - "mail": Mail configuration
1506
- - "cache": Cache settings
1507
- - Custom profiles for app-specific config`,
1234
+ description: `Get a setting profile by name. Returns key-value pairs accessible via config() in code.`,
1508
1235
  inputSchema: {
1509
1236
  type: 'object',
1510
1237
  properties: {
@@ -1518,38 +1245,7 @@ Common setting profiles:
1518
1245
  },
1519
1246
  {
1520
1247
  name: 'save_setting',
1521
- description: `Create or update a setting in the tenant's settings table.
1522
-
1523
- These settings are accessible via config() in sandbox code execution.
1524
- Use this to configure application behavior, API keys, feature flags, etc.
1525
-
1526
- IMPORTANT: This creates or updates the setting profile with the provided key-value data.
1527
- The data is merged with any existing values for that profile.
1528
-
1529
- EXAMPLE - Create app settings:
1530
- {
1531
- "name": "app",
1532
- "data": {
1533
- "name": "My Feedback App",
1534
- "timezone": "America/New_York",
1535
- "locale": "en"
1536
- }
1537
- }
1538
-
1539
- EXAMPLE - Create custom settings for voting:
1540
- {
1541
- "name": "vote",
1542
- "data": {
1543
- "salt": "my-secret-salt-for-ip-hashing",
1544
- "allow_anonymous": true,
1545
- "max_votes_per_day": 10
1546
- }
1547
- }
1548
-
1549
- In your controller code, access these with:
1550
- - config('app.name') returns "My Feedback App"
1551
- - config('vote.salt') returns "my-secret-salt-for-ip-hashing"
1552
- - config('vote.allow_anonymous') returns true`,
1248
+ description: `Create or update a setting profile. Data is merged with existing values. Access via config('name.key') in code.`,
1553
1249
  inputSchema: {
1554
1250
  type: 'object',
1555
1251
  properties: {
@@ -1587,6 +1283,71 @@ This removes the "vote" setting profile entirely.`,
1587
1283
  required: ['name'],
1588
1284
  },
1589
1285
  },
1286
+ {
1287
+ name: 'get_pattern',
1288
+ description: `Get a UI pattern checklist (accordion, modal, tabs, dropdown, toast). Returns best practices and common pitfalls.`,
1289
+ inputSchema: {
1290
+ type: 'object',
1291
+ properties: {
1292
+ name: {
1293
+ type: 'string',
1294
+ description: 'Pattern name (e.g., "accordion", "modal", "tabs", "dropdown", "toast")',
1295
+ },
1296
+ },
1297
+ required: ['name'],
1298
+ },
1299
+ },
1300
+ {
1301
+ name: 'save_pattern',
1302
+ description: `Save or update a UI pattern checklist.
1303
+
1304
+ Use this to add new patterns or update existing ones based on lessons learned.
1305
+
1306
+ EXAMPLE:
1307
+ {
1308
+ "name": "accordion",
1309
+ "description": "Collapsible content panels",
1310
+ "checklist": [
1311
+ "Use v-show for visibility toggle",
1312
+ "Store open state as boolean"
1313
+ ],
1314
+ "example": "const panels = ref([...]);"
1315
+ }`,
1316
+ inputSchema: {
1317
+ type: 'object',
1318
+ properties: {
1319
+ name: {
1320
+ type: 'string',
1321
+ description: 'Pattern name (e.g., "accordion", "modal")',
1322
+ },
1323
+ description: {
1324
+ type: 'string',
1325
+ description: 'Brief description of the pattern',
1326
+ },
1327
+ checklist: {
1328
+ type: 'array',
1329
+ items: { type: 'string' },
1330
+ description: 'Array of checklist items - best practices and things to remember',
1331
+ },
1332
+ example: {
1333
+ type: 'string',
1334
+ description: 'Optional code example',
1335
+ },
1336
+ },
1337
+ required: ['name', 'description', 'checklist'],
1338
+ },
1339
+ },
1340
+ {
1341
+ name: 'list_patterns',
1342
+ description: `List all available UI pattern checklists.
1343
+
1344
+ Returns an array of pattern names and descriptions.
1345
+ Use this to discover what patterns are available before building UI components.`,
1346
+ inputSchema: {
1347
+ type: 'object',
1348
+ properties: {},
1349
+ },
1350
+ },
1590
1351
  ];
1591
1352
  // Server instructions for tool discovery (used by MCP Tool Search)
1592
1353
  const SERVER_INSTRUCTIONS = `Stellify is a coding platform where you code alongside AI on a codebase maintained and curated by AI. Build Laravel, stellify-framework, and Vue.js applications.
@@ -1667,10 +1428,10 @@ notes.value = response.data || [];
1667
1428
 
1668
1429
  - **@click auto-wiring:** Pass the file UUID to html_to_elements to auto-wire @click handlers. Methods must be created BEFORE calling html_to_elements.
1669
1430
  - **Stellify imports:** Use "stellify-framework" package (NOT @stellify/core)
1670
- CORRECT: import { Http, List, Form } from 'stellify-framework';
1431
+ CORRECT: import { Http, Collection, Form } from 'stellify-framework';
1671
1432
  WRONG: import { Http } from '@stellify/core';
1672
1433
  - v-model requires ref(), NOT Form class: const formData = ref({title: ''})
1673
- - List is iterable and works directly with v-for (no .toArray() needed)
1434
+ - Collection is iterable and works directly with v-for (no .toArray() needed)
1674
1435
  - add_method_body APPENDS, doesn't replace - create new method to replace
1675
1436
  - 'data' array = method UUIDs, 'statements' array = import/variable UUIDs
1676
1437
  - For buttons in forms, set inputType: "button" to prevent auto-submit
@@ -1699,11 +1460,29 @@ Vue evaluates v-model bindings before v-else is applied, causing "Cannot read pr
1699
1460
  When you create a Vue component, **app.js is automatically created/updated** with component registration. The create_file response will confirm this with an \`appJs\` field.
1700
1461
 
1701
1462
  **Page mount point:** Each page using Vue needs \`<div id="app"></div>\`:
1702
- - html_to_elements(page=routeUuid, elements='<div id="app"></div>')`;
1463
+ - html_to_elements(page=routeUuid, elements='<div id="app"></div>')
1464
+
1465
+ ## Context Documentation
1466
+
1467
+ Add context fields to significant changes (methods, files, routes, elements) to help future AI sessions understand the application.
1468
+
1469
+ **When to add context:** New features, significant changes, multi-entity implementations.
1470
+ **Skip context for:** Trivial changes, temporary code, unchanged context.
1471
+
1472
+ **Context fields** (flat in data object, used with save_method, save_file, save_route, update_element):
1473
+ - \`summary\`: What this does
1474
+ - \`rationale\`: Why it was built this way
1475
+ - \`references\`: [{uuid, type, relationship, note}] - links to related entities
1476
+ - \`decisions\`: Array of design decisions
1477
+
1478
+ Reference types: model, route, method, file, setting, element
1479
+ Relationships: uses, creates, updates, calls, contains, triggers
1480
+
1481
+ Context is preserved across updates - the backend merges fields.`;
1703
1482
  // Create MCP server
1704
1483
  const server = new Server({
1705
1484
  name: 'stellify-mcp',
1706
- version: '0.1.28',
1485
+ version: '0.1.30',
1707
1486
  }, {
1708
1487
  capabilities: {
1709
1488
  tools: {},
@@ -2527,20 +2306,83 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2527
2306
  ],
2528
2307
  };
2529
2308
  }
2309
+ case 'get_pattern': {
2310
+ const result = await stellify.getPattern(args.name);
2311
+ return {
2312
+ content: [
2313
+ {
2314
+ type: 'text',
2315
+ text: JSON.stringify({
2316
+ success: true,
2317
+ pattern: result.data || result,
2318
+ }, null, 2),
2319
+ },
2320
+ ],
2321
+ };
2322
+ }
2323
+ case 'save_pattern': {
2324
+ const { name, description, checklist, example } = args;
2325
+ await stellify.savePattern(name, { description, checklist, example });
2326
+ return {
2327
+ content: [
2328
+ {
2329
+ type: 'text',
2330
+ text: JSON.stringify({
2331
+ success: true,
2332
+ message: `Saved pattern "${name}" with ${checklist.length} checklist items`,
2333
+ }, null, 2),
2334
+ },
2335
+ ],
2336
+ };
2337
+ }
2338
+ case 'list_patterns': {
2339
+ const result = await stellify.listPatterns();
2340
+ return {
2341
+ content: [
2342
+ {
2343
+ type: 'text',
2344
+ text: JSON.stringify({
2345
+ success: true,
2346
+ patterns: result.data || result,
2347
+ }, null, 2),
2348
+ },
2349
+ ],
2350
+ };
2351
+ }
2530
2352
  default:
2531
2353
  throw new Error(`Unknown tool: ${name}`);
2532
2354
  }
2533
2355
  }
2534
2356
  catch (error) {
2357
+ // Extract backend response data for better error messages
2358
+ const backendData = error.response?.data;
2359
+ const statusCode = error.response?.status;
2360
+ // Build a helpful error response
2361
+ const errorResponse = {
2362
+ success: false,
2363
+ error: backendData?.message || error.message || 'Request failed',
2364
+ };
2365
+ // Include hint if the backend provided one
2366
+ if (backendData?.hint) {
2367
+ errorResponse.hint = backendData.hint;
2368
+ }
2369
+ // Include validation errors if present
2370
+ if (backendData?.errors) {
2371
+ errorResponse.validation_errors = backendData.errors;
2372
+ }
2373
+ // Include status code for context
2374
+ if (statusCode) {
2375
+ errorResponse.status = statusCode;
2376
+ }
2377
+ // Include the original message if different from backend message
2378
+ if (backendData?.message && error.message && !error.message.includes(backendData.message)) {
2379
+ errorResponse.details = { message: backendData.message };
2380
+ }
2535
2381
  return {
2536
2382
  content: [
2537
2383
  {
2538
2384
  type: 'text',
2539
- text: JSON.stringify({
2540
- success: false,
2541
- error: error.message,
2542
- details: error.response?.data || error.toString(),
2543
- }, null, 2),
2385
+ text: JSON.stringify(errorResponse, null, 2),
2544
2386
  },
2545
2387
  ],
2546
2388
  isError: true,
@@ -188,4 +188,11 @@ export declare class StellifyClient {
188
188
  saveSetting(name: string, data: Record<string, any>): Promise<any>;
189
189
  createSetting(name: string): Promise<any>;
190
190
  deleteSetting(name: string): Promise<any>;
191
+ getPattern(name: string): Promise<any>;
192
+ savePattern(name: string, data: {
193
+ description: string;
194
+ checklist: string[];
195
+ example?: string;
196
+ }): Promise<any>;
197
+ listPatterns(): Promise<any>;
191
198
  }
@@ -225,4 +225,17 @@ export class StellifyClient {
225
225
  const response = await this.client.delete(`/config/${name}`);
226
226
  return response.data;
227
227
  }
228
+ // UI Pattern checklists - best practices for common UI patterns
229
+ async getPattern(name) {
230
+ const response = await this.client.get(`/pattern/${name}`);
231
+ return response.data;
232
+ }
233
+ async savePattern(name, data) {
234
+ const response = await this.client.put(`/pattern/${name}`, data);
235
+ return response.data;
236
+ }
237
+ async listPatterns() {
238
+ const response = await this.client.get('/pattern');
239
+ return response.data;
240
+ }
228
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellisoft/stellify-mcp",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "mcpName": "io.github.MattStellisoft/stellify-mcp",
5
5
  "description": "MCP server for Stellify - AI-native code generation platform",
6
6
  "main": "dist/index.js",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/Stellify-Software-Ltd/stellify-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.1.28",
9
+ "version": "0.1.30",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@stellisoft/stellify-mcp",
14
- "version": "0.1.28",
14
+ "version": "0.1.30",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },