A file-based task manager
0
fork

Configure Feed

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

tsk inbox auto-pulls before listing

Inbox listings now reflect what other clones have sent: tsk inbox
runs git_pull_refs first against "origin" if that remote is
configured, then prints the result.

Pass -r <name> to use a different remote, or -r "" to explicitly skip
the pull (useful when offline or for testing). File-backed workspaces
and git workspaces without an "origin" remote skip silently.

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

+36 -4
+36 -4
src/main.rs
··· 26 26 27 27 const NEW_SENTINEL: &str = "<new>"; 28 28 29 + /// Resolve the remote to use for an auto-sync command. If the user supplied 30 + /// `Some("")`, returns None (explicit skip). If `Some(name)`, returns that 31 + /// name. If `None`, returns "origin" if that remote is configured in git; 32 + /// otherwise None (so file-backed workspaces and clones without a configured 33 + /// origin fall through silently). 34 + fn effective_remote(ws: &Workspace, supplied: Option<String>) -> Result<Option<String>> { 35 + if let Some(s) = supplied { 36 + if s.is_empty() { 37 + return Ok(None); 38 + } 39 + return Ok(Some(s)); 40 + } 41 + if !ws.is_git_backed() { 42 + return Ok(None); 43 + } 44 + let marker = std::fs::read_to_string(ws.path.join(backend::GIT_BACKED_MARKER))?; 45 + let repo = git2::Repository::open(PathBuf::from(marker.trim()))?; 46 + if repo.find_remote("origin").is_ok() { 47 + Ok(Some("origin".to_string())) 48 + } else { 49 + Ok(None) 50 + } 51 + } 52 + 29 53 /// `[[tsk-N]]` → Some(Id(N)). Anything else (including foreign links) → None. 30 54 fn parse_internal_link_for_cli(s: &str) -> Option<Id> { 31 55 let inner = s.trim().strip_prefix("[[")?.strip_suffix("]]")?; ··· 237 261 task_id: TaskId, 238 262 }, 239 263 240 - /// List tasks pending in the current namespace's inbox. 241 - Inbox, 264 + /// List tasks pending in the current namespace's inbox. Pulls from a 265 + /// remote first so the listing reflects what others have sent. Defaults 266 + /// to "origin" if that remote exists; pass -r "" to skip the pull. 267 + Inbox { 268 + #[arg(short = 'r')] 269 + remote: Option<String>, 270 + }, 242 271 243 272 /// Accept a pending inbox item, creating a new local task with copied 244 273 /// content + properties and `source=[[<src-ns>/tsk-N]]` set. ··· 490 519 Commands::GitPush { remote } => command_git_push(dir, remote), 491 520 Commands::GitPull { remote } => command_git_pull(dir, remote), 492 521 Commands::Assign { target, task_id } => command_assign(dir, target, task_id), 493 - Commands::Inbox => command_inbox(dir), 522 + Commands::Inbox { remote } => command_inbox(dir, remote), 494 523 Commands::Accept { key } => command_accept(dir, key), 495 524 Commands::Bundle { output } => command_bundle(dir, output), 496 525 Commands::Migrate => command_migrate(dir), ··· 897 926 Ok(()) 898 927 } 899 928 900 - fn command_inbox(dir: PathBuf) -> Result<()> { 929 + fn command_inbox(dir: PathBuf, remote: Option<String>) -> Result<()> { 901 930 let ws = Workspace::from_path(dir)?; 931 + if let Some(r) = effective_remote(&ws, remote)? { 932 + ws.git_pull_refs(&r)?; 933 + } 902 934 let items = ws.list_inbox()?; 903 935 if items.is_empty() { 904 936 println!("Inbox is empty.");