type: compacted

type: message

role: developer

text:
<skills_instructions>
## Skills
A skill is a set of local instructions to follow that is stored in a `SKILL.md` file. Below is the list of skills that can be used. Each entry includes a name, description, and a short path that can be expanded into an absolute path using the skill roots table.
### Skill roots
- `r0` = `/Users/wesner/.codex/skills/.system`
- `r1` = `/Users/wesner/.codex/plugins/cache/openai-bundled`
- `r2` = `/Users/wesner/.codex/plugins/cache/openai-bundled/sites/0.1.31/skills`
- `r3` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote/figma/2.0.18/skills`
- `r4` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote/github/0.1.9-5f7cd798dc99/skills`
- `r5` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote/google-drive/0.1.11/skills`
- `r6` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote`
- `r7` = `/Users/wesner/.codex/plugins/cache/openai-primary-runtime`
- `r8` = `/Users/wesner/.codex/plugins/cache/openai-primary-runtime/spreadsheets/26.819.11345/skills`
- `r9` = `/Users/wesner/Herd/shop/.agents/skills`
### Available skills
- imagegen: Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG/vector/code-native assets, extending an established icon or logo system, or building the visual directly in HTML/CSS/canvas. (file: r0/imagegen/SKILL.md)
- openai-docs: Use for Codex models/pricing, scheduled tasks, skills, settings, setup, troubleshooting, customization, automations, and self-knowledge—including 'you,' 'your,' 'this app,' or 'this coding agent' when they refer to Codex—and for OpenAI APIs/products and ChatGPT Work. Also use for model choice/migration, prompting, SDKs, Responses, Realtime, agents, evals, and Chat/Work/Codex comparisons. Do not use for generic app/software tasks that merely mention Codex. (file: r0/openai-docs/SKILL.md)
- plugin-creator: Create and scaffold plugin directories for Codex with a required `.codex-plugin/plugin.json`, optional plugin folders/files, valid manifest defaults, and personal-marketplace entries by default. Use when Codex needs to create a new personal plugin, add optional plugin structure, generate or update marketplace entries for plugin ordering and availability metadata, or update an existing local plugin during development with the CLI-driven cachebuster and reinstall flow. (file: r0/plugin-creator/SKILL.md)
- skill-creator: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations. (file: r0/skill-creator/SKILL.md)
- skill-installer: Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos). (file: r0/skill-installer/SKILL.md)
- developing-with-fortify: Laravel Fortify headless authentication backend development. Activate when implementing authentication features including login, registration, password reset, email verification, two-factor authentication (2FA/TOTP), profile updates, headless auth, authentication scaffolding, or auth guards in Laravel applications. (file: r9/developing-with-fortify/SKILL.md)
- fluxui-development: Use this skill for Flux UI development in Livewire applications only. Trigger when working with <flux:*> components, building or customizing Livewire component UIs, creating forms, modals, tables, or other interactive elements. Covers: flux: components (buttons, inputs, modals, forms, tables, date-pickers, kanban, badges, tooltips, etc.), component composition, Tailwind CSS styling, Heroicons/Lucide icon integration, validation patterns, responsive design, and theming. Do not use for non-Livewire frameworks or non-component styling. (file: r9/fluxui-development/SKILL.md)
- infer-conventions: Use this skill to analyze how a Laravel application is actually written and record its conventions as shared rules. Trigger when the user wants to detect, infer, document, or standardize project conventions or coding style, set up or grow `.ai/rules`, resolve mixed or conflicting patterns (e.g. "are we using Form Requests or inline validation?"), or onboard agents and teammates to "how we do things here". Covers: a systematic sweep of ~49 Laravel convention dimensions (validation, models, architecture, testing, frontend, database, console), open-ended house-pattern discovery, conflict reporting, and recording rules scoped to the right paths via the Boost `record-rule` MCP tool. Do not use for one-off code review, enforcing formatting a linter already handles, or editing `.ai/rules` files by hand. (file: r9/infer-conventions/SKILL.md)
- laravel-best-practices: Apply this skill whenever writing, reviewing, or refactoring Laravel PHP code. This includes creating or modifying controllers, models, migrations, form requests, policies, jobs, scheduled commands, service classes, and Eloquent queries. Triggers for N+1 and query performance issues, caching strategies, authorization and security patterns, validation, error handling, queue and job configuration, route definitions, and architectural decisions. Also use for Laravel code reviews and refactoring existing Laravel code to follow best practices. Covers any task involving Laravel backend PHP code patterns. (file: r9/laravel-best-practices/SKILL.md)
- livewire-development: Use for any task or question involving Livewire. Activate if user mentions Livewire, wire: directives, or Livewire-specific concepts like wire:model, wire:click, wire:sort, or islands, invoke this skill. Covers building new components, debugging reactivity issues, real-time form validation, drag-and-drop, loading states, migrating from Livewire 3 to 4, converting component formats (SFC/MFC/class-based), and performance optimization. Do not use for non-Livewire reactive UI (React, Vue, Alpine-only, Inertia.js) or standard Laravel forms without Livewire. (file: r9/livewire-development/SKILL.md)
- pest-testing: Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to write something in Pest, mentions test files or directories (tests/Feature, tests/Unit, tests/Browser), or needs browser testing, smoke testing multiple pages for JS errors, or architecture tests. Covers: test()/it()/expect() syntax, datasets, mocking, browser testing (visit/click/fill), smoke testing, arch(), Livewire component tests, RefreshDatabase, and all Pest 4 features. Do not use for factories, seeders, migrations, controllers, models, or non-test PHP code. (file: r9/pest-testing/SKILL.md)
- tailwindcss-development: Always invoke when the user's message includes 'tailwind' in any form. Also invoke for: building responsive grid layouts (multi-column card grids, product grids), flex/grid page structures (dashboards with sidebars, fixed topbars, mobile-toggle navs), styling UI components (cards, tables, navbars, pricing sections, forms, inputs, badges), adding dark mode variants, fixing spacing or typography, and Tailwind v3/v4 work. The core use case: writing or fixing Tailwind utility classes in HTML templates (Blade, JSX, Vue). Skip for backend PHP logic, database queries, API routes, JavaScript with no HTML/CSS component, CSS file audits, build tool configuration, and vanilla CSS. (file: r9/tailwindcss-development/SKILL.md)
- browser:control-in-app-browser: Control the in-app Browser for opening, navigating, inspecting visible or interactive page state, clicking, typing, screenshots, and local web testing. It can have existing signed-in sessions. For semantic operations on linked resources, prefer a purpose-built connector, API, or CLI when available. (file: r1/browser/26.721.81911/skills/control-in-app-browser/SKILL.md)
- documents:documents: Create, edit, redline, and comment on `.docx`, Word, and Google Docs-targeted document artifacts inside the container, with a strict render-and-verify workflow. Use `render_docx.py` to generate page PNGs (and optional PDF) for visual QA, then iterate until layout is flawless before delivering the final document. (file: r7/documents/26.819.11345/skills/documents/SKILL.md)
- figma:figma-code-connect: Creates and maintains Figma Code Connect template files that map Figma components to code snippets. Use when the user mentions Code Connect, Figma component mapping, design-to-code translation, or asks to create/update .figma.ts or .figma.js files. (file: r3/figma-code-connect/SKILL.md)
- figma:figma-create-new-file: **MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `create_new_file` tool call. NEVER call `create_new_file` directly without loading this skill first. Trigger whenever the user wants a new blank Figma file — a new design, FigJam, or Slides file — or when you need a fresh file before calling `use_figma`. Usage — /figma-create-new-file [editorType] [fileName] (e.g. /figma-create-new-file figjam My Whiteboard, /figma-create-new-file slides Q3 Review) (file: r3/figma-create-new-file/SKILL.md)
- figma:figma-design-to-code: **MANDATORY prerequisite** — you MUST invoke this skill BEFORE calling the `get_design_context` Figma MCP tool. You MUST trigger this skill whenever the user wants to implement, build, port, or code up a Figma design as code. Example prompts (not exhaustive) are 'implement this Figma design', 'build this screen from Figma', 'turn this Figma into code', 'design to code'. This skill provides critical instructions and steps to the agent on how to correctly implement Figma designs in code and must NOT be skipped. (file: r3/figma-design-to-code/SKILL.md)
- figma:figma-generate-design: Use this skill alongside figma-use when the task involves translating an application page, view, or multi-section layout into Figma. Triggers: 'write to Figma', 'create in Figma from code', 'push page to Figma', 'take this app/page and build it in Figma', 'create a screen', 'build a landing page in Figma', 'update the Figma screen to match code', 'convert this modal/dialog/drawer/panel to Figma'. This is the preferred workflow skill whenever the user wants to build or update a full page, modal, dialog, drawer, sidebar, panel, or any composed multi-section view in Figma from code or a description. Discovers design system components, variables, and styles from Code Connect files, existing screens, and library search, then imports them and assembles views incrementally section-by-section using design system tokens instead of hardcoded values. (file: r3/figma-generate-design/SKILL.md)
- figma:figma-generate-diagram: MANDATORY prerequisite — load this skill BEFORE every `generate_diagram` tool call. NEVER call `generate_diagram` directly without loading this skill first. Trigger whenever the user asks to create, generate, draw, render, sketch, or build a diagram — flowchart, architecture diagram, sequence diagram, ERD or entity-relationship diagram, state diagram or state machine, gantt chart, or timeline. Also trigger when the user mentions Mermaid syntax or wants a system architecture, decision tree, dependency graph, API call flow, auth handshake, schema, or pipeline visualized in FigJam. Routes to type-specific guidance, sets universal Mermaid constraints, and tells you when to use a different diagram type or skip the tool entirely (mindmaps, pie charts, class diagrams, etc.). (file: r3/figma-generate-diagram/SKILL.md)
- figma:figma-generate-library: Build or update a professional-grade design system in Figma from a codebase. Use when the user wants to create variables/tokens, build component libraries, create individual components with proper variant sets and variable bindings, set up theming (light/dark modes), document foundations, or reconcile gaps between code and Figma. Also use when the user asks to create or generate any component in Figma — even a single one — since components require proper variable foundations, variant states, and design token bindings to be production-quality. This skill teaches WHAT to build and in WHAT ORDER — it complements the `figma-use` skill which teaches HOW to call the Plugin API. Both skills should be loaded together. (file: r3/figma-generate-library/SKILL.md)
- figma:figma-implement-motion: Translates Figma motion and animations into production-ready application code. Use when implementing animation/motion from a Figma design — user mentions "implement this motion", "add animation from Figma", "animate this component", provides a Figma URL whose node is animated, or when `get_design_context` returns motion data or instructs you to call `get_motion_context`. (file: r3/figma-implement-motion/SKILL.md)
- figma:figma-swiftui: SwiftUI ↔ Figma translation. Use whenever the user mentions Swift, SwiftUI, iOS, iPhone, or iPad — in EITHER direction — translating a Figma design into SwiftUI (design → code), or pushing SwiftUI views / screens / tokens back into a Figma file (code → design). Triggers on phrases like 'implement this Figma design in SwiftUI', 'build this screen in Swift', 'push this SwiftUI view to Figma', 'mirror my Swift code in a Figma file', or whenever a Figma URL appears alongside `.swift` files / an `.xcodeproj`. Routes to a direction-specific reference doc; loads alongside `figma-use` for the code → design path. (file: r3/figma-swiftui/SKILL.md)
- figma:figma-use: **MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context — e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically. (file: r3/figma-use/SKILL.md)
- figma:figma-use-figjam: This skill helps agents use Figma's use_figma MCP tool in the FigJam context. Can be used alongside figma-use which has foundational context for using the use_figma tool. (file: r3/figma-use-figjam/SKILL.md)
- figma:figma-use-motion: Motion / animation context for the `use_figma` MCP tool — animating Figma nodes via manual keyframes, animation styles, easing, and timeline duration. Load alongside figma-use whenever a task involves adding, editing, or inspecting animation on a node. (file: r3/figma-use-motion/SKILL.md)
- figma:figma-use-slides: This skill helps agents use Figma's use_figma MCP tool in the Slides context. Can be used alongside figma-use which has foundational context for using the use_figma tool. (file: r3/figma-use-slides/SKILL.md)
- github:gh-address-comments: Inspect GitHub PR review threads, implement local fixes, and perform authorized review actions. (file: r4/gh-address-comments/SKILL.md)
- github:github: Inspect GitHub repositories, PRs, issues, reviews, and CI; publish authorized changes. (file: r4/github/SKILL.md)
- google-drive:google-docs: Prompt- and template-complete Google Docs creation and editing with explicit-instruction-authoritative structural preservation, including semantic roles, relationships, comparison dimensions, and instructed extensions; full-topology native-copy routing; source-grounded per-tab adaptation for past/example references; style-preserving hyperlink and table edits; canonical smart-chip-first authoring for dates and relevant supported people or Google resources; a file-backed advisory trusted read before existing-document writes; automatic protected-control awareness; direct connector APIs by default; DOCX-first import only when no supplied Google Doc template/reference constrains the output; and checked-in code mode only for exact native dropdown mutation. Use when Codex must create, edit, fill, adapt, redesign, or verify Google Docs without overriding explicit user/template instructions, adding unrequested document scope, or carrying stale reference facts into a new deliverable. (file: r5/google-docs/SKILL.md)
- google-drive:google-drive: Use connected Google Drive as the single entrypoint for Drive, Docs, Sheets, and Slides work. Use when the user wants to find, fetch, organize, share, export, copy, or delete Drive files, or summarize and edit Google Docs, Google Sheets, and Google Slides through one unified Google Drive plugin. (file: r5/google-drive/SKILL.md)
- google-drive:google-drive-comments: Write, reply to, and resolve Google Drive comments on Docs, Sheets, Slides, and Drive files with evidence-backed location context. Use when the user asks to leave comments, review a file with comments, respond to comment threads, or resolve Drive comments. (file: r5/google-drive-comments/SKILL.md)
- google-drive:google-sheets: Analyze and edit connected Google Sheets with range precision. Use when the user wants to create Google Sheets, find a spreadsheet, inspect tabs or ranges, search rows, plan formulas, create or repair charts, clean or restructure tables, write concise summaries, or make explicit cell-range updates. (file: r5/google-sheets/SKILL.md)
- google-drive:google-slides: Route Google Slides authoring requests and derive a design system from a native template or reference deck. Use this skill when the user provides an existing native Google Slides deck as a template, reference, or prior-period source, or asks to edit, update, repair, restyle, or clean up an existing native Google Slides deck. Use the Presentations skill instead for net-new presentation creation when no existing native Google Slides deck must be followed. (file: r5/google-slides/SKILL.md)
- pdf:pdf: Read, create, inspect, render, and verify PDF files where visual layout matters, including fillable AcroForms. Use Poppler rendering plus Python tools such as reportlab, pdfplumber, and pypdf for generation and extraction. (file: r7/pdf/26.819.11345/skills/pdf/SKILL.md)
- plugin-management:plugin-management: Discover and suggest relevant plugins, inspect app permissions and dependencies, and manage plugin connections or removal. Use when the user asks about plugins or when a task would materially benefit from an external app, account, service, or data source that available tools cannot access. (file: r6/plugin-management/0.1.0/skills/plugin-management/SKILL.md)
- presentations:Presentations: Read, create or edit PowerPoint or Google Slides decks. Use for presentation, slide deck, PowerPoint, PPT, PPTX, or Google Slides requests. (file: r7/presentations/26.819.11345/skills/presentations/SKILL.md)
- sites:sites-building: Use Sites to build websites, including landing pages, portfolios, dashboards, portals, trackers, hubs, and internal tools. Always use Sites when the project contains `.openai/hosting.json`. (file: r2/sites-building/SKILL.md)
- sites:sites-hosting: Host websites with Sites. Always use after `sites-building`, and use for website publishing, deployment, hosting management, or projects containing `.openai/hosting.json`. (file: r2/sites-hosting/SKILL.md)
- spreadsheets:Spreadsheets: Create, edit, analyze, and verify standalone spreadsheet files or Google Sheets-ready workbooks, including .xlsx, .xls, .csv, and .tsv. Do not use for live controlling Microsoft Excel app or a live Excel session. (file: r8/spreadsheets/SKILL.md)
- spreadsheets:excel-live-control: Control an open or active Microsoft Excel workbook through the ChatGPT add-in or connected session. Use when the user tags the Microsoft Excel app in Codex or follows up on an established live Excel task. Do not use for standalone spreadsheet files or Google Sheets. (file: r8/excel-live-control/SKILL.md)
- template-creator:template-creator: Create or update a reusable personal Codex artifact-template skill. Use when the user invokes $template-creator or asks in natural language to create a reusable template from a reference document, presentation, spreadsheet, Google Docs, Slides, or Sheets link, ImageGen or Product Design image, email, Slack message, or Site project, or explicitly asks to edit or update a passed artifact-template skill. Do not use for one-off creation from an existing template. (file: r7/template-creator/26.819.11345/skills/template-creator/SKILL.md)
- visualize:visualize: Create visualizations and interactive tools directly in conversation. Use when asked to show how something works, make simulators or labs, maps, plots, charts or graphs, comparisons, scenarios, adjustable inputs, and exploration beyond regular text. (file: r1/visualize/1.0.15/skills/visualize/SKILL.md)
</skills_instructions>

