@atlashub/smartstack-cli 1.4.1 → 1.5.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 +916 -916
- package/.documentation/apex.html +1018 -1018
- package/.documentation/business-analyse.html +1501 -1501
- package/.documentation/commands.html +680 -680
- package/.documentation/css/styles.css +2168 -2168
- package/.documentation/efcore.html +2505 -2505
- package/.documentation/gitflow.html +2618 -2618
- package/.documentation/hooks.html +413 -413
- package/.documentation/index.html +323 -323
- package/.documentation/installation.html +462 -462
- package/.documentation/js/app.js +794 -794
- package/.documentation/test-web.html +513 -513
- package/dist/index.js +807 -277
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/agents/efcore/conflicts.md +44 -17
- package/templates/agents/efcore/db-status.md +27 -6
- package/templates/agents/efcore/scan.md +43 -13
- package/templates/commands/ai-prompt.md +315 -315
- package/templates/commands/application/create.md +362 -362
- package/templates/commands/controller/create.md +216 -216
- package/templates/commands/controller.md +59 -0
- package/templates/commands/documentation/module.md +202 -202
- package/templates/commands/efcore/_env-check.md +153 -153
- package/templates/commands/efcore/conflicts.md +109 -192
- package/templates/commands/efcore/db-status.md +101 -89
- package/templates/commands/efcore/migration.md +23 -11
- package/templates/commands/efcore/scan.md +115 -119
- package/templates/commands/efcore.md +54 -6
- package/templates/commands/feature-full.md +267 -267
- package/templates/commands/gitflow/11-finish.md +145 -11
- package/templates/commands/gitflow/13-sync.md +216 -216
- package/templates/commands/gitflow/14-rebase.md +251 -251
- package/templates/commands/gitflow/2-status.md +120 -10
- package/templates/commands/gitflow/3-commit.md +150 -0
- package/templates/commands/gitflow/7-pull-request.md +134 -5
- package/templates/commands/gitflow/9-merge.md +142 -1
- package/templates/commands/implement.md +663 -663
- package/templates/commands/init.md +562 -0
- package/templates/commands/mcp-integration.md +330 -0
- package/templates/commands/notification.md +129 -129
- package/templates/commands/validate.md +233 -0
- package/templates/commands/workflow.md +193 -193
- package/templates/skills/ai-prompt/SKILL.md +778 -778
- package/templates/skills/application/SKILL.md +563 -563
- package/templates/skills/application/templates-backend.md +450 -450
- package/templates/skills/application/templates-frontend.md +531 -531
- package/templates/skills/application/templates-i18n.md +520 -520
- package/templates/skills/application/templates-seed.md +647 -647
- package/templates/skills/controller/SKILL.md +240 -240
- package/templates/skills/controller/postman-templates.md +614 -614
- package/templates/skills/controller/templates.md +1468 -1468
- package/templates/skills/documentation/SKILL.md +133 -133
- package/templates/skills/documentation/templates.md +476 -476
- package/templates/skills/feature-full/SKILL.md +838 -838
- package/templates/skills/notification/SKILL.md +555 -555
- package/templates/skills/ui-components/SKILL.md +870 -870
- package/templates/skills/workflow/SKILL.md +582 -582
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: SmartStack MCP Integration Guide
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# SmartStack MCP Integration
|
|
6
|
+
|
|
7
|
+
This document describes how SmartStack CLI commands integrate with the **SmartStack MCP Server** for consistent, structured operations across all development environments.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
The SmartStack MCP Server provides four main tools:
|
|
14
|
+
|
|
15
|
+
| MCP Tool | CLI Commands Using It | Purpose |
|
|
16
|
+
|----------|----------------------|---------|
|
|
17
|
+
| `validate_conventions` | `/validate` | Check naming conventions |
|
|
18
|
+
| `check_migrations` | `/efcore:conflicts`, `/efcore:scan`, `/efcore:db-status` | Migration analysis |
|
|
19
|
+
| `scaffold_extension` | `/controller:create`, `/application:create` | Code generation |
|
|
20
|
+
| `api_docs` | (future) `/docs:api` | API documentation |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## MCP Tools Reference
|
|
25
|
+
|
|
26
|
+
### 1. validate_conventions
|
|
27
|
+
|
|
28
|
+
**Description:** Validate SmartStack conventions for SQL schemas, table prefixes, migration naming, service interfaces, and namespace structure.
|
|
29
|
+
|
|
30
|
+
**Parameters:**
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
{
|
|
34
|
+
path?: string; // Project path (default: auto-detect)
|
|
35
|
+
checks: Array<'tables' | 'migrations' | 'services' | 'namespaces' | 'all'>;
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Response:**
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
interface ValidationResult {
|
|
43
|
+
valid: boolean;
|
|
44
|
+
errors: ValidationIssue[];
|
|
45
|
+
warnings: ValidationIssue[];
|
|
46
|
+
summary: string;
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Used by:** `/validate`, `/validate:tables`, `/validate:migrations`, etc.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### 2. check_migrations
|
|
55
|
+
|
|
56
|
+
**Description:** Analyze EF Core migrations for conflicts, ordering issues, and ModelSnapshot discrepancies between branches.
|
|
57
|
+
|
|
58
|
+
**Parameters:**
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
{
|
|
62
|
+
projectPath?: string; // EF Core project path
|
|
63
|
+
branch?: string; // Git branch to check (default: current)
|
|
64
|
+
compareBranch?: string; // Branch to compare against
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Response:**
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
interface MigrationCheckResult {
|
|
72
|
+
hasConflicts: boolean;
|
|
73
|
+
migrations: MigrationInfo[];
|
|
74
|
+
conflicts: MigrationConflict[];
|
|
75
|
+
suggestions: string[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface MigrationInfo {
|
|
79
|
+
name: string;
|
|
80
|
+
context: string; // core, extensions
|
|
81
|
+
version: string; // 1.0.0, 1.2.0
|
|
82
|
+
sequence: string; // 001, 002
|
|
83
|
+
description: string;
|
|
84
|
+
file: string;
|
|
85
|
+
applied: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
interface MigrationConflict {
|
|
89
|
+
type: 'order' | 'snapshot' | 'dependency' | 'naming';
|
|
90
|
+
description: string;
|
|
91
|
+
files: string[];
|
|
92
|
+
resolution: string;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Used by:** `/efcore:conflicts`, `/efcore:scan`, `/efcore:db-status`
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 3. scaffold_extension
|
|
101
|
+
|
|
102
|
+
**Description:** Generate code to extend SmartStack: services, entities, controllers, or React components.
|
|
103
|
+
|
|
104
|
+
**Parameters:**
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
{
|
|
108
|
+
type: 'service' | 'entity' | 'controller' | 'component';
|
|
109
|
+
name: string; // e.g., "UserProfile", "Order"
|
|
110
|
+
options?: {
|
|
111
|
+
namespace?: string;
|
|
112
|
+
baseEntity?: string;
|
|
113
|
+
methods?: string[];
|
|
114
|
+
outputPath?: string;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Response:**
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface ScaffoldResult {
|
|
123
|
+
success: boolean;
|
|
124
|
+
files: GeneratedFile[];
|
|
125
|
+
instructions: string[];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface GeneratedFile {
|
|
129
|
+
path: string;
|
|
130
|
+
content: string;
|
|
131
|
+
type: 'created' | 'modified';
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Used by:** `/controller:create`, `/application:create`
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### 4. api_docs
|
|
140
|
+
|
|
141
|
+
**Description:** Get API documentation from Swagger/OpenAPI or by parsing controller files.
|
|
142
|
+
|
|
143
|
+
**Parameters:**
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
{
|
|
147
|
+
endpoint?: string; // Filter by path, e.g., "/api/users"
|
|
148
|
+
format?: 'markdown' | 'json' | 'openapi';
|
|
149
|
+
controller?: string; // Filter by controller name
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Used by:** Future `/docs:api` command
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Convention Alignment
|
|
158
|
+
|
|
159
|
+
### Migration Naming
|
|
160
|
+
|
|
161
|
+
Both CLI and MCP use the same format:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
{context}_v{version}_{sequence}_{Description}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
| Component | Values | Example |
|
|
168
|
+
|-----------|--------|---------|
|
|
169
|
+
| context | `core`, `extensions` | `core` |
|
|
170
|
+
| version | Semver | `1.2.0` |
|
|
171
|
+
| sequence | 3-digit | `001` |
|
|
172
|
+
| Description | PascalCase | `AddUserRoles` |
|
|
173
|
+
|
|
174
|
+
**Full example:** `core_v1.2.0_001_AddUserRoles`
|
|
175
|
+
|
|
176
|
+
### Table Prefixes
|
|
177
|
+
|
|
178
|
+
Valid prefixes enforced by `validate_conventions`:
|
|
179
|
+
|
|
180
|
+
- `auth_` - Authentication
|
|
181
|
+
- `nav_` - Navigation
|
|
182
|
+
- `usr_` - User data
|
|
183
|
+
- `ai_` - AI features
|
|
184
|
+
- `cfg_` - Configuration
|
|
185
|
+
- `wkf_` - Workflow
|
|
186
|
+
- `support_` - Support
|
|
187
|
+
- `entra_` - Entra ID
|
|
188
|
+
- `ref_` - Reference data
|
|
189
|
+
- `loc_` - Localization
|
|
190
|
+
- `lic_` - Licensing
|
|
191
|
+
|
|
192
|
+
### Service Pattern
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Interface: I{Name}Service
|
|
196
|
+
Implementation: {Name}Service
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Namespaces
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
SmartStack.Domain.*
|
|
203
|
+
SmartStack.Application.*
|
|
204
|
+
SmartStack.Infrastructure.*
|
|
205
|
+
SmartStack.Api.*
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Command to MCP Mapping
|
|
211
|
+
|
|
212
|
+
### /efcore:conflicts
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
1. Get current branch
|
|
216
|
+
2. CALL mcp__smartstack__check_migrations({
|
|
217
|
+
branch: currentBranch,
|
|
218
|
+
compareBranch: "develop"
|
|
219
|
+
})
|
|
220
|
+
3. Display conflicts from response
|
|
221
|
+
4. Exit 1 if hasConflicts is true
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### /efcore:scan
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
1. List all worktrees
|
|
228
|
+
2. FOR each branch:
|
|
229
|
+
CALL mcp__smartstack__check_migrations({
|
|
230
|
+
branch: branchName,
|
|
231
|
+
compareBranch: "develop"
|
|
232
|
+
})
|
|
233
|
+
3. Aggregate results
|
|
234
|
+
4. Calculate merge order by risk level
|
|
235
|
+
5. Display summary
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### /validate
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
1. CALL mcp__smartstack__validate_conventions({
|
|
242
|
+
checks: ["all"]
|
|
243
|
+
})
|
|
244
|
+
2. Display errors and warnings
|
|
245
|
+
3. Exit 1 if not valid
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### /controller:create
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
1. Parse arguments (area, module, entity)
|
|
252
|
+
2. CALL mcp__smartstack__scaffold_extension({
|
|
253
|
+
type: "controller",
|
|
254
|
+
name: moduleName,
|
|
255
|
+
options: { namespace: "SmartStack.Api.Controllers.{area}" }
|
|
256
|
+
})
|
|
257
|
+
3. Write generated files
|
|
258
|
+
4. Add permissions
|
|
259
|
+
5. Create migration if needed
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Benefits of MCP Integration
|
|
265
|
+
|
|
266
|
+
1. **Single Source of Truth**
|
|
267
|
+
- Convention rules defined once in MCP config
|
|
268
|
+
- No duplication between CLI and other tools
|
|
269
|
+
|
|
270
|
+
2. **Consistency**
|
|
271
|
+
- Same logic in CLI, CI/CD, IDE
|
|
272
|
+
- Identical results everywhere
|
|
273
|
+
|
|
274
|
+
3. **Structured Output**
|
|
275
|
+
- Typed responses instead of text parsing
|
|
276
|
+
- Easier automation and scripting
|
|
277
|
+
|
|
278
|
+
4. **Maintainability**
|
|
279
|
+
- Update logic in one place (MCP)
|
|
280
|
+
- All commands automatically benefit
|
|
281
|
+
|
|
282
|
+
5. **Extensibility**
|
|
283
|
+
- Add new checks/features in MCP
|
|
284
|
+
- Available to all consumers immediately
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## CI/CD Integration
|
|
289
|
+
|
|
290
|
+
```yaml
|
|
291
|
+
# GitHub Actions example
|
|
292
|
+
jobs:
|
|
293
|
+
validate:
|
|
294
|
+
runs-on: ubuntu-latest
|
|
295
|
+
steps:
|
|
296
|
+
- uses: actions/checkout@v4
|
|
297
|
+
|
|
298
|
+
- name: Validate conventions
|
|
299
|
+
run: |
|
|
300
|
+
OUTPUT=$(claude-code "/validate --json")
|
|
301
|
+
if [ "$(echo $OUTPUT | jq '.valid')" != "true" ]; then
|
|
302
|
+
echo "::error::Convention violations detected"
|
|
303
|
+
exit 1
|
|
304
|
+
fi
|
|
305
|
+
|
|
306
|
+
- name: Check migration conflicts
|
|
307
|
+
run: |
|
|
308
|
+
OUTPUT=$(claude-code "/efcore:conflicts --json")
|
|
309
|
+
if [ "$(echo $OUTPUT | jq '.hasConflicts')" = "true" ]; then
|
|
310
|
+
echo "::error::Migration conflicts detected"
|
|
311
|
+
exit 1
|
|
312
|
+
fi
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Fallback Behavior
|
|
318
|
+
|
|
319
|
+
When MCP is unavailable, commands fall back to:
|
|
320
|
+
|
|
321
|
+
1. **Local bash scripts** for simple operations
|
|
322
|
+
2. **Manual template generation** for scaffolding
|
|
323
|
+
3. **Warning message** indicating degraded mode
|
|
324
|
+
|
|
325
|
+
To check MCP availability:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
# MCP health check
|
|
329
|
+
claude-code --mcp-status smartstack
|
|
330
|
+
```
|
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
# /notification - Integration Notifications SmartStack
|
|
2
|
-
|
|
3
|
-
> **Synergie Skill/Commande:**
|
|
4
|
-
> - **Skill** (`templates/skills/notification/`) → Invocation automatique par Claude
|
|
5
|
-
> - **Commande** (`/notification`) → Invocation manuelle par l'utilisateur
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## ARGUMENTS
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
/notification <action> [options]
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
| Action | Description |
|
|
16
|
-
|--------|-------------|
|
|
17
|
-
| `add` | Ajouter une notification dans un service existant |
|
|
18
|
-
| `type` | Creer un nouveau type de notification |
|
|
19
|
-
| `hook` | Creer le hook frontend avec SignalR |
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## WORKFLOW
|
|
24
|
-
|
|
25
|
-
### /notification add
|
|
26
|
-
|
|
27
|
-
Ajoute l'envoi de notification dans un service existant.
|
|
28
|
-
|
|
29
|
-
**Questions:**
|
|
30
|
-
1. Quel service modifier ? (liste des services)
|
|
31
|
-
2. Quelle methode ? (Create, Update, Delete, etc.)
|
|
32
|
-
3. Qui notifier ? (createur, assigne, role, liste)
|
|
33
|
-
4. Quel type de notification ? (existant ou nouveau)
|
|
34
|
-
|
|
35
|
-
**Actions:**
|
|
36
|
-
1. Injecter `INotificationService` si pas present
|
|
37
|
-
2. Ajouter l'appel `SendNotificationAsync` dans la methode
|
|
38
|
-
3. Logger l'envoi de notification
|
|
39
|
-
|
|
40
|
-
### /notification type
|
|
41
|
-
|
|
42
|
-
Cree un nouveau type de notification.
|
|
43
|
-
|
|
44
|
-
**Questions:**
|
|
45
|
-
1. Nom du type ? (ex: `ProductCreated`)
|
|
46
|
-
2. Categorie ? (Support, Admin, System, SLA)
|
|
47
|
-
3. Description ?
|
|
48
|
-
|
|
49
|
-
**Actions:**
|
|
50
|
-
1. Ajouter dans `NotificationType.cs`
|
|
51
|
-
2. Creer migration EF Core
|
|
52
|
-
|
|
53
|
-
### /notification hook
|
|
54
|
-
|
|
55
|
-
Cree le hook frontend pour recevoir les notifications en temps reel.
|
|
56
|
-
|
|
57
|
-
**Questions:**
|
|
58
|
-
1. Quel module ?
|
|
59
|
-
2. Quel type d'entite ?
|
|
60
|
-
|
|
61
|
-
**Actions:**
|
|
62
|
-
1. Creer `use{Module}Notifications.ts`
|
|
63
|
-
2. Integrer `useSignalR`
|
|
64
|
-
3. Configurer les callbacks
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## TEMPLATES
|
|
69
|
-
|
|
70
|
-
### Template SendNotification
|
|
71
|
-
|
|
72
|
-
```csharp
|
|
73
|
-
await _notificationService.SendNotificationAsync(
|
|
74
|
-
userId: $USER_ID,
|
|
75
|
-
type: NotificationType.$TYPE,
|
|
76
|
-
title: "$TITLE",
|
|
77
|
-
message: $"$MESSAGE",
|
|
78
|
-
relatedEntityType: "$ENTITY_TYPE",
|
|
79
|
-
relatedEntityId: $ENTITY_ID,
|
|
80
|
-
actionUrl: $"/$MODULE/$ENTITY_ID",
|
|
81
|
-
cancellationToken: ct);
|
|
82
|
-
|
|
83
|
-
_logger.LogInformation(
|
|
84
|
-
"Notification sent to {UserId}: {Type}",
|
|
85
|
-
$USER_ID, NotificationType.$TYPE);
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Template Hook
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
// hooks/use{Module}Notifications.ts
|
|
92
|
-
import { useSignalR } from '@/hooks/useSignalR';
|
|
93
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
94
|
-
import { toast } from 'sonner';
|
|
95
|
-
|
|
96
|
-
export function use{Module}Notifications() {
|
|
97
|
-
const queryClient = useQueryClient();
|
|
98
|
-
|
|
99
|
-
useSignalR({
|
|
100
|
-
onNotification: (notification) => {
|
|
101
|
-
if (notification.relatedEntityType === '{Entity}') {
|
|
102
|
-
queryClient.invalidateQueries(['{module}']);
|
|
103
|
-
toast.info(notification.title, {
|
|
104
|
-
description: notification.message,
|
|
105
|
-
action: notification.actionUrl ? {
|
|
106
|
-
label: 'Voir',
|
|
107
|
-
onClick: () => window.location.href = notification.actionUrl,
|
|
108
|
-
} : undefined,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
## FICHIERS CLES
|
|
119
|
-
|
|
120
|
-
| Fichier | Role |
|
|
121
|
-
|---------|------|
|
|
122
|
-
| `Domain/Support/Enums/NotificationType.cs` | Types de notification |
|
|
123
|
-
| `Application/Common/Interfaces/INotificationService.cs` | Interface |
|
|
124
|
-
| `Infrastructure/Services/Support/NotificationService.cs` | Implementation |
|
|
125
|
-
| `web/src/hooks/useSignalR.ts` | Hook SignalR |
|
|
126
|
-
|
|
127
|
-
---
|
|
128
|
-
|
|
129
|
-
User: $ARGUMENTS
|
|
1
|
+
# /notification - Integration Notifications SmartStack
|
|
2
|
+
|
|
3
|
+
> **Synergie Skill/Commande:**
|
|
4
|
+
> - **Skill** (`templates/skills/notification/`) → Invocation automatique par Claude
|
|
5
|
+
> - **Commande** (`/notification`) → Invocation manuelle par l'utilisateur
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ARGUMENTS
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
/notification <action> [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
| Action | Description |
|
|
16
|
+
|--------|-------------|
|
|
17
|
+
| `add` | Ajouter une notification dans un service existant |
|
|
18
|
+
| `type` | Creer un nouveau type de notification |
|
|
19
|
+
| `hook` | Creer le hook frontend avec SignalR |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## WORKFLOW
|
|
24
|
+
|
|
25
|
+
### /notification add
|
|
26
|
+
|
|
27
|
+
Ajoute l'envoi de notification dans un service existant.
|
|
28
|
+
|
|
29
|
+
**Questions:**
|
|
30
|
+
1. Quel service modifier ? (liste des services)
|
|
31
|
+
2. Quelle methode ? (Create, Update, Delete, etc.)
|
|
32
|
+
3. Qui notifier ? (createur, assigne, role, liste)
|
|
33
|
+
4. Quel type de notification ? (existant ou nouveau)
|
|
34
|
+
|
|
35
|
+
**Actions:**
|
|
36
|
+
1. Injecter `INotificationService` si pas present
|
|
37
|
+
2. Ajouter l'appel `SendNotificationAsync` dans la methode
|
|
38
|
+
3. Logger l'envoi de notification
|
|
39
|
+
|
|
40
|
+
### /notification type
|
|
41
|
+
|
|
42
|
+
Cree un nouveau type de notification.
|
|
43
|
+
|
|
44
|
+
**Questions:**
|
|
45
|
+
1. Nom du type ? (ex: `ProductCreated`)
|
|
46
|
+
2. Categorie ? (Support, Admin, System, SLA)
|
|
47
|
+
3. Description ?
|
|
48
|
+
|
|
49
|
+
**Actions:**
|
|
50
|
+
1. Ajouter dans `NotificationType.cs`
|
|
51
|
+
2. Creer migration EF Core
|
|
52
|
+
|
|
53
|
+
### /notification hook
|
|
54
|
+
|
|
55
|
+
Cree le hook frontend pour recevoir les notifications en temps reel.
|
|
56
|
+
|
|
57
|
+
**Questions:**
|
|
58
|
+
1. Quel module ?
|
|
59
|
+
2. Quel type d'entite ?
|
|
60
|
+
|
|
61
|
+
**Actions:**
|
|
62
|
+
1. Creer `use{Module}Notifications.ts`
|
|
63
|
+
2. Integrer `useSignalR`
|
|
64
|
+
3. Configurer les callbacks
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## TEMPLATES
|
|
69
|
+
|
|
70
|
+
### Template SendNotification
|
|
71
|
+
|
|
72
|
+
```csharp
|
|
73
|
+
await _notificationService.SendNotificationAsync(
|
|
74
|
+
userId: $USER_ID,
|
|
75
|
+
type: NotificationType.$TYPE,
|
|
76
|
+
title: "$TITLE",
|
|
77
|
+
message: $"$MESSAGE",
|
|
78
|
+
relatedEntityType: "$ENTITY_TYPE",
|
|
79
|
+
relatedEntityId: $ENTITY_ID,
|
|
80
|
+
actionUrl: $"/$MODULE/$ENTITY_ID",
|
|
81
|
+
cancellationToken: ct);
|
|
82
|
+
|
|
83
|
+
_logger.LogInformation(
|
|
84
|
+
"Notification sent to {UserId}: {Type}",
|
|
85
|
+
$USER_ID, NotificationType.$TYPE);
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Template Hook
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// hooks/use{Module}Notifications.ts
|
|
92
|
+
import { useSignalR } from '@/hooks/useSignalR';
|
|
93
|
+
import { useQueryClient } from '@tanstack/react-query';
|
|
94
|
+
import { toast } from 'sonner';
|
|
95
|
+
|
|
96
|
+
export function use{Module}Notifications() {
|
|
97
|
+
const queryClient = useQueryClient();
|
|
98
|
+
|
|
99
|
+
useSignalR({
|
|
100
|
+
onNotification: (notification) => {
|
|
101
|
+
if (notification.relatedEntityType === '{Entity}') {
|
|
102
|
+
queryClient.invalidateQueries(['{module}']);
|
|
103
|
+
toast.info(notification.title, {
|
|
104
|
+
description: notification.message,
|
|
105
|
+
action: notification.actionUrl ? {
|
|
106
|
+
label: 'Voir',
|
|
107
|
+
onClick: () => window.location.href = notification.actionUrl,
|
|
108
|
+
} : undefined,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## FICHIERS CLES
|
|
119
|
+
|
|
120
|
+
| Fichier | Role |
|
|
121
|
+
|---------|------|
|
|
122
|
+
| `Domain/Support/Enums/NotificationType.cs` | Types de notification |
|
|
123
|
+
| `Application/Common/Interfaces/INotificationService.cs` | Interface |
|
|
124
|
+
| `Infrastructure/Services/Support/NotificationService.cs` | Implementation |
|
|
125
|
+
| `web/src/hooks/useSignalR.ts` | Hook SignalR |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
User: $ARGUMENTS
|