mdan-cli 2.5.1 → 2.7.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/AGENTS.md +76 -1
- package/README.md +274 -4
- package/agents/auto-orchestrator.md +343 -0
- package/agents/devops.md +511 -94
- package/cli/mdan.py +111 -6
- package/cli/mdan_crewai.py +539 -0
- package/core/crewai_orchestrator.md +419 -0
- package/core/debate-protocol.md +454 -0
- package/core/universal-envelope.md +113 -0
- package/integrations/__init__.py +33 -0
- package/integrations/crewai/__init__.py +27 -0
- package/integrations/crewai/agents/__init__.py +21 -0
- package/integrations/crewai/agents/architect_agent.py +264 -0
- package/integrations/crewai/agents/dev_agent.py +271 -0
- package/integrations/crewai/agents/devops_agent.py +421 -0
- package/integrations/crewai/agents/doc_agent.py +388 -0
- package/integrations/crewai/agents/product_agent.py +203 -0
- package/integrations/crewai/agents/security_agent.py +386 -0
- package/integrations/crewai/agents/test_agent.py +358 -0
- package/integrations/crewai/agents/ux_agent.py +257 -0
- package/integrations/crewai/flows/__init__.py +13 -0
- package/integrations/crewai/flows/auto_flow.py +451 -0
- package/integrations/crewai/flows/build_flow.py +297 -0
- package/integrations/crewai/flows/debate_flow.py +422 -0
- package/integrations/crewai/flows/discovery_flow.py +267 -0
- package/integrations/crewai/orchestrator.py +558 -0
- package/integrations/crewai/skills/__init__.py +8 -0
- package/integrations/crewai/skills/skill_router.py +534 -0
- package/integrations/crewai/tools/__init__.py +11 -0
- package/integrations/crewai/tools/file_tool.py +355 -0
- package/integrations/crewai/tools/serper_tool.py +169 -0
- package/integrations/crewai/tools/sql_tool.py +435 -0
- package/memory/CONTEXT-SAVE-FORMAT.md +328 -0
- package/memory/MEMORY-AUTO.json +66 -0
- package/memory/RESUME-PROTOCOL.md +379 -0
- package/package.json +1 -1
- package/phases/auto-01-load.md +165 -0
- package/phases/auto-02-discover.md +207 -0
- package/phases/auto-03-plan.md +509 -0
- package/phases/auto-04-architect.md +567 -0
- package/phases/auto-05-implement.md +713 -0
- package/phases/auto-06-test.md +559 -0
- package/phases/auto-07-deploy.md +510 -0
- package/phases/auto-08-doc.md +970 -0
- package/skills/azure-devops/skill.md +1757 -0
- package/templates/dotnet-blazor/README.md +415 -0
- package/templates/external-services/ExampleService.cs +361 -0
- package/templates/external-services/IService.cs +113 -0
- package/templates/external-services/README.md +325 -0
- package/templates/external-services/ServiceBase.cs +492 -0
- package/templates/external-services/ServiceProvider.cs +243 -0
- package/templates/prompts/devops-agent.yaml +327 -0
- package/templates/prompts.json +15 -1
- package/templates/sql-server/README.md +37 -0
- package/templates/sql-server/functions.sql +158 -0
- package/templates/sql-server/schema.sql +188 -0
- package/templates/sql-server/stored-procedures.sql +284 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# .NET 8.0 Blazor Server Project Template
|
|
2
|
+
|
|
3
|
+
## Project Structure
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
MyProject/
|
|
7
|
+
├── MyProject.sln
|
|
8
|
+
├── src/
|
|
9
|
+
│ ├── MyProject.Server/
|
|
10
|
+
│ │ ├── Program.cs
|
|
11
|
+
│ │ ├── Startup.cs
|
|
12
|
+
│ │ ├── appsettings.json
|
|
13
|
+
│ │ ├── appsettings.Development.json
|
|
14
|
+
│ │ ├── appsettings.Production.json
|
|
15
|
+
│ │ ├── Data/
|
|
16
|
+
│ │ │ └── ApplicationDbContext.cs
|
|
17
|
+
│ │ ├── Models/
|
|
18
|
+
│ │ ├── Controllers/
|
|
19
|
+
│ │ ├── Pages/
|
|
20
|
+
│ │ ├── Services/
|
|
21
|
+
│ │ └── wwwroot/
|
|
22
|
+
│ │ ├── css/
|
|
23
|
+
│ │ ├── js/
|
|
24
|
+
│ │ └── lib/
|
|
25
|
+
│ ├── MyProject.Shared/
|
|
26
|
+
│ │ └── Models/
|
|
27
|
+
│ └── MyProject.Client/
|
|
28
|
+
│ └── Components/
|
|
29
|
+
└── tests/
|
|
30
|
+
├── MyProject.Tests/
|
|
31
|
+
└── MyProject.IntegrationTests/
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Program.cs
|
|
35
|
+
|
|
36
|
+
```csharp
|
|
37
|
+
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
|
38
|
+
using Microsoft.Identity.Web;
|
|
39
|
+
using Microsoft.EntityFrameworkCore;
|
|
40
|
+
using MyProject.Server.Data;
|
|
41
|
+
using MyProject.Server.Services;
|
|
42
|
+
|
|
43
|
+
var builder = WebApplication.CreateBuilder(args);
|
|
44
|
+
|
|
45
|
+
// Add services
|
|
46
|
+
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
|
|
47
|
+
.AddMicrosoftIdentityWebApp(builder.Configuration.GetSection("AzureAd"));
|
|
48
|
+
|
|
49
|
+
builder.Services.AddAuthorization();
|
|
50
|
+
|
|
51
|
+
builder.Services.AddRazorPages();
|
|
52
|
+
builder.Services.AddServerSideBlazor()
|
|
53
|
+
.AddMicrosoftIdentityConsentHandler();
|
|
54
|
+
|
|
55
|
+
builder.Services.AddControllersWithViews();
|
|
56
|
+
|
|
57
|
+
// Database
|
|
58
|
+
builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
|
59
|
+
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
|
|
60
|
+
|
|
61
|
+
// Services
|
|
62
|
+
builder.Services.AddScoped<IUserService, UserService>();
|
|
63
|
+
builder.Services.AddScoped<INotificationService, NotificationService>();
|
|
64
|
+
|
|
65
|
+
// External Services (Generic)
|
|
66
|
+
builder.Services.AddHttpClient<IExternalService, ExternalService>();
|
|
67
|
+
|
|
68
|
+
// SignalR
|
|
69
|
+
builder.Services.AddSignalR();
|
|
70
|
+
|
|
71
|
+
var app = builder.Build();
|
|
72
|
+
|
|
73
|
+
// Configure pipeline
|
|
74
|
+
if (app.Environment.IsDevelopment())
|
|
75
|
+
{
|
|
76
|
+
app.UseDeveloperExceptionPage();
|
|
77
|
+
}
|
|
78
|
+
else
|
|
79
|
+
{
|
|
80
|
+
app.UseExceptionHandler("/Error");
|
|
81
|
+
app.UseHsts();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
app.UseHttpsRedirection();
|
|
85
|
+
app.UseStaticFiles();
|
|
86
|
+
|
|
87
|
+
app.UseRouting();
|
|
88
|
+
|
|
89
|
+
app.UseAuthentication();
|
|
90
|
+
app.UseAuthorization();
|
|
91
|
+
|
|
92
|
+
app.MapControllers();
|
|
93
|
+
app.MapBlazorHub();
|
|
94
|
+
app.MapFallbackToPage("/_Host");
|
|
95
|
+
|
|
96
|
+
app.Run();
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## appsettings.json
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"ConnectionStrings": {
|
|
104
|
+
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=MyProjectDb;Trusted_Connection=True;MultipleActiveResultSets=true"
|
|
105
|
+
},
|
|
106
|
+
"AzureAd": {
|
|
107
|
+
"Instance": "https://login.microsoftonline.com/",
|
|
108
|
+
"Domain": "yourdomain.onmicrosoft.com",
|
|
109
|
+
"TenantId": "your-tenant-id",
|
|
110
|
+
"ClientId": "your-client-id",
|
|
111
|
+
"CallbackPath": "/signin-oidc",
|
|
112
|
+
"SignedOutCallbackPath": "/signout-callback-oidc"
|
|
113
|
+
},
|
|
114
|
+
"ExternalServices": {
|
|
115
|
+
"ServiceName": {
|
|
116
|
+
"BaseUrl": "https://api.example.com/v1",
|
|
117
|
+
"ApiKey": "your-api-key",
|
|
118
|
+
"Timeout": 30,
|
|
119
|
+
"RetryCount": 3,
|
|
120
|
+
"RetryDelay": 1000,
|
|
121
|
+
"EnableCircuitBreaker": true,
|
|
122
|
+
"CircuitBreakerThreshold": 5,
|
|
123
|
+
"EnableRateLimiting": true,
|
|
124
|
+
"RateLimitPerMinute": 60,
|
|
125
|
+
"EnableCaching": true,
|
|
126
|
+
"CacheDurationMinutes": 5
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"Logging": {
|
|
130
|
+
"LogLevel": {
|
|
131
|
+
"Default": "Information",
|
|
132
|
+
"Microsoft.AspNetCore": "Warning"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"AllowedHosts": "*"
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## ApplicationDbContext.cs
|
|
140
|
+
|
|
141
|
+
```csharp
|
|
142
|
+
using Microsoft.EntityFrameworkCore;
|
|
143
|
+
using MyProject.Server.Models;
|
|
144
|
+
|
|
145
|
+
namespace MyProject.Server.Data;
|
|
146
|
+
|
|
147
|
+
public class ApplicationDbContext : DbContext
|
|
148
|
+
{
|
|
149
|
+
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
|
|
150
|
+
: base(options)
|
|
151
|
+
{
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
public DbSet<User> Users { get; set; }
|
|
155
|
+
public DbSet<Notification> Notifications { get; set; }
|
|
156
|
+
|
|
157
|
+
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
158
|
+
{
|
|
159
|
+
base.OnModelCreating(modelBuilder);
|
|
160
|
+
|
|
161
|
+
// User configuration
|
|
162
|
+
modelBuilder.Entity<User>(entity =>
|
|
163
|
+
{
|
|
164
|
+
entity.HasKey(e => e.Id);
|
|
165
|
+
entity.HasIndex(e => e.AzureAdId).IsUnique();
|
|
166
|
+
entity.HasIndex(e => e.Email).IsUnique();
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// Notification configuration
|
|
170
|
+
modelBuilder.Entity<Notification>(entity =>
|
|
171
|
+
{
|
|
172
|
+
entity.HasKey(e => e.Id);
|
|
173
|
+
entity.HasOne(e => e.User)
|
|
174
|
+
.WithMany(u => u.Notifications)
|
|
175
|
+
.HasForeignKey(e => e.UserId)
|
|
176
|
+
.OnDelete(DeleteBehavior.Cascade);
|
|
177
|
+
entity.HasIndex(e => e.UserId);
|
|
178
|
+
entity.HasIndex(e => e.IsRead);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## User Model
|
|
185
|
+
|
|
186
|
+
```csharp
|
|
187
|
+
using System.ComponentModel.DataAnnotations;
|
|
188
|
+
using System.ComponentModel.DataAnnotations.Schema;
|
|
189
|
+
|
|
190
|
+
namespace MyProject.Server.Models;
|
|
191
|
+
|
|
192
|
+
public class User
|
|
193
|
+
{
|
|
194
|
+
[Key]
|
|
195
|
+
public int Id { get; set; }
|
|
196
|
+
|
|
197
|
+
[Required]
|
|
198
|
+
[MaxLength(100)]
|
|
199
|
+
public string AzureAdId { get; set; } = string.Empty;
|
|
200
|
+
|
|
201
|
+
[Required]
|
|
202
|
+
[MaxLength(255)]
|
|
203
|
+
public string Email { get; set; } = string.Empty;
|
|
204
|
+
|
|
205
|
+
[MaxLength(100)]
|
|
206
|
+
public string? FirstName { get; set; }
|
|
207
|
+
|
|
208
|
+
[MaxLength(100)]
|
|
209
|
+
public string? LastName { get; set; }
|
|
210
|
+
|
|
211
|
+
[MaxLength(50)]
|
|
212
|
+
public string Role { get; set; } = "User";
|
|
213
|
+
|
|
214
|
+
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
215
|
+
|
|
216
|
+
public DateTime? LastLoginAt { get; set; }
|
|
217
|
+
|
|
218
|
+
// Navigation properties
|
|
219
|
+
public ICollection<Notification> Notifications { get; set; } = new List<Notification>();
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Notification Model
|
|
224
|
+
|
|
225
|
+
```csharp
|
|
226
|
+
using System.ComponentModel.DataAnnotations;
|
|
227
|
+
using System.ComponentModel.DataAnnotations.Schema;
|
|
228
|
+
|
|
229
|
+
namespace MyProject.Server.Models;
|
|
230
|
+
|
|
231
|
+
public class Notification
|
|
232
|
+
{
|
|
233
|
+
[Key]
|
|
234
|
+
public int Id { get; set; }
|
|
235
|
+
|
|
236
|
+
[Required]
|
|
237
|
+
public int UserId { get; set; }
|
|
238
|
+
|
|
239
|
+
[MaxLength(50)]
|
|
240
|
+
public string Type { get; set; } = string.Empty;
|
|
241
|
+
|
|
242
|
+
[MaxLength(200)]
|
|
243
|
+
public string Title { get; set; } = string.Empty;
|
|
244
|
+
|
|
245
|
+
[MaxLength(1000)]
|
|
246
|
+
public string Message { get; set; } = string.Empty;
|
|
247
|
+
|
|
248
|
+
public bool IsRead { get; set; } = false;
|
|
249
|
+
|
|
250
|
+
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
|
251
|
+
|
|
252
|
+
public DateTime? ReadAt { get; set; }
|
|
253
|
+
|
|
254
|
+
// Navigation properties
|
|
255
|
+
[ForeignKey(nameof(UserId))]
|
|
256
|
+
public User? User { get; set; }
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## UserService.cs
|
|
261
|
+
|
|
262
|
+
```csharp
|
|
263
|
+
using Microsoft.EntityFrameworkCore;
|
|
264
|
+
using MyProject.Server.Data;
|
|
265
|
+
using MyProject.Server.Models;
|
|
266
|
+
|
|
267
|
+
namespace MyProject.Server.Services;
|
|
268
|
+
|
|
269
|
+
public interface IUserService
|
|
270
|
+
{
|
|
271
|
+
Task<User?> GetUserByAzureAdIdAsync(string azureAdId);
|
|
272
|
+
Task<User?> GetUserByIdAsync(int id);
|
|
273
|
+
Task<IEnumerable<User>> GetAllUsersAsync();
|
|
274
|
+
Task<User> CreateUserAsync(User user);
|
|
275
|
+
Task<User?> UpdateUserAsync(int id, User user);
|
|
276
|
+
Task<bool> DeleteUserAsync(int id);
|
|
277
|
+
Task UpdateLastLoginAsync(int id);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
public class UserService : IUserService
|
|
281
|
+
{
|
|
282
|
+
private readonly ApplicationDbContext _context;
|
|
283
|
+
|
|
284
|
+
public UserService(ApplicationDbContext context)
|
|
285
|
+
{
|
|
286
|
+
_context = context;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
public async Task<User?> GetUserByAzureAdIdAsync(string azureAdId)
|
|
290
|
+
{
|
|
291
|
+
return await _context.Users
|
|
292
|
+
.FirstOrDefaultAsync(u => u.AzureAdId == azureAdId);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
public async Task<User?> GetUserByIdAsync(int id)
|
|
296
|
+
{
|
|
297
|
+
return await _context.Users
|
|
298
|
+
.FirstOrDefaultAsync(u => u.Id == id);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
public async Task<IEnumerable<User>> GetAllUsersAsync()
|
|
302
|
+
{
|
|
303
|
+
return await _context.Users
|
|
304
|
+
.OrderBy(u => u.CreatedAt)
|
|
305
|
+
.ToListAsync();
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
public async Task<User> CreateUserAsync(User user)
|
|
309
|
+
{
|
|
310
|
+
user.CreatedAt = DateTime.UtcNow;
|
|
311
|
+
_context.Users.Add(user);
|
|
312
|
+
await _context.SaveChangesAsync();
|
|
313
|
+
return user;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
public async Task<User?> UpdateUserAsync(int id, User user)
|
|
317
|
+
{
|
|
318
|
+
var existing = await _context.Users.FindAsync(id);
|
|
319
|
+
if (existing == null) return null;
|
|
320
|
+
|
|
321
|
+
existing.Email = user.Email;
|
|
322
|
+
existing.FirstName = user.FirstName;
|
|
323
|
+
existing.LastName = user.LastName;
|
|
324
|
+
existing.Role = user.Role;
|
|
325
|
+
|
|
326
|
+
await _context.SaveChangesAsync();
|
|
327
|
+
return existing;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
public async Task<bool> DeleteUserAsync(int id)
|
|
331
|
+
{
|
|
332
|
+
var user = await _context.Users.FindAsync(id);
|
|
333
|
+
if (user == null) return false;
|
|
334
|
+
|
|
335
|
+
_context.Users.Remove(user);
|
|
336
|
+
await _context.SaveChangesAsync();
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
public async Task UpdateLastLoginAsync(int id)
|
|
341
|
+
{
|
|
342
|
+
var user = await _context.Users.FindAsync(id);
|
|
343
|
+
if (user != null)
|
|
344
|
+
{
|
|
345
|
+
user.LastLoginAt = DateTime.UtcNow;
|
|
346
|
+
await _context.SaveChangesAsync();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
## Migration Commands
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# Add migration
|
|
356
|
+
dotnet ef migrations add InitialCreate --project src/MyProject.Server
|
|
357
|
+
|
|
358
|
+
# Update database
|
|
359
|
+
dotnet ef database update --project src/MyProject.Server
|
|
360
|
+
|
|
361
|
+
# Create SQL script
|
|
362
|
+
dotnet ef migrations script --project src/MyProject.Server --output migration.sql
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Build Commands
|
|
366
|
+
|
|
367
|
+
```bash
|
|
368
|
+
# Build solution
|
|
369
|
+
dotnet build
|
|
370
|
+
|
|
371
|
+
# Run application
|
|
372
|
+
dotnet run --project src/MyProject.Server
|
|
373
|
+
|
|
374
|
+
# Publish for production
|
|
375
|
+
dotnet publish src/MyProject.Server -c Release -o ./publish
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
## Testing Commands
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
# Run all tests
|
|
382
|
+
dotnet test
|
|
383
|
+
|
|
384
|
+
# Run with coverage
|
|
385
|
+
dotnet test --collect:"XPlat Code Coverage"
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## Docker Support
|
|
389
|
+
|
|
390
|
+
```dockerfile
|
|
391
|
+
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
|
|
392
|
+
WORKDIR /app
|
|
393
|
+
EXPOSE 80
|
|
394
|
+
EXPOSE 443
|
|
395
|
+
|
|
396
|
+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
|
397
|
+
WORKDIR /src
|
|
398
|
+
COPY ["src/MyProject.Server/MyProject.Server.csproj", "src/MyProject.Server/"]
|
|
399
|
+
RUN dotnet restore "src/MyProject.Server/MyProject.Server.csproj"
|
|
400
|
+
COPY . .
|
|
401
|
+
WORKDIR "/src/src/MyProject.Server"
|
|
402
|
+
RUN dotnet build "MyProject.Server.csproj" -c Release -o /app/build
|
|
403
|
+
|
|
404
|
+
FROM build AS publish
|
|
405
|
+
RUN dotnet publish "MyProject.Server.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
|
406
|
+
|
|
407
|
+
FROM base AS final
|
|
408
|
+
WORKDIR /app
|
|
409
|
+
COPY --from=publish /app/publish .
|
|
410
|
+
ENTRYPOINT ["dotnet", "MyProject.Server.dll"]
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Version
|
|
414
|
+
|
|
415
|
+
.NET 8.0 Blazor Server Template v1.0
|