-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add .github/copilot-instructions.md for Copilot coding agent onboarding #19
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d640752
Initial plan
Copilot 373b842
Add .github/copilot-instructions.md for Copilot coding agent onboarding
Copilot f78b1fe
Merge branch 'main' into copilot/add-copilot-instructions-file
slaFFik 4335531
Update copilot-instructions.md: linting must now pass with no errors
Copilot b330eeb
Merge branch 'main' into copilot/add-copilot-instructions-file
slaFFik 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 |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # Copilot Coding Agent Instructions | ||
|
|
||
| ## Project Summary | ||
|
|
||
| **Blocks Randomizer** is a WordPress Gutenberg block plugin that displays randomly selected child blocks from a container on the front-end. It is server-side rendered for cache-friendly randomization. | ||
|
|
||
| - **Type**: WordPress plugin (Gutenberg block) | ||
| - **Languages**: JavaScript (ES6+), PHP 7.4+, SCSS | ||
| - **Framework**: `@wordpress/scripts` build toolchain | ||
| - **WordPress**: Requires 6.7+, tested up to 6.9 | ||
| - **Size**: Small (~15 source files) | ||
|
|
||
| ## Build Commands | ||
|
|
||
| **Always run these in order for a clean build:** | ||
|
|
||
| ```bash | ||
| npm ci # Install dependencies (use ci, not install) | ||
| npm run build # Production build (~15s) | ||
| ``` | ||
|
|
||
| **Other commands:** | ||
|
|
||
| | Command | Purpose | Notes | | ||
| |-----------------------|--------------------------------------|---------------------------------| | ||
| | `npm start` | Development build with watch mode | Use for active development | | ||
| | `npm run build` | Production build | Required before plugin-zip | | ||
| | `npm run plugin-zip` | Create distributable ZIP | Run build first | | ||
| | `npm run format` | Format code (WordPress standards) | Fixes many lint issues | | ||
| | `npm run lint:js` | Lint JavaScript (ESLint) | Must pass with no errors | | ||
| | `npm run lint:css` | Lint SCSS (Stylelint) | Must pass with no errors | | ||
|
|
||
| ## Important Build Notes | ||
|
|
||
| 1. **Always use `npm ci`** instead of `npm install` for reproducible builds. | ||
| 2. **Node.js 20** is required (see `.nvmrc`). | ||
| 3. **Build before zipping**: The `plugin-zip` command requires a successful `build` first. | ||
| 4. **Linting must pass**: Both `npm run lint:js` and `npm run lint:css` must complete with no errors. Fix any linting issues in your changes. | ||
| 5. **The build directory is gitignored** and generated fresh on each build. | ||
|
|
||
| ## Project Layout | ||
|
|
||
| ``` | ||
| / # Repository root | ||
| ├── blocks-randomizer.php # Main plugin file (block registration) | ||
| ├── package.json # npm scripts and dependencies | ||
| ├── .nvmrc # Node.js version (20) | ||
| ├── README.md # User documentation | ||
| ├── readme.txt # WordPress.org plugin readme | ||
| ├── CLAUDE.md # Claude-specific guidance | ||
| ├── src/ | ||
| │ └── blocks-randomizer/ # Block source files | ||
| │ ├── block.json # Block metadata and attributes | ||
| │ ├── edit.js # Editor component (React) | ||
| │ ├── save.js # Save component (stores inner blocks) | ||
| │ ├── render.php # Server-side randomization logic | ||
| │ ├── index.js # Block registration | ||
| │ ├── view.js # Front-end script (empty, SSR used) | ||
| │ ├── editor.scss # Editor-only styles | ||
| │ └── style.scss # Front-end + editor styles | ||
| ├── build/ # Generated (gitignored) | ||
| │ ├── blocks-manifest.php # Auto-generated block manifest | ||
| │ └── blocks-randomizer/ # Compiled block assets | ||
| ├── .github/ | ||
| │ └── workflows/ | ||
| │ ├── claude.yml # Claude Code workflow | ||
| │ └── claude-code-review.yml # Claude code review workflow | ||
| └── .wp-org/ # WordPress.org assets (banners, icons) | ||
| ``` | ||
|
|
||
| ## Key Files for Changes | ||
|
|
||
| | When modifying... | Edit these files | | ||
| |-----------------------------|-------------------------------------------------| | ||
| | Block behavior (front-end) | `src/blocks-randomizer/render.php` | | ||
| | Block editor UI | `src/blocks-randomizer/edit.js` | | ||
| | Block attributes | `src/blocks-randomizer/block.json` and `edit.js`| | ||
| | Styles | `src/blocks-randomizer/editor.scss` or `style.scss` | | ||
| | Block registration | `src/blocks-randomizer/index.js` | | ||
| | Plugin metadata | `blocks-randomizer.php` and `readme.txt` | | ||
|
|
||
| ## Validation Checklist | ||
|
|
||
| Before submitting changes: | ||
|
|
||
| 1. **Build succeeds**: `npm run build` completes without errors | ||
| 2. **Format code**: `npm run format` (run before linting) | ||
| 3. **Check linting**: `npm run lint:js && npm run lint:css` must pass with no errors | ||
| 4. **Test in WordPress**: Plugin requires WordPress 6.7+ environment | ||
|
|
||
| ## No Test Suite | ||
|
|
||
| This repository does not have automated tests configured. Manual testing in a WordPress environment is required. | ||
|
|
||
| ## Code Style | ||
|
|
||
| - Follow [WordPress Coding Standards](https://developer.wordpress.org/coding-standards/) | ||
| - Use tabs for indentation | ||
| - PHP files use WordPress conventions (`phpcs:ignore` comments are intentional in `render.php`) | ||
| - Use `@wordpress/i18n` for translatable strings | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - Single dev dependency: `@wordpress/scripts` (includes webpack, eslint, stylelint, prettier) | ||
| - WordPress packages (`@wordpress/blocks`, `@wordpress/i18n`, etc.) are externals resolved at runtime | ||
|
|
||
| ## Workflow Notes | ||
|
|
||
| - No CI/CD builds or tests are configured beyond Claude workflows | ||
| - Dependabot monitors npm packages weekly | ||
| - GitHub Actions workflows are for Claude-based code review only | ||
|
|
||
| Trust these instructions. Only search the codebase if information here is incomplete or incorrect. | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The statement "Single dev dependency: @wordpress/scripts" is inaccurate. According to package.json, there are actually 6 devDependencies listed:
While @wordpress/scripts is the primary toolchain, the other WordPress packages are also listed as devDependencies. Consider revising to: "Primary dev dependency: @wordpress/scripts (includes webpack, eslint, stylelint, prettier), with additional WordPress packages as devDependencies"