Skip to content

Commit 17bede9

Browse files
committed
Agents markdown
1 parent 5a42c03 commit 17bede9

File tree

2 files changed

+136
-5
lines changed

2 files changed

+136
-5
lines changed

.augment-guidelines

Lines changed: 0 additions & 5 deletions
This file was deleted.

AGENTS.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Ecotone Framework - AI Agent Guidelines
2+
3+
> Guidelines for AI agents contributing to or working with the Ecotone framework codebase.
4+
5+
## Project Overview
6+
7+
Ecotone is a PHP framework for message-driven architecture with DDD, CQRS, and Event Sourcing.
8+
Works with Symfony, Laravel, or standalone (Ecotone Lite).
9+
10+
## Monorepo Structure
11+
12+
- Core package: `packages/Ecotone` - foundation for all other packages
13+
- Each package under `packages/*` is a separate Composer package
14+
- Packages are split to read-only repos during release
15+
- Template for new packages: `_PackageTemplate/`
16+
17+
## Code Conventions
18+
19+
- **No comments** - prefer meaningful private methods that describe intent
20+
- Use PHP 8.1+ features (attributes, enums, named arguments)
21+
- All public APIs need `@param`/`@return` PHPDoc
22+
- Follow existing patterns in the codebase
23+
24+
## Architecture Patterns
25+
26+
- **Messages first** - Commands, Events, Queries are first-class citizens
27+
- **Declarative configuration** - use PHP attributes, not YAML/XML
28+
- **ServiceActivatorBuilder** - for registering message handlers
29+
- **InterfaceToCall** - for reflection and method metadata
30+
- **MessageHeaders** - for message metadata propagation
31+
- **Modules** - self-register via `ModulePackageList`
32+
33+
## Testing Guidelines
34+
35+
### General Approach
36+
- Write high-level tests from end-user perspective
37+
- Tests use **EcotoneLite** to bootstrap isolated Ecotone instances
38+
- Prefer **inline anonymous classes** in tests over separate fixture files
39+
- Run tests for the specific package you modified
40+
41+
### Running Tests
42+
```bash
43+
# Enter development container
44+
docker exec -it -u root ecotone_development /bin/bash
45+
46+
# Run package tests
47+
cd packages/PackageName
48+
composer tests:ci
49+
50+
# Run specific test
51+
vendor/bin/phpunit --filter testMethodName tests/Path/To/TestFile.php
52+
```
53+
54+
### Database-Specific Tests
55+
```bash
56+
# MySQL for PdoEventSourcing
57+
DATABASE_DSN=mysql://ecotone:secret@database-mysql:3306/ecotone?serverVersion=8.0 \
58+
vendor/bin/phpunit packages/PdoEventSourcing/tests/
59+
60+
# PostgreSQL (default in container)
61+
vendor/bin/phpunit packages/PdoEventSourcing/tests/
62+
```
63+
64+
### Test Types
65+
- `composer tests:phpunit` - Unit/integration tests
66+
- `composer tests:behat` - BDD feature tests
67+
- `composer tests:phpstan` - Static analysis
68+
- `composer tests:ci` - All tests for CI
69+
70+
## Common Patterns
71+
72+
### Command Handler
73+
```php
74+
#[CommandHandler]
75+
public function handle(PlaceOrder $command): void
76+
{
77+
// Business logic
78+
}
79+
```
80+
81+
### Event Handler
82+
```php
83+
#[EventHandler]
84+
public function when(OrderPlaced $event): void
85+
{
86+
// React to event
87+
}
88+
```
89+
90+
### Async Handler
91+
```php
92+
#[Asynchronous('orders')]
93+
#[EventHandler]
94+
public function whenAsync(OrderPlaced $event): void
95+
{
96+
// Processed asynchronously
97+
}
98+
```
99+
100+
### Aggregate
101+
```php
102+
#[Aggregate]
103+
class Order
104+
{
105+
#[Identifier]
106+
private string $orderId;
107+
108+
#[CommandHandler]
109+
public static function place(PlaceOrder $command): self
110+
{
111+
return new self($command->orderId);
112+
}
113+
}
114+
```
115+
116+
## Documentation Resources
117+
118+
- [Full Documentation](https://docs.ecotone.tech)
119+
- [Testing Support](https://docs.ecotone.tech/modelling/testing-support)
120+
- [Contributing Guide](https://docs.ecotone.tech/messaging/contributing-to-ecotone)
121+
- [Blog & Examples](https://blog.ecotone.tech)
122+
123+
## Development Environment
124+
125+
```bash
126+
# Start all containers
127+
docker-compose up -d
128+
129+
# Enter dev container (use root for full access)
130+
docker exec -it -u root ecotone_development /bin/bash
131+
132+
# Verify lowest/highest dependencies
133+
composer update --prefer-lowest && vendor/bin/phpunit
134+
composer update --prefer-stable && vendor/bin/phpunit
135+
```
136+

0 commit comments

Comments
 (0)