Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Demo Store — Claude Code Instructions

## Project overview

Headless React + WooCommerce cosmetic storefront ("Salve"). The theme lives in
`themes/demo-store-headless/` and uses Vite to build a React SPA that is served
by a PHP shell (`index.php` + `functions.php`).

## Build & deploy

The React app **must be built locally** before deploying to a workspace:

```bash
cd themes/demo-store-headless
npm install
npm run build # outputs to dist/
```

The built `dist/` directory is committed to the repo and deployed via git push.
WordPress loads `dist/assets/index-*.js` and `dist/assets/style-*.css` from the
theme directory at runtime (see `functions.php` → `demo_store_get_assets()`).

**If you skip the build step, changes to source files under `src/` will not be
visible on the workspace.**

## Theme structure

- `src/` — React source (JSX, CSS modules)
- `src/pages/` — route-level components (Home, Shop, ProductDetail, Cart, Checkout, OrderConfirmation)
- `src/components/` — shared components (Header, Footer, ProductList, ProductCard, PriceSlider)
- `src/api/` — WooCommerce Store API clients (storeApi, products, cart, checkout)
- `src/styles/` — CSS files including design tokens (`tokens.css`)
- `src/data/` — demo product fixtures for offline/demo mode
- `dist/` — Vite production build output (committed)
- `inc/` — PHP server-side rendering helpers (SSR router, SEO data, schema)
- `mu-plugins/` — WP-CLI seed scripts for demo data
Comment on lines +26 to +36

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The section is titled "Theme structure", but it includes mu-plugins/ which is typically located at the repository root (or under wp-content/mu-plugins/) rather than inside the theme directory (themes/demo-store-headless/). Renaming this to "Project structure" and nesting the theme-specific directories under themes/demo-store-headless/ clarifies the actual layout of the repository.

Suggested change
## Theme structure
- `src/` — React source (JSX, CSS modules)
- `src/pages/` — route-level components (Home, Shop, ProductDetail, Cart, Checkout, OrderConfirmation)
- `src/components/` — shared components (Header, Footer, ProductList, ProductCard, PriceSlider)
- `src/api/` — WooCommerce Store API clients (storeApi, products, cart, checkout)
- `src/styles/` — CSS files including design tokens (`tokens.css`)
- `src/data/` — demo product fixtures for offline/demo mode
- `dist/` — Vite production build output (committed)
- `inc/` — PHP server-side rendering helpers (SSR router, SEO data, schema)
- `mu-plugins/` — WP-CLI seed scripts for demo data
## Project structure
- `themes/demo-store-headless/` — Headless theme directory
- `src/` — React source (JSX, CSS modules)
- `src/pages/` — route-level components (Home, Shop, ProductDetail, Cart, Checkout, OrderConfirmation)
- `src/components/` — shared components (Header, Footer, ProductList, ProductCard, PriceSlider)
- `src/api/` — WooCommerce Store API clients (storeApi, products, cart, checkout)
- `src/styles/` — CSS files including design tokens (`tokens.css`)
- `src/data/` — demo product fixtures for offline/demo mode
- `dist/` — Vite production build output (committed)
- `inc/` — PHP server-side rendering helpers (SSR router, SEO data, schema)
- `mu-plugins/` — WP-CLI seed scripts for demo data (located at the repository root)


## SYNC convention

Files marked with `SYNC:` comments at the top are shared with a sibling repo
(`UrumiAI/base-headless`). When modifying these files, port changes both ways
using the identifier mapping in the comment header.

## WooCommerce Store API

The React app uses the WooCommerce Store API (`/wp-json/wc/store/v1/`) for all
data fetching. Key endpoints: `products`, `cart`, `checkout`. The API supports
query params like `per_page`, `min_price`, `max_price`, `search`, `category`.

## Workspace deployment

**Preferred workflow: local git + SSH**

1. Edit code locally in the git clone.
2. Build locally (`npm run build` in the theme directory).
3. Test via SSH into the workspace — WordPress runs there.
- SSH format: `ssh {tenant-slug}-workspace-{index}@ssh.myscalablesite.com`
- Example: `ssh demo-kkzi5m-workspace-2@ssh.myscalablesite.com`
- WordPress root is at `/var/www/html/` (the SSH home directory).
- Run wp-cli: `wp option get siteurl`, `wp plugin list`, `wp cache flush`, etc.
4. Commit source + dist, push to GitHub to deploy.

**MCP tools (slow fallback)** — use only when SSH is unavailable:

- Workspace URL: check via `wp option get siteurl` (MCP wp_read)
- MCP branches use format: `urumi/ai/{workspace_index}/{slug}`
- Use `git_create_branch` MCP action to create deploy branches
- Use `write_files` MCP action to push source changes (dist must be built separately)