A file-based task manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Auto git-push on `tsk reject` and default origin for git-push/git-pull

Reject mirrors assign: pushes refs to "origin" by default after writing
the rejection event into the source's log. `-r NAME` selects a different
remote; `-r ""` skips.

`tsk git-push` and `tsk git-pull` now treat the remote argument as
optional, defaulting to "origin" when configured. Errors out when no
remote is supplied and no origin is set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+25 -11
+25 -11
src/main.rs
··· 240 240 }, 241 241 242 242 /// Push refs/tsk/* to a git remote so other clones can pull task state. 243 + /// Defaults to "origin" when configured. 243 244 GitPush { 244 - /// Remote name (e.g. origin). 245 - remote: String, 245 + /// Remote name. Defaults to "origin". 246 + remote: Option<String>, 246 247 }, 247 248 248 249 /// Fetch refs/tsk/* from a git remote, overwriting local task state. 250 + /// Defaults to "origin" when configured. 249 251 GitPull { 250 - /// Remote name (e.g. origin). 251 - remote: String, 252 + /// Remote name. Defaults to "origin". 253 + remote: Option<String>, 252 254 }, 253 255 254 256 /// Assign a task to another namespace by sending it to that namespace's ··· 283 285 284 286 /// Reject a pending inbox item, removing it without creating a local task. 285 287 /// Writes a `rejected` event to the source's event log so the assignor 286 - /// sees it. 288 + /// sees it. Auto-pushes refs to "origin" when configured; pass -r NAME 289 + /// to use a different remote or -r "" to skip the push. 287 290 Reject { 288 291 /// Inbox key (e.g. `alice-3` or `inbox/alice-3`). With no argument, 289 292 /// rejects the first item in the inbox. 290 293 key: Option<String>, 294 + #[arg(short = 'r')] 295 + remote: Option<String>, 291 296 }, 292 297 293 298 /// Bundle the entire workspace into a zip archive. ··· 538 543 } => command_assign(dir, target, task_id, remote), 539 544 Commands::Inbox { remote } => command_inbox(dir, remote), 540 545 Commands::Accept { key } => command_accept(dir, key), 541 - Commands::Reject { key } => command_reject(dir, key), 546 + Commands::Reject { key, remote } => command_reject(dir, key, remote), 542 547 Commands::Bundle { output } => command_bundle(dir, output), 543 548 Commands::Migrate => command_migrate(dir), 544 549 Commands::MigrateHistory => command_migrate_history(dir), ··· 882 887 Ok(()) 883 888 } 884 889 885 - fn command_git_push(dir: PathBuf, remote: String) -> Result<()> { 890 + fn command_git_push(dir: PathBuf, remote: Option<String>) -> Result<()> { 886 891 let workspace = Workspace::from_path(dir)?; 887 - workspace.git_push_refs(&remote) 892 + let r = effective_remote(&workspace, remote)?.ok_or_else(|| { 893 + errors::Error::Parse("No remote specified and no 'origin' configured".into()) 894 + })?; 895 + workspace.git_push_refs(&r) 888 896 } 889 897 890 - fn command_git_pull(dir: PathBuf, remote: String) -> Result<()> { 898 + fn command_git_pull(dir: PathBuf, remote: Option<String>) -> Result<()> { 891 899 let workspace = Workspace::from_path(dir)?; 892 - workspace.git_pull_refs(&remote) 900 + let r = effective_remote(&workspace, remote)?.ok_or_else(|| { 901 + errors::Error::Parse("No remote specified and no 'origin' configured".into()) 902 + })?; 903 + workspace.git_pull_refs(&r) 893 904 } 894 905 895 906 fn command_git_setup(dir: PathBuf, use_gitignore: bool, remote: Option<String>) -> Result<()> { ··· 991 1002 Ok(()) 992 1003 } 993 1004 994 - fn command_reject(dir: PathBuf, key: Option<String>) -> Result<()> { 1005 + fn command_reject(dir: PathBuf, key: Option<String>, remote: Option<String>) -> Result<()> { 995 1006 let ws = Workspace::from_path(dir)?; 996 1007 let key = match key { 997 1008 Some(k) => k, ··· 1005 1016 }; 1006 1017 let (src_ns, src_id) = ws.reject_inbox(&key)?; 1007 1018 eprintln!("Rejected inbox item from {src_ns}/tsk-{src_id}"); 1019 + if let Some(r) = effective_remote(&ws, remote)? { 1020 + ws.git_push_refs(&r)?; 1021 + } 1008 1022 Ok(()) 1009 1023 } 1010 1024