Browse Source

Merge pull request #23910 from abpframework/issue-23871

feat(schematics): add ai-config schematic for generating AI tool configurations
pull/24304/head
Yağmur Çelik 2 months ago
committed by GitHub
parent
commit
cb4ac2e3ef
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      npm/ng-packs/packages/schematics/src/collection.json
  2. 186
      npm/ng-packs/packages/schematics/src/commands/ai-config/files/claude/.claude/CLAUDE.md
  3. 186
      npm/ng-packs/packages/schematics/src/commands/ai-config/files/copilot/.github/copilot-instructions.md
  4. 186
      npm/ng-packs/packages/schematics/src/commands/ai-config/files/cursor/.cursor/rules/cursor.mdc
  5. 186
      npm/ng-packs/packages/schematics/src/commands/ai-config/files/gemini/.gemini/GEMINI.md
  6. 186
      npm/ng-packs/packages/schematics/src/commands/ai-config/files/junie/.junie/guidelines.md
  7. 186
      npm/ng-packs/packages/schematics/src/commands/ai-config/files/windsurf/.windsurf/rules/guidelines.md
  8. 118
      npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts
  9. 12
      npm/ng-packs/packages/schematics/src/commands/ai-config/model.ts
  10. 30
      npm/ng-packs/packages/schematics/src/commands/ai-config/schema.json
  11. 2
      npm/ng-packs/scripts/build-schematics.ts

5
npm/ng-packs/packages/schematics/src/collection.json

