This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Magento 2 extension (Idealpostcodes_Ukaddresssearch) providing UK address search via the Ideal Postcodes API. Supports postcode lookup and address autocomplete for checkout, customer accounts, and admin order management.
make up # Build and initialize Magento (includes init)
make down # Shutdown services
make shell # Bash into web container
make cache-flush # Clear Magento cache
make fix-session-expire # Fix session timeout (sets base URL to 127.0.0.1)
make logs # Tail all Docker logsPHP version selection: PHP=81 make up or PHP=82 make up
npm run build # Production build (Rollup)
npm run watch # Watch mode for development
npm run lint # ESLint check
npm run lint-fix # Auto-fix lintingnpm test # Run snapshot tests (Cypress against static fixtures)
npm test:open # Interactive snapshot testing
npm test:e2e # E2E tests against live Magento (requires `make up`)
npm test:e2e:open # Interactive E2E testingTests use Cypress. Snapshot tests run against HTML fixtures; E2E tests require the Docker environment running on localhost:3000.
Core extension logic compiled to minified bundles:
extension.ts- Main logic:setupPostcodeLookup(),setupAutocomplete(),hoistCountry(), field bindingstore.ts→view/base/web/binding.min.js(frontend bundle)admin.ts→view/base/web/admin.min.js(admin bundle)
Form bindings: billing.ts, shipping.ts, customer.ts, multishipping.ts, admin-orders.ts, admin-orders-edit.ts, admin-customers.ts
Helper/Data.php- Configuration retrieval (API key, enabled flags, field mappings)ViewModel/StoreConfig.php- Frontend JSON config forx-magento-initViewModel/AdminConfig.php- Admin panel configPlugin/Customer/SanitizeAddressPlugin.php- Input sanitization for customer addressesPlugin/Quote/SanitizeAddressPlugin.php- Input sanitization for quote addresses
layout/*.xmlinjects config blocks- Templates (
store.phtml,admin.phtml) initialize JS viax-magento-init - ViewModels serialize configuration to JSON
- RequireJS modules (
store-init.js,admin-init.js) callwindow.idpcStart() - Compiled TypeScript attaches to DOM elements
- Plugins sanitize address input before save
Admin config form: etc/adminhtml/system.xml
Default values: etc/config.xml
CSP whitelist: etc/csp_whitelist.xml (allows *.ideal-postcodes.co.uk)
Runtime: @ideal-postcodes/address-finder, @ideal-postcodes/postcode-lookup
Build output targets ES5 for IE11 compatibility.