Skip to content

Quickstart: the map in your repo

Write the first case files, check them, and run the check in CI. No account needed.

Applies to Engine
View as Markdown
On this page
  1. Create the map
  2. Write a use case
  3. Check it
  4. Run the check in CI
  1. Create the map

    Terminal
    npx @sypnia/cases init

    It creates cases/map.yaml with your app’s name, cases/navigation.yaml with a first root, and one example case.

  2. Write a use case

    cases/orders/place-order.case.yaml
    id: place-order
    title: Order for today
    actor: customer
    goal: Get fresh bread reserved for pick-up today
    starts: in_app
    where: shop.order-for-today
    steps:
      - The customer picks products and quantities
      - The system checks what is left and reserves it
      - The customer gets a pick-up code
    outcomes:
      OrderPlaced: { order_id: uuid, pickup_code: string }
    failures:
      OutOfStock:
        when: a product sold out while ordering
        tell: «This one just ran out. The rest of your order is kept.»
    data:
      reads: [product]
      writes: [order, order_item]
    allowed: [customer]
  3. Check it

    Terminal
    npx @sypnia/cases check

    It validates every file against the JSON Schema, checks that the case has a start and ends in declared outcomes, and that its place exists in cases/navigation.yaml (init wrote one with a root shop; add the place shop.order-for-today there, or let npx @sypnia/cases nav --from-code propose it from your screens). If your code uses Sypnorm, it also compares the code’s use cases with the map (The check).

  4. Run the check in CI

    .github/workflows/cases.yml
    - run: npx @sypnia/cases check --ci

    A scope error fails the build. The message says which code has no case, or which case is missing in the code.

  1. Create the map
  2. Write a use case
  3. Check it
  4. Run the check in CI

    Search pages, sections and terms