@atlashub/smartstack-cli 1.13.2 → 1.14.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/.documentation/agents.html +1 -1
- package/.documentation/apex.html +1 -1
- package/.documentation/business-analyse.html +1 -1
- package/.documentation/cli-commands.html +3 -3
- package/.documentation/commands.html +1 -1
- package/.documentation/efcore.html +1 -1
- package/.documentation/gitflow.html +1 -1
- package/.documentation/hooks.html +1 -1
- package/.documentation/index.html +1 -1
- package/.documentation/init.html +3 -3
- package/.documentation/installation.html +1001 -352
- package/.documentation/ralph-loop.html +1 -1
- package/.documentation/test-web.html +1 -1
- package/README.md +88 -20
- package/dist/index.js +276 -85
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/code-reviewer.md +163 -0
- package/templates/agents/efcore/db-deploy.md +25 -7
- package/templates/agents/efcore/db-reset.md +31 -10
- package/templates/agents/efcore/db-status.md +22 -5
- package/templates/agents/efcore/migration.md +69 -19
- package/templates/agents/gitflow/cleanup.md +8 -1
- package/templates/agents/gitflow/commit.md +7 -5
- package/templates/agents/gitflow/finish.md +6 -4
- package/templates/agents/gitflow/pr.md +8 -1
- package/templates/agents/gitflow/start.md +1 -1
- package/templates/commands/check-version.md +267 -0
- package/templates/commands/efcore/_shared.md +30 -1
- package/templates/commands/efcore/db-reset.md +18 -6
- package/templates/commands/gitflow/OPTIMIZATIONS.md +206 -0
- package/templates/commands/refactor.md +164 -0
- package/templates/project/DependencyInjection.Application.cs.template +25 -0
- package/templates/project/DependencyInjection.Infrastructure.cs.template +61 -0
- package/templates/project/DesignTimeExtensionsDbContextFactory.cs.template +70 -0
- package/templates/project/ExampleEntity.cs.template +116 -0
- package/templates/project/ExampleEntityConfiguration.cs.template +64 -0
- package/templates/project/ExampleService.cs.template +146 -0
- package/templates/project/ExtensionsDbContext.cs.template +41 -0
- package/templates/project/IExtensionsDbContext.cs.template +22 -0
- package/templates/project/Program.cs.template +47 -0
- package/templates/project/README.md +79 -0
- package/templates/ralph/README.md +10 -8
- package/templates/ralph/ralph.config.yaml +2 -2
- package/templates/skills/_shared.md +44 -44
- package/templates/skills/ai-prompt/SKILL.md +55 -55
- package/templates/skills/apex/SKILL.md +235 -0
- package/templates/skills/apex/steps/step-00-init.md +203 -0
- package/templates/skills/apex/steps/step-01-analyze.md +210 -0
- package/templates/skills/apex/steps/step-02-plan.md +217 -0
- package/templates/skills/apex/steps/step-03-execute.md +178 -0
- package/templates/skills/apex/steps/step-04-validate.md +217 -0
- package/templates/skills/apex/steps/step-05-examine.md +207 -0
- package/templates/skills/apex/steps/step-06-resolve.md +181 -0
- package/templates/skills/apex/steps/step-07-tests.md +206 -0
- package/templates/skills/apex/steps/step-08-run-tests.md +207 -0
- package/templates/skills/apex/templates/00-context.md +46 -0
- package/templates/skills/apex/templates/01-analyze.md +63 -0
- package/templates/skills/apex/templates/02-plan.md +63 -0
- package/templates/skills/apex/templates/03-execute.md +34 -0
- package/templates/skills/apex/templates/04-validate.md +61 -0
- package/templates/skills/apex/templates/05-examine.md +58 -0
- package/templates/skills/apex/templates/06-resolve.md +39 -0
- package/templates/skills/apex/templates/07-tests.md +56 -0
- package/templates/skills/apex/templates/08-run-tests.md +41 -0
- package/templates/skills/apex/templates/README.md +69 -0
- package/templates/skills/application/SKILL.md +50 -50
- package/templates/skills/application/templates-backend.md +25 -25
- package/templates/skills/application/templates-frontend.md +43 -43
- package/templates/skills/application/templates-i18n.md +29 -29
- package/templates/skills/application/templates-seed.md +77 -77
- package/templates/skills/business-analyse/SKILL.md +223 -0
- package/templates/skills/business-analyse/_shared.md +258 -0
- package/templates/skills/business-analyse/questionnaire/01-context.md +33 -0
- package/templates/skills/business-analyse/questionnaire/02-stakeholders.md +35 -0
- package/templates/skills/business-analyse/questionnaire/03-scope.md +35 -0
- package/templates/skills/business-analyse/questionnaire/04-data.md +36 -0
- package/templates/skills/business-analyse/questionnaire/05-integrations.md +36 -0
- package/templates/skills/business-analyse/questionnaire/06-security.md +40 -0
- package/templates/skills/business-analyse/questionnaire/07-ui.md +36 -0
- package/templates/skills/business-analyse/questionnaire/08-performance.md +35 -0
- package/templates/skills/business-analyse/questionnaire/09-constraints.md +35 -0
- package/templates/skills/business-analyse/questionnaire/10-documentation.md +35 -0
- package/templates/skills/business-analyse/questionnaire.md +177 -177
- package/templates/skills/business-analyse/react/components.md +340 -0
- package/templates/skills/business-analyse/react/i18n-template.md +245 -0
- package/templates/skills/business-analyse/react/schema.md +151 -0
- package/templates/skills/business-analyse/steps/step-00-init.md +293 -0
- package/templates/skills/business-analyse/steps/step-01-discover.md +267 -0
- package/templates/skills/business-analyse/steps/step-02-analyse.md +243 -0
- package/templates/skills/business-analyse/steps/step-03-specify.md +317 -0
- package/templates/skills/business-analyse/steps/step-04-validate.md +239 -0
- package/templates/skills/business-analyse/steps/step-05-handoff.md +336 -0
- package/templates/skills/business-analyse/steps/step-06-doc-html.md +261 -0
- package/templates/skills/business-analyse/templates/00-context.md +105 -0
- package/templates/skills/business-analyse/templates/frd-brd.md +97 -0
- package/templates/skills/business-analyse/templates/frd-discovery.md +78 -0
- package/templates/skills/business-analyse/templates/frd-handoff.md +118 -0
- package/templates/skills/business-analyse/templates/frd-spec.md +168 -0
- package/templates/skills/business-analyse/templates-frd.md +217 -217
- package/templates/skills/business-analyse/templates-react.md +26 -26
- package/templates/skills/controller/SKILL.md +141 -92
- package/templates/skills/controller/postman-templates.md +15 -15
- package/templates/skills/controller/steps/step-00-init.md +191 -0
- package/templates/skills/controller/steps/step-01-analyze.md +146 -0
- package/templates/skills/controller/steps/step-02-plan.md +176 -0
- package/templates/skills/controller/steps/step-03-generate.md +219 -0
- package/templates/skills/controller/steps/step-04-perms.md +219 -0
- package/templates/skills/controller/steps/step-05-validate.md +107 -0
- package/templates/skills/controller/templates.md +77 -77
- package/templates/skills/documentation/SKILL.md +79 -79
- package/templates/skills/feature-full/SKILL.md +38 -38
- package/templates/skills/gitflow/SKILL.md +277 -0
- package/templates/{commands → skills}/gitflow/_shared.md +20 -20
- package/templates/skills/gitflow/phases/abort.md +173 -0
- package/templates/skills/gitflow/phases/cleanup.md +226 -0
- package/templates/skills/gitflow/phases/status.md +178 -0
- package/templates/skills/gitflow/steps/step-commit.md +255 -0
- package/templates/skills/gitflow/steps/step-finish.md +255 -0
- package/templates/skills/gitflow/steps/step-init.md +209 -0
- package/templates/skills/gitflow/steps/step-merge.md +225 -0
- package/templates/skills/gitflow/steps/step-plan.md +208 -0
- package/templates/skills/gitflow/steps/step-pr.md +235 -0
- package/templates/skills/gitflow/steps/step-start.md +234 -0
- package/templates/skills/gitflow/steps/step-sync.md +200 -0
- package/templates/skills/gitflow/templates/config.json +53 -0
- package/templates/skills/notification/SKILL.md +51 -51
- package/templates/skills/ralph-loop/SKILL.md +228 -0
- package/templates/skills/ralph-loop/steps/step-00-init.md +201 -0
- package/templates/skills/ralph-loop/steps/step-01-task.md +169 -0
- package/templates/skills/ralph-loop/steps/step-02-execute.md +173 -0
- package/templates/skills/ralph-loop/steps/step-03-commit.md +170 -0
- package/templates/skills/ralph-loop/steps/step-04-check.md +162 -0
- package/templates/skills/ralph-loop/steps/step-05-report.md +181 -0
- package/templates/skills/review-code/SKILL.md +219 -0
- package/templates/skills/review-code/references/clean-code-principles.md +140 -0
- package/templates/skills/review-code/references/code-quality-metrics.md +174 -0
- package/templates/skills/review-code/references/feedback-patterns.md +149 -0
- package/templates/skills/review-code/references/security-checklist.md +127 -0
- package/templates/skills/ui-components/SKILL.md +54 -54
- package/templates/skills/workflow/SKILL.md +46 -46
- package/templates/commands/ai-prompt.md +0 -315
- package/templates/commands/apex/1-analyze.md +0 -100
- package/templates/commands/apex/2-plan.md +0 -145
- package/templates/commands/apex/3-execute.md +0 -171
- package/templates/commands/apex/4-examine.md +0 -116
- package/templates/commands/apex/5-tasks.md +0 -209
- package/templates/commands/apex.md +0 -76
- package/templates/commands/application/create.md +0 -362
- package/templates/commands/application/templates-backend.md +0 -463
- package/templates/commands/application/templates-frontend.md +0 -517
- package/templates/commands/application/templates-i18n.md +0 -478
- package/templates/commands/application/templates-seed.md +0 -362
- package/templates/commands/application.md +0 -303
- package/templates/commands/business-analyse/0-orchestrate.md +0 -156
- package/templates/commands/business-analyse/1-init.md +0 -99
- package/templates/commands/business-analyse/2-discover.md +0 -143
- package/templates/commands/business-analyse/3-analyse.md +0 -106
- package/templates/commands/business-analyse/4-specify.md +0 -133
- package/templates/commands/business-analyse/5-validate.md +0 -132
- package/templates/commands/business-analyse/6-handoff.md +0 -157
- package/templates/commands/business-analyse/7-doc-html.md +0 -103
- package/templates/commands/business-analyse/_shared.md +0 -176
- package/templates/commands/business-analyse/bug.md +0 -118
- package/templates/commands/business-analyse/change-request.md +0 -144
- package/templates/commands/business-analyse/hotfix.md +0 -116
- package/templates/commands/business-analyse.md +0 -121
- package/templates/commands/controller/create.md +0 -216
- package/templates/commands/controller/postman-templates.md +0 -528
- package/templates/commands/controller/templates.md +0 -600
- package/templates/commands/controller.md +0 -337
- package/templates/commands/create/agent.md +0 -138
- package/templates/commands/create/command.md +0 -166
- package/templates/commands/create/hook.md +0 -234
- package/templates/commands/create/plugin.md +0 -329
- package/templates/commands/create/project.md +0 -508
- package/templates/commands/create/skill.md +0 -199
- package/templates/commands/create.md +0 -220
- package/templates/commands/documentation/module.md +0 -202
- package/templates/commands/documentation/templates.md +0 -432
- package/templates/commands/documentation.md +0 -190
- package/templates/commands/epct.md +0 -69
- package/templates/commands/explain.md +0 -186
- package/templates/commands/feature-full.md +0 -267
- package/templates/commands/gitflow/1-init.md +0 -188
- package/templates/commands/gitflow/10-start.md +0 -190
- package/templates/commands/gitflow/11-finish.md +0 -382
- package/templates/commands/gitflow/12-cleanup.md +0 -103
- package/templates/commands/gitflow/13-sync.md +0 -216
- package/templates/commands/gitflow/14-rebase.md +0 -251
- package/templates/commands/gitflow/2-status.md +0 -122
- package/templates/commands/gitflow/3-commit.md +0 -209
- package/templates/commands/gitflow/4-plan.md +0 -174
- package/templates/commands/gitflow/5-exec.md +0 -202
- package/templates/commands/gitflow/6-abort.md +0 -121
- package/templates/commands/gitflow/7-pull-request.md +0 -176
- package/templates/commands/gitflow/8-review.md +0 -113
- package/templates/commands/gitflow/9-merge.md +0 -157
- package/templates/commands/gitflow.md +0 -128
- package/templates/commands/implement.md +0 -663
- package/templates/commands/init.md +0 -567
- package/templates/commands/mcp-integration.md +0 -330
- package/templates/commands/notification.md +0 -129
- package/templates/commands/oneshot.md +0 -57
- package/templates/commands/quickstart.md +0 -154
- package/templates/commands/ralph-loop/cancel-ralph.md +0 -18
- package/templates/commands/ralph-loop/help.md +0 -126
- package/templates/commands/ralph-loop/ralph-loop.md +0 -120
- package/templates/commands/review.md +0 -106
- package/templates/commands/workflow.md +0 -193
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using Microsoft.EntityFrameworkCore;
|
|
2
|
+
|
|
3
|
+
namespace {{ProjectName}}.Application.Common.Interfaces;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Interface for Extensions DbContext (client-specific entities).
|
|
7
|
+
///
|
|
8
|
+
/// This interface provides access to all entities specific to your project.
|
|
9
|
+
/// For Core entities (User, Role, Permission, etc.), use ICoreDataService.
|
|
10
|
+
/// </summary>
|
|
11
|
+
public interface IExtensionsDbContext
|
|
12
|
+
{
|
|
13
|
+
// === YOUR ENTITIES ===
|
|
14
|
+
// Add DbSet properties for your entities here. Example:
|
|
15
|
+
// DbSet<Order> Orders { get; }
|
|
16
|
+
// DbSet<Product> Products { get; }
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// Saves all changes made in this context to the database.
|
|
20
|
+
/// </summary>
|
|
21
|
+
Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
|
|
22
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
using Microsoft.EntityFrameworkCore;
|
|
2
|
+
using SmartStack.Api.Extensions;
|
|
3
|
+
using {{ProjectName}}.Infrastructure;
|
|
4
|
+
using {{ProjectName}}.Infrastructure.Persistence;
|
|
5
|
+
using {{ProjectName}}.Application;
|
|
6
|
+
|
|
7
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
8
|
+
|
|
9
|
+
// ===================================================================
|
|
10
|
+
// 1. Add SmartStack Core services (from NuGet package)
|
|
11
|
+
// ===================================================================
|
|
12
|
+
builder.Services.AddSmartStack(builder.Configuration, options =>
|
|
13
|
+
{
|
|
14
|
+
options.EnableDevSeeding = builder.Environment.IsDevelopment();
|
|
15
|
+
options.EnableSwagger = builder.Environment.IsDevelopment();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// ===================================================================
|
|
19
|
+
// 2. Add client-specific services (Dual-DbContext pattern)
|
|
20
|
+
// ===================================================================
|
|
21
|
+
builder.Services.Add{{ProjectName}}Infrastructure(builder.Configuration);
|
|
22
|
+
builder.Services.Add{{ProjectName}}Application();
|
|
23
|
+
|
|
24
|
+
var app = builder.Build();
|
|
25
|
+
|
|
26
|
+
// ===================================================================
|
|
27
|
+
// 3. Initialize SmartStack + apply migrations (in correct order!)
|
|
28
|
+
// ===================================================================
|
|
29
|
+
// This initializes SmartStack and applies Core migrations automatically
|
|
30
|
+
await app.InitializeSmartStackAsync();
|
|
31
|
+
|
|
32
|
+
// Apply Extensions migrations AFTER Core migrations
|
|
33
|
+
// Your client-specific tables may have FK references to Core tables
|
|
34
|
+
if (app.Environment.IsDevelopment())
|
|
35
|
+
{
|
|
36
|
+
using var scope = app.Services.CreateScope();
|
|
37
|
+
var extDb = scope.ServiceProvider.GetRequiredService<ExtensionsDbContext>();
|
|
38
|
+
await extDb.Database.MigrateAsync();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ===================================================================
|
|
42
|
+
// 4. SmartStack middleware & endpoints
|
|
43
|
+
// ===================================================================
|
|
44
|
+
app.UseSmartStack();
|
|
45
|
+
app.MapSmartStack();
|
|
46
|
+
|
|
47
|
+
app.Run();
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# SmartStack Client Project Templates
|
|
2
|
+
|
|
3
|
+
These templates are used by the SmartStack CLI to generate new client projects.
|
|
4
|
+
|
|
5
|
+
## Template Files
|
|
6
|
+
|
|
7
|
+
| File | Description | Destination |
|
|
8
|
+
|------|-------------|-------------|
|
|
9
|
+
| `ExtensionsDbContext.cs.template` | DbContext for client entities | `{ProjectName}.Infrastructure/Persistence/` |
|
|
10
|
+
| `IExtensionsDbContext.cs.template` | Interface for ExtensionsDbContext | `{ProjectName}.Application/Common/Interfaces/` |
|
|
11
|
+
| `DependencyInjection.Infrastructure.cs.template` | DI configuration for Infrastructure | `{ProjectName}.Infrastructure/` |
|
|
12
|
+
| `Program.cs.template` | API entry point with migration order | `{ProjectName}.Api/` |
|
|
13
|
+
| `DesignTimeExtensionsDbContextFactory.cs.template` | Factory for EF Core CLI tools | `{ProjectName}.Infrastructure/Persistence/` |
|
|
14
|
+
| `ExampleEntity.cs.template` | Example entity with FK to Core | `{ProjectName}.Domain/Entities/` (optional) |
|
|
15
|
+
| `ExampleService.cs.template` | Example service using ICoreDataService | `{ProjectName}.Infrastructure/Services/` (optional) |
|
|
16
|
+
| `ExampleEntityConfiguration.cs.template` | Example EF Core configuration | `{ProjectName}.Infrastructure/Persistence/Configurations/` (optional) |
|
|
17
|
+
|
|
18
|
+
## Placeholders
|
|
19
|
+
|
|
20
|
+
The following placeholders are replaced during project generation:
|
|
21
|
+
|
|
22
|
+
| Placeholder | Description | Example |
|
|
23
|
+
|-------------|-------------|---------|
|
|
24
|
+
| `{{ProjectName}}` | PascalCase project name | `MyCompany` |
|
|
25
|
+
|
|
26
|
+
## Architecture Overview
|
|
27
|
+
|
|
28
|
+
### Dual DbContext Pattern
|
|
29
|
+
|
|
30
|
+
SmartStack uses two separate DbContexts:
|
|
31
|
+
|
|
32
|
+
1. **CoreDbContext** (from SmartStack NuGet package)
|
|
33
|
+
- Schema: `core`
|
|
34
|
+
- Manages: Users, Roles, Permissions, Navigation, etc.
|
|
35
|
+
- Migrations: `core.__EFMigrationsHistory`
|
|
36
|
+
|
|
37
|
+
2. **ExtensionsDbContext** (client project)
|
|
38
|
+
- Schema: `extensions`
|
|
39
|
+
- Manages: Client-specific entities
|
|
40
|
+
- Migrations: `extensions.__EFMigrationsHistory`
|
|
41
|
+
|
|
42
|
+
### FK References to Core Entities
|
|
43
|
+
|
|
44
|
+
When your entities need to reference Core entities (User, Role, etc.):
|
|
45
|
+
|
|
46
|
+
```csharp
|
|
47
|
+
// IN YOUR ENTITY - Store GUID only
|
|
48
|
+
public Guid CustomerId { get; private set; } // FK to User
|
|
49
|
+
|
|
50
|
+
// IN YOUR SERVICE - Use ICoreDataService
|
|
51
|
+
var user = await _coreDataService.GetUserByIdAsync(entity.CustomerId);
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**DO NOT** create navigation properties to Core entities, as ExtensionsDbContext doesn't know about them.
|
|
55
|
+
|
|
56
|
+
### Migration Order
|
|
57
|
+
|
|
58
|
+
Migrations must be applied in order:
|
|
59
|
+
|
|
60
|
+
1. Core migrations first (SmartStack platform tables)
|
|
61
|
+
2. Extensions migrations second (client tables that may reference Core)
|
|
62
|
+
|
|
63
|
+
This is handled automatically in `Program.cs.template`.
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Create new project
|
|
69
|
+
smartstack init MyProject
|
|
70
|
+
|
|
71
|
+
# Add entity to Extensions
|
|
72
|
+
smartstack scaffold entity Order --context extensions
|
|
73
|
+
|
|
74
|
+
# Create migration
|
|
75
|
+
dotnet ef migrations add ext_v1.0.0_001_AddOrders --context ExtensionsDbContext
|
|
76
|
+
|
|
77
|
+
# Apply migrations
|
|
78
|
+
dotnet ef database update
|
|
79
|
+
```
|
|
@@ -27,15 +27,17 @@ Edit `ralph.config.yaml` to customize:
|
|
|
27
27
|
|
|
28
28
|
Ralph **requires** these MCP servers to function:
|
|
29
29
|
|
|
30
|
-
1.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
### 1. Download MCP packages
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g @atlashub/smartstack-mcp
|
|
33
|
+
npm install -g @upstash/context7-mcp
|
|
34
|
+
```
|
|
34
35
|
|
|
35
|
-
2.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
### 2. Register in Claude Code
|
|
37
|
+
```bash
|
|
38
|
+
claude mcp add smartstack -- npx @atlashub/smartstack-mcp
|
|
39
|
+
claude mcp add context7 -- npx @upstash/context7-mcp
|
|
40
|
+
```
|
|
39
41
|
|
|
40
42
|
## Usage
|
|
41
43
|
|
|
@@ -9,12 +9,12 @@ mcp:
|
|
|
9
9
|
required:
|
|
10
10
|
- name: context7
|
|
11
11
|
description: "Library documentation and code examples"
|
|
12
|
-
install_command: "claude mcp add context7"
|
|
12
|
+
install_command: "npm install -g @upstash/context7-mcp && claude mcp add context7 -- npx @upstash/context7-mcp"
|
|
13
13
|
health_check: true
|
|
14
14
|
|
|
15
15
|
- name: smartstack
|
|
16
16
|
description: "SmartStack validation and scaffolding"
|
|
17
|
-
install_command: "claude mcp add smartstack"
|
|
17
|
+
install_command: "npm install -g @atlashub/smartstack-mcp && claude mcp add smartstack -- npx @atlashub/smartstack-mcp"
|
|
18
18
|
health_check: true
|
|
19
19
|
|
|
20
20
|
# Behavior when MCP is unavailable
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
# Skills SmartStack -
|
|
1
|
+
# Skills SmartStack - Shared Functions
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Model Strategy
|
|
4
4
|
|
|
5
|
-
|
|
|
6
|
-
|
|
7
|
-
|
|
|
8
|
-
|
|
|
9
|
-
|
|
|
5
|
+
| Task | Model | Reason |
|
|
6
|
+
|------|-------|--------|
|
|
7
|
+
| Code generation | **Sonnet** | Optimal quality/cost ratio |
|
|
8
|
+
| Security audit | **Opus** | Critical analysis required |
|
|
9
|
+
| Final validation | **Opus** | Architectural decisions |
|
|
10
10
|
|
|
11
|
-
## Architecture
|
|
11
|
+
## SmartStack Architecture
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
Domain → Application → Infrastructure → API → Web
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
### Layers
|
|
18
|
-
| Layer |
|
|
19
|
-
|
|
20
|
-
| Domain |
|
|
18
|
+
| Layer | Responsibility | Namespace |
|
|
19
|
+
|-------|-----------------|-----------|
|
|
20
|
+
| Domain | Entities, ValueObjects | `SmartStack.Domain.{Context}` |
|
|
21
21
|
| Application | Services, DTOs, Interfaces | `SmartStack.Application.{Context}` |
|
|
22
|
-
| Infrastructure |
|
|
22
|
+
| Infrastructure | Implementations, EF Core | `SmartStack.Infrastructure.{Context}` |
|
|
23
23
|
| API | Controllers, Middleware | `SmartStack.Api.Controllers.{Area}` |
|
|
24
24
|
| Web | React components, pages | `src/pages/{context}/{app}/{module}` |
|
|
25
25
|
|
|
26
|
-
## Permissions (2
|
|
26
|
+
## Permissions (2 mandatory files)
|
|
27
27
|
|
|
28
28
|
### 1. Permissions.cs (Application layer)
|
|
29
29
|
```csharp
|
|
@@ -45,16 +45,16 @@ builder.HasData(
|
|
|
45
45
|
);
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
## i18n (4
|
|
48
|
+
## i18n (4 mandatory languages)
|
|
49
49
|
|
|
50
|
-
|
|
|
51
|
-
|
|
52
|
-
|
|
|
50
|
+
| Language | File | Code |
|
|
51
|
+
|----------|------|------|
|
|
52
|
+
| French | `fr.json` | `fr` |
|
|
53
53
|
| English | `en.json` | `en` |
|
|
54
|
-
|
|
|
55
|
-
|
|
|
54
|
+
| Italian | `it.json` | `it` |
|
|
55
|
+
| German | `de.json` | `de` |
|
|
56
56
|
|
|
57
|
-
### Structure
|
|
57
|
+
### i18n Structure
|
|
58
58
|
```json
|
|
59
59
|
{
|
|
60
60
|
"{context}": {
|
|
@@ -70,48 +70,48 @@ builder.HasData(
|
|
|
70
70
|
}
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
## Services
|
|
73
|
+
## Common Services to Inject
|
|
74
74
|
|
|
75
75
|
| Service | Usage |
|
|
76
76
|
|---------|-------|
|
|
77
|
-
| `IApplicationDbContext` |
|
|
78
|
-
| `ICurrentUserService` |
|
|
77
|
+
| `IApplicationDbContext` | DB access |
|
|
78
|
+
| `ICurrentUserService` | Current user |
|
|
79
79
|
| `ILogger<T>` | Logging |
|
|
80
80
|
| `IMapper` | AutoMapper |
|
|
81
|
-
| `IPermissionService` |
|
|
81
|
+
| `IPermissionService` | Permission cache |
|
|
82
82
|
|
|
83
|
-
## Validation
|
|
83
|
+
## Security Validation
|
|
84
84
|
|
|
85
|
-
### Logs
|
|
86
|
-
|
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
| Permission
|
|
90
|
-
|
|
|
85
|
+
### Critical Logs
|
|
86
|
+
| Event | Level |
|
|
87
|
+
|-------|-------|
|
|
88
|
+
| Failed login | `Critical` |
|
|
89
|
+
| Permission denied | `Critical` |
|
|
90
|
+
| Account locked | `Critical` |
|
|
91
91
|
| Password change | `Warning` |
|
|
92
|
-
|
|
|
92
|
+
| Deletion | `Warning` |
|
|
93
93
|
|
|
94
|
-
###
|
|
94
|
+
### System Account Protection
|
|
95
95
|
```csharp
|
|
96
96
|
if (entity.UserType == UserType.System || entity.UserType == UserType.LocalAdmin)
|
|
97
97
|
return BadRequest(new { message = "Cannot modify system accounts" });
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
-
##
|
|
100
|
+
## Common Validation Checklist
|
|
101
101
|
|
|
102
102
|
```
|
|
103
|
-
□ Permissions
|
|
104
|
-
□
|
|
105
|
-
□ i18n 4
|
|
106
|
-
□
|
|
107
|
-
□
|
|
103
|
+
□ Permissions created (Permissions.cs + PermissionConfiguration.cs)
|
|
104
|
+
□ EF Core migration created
|
|
105
|
+
□ i18n 4 languages (fr, en, it, de)
|
|
106
|
+
□ Unit tests
|
|
107
|
+
□ API documentation (ProducesResponseType)
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
##
|
|
110
|
+
## MCP Tools References
|
|
111
111
|
|
|
112
112
|
| Tool | Usage |
|
|
113
113
|
|------|-------|
|
|
114
|
-
| `mcp__smartstack__validate_conventions` |
|
|
115
|
-
| `mcp__smartstack__scaffold_extension` |
|
|
116
|
-
| `mcp__smartstack__check_migrations` |
|
|
117
|
-
| `mcp__smartstack__scaffold_tests` |
|
|
114
|
+
| `mcp__smartstack__validate_conventions` | Validate conventions |
|
|
115
|
+
| `mcp__smartstack__scaffold_extension` | Code generation |
|
|
116
|
+
| `mcp__smartstack__check_migrations` | Check migrations |
|
|
117
|
+
| `mcp__smartstack__scaffold_tests` | Generate tests |
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ai-prompt
|
|
3
3
|
description: |
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
-
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
4
|
+
Integrates AI capabilities into SmartStack features.
|
|
5
|
+
Use this skill when:
|
|
6
|
+
- User wants to integrate AI into a feature
|
|
7
|
+
- User mentions "prompt", "GPT", "Claude", "IA", "AI"
|
|
8
|
+
- Creating an assistant or chatbot
|
|
9
|
+
- Automatic content generation
|
|
10
|
+
- AI response validation with schema
|
|
11
11
|
Types: Prompt, OutputSchema, Provider, Model
|
|
12
12
|
---
|
|
13
13
|
|
|
@@ -16,19 +16,19 @@ description: |
|
|
|
16
16
|
> **Architecture:** Prompt + Blocks → Provider + Model → Completion → Schema Validation
|
|
17
17
|
> Multi-provider: OpenAI, Anthropic (Claude), Azure OpenAI, Google Gemini
|
|
18
18
|
|
|
19
|
-
**
|
|
19
|
+
**Reference:** [_shared.md](../_shared.md) for common patterns
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## WHEN THIS SKILL ACTIVATES
|
|
22
22
|
|
|
23
|
-
|
|
|
24
|
-
|
|
25
|
-
|
|
|
26
|
-
| Chatbot/Assistant | "
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
23
|
+
| Trigger | Example |
|
|
24
|
+
|---------|---------|
|
|
25
|
+
| Explicit request | "Integrate GPT to generate descriptions" |
|
|
26
|
+
| Chatbot/Assistant | "Create an assistant for support" |
|
|
27
|
+
| Content generation | "Auto-generate responses" |
|
|
28
|
+
| Text analysis | "Analyze the sentiment of comments" |
|
|
29
|
+
| Keywords | "prompt", "GPT", "Claude", "IA", "completion", "LLM" |
|
|
30
30
|
|
|
31
|
-
## FLOW
|
|
31
|
+
## AI FLOW
|
|
32
32
|
|
|
33
33
|
```
|
|
34
34
|
Feature → IAiCompletionService.ExecutePromptAsync()
|
|
@@ -38,7 +38,7 @@ Prompt + Blocks → Provider Instance → External API (OpenAI/Claude/Azure/Gemi
|
|
|
38
38
|
AI Response → OutputSchema Validation → Typed Result<T>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## MAIN ENTITIES
|
|
42
42
|
|
|
43
43
|
### AiProvider & AiModel
|
|
44
44
|
- **Providers:** OpenAI, Anthropic, Azure OpenAI, Google
|
|
@@ -46,7 +46,7 @@ AI Response → OutputSchema Validation → Typed Result<T>
|
|
|
46
46
|
- Properties: Code, ContextWindow, MaxOutputTokens, InputCost, OutputCost, SupportsVision, SupportsStreaming
|
|
47
47
|
|
|
48
48
|
### AiProviderInstance
|
|
49
|
-
|
|
49
|
+
Configured instance: Code, Name, SystemContext, DefaultModel, MonthlyBudgetLimit, EncryptedApiKey
|
|
50
50
|
|
|
51
51
|
### Prompt & PromptBlock
|
|
52
52
|
```csharp
|
|
@@ -56,20 +56,20 @@ Instance configurée: Code, Name, SystemContext, DefaultModel, MonthlyBudgetLimi
|
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### OutputSchema
|
|
59
|
-
JSON Schema
|
|
59
|
+
JSON Schema for validation: Code, Name, JsonSchema, DotNetType
|
|
60
60
|
|
|
61
61
|
## WORKFLOW INTEGRATION
|
|
62
62
|
|
|
63
|
-
### 1.
|
|
63
|
+
### 1. Define the Use Case
|
|
64
64
|
| Question | Impact |
|
|
65
65
|
|----------|--------|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
| Multi-
|
|
69
|
-
| Budget
|
|
70
|
-
|
|
|
66
|
+
| Content type? | Model choice |
|
|
67
|
+
| Structured response? | OutputSchema |
|
|
68
|
+
| Multi-language? | Language variables |
|
|
69
|
+
| Budget limited? | ProviderInstance |
|
|
70
|
+
| Real-time? | Streaming |
|
|
71
71
|
|
|
72
|
-
### 2.
|
|
72
|
+
### 2. Create the Prompt
|
|
73
73
|
```csharp
|
|
74
74
|
var promptId = await _promptService.CreatePromptAsync(new CreatePromptRequest
|
|
75
75
|
{
|
|
@@ -90,7 +90,7 @@ var promptId = await _promptService.CreatePromptAsync(new CreatePromptRequest
|
|
|
90
90
|
});
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
### 3.
|
|
93
|
+
### 3. Define OutputSchema (if structured response)
|
|
94
94
|
```csharp
|
|
95
95
|
var schemaId = await _schemaService.CreateAsync(new CreateSchemaRequest
|
|
96
96
|
{
|
|
@@ -100,22 +100,22 @@ var schemaId = await _schemaService.CreateAsync(new CreateSchemaRequest
|
|
|
100
100
|
});
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
### 4.
|
|
103
|
+
### 4. Execute the Prompt
|
|
104
104
|
```csharp
|
|
105
|
-
//
|
|
105
|
+
// Simple execution
|
|
106
106
|
var result = await _aiService.ExecutePromptAsync(promptId, new Dictionary<string, object>
|
|
107
107
|
{
|
|
108
108
|
["ticketTitle"] = ticket.Title,
|
|
109
109
|
["ticketDescription"] = ticket.Description
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
-
//
|
|
112
|
+
// With typed validation
|
|
113
113
|
var typedResult = await _aiService.ExecutePromptWithValidationAsync<TicketAnalysisResult>(
|
|
114
114
|
promptId, variables);
|
|
115
115
|
if (typedResult.Success && typedResult.IsValid) { /* use typedResult.Data */ }
|
|
116
116
|
```
|
|
117
117
|
|
|
118
|
-
## SERVICES
|
|
118
|
+
## AI SERVICES
|
|
119
119
|
|
|
120
120
|
### IAiCompletionService
|
|
121
121
|
```csharp
|
|
@@ -151,17 +151,17 @@ const { execute, loading, error, result } = useAiCompletion<T>(promptCode);
|
|
|
151
151
|
const data = await execute(variables);
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
###
|
|
154
|
+
### Component AiAssistantButton
|
|
155
155
|
```tsx
|
|
156
156
|
<AiAssistantButton
|
|
157
157
|
promptCode="ticket-analyzer"
|
|
158
158
|
variables={{ ticketTitle, ticketDescription }}
|
|
159
159
|
onResult={(result) => handleAnalysis(result)}
|
|
160
|
-
label="
|
|
160
|
+
label="Analyze with AI"
|
|
161
161
|
/>
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
## PATTERNS
|
|
164
|
+
## ADVANCED PATTERNS
|
|
165
165
|
|
|
166
166
|
### Streaming Response
|
|
167
167
|
```typescript
|
|
@@ -180,32 +180,32 @@ foreach (var provider in providers.OrderBy(p => p.Priority)) {
|
|
|
180
180
|
## CHECKLIST
|
|
181
181
|
|
|
182
182
|
```
|
|
183
|
-
□ Prompt
|
|
184
|
-
□ OutputSchema
|
|
185
|
-
□ Service
|
|
186
|
-
□
|
|
187
|
-
□ Frontend: Hook/
|
|
188
|
-
□ ProviderInstance
|
|
189
|
-
□ Tests: execution, variables, validation
|
|
183
|
+
□ Prompt created (unique Code, Blocks, Variables, Version)
|
|
184
|
+
□ OutputSchema if structured response
|
|
185
|
+
□ Service with IAiCompletionService injected
|
|
186
|
+
□ Error handling + Logging (tokens, time)
|
|
187
|
+
□ Frontend: Hook/component, Loading, Error handling
|
|
188
|
+
□ ProviderInstance with budget limit
|
|
189
|
+
□ Tests: execution, variables, schema validation
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
##
|
|
192
|
+
## ABSOLUTE RULES
|
|
193
193
|
|
|
194
194
|
| DO | DON'T |
|
|
195
195
|
|----|-------|
|
|
196
|
-
| IAiCompletionService
|
|
197
|
-
| OutputSchema
|
|
198
|
-
|
|
|
199
|
-
|
|
|
200
|
-
| Variables
|
|
196
|
+
| IAiCompletionService for executions | Direct API calls |
|
|
197
|
+
| OutputSchema for structured responses | Unvalidated responses |
|
|
198
|
+
| Error handling (API down, quota) | Ignore token limits |
|
|
199
|
+
| Log executions (tokens, duration) | Hardcode API keys |
|
|
200
|
+
| Variables for dynamic content | Expose system prompts to frontend |
|
|
201
201
|
|
|
202
|
-
##
|
|
202
|
+
## KEY FILES
|
|
203
203
|
|
|
204
|
-
|
|
|
205
|
-
|
|
206
|
-
| `Domain/AI/Prompts/Prompt.cs` |
|
|
204
|
+
| File | Role |
|
|
205
|
+
|------|------|
|
|
206
|
+
| `Domain/AI/Prompts/Prompt.cs` | Prompt entity |
|
|
207
207
|
| `Domain/AI/Schemas/OutputSchema.cs` | Schema validation |
|
|
208
|
-
| `Domain/AI/AiProviderInstance.cs` |
|
|
209
|
-
| `Application/Common/Interfaces/IAiCompletionService.cs` |
|
|
208
|
+
| `Domain/AI/AiProviderInstance.cs` | Configured instance |
|
|
209
|
+
| `Application/Common/Interfaces/IAiCompletionService.cs` | Service interface |
|
|
210
210
|
| `Infrastructure/Services/AI/AiCompletionService.cs` | Implementation |
|
|
211
|
-
| `web/src/services/api/aiApi.ts` | API
|
|
211
|
+
| `web/src/services/api/aiApi.ts` | Frontend API |
|