-
Notifications
You must be signed in to change notification settings - Fork 146
Improve AGENTS.md
#2375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
westonruter
wants to merge
4
commits into
trunk
Choose a base branch
from
update/agents
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+79
−37
Draft
Improve AGENTS.md
#2375
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # Performance Lab | ||
|
|
||
| This is a monorepo for the WordPress Performance Team, containing a collection of standalone performance feature plugins. Refer to the [Performance Lab handbook](https://make.wordpress.org/performance/handbook/performance-lab/) for more details. | ||
| This is a monorepo for the WordPress Performance Team, containing a collection of standalone performance feature plugins. Refer to the [Performance Lab handbook](https://make.wordpress.org/performance/handbook/performance-lab/) for more details, as well as [README.md](../README.md) and [CONTRIBUTING.md](../CONTRIBUTING.md). See also the [WordPress AI Guidelines](https://make.wordpress.org/ai/handbook/ai-guidelines/). | ||
|
|
||
| ## Project Overview | ||
|
|
||
|
|
@@ -9,10 +9,12 @@ This is a monorepo for the WordPress Performance Team, containing a collection o | |
|
|
||
| ### Project Structure | ||
|
|
||
| In this documentation, `<plugin-slug>` is a placeholder for one of the subdirectories under `/plugins`. | ||
|
|
||
| * `/bin`: Custom CLI commands and scripts for certain development workflows. | ||
| * `/plugins`: The actual WordPress plugins that are developed in this monorepo. | ||
| * `/plugins/*`: An individual WordPress plugin folder. | ||
| * `/plugins/*/tests`: PHPUnit tests for the specific WordPress plugin. | ||
| * `/plugins/<plugin-slug>`: An individual WordPress plugin folder. | ||
| * `/plugins/<plugin-slug>/tests`: PHPUnit tests for the specific WordPress plugin. | ||
| * `/tools`: Setup and configuration files for various tools, such as linting and testing. | ||
|
|
||
| ## Building and Running | ||
|
|
@@ -26,25 +28,68 @@ This is a monorepo for the WordPress Performance Team, containing a collection o | |
| ### Installation | ||
|
|
||
| 1. Run `npm install` to install the Node.js dependencies. | ||
| 2. Run `composer install` to install the PHP dependencies. | ||
| 3. Run `npm run build` to do an initial build of the assets. | ||
| 2. Run `npx husky` to ensure pre-commit hook (using `lint-staged`) is installed. | ||
| 3. Run `composer install` to install the PHP dependencies. | ||
| 4. Run `npm run build` to do an initial build of the JS and CSS assets. | ||
|
|
||
| ### Building | ||
| ### Production Builds | ||
|
|
||
| * To build the JavaScript and CSS assets: `npm run build` | ||
| * To build all plugins and place into the `build` directory: `npm run build-plugins` | ||
| * To build a specific plugin: `npm run build:plugin:<plugin-slug>` (e.g., `npm run build:plugin:performance-lab`) | ||
| * To build all plugins and place into the `build` directory: `npm run build-plugins`. | ||
| * To build a specific plugin: `npm run build:plugin:<plugin-slug>`. | ||
| * To build ZIP files for distribution: `npm run build-plugins:zip` | ||
|
|
||
| ### Running a Local Environment | ||
| ### Running Local Environment | ||
|
|
||
| This project uses `@wordpress/env` to create a local development environment. | ||
|
|
||
| * Check if the environment is already running: `npm run wp-env status` | ||
| * Start the environment: `npm run wp-env start` | ||
| * Stop the environment: `npm run wp-env stop` | ||
| * Start: `npx wp-env start` (with Xdebug: `npx wp-env start --xdebug`) | ||
| * Stop: `npx wp-env stop` | ||
| * Running a WP-CLI command: `npx wp-env run cli -- <command>` (e.g. `npx wp-env run cli -- wp post list`) | ||
|
|
||
| Web environment URLs: | ||
|
|
||
| * Development: `http://localhost:8888` (overridden by `port` in `.wp-env.override.json`) | ||
| * Test: `http://localhost:8889` (overridden by `testsPort` in `.wp-env.override.json`) | ||
|
|
||
| ### Testing | ||
|
|
||
| * PHPUnit: | ||
| * Run tests for all plugins: `npm run test-php` (and in multisite: `npm run test-php-multisite`) | ||
| * Run tests for one plugin: `npm run test-php:<plugin-slug>` (and in multisite: `npm run test-php-multisite:<plugin-slug>`) | ||
| * End-to-end (E2E) tests: | ||
| * Run tests for all plugins: `npm run test-e2e` | ||
| * Run tests for one plugin: `npm run test-e2e:<plugin-slug>` (currently only `auto-sizes`) | ||
|
|
||
| ### Formatting | ||
|
|
||
| * Format all files in the plugin: `npm run format` | ||
| * Format all PHP files: `composer format:all` | ||
| * Format all JavaScript, JSON, TypeScript, YAML files: `npm run format-js` | ||
|
|
||
| When possible, scope formatting to just the file/plugin being modified: | ||
|
|
||
| * Format JS files for a plugin: `npm run format-js plugins/<plugin-slug>` (or supply specific paths) | ||
| * Format all PHP files for a plugin: `composer format:<plugin-slug>` | ||
| * Format specific PHP files for a plugin: `composer format -- plugins/<plugin-slug>/phpcs.xml.dist plugins/<plugin-slug>/*.php` | ||
| * Format JavaScript, JSON, TypeScript, YAML files for a plugin: `npm run format-js plugins/<plugin-slug>` (or supply specific paths) | ||
|
|
||
| ### Static Analysis | ||
|
|
||
| Static analysis involves linting (ESLint, PHPCS), PHPStan (`composer phpstan`), and TypeScript (`npx tsc`). These are run automatically via a pre-commit hook, but they can be run manually. See the [lint-staged configuration](./lint-staged.config.js) for how to invoke. | ||
|
|
||
| ## Contributing a Change | ||
|
|
||
| Ensure all changed code passes static analysis checks and unit tests. When possible, include unit tests with each change. A bug fix should include a test that reproduces the original issue before following up with a commit to fix the issue. | ||
|
|
||
| The environment will by default be located at `http://localhost:8888` but this can be overridden by `.wp-env.override.json`. | ||
| Disclose AI tool usage in pull requests. Add a `Co-authored-by` Git commit message trailier indicating the agent when possible, for example one of: | ||
|
|
||
| ``` | ||
| Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> | ||
| Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this is the best option for Gemini. I've been using it, however. See google-gemini/gemini-cli#11447 |
||
| Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> | ||
| ``` | ||
|
|
||
| All contributions released under GPLv2+ license, so generated code must be compatible. | ||
|
|
||
| ## Code Style | ||
|
|
||
|
|
@@ -68,7 +113,7 @@ Note that `lint-staged` will be used to automatically run code quality checks wi | |
|
|
||
| ### Indentation | ||
|
|
||
| In general, indentation should use tabs. Refer to `.editorconfig` in the project root for specifics. | ||
| In general, indentation should use tabs. Refer to [`.editorconfig`](./.editorconfig) in the project root for specifics. | ||
|
|
||
| ### Inline Documentation | ||
|
|
||
|
|
@@ -161,24 +206,3 @@ export async function initialize( { log, onLCP, extendRootData } ) { | |
|
|
||
| // ... function definition for handleLCPMetric omitted ... | ||
| ``` | ||
|
|
||
| ### Static Analysis Commands | ||
|
|
||
| * **PHPStan**: `npm run phpstan` | ||
| * **TypeScript**: `npm run tsc` | ||
|
|
||
| ### Linting Commands | ||
|
|
||
| * **JavaScript:** `npm run lint-js` | ||
| * **PHP:** `npm run lint-php` | ||
|
|
||
| ### Formatting Commands | ||
|
|
||
| * **JavaScript:** `npm run format-js` | ||
| * **PHP:** `npm run format-php` | ||
|
|
||
| ### Testing Commands | ||
|
|
||
| * **End-to-end (E2E) tests:** `npm run test-e2e` | ||
| * **PHP tests:** `npm run test-php` | ||
| * **PHP tests (multisite):** `npm run test-php-multisite` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.