Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 17, 2025

This PR implements a comprehensive WordPress block structure that follows the WordPress Block Editor documentation and adheres to LightSpeed coding standards.

What's Included

Complete Block Example (examples/example-block/)

  • block.json - Modern block configuration using API version 3 with support for colors, typography, and spacing
  • React Components - Separate edit.js and save.js components following WordPress best practices
  • SCSS Stylesheets - Organized editor and frontend styles with accessibility and responsive design features
  • PHP Registration - Comprehensive server-side functionality with security, internationalization, and performance optimizations
  • Build Configuration - WordPress Scripts setup with linting, formatting, and development tools

Block Patterns (examples/patterns/)

  • Hero CTA Pattern - Complex responsive hero section with gradient backgrounds and multiple call-to-action buttons
  • Simple CTA Pattern - Clean, minimal call-to-action block for general use

Both patterns use theme.json variables for consistency and include proper pattern headers for discoverability.

Key Features

WordPress Standards Compliance:

  • Uses Block API version 3 (latest)
  • Follows React component architecture
  • Implements proper asset enqueuing and dependency management
  • Includes translation support with correct text domain usage

LightSpeed Standards:

  • 4-space indentation throughout
  • Comprehensive input sanitization and output escaping
  • Performance-optimized with minimal dependencies
  • Accessible design with ARIA labels and keyboard navigation
  • Mobile-first responsive approach

Developer Experience:

  • Hot reloading development mode (npm start)
  • Production build optimization (npm run build)
  • Code linting and formatting tools
  • Comprehensive documentation with usage examples

Usage

Developers can use this as a template for creating new WordPress blocks:

cd examples/example-block
npm install
npm run start  # Development mode
npm run build  # Production build

The implementation demonstrates modern WordPress development practices while maintaining compatibility with LightSpeed's organizational standards and workflows.

Created from VS Code via the GitHub Pull Request extension.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

…tion

Co-authored-by: ashleyshaw <1805352+ashleyshaw@users.noreply.github.com>
Copilot AI changed the title [WIP] Implementing a Typical Block Structure in WordPress Implement typical WordPress block structure following official documentation Sep 17, 2025
Copilot AI requested a review from ashleyshaw September 17, 2025 14:49
Signed-off-by: Ash Shaw <ashley@lightspeedwp.agency>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 17, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

@ashleyshaw ashleyshaw marked this pull request as ready for review September 17, 2025 16:00
@ashleyshaw ashleyshaw merged commit e98b681 into master Sep 17, 2025
2 of 3 checks passed
@ashleyshaw ashleyshaw deleted the copilot/vscode1758120066316 branch October 10, 2025 05:23
ashleyshaw pushed a commit that referenced this pull request Nov 17, 2025
Implements all critical release automation components to fix blocking issues.

## Changes

### Release Agent (✅ Implemented)
- Implement `.github/agents/release.agent.cjs` - Complete release automation
  - Validates VERSION and CHANGELOG.md
  - Bumps semantic versions (major/minor/patch)
  - Updates changelog with release date
  - Creates git tags
  - Publishes GitHub releases
  - Supports dry-run mode for testing
  - Handles both GitHub Actions and standalone execution

### Validation Scripts (✅ Implemented)
- Implement `scripts/validate-version.cjs` - Semantic version validation
  - Validates VERSION file format
  - Parses version components (major.minor.patch[-prerelease][+build])
  - Comprehensive error reporting

- Implement `scripts/validate-changelog.cjs` - Changelog validation
  - Validates Keep a Changelog format
  - Checks version and date formats
  - Validates section structure
  - Reports detailed errors

### Utilities (✅ Implemented)
- Implement `.github/agents/includes/changelogUtils.cjs` - Changelog parser
  - Parses Keep a Changelog format
  - Validates changelog structure
  - Extracts releases and sections
  - CLI tool with --validate, --parse, --latest, --unreleased modes

### Schemas (✅ Created)
- Create `automation/schemas/changelog.schema.json` - Changelog validation
- Create `automation/schemas/version.schema.json` - Version validation
- Create `automation/schemas/frontmatter.schema.json` - Frontmatter validation

### Workflow Updates (✅ Updated)
- Update `.github/workflows/release.yml` - Enable release agent
- Update `.github/workflows/release-prep.yml` - Fix script references
- Update `.github/workflows/changelog.yml` - Enable validation, add Node setup

## Issues Resolved

- ✅ Critical Issue #1: Release agent not implemented (was placeholder)
- ✅ Critical Issue #2: validate-changelog.js was placeholder (exit code 1)
- ✅ Critical Issue #3: validate-version.js was empty
- ✅ Critical Issue #4: changelogUtils.js missing
- ✅ Critical Issue #5: Schema files missing

## Testing

All components tested and working:
- ✅ validate-version.cjs validates current VERSION file
- ✅ validate-changelog.cjs validates current CHANGELOG.md
- ✅ changelogUtils.cjs parses and validates changelog
- ✅ release.agent.cjs runs successfully in dry-run mode

## Notes

- All scripts renamed from .js to .cjs for CommonJS compatibility
- Package.json contains "type": "module", so .cjs extension required
- Release agent supports --scope=major|minor|patch and --dry-run flags
- Follows LightSpeed coding standards and documentation requirements

