Imported from 0xmemu/ragilaluminium (
AGENTS.md). Install upstream withnpx skills add 0xmemu/ragilaluminium. Copyright stays with the author.
Coding Agents – Ragil Aluminium (website.4.0)
Laravel modular monolith: Inertia + React storefront and admin panel.
Orchestration: read docs/ORCHESTRATION.md first.
Server / production migrate: only when product is final — out of scope until then.
Always read before code
docs/ORCHESTRATION.md— SoT hierarchy & skill map- Architecture / schema / API (as needed for the task):
docs/architecture/system-architecture-ragil-aluminium.mddocs/database-schema-ragil-aluminium.mddocs/api-and-routes-ragil-aluminium.md
- UI work additionally:
frontend/README.mdfrontend/brand/BRAND-KIT.md+frontend/docs/DESIGN-SYSTEM.mddocs/sitemap/*+config/sitemap.php/config/admin-sitemap.phpfrontend/skills/ragil-public-ui/SKILL.mdorfrontend/skills/ragil-admin-ui/SKILL.mdfrontend/skills/ragil-ui-functional-integration/SKILL.md— UI/fitur wajib fungsional + terintegrasi backend (bukan mockup)
- Domain stage skill under
skills/stage-*.mdwhen touching that domain
skills/ domain files are flat .md (e.g. stage-1-foundation.md). Treat each as a skill.
Marketplace skills live in .agents/skills/ (technique helpers only).
Do not port UI from website_2.0/ui (Next.js). Functional contracts live in docs/PRODUCT-HANDOFF.md; visual governance lives in frontend/.
UI / fitur: setiap perubahan tampilan harus dianalisis fungsinya lalu disambungkan ke route/controller/service/schema yang ada sehingga langsung fungsional. Jangan kirim mockup atau data palsu sebagai selesai. Rule Cursor: .cursor/rules/ui-must-be-functional.mdc.
[AGENT REPORT FORMAT — MUST FOLLOW]
Every time you change code or fix an error, you MUST report using EXACTLY this structure. Do NOT add extra narrative or steps.
-
SCOPE:
- One short line.
- Example: "Admin product create form" "API /api/products detail WIN-JUNG-001"
-
ROOT_CAUSE:
- One line, directly stating the real cause.
- Example: "Null product_media->url caused blade error" "variants relation not loaded, property access in loop"
-
CHANGE:
- Maximum two lines.
- Name the files and what you changed.
- Example: "Added null-check in resources/views/admin/products/create.blade.php" "Loaded variants relation in ProductController@show before rendering"
-
SPEC_IMPACT:
- Choose ONE of these and write it exactly:
- "SPEC_UNCHANGED" → schema, routes, and JSON contracts are all unchanged.
- "SPEC_CHANGED_AND_DOCS_UPDATED" → spec changed AND docs have been updated.
- Choose ONE of these and write it exactly:
-
TEST_STATUS:
- One line about tests or manual checks.
- Example: "Smoke test admin create product: PASS" "Route /api/products/WIN-JUNG-001: 200 OK, payload matches api-and-routes spec"
Extra rules:
- Do NOT describe your internal process (e.g. "let me check the log", "let me run the request").
- Do NOT mention misleading stack frames or line numbers once you know they are not the real source.
- Focus only on: scope, root cause, concrete code changes, impact on spec, and test status.
SKILL USAGE RULES
Peta lengkap (tracks A–F, verify, gap): docs/ORCHESTRATION.md.
Ringkas area → skill wajib:
| Area | Track | Baca wajib |
|---|---|---|
| Public storefront / checkout | C | frontend/skills/ragil-public-ui/SKILL.md, ragil-ui-functional-integration, brand/design docs, docs/logic/stage-10-*, docs/sitemap/public-* |
| Admin UI | C | frontend/skills/ragil-admin-ui/SKILL.md, ragil-ui-functional-integration, brand/design docs, docs/logic/stage-9a-* / 9b-*, docs/sitemap/admin-* |
| Import & media | B | skills/stage-5-import-and-media-pipeline.md, schema |
| WhatsApp (+ event order) | B | skills/stage-8-*; event order juga skills/stage-4-* |
| Queue & storage | B | skills/stage-6-laravel-queue-and-storage.md |
| Order / payment / shipping | B | skills/stage-4-*; JNT → docs/jnt-cargo-integration.md |
| Tests / PHPUnit | E | .agents/skills/laravel-testing + tests/Feature/* |
| Visual implementation | C | frontend/brand/BRAND-KIT.md, frontend/docs/DESIGN-SYSTEM.md, frontend/skills/ragil-visual-qa/SKILL.md, ragil-ui-functional-integration |
| Visual overhaul technique | C | .agents/skills/design-taste-frontend + tetap tunduk pada kontrak dan brand kit |
General rule:
- Read AGENTS.md →
ORCHESTRATION.mdtrack → skill lokal → supporting docs. - Do NOT rely only on docs/;
skills/domain files are authoritative workflows for that stage. - Marketplace
.agents/skills/= technique only; do not override frontend governance / schema / sitemap. - Do NOT invent beyond schema / API / Product Handoff / sitemap contracts.
Phase 0 – Setup & Baseline
-
Initialize Laravel project
- Ensure Laravel version (e.g. 10+).
- Configure environment for MySQL (local dev).
-
Configure environment files
.env:- DB connection (MySQL).
- queue (Redis or database).
- storage (local, possibly S3 later).
- placeholder config for WhatsApp and shipping.
-
Create basic route groups
routes/web.php: public + admin prefixes.routes/api.php: if needed for API endpoints.- Webhook routes for WhatsApp and shipping.
Phase 1 – Database Migrations & Models (MySQL)
-
Implement migrations for catalog tables
products,product_variants,product_attributes,product_media.- Add indexes and enum fields as per
database-schema-ragil-aluminium.md.
-
Implement migrations for import pipeline
import_jobs,import_job_rows.
-
Implement migrations for orders & logistics
orders,order_items,payments,shipping_records.
-
Implement migrations for WhatsApp integration
whatsapp_templates,whatsapp_messages.
-
Implement migrations for users & customers
users,customers.
-
Implement migrations for analytics/logs
event_logs,performance_metrics.
-
Create Eloquent models
- One per table, with:
- relationships (e.g.
Product↔ProductVariant,Order↔OrderItem↔Payment↔ShippingRecord). - fillable/guarded fields and casting.
- relationships (e.g.
- One per table, with:
Phase 2 – Routing & Controller Skeletons
-
Public store controllers
HomeController,PageController,CatalogController,ProductController,CartController,CheckoutController,OrderController.
-
Admin controllers
Admin\DashboardController,Admin\ProductController,Admin\ProductVariantController,Admin\ProductAttributeController,Admin\ProductMediaController.Admin\ImportJobController,Admin\OrderController,Admin\PaymentController,Admin\ShippingRecordController.Admin\WhatsAppTemplateController,Admin\WhatsAppMessageController.Admin\AnalyticsController,Admin\PageController,Admin\BannerController,Admin\UserController,Admin\SettingsController.
-
Webhook controllers
Webhook\WhatsAppController,Webhook\ShippingController.
-
Wire routes to controllers
- Implement route definitions as per
docs/api-and-routes-ragil-aluminium.md.
- Implement route definitions as per
Phase 3 – Core Features Implementation
-
Catalog browsing & product detail
- Implement queries for category pages, filters, and product detail.
- Integrate
product_mediafor images. - Respect
statusandvisibilityflags.
-
Cart & checkout
- Implement cart storage (session or DB).
- Implement checkout flow: customer details, shipping, payment method, order creation.
- Ensure order creation writes to
orders,order_items,payments.
-
Admin catalog management
- Implement product/variant CRUD with archive behavior (no hard delete).
- Implement media manager UI and actions.
-
Import & media pipeline
- Implement upload of Shopee Excel.
- Use Laravel Excel queued imports for
import_jobsandimport_job_rows. - Implement media download jobs and update
product_media.
-
Order, payment, shipping management in admin
- Implement order list & detail.
- Implement payment recording & status updates.
- Implement shipping record creation & status refresh.
-
WhatsApp integration
- Implement outbound messaging via Business API.
- Implement webhook handling, log messages, and link to orders.
- Map Stage 4 events to Stage 8 templates.
Phase 4 – UI & UX Details (Admin & Public)
-
Admin UI
- Implement sidebar and Dashboard / Beranda widgets.
- Implement views for Catalog, Imports, Orders, Shipping, WhatsApp, Analytics, CMS, Settings.
- Follow
frontend/brand/BRAND-KIT.md,frontend/docs/DESIGN-SYSTEM.md, and the admin project skill.
-
Public store UI
- Implement homepage, category, product detail, cart, checkout, order status.
- Follow the public project skill and
frontend/docs/UX-FLOWS.md; mobile responsive.
Phase 5 – Testing, Performance, Security
-
Testing
- Add feature tests for:
- imports.
- order lifecycles.
- checkout flow.
- WhatsApp integration.
- Add feature tests for:
-
Performance
- Optimize queries with indexes and eager loading.
- Tune queue workers and chunk sizes.
-
Security
- Secure admin routes and webhooks with auth and validation.
- Protect sensitive config values.
Agent Rules
- Always read orchestration + relevant docs/skills before coding.
- Prefer updating docs/sitemap/DESIGN first when contracts change, then code.
- Log major architecture decisions in
docs/architecture/as needed. - Do not start production server migration until explicitly scoped as a mature release.
Resolved Issues Log (stabilization)
-
RouteNotFoundException
policy/privacy/policy/terms(500 on every page usinglayouts/public.blade.php, incl./,/windows,/api/catalog/*): the public layout calledroute('policy/privacy')but the contracted route names areprivacyandterms(routes/web.php). Fixed by using the defined namesroute('privacy')/route('terms')inresources/views/layouts/public.blade.php. No new route added. -
API routes returned HTML instead of JSON (
/api/catalog/{category},/api/products/{sku},/api/search): perapi-and-routes.md§10 these are API routes. Branched responses inCatalogController,ProductController,SearchController: whenrequest()->is('api/*')orrequest()->wantsJson()(Accept: application/json) they return schema-shaped JSON; otherwise Blade view. AddedProduct::toApiArray()andProductVariant::toApiArray()(fields taken fromdatabase-schema.md; no new fields). No schema/route/field changes. -
BadMethodCallException: whenLoadedintoApiArray():whenLoaded()is not a base Eloquent Model method. Replaced withrelationLoaded(...)guards. -
Error: map() on arrayonattributesrelation:$this->attributescollides with Eloquent's internal$attributesarray property. UsedgetRelation('attributes')inside therelationLoadedguard. -
Return-type
TypeErroronCatalogController::windows/doors/bouven: widened their return types toJsonResponse|Viewto match the branchedcategory()helper. -
main_imagenull on product-detail API:ProductController@shownow also eager-loadsmainImageso the field is consistent with the catalog API. -
Checkout → order creation flow verified (Stage 3): full flow
POST /cart/add→POST /checkout/validate→POST /checkout/place-orderruns end-to-end with no 500.OrderService::createFromCart()writesorders(statuspending_payment/pending/pending_pickup),order_items, andpaymentsperdatabase-schema.md.OrderCreatedevent firesSendOrderCreatedWhatsApp;WhatsAppServicedegrades safely when nowhatsapp_templatesrow / no API token (returns null, no partial write). Confirmation (/order/{n}/confirmation) and status (/order/status) pages render HTML 200. CSRF 419 on POST is expected framework behavior (browser supplies token); not a contract bug. -
Stage 4 import pipeline + admin pages fixed: (a)
CatalogProductsImporthad aBeforeImporthandler calling$event->reader->getActiveSheet()which 500s (null reader delegate) — removedWithEvents/registerEvents/RemembersRowNumber;total_rowsstays nullable per schema. (b)Excel::queueImport()requiresShouldQueuebut making the importShouldQueuecrashed serialization ("spreadsheet" ... does not exist). Fixed by adding queued jobApp\Jobs\ProcessCatalogImport(holds only$jobId/$storedPath) and dispatching it fromImportJobController@store/retry; import runs and writesproducts/product_variants/product_media/import_job_rowsper schema. (c) All admin pages 500'd withClass "Auth" not foundbecauseconfig/app.phpoverrode the default facadealiasesarray (onlyExcel), droppingAuth. Fixed view to useauth()->user()inlayouts/admin.blade.php. All admin sections now 200. -
Stage 5 (WhatsApp + Shipping webhooks & admin) verified: webhook routes
GET/POST /webhook/whatsappandPOST /webhook/shipping/jntare CSRF-exempt (seebootstrap/app.phpvalidateCsrfTokens(except: ['webhook/*'])).WhatsAppController@handlewrites inboundwhatsapp_messages(test: 1 inbound row created);ShippingController@handleJnt→ShippingService::applyCarrierUpdateupdatesshipping_records+ cascadesorders.shipping_status(graceful when waybill missing). Admin WhatsApp/Shipping/Payments pages 200; templatestore302 + row created; shippingrefresh302 + graceful (last_status_attouched) when no carrier API key. No 500 in Stage 5. -
Admin media manager 500 fixed:
ProductMediaController@storeand@redownloadcalledDownloadProductMedia::dispatch($media)(passing the model), but the job constructor requiresint $mediaId→TypeError. Fixed toDownloadProductMedia::dispatch($media->id)(matchesCatalogProductsImport). Media store/redownload/set-main/archive now 302, no 500. -
Phase 5 feature tests added: enabled SQLite (in-memory) for
phpunit.xml(matches dev env) and addedtests/Feature/CheckoutFlowTest(order+items+payment),ImportPipelineTest(viaProcessCatalogImport→ products/variants/media, jobcompleted),WhatsAppWebhookTest(inbound logged, verify 403). All 4 pass (17 assertions). No app code changed.