docs: add .paul/codebase/ codebase map (7 documents)
Stack, architecture, conventions, testing, integrations, db_schema, concerns. Generated by PAUL /map-codebase workflow from codebase analysis. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
94
.paul/codebase/conventions.md
Normal file
94
.paul/codebase/conventions.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# Conventions — krolewskie-miody.pl
|
||||
|
||||
## PHP Conventions (CLAUDE.md)
|
||||
|
||||
- **Standard:** PSR-12 formatting
|
||||
- **Classes:** PascalCase — e.g. `MfnDynamicData`, `class-mfn-builder.php`
|
||||
- **Methods/Functions:** snake_case — e.g. `mfn_woocommerce_product_reviews_tab_title()`
|
||||
- **Database variables:** snake_case
|
||||
- **Theme function prefix:** `mfn_` for all BeTheme functions
|
||||
- **Max nesting depth:** 3 levels — extract deeper logic to named methods
|
||||
- **Comments:** Only when explaining *why*, never *what*
|
||||
- **Customizations:** Child theme or dedicated plugin only — never in WordPress core or parent theme directly
|
||||
|
||||
## File Naming
|
||||
|
||||
- Plugin/theme files: kebab-case — `class-mfn-builder.php`
|
||||
- Class files: prefixed with `class-` — `class-mfn-dynamic-data.php`
|
||||
|
||||
## WordPress Hook Usage
|
||||
|
||||
Hooks registered in `wp-content/themes/betheme/functions/`:
|
||||
|
||||
**Core hooks used:**
|
||||
- `after_setup_theme` — theme init
|
||||
- `init` — WP initialization
|
||||
- `wp_enqueue_scripts` — script/style loading
|
||||
- `pre_get_posts` — query modification
|
||||
- `admin_menu` — admin customization
|
||||
|
||||
**Custom theme hooks (mfn_):**
|
||||
- `mfn_before_content` / `mfn_after_content`
|
||||
- `mfn_before_shop_content` / `mfn_after_shop_content`
|
||||
- `mfn_hook_bottom`
|
||||
|
||||
## WooCommerce Hook Pattern
|
||||
|
||||
See `wp-content/themes/betheme/functions/theme-woocommerce.php`.
|
||||
|
||||
**Remove defaults, then add custom:**
|
||||
```php
|
||||
// Remove WooCommerce defaults
|
||||
remove_action('woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
|
||||
remove_action('woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
|
||||
|
||||
// Add theme equivalents
|
||||
add_action('woocommerce_before_quantity_input_field', 'mfn_woocommerce_before_quantity_input_field');
|
||||
add_action('woocommerce_after_add_to_cart_button', 'mfn_append_wishlist_button');
|
||||
add_filter('loop_shop_columns', 'mfn_woo_loop_shop_columns', 20);
|
||||
add_filter('woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment');
|
||||
```
|
||||
|
||||
## CSS / JS Conventions
|
||||
|
||||
- **No build tooling** — no SASS, Webpack, or Gulp
|
||||
- CSS and JS are pre-compiled and committed directly
|
||||
- Main files: `betheme/css/be.css`, `betheme/js/scripts.js`
|
||||
- Both minified and unminified versions maintained
|
||||
- Custom CSS should go in child theme `style.css` (once child theme is created)
|
||||
|
||||
## Configuration Constants (wp-config.php)
|
||||
|
||||
Currently defined:
|
||||
```php
|
||||
define('RSSSL_KEY', '...'); // Really Simple SSL API key
|
||||
define('WP_DEBUG', false); // Production mode
|
||||
```
|
||||
|
||||
**Not yet defined (recommended):**
|
||||
```php
|
||||
define('DISALLOW_FILE_EDIT', true);
|
||||
define('FORCE_SSL_ADMIN', true);
|
||||
define('WP_MEMORY_LIMIT', '256M');
|
||||
```
|
||||
|
||||
## Database Conventions
|
||||
|
||||
- Schema documented in `.paul/codebase/db_schema.md`
|
||||
- Every schema change requires a new migration — never modify existing ones
|
||||
- Use `$wpdb->prepare()` for all dynamic queries
|
||||
- Table prefix: `wp_` (default)
|
||||
|
||||
## Version Control
|
||||
|
||||
- **Remote:** `https://git.project-pro.pl/Project-Pro/krolewskie-miody.pl.git`
|
||||
- **Branch:** `main`
|
||||
- **No `.gitignore`** — currently all files tracked (security risk; see concerns.md)
|
||||
- Excluded from FTP deploy: `.git`, `.vscode`, `.paul`, `.serena`, `CLAUDE.md`
|
||||
|
||||
## Code Quality Tools
|
||||
|
||||
None configured. Recommended additions:
|
||||
- `.phpcs.xml` — PHP CodeSniffer with WordPress/PSR-12 ruleset
|
||||
- `phpstan.neon` — Static analysis
|
||||
- `.eslintrc` — JavaScript linting
|
||||
Reference in New Issue
Block a user