Skip to content
Open
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ yarn-error.log*
/dist-zip
/tests/e2e/artifacts
npm-debug.log
.spec/
npm-debug.log
.phpcs.xml
phpcs.xml
148 changes: 14 additions & 134 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,143 +1,23 @@
# Ghost Kit - WordPress Gutenberg Blocks Plugin
# AGENTS

🚨 **CRITICAL INSTRUCTIONS FOR AI LANGUAGE MODELS** 🚨
Concise guidance for coding agents. **Do not turn this file into a manual.**

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

## ✅ SCRIPT EXECUTION RULES
WordPress plugin: large set of Gutenberg blocks and related editor/settings UI (`GhostKit_*` classes).

**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.
## Stack

## Essential Tech Stack
- PHP, WPCS
- React + `@wordpress/scripts`, SCSS
- Blocks and editor code: `gutenberg/`; PHP services: `classes/`; admin/settings as structured in repo; `build/` is compiled.

- **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
## Rules

## Critical Development Rules
- Prefer minimal, localized changes; match existing Ghost Kit patterns.
- WordPress: sanitize/escape; verify nonces and capabilities for privileged flows.
- Confirm script names in `package.json` before running builds or linters.

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

// 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.
Defined in `package.json` (e.g. `npm run dev`, `npm run build`, lint, env, e2e). Use those exact names.
66 changes: 66 additions & 0 deletions assets/vendor/gist-simple/dist/gist-simple.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@
background: #fff;
}

/* Highlight lines */
.gist-simple .gist-simple-highlighted-line {
background-color: rgb(255, 255, 204);
}

/* Collapsed lines */
.gist-simple .js-line-number.collapsed,
.gist-simple .js-file-line.collapsed {
background-color: #f9f9f9;
color: #999;
font-size: 12px;
font-style: italic;
padding-top: 5px !important;
padding-bottom: 5px !important;
}
.gist-simple .js-line-number.collapsed {
text-align: center;
}

/* Caption */
.gist-simple-caption > td {
background-color: #f9f9f9;
border-bottom: 10px solid white;
}
.gist-simple-caption > td:last-child {
padding: 10px !important;
font-weight: bold;
}

/* Loading icon */
.gist-simple-loading-icon {
display: flex;
align-items: center;
Expand Down Expand Up @@ -44,3 +74,39 @@
opacity: 1;
}
}

/* Dark mode */
.gist-simple-dark,
[data-theme="dark"] .gist-simple-system {
filter: invert(.8) contrast(1.6) hue-rotate(180deg);
}
.gist-simple-dark .gist-simple-highlighted-line,
[data-theme="dark"] .gist-simple-system .gist-simple-highlighted-line {
background-color: rgb(235, 233, 204);
}
.gist-simple-dark .js-line-number.collapsed,
.gist-simple-dark .gist-simple-system .js-file-line.collapsed,
[data-theme="dark"] .js-line-number.collapsed,
[data-theme="dark"] .gist-simple-system .js-file-line.collapsed {
background-color: #f1f1f1;
}
.gist-simple-dark .gist-simple-caption > td,
[data-theme="dark"] .gist-simple-system .gist-simple-caption > td {
background-color: #f1f1f1;
}

@media (prefers-color-scheme: dark) {
.gist-simple-system {
filter: invert(.8) contrast(1.6) hue-rotate(180deg);
}
.gist-simple .gist-simple-highlighted-line {
background-color: rgb(235, 233, 204);
}
.gist-simple .js-line-number.collapsed,
.gist-simple .js-file-line.collapsed {
background-color: #f1f1f1;
}
.gist-simple-caption > td {
background-color: #f1f1f1;
}
}
Loading
Loading