Skip to content

Commit bcdd066

Browse files
authored
Merge pull request #204 from Automattic/add/agents-md
Add AGENTS.md with structured agent guidance
2 parents 3ba621d + 05d44c8 commit bcdd066

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

.claude/CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

AGENTS.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Ad Code Manager
2+
3+
WordPress plugin for easy ad code management.
4+
5+
## Project Knowledge
6+
7+
| Property | Value |
8+
|----------|-------|
9+
| **Main file** | `ad-code-manager.php` |
10+
| **Text domain** | `ad-code-manager` |
11+
| **Namespace** | `Automattic\AdCodeManager` |
12+
| **Source directory** | `src/` |
13+
| **Version** | 0.8.0 |
14+
| **Requires PHP** | 7.4+ |
15+
| **Requires WP** | 6.4+ |
16+
17+
### Directory Structure
18+
19+
```
20+
ad-code-manager/
21+
├── src/ # Main plugin classes (PSR-4)
22+
│ ├── Providers/ # Ad provider implementations (DoubleClick, Google AdSense)
23+
│ └── UI/ # Admin UI components (autocomplete, contextual help)
24+
├── tests/
25+
│ ├── Unit/ # Unit tests (Brain Monkey)
26+
│ └── Integration/ # Integration tests (wp-env)
27+
├── languages/ # Translation files
28+
├── .github/workflows/ # CI: cs-lint, integration, unit, deploy
29+
└── .phpcs.xml.dist # PHPCS configuration
30+
```
31+
32+
### Key Classes
33+
34+
- `Ad_Code_Manager` — Main plugin class
35+
- `Acm_Widget` — WordPress widget for ad display
36+
- `Acm_Wp_List_Table` — Admin list table for managing ad codes
37+
- `Acm_Provider` — Base class for ad providers
38+
- `Providers/` — Concrete providers: DoubleClick, Google AdSense variants
39+
40+
### Dependencies
41+
42+
- `automattic/vipwpcs` — WordPress VIP coding standards
43+
- `yoast/wp-test-utils` — Test utilities (Brain Monkey, WP integration)
44+
45+
## Commands
46+
47+
```bash
48+
composer cs # Check code standards (PHPCS)
49+
composer cs-fix # Auto-fix code standard violations
50+
composer lint # PHP syntax lint
51+
composer test:unit # Run unit tests
52+
composer test:integration # Run integration tests (requires wp-env: npx wp-env start)
53+
composer test:integration-ms # Run multisite integration tests
54+
composer coverage # Run tests with HTML coverage report
55+
```
56+
57+
## Conventions
58+
59+
Follow the standards documented in `~/code/plugin-standards/` for full details. Key points:
60+
61+
- **Commits**: Use the `/commit` skill. Favour explaining "why" over "what".
62+
- **PRs**: Use the `/pr` skill. Squash and merge by default.
63+
- **Branch naming**: `feature/description`, `fix/description` from `develop`.
64+
- **Testing**: Write integration tests for WordPress-dependent behaviour, unit tests for isolated logic. Use `Yoast\WPTestUtils\WPIntegration\TestCase` for integration, `Yoast\WPTestUtils\BrainMonkey\YoastTestCase` for unit. Test files named `*Test.php`, one logical concept per test, Arrange-Act-Assert pattern.
65+
- **Code style**: WordPress coding standards via PHPCS. Tabs for indentation. PHPDoc on all public methods.
66+
- **i18n**: All user-facing strings must use the `ad-code-manager` text domain.
67+
68+
## Architectural Decisions
69+
70+
- **Provider pattern**: Ad networks are abstracted behind the `Acm_Provider` base class. New ad networks should be added as new provider classes in `src/Providers/`, not by modifying the core plugin.
71+
- **PSR-4 autoloading**: Classes in `src/` use PSR-4 under the `Automattic\AdCodeManager` namespace.
72+
- **WordPress.org deployment**: Has a deploy workflow for WordPress.org SVN. Do not manually modify SVN assets.
73+
74+
## Common Pitfalls
75+
76+
- Do not edit WordPress core files or bundled dependencies in `vendor/`.
77+
- Do not add ad provider logic directly to the main plugin class — create a new provider in `src/Providers/`.
78+
- Run `composer cs` before committing. CI will reject code standard violations.
79+
- Integration tests require `npx wp-env start` running first. If tests fail with connection errors, check that wp-env is up.
80+
- The widget class extends `WP_Widget` directly — do not refactor this to a block without explicit agreement, as it would be a breaking change for existing users.

0 commit comments

Comments
 (0)