maestro-bundle 1.3.0 → 1.4.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/README.md +125 -37
- package/package.json +1 -1
- package/src/cli.mjs +7 -4
- package/templates/bundle-ai-agents/skills/agent-orchestration/SKILL.md +107 -41
- package/templates/bundle-ai-agents/skills/agent-orchestration/references/graph-patterns.md +50 -0
- package/templates/bundle-ai-agents/skills/agent-orchestration/references/routing-strategies.md +47 -0
- package/templates/bundle-ai-agents/skills/api-design/SKILL.md +125 -16
- package/templates/bundle-ai-agents/skills/api-design/references/pydantic-patterns.md +72 -0
- package/templates/bundle-ai-agents/skills/api-design/references/rest-conventions.md +51 -0
- package/templates/bundle-ai-agents/skills/clean-architecture/SKILL.md +113 -21
- package/templates/bundle-ai-agents/skills/clean-architecture/references/dependency-injection.md +60 -0
- package/templates/bundle-ai-agents/skills/clean-architecture/references/layer-rules.md +56 -0
- package/templates/bundle-ai-agents/skills/context-engineering/SKILL.md +104 -36
- package/templates/bundle-ai-agents/skills/context-engineering/references/compression-techniques.md +76 -0
- package/templates/bundle-ai-agents/skills/context-engineering/references/context-budget-calculator.md +45 -0
- package/templates/bundle-ai-agents/skills/database-modeling/SKILL.md +146 -19
- package/templates/bundle-ai-agents/skills/database-modeling/references/index-strategies.md +48 -0
- package/templates/bundle-ai-agents/skills/database-modeling/references/naming-conventions.md +27 -0
- package/templates/bundle-ai-agents/skills/docker-containerization/SKILL.md +124 -15
- package/templates/bundle-ai-agents/skills/docker-containerization/references/compose-patterns.md +97 -0
- package/templates/bundle-ai-agents/skills/docker-containerization/references/dockerfile-checklist.md +37 -0
- package/templates/bundle-ai-agents/skills/eval-testing/SKILL.md +113 -25
- package/templates/bundle-ai-agents/skills/eval-testing/references/eval-types.md +52 -0
- package/templates/bundle-ai-agents/skills/eval-testing/references/golden-dataset-template.md +59 -0
- package/templates/bundle-ai-agents/skills/memory-management/SKILL.md +112 -28
- package/templates/bundle-ai-agents/skills/memory-management/references/memory-tiers.md +41 -0
- package/templates/bundle-ai-agents/skills/memory-management/references/namespace-conventions.md +41 -0
- package/templates/bundle-ai-agents/skills/prompt-engineering/SKILL.md +139 -47
- package/templates/bundle-ai-agents/skills/prompt-engineering/references/anti-patterns.md +59 -0
- package/templates/bundle-ai-agents/skills/prompt-engineering/references/prompt-templates.md +75 -0
- package/templates/bundle-ai-agents/skills/rag-pipeline/SKILL.md +104 -27
- package/templates/bundle-ai-agents/skills/rag-pipeline/references/chunking-strategies.md +27 -0
- package/templates/bundle-ai-agents/skills/rag-pipeline/references/embedding-models.md +31 -0
- package/templates/bundle-ai-agents/skills/rag-pipeline/references/rag-evaluation.md +39 -0
- package/templates/bundle-ai-agents/skills/testing-strategy/SKILL.md +127 -18
- package/templates/bundle-ai-agents/skills/testing-strategy/references/fixture-patterns.md +81 -0
- package/templates/bundle-ai-agents/skills/testing-strategy/references/naming-conventions.md +69 -0
- package/templates/bundle-base/skills/branch-strategy/SKILL.md +134 -21
- package/templates/bundle-base/skills/branch-strategy/references/branch-rules.md +40 -0
- package/templates/bundle-base/skills/code-review/SKILL.md +123 -38
- package/templates/bundle-base/skills/code-review/references/review-checklist.md +45 -0
- package/templates/bundle-base/skills/commit-pattern/SKILL.md +98 -39
- package/templates/bundle-base/skills/commit-pattern/references/conventional-commits.md +40 -0
- package/templates/bundle-data-pipeline/skills/data-preprocessing/SKILL.md +110 -19
- package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandas-cheatsheet.md +63 -0
- package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandera-schemas.md +44 -0
- package/templates/bundle-data-pipeline/skills/docker-containerization/SKILL.md +132 -16
- package/templates/bundle-data-pipeline/skills/docker-containerization/references/compose-patterns.md +82 -0
- package/templates/bundle-data-pipeline/skills/docker-containerization/references/dockerfile-best-practices.md +57 -0
- package/templates/bundle-data-pipeline/skills/feature-engineering/SKILL.md +143 -45
- package/templates/bundle-data-pipeline/skills/feature-engineering/references/encoding-guide.md +41 -0
- package/templates/bundle-data-pipeline/skills/feature-engineering/references/scaling-guide.md +38 -0
- package/templates/bundle-data-pipeline/skills/mlops-pipeline/SKILL.md +156 -37
- package/templates/bundle-data-pipeline/skills/mlops-pipeline/references/mlflow-commands.md +69 -0
- package/templates/bundle-data-pipeline/skills/model-training/SKILL.md +152 -33
- package/templates/bundle-data-pipeline/skills/model-training/references/evaluation-metrics.md +52 -0
- package/templates/bundle-data-pipeline/skills/model-training/references/model-selection-guide.md +41 -0
- package/templates/bundle-data-pipeline/skills/rag-pipeline/SKILL.md +127 -39
- package/templates/bundle-data-pipeline/skills/rag-pipeline/references/chunking-strategies.md +51 -0
- package/templates/bundle-data-pipeline/skills/rag-pipeline/references/embedding-models.md +49 -0
- package/templates/bundle-frontend-spa/skills/authentication/SKILL.md +196 -13
- package/templates/bundle-frontend-spa/skills/authentication/references/jwt-security.md +41 -0
- package/templates/bundle-frontend-spa/skills/component-design/SKILL.md +191 -41
- package/templates/bundle-frontend-spa/skills/component-design/references/accessibility-checklist.md +41 -0
- package/templates/bundle-frontend-spa/skills/component-design/references/tailwind-patterns.md +65 -0
- package/templates/bundle-frontend-spa/skills/e2e-testing/SKILL.md +241 -79
- package/templates/bundle-frontend-spa/skills/e2e-testing/references/playwright-selectors.md +66 -0
- package/templates/bundle-frontend-spa/skills/e2e-testing/references/test-patterns.md +82 -0
- package/templates/bundle-frontend-spa/skills/integration-api/SKILL.md +221 -31
- package/templates/bundle-frontend-spa/skills/integration-api/references/api-patterns.md +81 -0
- package/templates/bundle-frontend-spa/skills/react-patterns/SKILL.md +195 -70
- package/templates/bundle-frontend-spa/skills/react-patterns/references/component-checklist.md +22 -0
- package/templates/bundle-frontend-spa/skills/react-patterns/references/hook-patterns.md +63 -0
- package/templates/bundle-frontend-spa/skills/responsive-layout/SKILL.md +162 -22
- package/templates/bundle-frontend-spa/skills/responsive-layout/references/breakpoint-guide.md +63 -0
- package/templates/bundle-frontend-spa/skills/state-management/SKILL.md +158 -30
- package/templates/bundle-frontend-spa/skills/state-management/references/react-query-config.md +64 -0
- package/templates/bundle-frontend-spa/skills/state-management/references/state-patterns.md +78 -0
- package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/SKILL.md +135 -45
- package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/references/gitlab-ci-templates.md +93 -0
- package/templates/bundle-jhipster-microservices/skills/clean-architecture/SKILL.md +87 -21
- package/templates/bundle-jhipster-microservices/skills/clean-architecture/references/layer-rules.md +78 -0
- package/templates/bundle-jhipster-microservices/skills/ddd-tactical/SKILL.md +94 -25
- package/templates/bundle-jhipster-microservices/skills/ddd-tactical/references/ddd-patterns.md +48 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-angular/SKILL.md +63 -21
- package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-microservices.md +40 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-structure.md +59 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/SKILL.md +125 -91
- package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/references/docker-k8s-commands.md +68 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-entities/SKILL.md +72 -20
- package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/cross-service-entities.md +36 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/jdl-types.md +56 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/SKILL.md +80 -8
- package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/references/gateway-config.md +43 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/SKILL.md +115 -22
- package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/references/kafka-events.md +39 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-registry/SKILL.md +92 -23
- package/templates/bundle-jhipster-microservices/skills/jhipster-registry/references/consul-config.md +61 -0
- package/templates/bundle-jhipster-microservices/skills/jhipster-service/SKILL.md +81 -18
- package/templates/bundle-jhipster-microservices/skills/jhipster-service/references/service-patterns.md +40 -0
- package/templates/bundle-jhipster-microservices/skills/testing-strategy/SKILL.md +101 -20
- package/templates/bundle-jhipster-microservices/skills/testing-strategy/references/test-naming.md +55 -0
- package/templates/bundle-jhipster-monorepo/skills/clean-architecture/SKILL.md +87 -21
- package/templates/bundle-jhipster-monorepo/skills/clean-architecture/references/layer-rules.md +78 -0
- package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/SKILL.md +94 -25
- package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/references/ddd-patterns.md +48 -0
- package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/SKILL.md +99 -52
- package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/references/angular-structure.md +59 -0
- package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/SKILL.md +89 -36
- package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/references/jdl-types.md +56 -0
- package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/SKILL.md +123 -23
- package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/references/liquibase-operations.md +95 -0
- package/templates/bundle-jhipster-monorepo/skills/jhipster-security/SKILL.md +106 -19
- package/templates/bundle-jhipster-monorepo/skills/jhipster-security/references/security-checklist.md +47 -0
- package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/SKILL.md +84 -16
- package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/references/spring-layers.md +41 -0
- package/templates/bundle-jhipster-monorepo/skills/testing-strategy/SKILL.md +101 -20
- package/templates/bundle-jhipster-monorepo/skills/testing-strategy/references/test-naming.md +55 -0
|
@@ -1,13 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ddd-tactical
|
|
3
|
-
description:
|
|
3
|
+
description: Implement DDD tactical patterns -- Entities, Value Objects, Aggregates, Domain Events, Repositories, and Domain Services. Use when modeling domain, creating rich entities, defining aggregates, or applying DDD patterns.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: Maestro
|
|
4
6
|
---
|
|
5
7
|
|
|
6
|
-
# DDD
|
|
8
|
+
# DDD Tactical Patterns
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
Implement Domain-Driven Design tactical patterns including Entities, Value Objects, Aggregates, Domain Events, Repositories, and Domain Services.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
## When to Use
|
|
13
|
+
- When modeling domain entities with rich behavior
|
|
14
|
+
- When creating value objects for validated types
|
|
15
|
+
- When defining aggregate boundaries and invariants
|
|
16
|
+
- When implementing domain events for cross-aggregate communication
|
|
17
|
+
- When business logic spans multiple entities (Domain Services)
|
|
18
|
+
|
|
19
|
+
## Available Operations
|
|
20
|
+
1. Create Value Objects with validation
|
|
21
|
+
2. Create Entities with identity and behavior
|
|
22
|
+
3. Define Aggregates with invariant protection
|
|
23
|
+
4. Implement Domain Events
|
|
24
|
+
5. Create Domain Services for cross-entity logic
|
|
25
|
+
|
|
26
|
+
## Multi-Step Workflow
|
|
27
|
+
|
|
28
|
+
### Step 1: Identify Value Objects
|
|
29
|
+
Value Objects are immutable, compared by value, and contain self-validation.
|
|
11
30
|
|
|
12
31
|
```python
|
|
13
32
|
@dataclass(frozen=True)
|
|
@@ -24,7 +43,7 @@ class ComplianceScore:
|
|
|
24
43
|
|
|
25
44
|
def __post_init__(self):
|
|
26
45
|
if not 0 <= self.value <= 100:
|
|
27
|
-
raise ValueError("Score
|
|
46
|
+
raise ValueError("Score must be between 0 and 100")
|
|
28
47
|
|
|
29
48
|
def is_passing(self) -> bool:
|
|
30
49
|
return self.value >= 80.0
|
|
@@ -33,9 +52,8 @@ class ComplianceScore:
|
|
|
33
52
|
return f"{self.value:.1f}%"
|
|
34
53
|
```
|
|
35
54
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Identidade única, mutáveis, contêm comportamento.
|
|
55
|
+
### Step 2: Create Entities
|
|
56
|
+
Entities have unique identity, are mutable, and contain behavior.
|
|
39
57
|
|
|
40
58
|
```python
|
|
41
59
|
class Task:
|
|
@@ -66,31 +84,29 @@ class Task:
|
|
|
66
84
|
return None
|
|
67
85
|
```
|
|
68
86
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Cluster de entities com uma raiz que protege invariantes.
|
|
87
|
+
### Step 3: Define Aggregates
|
|
88
|
+
An Aggregate is a cluster of entities with a root that protects invariants.
|
|
72
89
|
|
|
73
90
|
```python
|
|
74
91
|
class Demand: # Aggregate Root
|
|
75
|
-
"""Demand
|
|
92
|
+
"""Demand is the root. Tasks are only accessed via Demand."""
|
|
76
93
|
|
|
77
94
|
def add_task(self, task: Task) -> None:
|
|
78
95
|
if len(self._tasks) >= 20:
|
|
79
|
-
raise TooManyTasksException("
|
|
96
|
+
raise TooManyTasksException("Maximum 20 tasks per demand")
|
|
80
97
|
self._tasks.append(task)
|
|
81
98
|
|
|
82
99
|
def start_task(self, task_id: TaskId) -> None:
|
|
83
100
|
task = self._find_task(task_id)
|
|
84
|
-
#
|
|
101
|
+
# Invariant: no more than 3 concurrent tasks
|
|
85
102
|
active = [t for t in self._tasks if t.status == TaskStatus.IN_PROGRESS]
|
|
86
103
|
if len(active) >= 3:
|
|
87
104
|
raise TooManyActiveTasksException()
|
|
88
105
|
task.start()
|
|
89
106
|
```
|
|
90
107
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Notificam que algo aconteceu no domínio.
|
|
108
|
+
### Step 4: Implement Domain Events
|
|
109
|
+
Domain Events notify that something happened in the domain.
|
|
94
110
|
|
|
95
111
|
```python
|
|
96
112
|
@dataclass(frozen=True)
|
|
@@ -112,9 +128,8 @@ class ComplianceViolationDetected(DomainEvent):
|
|
|
112
128
|
severity: str # "warning" | "critical"
|
|
113
129
|
```
|
|
114
130
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Lógica que não pertence a uma única entidade.
|
|
131
|
+
### Step 5: Create Domain Services
|
|
132
|
+
For logic that does not belong to a single entity.
|
|
118
133
|
|
|
119
134
|
```python
|
|
120
135
|
class TeamRecruitmentService:
|
|
@@ -130,9 +145,63 @@ class TeamRecruitmentService:
|
|
|
130
145
|
return team
|
|
131
146
|
```
|
|
132
147
|
|
|
133
|
-
|
|
148
|
+
### Step 6: Write Tests for Domain Logic
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Run domain unit tests (no infrastructure dependencies)
|
|
152
|
+
pytest tests/domain/ -v
|
|
153
|
+
|
|
154
|
+
# For Java/JUnit
|
|
155
|
+
./mvnw test -Dtest="*DomainTest,*ValueObjectTest"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
class TestComplianceScore:
|
|
160
|
+
def test_passing_score(self):
|
|
161
|
+
score = ComplianceScore(85.0)
|
|
162
|
+
assert score.is_passing() is True
|
|
163
|
+
|
|
164
|
+
def test_invalid_score_raises(self):
|
|
165
|
+
with pytest.raises(ValueError):
|
|
166
|
+
ComplianceScore(150.0)
|
|
167
|
+
```
|
|
134
168
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
169
|
+
## Resources
|
|
170
|
+
- `references/ddd-patterns.md` - DDD pattern decision guide and examples
|
|
171
|
+
|
|
172
|
+
## Examples
|
|
173
|
+
### Example 1: Create a Value Object
|
|
174
|
+
User asks: "Create a value object for email validation"
|
|
175
|
+
Response approach:
|
|
176
|
+
1. Create immutable dataclass/record with validation in constructor
|
|
177
|
+
2. Add behavior methods (e.g., `domain()`, `is_corporate()`)
|
|
178
|
+
3. Ensure equality by value, not reference
|
|
179
|
+
4. Write unit tests for valid and invalid cases
|
|
180
|
+
|
|
181
|
+
### Example 2: Define an Aggregate
|
|
182
|
+
User asks: "Model a Demand that contains Tasks with business rules"
|
|
183
|
+
Response approach:
|
|
184
|
+
1. Make Demand the Aggregate Root
|
|
185
|
+
2. Tasks are only accessed through Demand methods
|
|
186
|
+
3. Add invariants: max tasks, max concurrent, completion rules
|
|
187
|
+
4. Emit domain events on state changes
|
|
188
|
+
5. Write tests for each invariant
|
|
189
|
+
|
|
190
|
+
### Example 3: Implement a Domain Service
|
|
191
|
+
User asks: "I need logic that involves both Demands and Agents"
|
|
192
|
+
Response approach:
|
|
193
|
+
1. Create a Domain Service (not a generic "Service")
|
|
194
|
+
2. Accept entities as parameters, not IDs
|
|
195
|
+
3. Implement the cross-entity logic
|
|
196
|
+
4. Return results, let the use case persist
|
|
197
|
+
5. Write tests with test doubles for entities
|
|
198
|
+
|
|
199
|
+
## Notes
|
|
200
|
+
- Priority for placing business rules:
|
|
201
|
+
1. **Value Object** -- validation and simple behavior
|
|
202
|
+
2. **Entity** -- rules involving entity state
|
|
203
|
+
3. **Domain Service** -- rules involving multiple entities
|
|
204
|
+
4. **Use Case** -- orchestration only (NO business rules)
|
|
205
|
+
- Aggregates should be small -- prefer separate aggregates connected by ID
|
|
206
|
+
- Domain Events are immutable records of what happened
|
|
207
|
+
- Domain layer must have zero framework dependencies
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# DDD Tactical Patterns Reference
|
|
2
|
+
|
|
3
|
+
## Decision Guide: Where to Put Business Logic
|
|
4
|
+
|
|
5
|
+
| Pattern | When to Use | Example |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| Value Object | Validation, simple behavior, no identity | Email, Money, ComplianceScore |
|
|
8
|
+
| Entity | Has identity, mutable state, behavior | Task, Agent, Demand |
|
|
9
|
+
| Aggregate | Cluster with invariants, transactional boundary | Demand (root) + Tasks (children) |
|
|
10
|
+
| Domain Event | Notify something happened | TaskCompleted, DemandCreated |
|
|
11
|
+
| Domain Service | Logic spanning multiple entities | TeamRecruitmentService |
|
|
12
|
+
| Repository (Port) | Persistence abstraction | DemandRepository (interface) |
|
|
13
|
+
|
|
14
|
+
## Value Object Checklist
|
|
15
|
+
- [ ] Immutable (frozen dataclass / Java record)
|
|
16
|
+
- [ ] Validated in constructor
|
|
17
|
+
- [ ] Compared by value, not reference
|
|
18
|
+
- [ ] Contains behavior methods
|
|
19
|
+
- [ ] No identity field
|
|
20
|
+
|
|
21
|
+
## Entity Checklist
|
|
22
|
+
- [ ] Has unique identity (ID)
|
|
23
|
+
- [ ] Mutable state with controlled transitions
|
|
24
|
+
- [ ] Contains behavior (not anemic)
|
|
25
|
+
- [ ] State changes enforce invariants
|
|
26
|
+
- [ ] Compared by identity, not value
|
|
27
|
+
|
|
28
|
+
## Aggregate Checklist
|
|
29
|
+
- [ ] Has a single root entity
|
|
30
|
+
- [ ] Children accessed only through root
|
|
31
|
+
- [ ] Invariants enforced by root
|
|
32
|
+
- [ ] Small boundary (prefer separate aggregates)
|
|
33
|
+
- [ ] Cross-aggregate references by ID only
|
|
34
|
+
- [ ] One aggregate per transaction
|
|
35
|
+
|
|
36
|
+
## Domain Event Checklist
|
|
37
|
+
- [ ] Immutable (record/frozen dataclass)
|
|
38
|
+
- [ ] Contains occurred_at timestamp
|
|
39
|
+
- [ ] Named in past tense (TaskCompleted, not CompleteTask)
|
|
40
|
+
- [ ] Contains only IDs and primitives (no entity references)
|
|
41
|
+
- [ ] Published after aggregate state change
|
|
42
|
+
|
|
43
|
+
## Domain Service Checklist
|
|
44
|
+
- [ ] Logic involves multiple aggregates
|
|
45
|
+
- [ ] Stateless (no internal state)
|
|
46
|
+
- [ ] Named after the operation (TeamRecruitmentService)
|
|
47
|
+
- [ ] Accepts entities as parameters
|
|
48
|
+
- [ ] Does not persist (caller persists)
|
|
@@ -1,48 +1,57 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: jhipster-angular
|
|
3
|
-
description:
|
|
3
|
+
description: Develop Angular frontend in JHipster with components, services, routing, and reactive forms. Use when creating screens, customizing Angular components, adding filters, or building dashboards.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
author: Maestro
|
|
4
6
|
---
|
|
5
7
|
|
|
6
8
|
# JHipster Angular
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
Develop and customize the Angular frontend generated by JHipster, including components, services, reactive forms, and custom pages.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
- When creating new Angular components or pages
|
|
14
|
+
- When customizing JHipster-generated CRUD screens
|
|
15
|
+
- When adding filters, sorting, or pagination to lists
|
|
16
|
+
- When building dashboards or custom views
|
|
17
|
+
- When working with reactive forms and validation
|
|
18
|
+
|
|
19
|
+
## Available Operations
|
|
20
|
+
1. Customize generated CRUD components
|
|
21
|
+
2. Create new standalone components
|
|
22
|
+
3. Add reactive forms with validation
|
|
23
|
+
4. Create Angular services for API calls
|
|
24
|
+
5. Configure routing with lazy loading
|
|
25
|
+
|
|
26
|
+
## Multi-Step Workflow
|
|
27
|
+
|
|
28
|
+
### Step 1: Understand the Generated Structure
|
|
9
29
|
|
|
10
30
|
```
|
|
11
31
|
src/main/webapp/app/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
│ │ └── demand-delete-dialog.component.ts
|
|
26
|
-
│ └── task/
|
|
27
|
-
├── shared/ # Componentes compartilhados
|
|
28
|
-
│ ├── date/
|
|
29
|
-
│ ├── filter/
|
|
30
|
-
│ ├── pagination/
|
|
31
|
-
│ └── sort/
|
|
32
|
-
├── core/ # Services core
|
|
33
|
-
│ ├── auth/
|
|
34
|
-
│ ├── interceptor/
|
|
35
|
-
│ └── util/
|
|
36
|
-
├── layouts/ # Layouts de página
|
|
37
|
-
│ ├── main/
|
|
38
|
-
│ ├── navbar/
|
|
39
|
-
│ └── footer/
|
|
40
|
-
└── config/
|
|
32
|
+
entities/ # Generated CRUD per entity
|
|
33
|
+
demand/
|
|
34
|
+
demand.model.ts
|
|
35
|
+
demand.routes.ts
|
|
36
|
+
service/demand.service.ts
|
|
37
|
+
list/demand.component.ts
|
|
38
|
+
detail/demand-detail.component.ts
|
|
39
|
+
update/demand-update.component.ts
|
|
40
|
+
delete/demand-delete-dialog.component.ts
|
|
41
|
+
shared/ # Shared components
|
|
42
|
+
core/ # Core services (auth, interceptors)
|
|
43
|
+
layouts/ # Page layouts (navbar, footer)
|
|
44
|
+
config/ # App configuration
|
|
41
45
|
```
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
```bash
|
|
48
|
+
# Explore the generated structure
|
|
49
|
+
ls src/main/webapp/app/entities/
|
|
50
|
+
ls src/main/webapp/app/shared/
|
|
51
|
+
```
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
### Step 2: Customize Generated Components
|
|
54
|
+
Add filters and custom behavior WITHOUT breaking the generated structure:
|
|
46
55
|
|
|
47
56
|
```typescript
|
|
48
57
|
// entities/demand/list/demand.component.ts
|
|
@@ -56,7 +65,7 @@ export class DemandComponent implements OnInit {
|
|
|
56
65
|
demands?: IDemand[];
|
|
57
66
|
isLoading = false;
|
|
58
67
|
|
|
59
|
-
//
|
|
68
|
+
// ADD -- custom filters
|
|
60
69
|
statusFilter: DemandStatus | null = null;
|
|
61
70
|
priorityFilter: Priority | null = null;
|
|
62
71
|
|
|
@@ -67,7 +76,7 @@ export class DemandComponent implements OnInit {
|
|
|
67
76
|
protected sortService: SortService,
|
|
68
77
|
) {}
|
|
69
78
|
|
|
70
|
-
//
|
|
79
|
+
// ADD -- filter method
|
|
71
80
|
filterByStatus(status: DemandStatus): void {
|
|
72
81
|
this.statusFilter = status;
|
|
73
82
|
this.loadDemands();
|
|
@@ -94,7 +103,7 @@ export class DemandComponent implements OnInit {
|
|
|
94
103
|
}
|
|
95
104
|
```
|
|
96
105
|
|
|
97
|
-
|
|
106
|
+
### Step 3: Create New Components (Outside Generated CRUD)
|
|
98
107
|
|
|
99
108
|
```typescript
|
|
100
109
|
// dashboard/dashboard.component.ts
|
|
@@ -112,16 +121,8 @@ export class DemandComponent implements OnInit {
|
|
|
112
121
|
</div>
|
|
113
122
|
</div>
|
|
114
123
|
</div>
|
|
115
|
-
<div class="row mt-4">
|
|
116
|
-
<div class="col-md-8">
|
|
117
|
-
<app-agent-activity-feed />
|
|
118
|
-
</div>
|
|
119
|
-
<div class="col-md-4">
|
|
120
|
-
<app-active-demands />
|
|
121
|
-
</div>
|
|
122
|
-
</div>
|
|
123
124
|
`,
|
|
124
|
-
imports: [CommonModule
|
|
125
|
+
imports: [CommonModule],
|
|
125
126
|
})
|
|
126
127
|
export class DashboardComponent implements OnInit {
|
|
127
128
|
metrics: Metric[] = [];
|
|
@@ -134,7 +135,7 @@ export class DashboardComponent implements OnInit {
|
|
|
134
135
|
}
|
|
135
136
|
```
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
### Step 4: Add Reactive Forms with Validation
|
|
138
139
|
|
|
139
140
|
```typescript
|
|
140
141
|
@Component({...})
|
|
@@ -157,10 +158,56 @@ export class DemandUpdateComponent {
|
|
|
157
158
|
}
|
|
158
159
|
```
|
|
159
160
|
|
|
160
|
-
|
|
161
|
+
### Step 5: Build and Verify
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Run Angular dev server
|
|
165
|
+
npm start
|
|
166
|
+
|
|
167
|
+
# Run Angular tests
|
|
168
|
+
npm test
|
|
169
|
+
|
|
170
|
+
# Run lint
|
|
171
|
+
npm run lint
|
|
172
|
+
|
|
173
|
+
# Build for production
|
|
174
|
+
npm run build
|
|
175
|
+
```
|
|
161
176
|
|
|
162
|
-
|
|
163
|
-
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
177
|
+
## Resources
|
|
178
|
+
- `references/angular-structure.md` - JHipster Angular project structure and conventions
|
|
179
|
+
|
|
180
|
+
## Examples
|
|
181
|
+
### Example 1: Add Status Filter to Entity List
|
|
182
|
+
User asks: "Add a status filter to the demands list"
|
|
183
|
+
Response approach:
|
|
184
|
+
1. Open `entities/demand/list/demand.component.ts`
|
|
185
|
+
2. Add `statusFilter` property and `filterByStatus()` method
|
|
186
|
+
3. Update the template to include filter buttons/dropdown
|
|
187
|
+
4. Pass filter as query param to `demandService.query()`
|
|
188
|
+
5. Run `npm test` to verify
|
|
189
|
+
|
|
190
|
+
### Example 2: Create a Dashboard Page
|
|
191
|
+
User asks: "Create a dashboard showing key metrics"
|
|
192
|
+
Response approach:
|
|
193
|
+
1. Create `dashboard/` directory under `app/`
|
|
194
|
+
2. Create `dashboard.component.ts` with standalone component
|
|
195
|
+
3. Create `dashboard.service.ts` to fetch metrics from API
|
|
196
|
+
4. Add route in app routing with lazy loading
|
|
197
|
+
5. Run `npm start` to verify
|
|
198
|
+
|
|
199
|
+
### Example 3: Add Form Validation
|
|
200
|
+
User asks: "Add validation to the demand creation form"
|
|
201
|
+
Response approach:
|
|
202
|
+
1. Open `entities/demand/update/demand-update.component.ts`
|
|
203
|
+
2. Add validators to FormGroup controls
|
|
204
|
+
3. Add error messages in the template
|
|
205
|
+
4. Test validation behavior
|
|
206
|
+
5. Run `npm test`
|
|
207
|
+
|
|
208
|
+
## Notes
|
|
209
|
+
- Do not modify `navbar.component.ts` directly -- use configurable menus
|
|
210
|
+
- Use `SharedModule` for common imports
|
|
211
|
+
- Use lazy loading for all entity routes
|
|
212
|
+
- Use JHipster's `TranslateService` for i18n
|
|
213
|
+
- Mark customizations clearly to maintain compatibility with regeneration
|
package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/references/angular-structure.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# JHipster Angular Structure Reference
|
|
2
|
+
|
|
3
|
+
## Directory Layout
|
|
4
|
+
```
|
|
5
|
+
src/main/webapp/app/
|
|
6
|
+
entities/ # Generated CRUD per entity
|
|
7
|
+
<entity>/
|
|
8
|
+
<entity>.model.ts # TypeScript interface
|
|
9
|
+
<entity>.routes.ts # Lazy-loaded routes
|
|
10
|
+
service/<entity>.service.ts
|
|
11
|
+
list/<entity>.component.ts
|
|
12
|
+
detail/<entity>-detail.component.ts
|
|
13
|
+
update/<entity>-update.component.ts
|
|
14
|
+
delete/<entity>-delete-dialog.component.ts
|
|
15
|
+
shared/ # Shared modules and components
|
|
16
|
+
date/ # Date utilities
|
|
17
|
+
filter/ # Filter components
|
|
18
|
+
pagination/ # Pagination components
|
|
19
|
+
sort/ # Sort directives
|
|
20
|
+
core/ # Core services
|
|
21
|
+
auth/ # Authentication
|
|
22
|
+
interceptor/ # HTTP interceptors
|
|
23
|
+
util/ # Utility services
|
|
24
|
+
layouts/ # Page layouts
|
|
25
|
+
main/ # Main layout
|
|
26
|
+
navbar/ # Navigation bar
|
|
27
|
+
footer/ # Footer
|
|
28
|
+
config/ # App configuration
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Key Conventions
|
|
32
|
+
- All components are `standalone: true`
|
|
33
|
+
- Use `SharedModule` for common imports
|
|
34
|
+
- Lazy loading for entity routes
|
|
35
|
+
- JHipster's `TranslateService` for i18n
|
|
36
|
+
- `AlertService` for user notifications
|
|
37
|
+
- `SortDirective` and `SortByDirective` for table sorting
|
|
38
|
+
- `PaginationComponent` for paginated lists
|
|
39
|
+
|
|
40
|
+
## Service Pattern
|
|
41
|
+
```typescript
|
|
42
|
+
@Injectable({ providedIn: 'root' })
|
|
43
|
+
export class EntityService {
|
|
44
|
+
private resourceUrl = 'api/entities';
|
|
45
|
+
|
|
46
|
+
constructor(private http: HttpClient) {}
|
|
47
|
+
|
|
48
|
+
query(req?: any): Observable<HttpResponse<IEntity[]>> {
|
|
49
|
+
const options = createRequestOption(req);
|
|
50
|
+
return this.http.get<IEntity[]>(this.resourceUrl, { params: options, observe: 'response' });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Custom Component Best Practices
|
|
56
|
+
- Place custom components outside `entities/` to avoid regeneration conflicts
|
|
57
|
+
- Mark any changes to generated files with `// CUSTOM` comments
|
|
58
|
+
- Use standalone components with explicit imports
|
|
59
|
+
- Follow JHipster naming: `jhi-` prefix for entity components
|