# go-task/task architecture

> Architecture diagram of the GitHub repository go-task/task, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/go-task/task
- Repository: https://github.com/go-task/task

## Overview

Task is a cross-platform task runner: a user invokes the CLI, which configures an executor, loads task definitions, and runs requested tasks. Its runtime also supports remote and included Taskfiles, dependency/fingerprint handling, watch mode, task listing and summaries, and shell completion. The tree and sampled excerpts show key boundaries; several execution and watch connections are not shown in the excerpts, so those links are marked unverified rather than asserted.

Main entry points: [`task.go`](https://github.com/go-task/task/blob/main/task.go) (Task runner), [`cmd/task/task.go`](https://github.com/go-task/task/blob/main/cmd/task/task.go) (Task CLI), [`taskfile/reader.go`](https://github.com/go-task/task/blob/main/taskfile/reader.go) (Taskfile reader), [`internal/complete/engine.go`](https://github.com/go-task/task/blob/main/internal/complete/engine.go) (Shell completion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and configuration"]
  node_cli["Task CLI<br/>[task.go]"]
  node_flags["Flags and options<br/>[flags.go]"]
  node_taskrc["Task configuration<br/>[taskrc.go]"]
  node_task_rc_reader["Config reader<br/>[reader.go]"]
  node_task_rc_ast["Config model<br/>[taskrc.go]"]
end

subgraph group_definitions["Task definitions"]
  node_taskfile["Taskfile reader<br/>[reader.go]"]
  node_taskfile_ast["Taskfile model<br/>[tasks.go]"]
  node_task_nodes["Taskfile sources<br/>[node_http.go]"]
  node_git_node["Git source node<br/>[node_git.go]"]
end

subgraph group_runtime["Execution runtime"]
  node_executor["Executor setup<br/>[setup.go]"]
  node_runner["Task runner<br/>[task.go]"]
  node_compiler["Task compiler<br/>[compiler.go]"]
  node_fingerprint["Fingerprint checks<br/>[checker_mock.go]"]
  node_watch["Watch mode<br/>[watch.go]"]
  node_filesystem["Filesystem helpers<br/>[fs.go]"]
end

subgraph group_experience["User-facing features"]
  node_completion["Shell completion<br/>[engine.go]"]
  node_summary["Task summaries<br/>[summary.go]"]
  node_output["Output handling<br/>[output.go]"]
end

node_user(("CLI user"))
node_external_commands{{"Shell commands"}}

node_user -->|"invokes"| node_cli
node_cli -->|"validates options"| node_flags
node_cli -->|"sets up"| node_executor
node_flags -->|"configures"| node_executor
node_executor -.->|"loads definitions"| node_taskfile
node_taskfile -->|"builds model"| node_taskfile_ast
node_taskfile -.->|"resolves sources"| node_task_nodes
node_taskfile -.->|"uses Git source"| node_git_node
node_cli -->|"runs calls"| node_runner
node_runner -->|"reads tasks"| node_taskfile_ast
node_runner -.->|"compiles tasks"| node_compiler
node_runner -.->|"checks freshness"| node_fingerprint
node_runner -.->|"supports watching"| node_watch
node_runner -->|"executes commands"| node_external_commands
node_cli -->|"dispatches completion"| node_completion
node_completion -->|"uses compiler"| node_compiler
node_completion -->|"suggests task names"| node_taskfile_ast
node_runner -->|"prints summaries"| node_summary
node_runner -->|"routes output"| node_output
node_cli -.->|"loads configuration"| node_task_rc_reader
node_taskrc -->|"reads configuration"| node_task_rc_reader
node_task_rc_reader -.->|"returns config model"| node_task_rc_ast
node_taskrc -->|"searches config files"| node_filesystem
node_runner -.->|"resolves directories"| node_filesystem

click node_cli "https://github.com/go-task/task/blob/main/cmd/task/task.go"
click node_flags "https://github.com/go-task/task/blob/main/internal/flags/flags.go"
click node_taskrc "https://github.com/go-task/task/blob/main/taskrc/taskrc.go"
click node_executor "https://github.com/go-task/task/blob/main/setup.go"
click node_taskfile "https://github.com/go-task/task/blob/main/taskfile/reader.go"
click node_taskfile_ast "https://github.com/go-task/task/blob/main/taskfile/ast/tasks.go"
click node_task_nodes "https://github.com/go-task/task/blob/main/taskfile/node_http.go"
click node_git_node "https://github.com/go-task/task/blob/main/taskfile/node_git.go"
click node_task_rc_reader "https://github.com/go-task/task/blob/main/taskrc/reader.go"
click node_task_rc_ast "https://github.com/go-task/task/blob/main/taskrc/ast/taskrc.go"
click node_runner "https://github.com/go-task/task/blob/main/task.go"
click node_compiler "https://github.com/go-task/task/blob/main/compiler.go"
click node_fingerprint "https://github.com/go-task/task/blob/main/internal/fingerprint/checker_mock.go"
click node_watch "https://github.com/go-task/task/blob/main/watch.go"
click node_completion "https://github.com/go-task/task/blob/main/internal/complete/engine.go"
click node_summary "https://github.com/go-task/task/blob/main/internal/summary/summary.go"
click node_output "https://github.com/go-task/task/blob/main/internal/output/output.go"
click node_filesystem "https://github.com/go-task/task/blob/main/internal/fsext/fs.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_flags,node_taskrc,node_task_rc_reader,node_task_rc_ast,node_user toneBlue
class node_taskfile,node_taskfile_ast,node_task_nodes,node_git_node toneAmber
class node_executor,node_runner,node_compiler,node_fingerprint,node_watch,node_filesystem toneMint
class node_completion,node_summary,node_output toneRose
class node_external_commands toneIndigo
```

## Components

### CLI and configuration

- [Task CLI](https://github.com/go-task/task/blob/main/cmd/task/task.go): `cmd/task/task.go`
- [Flags and options](https://github.com/go-task/task/blob/main/internal/flags/flags.go): `internal/flags/flags.go`
- [Task configuration](https://github.com/go-task/task/blob/main/taskrc/taskrc.go): `taskrc/taskrc.go`
- [Config reader](https://github.com/go-task/task/blob/main/taskrc/reader.go): `taskrc/reader.go`
- [Config model](https://github.com/go-task/task/blob/main/taskrc/ast/taskrc.go): `taskrc/ast/taskrc.go`

### Task definitions

- [Taskfile reader](https://github.com/go-task/task/blob/main/taskfile/reader.go): `taskfile/reader.go`
- [Taskfile model](https://github.com/go-task/task/blob/main/taskfile/ast/tasks.go): `taskfile/ast/tasks.go`
- [Taskfile sources](https://github.com/go-task/task/blob/main/taskfile/node_http.go): `taskfile/node_http.go`
- [Git source node](https://github.com/go-task/task/blob/main/taskfile/node_git.go): `taskfile/node_git.go`

### Execution runtime

- [Executor setup](https://github.com/go-task/task/blob/main/setup.go): `setup.go`
- [Task runner](https://github.com/go-task/task/blob/main/task.go): `task.go`
- [Task compiler](https://github.com/go-task/task/blob/main/compiler.go): `compiler.go`
- [Fingerprint checks](https://github.com/go-task/task/blob/main/internal/fingerprint/checker_mock.go): `internal/fingerprint/checker_mock.go`
- [Watch mode](https://github.com/go-task/task/blob/main/watch.go): `watch.go`
- [Filesystem helpers](https://github.com/go-task/task/blob/main/internal/fsext/fs.go): `internal/fsext/fs.go`

### User-facing features

- [Shell completion](https://github.com/go-task/task/blob/main/internal/complete/engine.go): `internal/complete/engine.go`
- [Task summaries](https://github.com/go-task/task/blob/main/internal/summary/summary.go): `internal/summary/summary.go`
- [Output handling](https://github.com/go-task/task/blob/main/internal/output/output.go): `internal/output/output.go`

### Other components

- **CLI user**
- **Shell commands**

## Connections

- CLI user → Task CLI: invokes (evidence: `cmd/task/task.go`)
- Task CLI → Flags and options: validates options (evidence: `cmd/task/task.go`)
- Task CLI → Executor setup: sets up (evidence: `cmd/task/task.go`)
- Flags and options → Executor setup: configures (evidence: `internal/flags/flags.go`)
- Executor setup → Taskfile reader: loads definitions
- Taskfile reader → Taskfile model: builds model (evidence: `taskfile/reader.go`)
- Taskfile reader → Taskfile sources: resolves sources
- Taskfile reader → Git source node: uses Git source
- Task CLI → Task runner: runs calls (evidence: `cmd/task/task.go`)
- Task runner → Taskfile model: reads tasks (evidence: `task.go`)
- Task runner → Task compiler: compiles tasks
- Task runner → Fingerprint checks: checks freshness
- Task runner → Watch mode: supports watching
- Task runner → Shell commands: executes commands (evidence: `task.go`)
- Task CLI → Shell completion: dispatches completion (evidence: `cmd/task/task.go`)
- Shell completion → Task compiler: uses compiler (evidence: `internal/complete/engine.go`)
- Shell completion → Taskfile model: suggests task names (evidence: `internal/complete/engine.go`)
- Task runner → Task summaries: prints summaries (evidence: `task.go`)
- Task runner → Output handling: routes output (evidence: `task.go`)
- Task CLI → Config reader: loads configuration
- Task configuration → Config reader: reads configuration (evidence: `taskrc/taskrc.go`)
- Config reader → Config model: returns config model
- Task configuration → Filesystem helpers: searches config files (evidence: `taskrc/taskrc.go`)
- Task runner → Filesystem helpers: resolves directories
