Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Align user messages with output formatting guidelines
Maximilian Roos969bf82077e3
diff --git a/.claude/rules/cli-output-formatting.md b/.claude/rules/cli-output-formatting.mdindex 62ced8666..f34b4734e 100644--- a/.claude/rules/cli-output-formatting.md+++ b/.claude/rules/cli-output-formatting.md@@ -112,22 +112,22 @@ Use **sentence case** for help text headings: "Configuration files", "JSON outpu## Message Consistency Patterns-Use consistent punctuation and structure for related messages:+Use consistent punctuation and structure for related messages.-**Semicolon for qualifiers:** Separate the action from a qualifier/reason:+**Ampersand for combined actions:** Use `&` when a single operation does+multiple things:```rust-// Action; qualifier (flag)-"Removing feature worktree in background; retaining branch (--no-delete-branch)"-"Commands approved; not saved (--yes)"+"Removing feature worktree & branch in background"+"Commands approved & saved to config"```-**Ampersand for conjunctions:** Use `&` for combined actions:+**Semicolon for joining clauses:** Use semicolons to connect related information:```rust-// Action & additional action-"Removing feature worktree & branch in background"-"Commands approved & saved to config"+"Removing feature worktree in background; retaining branch (--no-delete-branch)"+"Branch unmerged; to delete, run <bright-black>wt remove -D</>" // hint uses bright-black+"{tool} not authenticated; run <bold>{tool} auth login</>" // warning uses bold```**Explicit flag acknowledgment:** Show flags in parentheses when they change@@ -343,6 +343,20 @@ clearer:"To proceed, commit or stash changes first"```+**Description + command in single message:** For warnings/errors that include a+recovery command, join with semicolon. Use `<bold>` for commands in+warnings/errors (only hints use `<bright-black>`):++```rust+// Warning with inline recovery command (bold for commands)+warning_message("Failed to restore stash; run <bold>git stash pop {ref}</> to restore manually")+warning_message("{tool} not authenticated; run <bold>{tool} auth login</>")++// For longer suggestions, use separate hint message (bright-black for commands)+warning_message("Failed to restore stash")+hint_message("To restore manually, run <bright-black>git stash pop {ref}</>")+```+**Multiple suggestions in one hint:** When combining suggestions with semicolons,put the more commonly needed command last for easy terminal copying:diff --git a/src/commands/config.rs b/src/commands/config.rsindex 8c17a0c77..a37a2a7c1 100644--- a/src/commands/config.rs+++ b/src/commands/config.rs@@ -1066,7 +1066,9 @@ pub fn handle_state_get(key: &str, branch: Option<String>) -> anyhow::Result<()>match key {"default-branch" => {let branch_name = repo.default_branch().ok_or_else(|| {- anyhow::anyhow!("Cannot determine default branch. Run 'wt config state default-branch set <branch>' to configure.")+ anyhow::anyhow!(cformat!(+ "Cannot determine default branch. To configure, run <bold>wt config state default-branch set BRANCH</>"+ ))})?;crate::output::stdout(branch_name)?;}diff --git a/src/commands/repository_ext.rs b/src/commands/repository_ext.rsindex 1e613c838..10f9785c0 100644--- a/src/commands/repository_ext.rs+++ b/src/commands/repository_ext.rs@@ -394,20 +394,18 @@ impl StashData {format_path_for_display(&self.path))));- let Ok(repo) = Repository::current() else {+ let success = Repository::current()+ .ok()+ .and_then(|repo| {+ repo.worktree_at(&self.path)+ .run_command(&["stash", "pop", "--quiet", &self.stash_ref])+ .ok()+ })+ .is_some();++ if !success {let _ = crate::output::print(warning_message(cformat!(- "Failed to restore stash <bold>{stash_ref}</> - run <bold>git stash pop {stash_ref}</> in <bold>{path}</>",- stash_ref = self.stash_ref,- path = format_path_for_display(&self.path),- )));- return;- };- if let Err(_e) =- repo.worktree_at(&self.path)- .run_command(&["stash", "pop", "--quiet", &self.stash_ref])- {- let _ = crate::output::print(warning_message(cformat!(- "Failed to restore stash <bold>{stash_ref}</> - run <bold>git stash pop {stash_ref}</> in <bold>{path}</>",+ "Failed to restore stash <bold>{stash_ref}</>; run <bold>git stash pop {stash_ref}</> in <bold>{path}</>",stash_ref = self.stash_ref,path = format_path_for_display(&self.path),)));diff --git a/src/git/repository/config.rs b/src/git/repository/config.rsindex 9183bbf86..df4f7af89 100644--- a/src/git/repository/config.rs+++ b/src/git/repository/config.rs@@ -1,6 +1,7 @@//! Git config, hints, marker, and default branch operations for Repository.use anyhow::Context;+use color_print::cformat;use crate::config::ProjectConfig;@@ -229,7 +230,9 @@ impl Repository {Some(b) => self.resolve_worktree_name(b),None => self.default_branch().ok_or_else(|| {GitError::Other {- message: "Cannot determine default branch. Specify target explicitly or run 'wt config state default-branch set <branch>'.".into(),+ message: cformat!(+ "Cannot determine default branch. Specify target explicitly or run <bold>wt config state default-branch set BRANCH</>"+ ),}.into()}),