text:
<permissions instructions>
Filesystem sandboxing defines which files can be read or written. `sandbox_mode` is `danger-full-access`: No filesystem sandboxing - all commands are permitted. Network access is enabled.
Approval policy is currently never. Do not provide the `sandbox_permissions` for any reason, commands will be rejected.
</permissions instructions>

text:
<apps_instructions>
## Apps (Connectors)
Apps (Connectors) can be explicitly triggered in user messages in the format `[$app-name](app://{connector_id})`. Apps can also be implicitly triggered as long as the context suggests usage of available apps.
An app is equivalent to a set of MCP tools within the `codex_apps` MCP.
An installed app's MCP tools are either provided to you already, or can be lazy-loaded through the `tool_search` tool. If `tool_search` is available, the apps that are searchable by `tools_search` will be listed by it.
Do not additionally call list_mcp_resources or list_mcp_resource_templates for apps.
</apps_instructions>

text:
<plugins_instructions>
## Plugins
A plugin is a local bundle of skills, MCP servers, and apps.
### How to use plugins
- Skill naming: If a plugin contributes skills, those skill entries are prefixed with `plugin_name:` in the Skills list.
- MCP naming: Plugin-provided MCP tools keep standard MCP identifiers such as `mcp__server__tool`; use tool provenance to tell which plugin they come from.
- Trigger rules: If the user explicitly names a plugin, prefer capabilities associated with that plugin for that turn.
- Relationship to capabilities: Plugins are not invoked directly. Use their underlying skills, MCP tools, and app tools to help solve the task.
- Relevance: Determine what a plugin can help with from explicit user mention or from the plugin-associated skills, MCP tools, and apps exposed elsewhere in this turn.
- Missing/blocked: If the user requests a plugin that does not have relevant callable capabilities for the task, say so briefly and continue with the best fallback.
</plugins_instructions>

role: user

text:
# AGENTS.md instructions for /Users/wesner/Herd/shop

<INSTRUCTIONS>
# Shop

Self-contained e-commerce platform with multi-tenant support, product catalog, cart, checkout, payments (mock PSP), order management, customer accounts, and an admin panel.

## Tech Stack

- PHP 8.4 / Laravel 12
- Livewire v4 / Flux UI Free v2
- Tailwind CSS v4
- SQLite
- Pest v4

## Specs

The complete specification is in `specs/`. Start with `specs/09-IMPLEMENTATION-ROADMAP.md` for the build order, then reference the other files as needed:

- `specs/01-DATABASE-SCHEMA.md` - Database schema
- `specs/02-API-ROUTES.md` - Routes and API endpoints
- `specs/03-ADMIN-UI.md` - Admin panel
- `specs/04-STOREFRONT-UI.md` - Storefront
- `specs/05-BUSINESS-LOGIC.md` - Business logic
- `specs/06-AUTH-AND-SECURITY.md` - Auth and security
- `specs/07-SEEDERS-AND-TEST-DATA.md` - Seeders and test data
- `specs/08-PLAYWRIGHT-E2E-PLAN.md` - E2E browser tests
- `specs/09-IMPLEMENTATION-ROADMAP.md` - Implementation roadmap

===

