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
186 changes: 186 additions & 0 deletions .vibe/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
active_model = "mistral-medium-3.5"
vim_keybindings = false
disable_welcome_banner_animation = false
displayed_workdir = ""
auto_compact_threshold = 200000
context_warnings = false
textual_theme = "catppuccin-mocha"
instructions = ""
system_prompt_id = "vibe"
include_commit_signature = true
include_model_info = true
include_project_context = true
include_prompt_detail = true
enable_update_checks = true
api_timeout = 720.0
tool_paths = []
mcp_servers = []
enabled_tools = []
disabled_tools = []

[[providers]]
name = "mistral"
api_base = "https://api.mistral.ai/v1"
api_key_env_var = "MISTRAL_API_KEY"
api_style = "openai"
backend = "mistral"

[[providers]]
name = "llamacpp"
api_base = "http://127.0.0.1:8080/v1"
api_key_env_var = ""
api_style = "openai"
backend = "generic"

[[models]]
name = "mistral-vibe-cli-latest"
provider = "mistral"
alias = "mistral-medium-3.5"
temperature = 1.0
input_price = 1.5
output_price = 7.5
thinking = "high"

[[models]]
name = "devstral-small-latest"
provider = "mistral"
alias = "devstral-small"
temperature = 0.2
input_price = 0.1
output_price = 0.3

[[models]]
name = "devstral"
provider = "llamacpp"
alias = "local"
temperature = 0.2
input_price = 0.0
output_price = 0.0

[project_context]
max_chars = 40000
default_commit_count = 5
max_doc_bytes = 32768
truncation_buffer = 1000
max_depth = 3
max_files = 1000
max_dirs_per_level = 20
timeout_seconds = 2.0

[session_logging]
save_dir = "/Users/jasperfrumau/.vibe/logs/session"
session_prefix = "session"
enabled = true

[tools.search_replace]
permission = "ask"
allowlist = []
denylist = []
max_content_size = 100000
create_backup = false
fuzzy_threshold = 0.9

[tools.bash]
permission = "ask"
allowlist = [
"cat",
"echo",
"file",
"find",
"git diff",
"git log",
"git status",
"head",
"ls",
"pwd",
"stat",
"tail",
"tree",
"uname",
"wc",
"which",
"whoami",
]
denylist = [
"gdb",
"pdb",
"passwd",
"nano",
"vim",
"vi",
"emacs",
"bash -i",
"sh -i",
"zsh -i",
"fish -i",
"dash -i",
"screen",
"tmux",
]
max_output_bytes = 16000
default_timeout = 30
denylist_standalone = [
"ipython",
"bash",
"sh",
"nohup",
"vi",
"vim",
"emacs",
"nano",
"su",
]

[tools.grep]
permission = "always"
allowlist = []
denylist = []
max_output_bytes = 64000
default_max_matches = 100
default_timeout = 60
exclude_patterns = [
".venv/",
"venv/",
".env/",
"env/",
"node_modules/",
".git/",
"__pycache__/",
".pytest_cache/",
".mypy_cache/",
".tox/",
".nox/",
".coverage/",
"htmlcov/",
"dist/",
"build/",
".idea/",
".vscode/",
"*.egg-info",
"*.pyc",
"*.pyo",
"*.pyd",
".DS_Store",
"Thumbs.db",
]
codeignore_file = ".vibeignore"

[tools.read_file]
permission = "always"
allowlist = []
denylist = []
max_read_bytes = 64000
max_state_history = 10

[tools.todo]
permission = "always"
allowlist = []
denylist = []
max_todos = 100

[tools.write_file]
permission = "ask"
allowlist = []
denylist = []
max_write_bytes = 64000
create_parent_dirs = true
86 changes: 86 additions & 0 deletions .vibe/prompts/vibe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Custom Instructions for Vibe

## Primary Directive
Always follow the rules and conventions in the project's `CLAUDE.md` file. This is your authoritative source for all project-specific guidance about Waygate.

## Project Overview
Waygate is a standalone WordPress plugin (`imagewize/waygate`) that provides AI-powered pattern page builder capabilities for the Elayne block theme. It integrates with the WordPress Abilities API (WP 7.0+) and WordPress AI Client to generate pages from natural-language descriptions.

- **Namespace:** `Imagewize\Waygate`
- **Requires:** PHP 8.3+, WordPress 7.0+
- **All classes** live in `includes/` with classmap autoloading

