@stratawp/cli 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +3 -2
  3. package/templates/advanced-theme/.ai/ONBOARDING.md +44 -0
  4. package/templates/advanced-theme/.ai/PROJECT_RULES.md +58 -0
  5. package/templates/advanced-theme/.ai/SKILLS.md +20 -0
  6. package/templates/advanced-theme/.ai/agent-state.md +21 -0
  7. package/templates/advanced-theme/.ai/developer-directions.md +41 -0
  8. package/templates/advanced-theme/.ai/plans/SPEC-TEMPLATE.md +37 -0
  9. package/templates/advanced-theme/.ai/skills/architecture/SKILL.md +43 -0
  10. package/templates/advanced-theme/.ai/skills/deployment/SKILL.md +34 -0
  11. package/templates/advanced-theme/.ai/skills/gutenberg-blocks/SKILL.md +34 -0
  12. package/templates/advanced-theme/.aiignore +42 -0
  13. package/templates/advanced-theme/AGENTS.md +42 -0
  14. package/templates/advanced-theme/package.json +3 -1
  15. package/templates/advanced-theme/scripts/ai-setup.mjs +143 -0
  16. package/templates/basic-theme/.ai/ONBOARDING.md +44 -0
  17. package/templates/basic-theme/.ai/PROJECT_RULES.md +58 -0
  18. package/templates/basic-theme/.ai/SKILLS.md +20 -0
  19. package/templates/basic-theme/.ai/agent-state.md +21 -0
  20. package/templates/basic-theme/.ai/developer-directions.md +41 -0
  21. package/templates/basic-theme/.ai/plans/SPEC-TEMPLATE.md +37 -0
  22. package/templates/basic-theme/.ai/skills/architecture/SKILL.md +43 -0
  23. package/templates/basic-theme/.ai/skills/deployment/SKILL.md +34 -0
  24. package/templates/basic-theme/.ai/skills/gutenberg-blocks/SKILL.md +34 -0
  25. package/templates/basic-theme/.aiignore +42 -0
  26. package/templates/basic-theme/AGENTS.md +42 -0
  27. package/templates/basic-theme/package.json +3 -1
  28. package/templates/basic-theme/scripts/ai-setup.mjs +143 -0
  29. package/templates/store-theme/.ai/ONBOARDING.md +44 -0
  30. package/templates/store-theme/.ai/PROJECT_RULES.md +58 -0
  31. package/templates/store-theme/.ai/SKILLS.md +20 -0
  32. package/templates/store-theme/.ai/agent-state.md +21 -0
  33. package/templates/store-theme/.ai/developer-directions.md +41 -0
  34. package/templates/store-theme/.ai/plans/SPEC-TEMPLATE.md +37 -0
  35. package/templates/store-theme/.ai/skills/architecture/SKILL.md +43 -0
  36. package/templates/store-theme/.ai/skills/deployment/SKILL.md +34 -0
  37. package/templates/store-theme/.ai/skills/gutenberg-blocks/SKILL.md +34 -0
  38. package/templates/store-theme/.aiignore +42 -0
  39. package/templates/store-theme/AGENTS.md +42 -0
  40. package/templates/store-theme/package.json +3 -1
  41. package/templates/store-theme/scripts/ai-setup.mjs +143 -0
  42. package/templates/advanced-theme/vendor/autoload.php +0 -25
  43. package/templates/advanced-theme/vendor/composer/ClassLoader.php +0 -579
  44. package/templates/advanced-theme/vendor/composer/InstalledVersions.php +0 -359
  45. package/templates/advanced-theme/vendor/composer/LICENSE +0 -21
  46. package/templates/advanced-theme/vendor/composer/autoload_classmap.php +0 -10
  47. package/templates/advanced-theme/vendor/composer/autoload_namespaces.php +0 -9
  48. package/templates/advanced-theme/vendor/composer/autoload_psr4.php +0 -11
  49. package/templates/advanced-theme/vendor/composer/autoload_real.php +0 -38
  50. package/templates/advanced-theme/vendor/composer/autoload_static.php +0 -41
  51. package/templates/advanced-theme/vendor/composer/installed.json +0 -61
  52. package/templates/advanced-theme/vendor/composer/installed.php +0 -32
  53. package/templates/advanced-theme/vendor/composer/platform_check.php +0 -26
  54. package/templates/basic-theme/vendor/autoload.php +0 -25
  55. package/templates/basic-theme/vendor/composer/ClassLoader.php +0 -579
  56. package/templates/basic-theme/vendor/composer/InstalledVersions.php +0 -359
  57. package/templates/basic-theme/vendor/composer/LICENSE +0 -21
  58. package/templates/basic-theme/vendor/composer/autoload_classmap.php +0 -10
  59. package/templates/basic-theme/vendor/composer/autoload_namespaces.php +0 -9
  60. package/templates/basic-theme/vendor/composer/autoload_psr4.php +0 -11
  61. package/templates/basic-theme/vendor/composer/autoload_real.php +0 -38
  62. package/templates/basic-theme/vendor/composer/autoload_static.php +0 -41
  63. package/templates/basic-theme/vendor/composer/installed.json +0 -61
  64. package/templates/basic-theme/vendor/composer/installed.php +0 -32
  65. package/templates/basic-theme/vendor/composer/platform_check.php +0 -26
  66. package/templates/store-theme/vendor/autoload.php +0 -25
  67. package/templates/store-theme/vendor/composer/ClassLoader.php +0 -579
  68. package/templates/store-theme/vendor/composer/InstalledVersions.php +0 -359
  69. package/templates/store-theme/vendor/composer/LICENSE +0 -21
  70. package/templates/store-theme/vendor/composer/autoload_classmap.php +0 -10
  71. package/templates/store-theme/vendor/composer/autoload_namespaces.php +0 -9
  72. package/templates/store-theme/vendor/composer/autoload_psr4.php +0 -11
  73. package/templates/store-theme/vendor/composer/autoload_real.php +0 -38
  74. package/templates/store-theme/vendor/composer/autoload_static.php +0 -41
  75. package/templates/store-theme/vendor/composer/installed.json +0 -61
  76. package/templates/store-theme/vendor/composer/installed.php +0 -32
  77. package/templates/store-theme/vendor/composer/platform_check.php +0 -26
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2024 Jon Imms
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
18
+
19
+ ---
20
+
21
+ For the full GPL-3.0 license text, see: https://www.gnu.org/licenses/gpl-3.0.txt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stratawp/cli",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "CLI tool for StrataWP - create and manage WordPress themes",
5
5
  "author": "Jon Imms",
