Skip to content

Commit 22df7c6

Browse files
authored
Create an AGENTS.md file (#213)
* Create AGENTS.md * Update AGENTS.md
1 parent 6cf4861 commit 22df7c6

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

AGENTS.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# AGENTS.md
2+
3+
## Dev environment tips
4+
5+
```bash
6+
# Setup
7+
npm install && composer install
8+
npm run wp-env status # Always check status first
9+
npm run wp-env start # Only start if not already running
10+
11+
# Development
12+
npm run watch # Development with watch
13+
npm run build # Production build
14+
```
15+
16+
### Key Directories
17+
18+
- `/includes/` - Core PHP functionality
19+
- `/assets/src/` - Frontend source files
20+
- `/assets/build/` - Compiled assets
21+
- `/tests/` - E2E and PHPUnit tests
22+
- `/docs/` - Documentation
23+
24+
## Testing instructions
25+
26+
> **Note**: PHP/E2E tests require wp-env running.
27+
28+
```bash
29+
# PHP (requires wp-env)
30+
composer test # All PHP tests (PHPUnit + PHPStan)
31+
composer test:php # PHPUnit tests only
32+
composer test:php -- --filter=<TestName> # Specific test
33+
vendor/bin/phpunit <path_to_test_file.php> # Specific file
34+
vendor/bin/phpunit <path_to_test_directory>/ # Directory
35+
composer test:phpstan # Static analysis only
36+
37+
# E2E (requires wp-env)
38+
npm run test:e2e
39+
npm run test:e2e:debug # Debug mode
40+
npm run test:e2e -- --headed # Run with browser visible
41+
npm run test:e2e -- <path_to_test_file.spec.js> # Specific test file
42+
43+
# Code Quality
44+
npx wp-scripts lint-js # Check JavaScript linting
45+
npx wp-scripts format # Fix JavaScript formatting
46+
composer lint:php # Check PHP standards
47+
vendor/bin/phpcs # Check PHP standards
48+
vendor/bin/phpcbf # Fix PHP standards
49+
50+
# Specific files
51+
vendor/bin/phpcbf <path_to_php_file.php>
52+
```
53+
54+
## Code patterns
55+
56+
- **Naming**: New functions use `scf_` prefix and hooks use `scf/hook_name`, existing use `acf_` and `acf/hook_name` (backward compat)
57+
- **Internationalization**: Use `__()`, `_e()` with text domain `'secure-custom-fields'`
58+
- **Output escaping**: Always escape with `esc_html()`, `esc_attr()`, `esc_url()`
59+
- **Input sanitization**: Use `sanitize_text_field()`, `sanitize_file_name()`
60+
61+
## PR instructions
62+
63+
- Ensure build passes
64+
- Fix all formatting/linting issues; these are enforced through CI in PRs

0 commit comments

Comments
 (0)