## Before Responding
1. **Review CLAUDE.md** for:
- Project architecture and file structure
- Class responsibilities (Pattern_Lab, Abilities_API, AI_Integration, Admin)
- Initialization order
- Code style and naming conventions
- Git commit guidelines

2. **Check Current Context**:
- Verify you're working in the plugin directory
- Confirm the current branch and git status
- Review recent commits for relevant changes

3. **Adhere to Key Principles**:
- Never mention AI tools (Claude, Mistral, Vibe) in commit messages
- Use conventional commit prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`
- Make atomic commits: each commit is one logical change that builds/passes on its own
- All PHP code must pass `vendor/bin/phpcs --standard=WordPress`

## Commands
**Install dependencies:**
```bash
composer install
```

**PHP syntax check:**
```bash
find . -name "*.php" -not -path "*/vendor/*" -exec php -l {} \;
```

**Run PHP CodeSniffer:**
```bash
vendor/bin/phpcs
```

**Run PHPUnit:**
```bash
vendor/bin/phpunit --configuration phpunit.xml
```

## Architecture
- **Pattern_Lab** (`includes/class-pattern-lab.php`) — Data layer for pattern querying and page composition
- **Abilities_API** (`includes/class-abilities-api.php`) — Registers `elayne/list-patterns` and `elayne/create-page` abilities
- **AI_Integration** (`includes/class-ai-integration.php`) — Orchestrates AI page generation with Mistral provider
- **Admin** (`includes/class-admin.php`) — WordPress admin UI at **Tools → Waygate**

**Initialization Order:**
```
plugins_loaded → Pattern_Lab::init()
→ AI_Integration::init()
→ Abilities_API::init()
→ Admin::init()
```

`Pattern_Lab` must init first since other classes depend on its pattern data.

## Response Guidelines
- Be concise and technical
- Reference specific files and line numbers
- Use markdown formatting for code and structure
- Prioritize verification over assumptions
- When unsure, ask for clarification before acting

## Version Bump Checklist
When releasing a new version, update the version string in **three places**:
1. `waygate.php` line 8 — `* Version:` plugin header
2. `waygate.php` line 19 — `define( 'WAYGATE_VERSION', ... )` constant
3. `CHANGELOG.md` — add a new `## [x.y.z] - YYYY-MM-DD` section at the top

## NO Mistral Vibe Attribution in Any Commits
- Do NOT include "Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>" attribution
- Keep all commits professional and attribution-free
- This applies to ALL files and directories in the entire repository
- Follow standard git commit message format
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ All notable changes to Waygate will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.0] - 2026-05-24

### Added
- Six built-in prompt templates (Homepage, About, Services, Contact, Landing Page, Portfolio) in `AI_Integration::get_prompt_templates()`; filterable via the `waygate_prompt_templates` hook so third-party themes/plugins can add or remove templates
- **Quick Template** dropdown in the admin AI generation form — selecting a template pre-fills the description textarea; a confirmation dialog fires when the textarea already has content
- `[placeholder]` substitution note added to the description field hint
- PHPUnit tests for `get_prompt_templates()` and the `waygate_prompt_templates` filter
- `phpcs.xml` PHP CodeSniffer configuration committed so `vendor/bin/phpcs` works without arguments

### Changed
- Renamed plugin classes to WordPress underscore convention: `Pattern_Lab`, `Abilities_API`, `AI_Integration` (previously `PatternLab`, `AbilitiesApi`, `AiIntegration`) to comply with WordPress coding standards and allow WordPress.org submission
- Removed `WordPress.Files.FileName.InvalidClassFileName` PHPCS exclusion from `phpcs.xml` — the renamed classes now pass the sniff cleanly
- All PHP files now pass WPCS coding standards (resolved via `phpcs.xml` ruleset)

## [0.5.0] - 2026-05-24

### Added
Expand Down
16 changes: 8 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ find . -name "*.php" -not -path "*/vendor/*" -exec php -l {} \;

**Run PHP CodeSniffer:**
```bash
vendor/bin/phpcs --standard=WordPress includes/ waygate.php
vendor/bin/phpcs
```

