Skip to content

Commit 9ba7bcb

Browse files
committed
Create initial AGENTS.md and improve CONTRIBUTING.md
1 parent c56df8f commit 9ba7bcb

File tree

5 files changed

+179
-17
lines changed

5 files changed

+179
-17
lines changed

AGENTS.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Agent guidelines for Dirigent development
2+
3+
Dirigent is a free and open package registry for Composer, the PHP package manager. It allows users to publish private packages and mirror packages from external registries like Packagist.
4+
5+
### Project structure
6+
7+
```
8+
assets/ # Frontend assets
9+
config/ # Symfony configuration
10+
migrations/ # Doctrine migrations (PostgreSQL)
11+
src/
12+
├── Attribute/ # PHP attributes
13+
├── Command/ # Symfony console commands
14+
├── Composer/ # Composer integration logic
15+
├── Controller/ # HTTP controllers
16+
│ └── Dashboard/ # EasyAdmin dashboard controllers
17+
├── Doctrine/
18+
│ ├── Entity/ # Doctrine ORM entities
19+
│ ├── Repository/ # Doctrine repositories
20+
│ ├── Type/ # Custom Doctrine types
21+
│ └── DataFixtures/ # Database fixtures
22+
├── Encryption/ # Encryption utilities
23+
├── Entity/ # Enums (UserRole, PackageUpdateSource)
24+
├── EventListener/ # Symfony event listeners
25+
├── Form/ # Symfony form types
26+
├── Message/ # Symfony messenger messages and handlers (async jobs)
27+
├── Package/ # Package management services
28+
├── Routing/ # Symfony routing logic
29+
├── Twig/ # Twig extensions
30+
└── Validator/ # Symfony validators
31+
templates/ # Twig templates
32+
tests/
33+
├── UnitTests/ # Unit tests
34+
├── FunctionalTests/ # Functional/Integration tests
35+
└── Docker/ # Docker image tests
36+
```
37+
38+
## Coding style
39+
40+
### Project
41+
42+
- Environment variables are stored in `.env.dirigent` and `.env.dirigent.*` (not `.env`).
43+
44+
### PHP
45+
46+
- Follow the PER coding style and the Symfony coding standards.
47+
- Organize services into domain-specific namespaces.
48+
- Always use strict comparisons (`===`, `!==`).
49+
- Enforce the use of DateTimeImmutable over DateTime.
50+
- Always use spaces in concatenation (`$a . $b`).
51+
- Always use imports. Use aliases when collisions occur or the imported name is unclear.
52+
- Don't use blank lines between import groups.
53+
54+
## Commands
55+
56+
### Linting & code quality
57+
58+
```shell
59+
# Run all linting jobs
60+
symfony composer lint
61+
62+
# Individual linters
63+
symfony composer lint:refactor # Rector (automatically applies changes)
64+
symfony composer lint:coding-style # PHP-CS-Fixer (automatically applies changes)
65+
symfony composer lint:static-analysis # PHPStan level 5
66+
symfony composer lint:container # Symfony container validation
67+
symfony composer lint:templates # Twig template validation
68+
```
69+
70+
### Testing
71+
72+
```shell
73+
# Prepare the Symfony test environment for tests (if the database schema changed)
74+
symfony composer tests:setup
75+
76+
# Run all tests
77+
symfony composer tests
78+
79+
# Run only PHP tests
80+
symfony composer tests:php
81+
symfony composer tests:php:unit
82+
symfony composer tests:php:functional
83+
84+
# Run tests for Docker images
85+
symfony composer tests:docker
86+
```

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Agent guidelines for Dirigent development in Claude Code
2+
3+
@AGENTS.md

CONTRIBUTING.md

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,107 @@
33
Dirigent is an open-source project, contributions of all kind are welcome, including
44
[financial contributions][codedmonkey-sponsor].
55

6+
This guide contains technical information and instructions about the development process of the project that you should
7+
follow when contributing code.
8+
9+
## Project information
10+
11+
### Technology stack
12+
13+
- **Languages & frameworks**:
14+
- PHP 8.3+
15+
- Symfony 7.3
16+
- PostgreSQL 16.x (via Doctrine ORM 3.x)
17+
- TypeScript
18+
- **Development requirements**:
19+
- Docker
20+
- Symfony CLI
21+
- **Package managers**:
22+
- **PHP**: Composer
23+
- **TypeScript**: NPM
24+
- **Frontend**: Twig, EasyAdmin 4.x
25+
- **Frontend (JavaScript)**: Webpack Encore, Stimulus
26+
- **Linting**: Rector, PHP-CS-Fixer, PHPStan
27+
- **Testing**: PHPUnit 12.x, Testcontainers
28+
29+
### Coding style
30+
31+
#### PHP
32+
33+
Dirigent follows the [PER coding style][per-coding-style] and the [Symfony coding standards][symfony-coding-standards].
34+
635
## Running Dirigent locally
736

