@atlashub/smartstack-mcp 1.9.0 → 1.10.0

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
@@ -1986,8 +1986,12 @@ async function scaffoldFeature(name, options, structure, config, result, dryRun
1986
1986
  result.instructions.push("---");
1987
1987
  result.instructions.push(`## Summary: Generated ${generated.join(" + ")}`);
1988
1988
  result.instructions.push("");
1989
+ const schema = options?.schema || (isClientExtension ? "extensions" : "core");
1990
+ const dbContextName = schema === "extensions" ? "ExtensionsDbContext" : "CoreDbContext";
1991
+ const dbContextInterface = schema === "extensions" ? "IExtensionsDbContext" : "ICoreDbContext";
1992
+ const migrationPrefix = schema === "extensions" ? "ext" : "core";
1989
1993
  result.instructions.push("### Next Steps:");
1990
- result.instructions.push(`1. Add DbSet to ApplicationDbContext: \`public DbSet<${name}> ${name}s => Set<${name}>();\``);
1994
+ result.instructions.push(`1. Add DbSet to ${dbContextInterface} and ${dbContextName}: \`public DbSet<${name}> ${name}s => Set<${name}>();\``);
1991
1995
  if (withRepository) {
1992
1996
  result.instructions.push(`2. Register repository: \`services.AddScoped<I${name}Repository, ${name}Repository>();\``);
1993
1997
  }
@@ -1995,8 +1999,8 @@ async function scaffoldFeature(name, options, structure, config, result, dryRun
1995
1999
  if (withValidation) {
1996
2000
  result.instructions.push(`${withRepository ? "4" : "3"}. Register validators: \`services.AddValidatorsFromAssemblyContaining<Create${name}DtoValidator>();\``);
1997
2001
  }
1998
- result.instructions.push(`${withRepository ? withValidation ? "5" : "4" : withValidation ? "4" : "3"}. Create migration: \`dotnet ef migrations add ${options?.tablePrefix || "ref_"}vX.X.X_XXX_Add${name}\``);
1999
- result.instructions.push(`${withRepository ? withValidation ? "6" : "5" : withValidation ? "5" : "4"}. Run migration: \`dotnet ef database update\``);
2002
+ result.instructions.push(`${withRepository ? withValidation ? "5" : "4" : withValidation ? "4" : "3"}. Create migration: \`dotnet ef migrations add ${migrationPrefix}_vX.X.X_XXX_Add${name} --context ${dbContextName}\``);
2003
+ result.instructions.push(`${withRepository ? withValidation ? "6" : "5" : withValidation ? "5" : "4"}. Run migration: \`dotnet ef database update --context ${dbContextName}\``);
2000
2004
  if (!skipComponent) {
2001
2005
  result.instructions.push(`Import component: \`import { ${name} } from './components/${name}';\``);
2002
2006
  }
@@ -2325,11 +2329,17 @@ public class {{name}}Configuration : IEntityTypeConfiguration<{{name}}>
2325
2329
  }
2326
2330
  result.files.push({ path: entityFilePath, content: entityContent, type: "created" });
2327
2331
  result.files.push({ path: configFilePath, content: configContent, type: "created" });
2328
- result.instructions.push(`Add DbSet to ApplicationDbContext:`);
2332
+ const dbContextName = schema === "extensions" ? "ExtensionsDbContext" : "CoreDbContext";
2333
+ const dbContextInterface = schema === "extensions" ? "IExtensionsDbContext" : "ICoreDbContext";
2334
+ const migrationPrefix = schema === "extensions" ? "ext" : "core";
2335
+ result.instructions.push(`Add DbSet to ${dbContextInterface}:`);
2336
+ result.instructions.push(`public DbSet<${name}> ${name}s => Set<${name}>();`);
2337
+ result.instructions.push("");
2338
+ result.instructions.push(`And implementation in ${dbContextName}:`);
2329
2339
  result.instructions.push(`public DbSet<${name}> ${name}s => Set<${name}>();`);
2330
2340
  result.instructions.push("");
2331
2341
  result.instructions.push("Create migration:");
2332
- result.instructions.push(`dotnet ef migrations add core_vX.X.X_XXX_Add${name} --context ApplicationDbContext`);
2342
+ result.instructions.push(`dotnet ef migrations add ${migrationPrefix}_vX.X.X_XXX_Add${name} --context ${dbContextName}`);
2333
2343
  result.instructions.push("");
2334
2344
  result.instructions.push("Required fields from BaseEntity:");
2335
2345
  result.instructions.push(`- Id (Guid), ${isSystemEntity ? "" : "TenantId (Guid), "}Code (string, lowercase)`);
@@ -2991,6 +3001,8 @@ public class Update{{name}}DtoValidator : AbstractValidator<Update{{name}}Dto>
2991
3001
  }