<laravel-boost-guidelines>
=== foundation rules ===

# Laravel Boost Guidelines

The Laravel Boost guidelines are specifically curated by Laravel maintainers for this application. These guidelines should be followed closely to ensure the best experience when building Laravel applications.

## Foundational Context

This application is a Laravel application running on PHP 8.4. You are an expert with the Laravel ecosystem. Always use the APIs that match the installed major version of each package — do not assume a version.

Before relying on a package's API, confirm its installed version:
- PHP packages: run `composer show --direct` to list direct dependencies with versions, or `composer show <vendor/package>` for a single package.
- JS packages: check `package.json` for the installed versions.

## Skills Activation

This project has domain-specific skills available in `**/skills/**`. You MUST activate the relevant skill whenever you work in that domain—don't wait until you're stuck.

## Conventions

- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, and naming.
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
- Check for existing components to reuse before writing a new one.

## Verification Scripts

- Do not create verification scripts or tinker when tests cover that functionality and prove they work. Unit and feature tests are more important.

## Application Structure & Architecture

- Stick to existing directory structure; don't create new base folders without approval.
- Do not change the application's dependencies without approval.

## Frontend Bundling

- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `npm run build`, `npm run dev`, or `composer run dev`. Ask them.

## Documentation Files

- You must only create documentation files if explicitly requested by the user.

## Replies

- Be concise in your explanations - focus on what's important rather than explaining obvious details.

=== boost rules ===

# Laravel Boost

## Tools

- Laravel Boost is an MCP server with tools designed specifically for this application. Prefer Boost tools over manual alternatives like shell commands or file reads.
- Use `database-query` to run read-only queries against the database instead of writing raw SQL in tinker.
- Use `database-schema` to inspect table structure before writing migrations or models.
- Use `get-absolute-url` to resolve the correct scheme, domain, and port for project URLs. Always use this before sharing a URL with the user.
- Use `browser-logs` to read browser logs, errors, and exceptions. Only recent logs are useful, ignore old entries.

## Searching Documentation (IMPORTANT)

- Use `search-docs` before changes that depend on Laravel ecosystem APIs, behavior, configuration, or version-specific syntax. Skip it for copy-only edits and other changes where package documentation is irrelevant. Reuse sufficient results already in context instead of searching again.
- Pass a `packages` array to scope results when you know which packages are relevant.
- Use multiple broad, topic-based queries: `['rate limiting', 'routing rate limiting', 'routing']`. Expect the most relevant results first.
- Do not add package names to queries because package info is already shared. Use `test resource table`, not `filament 4 test resource table`.

### Search Syntax

1. Use words for auto-stemmed AND logic: `rate limit` matches both "rate" AND "limit".
2. Use `"quoted phrases"` for exact position matching: `"infinite scroll"` requires adjacent words in order.
3. Combine words and phrases for mixed queries: `middleware "rate limit"`.
4. Use multiple queries for OR logic: `queries=["authentication", "middleware"]`.

## Project Rules

- This project contains committed, area-grouped rules in `.ai/rules` when that directory exists (settled decisions, non-obvious traps, standing constraints). Framework and package guidelines that only apply to specific paths (testing, frontend, components) also live there, under `.ai/rules/boost` — this is not just recorded decisions, it is load-bearing guidance you have not seen inline. Before you enter plan mode or create/edit any file, you MUST first: open @.ai/rules/index.md (it maps file globs to rule files), read every rule file whose globs cover the path(s) in scope, and run `grep -rin 'keyword' .ai/rules` to catch what a path match alone misses. Do not write code until you have read and are following every matching rule. If `.ai/rules` does not exist, continue without it.
- Record durable rules with `record-rule` so the next agent or teammate inherits them instead of working them out again. Pass a `glob` (e.g. `app/Http/Controllers/**`), a short `title`, and a few-line `note`. Always use `record-rule`, never your native memory or notes tool — native memory is personal and session-scoped; only `.ai/rules` is shared with the team and persists in the repo.

## Artisan

- Run Artisan commands directly via the command line (e.g., `php artisan route:list`). Use `php artisan list` to discover available commands and `php artisan [command] --help` to check parameters.
- Inspect routes with `php artisan route:list`. Filter with: `--method=GET`, `--name=users`, `--path=api`, `--except-vendor`, `--only-vendor`.
- Read configuration values using dot notation: `php artisan config:show app.name`, `php artisan config:show database.default`. Or read config files directly from the `config/` directory.

## Tinker

- Execute PHP in app context for debugging and testing code. Do not create models without user approval, prefer tests with factories instead. Prefer existing Artisan commands over custom tinker code.
- Always use single quotes to prevent shell expansion: `php artisan tinker --execute 'Your::code();'`
  - Double quotes for PHP strings inside: `php artisan tinker --execute 'User::where("active", true)->count();'`

=== php rules ===

# PHP

- Always use curly braces for control structures, even for single-line bodies.
- Use PHP 8 constructor property promotion: `public function __construct(public GitHub $github) { }`. Do not leave empty zero-parameter `__construct()` methods unless the constructor is private.
- Use explicit return type declarations and type hints for all method parameters: `function isAccessible(User $user, ?string $path = null): bool`
- Use TitleCase for Enum keys: `FavoritePerson`, `BestLake`, `Monthly`.
- Prefer PHPDoc blocks over inline comments. Only add inline comments for exceptionally complex logic.
- Use array shape type definitions in PHPDoc blocks.

=== deployments rules ===

# Deployment