@ -35,6 +35,11 @@
"factory": "./commands/change-theme",
"schema": "./commands/change-theme/schema.json"
},
"ai-config": {
"description": "Generates AI configuration files for Angular projects",
"factory": "./commands/ai-config",
"schema": "./commands/ai-config/schema.json"
},
"server": {
"factory": "./commands/ssr-add/server",
"description": "Create an Angular server app.",

186
npm/ng-packs/packages/schematics/src/commands/ai-config/files/claude/.claude/CLAUDE.md

@ -0,0 +1,186 @@
# 💻 ABP Full-Stack Development Rules
_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_
You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**.
You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**.
---
## 🧩 1. General Principles
- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers.
- Follow **modular architecture** — each layer or feature should be independently testable and reusable.
- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**.
- Prioritize **readability, maintainability, and performance**.
- Write **idiomatic** and **self-documenting** code.
---
## ⚙️ 2. ABP / .NET Development Rules
### Code Style and Structure
- Follow ABP’s standard folder structure:
- `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`
- Write concise, idiomatic C# code using modern language features.
- Apply **modular and layered design** (Domain, Application, Infrastructure, UI).
- Prefer **LINQ** and **lambda expressions** for collection operations.
- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`).
### Naming Conventions
- **PascalCase** → Classes, Methods, Properties
- **camelCase** → Local variables and private fields
- **UPPER_CASE** → Constants
- Prefix interfaces with **`I`** (e.g., `IUserRepository`).
### C# and .NET Usage
- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment).
- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging).
- Integrate **Entity Framework Core** with ABP’s repository abstractions.
### Syntax and Formatting
- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions).
- Use `var` when the type is clear.
- Use `string interpolation` and null-conditional operators.
- Keep code consistent and well-formatted.
### Error Handling and Validation
- Use exceptions only for exceptional cases.
- Log errors via ABP’s built-in logging or a compatible provider.
- Validate models with **DataAnnotations** or **FluentValidation**.
- Rely on ABP’s global exception middleware for unified responses.
- Return consistent HTTP status codes and error DTOs.
### API Design
- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**.
- Use **attribute-based routing** and versioning when needed.
- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization).
### Performance Optimization
- Use `async/await` for I/O operations.
- Use `IDistributedCache` over `IMemoryCache`.
- Avoid N+1 queries — include relations explicitly.
- Implement pagination with `PagedResultDto`.
### Key Conventions
- Use **Dependency Injection** via ABP’s DI system.
- Apply **repository pattern** or EF Core directly as needed.
- Use **AutoMapper** or ABP object mapping for DTOs.
- Implement **background jobs** with ABP’s job system or `IHostedService`.
- Follow **domain-driven design (DDD)** principles:
- Business rules in Domain layer.
- Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc.
- Avoid unnecessary dependencies between layers.
### Testing
- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing.
- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`).
- Mock dependencies properly and use ABP’s test base classes.
### Security
- Use **OpenIddict** for authentication & authorization.
- Implement permission checks through ABP’s infrastructure.
- Enforce **HTTPS** and properly configure **CORS**.
### API Documentation
- Use **Swagger / OpenAPI** (Swashbuckle or NSwag).
- Add XML comments to controllers and DTOs.
- Follow ABP’s documentation conventions for module APIs.
**Reference Best Practices:**
- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services)
- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories)
- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities)
- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services)
- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects)
- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration)
---
## 🌐 3. Angular / TypeScript Development Rules
### TypeScript Best Practices
- Enable **strict type checking** in `tsconfig.json`.
- Use **type inference** when the type is obvious.
- Avoid `any`; use `unknown` or generics instead.
- Use interfaces and types for clarity and structure.
### Angular Best Practices
- Prefer **standalone components** (no `NgModules`).
- Do **NOT** set `standalone: true` manually — it’s default.
- Use **signals** for state management.
- Implement **lazy loading** for feature routes.
- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators.
- Use **`NgOptimizedImage`** for static images (not base64).
### Components
- Keep components small, focused, and reusable.
- Use `input()` and `output()` functions instead of decorators.
- Use `computed()` for derived state.
- Always set `changeDetection: ChangeDetectionStrategy.OnPush`.
- Use **inline templates** for small components.
- Prefer **Reactive Forms** over template-driven forms.
- Avoid `ngClass` → use `[class]` bindings.
- Avoid `ngStyle` → use `[style]` bindings.
### State Management
- Manage **local component state** with signals.
- Use **`computed()`** for derived data.
- Keep state transformations **pure and predictable**.
- Avoid `mutate()` on signals — use `update()` or `set()`.
### Templates
- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives.
- Keep templates minimal and declarative.
- Use the **async pipe** for observable bindings.
### Services
- Design services for **single responsibility**.
- Provide services using `providedIn: 'root'`.
- Use the **`inject()` function** instead of constructor injection.
### Component Replacement
ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`:
**Key Features:**
- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations
- Replace layouts (Application, Account, Empty)
- Replace UI elements (Logo, Routes, NavItems)
**Basic Usage:**
```typescript
import { ReplaceableComponentsService } from '@abp/ng.core';
import { eIdentityComponents } from '@abp/ng.identity';
constructor(private replaceableComponents: ReplaceableComponentsService) {
this.replaceableComponents.add({
component: YourCustomComponent,
key: eIdentityComponents.Roles,
});
}
```
**Important Notes:**
- Component templates must include `<router-outlet></router-outlet>` for layouts
- Use the second parameter as `true` for runtime replacement (refreshes route)
- Runtime replacement clears component state and re-runs initialization logic
**📚 Full Documentation:**
For detailed examples, layout replacement, and advanced scenarios:
[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface)
---
## 🔒 4. Combined Full-Stack Practices
- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**.
- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation).
- Version APIs carefully and handle changes in Angular clients.
- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration.
- Apply **global error handling** and consistent response wrappers in both layers.
- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**.
---
## ✅ Summary
This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring:
- Code is **modular**, **performant**, and **maintainable**.
- Teams follow **consistent conventions** across backend and frontend.
- Every layer (Domain, Application, UI) is **clean, testable, and scalable**.

186
npm/ng-packs/packages/schematics/src/commands/ai-config/files/copilot/.github/copilot-instructions.md

@ -0,0 +1,186 @@
# 💻 ABP Full-Stack Development Rules
_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_
You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**.
You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**.
---
## 🧩 1. General Principles
- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers.
- Follow **modular architecture** — each layer or feature should be independently testable and reusable.
- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**.
- Prioritize **readability, maintainability, and performance**.
- Write **idiomatic** and **self-documenting** code.
---
## ⚙️ 2. ABP / .NET Development Rules
### Code Style and Structure
- Follow ABP’s standard folder structure:
- `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`
- Write concise, idiomatic C# code using modern language features.
- Apply **modular and layered design** (Domain, Application, Infrastructure, UI).
- Prefer **LINQ** and **lambda expressions** for collection operations.
- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`).
### Naming Conventions
- **PascalCase** → Classes, Methods, Properties
- **camelCase** → Local variables and private fields
- **UPPER_CASE** → Constants
- Prefix interfaces with **`I`** (e.g., `IUserRepository`).
### C# and .NET Usage
- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment).
- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging).
- Integrate **Entity Framework Core** with ABP’s repository abstractions.
### Syntax and Formatting
- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions).
- Use `var` when the type is clear.
- Use `string interpolation` and null-conditional operators.
- Keep code consistent and well-formatted.
### Error Handling and Validation
- Use exceptions only for exceptional cases.
- Log errors via ABP’s built-in logging or a compatible provider.
- Validate models with **DataAnnotations** or **FluentValidation**.
- Rely on ABP’s global exception middleware for unified responses.
- Return consistent HTTP status codes and error DTOs.
### API Design
- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**.
- Use **attribute-based routing** and versioning when needed.
- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization).
### Performance Optimization
- Use `async/await` for I/O operations.
- Use `IDistributedCache` over `IMemoryCache`.
- Avoid N+1 queries — include relations explicitly.
- Implement pagination with `PagedResultDto`.
### Key Conventions
- Use **Dependency Injection** via ABP’s DI system.
- Apply **repository pattern** or EF Core directly as needed.
- Use **AutoMapper** or ABP object mapping for DTOs.
- Implement **background jobs** with ABP’s job system or `IHostedService`.
- Follow **domain-driven design (DDD)** principles:
- Business rules in Domain layer.
- Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc.
- Avoid unnecessary dependencies between layers.
### Testing
- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing.
- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`).
- Mock dependencies properly and use ABP’s test base classes.
### Security
- Use **OpenIddict** for authentication & authorization.
- Implement permission checks through ABP’s infrastructure.
- Enforce **HTTPS** and properly configure **CORS**.
### API Documentation
- Use **Swagger / OpenAPI** (Swashbuckle or NSwag).
- Add XML comments to controllers and DTOs.
- Follow ABP’s documentation conventions for module APIs.
**Reference Best Practices:**
- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services)
- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories)
- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities)
- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services)
- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects)
- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration)
---
## 🌐 3. Angular / TypeScript Development Rules
### TypeScript Best Practices
- Enable **strict type checking** in `tsconfig.json`.
- Use **type inference** when the type is obvious.
- Avoid `any`; use `unknown` or generics instead.
- Use interfaces and types for clarity and structure.
### Angular Best Practices
- Prefer **standalone components** (no `NgModules`).
- Do **NOT** set `standalone: true` manually — it’s default.
- Use **signals** for state management.
- Implement **lazy loading** for feature routes.
- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators.
- Use **`NgOptimizedImage`** for static images (not base64).
### Components
- Keep components small, focused, and reusable.
- Use `input()` and `output()` functions instead of decorators.
- Use `computed()` for derived state.
- Always set `changeDetection: ChangeDetectionStrategy.OnPush`.
- Use **inline templates** for small components.
- Prefer **Reactive Forms** over template-driven forms.
- Avoid `ngClass` → use `[class]` bindings.
- Avoid `ngStyle` → use `[style]` bindings.
### State Management
- Manage **local component state** with signals.
- Use **`computed()`** for derived data.
- Keep state transformations **pure and predictable**.
- Avoid `mutate()` on signals — use `update()` or `set()`.
### Templates
- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives.
- Keep templates minimal and declarative.
- Use the **async pipe** for observable bindings.
### Services
- Design services for **single responsibility**.
- Provide services using `providedIn: 'root'`.
- Use the **`inject()` function** instead of constructor injection.
### Component Replacement
ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`:
**Key Features:**
- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations
- Replace layouts (Application, Account, Empty)
- Replace UI elements (Logo, Routes, NavItems)
**Basic Usage:**
```typescript
import { ReplaceableComponentsService } from '@abp/ng.core';
import { eIdentityComponents } from '@abp/ng.identity';
constructor(private replaceableComponents: ReplaceableComponentsService) {
this.replaceableComponents.add({
component: YourCustomComponent,
key: eIdentityComponents.Roles,
});
}
```
**Important Notes:**
- Component templates must include `<router-outlet></router-outlet>` for layouts
- Use the second parameter as `true` for runtime replacement (refreshes route)
- Runtime replacement clears component state and re-runs initialization logic
**📚 Full Documentation:**
For detailed examples, layout replacement, and advanced scenarios:
[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface)
---
## 🔒 4. Combined Full-Stack Practices
- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**.
- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation).
- Version APIs carefully and handle changes in Angular clients.
- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration.
- Apply **global error handling** and consistent response wrappers in both layers.
- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**.
---
## ✅ Summary
This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring:
- Code is **modular**, **performant**, and **maintainable**.
- Teams follow **consistent conventions** across backend and frontend.
- Every layer (Domain, Application, UI) is **clean, testable, and scalable**.

