Skip to content

Commit 1dea0db

Browse files
committed
chore: unify agent config with lnai and auto-sync setup
1 parent 4daee08 commit 1dea0db

File tree

7 files changed

+111
-30
lines changed

7 files changed

+111
-30
lines changed

.claude/CLAUDE.md renamed to .ai/AGENTS.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# CLAUDE.md
1+
# AGENTS.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
This file provides guidance to coding agents when working with code in this repository.
44

55
## Project Overview
66

@@ -12,13 +12,12 @@ It integrates `webonyx/graphql-php` with Laravel's ecosystem.
1212
The project uses Docker + Make for a reproducible development environment.
1313

1414
```bash
15-
make setup # Initial setup: build containers, install dependencies
16-
make # Run all checks before committing (fix, stan, test)
15+
make setup # Initial setup: build containers, install dependencies, generate agent config
16+
make it # Run all checks before committing (fix, stan, test)
1717
make fix # Auto-format code (rector, php-cs-fixer, prettier)
1818
make stan # Static analysis with PHPStan
1919
make test # Run PHPUnit tests
2020
make bench # Run PHPBench benchmarks
21-
make php # Shell into PHP container
2221
```
2322

2423
### Running a Single Test
@@ -90,7 +89,7 @@ Tests use `Tests\Utils\` namespace for test fixtures (Models, Queries, Mutations
9089
- PHPStan level 8
9190
- php-cs-fixer with `mll-lab/php-cs-fixer-config` (risky rules)
9291
- `protected` over `private` for extensibility
93-
- Never use `final` in `src/`, always in `tests/`
92+
- Never use `final` in `src/`, always in `tests/`
9493
- Full namespace in PHPDoc (`@var \Full\Namespace\Class`), imports in code
9594
- Code elements with `@api` have stability guarantees between major versions
9695

.ai/config.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"tools": {
3+
"claudeCode": {
4+
"enabled": true,
5+
"versionControl": false
6+
},
7+
"opencode": {
8+
"enabled": false,
9+
"versionControl": false
10+
},
11+
"cursor": {
12+
"enabled": false,
13+
"versionControl": false
14+
},
15+
"copilot": {
16+
"enabled": false,
17+
"versionControl": false
18+
},
19+
"windsurf": {
20+
"enabled": false,
21+
"versionControl": false
22+
},
23+
"gemini": {
24+
"enabled": false,
25+
"versionControl": false
26+
},
27+
"codex": {
28+
"enabled": true,
29+
"versionControl": false
30+
}
31+
}
32+
}

.ai/settings.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "https://lnai.sh/schemas/settings.schema.json",
3+
"permissions": {
4+
"allow": [
5+
"Bash(docker compose up:*)",
6+
"Bash(make setup)",
7+
"Bash(make it)",
8+
"Bash(make up)",
9+
"Bash(make build)",
10+
"Bash(make test)",
11+
"Bash(make stan)",
12+
"Bash(make fix)",
13+
"Bash(make rector)",
14+
"Bash(make php-cs-fixer)",
15+
"Bash(make prettier)",
16+
"Bash(make bench)",
17+
"Bash(make docs)",
18+
"Bash(make help)",
19+
"Bash(make release)",
20+
"Bash(make proto)",
21+
"Bash(make proto/update-reports)"
22+
],
23+
"deny": [
24+
"Bash(make php)",
25+
"Bash(make node)"
26+
]
27+
}
28+
}

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ proto-tmp
1919
composer.phar
2020
composer.lock
2121
vendor
22+
23+
# lnai
24+
.ai/.lnai-manifest.json
25+
26+
# lnai-generated
27+
.claude/CLAUDE.md
28+
.claude/settings.json
29+
AGENTS.md
30+
# end lnai-generated

Makefile

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
dcphp=$$(echo "docker compose exec php")
2-
dcnode=$$(echo "docker compose exec node")
3-
41
.PHONY: it
52
it: vendor fix stan test ## Run useful checks before commits
63

@@ -9,7 +6,7 @@ help: ## Display this list of targets with descriptions
96
@grep --extended-regexp '^[a-zA-Z0-9_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
107

118
.PHONY: setup
12-
setup: build docs/node_modules vendor ## Prepare the local environment
9+
setup: build vendor docs/node_modules ai-sync ## Prepare the local environment
1310

1411
.PHONY: build
1512
build: ## Build the local Docker containers
@@ -25,59 +22,64 @@ fix: rector php-cs-fixer prettier ## Automatically refactor and format code
2522

2623
.PHONY: rector
2724
rector: up ## Refactor code with Rector
28-
${dcphp} vendor/bin/rector process
25+
docker compose exec php vendor/bin/rector process
2926

3027
.PHONY: php-cs-fixer
3128
php-cs-fixer: up ## Format code with php-cs-fixer
32-
${dcphp} vendor/bin/php-cs-fixer fix
29+
docker compose exec php vendor/bin/php-cs-fixer fix
3330

3431
.PHONY: prettier
3532
prettier: up ## Format code with prettier
36-
${dcnode} yarn run prettify
33+
docker compose exec node-docs yarn run prettify
3734

3835
.PHONY: stan
3936
stan: up ## Run static analysis with PHPStan
40-
${dcphp} vendor/bin/phpstan --verbose
37+
docker compose exec php vendor/bin/phpstan --verbose
4138

4239
.PHONY: test
4340
test: up ## Run tests with PHPUnit
44-
${dcphp} vendor/bin/phpunit
41+
docker compose exec php vendor/bin/phpunit
4542

4643
.PHONY: bench
4744
bench: up ## Run benchmarks with PHPBench
48-
${dcphp} vendor/bin/phpbench run --report=aggregate
45+
docker compose exec php vendor/bin/phpbench run --report=aggregate
4946

5047
vendor: up composer.json ## Install composer dependencies
51-
${dcphp} composer update
52-
${dcphp} composer validate --strict
53-
${dcphp} composer normalize
48+
docker compose exec php composer update
49+
docker compose exec php composer validate --strict
50+
docker compose exec php composer normalize
5451

5552
.PHONY: php
5653
php: up ## Open an interactive shell into the PHP container
57-
${dcphp} bash
54+
docker compose exec php bash
5855

5956
.PHONY: node
6057
node: up ## Open an interactive shell into the Node container
61-
${dcnode} bash
58+
docker compose exec node-docs bash
6259

6360
.PHONY: release
6461
release: ## Prepare the docs for a new release
6562
rm -rf docs/6 && cp -r docs/master docs/6
6663

6764
.PHONY: docs
6865
docs: up ## Render the docs in a development server
69-
${dcnode} yarn run start
66+
docker compose exec node-docs yarn run start
7067

7168
docs/node_modules: up docs/package.json docs/yarn.lock ## Install yarn dependencies
72-
${dcnode} yarn
69+
docker compose exec node-docs yarn
70+
71+
.PHONY: ai-sync
72+
ai-sync: up ## Generate local agent configuration from .ai
73+
# https://github.com/KrystianJonca/lnai/releases
74+
docker compose exec node-tools npx --yes lnai@0.6.7 sync
7375

7476
.PHONY: proto/update-reports
7577
proto/update-reports:
76-
${dcphp} curl --silent --show-error --fail --output src/Tracing/FederatedTracing/reports.proto https://usage-reporting.api.apollographql.com/proto/reports.proto
77-
${dcphp} sed --in-place 's/ \[(js_use_toArray) = true]//g' src/Tracing/FederatedTracing/reports.proto
78-
${dcphp} sed --in-place 's/ \[(js_preEncoded) = true]//g' src/Tracing/FederatedTracing/reports.proto
79-
${dcphp} sed --in-place '3 i option php_namespace = "Nuwave\\\\Lighthouse\\\\Tracing\\\\FederatedTracing\\\\Proto";' src/Tracing/FederatedTracing/reports.proto
80-
${dcphp} sed --in-place '4 i option php_metadata_namespace = "Nuwave\\\\Lighthouse\\\\Tracing\\\\FederatedTracing\\\\Proto\\\\Metadata";' src/Tracing/FederatedTracing/reports.proto
78+
docker compose exec php curl --silent --show-error --fail --output src/Tracing/FederatedTracing/reports.proto https://usage-reporting.api.apollographql.com/proto/reports.proto
79+
docker compose exec php sed --in-place 's/ \[(js_use_toArray) = true]//g' src/Tracing/FederatedTracing/reports.proto
80+
docker compose exec php sed --in-place 's/ \[(js_preEncoded) = true]//g' src/Tracing/FederatedTracing/reports.proto
81+
docker compose exec php sed --in-place '3 i option php_namespace = "Nuwave\\\\Lighthouse\\\\Tracing\\\\FederatedTracing\\\\Proto";' src/Tracing/FederatedTracing/reports.proto
82+
docker compose exec php sed --in-place '4 i option php_metadata_namespace = "Nuwave\\\\Lighthouse\\\\Tracing\\\\FederatedTracing\\\\Proto\\\\Metadata";' src/Tracing/FederatedTracing/reports.proto
8183

8284
.PHONY: proto
8385
proto:

docker-compose.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ services:
2626
redis:
2727
image: redis:6
2828

29-
node:
29+
node-docs:
3030
build:
3131
context: .
3232
dockerfile: node.dockerfile
@@ -40,3 +40,12 @@ services:
4040
ports:
4141
- 8081:8080
4242
tty: true
43+
44+
node-tools:
45+
build:
46+
context: .
47+
dockerfile: node.dockerfile
48+
volumes:
49+
- ./:/workdir
50+
working_dir: /workdir
51+
tty: true

node.dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM node:18-slim
1+
FROM node:22-slim
2+
3+
RUN npm install -g npm
24

35
ARG USER_ID
46
ARG GROUP_ID

0 commit comments

Comments
 (0)