[Mate] Add Codex wrappers and refresh agent instructions on discover

This commit is contained in:
Johannes Wachter
2026-02-27 21:31:22 +01:00
committed by Christopher Hertel
parent 1116f3d748
commit 282b414d23
4 changed files with 99 additions and 1 deletions

View File

@@ -76,4 +76,11 @@ symfony console mcp:server
- OpenAI GPT-4o-mini default model
- ChromaDB on port 8080
- LiveComponents for real-time UI
- Symfony DI and best practices
- Symfony DI and best practices
<!-- BEGIN AI_MATE_INSTRUCTIONS -->
AI Mate Summary:
- Role: MCP-powered, project-aware coding guidance and tools.
- Required action: Read and follow `mate/AGENT_INSTRUCTIONS.md` before taking any action in this project, and prefer MCP tools over raw CLI commands whenever possible.
- Installed extensions: symfony/ai-mate, symfony/ai-monolog-mate-extension, symfony/ai-symfony-mate-extension.
<!-- END AI_MATE_INSTRUCTIONS -->

19
bin/codex Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env sh
set -eu
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname "$0")" && pwd)
PROJECT_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/.." && pwd)
if ! command -v codex >/dev/null 2>&1; then
echo "Codex CLI is not installed or not available in PATH." >&2
echo "Install Codex and try again." >&2
exit 1
fi
cd "$PROJECT_DIR"
exec codex \
-c "mcp_servers.symfony_ai_mate_local.command='./vendor/bin/mate'" \
-c "mcp_servers.symfony_ai_mate_local.args=['serve','--force-keep-alive']" \
"$@"

19
bin/codex.bat Normal file
View File

@@ -0,0 +1,19 @@
@echo off
setlocal
set "SCRIPT_DIR=%~dp0"
for %%I in ("%SCRIPT_DIR%..") do set "PROJECT_DIR=%%~fI"
where codex >nul 2>nul
if errorlevel 1 (
echo Codex CLI is not installed or not available in PATH. 1>&2
echo Install Codex and try again. 1>&2
exit /b 1
)
pushd "%PROJECT_DIR%" >nul
codex -c "mcp_servers.symfony_ai_mate_local.command='./vendor/bin/mate'" -c "mcp_servers.symfony_ai_mate_local.args=['serve','--force-keep-alive']" %*
set "CODE=%ERRORLEVEL%"
popd >nul
exit /b %CODE%

View File

@@ -0,0 +1,53 @@
## AI Mate Agent Instructions
This MCP server provides specialized tools for PHP development.
The following extensions are installed and provide MCP tools that you should
prefer over running CLI commands directly.
---
### Monolog Bridge
Use MCP tools instead of CLI for log analysis:
| Instead of... | Use |
|-----------------------------------|------------------------------------|
| `tail -f var/log/dev.log` | `monolog-tail` |
| `grep "error" var/log/*.log` | `monolog-search` with term "error" |
| `grep -E "pattern" var/log/*.log` | `monolog-search-regex` |
#### Benefits
- Structured output with parsed log entries
- Multi-file search across all logs at once
- Filter by environment, level, or channel
---
### Symfony Bridge
#### Container Introspection
| Instead of... | Use |
|--------------------------------|---------------------|
| `bin/console debug:container` | `symfony-services` |
- Direct access to compiled container
- Environment-aware (auto-detects dev/test/prod)
#### Profiler Access
When `symfony/http-kernel` is installed, profiler tools become available:
| Tool | Description |
|-----------------------------|--------------------------------------------|
| `symfony-profiler-list` | List profiles with optional filtering |
| `symfony-profiler-latest` | Get the most recent profile |
| `symfony-profiler-search` | Search by route, method, status, date |
| `symfony-profiler-get` | Get profile by token |
**Resources:**
- `symfony-profiler://profile/{token}` - Full profile with collector list
- `symfony-profiler://profile/{token}/{collector}` - Collector-specific data
**Security:** Cookies, session data, auth headers, and sensitive env vars are automatically redacted.