186
npm/ng-packs/packages/schematics/src/commands/ai-config/files/cursor/.cursor/rules/cursor.mdc

@ -0,0 +1,186 @@
# 💻 ABP Full-Stack Development Rules
_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_
You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**.
You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**.
---
## 🧩 1. General Principles
- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers.
- Follow **modular architecture** — each layer or feature should be independently testable and reusable.
- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**.
- Prioritize **readability, maintainability, and performance**.
- Write **idiomatic** and **self-documenting** code.
---
## ⚙️ 2. ABP / .NET Development Rules
### Code Style and Structure
- Follow ABP’s standard folder structure:
- `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`
- Write concise, idiomatic C# code using modern language features.
- Apply **modular and layered design** (Domain, Application, Infrastructure, UI).
- Prefer **LINQ** and **lambda expressions** for collection operations.
- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`).
### Naming Conventions
- **PascalCase** → Classes, Methods, Properties
- **camelCase** → Local variables and private fields
- **UPPER_CASE** → Constants
- Prefix interfaces with **`I`** (e.g., `IUserRepository`).
### C# and .NET Usage
- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment).
- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging).
- Integrate **Entity Framework Core** with ABP’s repository abstractions.
### Syntax and Formatting
- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions).
- Use `var` when the type is clear.
- Use `string interpolation` and null-conditional operators.
- Keep code consistent and well-formatted.
### Error Handling and Validation
- Use exceptions only for exceptional cases.
- Log errors via ABP’s built-in logging or a compatible provider.
- Validate models with **DataAnnotations** or **FluentValidation**.
- Rely on ABP’s global exception middleware for unified responses.
- Return consistent HTTP status codes and error DTOs.
### API Design
- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**.
- Use **attribute-based routing** and versioning when needed.
- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization).
### Performance Optimization
- Use `async/await` for I/O operations.
- Use `IDistributedCache` over `IMemoryCache`.
- Avoid N+1 queries — include relations explicitly.
- Implement pagination with `PagedResultDto`.
### Key Conventions
- Use **Dependency Injection** via ABP’s DI system.
- Apply **repository pattern** or EF Core directly as needed.
- Use **AutoMapper** or ABP object mapping for DTOs.
- Implement **background jobs** with ABP’s job system or `IHostedService`.
- Follow **domain-driven design (DDD)** principles:
- Business rules in Domain layer.
- Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc.
- Avoid unnecessary dependencies between layers.
### Testing
- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing.
- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`).
- Mock dependencies properly and use ABP’s test base classes.
### Security
- Use **OpenIddict** for authentication & authorization.
- Implement permission checks through ABP’s infrastructure.
- Enforce **HTTPS** and properly configure **CORS**.
### API Documentation
- Use **Swagger / OpenAPI** (Swashbuckle or NSwag).
- Add XML comments to controllers and DTOs.
- Follow ABP’s documentation conventions for module APIs.
**Reference Best Practices:**
- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services)
- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories)
- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities)
- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services)
- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects)
- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration)
---
## 🌐 3. Angular / TypeScript Development Rules
### TypeScript Best Practices
- Enable **strict type checking** in `tsconfig.json`.
- Use **type inference** when the type is obvious.
- Avoid `any`; use `unknown` or generics instead.
- Use interfaces and types for clarity and structure.
### Angular Best Practices
- Prefer **standalone components** (no `NgModules`).
- Do **NOT** set `standalone: true` manually — it’s default.
- Use **signals** for state management.
- Implement **lazy loading** for feature routes.
- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators.
- Use **`NgOptimizedImage`** for static images (not base64).
### Components
- Keep components small, focused, and reusable.
- Use `input()` and `output()` functions instead of decorators.
- Use `computed()` for derived state.
- Always set `changeDetection: ChangeDetectionStrategy.OnPush`.
- Use **inline templates** for small components.
- Prefer **Reactive Forms** over template-driven forms.
- Avoid `ngClass` → use `[class]` bindings.
- Avoid `ngStyle` → use `[style]` bindings.
### State Management
- Manage **local component state** with signals.
- Use **`computed()`** for derived data.
- Keep state transformations **pure and predictable**.
- Avoid `mutate()` on signals — use `update()` or `set()`.
### Templates
- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives.
- Keep templates minimal and declarative.
- Use the **async pipe** for observable bindings.
### Services
- Design services for **single responsibility**.
- Provide services using `providedIn: 'root'`.
- Use the **`inject()` function** instead of constructor injection.
### Component Replacement
ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`:
**Key Features:**
- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations
- Replace layouts (Application, Account, Empty)
- Replace UI elements (Logo, Routes, NavItems)
**Basic Usage:**
```typescript
import { ReplaceableComponentsService } from '@abp/ng.core';
import { eIdentityComponents } from '@abp/ng.identity';
constructor(private replaceableComponents: ReplaceableComponentsService) {
this.replaceableComponents.add({
component: YourCustomComponent,
key: eIdentityComponents.Roles,
});
}
```
**Important Notes:**
- Component templates must include `<router-outlet></router-outlet>` for layouts
- Use the second parameter as `true` for runtime replacement (refreshes route)
- Runtime replacement clears component state and re-runs initialization logic
**📚 Full Documentation:**
For detailed examples, layout replacement, and advanced scenarios:
[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface)
---
## 🔒 4. Combined Full-Stack Practices
- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**.
- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation).
- Version APIs carefully and handle changes in Angular clients.
- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration.
- Apply **global error handling** and consistent response wrappers in both layers.
- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**.
---
## ✅ Summary
This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring:
- Code is **modular**, **performant**, and **maintainable**.
- Teams follow **consistent conventions** across backend and frontend.
- Every layer (Domain, Application, UI) is **clean, testable, and scalable**.

186
npm/ng-packs/packages/schematics/src/commands/ai-config/files/gemini/.gemini/GEMINI.md

@ -0,0 +1,186 @@
# 💻 ABP Full-Stack Development Rules
_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_
You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**.
You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**.
---
## 🧩 1. General Principles
- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers.
- Follow **modular architecture** — each layer or feature should be independently testable and reusable.
- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**.
- Prioritize **readability, maintainability, and performance**.
- Write **idiomatic** and **self-documenting** code.
---
## ⚙️ 2. ABP / .NET Development Rules
### Code Style and Structure
- Follow ABP’s standard folder structure:
- `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`
- Write concise, idiomatic C# code using modern language features.
- Apply **modular and layered design** (Domain, Application, Infrastructure, UI).
- Prefer **LINQ** and **lambda expressions** for collection operations.
- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`).
### Naming Conventions
- **PascalCase** → Classes, Methods, Properties
- **camelCase** → Local variables and private fields
- **UPPER_CASE** → Constants
- Prefix interfaces with **`I`** (e.g., `IUserRepository`).
### C# and .NET Usage
- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment).
- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging).
- Integrate **Entity Framework Core** with ABP’s repository abstractions.
### Syntax and Formatting
- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions).
- Use `var` when the type is clear.
- Use `string interpolation` and null-conditional operators.
- Keep code consistent and well-formatted.
### Error Handling and Validation
- Use exceptions only for exceptional cases.
- Log errors via ABP’s built-in logging or a compatible provider.
- Validate models with **DataAnnotations** or **FluentValidation**.
- Rely on ABP’s global exception middleware for unified responses.
- Return consistent HTTP status codes and error DTOs.
### API Design
- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**.
- Use **attribute-based routing** and versioning when needed.
- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization).
### Performance Optimization
- Use `async/await` for I/O operations.
- Use `IDistributedCache` over `IMemoryCache`.
- Avoid N+1 queries — include relations explicitly.
- Implement pagination with `PagedResultDto`.
### Key Conventions
- Use **Dependency Injection** via ABP’s DI system.
- Apply **repository pattern** or EF Core directly as needed.
- Use **AutoMapper** or ABP object mapping for DTOs.
- Implement **background jobs** with ABP’s job system or `IHostedService`.
- Follow **domain-driven design (DDD)** principles:
- Business rules in Domain layer.
- Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc.
- Avoid unnecessary dependencies between layers.
### Testing
- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing.
- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`).
- Mock dependencies properly and use ABP’s test base classes.
### Security
- Use **OpenIddict** for authentication & authorization.
- Implement permission checks through ABP’s infrastructure.
- Enforce **HTTPS** and properly configure **CORS**.
### API Documentation
- Use **Swagger / OpenAPI** (Swashbuckle or NSwag).
- Add XML comments to controllers and DTOs.
- Follow ABP’s documentation conventions for module APIs.
**Reference Best Practices:**
- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services)
- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories)
- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities)
- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services)
- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects)
- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration)
---
## 🌐 3. Angular / TypeScript Development Rules
### TypeScript Best Practices
- Enable **strict type checking** in `tsconfig.json`.
- Use **type inference** when the type is obvious.
- Avoid `any`; use `unknown` or generics instead.
- Use interfaces and types for clarity and structure.
### Angular Best Practices
- Prefer **standalone components** (no `NgModules`).
- Do **NOT** set `standalone: true` manually — it’s default.
- Use **signals** for state management.
- Implement **lazy loading** for feature routes.
- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators.
- Use **`NgOptimizedImage`** for static images (not base64).
### Components
- Keep components small, focused, and reusable.
- Use `input()` and `output()` functions instead of decorators.
- Use `computed()` for derived state.
- Always set `changeDetection: ChangeDetectionStrategy.OnPush`.
- Use **inline templates** for small components.
- Prefer **Reactive Forms** over template-driven forms.
- Avoid `ngClass` → use `[class]` bindings.
- Avoid `ngStyle` → use `[style]` bindings.
### State Management
- Manage **local component state** with signals.
- Use **`computed()`** for derived data.
- Keep state transformations **pure and predictable**.
- Avoid `mutate()` on signals — use `update()` or `set()`.
### Templates
- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives.
- Keep templates minimal and declarative.
- Use the **async pipe** for observable bindings.
### Services
- Design services for **single responsibility**.
- Provide services using `providedIn: 'root'`.
- Use the **`inject()` function** instead of constructor injection.
### Component Replacement
ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`:
**Key Features:**
- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations
- Replace layouts (Application, Account, Empty)
- Replace UI elements (Logo, Routes, NavItems)
**Basic Usage:**
```typescript
import { ReplaceableComponentsService } from '@abp/ng.core';
import { eIdentityComponents } from '@abp/ng.identity';
constructor(private replaceableComponents: ReplaceableComponentsService) {
this.replaceableComponents.add({
component: YourCustomComponent,
key: eIdentityComponents.Roles,
});
}
```
**Important Notes:**
- Component templates must include `<router-outlet></router-outlet>` for layouts
- Use the second parameter as `true` for runtime replacement (refreshes route)
- Runtime replacement clears component state and re-runs initialization logic
**📚 Full Documentation:**
For detailed examples, layout replacement, and advanced scenarios:
[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface)
---
## 🔒 4. Combined Full-Stack Practices
- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**.
- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation).
- Version APIs carefully and handle changes in Angular clients.
- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration.
- Apply **global error handling** and consistent response wrappers in both layers.
- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**.
---
## ✅ Summary
This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring:
- Code is **modular**, **performant**, and **maintainable**.
- Teams follow **consistent conventions** across backend and frontend.
- Every layer (Domain, Application, UI) is **clean, testable, and scalable**.

