# Design
![[tsk.db]]
![[tsk.sqbpro]]
Tasks are a capped stack, the cap is configurable via a config file.
![[Tsk Home 2024-01-03 17.58.13.excalidraw]]
Tasks have only a few fields, all of which are either automatically generated or completely optional.
Example [[Rust]] struct:
```rust
enum TaskStatus {
Todo,
InProgress,
Complete,
Cancelled,
}
type Tag = String;
struct Task {
// This tasks unique identifier
id: u64, // used to generate a TSK-<id>
// This tasks state
status: TaskStatus,
// The required title of this task
title: String,
// The additional text body of this task. Arbitrary text
body: Optional<String>,
// Optional tags associated with this task.
// These should be stored as de-duplicated relationships
// in the backend
tags: Vec<Tag>,
// An optional link associated with the task. This is
// primarily to support quick navigation via a shortcut
// to the link. Additional links may be included in
// the `body` field.
link: Optional<Url>,
// Arbitrary relationships between tasks represented with
// an arbitrary tag.
relationships: Vec<(Task, Tag, Task)>,
}
```
Commands differ based on mode and are documented below
## Main Mode
> [!NOTE] Title
> Commands use `[]` to denote optional text and `<text>` to denote arguments. Everything else is a literal.
- `P[USH] <task title>` creates a task with the provided title to the top of the stack (highest priority)
- `E[DIT] <task id>` opens the details pane for a task with the provided id (ex. `123`)
- `N[EW] <task title>` creates a task with lowest priority
- `S[TART]` marks the task at the top of the priority stack as "in progress", denoted with a `[-]`
- `C[OMPLETE]` marks the task at the top of the priority stack as "complete", denoted with a `[x]` and removing the task from the priority stack
- `U[NDO]` undoes the previous operation
- History should be retained for at least program lifetime, but *may* be persisted to non-volatile storage
- `B[ACKLOG]` switches to the backlog pane, where all todo and in-progress tasks are displayed in order
- `T[ODO] <task id>` puts a task back in the todo status. This is how you "reopen" a task
- `C[ONNECT] <task id> <tag> <task id>` defines a relationship between 2 tasks
- The relationship is an arbitrary tag, however the tag must already be defined
- Autocomplete is a high priority feature
- `M[AKE] <tag>` defines a tag
- `Q[UERY] (#<tag>|
lt;status>|"arbitrary text")*, ...` finds tasks with a given filter. `#` is used to delimit a tag filter and a `