@stellisoft/stellify-mcp 0.1.8 → 0.1.11
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 +211 -28
- package/dist/stellify-client.d.ts +23 -0
- package/dist/stellify-client.js +9 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1058,43 +1058,176 @@ For PERSISTENT changes (saved to database), use update_element or html_to_elemen
|
|
|
1058
1058
|
required: ['action'],
|
|
1059
1059
|
},
|
|
1060
1060
|
},
|
|
1061
|
+
{
|
|
1062
|
+
name: 'create_resources',
|
|
1063
|
+
description: `Scaffold a complete resource stack in ONE operation. Creates Model, Controller, Service, and Migration together.
|
|
1064
|
+
|
|
1065
|
+
This is the FASTEST way to bootstrap new features! Instead of 20+ individual API calls, create everything at once.
|
|
1066
|
+
|
|
1067
|
+
WHAT IT CREATES:
|
|
1068
|
+
- Model: With $fillable, $casts, and relationship methods
|
|
1069
|
+
- Controller: With index, store, show, update, destroy actions
|
|
1070
|
+
- Service (optional): Business logic layer with list, find, create, update, delete methods
|
|
1071
|
+
- Migration: With proper column types based on field definitions
|
|
1072
|
+
|
|
1073
|
+
EXAMPLE - Create a User resource:
|
|
1074
|
+
{
|
|
1075
|
+
"name": "User",
|
|
1076
|
+
"fields": [
|
|
1077
|
+
{ "name": "name", "type": "string" },
|
|
1078
|
+
{ "name": "email", "type": "string", "unique": true },
|
|
1079
|
+
{ "name": "password", "type": "string" },
|
|
1080
|
+
{ "name": "is_active", "type": "boolean", "default": true }
|
|
1081
|
+
],
|
|
1082
|
+
"relationships": [
|
|
1083
|
+
{ "type": "hasMany", "model": "Post" }
|
|
1084
|
+
],
|
|
1085
|
+
"controller": true,
|
|
1086
|
+
"service": true,
|
|
1087
|
+
"migration": true
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
FIELD TYPES:
|
|
1091
|
+
- string, text, longtext (text fields)
|
|
1092
|
+
- integer, int, bigint (numbers)
|
|
1093
|
+
- boolean, bool (true/false)
|
|
1094
|
+
- float, double, decimal (decimals)
|
|
1095
|
+
- date, datetime, timestamp (dates)
|
|
1096
|
+
- json (JSON/array data)
|
|
1097
|
+
- email (string with email validation)
|
|
1098
|
+
|
|
1099
|
+
FIELD OPTIONS:
|
|
1100
|
+
- nullable: Allow NULL values
|
|
1101
|
+
- unique: Add unique constraint
|
|
1102
|
+
- required: Require in validation (default: true for store)
|
|
1103
|
+
- default: Default value
|
|
1104
|
+
- max: Maximum length/value
|
|
1105
|
+
|
|
1106
|
+
RELATIONSHIP TYPES:
|
|
1107
|
+
- hasOne: One-to-one (User hasOne Profile)
|
|
1108
|
+
- hasMany: One-to-many (User hasMany Posts)
|
|
1109
|
+
- belongsTo: Inverse of hasOne/hasMany (Post belongsTo User)
|
|
1110
|
+
- belongsToMany: Many-to-many (User belongsToMany Roles)
|
|
1111
|
+
|
|
1112
|
+
Returns UUIDs for all created files so you can customize them further if needed.`,
|
|
1113
|
+
inputSchema: {
|
|
1114
|
+
type: 'object',
|
|
1115
|
+
properties: {
|
|
1116
|
+
name: {
|
|
1117
|
+
type: 'string',
|
|
1118
|
+
description: 'Resource name in PascalCase (e.g., "User", "BlogPost", "OrderItem")',
|
|
1119
|
+
},
|
|
1120
|
+
fields: {
|
|
1121
|
+
type: 'array',
|
|
1122
|
+
description: 'Array of field definitions for the model and migration',
|
|
1123
|
+
items: {
|
|
1124
|
+
type: 'object',
|
|
1125
|
+
properties: {
|
|
1126
|
+
name: {
|
|
1127
|
+
type: 'string',
|
|
1128
|
+
description: 'Field name in snake_case (e.g., "first_name", "is_active")',
|
|
1129
|
+
},
|
|
1130
|
+
type: {
|
|
1131
|
+
type: 'string',
|
|
1132
|
+
enum: ['string', 'integer', 'int', 'bigint', 'boolean', 'bool', 'float', 'double', 'decimal', 'date', 'datetime', 'timestamp', 'text', 'longtext', 'json', 'email'],
|
|
1133
|
+
description: 'Field data type',
|
|
1134
|
+
},
|
|
1135
|
+
nullable: {
|
|
1136
|
+
type: 'boolean',
|
|
1137
|
+
description: 'Allow NULL values (default: false)',
|
|
1138
|
+
},
|
|
1139
|
+
unique: {
|
|
1140
|
+
type: 'boolean',
|
|
1141
|
+
description: 'Add unique constraint (default: false)',
|
|
1142
|
+
},
|
|
1143
|
+
required: {
|
|
1144
|
+
type: 'boolean',
|
|
1145
|
+
description: 'Require in validation for store action (default: true)',
|
|
1146
|
+
},
|
|
1147
|
+
default: {
|
|
1148
|
+
description: 'Default value for the field',
|
|
1149
|
+
},
|
|
1150
|
+
max: {
|
|
1151
|
+
type: 'integer',
|
|
1152
|
+
description: 'Maximum length/value for validation',
|
|
1153
|
+
},
|
|
1154
|
+
},
|
|
1155
|
+
required: ['name'],
|
|
1156
|
+
},
|
|
1157
|
+
},
|
|
1158
|
+
relationships: {
|
|
1159
|
+
type: 'array',
|
|
1160
|
+
description: 'Array of relationship definitions',
|
|
1161
|
+
items: {
|
|
1162
|
+
type: 'object',
|
|
1163
|
+
properties: {
|
|
1164
|
+
type: {
|
|
1165
|
+
type: 'string',
|
|
1166
|
+
enum: ['hasOne', 'hasMany', 'belongsTo', 'belongsToMany'],
|
|
1167
|
+
description: 'Relationship type',
|
|
1168
|
+
},
|
|
1169
|
+
model: {
|
|
1170
|
+
type: 'string',
|
|
1171
|
+
description: 'Related model name in PascalCase',
|
|
1172
|
+
},
|
|
1173
|
+
name: {
|
|
1174
|
+
type: 'string',
|
|
1175
|
+
description: 'Custom method name (defaults to camelCase of model)',
|
|
1176
|
+
},
|
|
1177
|
+
},
|
|
1178
|
+
required: ['type', 'model'],
|
|
1179
|
+
},
|
|
1180
|
+
},
|
|
1181
|
+
controller: {
|
|
1182
|
+
type: 'boolean',
|
|
1183
|
+
description: 'Create controller with CRUD actions (default: true)',
|
|
1184
|
+
},
|
|
1185
|
+
service: {
|
|
1186
|
+
type: 'boolean',
|
|
1187
|
+
description: 'Create service class for business logic (default: false)',
|
|
1188
|
+
},
|
|
1189
|
+
migration: {
|
|
1190
|
+
type: 'boolean',
|
|
1191
|
+
description: 'Create database migration (default: true)',
|
|
1192
|
+
},
|
|
1193
|
+
routes: {
|
|
1194
|
+
type: 'boolean',
|
|
1195
|
+
description: 'Create API routes (default: true)',
|
|
1196
|
+
},
|
|
1197
|
+
soft_deletes: {
|
|
1198
|
+
type: 'boolean',
|
|
1199
|
+
description: 'Add soft delete support to model and migration (default: false)',
|
|
1200
|
+
},
|
|
1201
|
+
api: {
|
|
1202
|
+
type: 'boolean',
|
|
1203
|
+
description: 'Generate API-style responses (default: true)',
|
|
1204
|
+
},
|
|
1205
|
+
},
|
|
1206
|
+
required: ['name'],
|
|
1207
|
+
},
|
|
1208
|
+
},
|
|
1061
1209
|
{
|
|
1062
1210
|
name: 'run_code',
|
|
1063
|
-
description: `Execute
|
|
1211
|
+
description: `Execute a method in the Stellify project environment and return the output.
|
|
1064
1212
|
|
|
1065
|
-
This tool allows you to run
|
|
1213
|
+
This tool allows you to run methods you've created and see the results. Use this for:
|
|
1066
1214
|
- Testing methods you've created
|
|
1067
1215
|
- Verifying code behavior
|
|
1068
|
-
- Running artisan commands
|
|
1069
1216
|
- Debugging issues
|
|
1070
1217
|
- Getting real feedback on code execution
|
|
1071
1218
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
1. Run a specific method by UUID:
|
|
1075
|
-
{ file: "file-uuid", method: "method-uuid", args: ["arg1", "arg2"] }
|
|
1076
|
-
|
|
1077
|
-
2. Run arbitrary PHP code:
|
|
1078
|
-
{ code: "return 1 + 1;" }
|
|
1079
|
-
|
|
1080
|
-
3. Run with benchmarking enabled:
|
|
1081
|
-
{ file: "file-uuid", method: "method-uuid", benchmark: true }
|
|
1219
|
+
REQUIRED: Both file and method UUIDs must be provided.
|
|
1082
1220
|
|
|
1083
1221
|
EXAMPLES:
|
|
1084
1222
|
|
|
1085
|
-
Run a
|
|
1223
|
+
Run a method:
|
|
1086
1224
|
{
|
|
1087
|
-
"file": "
|
|
1088
|
-
"method": "
|
|
1225
|
+
"file": "file-uuid",
|
|
1226
|
+
"method": "method-uuid",
|
|
1089
1227
|
"args": []
|
|
1090
1228
|
}
|
|
1091
1229
|
|
|
1092
|
-
|
|
1093
|
-
{
|
|
1094
|
-
"code": "return collect([1, 2, 3])->sum();"
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
Test with benchmark timing:
|
|
1230
|
+
Run with benchmarking enabled:
|
|
1098
1231
|
{
|
|
1099
1232
|
"file": "file-uuid",
|
|
1100
1233
|
"method": "method-uuid",
|
|
@@ -1114,15 +1247,11 @@ SECURITY: Code runs in a sandboxed environment with limited permissions.`,
|
|
|
1114
1247
|
properties: {
|
|
1115
1248
|
file: {
|
|
1116
1249
|
type: 'string',
|
|
1117
|
-
description: 'UUID of the file containing the method to run',
|
|
1250
|
+
description: 'UUID of the file containing the method to run (required)',
|
|
1118
1251
|
},
|
|
1119
1252
|
method: {
|
|
1120
1253
|
type: 'string',
|
|
1121
|
-
description: 'UUID of the method to execute',
|
|
1122
|
-
},
|
|
1123
|
-
code: {
|
|
1124
|
-
type: 'string',
|
|
1125
|
-
description: 'Raw PHP/JS code to execute (alternative to file/method)',
|
|
1254
|
+
description: 'UUID of the method to execute (required)',
|
|
1126
1255
|
},
|
|
1127
1256
|
args: {
|
|
1128
1257
|
type: 'array',
|
|
@@ -1138,6 +1267,7 @@ SECURITY: Code runs in a sandboxed environment with limited permissions.`,
|
|
|
1138
1267
|
description: 'Enable benchmarking to measure execution time and memory usage',
|
|
1139
1268
|
},
|
|
1140
1269
|
},
|
|
1270
|
+
required: ['file', 'method'],
|
|
1141
1271
|
},
|
|
1142
1272
|
},
|
|
1143
1273
|
];
|
|
@@ -1709,6 +1839,59 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1709
1839
|
],
|
|
1710
1840
|
};
|
|
1711
1841
|
}
|
|
1842
|
+
case 'create_resources': {
|
|
1843
|
+
const result = await stellify.createResources(args);
|
|
1844
|
+
const data = result.data || result;
|
|
1845
|
+
const stats = data.statistics || {};
|
|
1846
|
+
// Build summary of what was created
|
|
1847
|
+
const created = [];
|
|
1848
|
+
if (data.model)
|
|
1849
|
+
created.push(`Model (${data.model.uuid})`);
|
|
1850
|
+
if (data.controller)
|
|
1851
|
+
created.push(`Controller (${data.controller.uuid})`);
|
|
1852
|
+
if (data.service)
|
|
1853
|
+
created.push(`Service (${data.service.uuid})`);
|
|
1854
|
+
if (data.migration)
|
|
1855
|
+
created.push(`Migration (${data.migration.uuid})`);
|
|
1856
|
+
return {
|
|
1857
|
+
content: [
|
|
1858
|
+
{
|
|
1859
|
+
type: 'text',
|
|
1860
|
+
text: JSON.stringify({
|
|
1861
|
+
success: true,
|
|
1862
|
+
message: `Created ${args.name} resource: ${created.join(', ')} (${stats.files || 0} files, ${stats.methods || 0} methods)`,
|
|
1863
|
+
data: {
|
|
1864
|
+
name: data.name,
|
|
1865
|
+
model: data.model ? {
|
|
1866
|
+
uuid: data.model.uuid,
|
|
1867
|
+
name: data.model.name,
|
|
1868
|
+
namespace: data.model.namespace,
|
|
1869
|
+
methods: data.model.methods,
|
|
1870
|
+
} : null,
|
|
1871
|
+
controller: data.controller ? {
|
|
1872
|
+
uuid: data.controller.uuid,
|
|
1873
|
+
name: data.controller.name,
|
|
1874
|
+
namespace: data.controller.namespace,
|
|
1875
|
+
methods: data.controller.methods,
|
|
1876
|
+
} : null,
|
|
1877
|
+
service: data.service ? {
|
|
1878
|
+
uuid: data.service.uuid,
|
|
1879
|
+
name: data.service.name,
|
|
1880
|
+
namespace: data.service.namespace,
|
|
1881
|
+
methods: data.service.methods,
|
|
1882
|
+
} : null,
|
|
1883
|
+
migration: data.migration ? {
|
|
1884
|
+
uuid: data.migration.uuid,
|
|
1885
|
+
name: data.migration.name,
|
|
1886
|
+
table: data.migration.table,
|
|
1887
|
+
} : null,
|
|
1888
|
+
statistics: stats,
|
|
1889
|
+
},
|
|
1890
|
+
}, null, 2),
|
|
1891
|
+
},
|
|
1892
|
+
],
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1712
1895
|
case 'run_code': {
|
|
1713
1896
|
const result = await stellify.runCode(args);
|
|
1714
1897
|
const benchmarkInfo = args.benchmark
|
|
@@ -148,6 +148,29 @@ export declare class StellifyClient {
|
|
|
148
148
|
changes: Record<string, any>;
|
|
149
149
|
}>;
|
|
150
150
|
}): Promise<any>;
|
|
151
|
+
createResources(params: {
|
|
152
|
+
name: string;
|
|
153
|
+
fields?: Array<{
|
|
154
|
+
name: string;
|
|
155
|
+
type?: string;
|
|
156
|
+
nullable?: boolean;
|
|
157
|
+
unique?: boolean;
|
|
158
|
+
required?: boolean;
|
|
159
|
+
default?: any;
|
|
160
|
+
max?: number;
|
|
161
|
+
}>;
|
|
162
|
+
relationships?: Array<{
|
|
163
|
+
type: 'hasOne' | 'hasMany' | 'belongsTo' | 'belongsToMany';
|
|
164
|
+
model: string;
|
|
165
|
+
name?: string;
|
|
166
|
+
}>;
|
|
167
|
+
controller?: boolean;
|
|
168
|
+
service?: boolean;
|
|
169
|
+
migration?: boolean;
|
|
170
|
+
routes?: boolean;
|
|
171
|
+
soft_deletes?: boolean;
|
|
172
|
+
api?: boolean;
|
|
173
|
+
}): Promise<any>;
|
|
151
174
|
runCode(params: {
|
|
152
175
|
file: string;
|
|
153
176
|
method: string;
|
package/dist/stellify-client.js
CHANGED
|
@@ -172,9 +172,17 @@ export class StellifyClient {
|
|
|
172
172
|
const response = await this.client.post('/elements/command', params);
|
|
173
173
|
return response.data;
|
|
174
174
|
}
|
|
175
|
-
//
|
|
175
|
+
// Resource scaffolding - create Model, Controller, Service, Migration in one call
|
|
176
|
+
async createResources(params) {
|
|
177
|
+
const response = await this.client.post('/resources', params);
|
|
178
|
+
return response.data;
|
|
179
|
+
}
|
|
180
|
+
// Code execution - runs a specific method by file and method UUID
|
|
176
181
|
async runCode(params) {
|
|
177
182
|
const { file, method, ...body } = params;
|
|
183
|
+
if (!file || !method) {
|
|
184
|
+
throw new Error('Both file and method UUIDs are required to run code');
|
|
185
|
+
}
|
|
178
186
|
const response = await this.client.put(`/code/${file}/${method}`, body);
|
|
179
187
|
return response.data;
|
|
180
188
|
}
|
package/package.json
CHANGED