feat(php): php projects support added
This commit is contained in:
22
SKILL.md
22
SKILL.md
@@ -27,11 +27,15 @@ Locate the belief map. If absent, build it:
|
||||
|
||||
```bash
|
||||
ls .belief_map.sexp belief_map.sexp 2>/dev/null
|
||||
# Build: pip3 install tree-sitter tree-sitter-typescript tree-sitter-python
|
||||
# Build: pip3 install tree-sitter tree-sitter-typescript tree-sitter-python tree-sitter-php
|
||||
python3 scripts/build_belief_map.py # incremental ~5s
|
||||
python3 scripts/build_belief_map.py --full # full rebuild ~30s
|
||||
```
|
||||
|
||||
Supports **Python**, **TypeScript/TSX**, and **PHP** (.php, PSR-4 autoload via
|
||||
composer.json, PHP 8.1 enums, traits, PHP 8 attributes, Symfony/Laravel DI).
|
||||
Blade templates (.blade.php) are skipped.
|
||||
|
||||
## Mandatory Workflow: Query Before Code
|
||||
|
||||
For non-trivial code work, run a belief-map query before `rg`, `find`, `sed`,
|
||||
@@ -134,7 +138,7 @@ Key patterns:
|
||||
(result-count 42)
|
||||
```
|
||||
|
||||
**`:lang` values**: `py` = Python (snake_case), `ts` = TypeScript (camelCase), `tsx` = TSX (PascalCase).
|
||||
**`:lang` values**: `py` = Python (snake_case), `ts` = TypeScript (camelCase), `tsx` = TSX (PascalCase), `php` = PHP (PascalCase classes, snake_case functions).
|
||||
|
||||
## Scheme Query Language
|
||||
|
||||
@@ -233,6 +237,20 @@ python3 scripts/build_belief_map.py --lsp # with LSP call hierarchy (~1-5min)
|
||||
|
||||
Rebuild after structural changes (add/remove files, change imports, add classes).
|
||||
|
||||
**LSP servers** (optional, for `--lsp`):
|
||||
- TypeScript: `typescript-language-server`
|
||||
- Python: `pyright-langserver`
|
||||
- PHP: `phpactor` (`composer global require phpactor/phpactor`)
|
||||
|
||||
**PHP-specific notes**:
|
||||
- PSR-4 autoload resolution reads `composer.json` (`autoload.psr-4`).
|
||||
- Trait usage (`use TraitX;` inside class body) creates `calls-api` edges.
|
||||
- Constructor type-hints create `calls-api` edges (Symfony/Laravel DI).
|
||||
- PHP 8 attributes (`#[AsService]`) are captured as entity decorators.
|
||||
- `vendor/` and `var/` are skipped; `.blade.php` templates are skipped.
|
||||
- If `tree-sitter-php` is not installed, a regex fallback parser is used
|
||||
(reduced precision: no PHP 8 attributes, no constructor DI, coarser methods).
|
||||
|
||||
## Infrastructure Topology
|
||||
|
||||
Extract service topology from Kustomize, Helm, and Terraform files. This script requires `PyYAML` (`pip3 install pyyaml`).
|
||||
|
||||
Reference in New Issue
Block a user