6
6
  "license": "GPL-3.0-or-later",
@@ -37,7 +37,8 @@
37
37
  "./generators": {
38
38
  "types": "./dist/generators/index.d.ts",
39
39
  "import": "./dist/generators/index.js"
40
- }
40
+ },
41
+ "./dist/create.js": "./dist/create.js"
41
42
  },
42
43
  "files": [
43
44
  "dist",
@@ -0,0 +1,44 @@
1
+ # AI Agent Onboarding Guide
2
+
3
+ This guide gets you up to speed with this StrataWP theme efficiently, without redundant setup work.
4
+
5
+ ## 🚀 The Onboarding Workflow
6
+
7
+ ### Step 1: Check Agent State
8
+
9
+ Check `.ai/agent-state.md`.
10
+
11
+ - **If Onboarding Status is "Completed"**: Stop! Do NOT run setup or re-explore. Proceed directly to the user's task.
12
+ - **If Onboarding Status is "Pending"**: Continue below.
13
+
14
+ ### Step 2: Initialize AI Setup (First-Time Only)
15
+
16
+ If your agent-specific configuration file (e.g. `CLAUDE.md`, `.cursor/rules/`, `GEMINI.md`, `.github/copilot-instructions.md`) does not exist:
17
+
18
+ 1. Explain that you are running the setup command.
19
+ 2. Run `pnpm ai:setup` and select your agent (or pass `--agents=<name>`).
20
+
21
+ ### Step 3: Read Developer Directions
22
+
23
+ Read `.ai/developer-directions.md` — the theme developer's standing rules for design, code style, and priorities. You **MUST** adhere to everything in it.
24
+
25
+ ### Step 4: Map the Theme & Initialize Project Rules
26
+
27
+ 1. Read `theme.json` — design tokens, palettes, typography, spacing.
28
+ 2. Read `functions.php` — which StrataWP components are registered.
29
+ 3. Read `vite.config.ts` — entry points and build options.
30
+ 4. Skim `templates/`, `parts/`, `patterns/`, and `src/blocks/` to see what exists.
31
+ 5. Record your findings in the **Discovered Theme Configuration** section of `.ai/PROJECT_RULES.md`.
32
+
33
+ ### Step 5: Update Agent State
34
+
35
+ Update `.ai/agent-state.md`: set Status to Completed, record your agent name and the date, check off the completed steps, and add an Agent Log entry.
36
+
37
+ ---
38
+
39
+ ## 🛠️ Key Resources
40
+
41
+ 1. **Project Rules** (`.ai/PROJECT_RULES.md`) — running log of conventions and decisions. Check it frequently.
42
+ 2. **Skills** (`.ai/skills/`) — recipes for architecture, blocks & patterns, and deployment.
43
+ 3. **Scaffolding** — `stratawp block:new`, `stratawp component:new`, `stratawp template:new`, `stratawp part:new`.
44
+ 4. **Verification** — `pnpm ai:check` before submitting any work.
@@ -0,0 +1,58 @@
1
+ # Project Rules & Learned Guidelines
2
+
3
+ This file is updated over time by the AI agents working on this theme. It is long-term memory: a running log of theme-specific guidelines, discovered patterns, and decisions.
4
+
5
+ > [!IMPORTANT]
6
+ > **AI Agents:** Read this file on every session. Keep it updated with new architectural decisions and conventions established during your work.
7
+
8
+ ---
9
+
10
+ ## 🏗️ Discovered Theme Configuration
11
+
12
+ <!--
13
+ Agent: Document this theme's setup as you discover it (registered components, block list, template structure, build options).
14
+ -->
15
+
16
+ - **Theme Type:** WordPress block theme (FSE), built on the StrataWP framework.
17
+ - **Framework Location:** `vendor/stratawp/core/` (vendored — never hand-edit; replaced on framework updates).
18
+ - **Registered Components:** _(read `functions.php` and list them here)_
19
+ - **Custom Blocks:** _(list `src/blocks/*` here)_
20
+
21
+ ---
22
+
23
+ ## 🎨 Discovered Design System & Tokens
24
+
25
+ <!--
26
+ Agent: Document the palette, typography, and spacing configured in theme.json.
27
+ -->
28
+
29
+ - **Color Palette:**
30
+ - **Typography Rules:**
31
+ - **Spacing Scale:**
32
+
33
+ ---
34
+
35
+ ## 💻 Theme-Specific Coding Patterns
36
+
37
+ <!--
38
+ Agent: Document custom patterns established in this theme (naming standards, APIs to use or avoid, CSS conventions).
39
+ -->
40
+
41
+ - **PHP Components:** Implement `ComponentInterface` (`get_slug()` + `initialize()`); register in `functions.php` or via the `stratawp_theme_components` filter.
42
+ - **Blocks:** Live in `src/blocks/<name>/` with `block.json`; auto-registered by the build — never edit `inc/blocks-generated.php`.
43
+ - **Patterns:** Native blocks first; `wp:html` only when unavoidable; no bare HTML comments between blocks.
44
+
45
+ ---
46
+
47
+ ## 📝 Running Architectural Decisions & Learnings Log
48
+
49
+ <!--
50
+ Agent: Keep a chronological log of decisions and gotchas.
51
+
52
+ Entry format:
53
+
54
+ ### 📅 YYYY-MM-DD - Short Title
55
+ - **Context:** What prompted the decision.
56
+ - **Decision:** What was done and where.
57
+ - **Key Learning:** The reusable insight.
58
+ -->
@@ -0,0 +1,20 @@
1
+ # Skill Directory
2
+
3
+ Specialized skills for AI agents working on this theme.
4
+
5
+ ## 🛠 Foundational
6
+
7
+ - [**Theme Architecture**](skills/architecture/SKILL.md): FSE structure, StrataWP components, build pipeline, hard rules.
8
+ - [**Onboarding Guide**](ONBOARDING.md): First-time setup protocol.
9
+
10
+ ## 🧱 Building
11
+
12
+ - [**Gutenberg Blocks & Patterns**](skills/gutenberg-blocks/SKILL.md): Scaffolding, auto-registration, pattern authoring rules.
13
+
14
+ ## ⚙️ Operations
15
+
16
+ - [**Deployment**](skills/deployment/SKILL.md): Deploying safely with the StrataWP CLI.
17
+
18
+ ## 📋 Planning
19
+
20
+ - [**Spec template**](plans/SPEC-TEMPLATE.md): Contract-first feature planning — copy it into `plans/` for any non-trivial feature.
@@ -0,0 +1,21 @@
1
+ # Agent State
2
+
3
+ This file tracks the onboarding status of AI agents in this theme to prevent redundant setup runs.
4
+
5
+ > [!NOTE]
6
+ > AI Agents: If `Onboarding Status` is **Completed**, do NOT run `pnpm ai:setup` or repeat initial exploration. Proceed directly to the user's task.
7
+
8
+ ## Onboarding Status
9
+
10
+ - **Status**:
11
+ - **Last Agent**:
12
+ - **Last Updated**:
13
+
14
+ ## Completed Steps
15
+
16
+ - [ ] Initial environment check
17
+ - [ ] AI Setup (`pnpm ai:setup`)
18
+ - [ ] Theme architectural mapping
19
+ - [ ] Read Developer Directions (`.ai/developer-directions.md`)
20
+
21
+ ## Agent Log
@@ -0,0 +1,41 @@
1
+ # Developer Directions for AI Agents
2
+
3
+ This file is your dedicated space to define standing rules for all AI agents working on this theme.
4
+
5
+ > [!TIP]
6
+ > **Theme Developer:** Fill out the sections below once, and every agent will read and follow them automatically during onboarding — no need to repeat instructions in chat.
7
+
8
+ ---
9
+
10
+ ## 🎨 Design & Aesthetic Guidelines
11
+
12
+ _Define the look and feel agents should maintain._
13
+
14
+ - **Brand Colors:** _(primary, secondary, backgrounds — prefer pointing at `theme.json` tokens)_
15
+ - **Typography:** _(font families, scale, line-heights)_
16
+ - **Spacing / Grid:** _(gaps, margins, padding system)_
17
+ - **Design Tokens:** Check `theme.json` first before hardcoding colors or spacing.
18
+
19
+ ---
20
+
21
+ ## 💻 Coding Conventions & Overrides
22
+
23
+ _Rules unique to this theme._
24
+
25
+ - **PHP Standards:** _(namespace preferences, templating habits)_
26
+ - **CSS Architecture:** _(naming schemes like BEM, utility class usage)_
27
+ - **TypeScript/JS Rules:** _(module conventions, libraries to avoid)_
28
+
29
+ ---
30
+
31
+ ## 🚀 Project Priorities
32
+
33
+ - **Immediate Focus:**
34
+ - **Planned Enhancements:**
35
+ - **Strict Constraints:** _(e.g., "Do not modify the checkout templates without asking")_
36
+
37
+ ---
38
+
39
+ ## 📝 Custom Guidelines / Miscellaneous
40
+
41
+ -
@@ -0,0 +1,37 @@
1
+ # SPEC: {Feature Title}
2
+
3
+ > Copy this template to `.ai/plans/{YYYY-MM-DD}-{feature-slug}.md`. Do not begin implementation until the user approves the contract.
4
+
5
+ ## Mission Statement
6
+
7
+ _One or two sentences describing the goal and the problem it solves._
8
+
9
+ ## Architectural Fit
10
+
11
+ - **Areas touched:** _(e.g., new block in `src/blocks/`, component in `inc/Components/`, template in `templates/`)_
12
+ - **Hooks & filters used:** _(e.g., `stratawp_theme_components`, `stratawp_conditional_css_files`)_
13
+ - **Design tokens:** _(which `theme.json` tokens apply)_
14
+
15
+ ## User Stories
16
+
17
+ - As a _(site visitor / editor / developer)_, I want _..._ so that _..._
18
+
19
+ ## Success Metrics
20
+
21
+ _How will this be verified? (e.g., "pnpm ai:check passes", "block renders correctly in editor and front end", "no accessibility regressions")_
22
+
23
+ ## Technical Plan (The Contract)
24
+
25
+ 1. **Scaffolding:** _(commands to run, e.g., `stratawp block:new hero`)_
26
+ 2. **Implementation steps:** _(logical order of file creation/modification, with paths)_
27
+ 3. **Verification:** _(build, editor check, front-end check)_
28
+
29
+ ## Open Questions
30
+
31
+ - _(Anything unresolved that blocks >95% implementation confidence.)_
32
+
33
+ ## Approval
34
+
35
+ - **Status:** Draft / Approved
36
+ - **Approved by:** —
37
+ - **Date:** —
@@ -0,0 +1,43 @@
1
+ ---
2
+ description: Theme structure, StrataWP component architecture, and build pipeline constraints.
3
+ globs: src/**/*, inc/**/*, templates/**/*, parts/**/*, patterns/**/*, theme.json, vite.config.ts
4
+ ---
5
+
6
+ # Theme Architecture
7
+
8
+ ## Layout
9
+
10
+ | Path | What it is |
11
+ | -------------------------- | -------------------------------------------------------------------- |
12
+ | `theme.json` | Global settings, styles, and design tokens (single source of truth) |
13
+ | `templates/` / `parts/` | Block templates and template parts (`.html`, FSE) |
14
+ | `patterns/` | Block patterns (`.php` with header comments) |
15
+ | `src/blocks/` | Custom Gutenberg blocks (auto-registered by the build) |
16
+ | `src/js/`, `src/scss/` | Entry points defined in `vite.config.ts` (`src/css/` in some themes) |
17
+ | `inc/Components/` | Theme-specific PHP components |
18
+ | `vendor/stratawp/core/` | The vendored StrataWP framework — **never hand-edit** |
19
+ | `dist/` | Build output — **never edit** |
20
+ | `inc/blocks-generated.php` | Generated block registration — **never edit** |
21
+
22
+ ## Hard Rules
23
+
24
+ 1. **Source files only.** `dist/` and generated files are artifacts of `pnpm build`.
25
+ 2. **The framework is vendored.** `vendor/stratawp/core/` is replaced wholesale on framework updates. Custom behavior belongs in `inc/Components/` and `stratawp_*` filters, never in vendor files.
26
+ 3. **pnpm only** for installs and scripts.
27
+ 4. **Scaffold with the CLI:** `stratawp block:new`, `component:new`, `template:new`, `part:new`.
28
+
29
+ ## PHP Component Architecture
30
+
31
+ - Every component implements `ComponentInterface`: `get_slug(): string` + `initialize(): void` (hook registrations go in `initialize()`, constructors stay side-effect free).
32
+ - Components are registered in `functions.php` via the `Theme` class, and the `stratawp_theme_components` filter can add/remove/replace them.
33
+ - Framework extension points are `stratawp_*` filters — e.g. `stratawp_conditional_css_files`, `stratawp_preconnect_hints`, `stratawp_defer_scripts`. Prefer filters over hardcoding.
34
+
35
+ ## Build Pipeline
36
+
37
+ - Vite compiles entry points and blocks to `dist/`; WordPress enqueues via the generated manifest.
38
+ - `pnpm dev` runs the dev server with HMR (JS/TS, SCSS, and PHP hot reload).
39
+ - `pnpm build` produces production assets and regenerates `inc/blocks-generated.php`.
40
+
41
+ ## Naming
42
+
43
+ - Block namespace = theme slug. Component slugs kebab-case; PHP classes PascalCase; TS files kebab-case.
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: Deploying this theme safely with the StrataWP CLI.
3
+ globs: .stratawp-deploy.json, dist/**/*
4
+ ---
5
+
6
+ # Deployment
7
+
8
+ This theme deploys with the StrataWP CLI (SFTP/FTP/SSH with pre-deploy snapshots).
9
+
10
+ > [!WARNING]
11
+ > Deploys mutate a live site. Never run `stratawp deploy`, `sync:db:push`, or any remote-mutating command unless the user explicitly asks for that exact operation in this session. Always prefer `--dry-run` first.
12
+
13
+ ## Commands
14
+
15
+ ```bash
16
+ stratawp deploy:setup # one-time interactive configuration
17
+ stratawp deploy:test production # connection test (safe)
18
+ stratawp deploy production --dry-run # preview what would change (safe)
19
+ stratawp deploy production # real deploy (asks for confirmation)
20
+ stratawp sync:templates production --all # push Site Editor templates (stored in DB, not files)
21
+ stratawp rollback:list # snapshots (deploys auto-snapshot first)
22
+ ```
23
+
24
+ ## What Ships
25
+
26
+ Only production files deploy: `dist/`, PHP files, `theme.json`, `style.css`, `vendor/`. Source (`src/`), `node_modules/`, and dev files (including `.ai/` and `AGENTS.md`) never ship.
27
+
28
+ ## Rules
29
+
30
+ 1. **Build before deploy** (`pnpm build`) unless using the CLI's built-in build step.
31
+ 2. **Dry-run first, always.** Read the file list; if anything unexpected appears, stop and show the user.
32
+ 3. **Site Editor template changes live in the database**, not in `templates/*.html` — file deploys don't move them. Use `stratawp sync:templates` for those.
33
+ 4. **Credentials** live in the deploy config / `.env` — never inline them in commands, code, or logs.
34
+ 5. If something breaks post-deploy, snapshots exist: `stratawp rollback:list` / `rollback:diff` — but restoring is the user's call, not yours.
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: Scaffolding custom Gutenberg blocks and authoring block patterns in this theme.
3
+ globs: src/blocks/**/*, patterns/**/*
4
+ ---
5
+
6
+ # Gutenberg Blocks & Patterns
7
+
8
+ ## Blocks
9
+
10
+ Scaffold — never hand-roll:
11
+
12
+ ```bash
13
+ stratawp block:new hero
14
+ ```
15
+
16
+ This creates `src/blocks/hero/` with `block.json`, `index.tsx` (editor), `save.tsx` (front end), and styles.
17
+
18
+ Rules:
19
+
20
+ - **Auto-registration:** the build scans `src/blocks/**/block.json` and regenerates `inc/blocks-generated.php`. Never edit that file.
21
+ - **apiVersion 3** for all new blocks; namespace = theme slug.
22
+ - **Dynamic output** uses `render.php` + `"render"` in `block.json`; static output lives in `save.tsx`.
23
+ - **Changing a shipped block's attributes or save output requires a `deprecated` entry** — otherwise existing content shows block-recovery errors.
24
+ - Front-end behavior should prefer the Interactivity API (`viewScriptModule`, `data-wp-*` directives) over ad-hoc scripts.
25
+
26
+ Verify: `pnpm build`, then insert the block in the editor — no console errors, no "attempt block recovery" prompts.
27
+
28
+ ## Patterns (`patterns/*.php`)
29
+
30
+ - **Default to native blocks** (`wp:paragraph`, `wp:heading`, `wp:group`, …) with `className` hooks — they stay editable and render WYSIWYG in the editor.
31
+ - **Use `wp:html` only when it earns its keep:** inline custom-classed spans the rich-text editor strips, custom data attributes, or embedded SVG. Keep chunks small.
32
+ - **Never put bare `<!-- ... -->` HTML comments between blocks** — use `<?php /* ... */ ?>`. Bare comments make the parser wrap them in empty paragraphs (visible layout gaps) or fall back to the Classic block.
33
+ - **Patterns are templates, not live references.** Once inserted, page content is a copy — editing the pattern file does not update existing pages.
34
+ - Watch `theme.json` `<p>` margins when converting a `<div>`/`<span>` to `wp:paragraph` — add explicit margins to affected styles.
@@ -0,0 +1,42 @@
1
+ # Files and directories AI agents should not read or index.
2
+
3
+ # Dependencies
4
+ node_modules/
5
+ vendor/
6
+
7
+ # Build artifacts
8
+ dist/
9
+ .turbo/
10
+ .vite/
11
+
12
+ # Generated files
13
+ inc/blocks-generated.php
14
+
15
+ # Temporary files
16
+ *.log
17
+ tmp/
18
+ .DS_Store
19
+ *.zip
20
+ *.tar.gz
21
+ *.bak
22
+
23
+ # Minified assets
24
+ *.min.css
25
+ *.min.css.map
26
+ *.min.js
27
+ *.min.js.map
28
+
29
+ # Environment & secrets
30
+ .env
31
+ .env.*
32
+ .stratawp-deploy.json
33
+ .stratawp-snapshots/
34
+
35
+ # Binary assets
36
+ *.png
37
+ *.jpg
38
+ *.jpeg
39
+ *.gif
40
+ *.webp
41
+ *.woff
42
+ *.woff2
@@ -0,0 +1,42 @@
1
+ # AI Agents Guide
2
+
3
+ Welcome, AI Agent! This is a StrataWP-powered WordPress block theme (FSE). To work here safely and effectively, you **MUST** follow these five core pillars.
4
+
5
+ ---
6
+
7
+ ### 1. ONBOARDING & STATE PROTOCOL
8
+
9
+ Before starting, check `.ai/agent-state.md` for your status:
10
+
11
+ - **If Pending:** Follow [**The Onboarding Guide**](.ai/ONBOARDING.md) (run `pnpm ai:setup` once, read [**Developer Directions**](.ai/developer-directions.md), read/initialize [**Project Rules**](.ai/PROJECT_RULES.md), and mark state as Completed).
12
+ - **If Completed:** Read [**Project Rules**](.ai/PROJECT_RULES.md) for learned theme conventions, keep it updated with new decisions, and proceed directly to the user's task. Do NOT re-run setup.
13
+
14
+ ### 2. ARCHITECTURE & BUILD PIPELINE
15
+
16
+ - **Source files only.** NEVER edit compiled artifacts (`dist/`) or generated files (`inc/blocks-generated.php` — regenerated by the build). Edit sources under `src/`.
17
+ - **Never hand-edit `vendor/stratawp/core/`.** That is the vendored StrataWP framework — it is replaced wholesale on framework updates, so local edits are lost. Theme customization belongs in `inc/Components/` and the `stratawp_*` filters.
18
+ - **pnpm only.** Never use `npm` or `yarn` for installs or scripts.
19
+ - **Scaffold, don't hand-roll.** Use the StrataWP CLI (`stratawp block:new`, `stratawp component:new`, `stratawp template:new`, `stratawp part:new`) rather than manually bootstrapping files.
20
+
21
+ ### 3. CONTRACT-FIRST DEVELOPMENT
22
+
23
+ - Do not modify source files for a non-trivial feature without an approved plan. Author a spec in `.ai/plans/` (copy `SPEC-TEMPLATE.md`) and ask clarifying questions first until you reach a >95% confidence score.
24
+ - Trivial fixes (typos, single-line bugs) do not require a spec.
25
+
26
+ ### 4. CONFIGURATION FIRST
27
+
28
+ - Reference `theme.json` (design tokens, settings, styles), `vite.config.ts` (entry points, plugin options), and `functions.php` (registered components) before making build or architectural changes.
29
+ - Never hardcode what a `stratawp_*` filter already provides (resource hints, conditional styles, deferred scripts, component list).
30
+
31
+ ### 5. PRE-FLIGHT QUALITY CHECK
32
+
33
+ - Run `pnpm ai:check` before submitting to confirm the theme builds cleanly.
34
+ - If your change affects rendered output, verify it in the block editor and on the front end, and check for accessibility regressions (landmarks, focus, contrast, `aria-*`).
35
+
36
+ ---
37
+
38
+ ## Skills & Resources
39
+
40
+ - [**Skill directory**](.ai/SKILLS.md) — recipes for this theme's architecture, blocks & patterns, and deployment.
41
+ - **Project rules** (`.ai/PROJECT_RULES.md`) — the running log of learned conventions. Read it every session.
42
+ - **StrataWP MCP** — if available, the `@stratawp/mcp` server exposes the framework's generators and component catalog to MCP-capable agents.
@@ -8,7 +8,9 @@
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "vite build",
11
- "preview": "vite preview"
11
+ "preview": "vite preview",
12
+ "ai:setup": "node scripts/ai-setup.mjs",
13
+ "ai:check": "pnpm build"
12
14
  },
