Skip to content

Commit 60059c8

Browse files
committed
feat(dev): add agentic dev setup
1 parent db53acb commit 60059c8

8 files changed

Lines changed: 184 additions & 8 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Agent Task"
2+
description: "Structured task for coding agents"
3+
labels: ["agent"]
4+
body:
5+
- type: textarea
6+
id: goal
7+
attributes:
8+
label: Goal / Acceptance Criteria
9+
description: "What does 'done' look like? Be specific."
10+
placeholder: "Example: Update E2E docs to use npm run env:up/env:down and ensure credentials match bin/cli-setup.sh."
11+
validations:
12+
required: true
13+
14+
- type: textarea
15+
id: constraints
16+
attributes:
17+
label: Constraints / Do Not Touch
18+
description: "List files/areas to avoid or any guardrails."
19+
placeholder: "Example: Do not edit build outputs directly; do not change vendor/ or node_modules/."
20+
validations:
21+
required: false
22+
23+
- type: textarea
24+
id: relevant_files
25+
attributes:
26+
label: Relevant Files (if known)
27+
description: "Optional: point the agent to likely files."
28+
placeholder: "Example: tests/e2e/README.md, AGENTS.md"
29+
validations:
30+
required: false
31+
32+
- type: textarea
33+
id: tests
34+
attributes:
35+
label: Tests to Run
36+
description: "Default is PHPUnit + E2E unless explicitly scoped out."
37+
value: |
38+
Default:
39+
- composer lint
40+
- composer phpstan
41+
- ./vendor/bin/phpunit
42+
- npm run env:up
43+
- npm run test:e2e:playwright
44+
- npm run env:down
45+
validations:
46+
required: true
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: "Copilot Setup Steps"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- .github/workflows/copilot-setup-steps.yml
8+
pull_request:
9+
paths:
10+
- .github/workflows/copilot-setup-steps.yml
11+
12+
jobs:
13+
copilot-setup-steps:
14+
runs-on: ubuntu-latest
15+
services:
16+
mysql:
17+
image: mysql:5.7
18+
env:
19+
MYSQL_ROOT_PASSWORD: root
20+
ports:
21+
- 3306:3306
22+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
23+
permissions:
24+
contents: read
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v5
28+
29+
- name: Set up Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: "18"
33+
cache: "npm"
34+
35+
- name: Install JavaScript dependencies
36+
run: npm ci
37+
38+
- name: Install Playwright browsers
39+
run: npx playwright install --with-deps chromium
40+
41+
- name: Set up PHP
42+
uses: shivammathur/setup-php@v2
43+
with:
44+
php-version: "7.4"
45+
extensions: simplexml, mysql
46+
47+
- name: Install PHP dependencies
48+
run: composer install
49+
50+
- name: Pre-pull E2E Docker images
51+
run: docker compose -f docker-compose.ci.yml pull

AGENTS.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,41 @@ npm run dev # Watch mode for development
3939
4040
---
4141

42+
## Agent Quickstart
43+
44+
### Copilot Coding Agent Environment
45+
This repo includes `.github/workflows/copilot-setup-steps.yml` to preinstall dependencies for Copilot Coding Agent. This workflow is not part of normal CI and only prepares the agent environment. Note: Copilot only uses it once it exists on the default branch.
46+
47+
### Standard Test Sequence
48+
1. `composer lint`
49+
2. `composer phpstan`
50+
3. `./vendor/bin/phpunit`
51+
4. `npm ci` (if deps missing)
52+
5. `npm run gutenberg:build`
53+
6. `npm run chartbuilder:build`
54+
7. `npm run d3renderer:build`
55+
8. `npm run env:up`
56+
9. `npm run test:e2e:playwright`
57+
10. `npm run env:down`
58+
59+
### E2E Environment
60+
- Default: Docker via `npm run env:up` / `npm run env:down` (uses `docker-compose.ci.yml`).
61+
- Optional: `wp-env` is supported, but Docker is the default for agents.
62+
63+
### Build Outputs
64+
If you change anything under `classes/Visualizer/**/src`, you must run the corresponding build and commit the output:
65+
- Gutenberg: `npm run gutenberg:build`
66+
- ChartBuilder: `npm run chartbuilder:build`
67+
- D3Renderer: `npm run d3renderer:build`
68+
69+
### Do / Don't
70+
- Do: keep changes scoped to the task and run the standard test sequence.
71+
- Do: update both classic and Gutenberg editor paths when changing settings UI.
72+
- Don't: edit build artifacts directly (edit `src`, then build).
73+
- Don't: modify `vendor/` or `node_modules/`.
74+
75+
---
76+
4277
## Architecture Overview
4378

