Skip to content

Latest commit

 

History

History
47 lines (32 loc) · 2.38 KB

File metadata and controls

47 lines (32 loc) · 2.38 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Build

make          # build ./pizza-party binary
make clean    # remove objects and binary

Requires libcurl (libcurl4-openssl-dev on Debian/Ubuntu) and a C11 compiler + clangd (apt install clang clangd). In the devcontainer, both are installed by the postCreateCommand in .devcontainer/devcontainer.json.

CLI usage

./pizza-party stores <zip>
./pizza-party menu <store_id>
./pizza-party track <order_id>
./pizza-party watch <order_id> [poll_seconds]
./pizza-party -c <config_file> -v <command>   # custom config, verbose curl

Config file format is key=value — valid keys: base_url, api_key, timeout, verbose.

Architecture

The application is built around a provider vtable (include/provider.h, src/provider.c). Each restaurant backend implements pp_provider_t — a struct of function pointers covering store search, menu fetch, order validation/placement, and order tracking. Providers are registered at startup via pp_provider_register() and resolved by name or default.

The remaining modules are provider-agnostic and operate through pp_config_t:

  • http_client — thin libcurl wrapper; all network I/O goes through pp_http_get / pp_http_post, which return a heap-allocated pp_response_t (caller frees with pp_response_free)
  • store / menu / order / tracker — each owns its data structs, a fetch/create function that calls http_client, and a _free + _print pair
  • config — loaded once in main.c, passed by pointer to every function that needs it; never mutated after load

Key conventions

  • All public symbols are prefixed pp_.
  • Functions that allocate return a pointer (NULL on failure); the caller always owns and frees the result.
  • JSON parsing is not yet implemented — every module that receives HTTP responses has a /* TODO: parse resp->data */ stub. Add a JSON library (e.g. cJSON) and fill these in per-provider.
  • Do not reference specific restaurant brand names anywhere in the codebase — keep all naming generic to allow multiple providers.

Adding a provider

  1. Create src/providers/<name>.c implementing all five function pointers in pp_provider_t.
  2. Call pp_provider_register(&your_provider) early in main.
  3. Add the new .c file to SRCS in the Makefile.