Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Claude Code Review

on:
pull_request:
types: [opened, synchronize]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"

jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
You are reviewing a pull request. Focus ONLY on the changes made in this PR, not the entire codebase.

First, use `gh pr diff` to see what files and lines were actually changed in this PR.
Then review ONLY those specific changes for:
- Code quality issues in the modified lines
- Potential bugs introduced by the changes
- Security concerns in the new/modified code
- Whether tests are needed for the changes

Ignore existing code that wasn't modified. Provide concise, actionable feedback.
Use `gh pr comment` to post your review focusing only on the actual changes.

Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'

50 changes: 50 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read

# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'

# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://docs.anthropic.com/en/docs/claude-code/sdk#command-line for available options
# claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)'

143 changes: 143 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Ghost Kit - WordPress Gutenberg Blocks Plugin

🚨 **CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS** 🚨

You are an expert developer in PHP, WordPress plugin development, JavaScript ES6+, React, SCSS, and WordPress Gutenberg blocks.

## ✅ SCRIPT EXECUTION RULES

**NEVER** run `npm run build:prod` - only when explicitly requested.
**ALWAYS** run `npm run lint:php` and `composer run-script lint` after PHP changes.
**ALWAYS** run `npm run lint:js` and `npm run lint:css` after frontend changes.

## Essential Tech Stack

- **Backend**: PHP 7.2+, WordPress 6.2+, WordPress Coding Standards (WPCS)
- **Frontend**: JavaScript ES6+, React (Gutenberg), SCSS, @wordpress/scripts
- **Architecture**: Single-plugin system with 35+ Gutenberg blocks
- **Build**: @wordpress/scripts, Webpack, npm for package management

## Critical Development Rules

### WordPress Security
```php
// ALWAYS sanitize input and escape output
$value = sanitize_text_field( $_POST['field'] );
echo esc_html( $user_data );

// ALWAYS verify nonces and capabilities
check_ajax_referer( 'ghostkit-ajax-nonce', 'nonce' );
if ( ! current_user_can( 'edit_posts' ) ) wp_die( 'Unauthorized' );
```

### Plugin Architecture
- **Main Class**: `GhostKit` singleton pattern in `class-ghost-kit.php`
- **Module Loading**: Individual classes in `/classes/` loaded via `require_once`
- **Block Registration**: Gutenberg blocks in `/gutenberg/blocks/`
- **Namespace**: All classes prefixed with `GhostKit_`
- **Hooks**: Use WordPress action/filter system exclusively

### Key File Paths
- `class-ghost-kit.php` - Main plugin bootstrap (singleton pattern)
- `gutenberg/` - All Gutenberg block components and logic
- `gutenberg/blocks/` - 35+ individual block directories
- `classes/` - Core PHP classes (Assets, REST, Typography, etc.)
- `settings/` - Admin settings interface
- `assets/` - Source SCSS/JS files
- `build/` - Compiled assets (webpack output)

## Development Commands

```bash
# Build
npm run dev # Development with watcher and hot reload
npm run build # Development build

# Quality Checks
npm run lint:php # PHP CodeSniffer (WPCS)
npm run lint:js # ESLint JavaScript
npm run lint:css # Stylelint SCSS
npm run lint # Run all linters concurrently

# Testing
npm run test:e2e # Playwright end-to-end tests
npm run test:unit:php # PHPUnit tests in wp-env

# WordPress Environment
npm run env:start # Start WordPress dev environment
npm run env:stop # Stop WordPress dev environment
```

## WordPress Patterns

### Block Registration
```php
// Gutenberg block registration
register_block_type( 'ghostkit/block-name', array(
'render_callback' => 'render_callback_function',
'attributes' => array(
'content' => array(
'type' => 'string',
'default' => '',
),
),
) );
```

### AJAX Handlers
```php
add_action( 'wp_ajax_ghostkit_action', 'callback_function' );
function callback_function() {
check_ajax_referer( 'ghostkit-ajax-nonce', 'nonce' );
wp_send_json_success( $data );
}
```

### Asset Enqueuing
```php
// Use GhostKit_Assets class for consistent asset loading
GhostKit_Assets::enqueue_script(
'ghostkit-block-script',
'build/blocks/block-name/index',
array( 'wp-blocks', 'wp-element' )
);
```

## Key Block Categories
- **Layout Blocks**: `accordion/`, `grid/`, `carousel/`, `tabs-v2/`
- **Content Blocks**: `alert/`, `button/`, `counter-box/`, `testimonial/`
- **Media Blocks**: `gif/`, `google-maps/`, `video/`, `instagram/`
- **Advanced Blocks**: `form/`, `table-of-contents/`, `pricing-table/`

## Core Classes Overview
- `GhostKit_Assets` - Asset management and enqueuing
- `GhostKit_REST` - REST API endpoints
- `GhostKit_Typography` - Typography and Google Fonts
- `GhostKit_Icons` - Icon library management
- `GhostKit_Breakpoints` - Responsive breakpoint system
- `GhostKit_Templates` - Template and theme integration

## WordPress Integration
```php
// Main plugin instance
function ghostkit() {
return GhostKit::instance();
}
add_action( 'plugins_loaded', 'ghostkit' );

// Block category registration
add_filter( 'block_categories_all', array( $this, 'block_categories_all' ), 9999 );

// Asset enqueuing for blocks
add_action( 'enqueue_block_assets', array( $this, 'enqueue_block_assets' ), 9 );
```

## Build System
- Uses `@wordpress/scripts` for consistent WordPress development
- Webpack configuration in `webpack.config.js`
- SCSS compilation with PostCSS and RTL support
- Vendor libraries copied to `/assets/vendor/`

---

**Note**: This is a comprehensive Gutenberg blocks plugin focused on enhancing the WordPress editor experience with advanced blocks, motion effects, and responsive design tools.
Loading