<ContentPage eyebrow="Tutorial" title="Build a CLI with Tea" description="Learn Tea by building a task-list tool, one working feature at a time.">

<TutorialNavigation slug="tutorial" />

You already know how to program. Now you want to find out what writing a real program in Tea feels like. In this tutorial, you'll build a small command-line task list from an empty file, adding one useful feature at a time.

By the end, you'll be able to do this:

```bash
./bin/tasks add "Learn Tea"
./bin/tasks add "Build something useful"
./bin/tasks done 1
./bin/tasks list --all
```

Starting with an empty list, the final command prints:

```text
1. [x] Learn Tea
2. [ ] Build something useful
```

Your tasks survive between runs in a local text file. You'll also have tests for the program's logic and a native executable you can run on a compatible machine.

## Before you begin

You should be comfortable editing a text file and running commands in a terminal. We'll assume you know what variables, loops, and functions are, but explain Tea's spelling and behavior as they appear.

[Install Tea](/docs/install), including the host C toolchain described there, then check your installation:

```bash
tea --version
```

Create a directory just for this project:

```bash
mkdir tea-tasks
cd tea-tasks
```

Run the tutorial commands from this directory. You'll start with `tasks.tea`; later you'll add `tasks.txt` for data and `task_list.tea` for reusable code. You do not need to clone the Tea repository.

## How to follow along

Each chapter starts from the previous chapter's finished program. Read the explanation, make the changes, and run the command shown. The complete source at the end of a chapter is a recovery point: you can copy it over your files if you get stuck. Longer listings are expandable.

Commands and their output appear in separate blocks, so you can copy a command without copying a shell prompt. Sample output assumes you've followed the steps in order. Each chapter also has a small optional exercise; the next chapter always starts from the main walkthrough, not your exercise solution.

The first four chapters work with sample tasks in memory. From chapter 5 onward, the program reads `tasks.txt` in your current directory. We'll make that transition explicitly so you know which data you're looking at.

## Your route through the project

<TutorialContents />

## What you'll have learned

You'll use bindings, lists, loops, functions, structs, imports, typed errors, file operations, and tests in one program. Follow the reference links when you want more detail. You can explore generics, lambdas, and the rest of the standard library after you've finished your first tool.

This is a local, single-user task list. Features such as deletion, due dates, and concurrent writers are useful follow-up projects, rather than prerequisites for learning Tea.

<TutorialNavigation slug="tutorial" position="bottom" />

</ContentPage>
