@stellisoft/stellify-mcp 0.1.10 → 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 +201 -0
- package/dist/stellify-client.d.ts +23 -0
- package/dist/stellify-client.js +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1058,6 +1058,154 @@ 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
1211
|
description: `Execute a method in the Stellify project environment and return the output.
|
|
@@ -1691,6 +1839,59 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1691
1839
|
],
|
|
1692
1840
|
};
|
|
1693
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
|
+
}
|
|
1694
1895
|
case 'run_code': {
|
|
1695
1896
|
const result = await stellify.runCode(args);
|
|
1696
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,6 +172,11 @@ export class StellifyClient {
|
|
|
172
172
|
const response = await this.client.post('/elements/command', params);
|
|
173
173
|
return response.data;
|
|
174
174
|
}
|
|
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
|
+
}
|
|
175
180
|
// Code execution - runs a specific method by file and method UUID
|
|
176
181
|
async runCode(params) {
|
|
177
182
|
const { file, method, ...body } = params;
|
package/package.json
CHANGED