Extra Chill Copilot Instructions
- Architecture: WordPress multisite with 11 active sites; Blog ID 6 is unused (IDs: 1 main, 2 community, 3 shop, 4 artist/extrachill.link, 5 chat, 7 events, 8 stream, 9 newsletter, 10 docs, 11 wire, 12 horoscope). One theme
extrachill drives all sites via extrachill/inc/core/template-router.php; do not change IDs or AI models. extrachill.link maps to blog 4 via .github/sunrise.php.
- Key components: Network-activated plugins (multisite, users, ai-client, api, search, newsletter, admin-tools, analytics, seo) are always on; site-activated plugins (artist-platform, community, blog, blocks-everywhere, chat, stream, events, horoscopes, contact, shop, news-wire, docs) load per site.
extrachill-users is the single source of truth for auth/user + artist relationships; extrachill-search is the only plugin that enumerates sites dynamically.
- Workflows: From repo root run
composer install && composer test; lint with composer run lint:php (fix via lint:fix). Each component uses the same commands. Release builds use each component’s ./build.sh (symlink to /.github/build.sh) → outputs build/<name>.zip then restores dev deps. extrachill-blocks adds npm run build/npm run start for block assets before ./build.sh.
- Coding patterns: Explicit
require_once trees (no runtime PSR-4), 4-space indents, same-line braces, snake_case functions, PascalCase classes, camelCase locals, kebab-case files. Prefer hooks/filters over template copies (e.g., extrachill_homepage_hero, extrachill_navigation_main_menu, extrachill_template_*, ec_avatar_menu_items).
- Security: Pair capability helpers (e.g.,
ec_can_manage_*) with nonces; sanitize with wp_unslash() + context sanitizers; escape with esc_html/attr/url; prepare SQL; bail loudly—no permissive fallbacks or dual data contracts.
- Multisite discipline: Hardcode blog IDs, wrap
switch_to_blog()/restore_current_blog() in try/finally, and lean on shared helpers (ec_get_artists_for_user, extrachill_multisite_search, extrachill_multisite_subscribe). Cross-domain auth cookies and avatar menu logic live in extrachill-users; extrachill.link canonical URLs must be preserved.
- Theme + assets: Root CSS variables live in
extrachill/assets/css/root.css; any new styles depend on handle extrachill-root. Assets stay unbundled (except block builds), enqueued conditionally with filemtime() versioning. No inline styles/scripts, no !important, no external font/CDN additions.
- Data/contracts: Use canonical data functions (
ec_get_link_page_data, ec_get_artist_profile_data, newsletter integration filters) instead of duplicating logic. Avoid placeholder fallbacks; missing data should error rather than silently guess.
- Integrations: Artist link pages render at extrachill.link with public template
inc/link-pages/live/templates/extrch-link-page-template.php and CORS edit-button flow; join flow hooks into extrachill_below_login_register_form. Newsletter plugin is network-configured (Sendy creds + list IDs from settings, never hardcoded).
- Template routing: Theme’s template router and plugin filters override templates; respect hook-based overrides before adding files. Search results template comes from extrachill-search; artist homepage override via artist-platform hooks.
- Testing/build tasks: VS Code tasks exist for per-component build/test; prefer tasks when available. Community plugin has no build step—format PHP/JS manually.
- Documentation: Component
CLAUDE.md files are authoritative for component-specific details; consult the relevant file before editing. docs/CHANGELOG.md (where present) is the changelog source; do not bump versions unless explicitly instructed.