**Run PHPUnit:**
Expand All @@ -38,28 +38,28 @@ All classes live in `includes/` with PSR-4 autoloading (`Imagewize\Waygate` →

### Class Responsibilities

**`PatternLab`** (`includes/class-pattern-lab.php`) — The data layer. Queries WordPress's registered block patterns to extract those belonging to the active Elayne theme, returning structured metadata (slug, title, description, categories, keywords). Also handles composing `wp:pattern` blocks into a page and calling `wp_insert_post`.
**`Pattern_Lab`** (`includes/class-pattern-lab.php`) — The data layer. Queries WordPress's registered block patterns to extract those belonging to the active Elayne theme, returning structured metadata (slug, title, description, categories, keywords). Also handles composing `wp:pattern` blocks into a page and calling `wp_insert_post`.

**`AbilitiesApi`** (`includes/class-abilities-api.php`) — Registers two WordPress Abilities (WP 7.0+ feature):
**`Abilities_API`** (`includes/class-abilities-api.php`) — Registers two WordPress Abilities (WP 7.0+ feature):
- `elayne/list-patterns` — lists available patterns, optionally filtered by category; requires `edit_posts`
- `elayne/create-page` — creates a draft page from an ordered pattern slug list; requires `publish_pages`

Each ability has a JSON input/output schema for capability validation.

**`AiIntegration`** (`includes/class-ai-integration.php`) — Orchestrates AI page generation. Registers a Mistral provider with the WP AI Client registry, then in `generate_page()` builds a prompt from all available patterns, sends it to the AI (with fallback chain: Mistral → Claude → OpenAI → Gemini), parses the JSON response, and delegates to `PatternLab::create_page()`. Enforces layout constraints: 3–7 patterns, hero first, CTA last, no consecutive grid patterns.
**`AI_Integration`** (`includes/class-ai-integration.php`) — Orchestrates AI page generation. Registers a Mistral provider with the WP AI Client registry, then in `generate_page()` builds a prompt from all available patterns, sends it to the AI (with fallback chain: Mistral → Claude → OpenAI → Gemini), parses the JSON response, and delegates to `Pattern_Lab::create_page()`. Enforces layout constraints: 3–7 patterns, hero first, CTA last, no consecutive grid patterns.

**`Admin`** (`includes/class-admin.php`) — WordPress admin UI at **Tools → Waygate**. Renders status indicators (WP AI Client, Abilities API, Mistral provider, Elayne patterns), the AI generation form, and a searchable pattern catalog. Handles POST form submission with nonce verification and displays success/error notices.

### Initialization Order

```
plugins_loaded → PatternLab::init()
AiIntegration::init()
AbilitiesApi::init()
plugins_loaded → Pattern_Lab::init()
AI_Integration::init()
Abilities_API::init()
→ Admin::init()
```

`PatternLab` must init first since the other classes depend on its pattern data.
`Pattern_Lab` must init first since the other classes depend on its pattern data.

### External Dependencies (optional)

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Waygate lets you assemble WordPress pages from block patterns — manually or via a natural-language AI prompt powered by the WordPress AI Client (WordPress 7.0+). Works with any block theme; [Elayne](https://github.com/imagewize/elayne) is the primary supported theme.

> **Beta** — v0.5.0. Use on staging/development sites; not yet recommended for production.
> **Beta** — v0.6.0. Use on staging/development sites; not yet recommended for production.

---

Expand All @@ -14,6 +14,7 @@ Waygate lets you assemble WordPress pages from block patterns — manually or vi
- **AI page generation** — Describe the page you want; the AI picks patterns and creates a draft
- **AI reasoning** — The AI's one-sentence explanation of its pattern choices is shown after generation and persisted as post meta on the created page
- **Developer debug info** — When `WP_ENV=development`, the page editor sidebar and the generation notice also show the ordered pattern slugs and generation timestamp
- **Prompt templates** — Six built-in page templates (Homepage, About, Services, Contact, Landing Page, Portfolio) pre-fill the AI prompt; extend via the `waygate_prompt_templates` filter
- **Feature detection** — AI form is hidden automatically when no provider supports text generation
- **Abilities API** — Exposes `elayne/list-patterns` and `elayne/create-page` abilities for WP 7.0+
- **Multi-provider** — Works with Mistral, Claude, OpenAI, or Gemini via WP AI Client
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"../../plugins/{$name}/": ["type:wordpress-plugin"]
},
"archive": {
"exclude": ["docs/", "tests/", ".github/", "*.md", "!README.md"]
"exclude": ["docs/", "tests/", ".github/", ".vibe/", "*.md", "!README.md"]
}
},
"config": {
Expand Down
Loading
Loading