13
15
  "dependencies": {
14
16
  "@wordpress/block-editor": "^12.19.0",
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env node
2
+ // Generates instruction files for AI coding agents so they discover and
3
+ // follow this theme's agent protocol (AGENTS.md + .ai/). Zero dependencies.
4
+ //
5
+ // Usage:
6
+ // pnpm ai:setup # interactive agent selection
7
+ // pnpm ai:setup --all # generate for every supported agent
8
+ // pnpm ai:setup --agents=claude,cursor
9
+ // pnpm ai:setup --force # overwrite existing files
10
+
11
+ import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
12
+ import { dirname, resolve } from 'node:path'
13
+ import { fileURLToPath } from 'node:url'
14
+ import { createInterface } from 'node:readline/promises'
15
+
16
+ const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
17
+
18
+ const CORE_INSTRUCTIONS = `# AI Agent Instructions
19
+
20
+ This WordPress theme is built on the StrataWP framework and uses a structured AI-assisted development workflow.
21
+
22
+ **Read \`AGENTS.md\` at the theme root and follow its protocol before making any changes.**
23
+
24
+ Core rules (full detail in AGENTS.md):
25
+
26
+ 1. **Onboarding & state:** Check \`.ai/agent-state.md\`. If onboarding is pending, follow \`.ai/ONBOARDING.md\`. Always read \`.ai/PROJECT_RULES.md\` for learned theme conventions.
27
+ 2. **pnpm only.** Never use npm or yarn.
28
+ 3. **Source files only.** Never edit \`dist/\`, \`inc/blocks-generated.php\`, or \`vendor/stratawp/core/\` (the vendored framework — replaced wholesale on updates).
29
+ 4. **Contract-first.** Non-trivial features require an approved spec in \`.ai/plans/\` (copy \`SPEC-TEMPLATE.md\`).
30
+ 5. **Pre-flight check.** Run \`pnpm ai:check\` before submitting work.
31
+
32
+ Skill recipes live in \`.ai/skills/\` (see \`.ai/SKILLS.md\`).
33
+ `
34
+
35
+ const AGENTS = {
36
+ claude: {
37
+ label: 'Claude Code',
38
+ file: 'CLAUDE.md',
39
+ content: CORE_INSTRUCTIONS,
40
+ },
41
+ cursor: {
42
+ label: 'Cursor',
43
+ file: '.cursor/rules/theme.mdc',
44
+ content: `---
45
+ description: Theme rules for AI-assisted development
46
+ alwaysApply: true
47
+ ---
48
+
49
+ ${CORE_INSTRUCTIONS}`,
50
+ },
51
+ copilot: {
52
+ label: 'GitHub Copilot',
53
+ file: '.github/copilot-instructions.md',
54
+ content: CORE_INSTRUCTIONS,
55
+ },
56
+ gemini: {
57
+ label: 'Gemini CLI',
58
+ file: 'GEMINI.md',
59
+ content: CORE_INSTRUCTIONS,
60
+ },
61
+ windsurf: {
62
+ label: 'Windsurf',
63
+ file: '.windsurf/rules/theme.md',
64
+ content: CORE_INSTRUCTIONS,
65
+ },
66
+ }
67
+
68
+ // Agents that read AGENTS.md natively and need no generated file.
69
+ const NATIVE = [{ label: 'Codex / OpenCode / Jules', note: 'read AGENTS.md natively' }]
70
+
71
+ function parseArgs(argv) {
72
+ const opts = { all: false, force: false, agents: [] }
73
+ for (const arg of argv) {
74
+ if (arg === '--all' || arg === '-a') opts.all = true
75
+ else if (arg === '--force' || arg === '-f') opts.force = true
76
+ else if (arg.startsWith('--agents=')) {
77
+ opts.agents = arg
78
+ .slice('--agents='.length)
79
+ .split(',')
80
+ .map((a) => a.trim().toLowerCase())
81
+ .filter(Boolean)
82
+ }
83
+ }
84
+ return opts
85
+ }
86
+
87
+ async function selectInteractive() {
88
+ const keys = Object.keys(AGENTS)
89
+ console.log('\nWhich AI coding agents should be configured?\n')
90
+ keys.forEach((key, i) => {
91
+ const configured = existsSync(resolve(root, AGENTS[key].file)) ? ' (already configured)' : ''
92
+ console.log(` ${i + 1}. ${AGENTS[key].label}${configured}`)
93
+ })
94
+ console.log(` ${keys.length + 1}. All of the above\n`)
95
+ for (const n of NATIVE) console.log(` — ${n.label}: ${n.note}, no setup needed`)
96
+
97
+ const rl = createInterface({ input: process.stdin, output: process.stdout })
98
+ const answer = await rl.question('\nEnter numbers separated by commas (or press Enter to cancel): ')
99
+ rl.close()
100
+
101
+ const picks = answer
102
+ .split(',')
103
+ .map((s) => Number.parseInt(s.trim(), 10))
104
+ .filter((n) => Number.isInteger(n) && n >= 1 && n <= keys.length + 1)
105
+ if (picks.includes(keys.length + 1)) return keys
106
+ return picks.map((n) => keys[n - 1])
107
+ }
108
+
109
+ function writeAgentFile(key, force) {
110
+ const agent = AGENTS[key]
111
+ const target = resolve(root, agent.file)
112
+ if (existsSync(target) && !force) {
113
+ console.log(` • ${agent.label}: ${agent.file} already exists — skipped (use --force to overwrite)`)
114
+ return
115
+ }
116
+ mkdirSync(dirname(target), { recursive: true })
117
+ writeFileSync(target, agent.content)
118
+ console.log(` ✓ ${agent.label}: wrote ${agent.file}`)
119
+ }
120
+
121
+ const opts = parseArgs(process.argv.slice(2))
122
+ let selected = []
123
+ if (opts.all) selected = Object.keys(AGENTS)
124
+ else if (opts.agents.length) {
125
+ selected = opts.agents.filter((a) => {
126
+ if (!AGENTS[a]) {
127
+ console.error(` ! Unknown agent "${a}". Supported: ${Object.keys(AGENTS).join(', ')}`)
128
+ return false
129
+ }
130
+ return true
131
+ })
132
+ } else {
133
+ selected = await selectInteractive()
134
+ }
135
+
136
+ if (!selected.length) {
137
+ console.log('Nothing selected — no files written.')
138
+ process.exit(0)
139
+ }
140
+
141
+ console.log('')
142
+ for (const key of selected) writeAgentFile(key, opts.force)
143
+ console.log('\nDone. Agents should now read AGENTS.md and follow the onboarding protocol in .ai/ONBOARDING.md.')
@@ -0,0 +1,44 @@
1
+ # AI Agent Onboarding Guide
2
+
3
+ This guide gets you up to speed with this StrataWP theme efficiently, without redundant setup work.
4
+
5
+ ## 🚀 The Onboarding Workflow
6
+
7
+ ### Step 1: Check Agent State
8
+
9
+ Check `.ai/agent-state.md`.
10
+
11
+ - **If Onboarding Status is "Completed"**: Stop! Do NOT run setup or re-explore. Proceed directly to the user's task.
12
+ - **If Onboarding Status is "Pending"**: Continue below.
13
+
14
+ ### Step 2: Initialize AI Setup (First-Time Only)
15
+
16
+ If your agent-specific configuration file (e.g. `CLAUDE.md`, `.cursor/rules/`, `GEMINI.md`, `.github/copilot-instructions.md`) does not exist:
17
+
18
+ 1. Explain that you are running the setup command.
19
+ 2. Run `pnpm ai:setup` and select your agent (or pass `--agents=<name>`).
20
+
21
+ ### Step 3: Read Developer Directions
22
+
23
+ Read `.ai/developer-directions.md` — the theme developer's standing rules for design, code style, and priorities. You **MUST** adhere to everything in it.
24
+
25
+ ### Step 4: Map the Theme & Initialize Project Rules
26
+
27
+ 1. Read `theme.json` — design tokens, palettes, typography, spacing.
28
+ 2. Read `functions.php` — which StrataWP components are registered.
29
+ 3. Read `vite.config.ts` — entry points and build options.
30
+ 4. Skim `templates/`, `parts/`, `patterns/`, and `src/blocks/` to see what exists.
31
+ 5. Record your findings in the **Discovered Theme Configuration** section of `.ai/PROJECT_RULES.md`.
32
+
33
+ ### Step 5: Update Agent State
34
+
35
+ Update `.ai/agent-state.md`: set Status to Completed, record your agent name and the date, check off the completed steps, and add an Agent Log entry.
36
+
37
+ ---
38
+
39
+ ## 🛠️ Key Resources
40
+
41
+ 1. **Project Rules** (`.ai/PROJECT_RULES.md`) — running log of conventions and decisions. Check it frequently.
42
+ 2. **Skills** (`.ai/skills/`) — recipes for architecture, blocks & patterns, and deployment.
43
+ 3. **Scaffolding** — `stratawp block:new`, `stratawp component:new`, `stratawp template:new`, `stratawp part:new`.
44
+ 4. **Verification** — `pnpm ai:check` before submitting any work.