@stellisoft/stellify-mcp 0.1.30 → 0.1.31

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
@@ -89,7 +89,11 @@ const tools = [
89
89
  For PHP: type='class', 'model', 'controller', or 'middleware'.
90
90
  For Vue: type='js', extension='vue'. Auto-creates app.js and template route.
91
91
 
92
- Pass 'includes' array for framework class dependencies (auto-resolved to UUIDs). Use 'models' array in save_file for project models.`,
92
+ Pass 'includes' array for framework class dependencies (auto-resolved to UUIDs). Use 'models' array in save_file for project models.
93
+
94
+ **IMPORTANT - Check appJs response for Vue components:**
95
+ - If \`appJs.action_required === "create_or_select_mount_file"\`: No mount file exists. You MUST ask the user if they want to create a new app.js mount file before proceeding.
96
+ - If \`appJs.action_required === "register_component"\`: Mount file exists but component isn't registered. Call save_file on the mount file to add the component UUID to its includes array.`,
93
97
  inputSchema: {
94
98
  type: 'object',
95
99
  properties: {
@@ -515,7 +519,7 @@ Use this to look up a route you created or to find existing routes in the projec
515
519
  name: 'delete_route',
516
520
  description: `Delete a route/page from the project by UUID. This permanently removes the route.
517
521
 
518
- WARNING: This is destructive and cannot be undone. Any elements attached to this route will become orphaned.`,
522
+ WARNING: This is destructive and cannot be undone. Any elements attached to this route will be deleted also.`,
519
523
  inputSchema: {
520
524
  type: 'object',
521
525
  properties: {
@@ -563,8 +567,7 @@ Use the returned UUID with html_to_elements (page parameter) or get_route for fu
563
567
  enum: [
564
568
  's-wrapper', 's-input', 's-form', 's-svg', 's-shape', 's-media', 's-iframe',
565
569
  's-loop', 's-transition', 's-freestyle', 's-motion',
566
- 's-directive',
567
- 's-chart', 's-table', 's-combobox', 's-accordion', 's-calendar', 's-contiguous'
570
+ 's-directive'
568
571
  ],
569
572
  description: 'Element type - must be one of the valid Stellify element types',
570
573
  },
@@ -874,7 +877,7 @@ Required: uuid, name, type. For significant changes, include context fields: sum
874
877
  includes: {
875
878
  type: 'array',
876
879
  items: { type: 'string' },
877
- description: 'Framework class UUIDs or namespaces. Use models array for project models.',
880
+ description: 'File UUIDs for local imports (e.g., Vue components imported by app.js) AND framework class UUIDs/namespaces. CRITICAL: For JS mount files, add imported Vue component UUIDs here or they won\'t be bundled. Use models array for project models.',
878
881
  },
879
882
  models: {
880
883
  type: 'array',
@@ -1348,141 +1351,59 @@ Use this to discover what patterns are available before building UI components.`
1348
1351
  properties: {},
1349
1352
  },
1350
1353
  },
1354
+ {
1355
+ name: 'get_assembled_code',
1356
+ description: `Get the assembled source code for a file. Returns the actual Vue SFC or PHP class as it would be rendered.
1357
+
1358
+ Use this after save_file to verify the component was built correctly:
1359
+ - Check that all methods are included
1360
+ - Verify @click handlers are wired to methods
1361
+ - Confirm imports and reactive state are present
1362
+ - Spot any missing pieces before deployment`,
1363
+ inputSchema: {
1364
+ type: 'object',
1365
+ properties: {
1366
+ uuid: {
1367
+ type: 'string',
1368
+ description: 'UUID of the file to get assembled code for',
1369
+ },
1370
+ },
1371
+ required: ['uuid'],
1372
+ },
1373
+ },
1351
1374
  ];