8-
To run Dirigent locally, follow the [Running from source code][dirigent-docs-install-source] guide in the documentation,
37+
### Installation
38+
39+
To run Dirigent locally, follow the [Running from source code][docs-install-source] guide in the documentation,
940
up to the *Configure services* section.
1041

1142
Additional requirements:
1243

1344
- Symfony binary
1445
- Docker
1546

47+
1648
```shell
1749
# Optionally, copy the example Docker Compose configuration override file
18-
cp compose.override.example.yaml composer.override.yaml
50+
cp compose.override.example.yaml compose.override.yaml
51+
52+
# Install dependencies
53+
composer install
54+
npm install
1955

20-
# Start Docker services
56+
# Build frontend assets
57+
npm run build # or watch for changes with: npm run watch
58+
59+
# Run services through Docker Compose
2160
docker compose up -d
2261

23-
# Start Symfony local server
62+
# Run the Symfony development server
2463
symfony server:start -d
64+
65+
# Create & fill the development database
66+
symfony console doctrine:database:create --if-not-exists
67+
symfony console doctrine:schema:update --force
68+
symfony console doctrine:fixtures:load --no-interaction
2569
```
2670

27-
## Lint & test your code
71+
## Lint & validate the code
2872

2973
```shell
30-
# Run all linters
74+
# Run all linting jobs
3175
symfony composer lint
76+
77+
# Individual linters
78+
symfony composer lint:refactor # Rector (automatically applies changes)
79+
symfony composer lint:coding-style # PHP-CS-Fixer (automatically applies changes)
80+
symfony composer lint:static-analysis # PHPStan level 5
81+
symfony composer lint:container # Symfony container validation
82+
symfony composer lint:templates # Twig template validation
3283
```
3384

34-
### Running PHPUnit tests
85+
### Running tests
3586

3687
```shell
37-
# Before running the tests, make sure the testing database is ready
88+
# Prepare the Symfony test environment (if the database schema changed)
3889
symfony composer tests:setup
90+
```
91+
92+
```shell
93+
# Run all tests
94+
symfony composer tests
3995

40-
# Run PHP tests
96+
# Run only PHP tests
4197
symfony composer tests:php
98+
symfony composer tests:php:unit
99+
symfony composer tests:php:functional
42100

43-
# Run tests on Docker images
44-
symfony composer tests:docker
101+
# Run tests for Docker images
102+
symfony composer tests:docker
103+
symfony composer tests:docker:standalone
45104
```
46105

47106
[codedmonkey-sponsor]: https://github.com/sponsors/codedmonkey
48-
[dirigent-docs-install-source]: https://dirigent.dev/docs/installation/source
107+
[docs-install-source]: ./docs/installation/source.md
108+
[per-coding-style]: https://www.php-fig.org/per/coding-style/
109+
[symfony-coding-standards]: https://symfony.com/doc/current/contributing/code/standards.html

docs/installation/docker-standalone.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Dirigent into one, including a web server, database and a background worker. The
1313

1414
### Docker command
1515

16-
```bash
16+
```shell
1717
docker volume create dirigent-data
1818

1919
docker container run -d \

docs/installation/source.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,31 @@ This page is a stub.
1111

1212
:::
1313

14-
Running the project from source code is not guaranteed to work on every system.
14+
Running the project from the source code is not guaranteed to work on every system.
1515

1616
## Requirements
1717

18-
To install Dirigent on your system from source you need to following packages:
18+
To install Dirigent on your system from source you need to have the following packages installed on your system:
1919

2020
- Git
2121
- PHP 8.3 or higher
2222
- Composer 2
2323
- Web server (like Nginx or Caddy)
2424
- PHP-FPM
25-
- PostgreSQL
26-
- Node
25+
- PostgreSQL 16
26+
- Node 23
2727

2828
## Download source code
2929

30+
The recommended way to download Dirigent is through Git:
31+
3032
```shell
3133
git clone https://github.com/codedmonkey/dirigent.git
3234
cd dirigent
3335
```
3436

37+
You can also download the source code directly from the [Releases][github-releases] page on GitHub.
38+
3539
## Install build tools
3640

3741
```shell
@@ -44,4 +48,12 @@ npm install
4448
npm run production
4549
```
4650

51+
:::note
52+
53+
Stop here if you're following the "Contributing to Dirigent" guide.
54+
55+
:::
56+
4757
## Configure services
58+
59+
[github-releases]: https://github.com/codedmonkey/dirigent/releases

0 commit comments

Comments
 (0)