Skip to content

Commit a52a30b

Browse files
authored
Merge pull request #1 from imagewize/feature/v2-absorb-elayne-cli
Feature/v2 Absorb Elayne Cli
2 parents 31e43ca + d48e4fe commit a52a30b

59 files changed

Lines changed: 3690 additions & 8 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [2.0.0] - 2026-05-08
8+
9+
### Added
10+
11+
**Scaffolding Commands (Phase 5 - absorbed from elayne-cli):**
12+
13+
- `pattern:create` command (`src/Commands/Scaffold/PatternCreateCommand.php`) — Scaffold new Elayne block patterns from templates with interactive prompts:
14+
- Supports 23 pattern templates (see below)
15+
- Supports 18 pattern categories (header, footer, elayne/hero, elayne/features, etc.)
16+
- Options: `--title`, `--slug`, `--template`, `--category`, `--keywords`, `--output-dir`, `--with-style`, `--style-dir`, `--shell-only`
17+
- Automatically generates CSS file when `--with-style` flag is used
18+
- Shell-only mode for editor-first workflow (generates PHP header + paste marker)
19+
20+
- `layout:create` command (`src/Commands/Scaffold/LayoutCreateCommand.php`) — Scaffold new Elayne block layout patterns:
21+
- Supports 8 layout skeletons (full-width, two-column, three-column, sidebar-left, sidebar-right, hero-image-left, hero-image-right, landing-page)
22+
- Options: `--title`, `--slug`, `--layout`, `--category`, `--keywords`, `--output-dir`, `--shell-only`
23+
24+
- `style:create` command (`src/Commands/Scaffold/StyleCreateCommand.php`) — Scaffold WordPress theme style variation JSON:
25+
- Supports 5 preset color palettes (custom, legal, plumbing, spa, food-beverage)
26+
- Generates full theme.json with color palette, gradients, and duotone presets
27+
- Interactive color picker with validation
28+
- Options: `--name`, `--vertical`, `--output-dir`
29+
30+
- `pattern:list` command (`src/Commands/Scaffold/PatternListCommand.php`) — List all available resources:
31+
- Lists all 23 templates with descriptions
32+
- Lists all 13 snippets with descriptions
33+
- Lists all 5 style variations with descriptions
34+
- Lists all 18 pattern categories
35+
- Set as default command (replaces `check` as default)
36+
37+
**Template Files (23 patterns in `templates/` directory):**
38+
39+
- `blank.php` — Empty pattern with header only
40+
- `hero-cover.php` — Full-bleed wp:cover with bottom-center content
41+
- `cta-fullwidth.php` — Full-width call-to-action band
42+
- `feature-grid-3col.php` — Full-width section with 3 feature cards
43+
- `stats-bar-fullwidth.php` — Dark full-width stats/numbers bar
44+
- `two-column-text-image.php` — Text left, image right two-column layout
45+
- `header-standard.php` — Standard header with logo, navigation, social links
46+
- `footer-standard.php` — Standard footer with brand blurb, nav columns, subnav
47+
- `testimonials-grid.php` — Responsive testimonial card grid with reviewer info
48+
- `pricing-comparison.php` — Three-tier pricing table with elevated recommended card
49+
- `blog-post-columns.php` — wp:query-driven 3-column post grid (portrait images)
50+
- `team-grid.php` — Team member profile grid with photo, name, title, bio
51+
- `woo-hero.php` — WooCommerce two-column hero
52+
- `woo-ticker.php` — WooCommerce server-rendered marquee ticker bar
53+
- `woo-shop-categories.php` — WooCommerce CSS bento grid layout
54+
- `woo-featured-products.php` — WooCommerce section header with View All + product-collection grid
55+
- `woo-our-story.php` — WooCommerce two-column brand story
56+
- `woo-testimonials.php` — WooCommerce three-column testimonial cards with ratings
57+
- `woo-newsletter.php` — WooCommerce full-bleed newsletter signup
58+
- `woo-shop-landing.php` — WooCommerce store homepage shell
59+
- `woo-cart.php` — WooCommerce cart page wrapper
60+
- `woo-checkout.php` — WooCommerce checkout page wrapper
61+
- `woo-filters-sidebar.php` — WooCommerce sticky sidebar with filters
62+
- `woo-product-grid.php` — WooCommerce filter-aware product-collection grid
63+
64+
**Layout Files (8 layouts in `layouts/` directory):**
65+
66+
- `full-width.php` — Single column, constrained
67+
- `two-column.php` — 50/50 columns block
68+
- `three-column.php` — Grid with 3 equal groups
69+
- `sidebar-left.php` — Narrow left sidebar (33%) + wide content area (66%)
70+
- `sidebar-right.php` — Wide content area (66%) + narrow right sidebar (33%)
71+
- `hero-image-left.php` — Cover image left + heading, text, CTA right
72+
- `hero-image-right.php` — Heading, text, CTA left + cover image right
73+
- `landing-page.php` — Hero + 3-column features + CTA
74+
75+
**CSS Stubs (8 files in `css/` directory):**
76+
77+
- `cta-fullwidth.css` — Styles for CTA full-width pattern
78+
- `feature-grid-3col.css` — Styles for 3-column feature grid
79+
- `generic.css` — Generic fallback CSS stub
80+
- `hero-cover.css` — Styles for hero cover pattern
81+
- `stats-bar-fullwidth.css` — Styles for stats bar pattern
82+
- `team-grid.css` — Styles for team grid pattern
83+
- `testimonials-grid.css` — Styles for testimonials grid pattern
84+
- `woo-filters-sidebar.css` — Comprehensive styles for WooCommerce filters sidebar
85+
86+
**Code Snippets (13 files in `snippets/` directory):**
87+
88+
- `eyebrow-heading-body.txt` — Eyebrow label + heading + body paragraph
89+
- `3col-grid-wrapper.txt` — Responsive 3-column grid wrapper
90+
- `stat-item.txt` — Number + label stat card (dark background)
91+
- `testimonial-card.txt` — Testimonial with stars, quote, author
92+
- `two-button-group.txt` — Primary + outline button pair
93+
- `overlay-grid-cover-card.txt` — Portrait cover image card + floating badge
94+
- `valid-cover.txt` — wp:cover with all required attributes
95+
- `valid-columns-wp66.txt` — wp:columns without inline gap/margin
96+
- `responsive-grid-min-width.txt` — wp:group grid layout with minimumColumnWidth
97+
- `valid-button-attr-order.txt` — wp:button with proper attribute order
98+
- `valid-fullwidth-section.txt` — alignfull outer group + margin reset
99+
- `valid-heading-with-preset.txt` — wp:heading with fontSize slug and matching utility class
100+
101+
### Changed
102+
103+
- **Application version**: Bumped from `1.0.0` to `2.0.0` in `bin/pt-cli`
104+
- **Package description**: Updated from "Pattern compliance checker" to "Pattern scaffolding and compliance checker for WordPress FSE block themes" in `composer.json`
105+
- **Default command**: Changed from `check` to `list` in `bin/pt-cli`
106+
- **Namespace migration**: All scaffold commands now under `Imagewize\PtCli\Commands\Scaffold\` namespace (previously `Imagewize\ElaynePatternCli\Commands` in elayne-cli)
107+
108+
### Deprecated
109+
110+
- `imagewize/elayne-cli` package — All scaffold functionality has been absorbed into pt-cli v2.0.0 (Phase 6)
111+
112+
---
113+
114+
## [1.0.0] - 2026-05-08
115+
116+
Initial release — pattern compliance checker for WordPress FSE block themes.
117+
118+
### Added
119+
120+
- `bin/pt-cli` entry point with Symfony Console application
121+
- `check` command with `--theme` and `--autofix` flags
122+
- `src/Commands/CheckCommand.php` — CLI entry point for compliance checking
123+
- `src/Compliance/ComplianceChecker.php` — orchestrates rule sets per file and directory
124+
- `src/Compliance/Rules/RuleSetInterface.php` and `AbstractRuleSet.php` — rule set contract
125+
- `src/Compliance/Rules/BaseRules.php` — 19 compliance checks for any FSE theme:
126+
- No hardcoded CSS font sizes (px/rem/em)
127+
- No spacer blocks (use blockGap instead)
128+
- Margin reset required on alignfull patterns
129+
- Warn on `wp:columns` for 3+ columns (use responsive grid with `minimumColumnWidth`)
130+
- No hardcoded media IDs
131+
- Translated strings required (HTML tags + alt attributes)
132+
- Proper `patternName` in outermost block metadata
133+
- No HTML comments between opening tags and block comments
134+
- No custom-domain emails (use `example@example.com`)
135+
- No hardcoded external URLs in `src` attributes
136+
- `wp:button` root `fontSize` must use `style.typography`
137+
- `wp:button` `className` must come before `style` in JSON
138+
- Cover block `minHeight` must have root-level units
139+
- No empty border side objects `{}` in block JSON
140+
- `wp:buttons` must have `<div class="wp-block-buttons">` wrapper
141+
- No `overflow:hidden` as inline style on group blocks
142+
- No `opacity` as inline style on HTML elements
143+
- Font preset classes must match root-level `fontSize`/`fontFamily`
144+
- No stale inline `blockGap`/`gap`/`margin` on group/column wrappers
145+
- `src/Compliance/Rules/WooCommerceRules.php` — 5 WooCommerce-specific checks:
146+
- `product-title` inside `product-template` must use `post-title` + `__woocommerceNamespace`
147+
- WC native blocks must not have `__woocommerceNamespace`
148+
- `product-collection` must have `query` metadata
149+
- `product-collection` must have `<div class="wp-block-woocommerce-product-collection">` wrapper
150+
- `product-collection` must not have both `layout` and `displayLayout`
151+
- `src/Compliance/Config/ConfigLoader.php` — loads and merges JSON config with project-level override support
152+
- `src/Compliance/Config/ThemeConfig.php` — typed config accessor
153+
- `config/base.json` — default rules for any FSE theme
154+
- `config/elayne.json` — Elayne-specific rules (extends base): theme attribute, `elayne/` prefix, emoji check, WooCommerce rules, template exceptions
155+
- Five autofixable rules applied by `--autofix`:
156+
- Strip inline `gap:` from group/column wrappers
157+
- Strip inline `margin:` from flex group/column wrappers
158+
- Reorder `wp:button` JSON keys (`className` before `style`)
159+
- Migrate `wp:button` root `fontSize` to `style.typography`
160+
- Inject `has-{slug}-font-size` class on heading/paragraph elements
161+
- Project-level config override: `.pt-cli/{theme}.json` in project root
162+
- `README.md` with full usage, configuration, and rule reference
163+
- `LICENSE` (MIT)

README.md

Lines changed: 131 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# pt-cli
22

3-
Pattern compliance checker for WordPress FSE block themes.
3+
Pattern scaffolding and compliance checker for WordPress FSE block themes.
44

5-
Checks pattern `.php` files for structural and naming rule violations — no WordPress context required. Runs on the host machine as a standalone PHP CLI tool.
5+
Generates block pattern PHP files, layout patterns, and style variations. Checks pattern `.php` files for structural and naming rule violations — no WordPress context required. Runs on the host machine as a standalone PHP CLI tool.
66

77
## Installation
88

@@ -22,6 +22,27 @@ Requires PHP 8.1+.
2222

2323
## Usage
2424

25+
### Scaffolding Commands
26+
27+
```bash
28+
# List available templates, snippets, categories, and style variations
29+
pt-cli list
30+
31+
# Scaffold a new pattern from a template
32+
pt-cli pattern:create --title="My Hero" --slug=my-hero --template=hero-cover --category=elayne/hero
33+
34+
# Scaffold a layout pattern
35+
pt-cli layout:create --title="Landing Page" --slug=landing --layout=landing-page --category=elayne/pages
36+
37+
# Scaffold a theme style variation
38+
pt-cli style:create --name="Ocean Legal" --vertical=legal
39+
40+
# Full interactive mode (no options = prompts)
41+
pt-cli pattern:create
42+
```
43+
44+
### Compliance Checking
45+
2546
```bash
2647
# Check all patterns in a directory
2748
pt-cli check /path/to/patterns
@@ -36,15 +57,119 @@ pt-cli check /path/to/patterns/header-default.php --theme=elayne
3657
pt-cli check /path/to/patterns --theme=elayne --autofix
3758
```
3859

60+
## Commands Reference
61+
62+
| Command | Description |
63+
|---------|-------------|
64+
| `list` (default) | List available templates, snippets, categories, and style variations |
65+
| `pattern:create` | Scaffold a new Elayne block pattern from a template |
66+
| `layout:create` | Scaffold a new Elayne block layout pattern |
67+
| `style:create` | Scaffold a WordPress theme style variation JSON |
68+
| `check` | Check pattern files for compliance violations |
69+
3970
## Workflow
4071

41-
`pt-cli` is one tool in a three-step pattern workflow:
72+
`pt-cli` is an all-in-one tool for WordPress FSE block theme development:
73+
74+
### Scaffolding Workflow
75+
76+
| Step | Tool | Purpose | Where |
77+
|------|------|---------|-------|
78+
| 1 | `pt-cli pattern:create` or `pt-cli layout:create` | Generate pattern/layout scaffolding | Host |
79+
| 2 | Build in WP editor | Create pattern content | VM |
80+
| 3 | Copy blocks | Copy all blocks from editor | VM |
81+
| 4 | `pt-cli pattern:create --shell-only` | Create PHP file with paste marker | Host |
82+
| 5 | Replace marker | Paste blocks into pattern file | Host |
83+
84+
### Compliance Workflow
4285

4386
| Step | Tool | Purpose | Where |
4487
|------|------|---------|-------|
45-
| 1 | `elayne scaffold` | Generate pattern scaffolding | Host |
88+
| 1 | `pt-cli check` | Generate pattern scaffolding | Host |
4689
| 2 | `wp pattern validate` | Structural validation (WordPress parser) | VM |
47-
| 3 | `pt-cli check` | Compliance checking | Host |
90+
| 3 | `pt-cli check --autofix` | Compliance checking with fixes | Host |
91+
92+
## Templates
93+
94+
**23 pre-built pattern templates** covering common use cases:
95+
96+
| Template | Description |
97+
|----------|-------------|
98+
| `blank` | Empty pattern with header only |
99+
| `hero-cover` | Full-bleed wp:cover with bottom-center content |
100+
| `cta-fullwidth` | Full-width call-to-action band |
101+
| `feature-grid-3col` | Full-width section with 3 feature cards |
102+
| `stats-bar-fullwidth` | Dark full-width stats/numbers bar |
103+
| `two-column-text-image` | Text left, image right two-column layout |
104+
| `header-standard` | Standard header — logo, navigation, social links |
105+
| `footer-standard` | Standard footer — brand blurb, nav columns, subnav |
106+
| `testimonials-grid` | Responsive testimonial card grid with reviewer info |
107+
| `pricing-comparison` | Three-tier pricing table with elevated recommended card |
108+
| `blog-post-columns` | wp:query-driven 3-column post grid (portrait images) |
109+
| `team-grid` | Team member profile grid — photo, name, title, bio |
110+
111+
**WooCommerce templates:**
112+
113+
| Template | Description |
114+
|----------|-------------|
115+
| `woo-hero` | Two-column hero: text + CTA left, decorative cover right |
116+
| `woo-ticker` | Server-rendered marquee ticker bar (needs render_block filter) |
117+
| `woo-shop-categories` | CSS bento grid: one large featured card + four smaller cards |
118+
| `woo-featured-products` | Section header with View All + product-collection 4-col grid |
119+
| `woo-our-story` | Two-column brand story: monogram watermark left, text + stats right |
120+
| `woo-testimonials` | Three-column testimonial cards with star ratings and avatar circles |
121+
| `woo-newsletter` | Full-bleed newsletter signup with decorative eyebrow |
122+
| `woo-shop-landing` | Store homepage shell that composes sub-patterns in sequence |
123+
| `woo-cart` | Full-width cart page wrapper (Inserter: false) |
124+
| `woo-checkout` | Full-width checkout page wrapper (Inserter: false) |
125+
| `woo-filters-sidebar` | Sticky sidebar: price slider + colour-chip attribute + two checkbox-list attributes |
126+
| `woo-product-grid` | Filter-aware product-collection grid with sort toolbar + pagination |
127+
128+
## Layouts
129+
130+
**8 layout skeletons** for rapid page construction:
131+
132+
| Layout | Description |
133+
|--------|-------------|
134+
| `full-width` | Single column, constrained — simplest starting point |
135+
| `two-column` | 50/50 columns block |
136+
| `three-column` | Grid with 3 equal groups |
137+
| `sidebar-left` | Narrow left sidebar (33%) + wide content area (66%) |
138+
| `sidebar-right` | Wide content area (66%) + narrow right sidebar (33%) |
139+
| `hero-image-left` | Cover image left + heading, text, CTA right |
140+
| `hero-image-right` | Heading, text, CTA left + cover image right |
141+
| `landing-page` | Hero + 3-column features + CTA — no header/footer wrapper |
142+
143+
## Style Variations
144+
145+
**5 preset color palettes** for common business verticals:
146+
147+
| Vertical | Color Scheme |
148+
|----------|--------------|
149+
| `custom` | Enter your own hex color values |
150+
| `legal` | Navy blue + gold |
151+
| `plumbing` | Dark blue + orange |
152+
| `spa` | Sage green + sand |
153+
| `food-beverage` | Burgundy + gold |
154+
155+
## Snippets
156+
157+
**13 reusable code snippets** for common pattern components:
158+
159+
| Snippet | Description |
160+
|---------|-------------|
161+
| `eyebrow-heading-body.txt` | Eyebrow label + heading + body paragraph |
162+
| `3col-grid-wrapper.txt` | Responsive 3-column grid wrapper |
163+
| `stat-item.txt` | Number + label stat card (dark background) |
164+
| `testimonial-card.txt` | Testimonial with stars, quote, author |
165+
| `two-button-group.txt` | Primary + outline button pair |
166+
| `overlay-grid-cover-card.txt` | Portrait cover image card + floating badge (use wp:cover, NOT wp:image) |
167+
| `valid-cover.txt` | wp:cover with all required attrs: dimRatio, backgroundColor/customGradient, minHeight (root integer) + minHeightUnit |
168+
| `valid-columns-wp66.txt` | wp:columns without inline gap/margin; isStackedOnMobile:false → is-not-stacked-on-mobile class |
169+
| `responsive-grid-min-width.txt` | wp:group grid layout with minimumColumnWidth — preferred over wp:columns for 3+ columns |
170+
| `valid-button-attr-order.txt` | wp:button with className/colors before style; font size via style.typography.fontSize |
171+
| `valid-fullwidth-section.txt` | alignfull outer group + margin reset (top/bottom:"0" no units) + constrained inner group |
172+
| `valid-heading-with-preset.txt` | wp:heading with fontSize slug in JSON and matching has-{slug}-font-size utility class in HTML |
48173

49174
## Configuration
50175

@@ -130,6 +255,7 @@ Config lookup order:
130255
git clone https://github.com/imagewize/pt-cli
131256
cd pt-cli
132257
composer install
258+
bin/pt-cli list
133259
bin/pt-cli check --help
134260
```
135261