1352
1375
  // Server instructions for tool discovery (used by MCP Tool Search)
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.
1354
-
1355
- Use Stellify tools when:
1356
- - Building PHP controllers, models, middleware, or classes
1357
- - Creating Vue.js components with reactive state and UI
1358
- - Managing UI elements (HTML stored as structured JSON)
1359
- - Working with a Stellify project (user will mention "Stellify" or provide project UUID)
1360
-
1361
- Key concepts:
1362
- - Code is stored as structured JSON, enabling surgical AI edits at the statement level
1363
- - Files contain methods and statements (code outside methods)
1364
- - Vue components link to UI elements via the 'template' field
1365
- - Event handlers (click, submit) wire UI elements to methods by UUID
1366
-
1367
- ## General Workflow (all file types)
1368
-
1369
- 1. create_file → empty shell, returns file UUID
1370
- 2. create_method → signature only, returns method UUID
1371
- 3. add_method_body → implementation code
1372
- 4. create_statement + add_statement_code → for imports, variables, refs
1373
- 5. save_file → finalize with template/data/statements arrays
1374
-
1375
- ## Vue Component Workflow
1376
-
1377
- 1. get_project → find 'js' directory UUID (or create it)
1378
- 2. create_file → type='js', extension='vue' for the component
1379
- - **Auto-creates app.js** and **template route** (check response for appJs and templateRoute fields)
1380
- 3. Create statements for imports using **create_statement_with_code** (ONE call each):
1381
- - create_statement_with_code(file, "import { ref, onMounted } from 'vue';")
1382
- - create_statement_with_code(file, "import { Http } from 'stellify-framework';")
1383
- 4. Create statements for reactive data: create_statement_with_code(file, "const notes = ref([]);")
1384
- 5. **create_method with body** (async auto-detected from \`await\`). Example:
1385
- \`\`\`
1386
- create_method({
1387
- file: fileUuid,
1388
- name: "fetchNotes",
1389
- body: "const response = await Http.get('/api/notes');\\nnotes.value = response.data || [];"
1390
- })
1391
- \`\`\`
1392
- 6. Create statement for onMounted: create_statement_with_code(file, "onMounted(fetchData);")
1393
- 7. **Create UI interaction methods** for any button that changes state:
1394
- \`\`\`
1395
- create_method({ file: fileUuid, name: "openModal", body: "showModal.value = true;" })
1396
- create_method({ file: fileUuid, name: "closeModal", body: "showModal.value = false;" })
1397
- \`\`\`
1398
- 8. html_to_elements with @click handlers auto-wired:
1399
- \`\`\`
1400
- html_to_elements({
1401
- elements: '<button @click="openModal">Open</button>',
1402
- page: templateRoute.uuid,
1403
- file: fileUuid // Auto-wires @click="openModal" to the method UUID
1404
- })
1405
- \`\`\`
1406
- 9. save_file with: extension='vue', template=[elementUuid], data=[methodUuids], statements=[importUuids, refUuids, onMountedUuid]
1407
- 11. Create web route for the display page (e.g., "/notes")
1408
- 12. Add \`<div id="app"></div>\` to the display page: html_to_elements(page=routeUuid, elements='<div id="app"></div>')
1409
-
1410
- ## Fetching Paginated Data
1411
-
1412
- Use \`Http.items()\` for paginated endpoints - it auto-extracts the array from Laravel responses:
1413
-
1414
- \`\`\`javascript
1415
- // Recommended - auto-extracts .data from paginated response
1416
- notes.value = await Http.items('/api/notes');
1376
+ const SERVER_INSTRUCTIONS = `Stellify is a coding platform where code is stored as structured JSON in a database, enabling surgical AI edits. Build Laravel (PHP) applications with StellifyJS (a front-end Laravel extension framework that has adaptors for reactive frameworks such as Vue, React and library wrappers for chart.js etc.).
1417
1377
 
1418
- // Alternative - manual extraction
1419
- const response = await Http.get('/api/notes');
1420
- notes.value = response.data || [];
1421
- \`\`\`
1378
+ ## Architecture
1422
1379
 
1423
- ## Editing Existing Code
1380
+ - Files are stored as json. The json has a data key that references its methods (using uuids), and each method has a data key that references statements, and each statement has a data key that references clauses.
1424
1381
 
1425
- - **Edit at the right level:** To change code, edit the statement or clause - never delete an entire method just to change a line.
1382
+ ## Example Workflow
1383
+ 1. Research: Call the get_project tool to understand the current project structure, existing files, and directories. This helps avoid duplicates and informs where to create new files.
1384
+ 2. Plan: If the user is in plan mode, create a plan and prompt the user to accept before starting.
1385
+ 3. Execute: Map out the solution in full before calling any tools. Use the tools to verify assumptions and gather information about the project as needed.
1386
+ 4. Create: create_file, create_method (with body), create_statement_with_code
1387
+ 5. Wire: html_to_elements (pass file UUID to auto-wire @click handlers)
1388
+ 6. Finalize: save_file with template/data/statements arrays
1389
+ 7. Verify: Call \`get_assembled_code\` to see the actual rendered output and fix any issues
1390
+ 8. Test: Use run_code to execute methods and verify behavior. For UI components, use broadcast_element_command to demonstrate functionality in real-time.
1426
1391
 
1427
- ## Common Pitfalls
1392
+ ## Component Response Handling (IMPORTANT)
1428
1393
 
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.
1430
- - **Stellify imports:** Use "stellify-framework" package (NOT @stellify/core)
1431
- CORRECT: import { Http, Collection, Form } from 'stellify-framework';
1432
- WRONG: import { Http } from '@stellify/core';
1433
- - v-model requires ref(), NOT Form class: const formData = ref({title: ''})
1434
- - Collection is iterable and works directly with v-for (no .toArray() needed)
1435
- - add_method_body APPENDS, doesn't replace - create new method to replace
1436
- - 'data' array = method UUIDs, 'statements' array = import/variable UUIDs
1437
- - For buttons in forms, set inputType: "button" to prevent auto-submit
1438
- - **Async methods:** Auto-detected when body contains \`await\`. Response includes \`is_async: true\` if detected.
1439
- - **onMounted:** Use direct method reference: "onMounted(fetchNotes);"
1440
- The assembler automatically outputs lifecycle hooks after method definitions.
1394
+ When creating Vue/ React etc. components, ALWAYS check the \`appJs\` field in the response:
1441
1395
 
1442
- ## Nullable Refs: Use explicit v-if, NOT v-else
1396
+ 1. **appJs.action_required === "create_or_select_mount_file"**: No mount file exists. You MUST immediately ask the user: "Would you like me to create an app.js mount file for this component?" Do NOT proceed without user confirmation.
1443
1397
 
1444
- When using nullable refs (e.g., \`const editingItem = ref(null)\`) with v-model, use explicit v-if guards:
1445
- - WRONG: \`<template v-else><input v-model="editingItem.title"/></template>\`
1446
- - CORRECT: \`<template v-if="editingItem && editingItem.id === item.id"><input v-model="editingItem.title"/></template>\`
1398
+ 2. **appJs.action_required === "register_component"**: Mount file exists but component isn't registered. Call save_file on the mount file (appJs.uuid) to add the component UUID to its includes array.
1447
1399
 
1448
- Vue evaluates v-model bindings before v-else is applied, causing "Cannot read properties of null" errors.
1449
-
1450
- ## Stack and Business Logic
1451
-
1452
- **Default stack:** Laravel (PHP), stellify-framework (JS), and Vue.js. Available capabilities (optional packages/libraries) are returned by \`get_project\`. Use \`get_stellify_framework_api\` for the stellify-framework API reference.
1453
-
1454
- **All business logic** (controllers, models, middleware, etc.) goes in the tenant DB via MCP tools. If a required capability is not available, use \`request_capability\` to log it.
1455
-
1456
- **Prefer Laravel methods:** When Laravel provides a helper (Str, Arr, Hash, Number, Collection), use it instead of native PHP functions.
1457
-
1458
- ## JavaScript Entry File (app.js) - Auto-Generated
1459
-
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.
1461
-
1462
- **Page mount point:** Each page using Vue needs \`<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.`;
1400
+ 3. **No action_required**: Component is already registered in a mount file. Proceed normally.
1401
+ `;
1402
+ // Legacy detailed instructions preserved as comments for reference if needed
1482
1403
  // Create MCP server
1483
1404
  const server = new Server({
1484
1405
  name: 'stellify-mcp',
1485
- version: '0.1.30',
1406
+ version: '0.1.31',
1486
1407
  }, {
1487
1408
  capabilities: {
1488
1409
  tools: {},
@@ -2349,6 +2270,20 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2349
2270
  ],
2350
2271
  };
2351
2272
  }
2273
+ case 'get_assembled_code': {
2274
+ const result = await stellify.getAssembledCode(args.uuid);
2275
+ // Return just the code content for easy reading
2276
+ const code = result.files?.[0]?.content || result.data?.code || 'No code available';
2277
+ const fileName = result.files?.[0]?.path || result.entryPoint || 'unknown';
2278
+ return {
2279
+ content: [
2280
+ {
2281
+ type: 'text',
2282
+ text: `// ${fileName}\n\n${code}`,
2283
+ },
2284
+ ],
2285
+ };
2286
+ }
2352
2287
  default:
2353
2288
  throw new Error(`Unknown tool: ${name}`);
2354
2289
  }
@@ -195,4 +195,5 @@ export declare class StellifyClient {
195
195
  example?: string;
196
196
  }): Promise<any>;
197
197
  listPatterns(): Promise<any>;
198
+ getAssembledCode(uuid: string): Promise<any>;
198
199
  }
@@ -238,4 +238,9 @@ export class StellifyClient {
238
238
  const response = await this.client.get('/pattern');
239
239
  return response.data;
240
240
  }
241
+ // Code Assembly - get rendered source code for a file
242
+ async getAssembledCode(uuid) {
243
+ const response = await this.client.get(`/file/${uuid}/source`);
244
+ return response.data;
245
+ }
241
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellisoft/stellify-mcp",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
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.30",
9
+ "version": "0.1.31",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@stellisoft/stellify-mcp",
14
- "version": "0.1.30",
14
+ "version": "0.1.31",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  },