2992
3002
  async function scaffoldRepository(name, options, structure, config, result, dryRun = false) {
2993
3003
  const isSystemEntity = options?.isSystemEntity || false;
3004
+ const schema = options?.schema || config.conventions.schemas.platform;
3005
+ const dbContextName = schema === "extensions" ? "ExtensionsDbContext" : "CoreDbContext";
2994
3006
  const interfaceTemplate = `using System;
2995
3007
  using System.Collections.Generic;
2996
3008
  using System.Threading;
@@ -3042,9 +3054,9 @@ namespace ${config.conventions.namespaces.infrastructure}.Repositories;
3042
3054
  /// </summary>
3043
3055
  public class {{name}}Repository : I{{name}}Repository
3044
3056
  {
3045
- private readonly ApplicationDbContext _context;
3057
+ private readonly {{dbContextName}} _context;
3046
3058
 
3047
- public {{name}}Repository(ApplicationDbContext context)
3059
+ public {{name}}Repository({{dbContextName}} context)
3048
3060
  {
3049
3061
  _context = context;
3050
3062
  }
@@ -3104,7 +3116,8 @@ public class {{name}}Repository : I{{name}}Repository
3104
3116
  `;
3105
3117
  const context = {
3106
3118
  name,
3107
- isSystemEntity
3119
+ isSystemEntity,
3120
+ dbContextName
3108
3121
  };
3109
3122
  const interfaceContent = Handlebars.compile(interfaceTemplate)(context);
3110
3123
  const implementationContent = Handlebars.compile(implementationTemplate)(context);
@@ -3602,7 +3615,8 @@ async function handleSuggestMigration(args, config) {
3602
3615
  const pascalDescription = toPascalCase(input.description);
3603
3616
  const sequenceStr = sequence.toString().padStart(3, "0");
3604
3617
  const migrationName = `${context}_v${version}_${sequenceStr}_${pascalDescription}`;
3605
- const command = `dotnet ef migrations add ${migrationName} --context ApplicationDbContext`;
3618
+ const dbContextName = context === "core" ? "CoreDbContext" : "ExtensionsDbContext";
3619
+ const command = `dotnet ef migrations add ${migrationName} --context ${dbContextName}`;
3606
3620
  const lines = [];
3607
3621
  lines.push("# Migration Name Suggestion");
3608
3622
  lines.push("");
@@ -3620,11 +3634,17 @@ async function handleSuggestMigration(args, config) {
3620
3634
  lines.push("");
3621
3635
  lines.push(`| Part | Value | Description |`);
3622
3636
  lines.push(`|------|-------|-------------|`);
3623
- lines.push(`| Context | \`${context}\` | DbContext name |`);
3637
+ lines.push(`| Context | \`${context}\` | Migration prefix (core/extensions) |`);
3638
+ lines.push(`| DbContext | \`${dbContextName}\` | EF Core DbContext to use |`);
3639
+ lines.push(`| Schema | \`${context}\` | Database schema for tables |`);
3624
3640
  lines.push(`| Version | \`v${version}\` | Semver version |`);
3625
3641
  lines.push(`| Sequence | \`${sequenceStr}\` | Order in version |`);
3626
3642
  lines.push(`| Description | \`${pascalDescription}\` | Migration description |`);
3627
3643
  lines.push("");
3644
+ lines.push("> **Note**: Migrations are stored in separate history tables:");
3645
+ lines.push(`> - Core: \`core.__EFMigrationsHistory\``);
3646
+ lines.push(`> - Extensions: \`extensions.__EFMigrationsHistory\``);
3647
+ lines.push("");
3628
3648
  if (existingMigrations.length > 0) {
3629
3649
  lines.push("## Existing Migrations (last 5)");
3630
3650
  lines.push("");
@@ -11337,7 +11357,7 @@ async function createServer() {
11337
11357
  const server = new Server(
11338
11358
  {
11339
11359
  name: "smartstack-mcp",
11340
- version: "1.9.0"
11360
+ version: "1.10.0"
11341
11361
  },
11342
11362
  {
11343
11363
  capabilities: {