diff --git a/AGENTS.md b/AGENTS.md index 1a108a4..d8c87a6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,3 +39,4 @@ Tests create temporary `.worklane` directories with all four status folders pre- - When working on a ticket use `worklane show [ticketID]` to read the ticket. - If the ticket is in the backlog, move it to committed using `worklane mv --status committed [ticketID]`. - When your changes meet the acceptance criteria and the code compiles, move the ticket to reviewing using `worklane mv --status reviewing [ticketID]` +- If you need more information on how to use `worklane`, use the worklane kanban skill diff --git a/src/main.rs b/src/main.rs index 18f2317..b5cddc9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -250,6 +250,23 @@ fn cmd_ls(status_filter: &Option, worklane_dir: &Path) -> Result<()> { Ok(()) } +fn get_git_user() -> Option { + std::process::Command::new("git") + .args(&["config", "user.name"]) + .output() + .ok() + .and_then(|out| { + if out.status.success() { + String::from_utf8(out.stdout) + .ok() + .map(|s| s.trim().to_string()) + .filter(|s| !s.is_empty()) + } else { + None + } + }) +} + fn cmd_add( title: &str, description: &Option, @@ -260,6 +277,10 @@ fn cmd_add( owner: &Option, start: &Path, ) -> Result<()> { + let owner = match owner { + Some(o) => Some(o.clone()), + None => get_git_user(), + }; let worklane_dir = find_worklane_dir(start)?; let backlog_dir = worklane_dir.join("backlog");