- Laravel can be deployed using [Laravel Cloud](https://cloud.laravel.com/), which is the fastest way to deploy and scale production Laravel applications.

=== tests rules ===

# Test Enforcement

- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test --compact` with a specific filename or filter.

=== laravel-fortify/core rules ===

# Laravel Fortify

- Fortify is a headless authentication backend that provides authentication routes and controllers for Laravel applications.
- IMPORTANT: Always use the `search-docs` tool for detailed Laravel Fortify patterns and documentation.
- IMPORTANT: Activate `developing-with-fortify` skill when working with Fortify authentication features.

=== laravel/core rules ===

# Do Things the Laravel Way

- Use `php artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using `php artisan list` and check their parameters with `php artisan [command] --help`.
- If you're creating a generic PHP class, use `php artisan make:class`.
- Pass `--no-interaction` to all Artisan commands to ensure they work without user input. You should also pass the correct `--options` to ensure correct behavior.

### Model Creation

- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `php artisan make:model --help` to check the available options.

## APIs & Eloquent Resources

- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.

## URL Generation

- When generating links to other pages, prefer named routes and the `route()` function.

## Testing

- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
- When creating tests, make use of `php artisan make:test [options] {name}` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.

## Vite Error

- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.

=== laravel/v12 rules ===

# Laravel 12

- CRITICAL: ALWAYS use `search-docs` tool for version-specific Laravel documentation and updated code examples.
- Since Laravel 11, Laravel has a new streamlined file structure which this project uses.

## Laravel 12 Structure

- In Laravel 12, middleware are no longer registered in `app/Http/Kernel.php`.
- Middleware are configured declaratively in `bootstrap/app.php` using `Application::configure()->withMiddleware()`.
- `bootstrap/app.php` is the file to register middleware, exceptions, and routing files.
- `bootstrap/providers.php` contains application specific service providers.
- The `app/Console/Kernel.php` file no longer exists; use `bootstrap/app.php` or `routes/console.php` for console configuration.
- Console commands in `app/Console/Commands/` are automatically available and do not require manual registration.

## Database

- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.

- Laravel 12 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.

### Models

- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.

=== livewire/core rules ===

# Livewire

- Livewire allow to build dynamic, reactive interfaces in PHP without writing JavaScript.
- You can use Alpine.js for client-side interactions instead of JavaScript frameworks.
- Keep state server-side so the UI reflects it. Validate and authorize in actions as you would in HTTP requests.

=== pint/core rules ===

# Laravel Pint Code Formatter

- If you have modified any PHP files, you must run `vendor/bin/pint --dirty --format agent` before finalizing changes to ensure your code matches the project's expected style.
- Do not run `vendor/bin/pint --test --format agent`, simply run `vendor/bin/pint --format agent` to fix any formatting issues.

=== pest/core rules ===

## Pest

- This project uses Pest for testing. Create tests: `php artisan make:test --pest {name}`.
- The `{name}` argument should not include the test suite directory. Use `php artisan make:test --pest SomeFeatureTest` instead of `php artisan make:test --pest Feature/SomeFeatureTest`.
- Run tests: `php artisan test --compact` or filter: `php artisan test --compact --filter=testName`.
- Do NOT delete tests without approval.

</laravel-boost-guidelines>

</INSTRUCTIONS>

text:
<environment_context>
  <cwd>/Users/wesner/Herd/shop</cwd>
  <shell>zsh</shell>
  <current_date>2026-08-21</current_date>
  <timezone>Europe/Berlin</timezone>
  <filesystem><workspace_roots><root>/Users/wesner/Herd/shop</root></workspace_roots><permission_profile type="disabled"><file_system type="unrestricted" /></permission_profile></filesystem>
</environment_context>

type: compaction


text:
# Shop

Self-contained e-commerce platform with multi-tenant support, product catalog, cart, checkout, payments (mock PSP), order management, customer accounts, and an admin panel.

## Tech Stack

- PHP 8.4 / Laravel 12
- Livewire v4 / Flux UI Free v2
- Tailwind CSS v4
- SQLite
- Pest v4

## Specs

The complete specification is in `specs/`. Start with `specs/09-IMPLEMENTATION-ROADMAP.md` for the build order, then reference the other files as needed:

- `specs/01-DATABASE-SCHEMA.md` - Database schema
- `specs/02-API-ROUTES.md` - Routes and API endpoints
- `specs/03-ADMIN-UI.md` - Admin panel
- `specs/04-STOREFRONT-UI.md` - Storefront
- `specs/05-BUSINESS-LOGIC.md` - Business logic
- `specs/06-AUTH-AND-SECURITY.md` - Auth and security
- `specs/07-SEEDERS-AND-TEST-DATA.md` - Seeders and test data
- `specs/08-PLAYWRIGHT-E2E-PLAN.md` - E2E browser tests
- `specs/09-IMPLEMENTATION-ROADMAP.md` - Implementation roadmap

===

<laravel-boost-guidelines>
=== foundation rules ===

# Laravel Boost Guidelines

The Laravel Boost guidelines are specifically curated by Laravel maintainers for this application. These guidelines should be followed closely to ensure the best experience when building Laravel applications.

## Foundational Context

This application is a Laravel application running on PHP 8.4. You are an expert with the Laravel ecosystem. Always use the APIs that match the installed major version of each package — do not assume a version.

Before relying on a package's API, confirm its installed version:
- PHP packages: run `composer show --direct` to list direct dependencies with versions, or `composer show <vendor/package>` for a single package.
- JS packages: check `package.json` for the installed versions.

## Skills Activation

This project has domain-specific skills available in `**/skills/**`. You MUST activate the relevant skill whenever you work in that domain—don't wait until you're stuck.

## Conventions

- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, and naming.
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
- Check for existing components to reuse before writing a new one.

## Verification Scripts

- Do not create verification scripts or tinker when tests cover that functionality and prove they work. Unit and feature tests are more important.

## Application Structure & Architecture

- Stick to existing directory structure; don't create new base folders without approval.
- Do not change the application's dependencies without approval.

## Frontend Bundling

- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `npm run build`, `npm run dev`, or `composer run dev`. Ask them.

## Documentation Files

- You must only create documentation files if explicitly requested by the user.

## Replies

- Be concise in your explanations - focus on what's important rather than explaining obvious details.

=== boost rules ===

# Laravel Boost

## Tools

- Laravel Boost is an MCP server with tools designed specifically for this application. Prefer Boost tools over manual alternatives like shell commands or file reads.
- Use `database-query` to run read-only queries against the database instead of writing raw SQL in tinker.
- Use `database-schema` to inspect table structure before writing migrations or models.
- Use `get-absolute-url` to resolve the correct scheme, domain, and port for project URLs. Always use this before sharing a URL with the user.
- Use `browser-logs` to read browser logs, errors, and exceptions. Only recent logs are useful, ignore old entries.

## Searching Documentation (IMPORTANT)

- Use `search-docs` before changes that depend on Laravel ecosystem APIs, behavior, configuration, or version-specific syntax. Skip it for copy-only edits and other changes where package documentation is irrelevant. Reuse sufficient results already in context instead of searching again.
- Pass a `packages` array to scope results when you know which packages are relevant.
- Use multiple broad, topic-based queries: `['rate limiting', 'routing rate limiting', 'routing']`. Expect the most relevant results first.
- Do not add package names to queries because package info is already shared. Use `test resource table`, not `filament 4 test resource table`.

### Search Syntax

1. Use words for auto-stemmed AND logic: `rate limit` matches both "rate" AND "limit".
2. Use `"quoted phrases"` for exact position matching: `"infinite scroll"` requires adjacent words in order.
3. Combine words and phrases for mixed queries: `middleware "rate limit"`.
4. Use multiple queries for OR logic: `queries=["authentication", "middleware"]`.

## Project Rules

- This project contains committed, area-grouped rules in `.ai/rules` when that directory exists (settled decisions, non-obvious traps, standing constraints). Framework and package guidelines that only apply to specific paths (testing, frontend, components) also live there, under `.ai/rules/boost` — this is not just recorded decisions, it is load-bearing guidance you have not seen inline. Before you enter plan mode or create/edit any file, you MUST first: open @.ai/rules/index.md (it maps file globs to rule files), read every rule file whose globs cover the path(s) in scope, and run `grep -rin 'keyword' .ai/rules` to catch what a path match alone misses. Do not write code until you have read and are following every matching rule. If `.ai/rules` does not exist, continue without it.
- Record durable rules with `record-rule` so the next agent or teammate inherits them instead of working them out again. Pass a `glob` (e.g. `app/Http/Controllers/**`), a short `title`, and a few-line `note`. Always use `record-rule`, never your native memory or notes tool — native memory is personal and session-scoped; only `.ai/rules` is shared with the team and persists in the repo.

## Artisan

- Run Artisan commands directly via the command line (e.g., `php artisan route:list`). Use `php artisan list` to discover available commands and `php artisan [command] --help` to check parameters.
- Inspect routes with `php artisan route:list`. Filter with: `--method=GET`, `--name=users`, `--path=api`, `--except-vendor`, `--only-vendor`.
- Read configuration values using dot notation: `php artisan config:show app.name`, `php artisan config:show database.default`. Or read config files directly from the `config/` directory.

## Tinker

- Execute PHP in app context for debugging and testing code. Do not create models without user approval, prefer tests with factories instead. Prefer existing Artisan commands over custom tinker code.
- Always use single quotes to prevent shell expansion: `php artisan tinker --execute 'Your::code();'`
  - Double quotes for PHP strings inside: `php artisan tinker --execute 'User::where("active", true)->count();'`

=== php rules ===

# PHP

- Always use curly braces for control structures, even for single-line bodies.
- Use PHP 8 constructor property promotion: `public function __construct(public GitHub $github) { }`. Do not leave empty zero-parameter `__construct()` methods unless the constructor is private.
- Use explicit return type declarations and type hints for all method parameters: `function isAccessible(User $user, ?string $path = null): bool`
- Use TitleCase for Enum keys: `FavoritePerson`, `BestLake`, `Monthly`.
- Prefer PHPDoc blocks over inline comments. Only add inline comments for exceptionally complex logic.
- Use array shape type definitions in PHPDoc blocks.

=== deployments rules ===

# Deployment

- Laravel can be deployed using [Laravel Cloud](https://cloud.laravel.com/), which is the fastest way to deploy and scale production Laravel applications.

=== tests rules ===

# Test Enforcement

- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test --compact` with a specific filename or filter.

=== laravel-fortify/core rules ===

# Laravel Fortify

- Fortify is a headless authentication backend that provides authentication routes and controllers for Laravel applications.
- IMPORTANT: Always use the `search-docs` tool for detailed Laravel Fortify patterns and documentation.
- IMPORTANT: Activate `developing-with-fortify` skill when working with Fortify authentication features.

=== laravel/core rules ===

# Do Things the Laravel Way

- Use `php artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using `php artisan list` and check their parameters with `php artisan [command] --help`.
- If you're creating a generic PHP class, use `php artisan make:class`.
- Pass `--no-interaction` to all Artisan commands to ensure they work without user input. You should also pass the correct `--options` to ensure correct behavior.

### Model Creation

- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `php artisan make:model --help` to check the available options.

## APIs & Eloquent Resources

- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.

## URL Generation

- When generating links to other pages, prefer named routes and the `route()` function.

## Testing

- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
- When creating tests, make use of `php artisan make:test [options] {name}` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.

## Vite Error

- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.

=== laravel/v12 rules ===

# Laravel 12

- CRITICAL: ALWAYS use `search-docs` tool for version-specific Laravel documentation and updated code examples.
- Since Laravel 11, Laravel has a new streamlined file structure which this project uses.

## Laravel 12 Structure

- In Laravel 12, middleware are no longer registered in `app/Http/Kernel.php`.
- Middleware are configured declaratively in `bootstrap/app.php` using `Application::configure()->withMiddleware()`.
- `bootstrap/app.php` is the file to register middleware, exceptions, and routing files.
- `bootstrap/providers.php` contains application specific service providers.
- The `app/Console/Kernel.php` file no longer exists; use `bootstrap/app.php` or `routes/console.php` for console configuration.
- Console commands in `app/Console/Commands/` are automatically available and do not require manual registration.

## Database

- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.

- Laravel 12 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.

### Models

- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.

=== livewire/core rules ===

# Livewire

- Livewire allow to build dynamic, reactive interfaces in PHP without writing JavaScript.
- You can use Alpine.js for client-side interactions instead of JavaScript frameworks.
- Keep state server-side so the UI reflects it. Validate and authorize in actions as you would in HTTP requests.

=== pint/core rules ===

# Laravel Pint Code Formatter

- If you have modified any PHP files, you must run `vendor/bin/pint --dirty --format agent` before finalizing changes to ensure your code matches the project's expected style.
- Do not run `vendor/bin/pint --test --format agent`, simply run `vendor/bin/pint --format agent` to fix any formatting issues.

=== pest/core rules ===

## Pest

- This project uses Pest for testing. Create tests: `php artisan make:test --pest {name}`.
- The `{name}` argument should not include the test suite directory. Use `php artisan make:test --pest SomeFeatureTest` instead of `php artisan make:test --pest Feature/SomeFeatureTest`.
- Run tests: `php artisan test --compact` or filter: `php artisan test --compact --filter=testName`.
- Do NOT delete tests without approval.

</laravel-boost-guidelines>

status: available

shell: zsh

timezone: Europe/Berlin

body:
## Skills
A skill is a set of local instructions to follow that is stored in a `SKILL.md` file. Below is the list of skills that can be used. Each entry includes a name, description, and a short path that can be expanded into an absolute path using the skill roots table.
### Skill roots
- `r0` = `/Users/wesner/.codex/skills/.system`
- `r1` = `/Users/wesner/.codex/plugins/cache/openai-bundled`
- `r2` = `/Users/wesner/.codex/plugins/cache/openai-bundled/sites/0.1.31/skills`
- `r3` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote/figma/2.0.18/skills`
- `r4` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote/github/0.1.9-5f7cd798dc99/skills`
- `r5` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote/google-drive/0.1.11/skills`
- `r6` = `/Users/wesner/.codex/plugins/cache/openai-curated-remote`
- `r7` = `/Users/wesner/.codex/plugins/cache/openai-primary-runtime`
- `r8` = `/Users/wesner/.codex/plugins/cache/openai-primary-runtime/spreadsheets/26.819.11345/skills`
- `r9` = `/Users/wesner/Herd/shop/.agents/skills`
### Available skills
- imagegen: Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG/vector/code-native assets, extending an established icon or logo system, or building the visual directly in HTML/CSS/canvas. (file: r0/imagegen/SKILL.md)
- openai-docs: Use for Codex models/pricing, scheduled tasks, skills, settings, setup, troubleshooting, customization, automations, and self-knowledge—including 'you,' 'your,' 'this app,' or 'this coding agent' when they refer to Codex—and for OpenAI APIs/products and ChatGPT Work. Also use for model choice/migration, prompting, SDKs, Responses, Realtime, agents, evals, and Chat/Work/Codex comparisons. Do not use for generic app/software tasks that merely mention Codex. (file: r0/openai-docs/SKILL.md)
- plugin-creator: Create and scaffold plugin directories for Codex with a required `.codex-plugin/plugin.json`, optional plugin folders/files, valid manifest defaults, and personal-marketplace entries by default. Use when Codex needs to create a new personal plugin, add optional plugin structure, generate or update marketplace entries for plugin ordering and availability metadata, or update an existing local plugin during development with the CLI-driven cachebuster and reinstall flow. (file: r0/plugin-creator/SKILL.md)
- skill-creator: Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Codex's capabilities with specialized knowledge, workflows, or tool integrations. (file: r0/skill-creator/SKILL.md)
- skill-installer: Install Codex skills into $CODEX_HOME/skills from a curated list or a GitHub repo path. Use when a user asks to list installable skills, install a curated skill, or install a skill from another repo (including private repos). (file: r0/skill-installer/SKILL.md)
- developing-with-fortify: Laravel Fortify headless authentication backend development. Activate when implementing authentication features including login, registration, password reset, email verification, two-factor authentication (2FA/TOTP), profile updates, headless auth, authentication scaffolding, or auth guards in Laravel applications. (file: r9/developing-with-fortify/SKILL.md)
- fluxui-development: Use this skill for Flux UI development in Livewire applications only. Trigger when working with <flux:*> components, building or customizing Livewire component UIs, creating forms, modals, tables, or other interactive elements. Covers: flux: components (buttons, inputs, modals, forms, tables, date-pickers, kanban, badges, tooltips, etc.), component composition, Tailwind CSS styling, Heroicons/Lucide icon integration, validation patterns, responsive design, and theming. Do not use for non-Livewire frameworks or non-component styling. (file: r9/fluxui-development/SKILL.md)
- infer-conventions: Use this skill to analyze how a Laravel application is actually written and record its conventions as shared rules. Trigger when the user wants to detect, infer, document, or standardize project conventions or coding style, set up or grow `.ai/rules`, resolve mixed or conflicting patterns (e.g. "are we using Form Requests or inline validation?"), or onboard agents and teammates to "how we do things here". Covers: a systematic sweep of ~49 Laravel convention dimensions (validation, models, architecture, testing, frontend, database, console), open-ended house-pattern discovery, conflict reporting, and recording rules scoped to the right paths via the Boost `record-rule` MCP tool. Do not use for one-off code review, enforcing formatting a linter already handles, or editing `.ai/rules` files by hand. (file: r9/infer-conventions/SKILL.md)
- laravel-best-practices: Apply this skill whenever writing, reviewing, or refactoring Laravel PHP code. This includes creating or modifying controllers, models, migrations, form requests, policies, jobs, scheduled commands, service classes, and Eloquent queries. Triggers for N+1 and query performance issues, caching strategies, authorization and security patterns, validation, error handling, queue and job configuration, route definitions, and architectural decisions. Also use for Laravel code reviews and refactoring existing Laravel code to follow best practices. Covers any task involving Laravel backend PHP code patterns. (file: r9/laravel-best-practices/SKILL.md)
- livewire-development: Use for any task or question involving Livewire. Activate if user mentions Livewire, wire: directives, or Livewire-specific concepts like wire:model, wire:click, wire:sort, or islands, invoke this skill. Covers building new components, debugging reactivity issues, real-time form validation, drag-and-drop, loading states, migrating from Livewire 3 to 4, converting component formats (SFC/MFC/class-based), and performance optimization. Do not use for non-Livewire reactive UI (React, Vue, Alpine-only, Inertia.js) or standard Laravel forms without Livewire. (file: r9/livewire-development/SKILL.md)
- pest-testing: Use this skill for Pest PHP testing in Laravel projects only. Trigger whenever any test is being written, edited, fixed, or refactored — including fixing tests that broke after a code change, adding assertions, converting PHPUnit to Pest, adding datasets, and TDD workflows. Always activate when the user asks how to write something in Pest, mentions test files or directories (tests/Feature, tests/Unit, tests/Browser), or needs browser testing, smoke testing multiple pages for JS errors, or architecture tests. Covers: test()/it()/expect() syntax, datasets, mocking, browser testing (visit/click/fill), smoke testing, arch(), Livewire component tests, RefreshDatabase, and all Pest 4 features. Do not use for factories, seeders, migrations, controllers, models, or non-test PHP code. (file: r9/pest-testing/SKILL.md)
- tailwindcss-development: Always invoke when the user's message includes 'tailwind' in any form. Also invoke for: building responsive grid layouts (multi-column card grids, product grids), flex/grid page structures (dashboards with sidebars, fixed topbars, mobile-toggle navs), styling UI components (cards, tables, navbars, pricing sections, forms, inputs, badges), adding dark mode variants, fixing spacing or typography, and Tailwind v3/v4 work. The core use case: writing or fixing Tailwind utility classes in HTML templates (Blade, JSX, Vue). Skip for backend PHP logic, database queries, API routes, JavaScript with no HTML/CSS component, CSS file audits, build tool configuration, and vanilla CSS. (file: r9/tailwindcss-development/SKILL.md)
- browser:control-in-app-browser: Control the in-app Browser for opening, navigating, inspecting visible or interactive page state, clicking, typing, screenshots, and local web testing. It can have existing signed-in sessions. For semantic operations on linked resources, prefer a purpose-built connector, API, or CLI when available. (file: r1/browser/26.721.81911/skills/control-in-app-browser/SKILL.md)
- documents:documents: Create, edit, redline, and comment on `.docx`, Word, and Google Docs-targeted document artifacts inside the container, with a strict render-and-verify workflow. Use `render_docx.py` to generate page PNGs (and optional PDF) for visual QA, then iterate until layout is flawless before delivering the final document. (file: r7/documents/26.819.11345/skills/documents/SKILL.md)
- figma:figma-code-connect: Creates and maintains Figma Code Connect template files that map Figma components to code snippets. Use when the user mentions Code Connect, Figma component mapping, design-to-code translation, or asks to create/update .figma.ts or .figma.js files. (file: r3/figma-code-connect/SKILL.md)
- figma:figma-create-new-file: **MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `create_new_file` tool call. NEVER call `create_new_file` directly without loading this skill first. Trigger whenever the user wants a new blank Figma file — a new design, FigJam, or Slides file — or when you need a fresh file before calling `use_figma`. Usage — /figma-create-new-file [editorType] [fileName] (e.g. /figma-create-new-file figjam My Whiteboard, /figma-create-new-file slides Q3 Review) (file: r3/figma-create-new-file/SKILL.md)
- figma:figma-design-to-code: **MANDATORY prerequisite** — you MUST invoke this skill BEFORE calling the `get_design_context` Figma MCP tool. You MUST trigger this skill whenever the user wants to implement, build, port, or code up a Figma design as code. Example prompts (not exhaustive) are 'implement this Figma design', 'build this screen from Figma', 'turn this Figma into code', 'design to code'. This skill provides critical instructions and steps to the agent on how to correctly implement Figma designs in code and must NOT be skipped. (file: r3/figma-design-to-code/SKILL.md)
- figma:figma-generate-design: Use this skill alongside figma-use when the task involves translating an application page, view, or multi-section layout into Figma. Triggers: 'write to Figma', 'create in Figma from code', 'push page to Figma', 'take this app/page and build it in Figma', 'create a screen', 'build a landing page in Figma', 'update the Figma screen to match code', 'convert this modal/dialog/drawer/panel to Figma'. This is the preferred workflow skill whenever the user wants to build or update a full page, modal, dialog, drawer, sidebar, panel, or any composed multi-section view in Figma from code or a description. Discovers design system components, variables, and styles from Code Connect files, existing screens, and library search, then imports them and assembles views incrementally section-by-section using design system tokens instead of hardcoded values. (file: r3/figma-generate-design/SKILL.md)
- figma:figma-generate-diagram: MANDATORY prerequisite — load this skill BEFORE every `generate_diagram` tool call. NEVER call `generate_diagram` directly without loading this skill first. Trigger whenever the user asks to create, generate, draw, render, sketch, or build a diagram — flowchart, architecture diagram, sequence diagram, ERD or entity-relationship diagram, state diagram or state machine, gantt chart, or timeline. Also trigger when the user mentions Mermaid syntax or wants a system architecture, decision tree, dependency graph, API call flow, auth handshake, schema, or pipeline visualized in FigJam. Routes to type-specific guidance, sets universal Mermaid constraints, and tells you when to use a different diagram type or skip the tool entirely (mindmaps, pie charts, class diagrams, etc.). (file: r3/figma-generate-diagram/SKILL.md)
- figma:figma-generate-library: Build or update a professional-grade design system in Figma from a codebase. Use when the user wants to create variables/tokens, build component libraries, create individual components with proper variant sets and variable bindings, set up theming (light/dark modes), document foundations, or reconcile gaps between code and Figma. Also use when the user asks to create or generate any component in Figma — even a single one — since components require proper variable foundations, variant states, and design token bindings to be production-quality. This skill teaches WHAT to build and in WHAT ORDER — it complements the `figma-use` skill which teaches HOW to call the Plugin API. Both skills should be loaded together. (file: r3/figma-generate-library/SKILL.md)
- figma:figma-implement-motion: Translates Figma motion and animations into production-ready application code. Use when implementing animation/motion from a Figma design — user mentions "implement this motion", "add animation from Figma", "animate this component", provides a Figma URL whose node is animated, or when `get_design_context` returns motion data or instructs you to call `get_motion_context`. (file: r3/figma-implement-motion/SKILL.md)
- figma:figma-swiftui: SwiftUI ↔ Figma translation. Use whenever the user mentions Swift, SwiftUI, iOS, iPhone, or iPad — in EITHER direction — translating a Figma design into SwiftUI (design → code), or pushing SwiftUI views / screens / tokens back into a Figma file (code → design). Triggers on phrases like 'implement this Figma design in SwiftUI', 'build this screen in Swift', 'push this SwiftUI view to Figma', 'mirror my Swift code in a Figma file', or whenever a Figma URL appears alongside `.swift` files / an `.xcodeproj`. Routes to a direction-specific reference doc; loads alongside `figma-use` for the code → design path. (file: r3/figma-swiftui/SKILL.md)
- figma:figma-use: **MANDATORY prerequisite** — you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context — e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically. (file: r3/figma-use/SKILL.md)
- figma:figma-use-figjam: This skill helps agents use Figma's use_figma MCP tool in the FigJam context. Can be used alongside figma-use which has foundational context for using the use_figma tool. (file: r3/figma-use-figjam/SKILL.md)
- figma:figma-use-motion: Motion / animation context for the `use_figma` MCP tool — animating Figma nodes via manual keyframes, animation styles, easing, and timeline duration. Load alongside figma-use whenever a task involves adding, editing, or inspecting animation on a node. (file: r3/figma-use-motion/SKILL.md)
- figma:figma-use-slides: This skill helps agents use Figma's use_figma MCP tool in the Slides context. Can be used alongside figma-use which has foundational context for using the use_figma tool. (file: r3/figma-use-slides/SKILL.md)
- github:gh-address-comments: Inspect GitHub PR review threads, implement local fixes, and perform authorized review actions. (file: r4/gh-address-comments/SKILL.md)
- github:github: Inspect GitHub repositories, PRs, issues, reviews, and CI; publish authorized changes. (file: r4/github/SKILL.md)
- google-drive:google-docs: Prompt- and template-complete Google Docs creation and editing with explicit-instruction-authoritative structural preservation, including semantic roles, relationships, comparison dimensions, and instructed extensions; full-topology native-copy routing; source-grounded per-tab adaptation for past/example references; style-preserving hyperlink and table edits; canonical smart-chip-first authoring for dates and relevant supported people or Google resources; a file-backed advisory trusted read before existing-document writes; automatic protected-control awareness; direct connector APIs by default; DOCX-first import only when no supplied Google Doc template/reference constrains the output; and checked-in code mode only for exact native dropdown mutation. Use when Codex must create, edit, fill, adapt, redesign, or verify Google Docs without overriding explicit user/template instructions, adding unrequested document scope, or carrying stale reference facts into a new deliverable. (file: r5/google-docs/SKILL.md)
- google-drive:google-drive: Use connected Google Drive as the single entrypoint for Drive, Docs, Sheets, and Slides work. Use when the user wants to find, fetch, organize, share, export, copy, or delete Drive files, or summarize and edit Google Docs, Google Sheets, and Google Slides through one unified Google Drive plugin. (file: r5/google-drive/SKILL.md)
- google-drive:google-drive-comments: Write, reply to, and resolve Google Drive comments on Docs, Sheets, Slides, and Drive files with evidence-backed location context. Use when the user asks to leave comments, review a file with comments, respond to comment threads, or resolve Drive comments. (file: r5/google-drive-comments/SKILL.md)
- google-drive:google-sheets: Analyze and edit connected Google Sheets with range precision. Use when the user wants to create Google Sheets, find a spreadsheet, inspect tabs or ranges, search rows, plan formulas, create or repair charts, clean or restructure tables, write concise summaries, or make explicit cell-range updates. (file: r5/google-sheets/SKILL.md)
- google-drive:google-slides: Route Google Slides authoring requests and derive a design system from a native template or reference deck. Use this skill when the user provides an existing native Google Slides deck as a template, reference, or prior-period source, or asks to edit, update, repair, restyle, or clean up an existing native Google Slides deck. Use the Presentations skill instead for net-new presentation creation when no existing native Google Slides deck must be followed. (file: r5/google-slides/SKILL.md)
- pdf:pdf: Read, create, inspect, render, and verify PDF files where visual layout matters, including fillable AcroForms. Use Poppler rendering plus Python tools such as reportlab, pdfplumber, and pypdf for generation and extraction. (file: r7/pdf/26.819.11345/skills/pdf/SKILL.md)
- plugin-management:plugin-management: Discover and suggest relevant plugins, inspect app permissions and dependencies, and manage plugin connections or removal. Use when the user asks about plugins or when a task would materially benefit from an external app, account, service, or data source that available tools cannot access. (file: r6/plugin-management/0.1.0/skills/plugin-management/SKILL.md)
- presentations:Presentations: Read, create or edit PowerPoint or Google Slides decks. Use for presentation, slide deck, PowerPoint, PPT, PPTX, or Google Slides requests. (file: r7/presentations/26.819.11345/skills/presentations/SKILL.md)
- sites:sites-building: Use Sites to build websites, including landing pages, portfolios, dashboards, portals, trackers, hubs, and internal tools. Always use Sites when the project contains `.openai/hosting.json`. (file: r2/sites-building/SKILL.md)
- sites:sites-hosting: Host websites with Sites. Always use after `sites-building`, and use for website publishing, deployment, hosting management, or projects containing `.openai/hosting.json`. (file: r2/sites-hosting/SKILL.md)
- spreadsheets:Spreadsheets: Create, edit, analyze, and verify standalone spreadsheet files or Google Sheets-ready workbooks, including .xlsx, .xls, .csv, and .tsv. Do not use for live controlling Microsoft Excel app or a live Excel session. (file: r8/spreadsheets/SKILL.md)
- spreadsheets:excel-live-control: Control an open or active Microsoft Excel workbook through the ChatGPT add-in or connected session. Use when the user tags the Microsoft Excel app in Codex or follows up on an established live Excel task. Do not use for standalone spreadsheet files or Google Sheets. (file: r8/excel-live-control/SKILL.md)
- template-creator:template-creator: Create or update a reusable personal Codex artifact-template skill. Use when the user invokes $template-creator or asks in natural language to create a reusable template from a reference document, presentation, spreadsheet, Google Docs, Slides, or Sheets link, ImageGen or Product Design image, email, Slack message, or Site project, or explicitly asks to edit or update a passed artifact-template skill. Do not use for one-off creation from an existing template. (file: r7/template-creator/26.819.11345/skills/template-creator/SKILL.md)
- visualize:visualize: Create visualizations and interactive tools directly in conversation. Use when asked to show how something works, make simulators or labs, maps, plots, charts or graphs, comparisons, scenarios, adjustable inputs, and exploration beyond regular text. (file: r1/visualize/1.0.15/skills/visualize/SKILL.md)

instructions: 32ca25d6d85edaeb6f1e19b2a5cc4e08d2a631cd

approved_command_prefixes: /bin/zsh -lc "set -a; source .env; set +a; npx --yes vercel@latest --prod --yes --token \"$VERCEL_API_KEY\""

approved_command_prefixes: PATH=/private/tmp/agendo-node-24.15.0.18vAuJ/node-v24.15.0-darwin-arm64/bin:$PATH node --input-type=module --eval 'import { spawnWithControllerTimeout } from "./benchmarks/controller-timeout.mjs"; const out=[]; for(let i=0;i<3;i++){const r=await spawnWithControllerTimeout("/usr/bin/true",[],{cwd:process.cwd(),env:{PATH:"/usr/bin:/bin",HOME:"/private/tmp"},deadlineAtMs:Date.now()+30000});out.push({code:r.code,signal:r.signal,processGroupClosedBeforeLeaderExit:r.processGroupClosedBeforeLeaderExit,processSweep:r.processSweep,authWorkDrained:r.authWorkDrained});} console.log(JSON.stringify(out,null,2));'

approved_command_prefixes: RDAP_BOOTSTRAP_FILE=iana-rdap-dns.json SLEEP_SECONDS=0.25 ./check_wordplay_domains.sh wordplay-1000-candidates.txt wordplay-rdap-results.csv wordplay-free-domains.md

approved_command_prefixes: export SITES_GIT_TOKEN='art_v1_a91d30973832104ec0b09ee31951cdd32099f6ac'; git -c http.extraHeader="Authorization: Bearer ${SITES_GIT_TOKEN}" push 'https://git.chatgpt-team.site/826899a4-b2f3-4fea-81c8-d716cbf0ff4e/appgprj_6a72f8fa0a5c8191b7b852eb0505b7a6.git' HEAD:main

approved_command_prefixes: mv .env /private/tmp/qwen-city-driver.env && /Users/wesner/.codex/plugins/cache/openai-bundled/sites/0.1.31/scripts/init-site.sh "$PWD" && mv /private/tmp/qwen-city-driver.env .env && chmod 600 .env

approved_command_prefixes: npm run build && set -a; source .env; set +a; CLOUDFLARE_API_TOKEN="$CLOUDFLARE_API_KEY" npx --yes wrangler@latest pages deploy dist --project-name knockbots --branch main

approved_command_prefixes: set -a; source ../.env; set +a; npx --yes vercel@latest --prod --yes --token "$VERCEL_API_KEY"

approved_command_prefixes: set -a; source .env; set +a; PI_CODING_AGENT_DIR="$PWD/.pi" npx --yes @mariozechner/pi-coding-agent --provider qwencloud --model qwen3.8-max-preview --print 'Reply exactly: PI_QWENCLOUD_OK'

approved_command_prefixes: set -a; source .env; set +a; curl --silent --show-error --fail --request GET https://api.cloudflare.com/client/v4/user/tokens/verify --header "Authorization: Bearer $CLOUDFLARE_API_KEY" --header 'Content-Type: application/json' | sed -E 's/"id":"[^"]+"/"id":"<redacted>"/g'

approved_command_prefixes: set -a; source .env; set +a; curl --silent --show-error --request GET https://api.cloudflare.com/client/v4/accounts/c227bfa7c02c5c554b5b159474277563/pages/projects --header "Authorization: Bearer $CLOUDFLARE_API_KEY" --header 'Content-Type: application/json'

approved_command_prefixes: set -a; source .env; set +a; curl --silent --show-error --request GET https://api.cloudflare.com/client/v4/user/tokens/verify --header "Authorization: Bearer $CLOUDFLARE_API_KEY" --header 'Content-Type: application/json'

approved_command_prefixes: set -a; source .env; set +a; export ANTHROPIC_BASE_URL='https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic'; export ANTHROPIC_AUTH_TOKEN="$QWEN_API_KEY"; export ANTHROPIC_MODEL='qwen3.8-max-preview'; export ANTHROPIC_DEFAULT_HAIKU_MODEL='qwen3.6-flash'; export ANTHROPIC_DEFAULT_SONNET_MODEL='qwen3.8-max-preview'; export ANTHROPIC_DEFAULT_OPUS_MODEL='qwen3.8-max-preview'; export CLAUDE_CODE_SUBAGENT_MODEL='qwen3.7-max'; export CLAUDE_CODE_EFFORT_LEVEL=max; claude --bare --no-session-persistence --permission-mode auto --effort max --print 'ultracode: Work on the current QwenFight Three.js combat vertical slice. Apply the user brief: make the fight game visually beautiful and technically robust, use parallel subagents where useful, and employ a harsh visual critic. Work within the existing browser prototype; do not claim or fabricate Tekken 8 / AAA parity. Make one high-impact improvement that is feasible in this iteration, verify it with npm run build and npm run test:visual, update PROGRESS.md with the honest outcome, and commit your changes. Do not deploy.'

approved_command_prefixes: set -a; source .env; set +a; export ANTHROPIC_BASE_URL='https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic'; export ANTHROPIC_AUTH_TOKEN="$QWEN_API_KEY"; export ANTHROPIC_MODEL='qwen3.8-max-preview'; export ANTHROPIC_DEFAULT_HAIKU_MODEL='qwen3.6-flash'; export ANTHROPIC_DEFAULT_SONNET_MODEL='qwen3.8-max-preview'; export ANTHROPIC_DEFAULT_OPUS_MODEL='qwen3.8-max-preview'; export CLAUDE_CODE_SUBAGENT_MODEL='qwen3.7-max'; export CLAUDE_CODE_EFFORT_LEVEL=max; claude --bare --no-session-persistence --permission-mode plan --effort max --print 'Reply exactly: CLAUDE_CODE_QWEN_OK'

approved_command_prefixes: set -a; source .env; set +a; export OPENAI_API_KEY="$QWEN_API_KEY"; export OPENAI_BASE_URL='https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1'; npx --yes @mariozechner/pi-coding-agent --provider openai --model qwen3.8-max-preview --print 'Reply exactly: PI_OK'

approved_command_prefixes: set -a; source .env; set +a; npx --yes vercel@latest --prod --yes --token "$VERCEL_API_KEY"

approved_command_prefixes: brew install --cask upscayl

approved_command_prefixes: composer install

approved_command_prefixes: docker compose

approved_command_prefixes: find experiments/shooter -mindepth 1 -maxdepth 1 -type d -exec chmod 755 {} +

approved_command_prefixes: find experiments/tetris -mindepth 1 -maxdepth 1 -type d -exec chmod 755 {} +

approved_command_prefixes: test: close mixed partial price validation

approved_command_prefixes: git add

approved_command_prefixes: git commit

approved_command_prefixes: git push

approved_command_prefixes: head -c 5000

approved_command_prefixes: head -n 1

approved_command_prefixes: herd isolate

approved_command_prefixes: npm --prefix dashboard test

approved_command_prefixes: npm install

approved_command_prefixes: npm install -g playwright

approved_command_prefixes: npm run benchmark

approved_command_prefixes: npm run build

approved_command_prefixes: npm run dev

approved_command_prefixes: npm test

approved_command_prefixes: npm view

approved_command_prefixes: npx playwright install chromium

approved_command_prefixes: open -a

approved_command_prefixes: playwright install

approved_command_prefixes: playwright uninstall

approved_command_prefixes: pnpm install

approved_command_prefixes: ps -Ao

approved_command_prefixes: 23/28 scored|5/16 scored|Kimi K3 · R2 99|Laguna S 2.1 · 0|0 / 100 · MODEL FAILURE · ELIMINATED

approved_command_prefixes:
rg
next build|npm run verify|npm run build

approved_command_prefixes: rm -rf -- ./.git

approved_command_prefixes: rm -rf .git

approved_command_prefixes: rm -rf .next

approved_command_prefixes: set -a

approved_command_prefixes: source .env

personality: pragmatic


approval_policy: never

approvals_reviewer: user

type: danger-full-access

type: disabled

mode: default

reasoning_effort: xhigh

effort: xhigh

summary: auto


type: AgentMessage

type: Text

text: I’m continuing the hardening pass from the focused-test checkpoint. I’ll first close the remaining cart/API edge cases, then run the full verification stack and a fresh browser/audit review before committing the implementation.

phase: commentary


role: assistant


exec

status: completed

input:
const r = await tools.exec_command({cmd:"git status --short && sed -n '1,260p' app/Http/Controllers/Api/StorefrontCartController.php && sed -n '1,220p' tests/Feature/PlatformApiAndMediaTest.php",workdir:"/Users/wesner/Herd/shop",yield_time_ms:10000,max_output_tokens:20000});
text(r.output);


type: CommandExecution

command: git status --short && sed -n '1,260p' app/Http/Controllers/Api/StorefrontCartController.php && sed -n '1,220p' tests/Feature/PlatformApiAndMediaTest.php

type: unknown

status: completed

stdout:
 M app/Http/Controllers/Api/AdminController.php
 M app/Http/Controllers/Api/PlatformController.php
 M app/Http/Controllers/Api/StorefrontAnalyticsController.php
 M app/Http/Controllers/Api/StorefrontCheckoutController.php
 M app/Http/Controllers/Api/StorefrontOrderController.php
 M app/Http/Controllers/Api/StorefrontSearchController.php
 M app/Http/Middleware/EnsureApiAbility.php
 M app/Http/Middleware/ResolveStore.php
 M app/Http/Requests/CreateFulfillmentRequest.php
 M app/Http/Requests/CreateRefundRequest.php
 M app/Http/Requests/StoreInvitationRequest.php
 M app/Http/Requests/StoreShippingRateRequest.php
 M app/Http/Requests/StoreShippingZoneRequest.php
 M app/Http/Requests/StoreThemeRequest.php
 M app/Http/Requests/UpdateTaxSettingsRequest.php
 M app/Http/Requests/UpdateThemeSettingsRequest.php
 M app/Jobs/AggregateAnalytics.php
 M app/Jobs/CancelUnpaidBankTransferOrders.php
 M app/Jobs/DeliverWebhook.php
 M app/Jobs/ExpireAbandonedCheckouts.php
 M app/Jobs/ProcessMediaUpload.php
 M app/Livewire/Admin/Developers/Index.php
 M app/Livewire/Storefront/CartDrawer.php
 M app/Livewire/Storefront/Collections/Show.php
 M app/Livewire/Storefront/Products/Show.php
 M app/Livewire/Storefront/Search/Modal.php
 M app/Models/Payment.php
 M app/Models/ThemeFile.php
 M app/Models/User.php
 M app/Observers/ProductObserver.php
 M app/Providers/AppServiceProvider.php
 M app/Services/CheckoutService.php
 M app/Services/FulfillmentService.php
 M app/Services/MockPaymentProvider.php
 M app/Services/OrderService.php
 M app/Services/PaymentService.php
 M app/Services/PricingEngine.php
 M app/Services/SearchService.php
 M app/Services/ShippingCalculator.php
 M app/Services/TaxCalculator.php
 M app/ValueObjects/PaymentResult.php
 M boost.json
 M bootstrap/app.php
 M config/cors.php
 M config/fortify.php
 M config/session.php
 M database/factories/PaymentFactory.php
 M database/factories/UserFactory.php
 M database/seeders/AnalyticsSeeder.php
 M database/seeders/NavigationSeeder.php
 M database/seeders/PageSeeder.php
 M database/seeders/SearchSettingsSeeder.php
 M database/seeders/UserSeeder.php
 M resources/views/layouts/admin.blade.php
 M resources/views/layouts/storefront.blade.php
 M resources/views/livewire/storefront/cart-drawer.blade.php
 M resources/views/livewire/storefront/collections/show.blade.php
 M resources/views/livewire/storefront/home.blade.php
 M resources/views/livewire/storefront/products/show.blade.php
 M routes/api.php
 M tests/Feature/ApiTokenTest.php
 M tests/Feature/CommerceFlowTest.php
 M tests/Feature/ContractBehaviorTest.php
 M tests/Feature/PlatformApiAndMediaTest.php
 M tests/Feature/SearchAnalyticsWebhookTest.php
?? .playwright-mcp/
?? app/Events/CheckoutAddressed.php
?? app/Events/CheckoutCompleted.php
?? app/Events/CheckoutExpired.php
?? app/Events/CheckoutShippingSelected.php
?? app/Events/FulfillmentCreated.php
?? app/Events/ProductCreated.php
?? app/Events/ProductDeleted.php
?? app/Events/ProductUpdated.php
?? app/Exceptions/PaymentDeclinedException.php
?? app/Http/Requests/CreateOrderExportRequest.php
?? app/Http/Requests/StoreAnalyticsEventsRequest.php
?? app/Jobs/GenerateOrderExport.php
?? app/Listeners/
?? app/Models/OrderExport.php
?? database/factories/OrderExportFactory.php
?? database/migrations/2026_08_21_002127_create_order_exports_table.php
?? database/migrations/2026_08_21_003147_add_platform_admin_and_payment_raw_json_columns.php
?? tests/Feature/OrderExportsAndDomainEventsTest.php
<?php

namespace App\Http\Controllers\Api;

use App\Exceptions\CartVersionConflictException;
use App\Exceptions\InsufficientInventoryException;
use App\Http\Controllers\Controller;
use App\Models\Cart;
use App\Services\CartService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;

class StorefrontCartController extends Controller
{
    public function __construct(private readonly CartService $carts) {}

    public function store(Request $request): JsonResponse
    {
        $data = $request->validate(['currency' => ['nullable', 'string', 'size:3']]);
        $cart = $this->carts->create(app('current_store'), $request->user('customer'));

        if (isset($data['currency'])) {
            $cart->update(['currency' => strtoupper($data['currency'])]);
        }

        $request->session()->put(['cart_id' => $cart->getKey(), 'cart_id_'.app('current_store')->getKey() => $cart->getKey()]);

        return response()->json($this->payload($cart->refresh()), 201);
    }

    public function show(int $cartId): JsonResponse
    {
        return response()->json($this->payload($this->cart($cartId)));
    }

    public function addLine(Request $request, int $cartId): JsonResponse
    {
        $data = $request->validate(['variant_id' => ['required', 'integer'], 'quantity' => ['required', 'integer', 'min:1', 'max:9999'], 'cart_version' => ['nullable', 'integer'], 'expected_version' => ['nullable', 'integer']]);
        $cart = $this->cart($cartId);

        try {
            $this->carts->assertVersion($cart, $data['cart_version'] ?? $data['expected_version'] ?? null);
            $this->carts->addLine($cart, $data['variant_id'], $data['quantity']);
        } catch (CartVersionConflictException $exception) {
            return response()->json(['message' => $exception->getMessage(), 'cart' => $this->payload($cart->refresh())], 409);
        } catch (InsufficientInventoryException $exception) {
            return response()->json(['message' => $exception->getMessage(), 'code' => 'insufficient_inventory'], 422);
        }

        return response()->json($this->payload($this->cart($cartId)), 201);
    }

    public function updateLine(Request $request, int $cartId, int $lineId): JsonResponse
    {
        $data = $request->validate(['quantity' => ['required', 'integer', 'min:1', 'max:9999'], 'cart_version' => ['required', 'integer']]);
        $cart = $this->cart($cartId);

        try {
            $this->carts->assertVersion($cart, $data['cart_version']);
            $this->carts->updateLineQuantity($cart, $lineId, $data['quantity']);
        } catch (CartVersionConflictException $exception) {
            return response()->json(['message' => $exception->getMessage(), 'cart' => $this->payload($cart->refresh())], 409);
        } catch (InsufficientInventoryException $exception) {
            return response()->json(['message' => $exception->getMessage(), 'code' => 'insufficient_inventory'], 422);
        }

        return response()->json($this->payload($this->cart($cartId)));
    }

    public function removeLine(Request $request, int $cartId, int $lineId): JsonResponse
    {
        $data = $request->validate(['cart_version' => ['required', 'integer']]);
        $cart = $this->cart($cartId);

        try {
            $this->carts->assertVersion($cart, $data['cart_version']);
            $this->carts->removeLine($cart, $lineId);
        } catch (CartVersionConflictException $exception) {
            return response()->json(['message' => $exception->getMessage(), 'cart' => $this->payload($cart->refresh())], 409);
        }

        return response()->json($this->payload($this->cart($cartId)));
    }

    private function cart(int $cartId): Cart
    {
        $cart = Cart::query()
            ->where('store_id', app('current_store')->getKey())
            ->with(['lines.variant.product.media', 'lines.variant.inventory'])
            ->findOrFail($cartId);
        $customerId = request()->user('customer')?->getKey();

        if ($customerId !== null) {
            abort_unless((int) $cart->customer_id === (int) $customerId, 404);
        }

        return $cart;
    }

    /** @return array<string, mixed> */
    private function payload(Cart $cart): array
    {
        $lines = $cart->lines->map(fn ($line): array => ['id' => $line->id, 'variant_id' => $line->variant_id, 'product_title' => $line->variant->product->title, 'variant_title' => $line->variant->title, 'sku' => $line->variant->sku, 'quantity' => $line->quantity, 'unit_price_amount' => $line->unit_price_amount, 'line_subtotal_amount' => $line->line_subtotal_amount, 'line_discount_amount' => $line->line_discount_amount, 'line_total_amount' => $line->line_total_amount, 'image_url' => $line->variant->product->media->first()?->url, 'requires_shipping' => $line->variant->requires_shipping, 'available_quantity' => $line->variant->inventory?->availableQuantity() ?? 0])->values()->all();
        $subtotal = (int) collect($lines)->sum('line_total_amount');

        return ['id' => $cart->id, 'store_id' => $cart->store_id, 'customer_id' => $cart->customer_id, 'currency' => $cart->currency, 'cart_version' => $cart->cart_version, 'status' => $cart->status, 'lines' => $lines, 'totals' => ['subtotal' => $subtotal, 'discount' => 0, 'total' => $subtotal, 'currency' => $cart->currency, 'line_count' => count($lines), 'item_count' => (int) collect($lines)->sum('quantity')], 'created_at' => $cart->created_at, 'updated_at' => $cart->updated_at];
    }
}
<?php

use App\Jobs\ProcessMediaUpload;
use App\Livewire\Admin\Developers\Index as DeveloperSettings;
use App\Models\Organization;
use App\Models\Product;
use App\Models\ProductMedia;
use App\Models\Store;
use App\Models\StoreInvitation;
use App\Models\User;
use App\Models\WebhookSubscription;
use Database\Seeders\ShopSeeder;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Storage;
use Livewire\Livewire;

uses(LazilyRefreshDatabase::class);

beforeEach(function (): void {
    config(['cache.default' => 'array']);
    $this->seed(ShopSeeder::class);
    $this->store = Store::query()->where('handle', 'acme-fashion')->firstOrFail();
    $this->admin = User::query()->where('email', 'admin@acme.test')->firstOrFail();
    app()->instance('current_store', $this->store);
});

test('platform API creates organizations, stores, invitations, and membership responses', function (): void {
    $token = $this->admin->createToken('platform-manager', ['manage-platform'])->plainTextToken;

    $organization = $this->withToken($token)->postJson('http://shop.test/api/admin/v1/platform/organizations', [
        'name' => 'Northwind',
        'billing_email' => 'billing@northwind.test',
    ])->assertCreated()->json('data');

    $createdStore = $this->withToken($token)->postJson('http://shop.test/api/admin/v1/platform/stores', [
        'organization_id' => $organization['id'],
        'name' => 'Northwind Shop',
        'handle' => 'northwind-shop',
        'default_currency' => 'EUR',
        'default_locale' => 'en',
        'timezone' => 'Europe/Berlin',
    ])->assertCreated()->json('data');

    $this->withToken($token)->postJson("http://shop.test/api/admin/v1/stores/{$this->store->getKey()}/invites", [
        'email' => 'new-staff@example.test',
        'role' => 'staff',
    ])->assertCreated()->assertJsonPath('data.role', 'staff');

    $this->withToken($this->admin->createToken('membership-reader', ['read-products'])->plainTextToken)
        ->getJson("http://shop.test/api/admin/v1/stores/{$this->store->getKey()}/me")
        ->assertOk()
        ->assertJsonPath('data.store_id', $this->store->getKey())
        ->assertJsonPath('data.role', 'owner');

    expect(Organization::query()->whereKey($organization['id'])->exists())->toBeTrue()
        ->and(Store::query()->whereKey($createdStore['id'])->value('handle'))->toBe('northwind-shop')
        ->and(StoreInvitation::query()->where('email', 'new-staff@example.test')->exists())->toBeTrue();
});

test('product API persists nested options variants inventory and collections', function (): void {
    $token = $this->admin->createToken('catalog-writer', ['write-products'])->plainTextToken;
    $collection = \App\Models\Collection::withoutGlobalScopes()->create(['store_id' => $this->store->getKey(), 'title' => 'Nested Collection', 'handle' => 'nested-collection', 'type' => 'manual', 'status' => 'active']);

    $response = $this->withToken($token)->postJson("http://shop.test/api/admin/v1/stores/{$this->store->getKey()}/products", [
        'title' => 'Nested Catalog Product',
        'status' => 'draft',
        'options' => [['name' => 'Color', 'position' => 1]],
        'variants' => [[
            'sku' => 'NESTED-BLUE',
            'price_amount' => 2500,
            'currency' => 'EUR',
            'requires_shipping' => true,
            'is_default' => true,
            'option_values' => [['option_name' => 'Color', 'value' => 'Blue']],
            'inventory' => ['quantity_on_hand' => 50, 'policy' => 'deny'],
        ]],
        'collections' => [$collection->getKey()],
    ])->assertCreated();

    $product = Product::withoutGlobalScopes()->where('title', 'Nested Catalog Product')->with(['options.values', 'variants.inventory', 'variants.optionValues', 'collections'])->firstOrFail();

    expect($response->json('data.options.0.name'))->toBe('Color')
        ->and($product->variants->first()->inventory->quantity_on_hand)->toBe(50)
        ->and($product->variants->first()->optionValues->first()->value)->toBe('Blue')
        ->and($product->collections->contains($collection))->toBeTrue();

    $presigned = $this->withToken($token)->postJson("http://shop.test/api/admin/v1/stores/{$this->store->getKey()}/products/{$product->getKey()}/media/presign-upload", [
        'filename' => 'product-image.jpg',
        'content_type' => 'image/jpeg',
        'byte_size' => 1200,
    ])->assertCreated()->json();

    expect($presigned['method'])->toBe('PUT')->and($presigned['media_id'])->toBeInt();
});

test('media processing records metadata, dimensions, derivatives, and failure state', function (): void {
    Storage::fake('public');
    $product = Product::query()->firstOrFail();
    $key = 'stores/'.$this->store->getKey().'/products/'.$product->getKey().'/media/source.jpg';
    $image = imagecreatetruecolor(640, 400);
    ob_start();
    imagejpeg($image, null, 90);
    $contents = ob_get_clean();
    imagedestroy($image);
    Storage::disk('public')->put($key, $contents);

    $media = ProductMedia::create(['product_id' => $product->getKey(), 'type' => 'image', 'path' => $key, 'storage_key' => $key, 'mime_type' => 'image/jpeg', 'status' => 'processing']);
    (new ProcessMediaUpload($media))->handle();

    expect($media->refresh()->status)->toBe('ready')
        ->and($media->width)->toBe(640)
        ->and($media->height)->toBe(400)
        ->and($media->metadata['variants'])->toHaveKeys(['original', 'thumbnail', 'small', 'medium', 'large'])
        ->and($media->checksum)->toBe(hash('sha256', $contents));

    $failed = ProductMedia::create(['product_id' => $product->getKey(), 'type' => 'image', 'path' => 'missing.jpg', 'status' => 'processing']);
    $exception = new RuntimeException('missing upload');
    (new ProcessMediaUpload($failed))->failed($exception);

    expect($failed->refresh()->status)->toBe('failed')
        ->and($failed->metadata['error'])->toBe('missing upload');
});

test('developer webhook creation writes the normalized event type', function (): void {
    $this->actingAs($this->admin);

    Livewire::test(DeveloperSettings::class)
        ->set('event', 'order.created')
        ->set('targetUrl', 'https://hooks.example.test/orders')
        ->call('createWebhook')
        ->assertHasNoErrors();

    expect(WebhookSubscription::query()->where('target_url', 'https://hooks.example.test/orders')->value('event_type'))->toBe('order.created');
});

test('deferred OAuth endpoints return not implemented responses', function (): void {
    $this->postJson('http://shop.test/oauth/token')->assertStatus(501);
});