Operations

Contributing

Branches, commits, pull requests, code conventions and how to write documentation.

Workflow

  1. Branch from main: feature/<short-name>, fix/<short-name> or docs/<short-name>.
  2. Keep pull requests focused — one feature or fix each.
  3. Run npm run check before pushing.
  4. Fill in the PR template (.github/PULL_REQUEST_TEMPLATE.md): what changed, a recording for UI changes, dependency changes.

Commit messages are short imperative sentences in English: "Add per-person cover charge", "Fix rounding when every subtotal is zero".

Code conventions

  • TypeScript strict, including noUncheckedIndexedAccess. No any.
  • Money is integers. Never do arithmetic on formatted strings or floats. See the engine.
  • Logic goes in src/lib/ as pure functions with tests. Components render and dispatch; they don't calculate.
  • State changes go through billReducer. Add an action instead of mutating the bill from a component. Return the same reference for no-ops.
  • Every user-facing string goes through the dictionaries. Portuguese first.
  • UI comes from the design system. Import components from @/design-system; style with semantic tokens (var(--color-…), var(--space-…)) in CSS Modules. No hex values, no ad-hoc spacing, no restyling a component from a feature: add a variant instead. See design system rules.
  • Formatting is Prettier's job (npm run format). Don't hand-align code; Markdown is excluded and stays hand-written.
  • Comment the why. Every component and module starts with a header comment saying what it is for and when not to use it; props get TSDoc (it becomes the Storybook docs table).
  • Accessibility is part of done: real buttons, labels for inputs, aria-pressed/aria-checked on toggles, focus visible.
  • Dependencies need a reason. The app has seven runtime dependencies. Adding one means writing down why in the PR (and, if it shapes the architecture, an ADR).

Writing docs

Docs live in docs/ as Markdown and are rendered at /docs by the app (src/lib/docs.ts).

Adding a page

Create docs/<slug>.md (or docs/<folder>/<slug>.md) with frontmatter:

---
title: Share links
description: One sentence shown under the title and in search results.
section: Architecture
order: 5
---

# Share links

Content…
FieldMeaning
titlePage title and sidebar label.
descriptionLead paragraph, meta description, search text.
sectionSidebar group. Known groups: Start here, Architecture, Product & design, Operations, Decisions, Legacy.
orderPosition inside the group (lower first).

The page appears in the sidebar, the search filter, the prev/next links and the sitemap automatically. index.md or README.md in a folder becomes that folder's URL.

Conventions

  • Link with relative .md paths — [engine](./calculation-engine.md#allocation). They work on GitHub and are rewritten to site URLs on render.
  • Callouts use GitHub syntax: > [!NOTE], > [!TIP], > [!IMPORTANT], > [!WARNING].
  • The # Title line is for GitHub readers; the site uses the frontmatter title instead.
  • ## and ### headings get anchors and appear in "On this page".
  • Write in English, present tense, second person. Prefer a table or a worked example to a paragraph of prose.
  • When code changes behavior described here, update the doc in the same PR.

Recording decisions

Choices that shape the architecture get an ADR in docs/decisions/: copy the structure of an existing one (Context → Decision → Consequences), number it, and add it to the decision log.

Edit this page on GitHub