Refs: G-1, G-2 (release agent and changelog utils implementation)
ashleyshaw pushed a commit that referenced this pull request Nov 17, 2025
Completes the remaining medium-priority items from the release agent review.
Adds PR automation, Release Notes Manager agent, and comprehensive scope
parameter documentation.

## Changes

### 1. PR Automation for release-prep.yml (✅ Complete)

**Created: `scripts/create-release-pr.cjs`**
- Automatically creates release PRs from develop to main
- Computes next version based on merged PR labels
- Updates VERSION and CHANGELOG.md files
- Creates release branch (release/vX.Y.Z)
- Generates comprehensive PR description with:
  - Changelog summary
  - Release checklist
  - Version bump information
- Uses gh CLI for PR creation

**Updated: `.github/workflows/release-prep.yml`**
- Added "Create Release PR" step
- Calls create-release-pr.cjs script
- Passes GITHUB_TOKEN for authentication
- Removes TODO comment (now implemented)

**Features:**
- Validates unreleased changes exist before creating PR
- Detects if release branch already exists
- Computes semantic version bumps (major/minor/patch)
- Commits and pushes changes automatically
- Comprehensive error handling and logging

### 2. Release Notes Manager Agent (✅ Complete)

**Created: `.github/agents/release-notes-manager.agent.cjs`**

Comprehensive release notes generation agent that:
- Compiles clean release notes from changelog
- Generates highlights from key sections (Added, Changed, Security)
- Detects and flags breaking changes automatically
- Lists contributors with PR counts
- Groups changes by type with emojis (✨ Added, 🐛 Fixed, etc.)
- Formats output suitable for GitHub releases
- Includes installation instructions
- Links to full changelog comparison

**CLI Usage:**
```bash
# Generate notes for specific version
node .github/agents/release-notes-manager.agent.cjs --version=1.0.0

# Generate notes for latest version
node .github/agents/release-notes-manager.agent.cjs --latest

# Output to file
node .github/agents/release-notes-manager.agent.cjs --version=1.0.0 --output=RELEASE_NOTES.md
```

**Features:**
- ✅ Highlights (top 5 important changes)
- ✅ Breaking changes detection and warnings
- ✅ Grouped sections with emojis
- ✅ Contributor attribution
- ✅ Installation instructions
- ✅ Full changelog links
- ✅ Graceful error handling for missing tags

**Implements spec:** `.github/agents/TODO/release-notes-manager.agents.md`

### 3. Scope Parameter Documentation (✅ Complete)

**Created: `docs/RELEASE-SCOPE-GUIDE.md`**

Comprehensive 400+ line guide covering:

**Overview:**
- What the --scope parameter does
- Semantic versioning primer
- How it affects version bumping

**Detailed Sections:**
- When to use each scope (patch/minor/major)
- Real-world examples for each scope type
- Decision flowchart for scope selection
- Release label system integration

**Examples:**
- Bug fix release (patch)
- New feature release (minor)
- Breaking change release (major)
- Dry-run testing examples

**Best Practices:**
- Validation before release
- Documentation requirements
- Testing procedures
- Communication guidelines

**FAQ:**
- Common questions and answers
- Edge cases and troubleshooting
- Pre-release versions
- Reverting releases
- Monorepo considerations

**Related Documentation:**
- Links to release process guide
- Agent specifications
- External SemVer reference
- Support channels

## Testing

All components tested and working:

✅ **create-release-pr.cjs**
- Script executes without errors
- Validates unreleased changes
- Handles missing tags gracefully

✅ **release-notes-manager.agent.cjs**
- Generates comprehensive release notes for 0.1.0
- Handles missing git tags gracefully
- Formats output with proper markdown
- Includes highlights, breaking changes, grouped sections
- Lists contributors (when available)

✅ **RELEASE-SCOPE-GUIDE.md**
- Well-structured and comprehensive
- Clear examples and use cases
- Proper YAML frontmatter
- Links to related documentation

## Benefits

1. **Automated PR Creation**
   - Reduces manual work for maintainers
   - Ensures consistent PR format
   - Validates changelog before PR creation
   - Integrates with existing workflows

2. **Professional Release Notes**
   - User-friendly format
   - Highlights key changes
   - Warns about breaking changes
   - Credits contributors

3. **Clear Documentation**
   - Removes ambiguity about version bumping
   - Provides decision framework
   - Real-world examples
   - Answers common questions

## Standards Compliance

- ✅ UK English throughout
- ✅ LightSpeed coding standards
- ✅ Comprehensive JSDoc comments
- ✅ YAML frontmatter in documentation
- ✅ Error handling and logging
- ✅ CommonJS compatibility (.cjs extension)

## Related Issues

- Addresses medium-priority item #1: PR automation
- Addresses medium-priority item #2: Release Notes Manager
- Addresses medium-priority item #3: Scope documentation
- Completes TODO in release-prep.yml (line 25)

## Next Steps

The release automation is now feature-complete for MVP:
- ✅ All critical issues resolved
- ✅ All medium-priority items completed
- ⏳ Low-priority polish items remain (optional)

---

**Dependencies:** Requires .cjs scripts from previous commit
**Breaking Changes:** None
**Migration Required:** None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants