Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ first added in the same Unreleased section is not an entry: edit that entry inst

## Unreleased

### Added

- `tsk edit --thread <name>` puts an existing task on a thread, and `--clear-thread` takes it off ([edit](https://gettsk.sh/docs/cli/#edit)).

## v0.14.0

### Breaking
Expand Down
4 changes: 2 additions & 2 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ this file names things.
- **list command**: `tsk list`, which prints tasks without changing them.
- **status command**: `tsk status`, which sets a task's human status. `start` is an alias
for `started`.
- **edit command**: `tsk edit`, which changes a task's title, notes, assignee, base, or
`after` list. It never changes scope or thread.
- **edit command**: `tsk edit`, which changes a task's title, notes, assignee, thread, base,
due date, or `after` list. It never changes scope.
- **bulk add**: one `add` of many items. It reports each item and makes one durable write
of the successes.
- **invocation default**: the scope `add` uses when no project or `--desk` is given: the
Expand Down
2 changes: 1 addition & 1 deletion site/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The human works the board in a TUI; agents read and write the same tasks with th

- Status: `open` (inbox), `ready` (picked), `started`, `blocked`, `review`, `done`. The human owns status; checking every step never completes a task.
- Desk and project: a project is a Git repository root, named by its folder or by a title (`tsk project title`). `-p` takes the title or the folder name. The desk holds tasks with no project.
- Thread: a label that groups related work, within a project or across several.
- Thread: a label that groups related work, within a project or across several. `tsk add --thread`, `tsk edit --thread` and `--clear-thread` set it.
- Task number: `T12`, `12`, and the task's UUID address the same task.
- Notice: `N` rows on the desk (starter tasks, What's new) are for the human only. `tsk list` never shows them.
- Agent profile: an `[agent.<name>]` table in `config.toml` holding the command that launches an agent.
Expand Down
8 changes: 5 additions & 3 deletions site/src/content/docs/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tsk list
| [`tsk add`](#add) | Add a task, or every task in a JSON plan |
| [`tsk list`](#list) | Read tasks |
| [`tsk status`](#status) | Set a task's status, block it, or put it up for review |
| [`tsk edit`](#edit) | Change a task's title, notes, assignee, base, due date, after list, or who its block or review waits on |
| [`tsk edit`](#edit) | Change a task's title, notes, assignee, thread, base, due date, after list, or who its block or review waits on |
| [`tsk steps`](#steps) | Add, toggle, rename, move, or remove a step |
| [`tsk checks`](#checks) | Mark a review check open, passed, or failed |
| [`tsk reply`](#reply) | Answer a block, or give feedback on a review |
Expand Down Expand Up @@ -385,10 +385,10 @@ tsk status T12 review --done "Opened PR #42" --check "tests pass" --next "docs"

## edit

Changes a task's title, notes, assignee, dispatch base, due date, the tasks it runs after, or who its open block or review waits on. Scope and thread stay as they are: to move a task, add it again in the right scope and archive the old one.
Changes a task's title, notes, assignee, thread, dispatch base, due date, the tasks it runs after, or who its open block or review waits on. Scope stays as it is: to move a task, add it again in the right scope and archive the old one.

```text
tsk edit <task> [--title <title>] [--notes <notes> | --append-notes <text>] [--assignee <name> | --unassign] [--base <branch> | --clear-base] [--due <date> | --clear-due] [--after <task>]... [--clear-after] [--on <who>] [--state-dir <dir>]
tsk edit <task> [--title <title>] [--notes <notes> | --append-notes <text>] [--assignee <name> | --unassign] [--thread <name> | --clear-thread] [--base <branch> | --clear-base] [--due <date> | --clear-due] [--after <task>]... [--clear-after] [--on <who>] [--state-dir <dir>]
```

| Flag | Meaning |
Expand All @@ -398,6 +398,8 @@ tsk edit <task> [--title <title>] [--notes <notes> | --append-notes <text>] [--a
| `--append-notes <text>` | Add text below the notes after one blank line, or set it as the notes when there are none |
| `--assignee <name>` | Assign an agent profile from [`config.toml`](/docs/storage/#configuration), `me`, or a person ([names](/docs/dispatch/#assignee-names)) |
| `--unassign` | Clear the assignee |
| `--thread <name>` | Put the task on this [thread](/docs/capture/#thread-names), replacing any other |
| `--clear-thread` | Take the task off its thread |
| `--base <branch>` | Dispatch from this existing branch, not a tag or commit (`unknown-base`) |
| `--clear-base` | Dispatch from the project's default branch |
| `--due <date>` | Set the day it is due, as `YYYY-MM-DD`. No time of day (`invalid-due`) |
Expand Down
6 changes: 3 additions & 3 deletions skills/tsk-cli/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: tsk-cli
description: Work the user's tsk task board from the command line. Use when asked to add, update, edit, start, block, finish, archive, or restore a task on the board (or "tsk", "the tsk board", "the desk"), to add or tick steps, to answer "what's on the board", "what's next", "what's on deck", "what needs me", or to refine a task ("refine T12", "let's discuss T12", "what's missing from T12", "improve / rewrite this task"). Always `tsk add|list|status|reply|edit|steps|archive|dispatch|clean|trash`, never the TUI.
version: 1.7.0
version: 1.8.0
---

# tsk: the user's task board
Expand Down Expand Up @@ -184,8 +184,8 @@ criteria, no design document, no code. It ends with a better task on the board.
- Does not exist yet: `tsk add -t "…" -n "…"` in the agreed scope (`--desk`, `-p`), with
`--thread` if agreed.
- Steps only when the user wants order of work tracked: `tsk steps T12 add "…"` per step.
- Never change status. `edit` cannot change scope or thread: for a scope change re-add in the
right scope and archive the stray; say so before doing it.
- Never change status. `edit --thread` changes the thread; `edit` cannot change scope: re-add
in the right scope and archive the stray, and say so before doing it.
7. **Stop.** The hand-off is the updated or created task. Report its number and title in one line.
Do not offer builders, worktrees, or plans, and do not start building unless asked.

Expand Down
2 changes: 1 addition & 1 deletion skills/tsk-coordinator/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: tsk-coordinator
description: 'Coordinate a multi-agent build: plan the work, brief builder agents, gate every pull request with an independent review, live-test before merge, and report to the user. Works with any agent and tracker, tuned for the tsk board. Use when asked to coordinate builders or workers, run parallel agents, "move the plan along", or work through a task list on your own.'
version: 1.7.0
version: 1.8.0
---

# tsk-coordinator: run builders for the user
Expand Down
18 changes: 14 additions & 4 deletions src/cli/edit.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Headless edits: title, notes, assignee, base, due date, after, and who an open block or
//! review waits on.
//! Headless edits: title, notes, assignee, thread, base, due date, after, and who an open
//! block or review waits on.

use std::path::PathBuf;

Expand All @@ -21,6 +21,8 @@ pub struct EditFields {
pub append_notes: Option<String>,
/// `None` leaves it unchanged, `Some(None)` clears it. A name is read by the name rule.
pub assignee: Option<Option<String>>,
/// `None` leaves it unchanged, `Some(None)` clears it. A name is already normalized.
pub thread: Option<Option<String>>,
/// `None` leaves it unchanged, `Some(None)` clears it.
pub base: Option<Option<String>>,
/// `None` leaves it unchanged, `Some(None)` clears it. A day is `YYYY-MM-DD`.
Expand Down Expand Up @@ -84,7 +86,7 @@ impl EditError {
}
}

/// Replace the supplied title and/or notes, keeping scope and thread.
/// Replace the supplied fields, keeping scope.
///
/// Whitespace-only notes clear the field. Repeating the stored values writes nothing; a
/// repeated append adds its text again.
Expand Down Expand Up @@ -131,6 +133,7 @@ pub fn run(
notes: fields.notes,
append_notes: fields.append_notes,
assignee,
thread: fields.thread,
base: fields.base,
due: fields.due,
after: fields.after,
Expand Down Expand Up @@ -167,6 +170,7 @@ struct Edit {
notes: Option<String>,
append_notes: Option<String>,
assignee: Option<Option<Assignee>>,
thread: Option<Option<String>>,
base: Option<Option<String>>,
due: Option<Option<String>>,
after: Option<Vec<u64>>,
Expand Down Expand Up @@ -225,6 +229,10 @@ fn apply(
.assignee
.clone()
.unwrap_or_else(|| found.assignee.clone());
let next_thread = fields
.thread
.clone()
.unwrap_or_else(|| found.thread.clone());
let next_base = fields.base.clone().unwrap_or_else(|| found.base.clone());
if let Some(base) = fields.base.as_ref().and_then(|value| value.as_deref()) {
if let Err(error) = crate::git_base::validate_task_base(&found.scope, base, true) {
Expand Down Expand Up @@ -256,6 +264,7 @@ fn apply(
let assignee = fields.assignee.clone().flatten();
if next_title == found.title
&& next_notes == found.notes
&& next_thread == found.thread
&& next_assignee == found.assignee
&& next_base == found.base
&& !changed_after
Expand All @@ -273,6 +282,7 @@ fn apply(
}
let fields_changed = next_title != found.title
|| next_notes != found.notes
|| next_thread != found.thread
|| next_assignee != found.assignee
|| next_base != found.base;
let edited = if fields_changed {
Expand All @@ -281,7 +291,7 @@ fn apply(
&next_title,
next_notes,
found.scope,
found.thread,
next_thread,
next_assignee,
next_base,
)
Expand Down
10 changes: 9 additions & 1 deletion src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ fn run_edit(args: Vec<String>) -> CliOutput {
&& input.append_notes.is_none()
&& input.assignee.is_none()
&& !input.unassign
&& input.thread.is_none()
&& !input.clear_thread
&& input.base.is_none()
&& !input.clear_base
&& input.due.is_none()
Expand All @@ -504,14 +506,19 @@ fn run_edit(args: Vec<String>) -> CliOutput {
&& input.on.is_none()
{
return presenter::edit_usage(
"title, notes, append-notes, assignee, base, due, after, on, --unassign, --clear-base, --clear-due, or --clear-after is required",
"title, notes, append-notes, assignee, thread, base, due, after, on, --unassign, --clear-thread, --clear-base, --clear-due, or --clear-after is required",
);
}
let assignee = if input.unassign {
Some(None)
} else {
input.assignee.map(Some)
};
let thread = if input.clear_thread {
Some(None)
} else {
input.thread.map(Some)
};
let base = if input.clear_base {
Some(None)
} else {
Expand All @@ -532,6 +539,7 @@ fn run_edit(args: Vec<String>) -> CliOutput {
notes: input.notes,
append_notes: input.append_notes,
assignee,
thread,
base,
due,
after: if input.clear_after {
Expand Down
61 changes: 54 additions & 7 deletions src/cli/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,9 @@ pub struct FlagEdit {
pub append_notes: Option<String>,
pub assignee: Option<String>,
pub unassign: bool,
/// `--thread`: normalized at the argv boundary, like `tsk add --thread`.
pub thread: Option<String>,
pub clear_thread: bool,
pub base: Option<String>,
pub clear_base: bool,
/// `--due`: a day as typed. Checked when the edit runs, so a bad date refuses with
Expand All @@ -754,6 +757,12 @@ pub fn parse_assignee(value: &str) -> Result<String, String> {
.map_err(|error| format!("invalid assignee name · {}", thread_refusal_message(error)))
}

/// Parse one `--thread` value by the thread rules.
fn parse_thread(value: &str) -> Result<String, String> {
normalize_thread(value)
.map_err(|error| format!("invalid thread name · {}", thread_refusal_message(error)))
}

/// Parse one `--after` value: a task number, with or without its `T`.
pub fn parse_after_number(value: &str) -> Result<u64, String> {
let digits = value.strip_prefix(['T', 't']).unwrap_or(value);
Expand All @@ -764,7 +773,7 @@ pub fn parse_after_number(value: &str) -> Result<u64, String> {
.ok_or_else(|| format!("invalid --after value {value} · use a task number like T12"))
}

/// Parse `tsk edit <task> [--title <title>] [--notes <notes>]` arguments, including argv0.
/// Parse `tsk edit <task> [<field flags>]` arguments, including argv0.
pub fn parse_flag_edit(args: &[String]) -> Result<FlagEdit, String> {
if args.get(1).map(String::as_str) != Some("edit") {
return Err("expected edit command".into());
Expand All @@ -777,6 +786,8 @@ pub fn parse_flag_edit(args: &[String]) -> Result<FlagEdit, String> {
append_notes: None,
assignee: None,
unassign: false,
thread: None,
clear_thread: false,
base: None,
clear_base: false,
due: None,
Expand Down Expand Up @@ -838,6 +849,18 @@ pub fn parse_flag_edit(args: &[String]) -> Result<FlagEdit, String> {
parsed.unassign = true;
index += 1;
}
flag if flag.starts_with("--thread=") => {
parsed.thread = Some(parse_thread(&flag["--thread=".len()..])?);
index += 1;
}
"--thread" => {
parsed.thread = Some(parse_thread(&value(flag)?)?);
index += 2;
}
"--clear-thread" => {
parsed.clear_thread = true;
index += 1;
}
flag if flag.starts_with("--base=") => {
parsed.base = Some(flag["--base=".len()..].to_owned());
index += 1;
Expand Down Expand Up @@ -901,6 +924,9 @@ pub fn parse_flag_edit(args: &[String]) -> Result<FlagEdit, String> {
if parsed.unassign && parsed.assignee.is_some() {
return Err("--unassign cannot be used with --assignee".into());
}
if parsed.clear_thread && parsed.thread.is_some() {
return Err("--clear-thread cannot be used with --thread".into());
}
if parsed.clear_base && parsed.base.is_some() {
return Err("--clear-base cannot be used with --base".into());
}
Expand Down Expand Up @@ -1206,6 +1232,8 @@ mod tests {
append_notes: None,
assignee: None,
unassign: false,
thread: None,
clear_thread: false,
base: None,
clear_base: false,
due: None,
Expand All @@ -1219,6 +1247,29 @@ mod tests {
);
}

#[test]
fn edit_parses_thread_flags_by_the_thread_rules() {
let args = |rest: &[&str]| {
["tsk", "edit", "T5"]
.iter()
.chain(rest)
.map(|arg| (*arg).to_owned())
.collect::<Vec<_>>()
};
let set = parse_flag_edit(&args(&["--thread", "Auth"])).expect("thread");
assert_eq!(set.thread.as_deref(), Some("auth"));
assert!(!set.clear_thread);
let equals = parse_flag_edit(&args(&["--thread=release"])).expect("thread=");
assert_eq!(equals.thread.as_deref(), Some("release"));
let clear = parse_flag_edit(&args(&["--clear-thread"])).expect("clear");
assert!(clear.clear_thread);
assert_eq!(clear.thread, None);
let invalid = parse_flag_edit(&args(&["--thread", "two words"])).expect_err("invalid");
assert!(invalid.starts_with("invalid thread name · "), "{invalid}");
assert!(parse_flag_edit(&args(&["--thread", "a", "--clear-thread"])).is_err());
assert!(parse_flag_edit(&args(&["--thread"])).is_err());
}

#[test]
fn edit_parses_repeatable_after_and_status_parses_force() {
let args = |command: &str, rest: &[&str]| {
Expand Down Expand Up @@ -1628,9 +1679,7 @@ pub fn parse_flag_add(args: &[String]) -> Result<FlagAdd, String> {
index += 1;
}
flag if flag.starts_with("--thread=") => {
parsed.thread = Some(normalize_thread(&flag["--thread=".len()..]).map_err(
|error| format!("invalid thread name · {}", thread_refusal_message(error)),
)?);
parsed.thread = Some(parse_thread(&flag["--thread=".len()..])?);
parsed.has_item_flags = true;
index += 1;
}
Expand All @@ -1650,9 +1699,7 @@ pub fn parse_flag_add(args: &[String]) -> Result<FlagAdd, String> {
index += 2;
}
"--thread" => {
parsed.thread = Some(normalize_thread(&value(flag)?).map_err(|error| {
format!("invalid thread name · {}", thread_refusal_message(error))
})?);
parsed.thread = Some(parse_thread(&value(flag)?)?);
parsed.has_item_flags = true;
index += 2;
}
Expand Down
10 changes: 8 additions & 2 deletions src/cli/presenter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const STATUS_USAGE: &[&str] = &[
"tsk status <task> review [--done <text>] [--check <text>]... [--next <text>] [--on <who>]",
];
const EDIT_USAGE: &[&str] = &[
"tsk edit <task> [--title <title>] [--notes <notes> | --append-notes <text>] [--assignee <name> | --unassign] [--base <branch> | --clear-base] [--due <date> | --clear-due] [--after <task>]... [--clear-after] [--on <who>] [--state-dir <dir>]",
"tsk edit <task> [--title <title>] [--notes <notes> | --append-notes <text>] [--assignee <name> | --unassign] [--thread <name> | --clear-thread] [--base <branch> | --clear-base] [--due <date> | --clear-due] [--after <task>]... [--clear-after] [--on <who>] [--state-dir <dir>]",
];
const STEPS_USAGE: &[&str] = &[
"tsk steps <task> add <text> [<place>] [--state-dir <dir>]",
Expand Down Expand Up @@ -2261,7 +2261,7 @@ pub fn status_rejected(error: StatusError, task: TaskAddress) -> CliOutput {
pub fn edit_help() -> CliOutput {
help(HelpDoc {
usage: lines(EDIT_USAGE),
purpose: "Change a task's title, notes, assignee, dispatch base, due date, the tasks it runs after, or who its open block or review waits on. Scope and thread stay as they are.".into(),
purpose: "Change a task's title, notes, assignee, thread, dispatch base, due date, the tasks it runs after, or who its open block or review waits on. Scope stays as it is.".into(),
groups: vec![
group("Arguments", &[("<task>", "a task number or UUID")]),
group(
Expand All @@ -2278,6 +2278,11 @@ pub fn edit_help() -> CliOutput {
"assign an agent profile from config.toml, me, or a person's name",
),
("--unassign", "clear the assignee"),
(
"--thread <name>",
"set or change the thread: letters, numbers, hyphens, dots",
),
("--clear-thread", "take the task off its thread"),
(
"--base <branch>",
"dispatch from this existing branch of the project",
Expand Down Expand Up @@ -2311,6 +2316,7 @@ pub fn edit_help() -> CliOutput {
examples: vec![
"tsk edit T12 --title \"Fix timeout on slow connections\"".into(),
"tsk edit T12 --assignee claude --base main".into(),
"tsk edit T12 --thread auth".into(),
"tsk edit T205 --after T202 --after T12".into(),
"tsk edit T12 --on coordinator".into(),
],
Expand Down
Loading
Loading