Get started

Six steps from a repo with no Lattice in it to a build that comes back from cache the second time you run it. You need a terminal and the tools your workspaces already use. The transcripts are from a repo with two npm packages, app and greet, whereapp depends on greet.

  1. Install it into your repo

    From the root of the repo you want to use Lattice in:

    The script picks the archive for your platform, checks its SHA-256 against the release's published checksums, and refuses to install on a mismatch. The binary lands in.lattice/bin/, and the script adds that path to your .gitignore if the repo already has one. The only thing it writes outside the repo is a PATHline in your shell config. To skip that line, pass --no-modify-path and call./.lattice/bin/lattice directly.

    That script covers macOS, Linux, and Windows under Git Bash. In PowerShell, run the Windows installer instead:

    irm https://latticeandcompany.github.io/lattice/install.ps1 | iex

    It writes the same .lattice\bin and adds that directory to your userPATH, asking first. Every published build is listed on thereleases page. SeeInstallation for the switches both installers take.

  2. Check that it runs

    lattice --version
    lattice 2.0.0

    If your shell can't find lattice, open a new terminal so thePATH line takes effect.

  3. Initialize

    lattice init

    init reads the repo before it writes anything. It finds the workspaces yourpackage.json, pnpm-workspace.yaml, Cargo.toml orgo.work already name, and on a terminal it offers any other projects it found and any tool versions the repo already pins. -y takes what it offers without asking. Then it shows every workspace it sees, the tool that runs it and the tasks it can run:

    ✓ wrote lattice.json
    ✓ wrote .lattice/schema.json
    ✓ updated .gitignore
    
    2 workspaces:
      app    npm      build test
      greet  npm      build
    
    next: lattice run build

    Commit lattice.json and .lattice/schema.json, which lets your editor check the config as you type. init gitignores the rest of.lattice/, which is per-machine.

  4. Read what it wrote

    {
      "$schema": ".lattice/schema.json",
      "latticeVersion": "2.0.0"
    }

    That is the whole config for this repo. The packages come from the rootpackage.json's workspaces, the tool from the lockfile, the tasks from each package's scripts, and the order from app's dependency ongreet. Ask what a run would do before running it:

    lattice run build --dry-run
    ❖ lattice  dry run · build
      → greet:build  npm run build
      → app:build  npm run build

    A project no workspace file names, a dependency between languages, or a command you want to write yourself goes in lattice.json. SeeConfiguration.

  5. Install dependencies

    lattice setup

    setup checks or installs any tool versions you pinned, then runs each workspace's own installer, once per lockfile: here, one npm install. Run it as often as you like. Lattice skips a workspace whose lockfile hasn't changed.

  6. Run a task

    lattice run build
    ❖ lattice  build  · 2 workspaces
    
      ✓ greet  0.12s
      ✓ app    0.12s
    
    ❖  2 tasks  0.27s

    greet builds before app because app depends on it. Workspaces with no dependency between them run at the same time. While a run is going, the live display shows each running task with the last lines it printed and what the rest are waiting on; in CI, or with --stream, you get one plain line per event instead.

    Run it again without changing a file:

    ❖ lattice  build  · 2 workspaces
    
      ● greet  cached · 0.12s saved
      ● app    cached · 0.12s saved
    
    ❖  2 tasks · 2 cached  0.00s · 0.23s saved
    
    ❖❖❖ FULL POWER

    Nothing changed, so nothing ran. Each package's dist/ came back out of.lattice/cache/. Edit a file in greet and it builds again, and so does app, which depends on it. Run it from inside packages/greetand only greet builds.