1. The documentation rule
When you change a tool or a flow: (1) update its section on this page (add or refresh a diagram if the flow isn't obvious), (2) add a line to the repo's CHANGELOG.md (who / what / when / where), and (3) if a system, integration or deploy changed, update KTUBTU-Intranet/docs/DEVELOPER.md. The Tekki agent mirrors every CHANGELOG.md to the intranet's Change Log (Tech Stack tab) and flags changes that shipped without their how-to.
2. The selections and ordering flow
Each option's photo is attached to the JobTread selection document at publish (the resolved photo the client sees — bundled, or the catalogue item's scraped vendor image). The order sheet is rebuilt from JobTread on approval and every 2 hours.
3. Order sheet
What: the buy list per job, built from what JobTread sold + the client chose — never re-typed. Each line shows its unit (LF / sq ft / each) and price; a "needed but not quoted or selected" callout flags companions a pick needs (a shower fixture's rough-in valve, a countertop's edge/cutout/seam, a toilet's wax ring).
Where: pricing.ktubtu.com/o/<token> (link is in the ready-to-order email) and the CSV export. Also written into the JobTread job comment.
Source: ktu-pricing-build/app/src/orders.js (build) + index.html (page/email). Runs: automatically on client approval and on the 2-hourly refresh — no manual step. To add a companion rule, edit COMPANIONS in orders.js.
4. Selection photos in JobTread
Going forward: nothing to run — the pricing app attaches each chosen option's photo when the selection document is published (attachCustomImages in ktu-pricing-build/app/src/index.js). It resolves the photo the client already sees: the bundled img-map.json image, else the catalogue item's own scraped vendor photo (in its JobTread description, e.g. … | img https://…).
One-off backfill for documents published before that (draft docs only — JobTread locks pending/approved). From ktubtu-automations:
python3 tools/backfill_ktu_selection_images.py # dry run — reports coverage
python3 tools/backfill_ktu_selection_images.py --apply # attach the resolved photos
python3 tools/backfill_ktu_selection_images.py --job <id> # one job only
Check after: open the JobTread selection document — each option should carry a photo file. Items with no photo anywhere (drawn edge profiles, materials kits) stay blank, which is correct.
5. Deploying
Golden rules: only deploy code that contains current main (merge first), and merge what you deploy (or the next deploy from main undoes it).
- Pricing app (
ktubtu-pricing): fromktu-pricing-build/app/—bash check.sh, thennpm installandnpx wrangler deploy(needsCLOUDFLARE_API_TOKEN). - Intranet: push to
main→ deploys automatically. - Playbook: from
TeamLivingston/playbook/—npx wrangler pages deploy . --project-name ktu-playbook --branch main.