Metadata-Version: 2.4
Name: mdtodo
Version: 0.7.0
Summary: A todo list manager that keeps projects and tasks in a plain markdown file.
Keywords: todo,markdown,cli
Author: mjws4oss
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Dist: rich==15.0.0
Requires-Python: >=3.14
Description-Content-Type: text/markdown

# mdtodo

`mdtodo` is a command-line todo manager that keeps everything in one plain markdown file.
Headings are projects and checkbox items are tasks. You can edit the file in any editor, or
use the `mdtodo` commands. Either way, it stays readable markdown.

```markdown
- [ ] Call the bank due:2026-10-20

## Website
- [ ] Write landing copy @active due:2026-10-18
- [ ] Pick a color palette @next
  - [ ] Shortlist 3 palettes
- [x] Buy domain
```

- `[ ]` means open, and `[x]` means completed.
- `@active` marks a task you're working on now. `@next` adds a task to the pool of tasks
  you plan to pick up next.
- `due:YYYY-MM-DD` sets a deadline. Open tasks are flagged as overdue, or as due soon
  (today through the next 3 days).
- Tasks above the first heading go into the `Inbox` project. Prose, notes, and code blocks
  are ignored.

Running `mdtodo` with no command shows the summary. Its first line says whether anything
needs attention, then the most urgent tasks come first:

```text
$ mdtodo
1 OVERDUE · 2 due soon · 1 active · 2 next

               Task                  Project  Due      Ref
OVERDUE   1    Fix the fence         Garden   LATE 4d  ee6d3a

DUE SOON  2  ▶ Write landing copy    Website  TMRW     bbdb3a
          3    Call the bank         Inbox    FRI      0a39ec

NEXT      4    Order seeds           Garden   NOV 3    28862d
          5    Pick a color palette  Website  —        b1b77f

Inbox 1 open · Website 3 open, 1 done · Garden 2 open
```

The section name sits in a left-hand gutter, so the summary drops the `‼`/`!` symbols and
shows `▶` or `→` only where the section doesn't already say it. Task names longer than 40
characters wrap at spaces onto the next line, inside the Task column.

Each task starts with a number, counting down the whole summary. A wrapped task name
continues on lines with no number, so the numbers show where each task starts, and the last
number is how many tasks are listed. Numbers are only for reading. Commands take the ref.

`list`, `next` and `due` use the same columns. How to read a row:

- **Marker**: the first symbol is `‼` for overdue or `!` for due soon. The second is `▶`
  for active, `→` for next, or `✓` for done (`list --all` only).
- **Due**: `LATE 4d`, `TODAY`, `TMRW`, a weekday for the coming week (`FRI`), otherwise the
  date (`NOV 3`, or `JAN 5 2027` for another year). It shows `—` for no deadline and
  `INVALID` for a date that can't be read.
- **Ref**: always last, ready to copy into `mdtodo start <ref>` or `mdtodo done <ref>`.

A subtask is shown as `<parent>: <task>`. In `list` it is shown as its own name, indented
under its parent.

The full syntax is in
[specs/001-markdown-todo-manager/contracts/file-format.md](specs/001-markdown-todo-manager/contracts/file-format.md).

## Install

With [uv](https://docs.astral.sh/uv/) installed:

```bash
uv tool install mdtodo   # puts `mdtodo` on your PATH (~/.local/bin)
mdtodo --version
```

If you don't have a suitable Python, uv downloads one for you.

```bash
uv tool install mdtodo==X.Y.Z   # install a specific version
uv tool upgrade mdtodo          # move to the latest release
uv tool uninstall mdtodo        # remove the command
```

Uninstalling removes only the command. Your todo file (`~/tracker.md`, or whatever `--file`
or `MDTODO_FILE` points at) is left untouched.

**Switching from an editable install**: if you installed with `uv tool install --editable .`,
run `uv tool uninstall mdtodo` first, or replace it in one step with
`uv tool install --force mdtodo`.

## Which file is used

The first match wins:

1. `--file PATH`, which can go before or after the command;
2. the `MDTODO_FILE` environment variable;
3. `~/tracker.md`.

If you used an earlier version that read `~/TODO.md`, rename that file to `~/tracker.md`, or
point `--file` or `MDTODO_FILE` at it.

`mdtodo init` creates a starter file. Nothing else ever creates the file.

`--file -` reads the todo text from standard input instead, for example
`cat tracker.md | mdtodo --file -`. Only the commands that just read (`mdtodo`, `summary`,
`list`, `next`, `due`) accept it. The commands that change the file, and `init`, refuse it.
Standard input is never read unless you pass `--file -`, and `MDTODO_FILE=-` means a file
named `-`.

## Colour

On a terminal, colour appears only for problems: overdue in bold red, and due soon (and
unreadable dates) in bold magenta. Active tasks and titles are bold, and everything else is
normal text, so on a day with nothing late or due soon there is no colour at all. Only bold and the terminal's standard named colours are used, so your theme picks the
exact shades and the output stays readable on light and dark backgrounds. Colour only repeats
what the text already says, so nothing is lost without it.

`--color auto|always|never` (before or after the command) chooses when to use it. With
`auto`, the default, colour is off when output is piped or redirected, when `NO_COLOR` is set,
or when `TERM=dumb`. `FORCE_COLOR` is not read; use `--color always` to force colour, for
example `mdtodo --color always | less -R`.

## Commands

| Command | What it does |
|---------|--------------|
| `mdtodo` / `mdtodo summary` | Overdue, Due soon, Active, and Next tasks (each listed once), plus counts per project |
| `mdtodo list [--all] [--project NAME]` | Tasks grouped by project, each with its reference |
| `mdtodo next` | The next pool, ordered by deadline |
| `mdtodo due` | Open tasks ordered by deadline |
| `mdtodo start REF` / `mdtodo stop REF` | Add or remove `@active` |
| `mdtodo next add REF` / `mdtodo next rm REF` | Add or remove `@next` |
| `mdtodo done REF` | Check the box, and remove `@active` and `@next` |
| `mdtodo init` | Create a starter file |

`REF` is the 6-character reference shown in every listing. It stays the same when markers
change. If you edit a task's text, its reference changes, and the old one is refused rather
than applied to the wrong task. Each command changes only the task's own line. If the file
changed while the command was running, nothing is written.

Details, including output formats and exit codes, are in
[contracts/cli.md](specs/001-markdown-todo-manager/contracts/cli.md).

## Development

```bash
uv sync
uv tool install --editable .       # installs this working tree as the `mdtodo` command
scripts/check.sh                   # format, lint, mypy --strict, tests (coverage ≥ 80%)
uv run pytest -m perf --no-cov     # timing checks (SC-002), kept out of the default run
```

To see the output with realistic data (every summary section filled, long task names
wrapped, ten projects in the tally) without touching your own file, pipe the sample into
mdtodo from the repository root:

```bash
uv run sample.py | uv run mdtodo --file -   # this working copy
uv run sample.py | mdtodo --file -          # the installed command
```

The sample's deadlines are relative to today, so it always shows 3 overdue tasks and 2 due
tomorrow. `sample.py` prints to stdout and writes no files.

The design documents are in [specs/001-markdown-todo-manager/](specs/001-markdown-todo-manager/),
and the project principles are in [.specify/memory/constitution.md](.specify/memory/constitution.md).

## Releasing

Releases go to PyPI with `scripts/release.sh`. See [docs/releasing.md](docs/releasing.md).
