doordash-group-checkout-gate — Claude Code hook: allergen re-check
A hook that re-checks allergens at DoorDash group checkout through dd-cli and blocks payment when a dangerous match turns up.
npx claude-code-templates@latest --hook doordash/doordash-group-checkout-gateWhat doordash-group-checkout-gate does
The hook runs on PreToolUse for Bash. Before a command executes, it looks for a round ledger on the cart: a .dd/round-*.json file. No ledger, no check — single orders belong to the other hook, doordash-allergy-shield.
With a ledger present, the hook runs dd-cli cart show itself and ties each cart line to an eater through the person-to-cart-item-id ledger. It then compares allergens against that person's entry in team-food.json. An anaphylaxis-tier match ends the hook with exit code 2, so the order does not go through.
The check happens against the cart as it is at checkout. A vetting step that got skipped, or a cart edited after review, will not slip past quietly. Without a team-food.json roster there is nothing to compare against, so that file has to exist before the hook is switched on.
What it helps with
- catch an allergen in a group cart before payment
- match cart lines to eaters through the round ledger
- spot a cart edited after it was reviewed
- stop checkout with exit 2 on a dangerous match
Example prompts for the agent
- Check the cart before we place the group DoorDash order
- Place the order with
dd-cli; the hook should re-verify allergens - Show me what is in the cart now with
dd-cli cart show
How to install doordash-group-checkout-gate
1claude-code-templates
npx claude-code-templates@latest --hook doordash/doordash-group-checkout-gate2Manually: put the files in place
.claude/settings.jsonThe hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json
Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command
Questions about doordash-group-checkout-gate
How do I install doordash-group-checkout-gate in Claude Code?
Run npx claude-code-templates@latest --hook doordash/doordash-group-checkout-gate, then confirm the entry in .claude/settings.json.
What does doordash-group-checkout-gate do?
Before Bash commands it inspects a group cart, links each line to an eater and checks allergens against team-food.json. On a dangerous match it blocks checkout.
When does the hook stay inactive?
Only carts with a .dd/round-*.json round ledger trigger it. Single orders are left to doordash-allergy-shield.
Source text
doordash-group-checkout-gate.json · MIT
{
"description": "Live allergen re-check for DoorDash CLI group orders. When a checkout runs for a cart that has a doordash-group-orders round ledger (.dd/round-*.json), this hook itself runs 'dd-cli cart show', joins cart lines to eaters via the person-to-cart-item-id ledger, and re-derives allergen conflicts against each eater's entry in the team-food.json roster - blocking with exit 2 on a live anaphylaxis-tier match. Verifies reality at checkout time instead of trusting a flag file: a skipped vetting step or a cart edited after review cannot pass silently. Only activates for carts with a round ledger; solo orders are doordash-allergy-shield territory.",
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/doordash-group-checkout-gate.sh"
}
]
}
]
}
}
© davila7 · MIT · davila7/claude-code-templates