bin/pt-cli

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@ foreach ($autoloadPaths as $path) {
1414
}
1515

1616
use Imagewize\PtCli\Commands\CheckCommand;
17+
use Imagewize\PtCli\Commands\Scaffold\LayoutCreateCommand;
18+
use Imagewize\PtCli\Commands\Scaffold\PatternCreateCommand;
19+
use Imagewize\PtCli\Commands\Scaffold\PatternListCommand;
20+
use Imagewize\PtCli\Commands\Scaffold\StyleCreateCommand;
1721
use Symfony\Component\Console\Application;
1822

19-
$application = new Application('pt-cli', '1.0.0');
23+
$application = new Application('pt-cli', '2.0.0');
2024
$application->add(new CheckCommand());
21-
$application->setDefaultCommand('check');
25+
$application->add(new PatternCreateCommand());
26+
$application->add(new LayoutCreateCommand());
27+
$application->add(new StyleCreateCommand());
28+
$application->add(new PatternListCommand());
29+
$application->setDefaultCommand('list');
2230
$application->run();

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "imagewize/pt-cli",
3-
"description": "Pattern compliance checker for WordPress FSE block themes",
3+
"description": "Pattern scaffolding and compliance checker for WordPress FSE block themes",
44
"type": "project",
55
"license": "MIT",
66
"require": {

css/cta-fullwidth.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* ── Elayne TODO-title ── */
2+
3+
.elayne-TODO-slug {
4+
}
5+
6+
.elayne-TODO-slug .wp-block-buttons {
7+
justify-content: center;
8+
}
9+
10+
@media (max-width: 600px) {
11+
.elayne-TODO-slug .wp-block-buttons {
12+
flex-direction: column;
13+
align-items: stretch;
14+
}
15+
.elayne-TODO-slug .wp-block-button,
16+
.elayne-TODO-slug .wp-block-button__link {
17+
width: 100%;
18+
text-align: center;
19+
}
20+
}

0 commit comments

Comments
 (0)