4479
### Bootstrapping (`index.php`)

bin/run-e2e-tests-default.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

4+
export DOCKER_FILE=${DOCKER_FILE:-docker-compose.ci.yml}
35

4-
5-
6+
npm run env:up
7+
npm run test:e2e:playwright
8+
npm run env:down
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/usr/bin/env bash
2-
docker compose -f $DOCKER_FILE run --rm -u root cli bash -c "wp --allow-root plugin deactivate classic-editor"
2+
# NOTE: This script only toggles plugin state for Gutenberg DataTable variants.
3+
# It does not run tests. Use bin/run-e2e-tests-default.sh for a full run.
4+
# Requires the environment to be up.
5+
set -euo pipefail
36

7+
export DOCKER_FILE=${DOCKER_FILE:-docker-compose.ci.yml}
8+
docker compose -f $DOCKER_FILE run --rm -u root cli bash -c "wp --allow-root plugin deactivate classic-editor"
49

510

611

bin/run-e2e-tests-gutenberg.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
#!/usr/bin/env bash
2-
docker compose -f $DOCKER_FILE run --rm -u root cli bash -c "wp --allow-root plugin deactivate classic-editor"
2+
# NOTE: This script only toggles plugin state for Gutenberg E2E variants.
3+
# It does not run tests. Use bin/run-e2e-tests-default.sh for a full run.
4+
# Requires the environment to be up.
5+
set -euo pipefail
6+
7+
export DOCKER_FILE=${DOCKER_FILE:-docker-compose.ci.yml}
8+
docker compose -f $DOCKER_FILE run --rm -u root cli bash -c "wp --allow-root plugin deactivate classic-editor"

skills/unit.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@ Run the PHPUnit test suite for the Visualizer free plugin.
55
## Commands
66

77
```bash
8+
# Ensure MySQL is running and accessible (default: 127.0.0.1:3306).
9+
# Example (macOS/Homebrew):
10+
# brew services start mysql
11+
# Example (Linux):
12+
# sudo service mysql start
13+
814
# Install PHP dependencies if not already done
915
composer install
1016

17+
# Install WordPress test suite (required for phpunit)
18+
# Format: bash bin/install-wp-tests.sh <db_name> <db_user> <db_pass> <db_host> [wp_version]
19+
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1
20+
1121
# Run the full PHPUnit suite
1222
./vendor/bin/phpunit
1323

@@ -18,8 +28,9 @@ composer install
1828
## Instructions
1929

2030
1. Check that `vendor/` exists. If not, run `composer install` first.
21-
2. Run the tests. Show output as it streams.
22-
3. Report a summary: how many tests passed, failed, and any error messages.
23-
4. If the user specified a particular test file or test name, run only that:
31+
2. Ensure the WordPress test suite is installed using `bin/install-wp-tests.sh`.
32+
3. Run the tests. Show output as it streams.
33+
4. Report a summary: how many tests passed, failed, and any error messages.
34+
5. If the user specified a particular test file or test name, run only that:
2435
- Single file: `./vendor/bin/phpunit tests/test-<name>.php`
2536
- Single test method: `./vendor/bin/phpunit --filter testMethodName`

tests/e2e/README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,24 @@ npx playwright install
1414
Create the testing instance using the following command:
1515

1616
```bash
17-
npm run ci:up
17+
npm run env:up
1818
```
1919

2020
This will create a WordPress instance. The port is `8889` and the user is `admin` and the password is `password` (the same values used by `wp-env` testing instance).
21+
If you see port `8080`, ignore it for E2E; the test environment is expected at `http://localhost:8889`.
2122

2223
For the _headless_ mode, use the following command:
2324

2425
```bash
2526
npm run test:e2e:playwright
2627
```
2728

29+
Tear down the environment when finished:
30+
31+
```bash
32+
npm run env:down
33+
```
34+
2835
For _debug_ mode (which will open the browser along with Playwright Editor), use the following command:
2936

3037
```bash
@@ -42,6 +49,18 @@ For database connection, the credentials are:
4249
- Password: `password`
4350
- Port: `3306`
4451

52+
### Build requirements
53+
54+
If you change any sources under `classes/Visualizer/**/src`, run the matching build before E2E:
55+
56+
- `npm run gutenberg:build`
57+
- `npm run chartbuilder:build`
58+
- `npm run d3renderer:build`
59+
60+
### Docker file
61+
62+
The E2E environment uses `docker-compose.ci.yml` (via `npm run env:up`).
63+
4564
> [!NOTE]
4665
> You can modify the credentials in the `docker-compose.yml` file.
4766

0 commit comments

Comments
 (0)