186
npm/ng-packs/packages/schematics/src/commands/ai-config/files/junie/.junie/guidelines.md

@ -0,0 +1,186 @@
# 💻 ABP Full-Stack Development Rules
_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_
You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**.
You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**.
---
## 🧩 1. General Principles
- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers.
- Follow **modular architecture** — each layer or feature should be independently testable and reusable.
- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**.
- Prioritize **readability, maintainability, and performance**.
- Write **idiomatic** and **self-documenting** code.
---
## ⚙️ 2. ABP / .NET Development Rules
### Code Style and Structure
- Follow ABP’s standard folder structure:
- `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`
- Write concise, idiomatic C# code using modern language features.
- Apply **modular and layered design** (Domain, Application, Infrastructure, UI).
- Prefer **LINQ** and **lambda expressions** for collection operations.
- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`).
### Naming Conventions
- **PascalCase** → Classes, Methods, Properties
- **camelCase** → Local variables and private fields
- **UPPER_CASE** → Constants
- Prefix interfaces with **`I`** (e.g., `IUserRepository`).
### C# and .NET Usage
- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment).
- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging).
- Integrate **Entity Framework Core** with ABP’s repository abstractions.
### Syntax and Formatting
- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions).
- Use `var` when the type is clear.
- Use `string interpolation` and null-conditional operators.
- Keep code consistent and well-formatted.
### Error Handling and Validation
- Use exceptions only for exceptional cases.
- Log errors via ABP’s built-in logging or a compatible provider.
- Validate models with **DataAnnotations** or **FluentValidation**.
- Rely on ABP’s global exception middleware for unified responses.
- Return consistent HTTP status codes and error DTOs.
### API Design
- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**.
- Use **attribute-based routing** and versioning when needed.
- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization).
### Performance Optimization
- Use `async/await` for I/O operations.
- Use `IDistributedCache` over `IMemoryCache`.
- Avoid N+1 queries — include relations explicitly.
- Implement pagination with `PagedResultDto`.
### Key Conventions
- Use **Dependency Injection** via ABP’s DI system.
- Apply **repository pattern** or EF Core directly as needed.
- Use **AutoMapper** or ABP object mapping for DTOs.
- Implement **background jobs** with ABP’s job system or `IHostedService`.
- Follow **domain-driven design (DDD)** principles:
- Business rules in Domain layer.
- Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc.
- Avoid unnecessary dependencies between layers.
### Testing
- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing.
- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`).
- Mock dependencies properly and use ABP’s test base classes.
### Security
- Use **OpenIddict** for authentication & authorization.
- Implement permission checks through ABP’s infrastructure.
- Enforce **HTTPS** and properly configure **CORS**.
### API Documentation
- Use **Swagger / OpenAPI** (Swashbuckle or NSwag).
- Add XML comments to controllers and DTOs.
- Follow ABP’s documentation conventions for module APIs.
**Reference Best Practices:**
- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services)
- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories)
- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities)
- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services)
- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects)
- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration)
---
## 🌐 3. Angular / TypeScript Development Rules
### TypeScript Best Practices
- Enable **strict type checking** in `tsconfig.json`.
- Use **type inference** when the type is obvious.
- Avoid `any`; use `unknown` or generics instead.
- Use interfaces and types for clarity and structure.
### Angular Best Practices
- Prefer **standalone components** (no `NgModules`).
- Do **NOT** set `standalone: true` manually — it’s default.
- Use **signals** for state management.
- Implement **lazy loading** for feature routes.
- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators.
- Use **`NgOptimizedImage`** for static images (not base64).
### Components
- Keep components small, focused, and reusable.
- Use `input()` and `output()` functions instead of decorators.
- Use `computed()` for derived state.
- Always set `changeDetection: ChangeDetectionStrategy.OnPush`.
- Use **inline templates** for small components.
- Prefer **Reactive Forms** over template-driven forms.
- Avoid `ngClass` → use `[class]` bindings.
- Avoid `ngStyle` → use `[style]` bindings.
### State Management
- Manage **local component state** with signals.
- Use **`computed()`** for derived data.
- Keep state transformations **pure and predictable**.
- Avoid `mutate()` on signals — use `update()` or `set()`.
### Templates
- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives.
- Keep templates minimal and declarative.
- Use the **async pipe** for observable bindings.
### Services
- Design services for **single responsibility**.
- Provide services using `providedIn: 'root'`.
- Use the **`inject()` function** instead of constructor injection.
### Component Replacement
ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`:
**Key Features:**
- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations
- Replace layouts (Application, Account, Empty)
- Replace UI elements (Logo, Routes, NavItems)
**Basic Usage:**
```typescript
import { ReplaceableComponentsService } from '@abp/ng.core';
import { eIdentityComponents } from '@abp/ng.identity';
constructor(private replaceableComponents: ReplaceableComponentsService) {
this.replaceableComponents.add({
component: YourCustomComponent,
key: eIdentityComponents.Roles,
});
}
```
**Important Notes:**
- Component templates must include `<router-outlet></router-outlet>` for layouts
- Use the second parameter as `true` for runtime replacement (refreshes route)
- Runtime replacement clears component state and re-runs initialization logic
**📚 Full Documentation:**
For detailed examples, layout replacement, and advanced scenarios:
[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface)
---
## 🔒 4. Combined Full-Stack Practices
- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**.
- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation).
- Version APIs carefully and handle changes in Angular clients.
- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration.
- Apply **global error handling** and consistent response wrappers in both layers.
- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**.
---
## ✅ Summary
This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring:
- Code is **modular**, **performant**, and **maintainable**.
- Teams follow **consistent conventions** across backend and frontend.
- Every layer (Domain, Application, UI) is **clean, testable, and scalable**.

186
npm/ng-packs/packages/schematics/src/commands/ai-config/files/windsurf/.windsurf/rules/guidelines.md

@ -0,0 +1,186 @@
# 💻 ABP Full-Stack Development Rules
_Expert Guidelines for .NET Backend (ABP) and Angular Frontend Development_
You are a **senior full-stack developer** specializing in **ABP Framework (.NET)** and **Angular (TypeScript)**.
You write **clean, maintainable, and modular** code following **ABP, ASP.NET Core, and Angular best practices**.
---
## 🧩 1. General Principles
- Maintain a clear separation between backend (ABP/.NET) and frontend (Angular) layers.
- Follow **modular architecture** — each layer or feature should be independently testable and reusable.
- Always adhere to **official ABP documentation** ([docs.abp.io](https://docs.abp.io)) and **Angular official guides**.
- Prioritize **readability, maintainability, and performance**.
- Write **idiomatic** and **self-documenting** code.
---
## ⚙️ 2. ABP / .NET Development Rules
### Code Style and Structure
- Follow ABP’s standard folder structure:
- `*.Application`, `*.Domain`, `*.EntityFrameworkCore`, `*.HttpApi`
- Write concise, idiomatic C# code using modern language features.
- Apply **modular and layered design** (Domain, Application, Infrastructure, UI).
- Prefer **LINQ** and **lambda expressions** for collection operations.
- Use **descriptive method and variable names** (`GetActiveUsers`, `CalculateTotalAmount`).
### Naming Conventions
- **PascalCase** → Classes, Methods, Properties
- **camelCase** → Local variables and private fields
- **UPPER_CASE** → Constants
- Prefix interfaces with **`I`** (e.g., `IUserRepository`).
### C# and .NET Usage
- Use **C# 10+ features** (records, pattern matching, null-coalescing assignment).
- Utilize **ABP modules** (Permission Management, Setting Management, Audit Logging).
- Integrate **Entity Framework Core** with ABP’s repository abstractions.
### Syntax and Formatting
- Follow [Microsoft C# Coding Conventions](https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions).
- Use `var` when the type is clear.
- Use `string interpolation` and null-conditional operators.
- Keep code consistent and well-formatted.
### Error Handling and Validation
- Use exceptions only for exceptional cases.
- Log errors via ABP’s built-in logging or a compatible provider.
- Validate models with **DataAnnotations** or **FluentValidation**.
- Rely on ABP’s global exception middleware for unified responses.
- Return consistent HTTP status codes and error DTOs.
### API Design
- Build RESTful APIs via `HttpApi` layer and **ABP conventional controllers**.
- Use **attribute-based routing** and versioning when needed.
- Apply **action filters/middleware** for cross-cutting concerns (auditing, authorization).
### Performance Optimization
- Use `async/await` for I/O operations.
- Use `IDistributedCache` over `IMemoryCache`.
- Avoid N+1 queries — include relations explicitly.
- Implement pagination with `PagedResultDto`.
### Key Conventions
- Use **Dependency Injection** via ABP’s DI system.
- Apply **repository pattern** or EF Core directly as needed.
- Use **AutoMapper** or ABP object mapping for DTOs.
- Implement **background jobs** with ABP’s job system or `IHostedService`.
- Follow **domain-driven design (DDD)** principles:
- Business rules in Domain layer.
- Use `AuditedAggregateRoot`, `FullAuditedEntity`, etc.
- Avoid unnecessary dependencies between layers.
### Testing
- Use **xUnit**, **Shouldly**, and **NSubstitute** for testing.
- Write **unit and integration tests** per module (`Application.Tests`, `Domain.Tests`).
- Mock dependencies properly and use ABP’s test base classes.
### Security
- Use **OpenIddict** for authentication & authorization.
- Implement permission checks through ABP’s infrastructure.
- Enforce **HTTPS** and properly configure **CORS**.
### API Documentation
- Use **Swagger / OpenAPI** (Swashbuckle or NSwag).
- Add XML comments to controllers and DTOs.
- Follow ABP’s documentation conventions for module APIs.
**Reference Best Practices:**
- [Domain Services](https://abp.io/docs/latest/framework/architecture/best-practices/domain-services)
- [Repositories](https://abp.io/docs/latest/framework/architecture/best-practices/repositories)
- [Entities](https://abp.io/docs/latest/framework/architecture/best-practices/entities)
- [Application Services](https://abp.io/docs/latest/framework/architecture/best-practices/application-services)
- [DTOs](https://abp.io/docs/latest/framework/architecture/best-practices/data-transfer-objects)
- [Entity Framework Integration](https://abp.io/docs/latest/framework/architecture/best-practices/entity-framework-core-integration)
---
## 🌐 3. Angular / TypeScript Development Rules
### TypeScript Best Practices
- Enable **strict type checking** in `tsconfig.json`.
- Use **type inference** when the type is obvious.
- Avoid `any`; use `unknown` or generics instead.
- Use interfaces and types for clarity and structure.
### Angular Best Practices
- Prefer **standalone components** (no `NgModules`).
- Do **NOT** set `standalone: true` manually — it’s default.
- Use **signals** for state management.
- Implement **lazy loading** for feature routes.
- Avoid `@HostBinding` / `@HostListener`; use `host` object in decorators.
- Use **`NgOptimizedImage`** for static images (not base64).
### Components
- Keep components small, focused, and reusable.
- Use `input()` and `output()` functions instead of decorators.
- Use `computed()` for derived state.
- Always set `changeDetection: ChangeDetectionStrategy.OnPush`.
- Use **inline templates** for small components.
- Prefer **Reactive Forms** over template-driven forms.
- Avoid `ngClass` → use `[class]` bindings.
- Avoid `ngStyle` → use `[style]` bindings.
### State Management
- Manage **local component state** with signals.
- Use **`computed()`** for derived data.
- Keep state transformations **pure and predictable**.
- Avoid `mutate()` on signals — use `update()` or `set()`.
### Templates
- Use **native control flow** (`@if`, `@for`, `@switch`) instead of structural directives.
- Keep templates minimal and declarative.
- Use the **async pipe** for observable bindings.
### Services
- Design services for **single responsibility**.
- Provide services using `providedIn: 'root'`.
- Use the **`inject()` function** instead of constructor injection.
### Component Replacement
ABP Angular provides a powerful **component replacement** system via `ReplaceableComponentsService`:
**Key Features:**
- Replace ABP default components (Roles, Users, Tenants, etc.) with custom implementations
- Replace layouts (Application, Account, Empty)
- Replace UI elements (Logo, Routes, NavItems)
**Basic Usage:**
```typescript
import { ReplaceableComponentsService } from '@abp/ng.core';
import { eIdentityComponents } from '@abp/ng.identity';
constructor(private replaceableComponents: ReplaceableComponentsService) {
this.replaceableComponents.add({
component: YourCustomComponent,
key: eIdentityComponents.Roles,
});
}
```
**Important Notes:**
- Component templates must include `<router-outlet></router-outlet>` for layouts
- Use the second parameter as `true` for runtime replacement (refreshes route)
- Runtime replacement clears component state and re-runs initialization logic
**📚 Full Documentation:**
For detailed examples, layout replacement, and advanced scenarios:
[Component Replacement Guide](https://abp.io/docs/latest/framework/ui/angular/customization-user-interface)
---
## 🔒 4. Combined Full-Stack Practices
- Ensure backend and frontend follow consistent **DTO contracts** and **naming conventions**.
- Maintain shared models (e.g., via a `contracts` package or OpenAPI generation).
- Version APIs carefully and handle changes in Angular clients.
- Use ABP’s **CORS**, **Swagger**, and **Identity** modules to simplify frontend integration.
- Apply **global error handling** and consistent response wrappers in both layers.
- Monitor performance with tools like **Application Insights**, **ABP auditing**, or **Angular profiler**.
---
## ✅ Summary
This document defines a unified standard for developing **ABP + Angular full-stack applications**, ensuring:
- Code is **modular**, **performant**, and **maintainable**.
- Teams follow **consistent conventions** across backend and frontend.
- Every layer (Domain, Application, UI) is **clean, testable, and scalable**.

118
npm/ng-packs/packages/schematics/src/commands/ai-config/index.ts

@ -0,0 +1,118 @@
import {
Rule,
SchematicsException,
Tree,
apply,
url,
mergeWith,
MergeStrategy,
filter,
chain,
} from '@angular-devkit/schematics';
import { join, normalize } from '@angular-devkit/core';
import { AiConfigSchema, AiTool } from './model';
import { getWorkspace } from '../../utils';
export default function (options: AiConfigSchema): Rule {
return async (tree: Tree) => {
if (!options.tool || options.tool.trim() === '') {
console.log('ℹ️ No AI tools selected. Skipping configuration generation.');
console.log('');
console.log('💡 Usage examples:');
console.log(' ng g @abp/ng.schematics:ai-config --tool=claude,cursor');
console.log(' ng g @abp/ng.schematics:ai-config --tool="claude, cursor"');
console.log(' ng g @abp/ng.schematics:ai-config --tool=gemini --tool=cursor');
console.log(' ng g @abp/ng.schematics:ai-config --tool=gemini --target-project=my-app');
console.log('');
console.log('Available tools: claude, copilot, cursor, gemini, junie, windsurf');
return tree;
}
const tools = options.tool.split(/[\s,]+/).filter(t => t) as AiTool[];
const validTools: AiTool[] = ['claude', 'copilot', 'cursor', 'gemini', 'junie', 'windsurf'];
const invalidTools = tools.filter(tool => !validTools.includes(tool));
if (invalidTools.length > 0) {
throw new SchematicsException(
`Invalid AI tool(s): ${invalidTools.join(', ')}. Valid options are: ${validTools.join(', ')}`,
);
}
if (tools.length === 0) {
console.log('ℹ️ No AI tools selected. Skipping configuration generation.');
return tree;
}
const workspace = await getWorkspace(tree);
let targetPath = '/';
if (options.targetProject) {
const trimmedTargetProject = options.targetProject.trim();
const project = workspace.projects.get(trimmedTargetProject);
if (!project) {
throw new SchematicsException(`Project "${trimmedTargetProject}" not found in workspace.`);
}
targetPath = normalize(project.root);
}
console.log('🚀 Generating AI configuration files...');
console.log(`📁 Target path: ${targetPath}`);
console.log(`🤖 Selected tools: ${tools.join(', ')}`);
const rules: Rule[] = tools.map(tool =>
generateConfigForTool(tool, targetPath, options.overwrite || false),
);
return chain([
...rules,
(tree: Tree) => {
console.log('✅ AI configuration files generated successfully!');
console.log('\n📝 Generated files:');
tools.forEach(tool => {
const configPath = getConfigPath(tool, targetPath);
console.log(` - ${configPath}`);
});
console.log('\n💡 Tip: Restart your IDE or AI tool to apply the new configurations.');
return tree;
},
]);
};
}
function generateConfigForTool(tool: AiTool, targetPath: string, overwrite: boolean): Rule {
return (tree: Tree) => {
const configPath = getConfigPath(tool, targetPath);
if (tree.exists(configPath) && !overwrite) {
console.log(`⚠️ Configuration file already exists: ${configPath}`);
console.log(` Use --overwrite flag to replace existing files.`);
return tree;
}
const sourceDir = `./files/${tool}`;
const source = apply(url(sourceDir), [
filter(path => {
return !path.endsWith('.DS_Store');
}),
]);
return mergeWith(source, overwrite ? MergeStrategy.Overwrite : MergeStrategy.Default);
};
}
function getConfigPath(tool: AiTool, basePath: string): string {
const configFiles: Record<AiTool, string> = {
claude: '.claude/CLAUDE.md',
copilot: '.github/copilot-instructions.md',
cursor: '.cursor/rules/cursor.mdc',
gemini: '.gemini/GEMINI.md',
junie: '.junie/guidelines.md',
windsurf: '.windsurf/rules/guidelines.md',
};
const configFile = configFiles[tool];
return join(normalize(basePath), configFile);
}

12
npm/ng-packs/packages/schematics/src/commands/ai-config/model.ts

@ -0,0 +1,12 @@
export type AiTool = 'claude' | 'copilot' | 'cursor' | 'gemini' | 'junie' | 'windsurf';
export interface AiConfigSchema {
tool?: string;
targetProject?: string;
overwrite?: boolean;
}
export interface AiConfigFile {
path: string;
content: string;
}

30
npm/ng-packs/packages/schematics/src/commands/ai-config/schema.json

@ -0,0 +1,30 @@
{
"$schema": "http://json-schema.org/schema",
"$id": "SchematicsABPAiConfig",
"title": "ABP AI Configuration Generator Schema",
"type": "object",
"properties": {
"tool": {
"description": "Comma-separated list of AI tools (e.g., claude,cursor,gemini)",
"type": "string",
"x-prompt": {
"message": "Which AI tools would you like to generate configuration files for? (comma-separated)",
"type": "input"
}
},
"targetProject": {
"description": "The target project name to generate AI configuration files for",
"type": "string",
"x-prompt": {
"message": "Which project would you like to generate AI config for?",
"type": "input"
}
},
"overwrite": {
"description": "Overwrite existing AI configuration files",
"type": "boolean",
"default": false
}
},
"required": []
}

2
npm/ng-packs/scripts/build-schematics.ts

@ -22,6 +22,8 @@ const PACKAGE_TO_BUILD = 'schematics';
const FILES_TO_COPY_AFTER_BUILD: (FileCopy | string)[] = [
{ src: 'src/commands/create-lib/schema.json', dest: 'commands/create-lib/schema.json' },
{ src: 'src/commands/change-theme/schema.json', dest: 'commands/change-theme/schema.json' },
{ src: 'src/commands/ai-config/schema.json', dest: 'commands/ai-config/schema.json' },
{ src: 'src/commands/ai-config/files', dest: 'commands/ai-config/files' },
{ src: 'src/commands/create-lib/files-package', dest: 'commands/create-lib/files-package' },
{ src: 'src/commands/create-lib/files-package-standalone', dest: 'commands/create-lib/files-package-standalone' },
{

Loading…
Cancel
Save