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
16 changes: 8 additions & 8 deletions .claude/skills/writing-user-outputs/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ address the user. Imperatives like "Run", "Use", "Add" are fine — they're
concise CLI idiom.

```rust
// BAD - "Use 'wt merge' to rebase your changes onto main"
// GOOD - "Use 'wt merge' to rebase onto main"
// BAD - "To rebase your changes onto main, run wt merge"
// GOOD - "To rebase onto main, run wt merge"
```

**Avoid redundant parenthesized content:** Parenthesized text should add new
Expand Down Expand Up @@ -292,10 +292,10 @@ mentioned in the error message.
```rust
// BAD - "it" refers to branch name in error message
// Error: "Branch 'feature' not found"
// Hint: "Use --create to create it"
// Hint: "To create it, use --create"
// GOOD - self-contained hint
// Error: "Branch 'feature' not found"
// Hint: "Use --create to create a new branch"
// Hint: "To create a new branch, use --create"
```

## Heading Case
Expand Down Expand Up @@ -763,7 +763,7 @@ Use `eprintln!` with formatting functions. Use `cformat!` for inner styling:

```rust
eprintln!("{}", success_message(cformat!("Created <bold>{branch}</> from <bold>{base}</>")));
eprintln!("{}", hint_message(cformat!("Run <underline>wt merge</> to continue")));
eprintln!("{}", hint_message(cformat!("To continue, run <underline>wt merge</>")));
```

**color-print tags:** `<bold>`, `<dim>`, `<underline>`, `<bright-black>`, `<red>`,
Expand All @@ -790,11 +790,11 @@ Never quote commands or branch names. Use styling to make them stand out:

```rust
// GOOD - bold in normal context
eprintln!("{}", info_message(cformat!("Use <bold>wt merge</> to continue")));
eprintln!("{}", info_message(cformat!("To continue, use <bold>wt merge</>")));
// GOOD - underline for commands in hints
eprintln!("{}", hint_message(cformat!("Run <underline>wt list</> to see worktrees")));
eprintln!("{}", hint_message(cformat!("To see worktrees, run <underline>wt list</>")));
// BAD - quoted commands
eprintln!("{}", hint_message("Run 'wt list' to see worktrees"));
eprintln!("{}", hint_message("To see worktrees, run 'wt list'"));
```

## Hyperlinks
Expand Down
2 changes: 1 addition & 1 deletion src/commands/config/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ pub fn handle_state_get(
"default-branch" => {
let branch_name = repo.default_branch().ok_or_else(|| {
anyhow::anyhow!(cformat!(
"Cannot determine default branch. To configure, run <bold>wt config state default-branch set BRANCH</>"
"Cannot determine default branch; to configure one, run <bold>wt config state default-branch set BRANCH</>"
))
})?;
println!("{branch_name}");
Expand Down
2 changes: 1 addition & 1 deletion src/commands/step/promote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ fn print_promote_announcement(is_restoring: bool, default_branch: Option<&str>)
eprintln!(
"{}",
hint_message(cformat!(
"Run <underline>wt step promote {default}</> to restore canonical locations"
"To restore canonical locations, run <underline>wt step promote {default}</>"
))
);
}
Expand Down
7 changes: 4 additions & 3 deletions src/commands/step/relocate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! See `src/commands/relocate.rs` for the implementation details and algorithm.

use anyhow::Context;
use color_print::cformat;

use std::path::PathBuf;

Expand Down Expand Up @@ -43,9 +44,9 @@ pub fn step_relocate(

// Validate default branch early - needed for main worktree relocation
if default_branch.is_empty() {
anyhow::bail!(
"Cannot determine default branch; set with: wt config state default-branch set main"
);
anyhow::bail!(cformat!(
"Cannot determine default branch; to configure one, run <bold>wt config state default-branch set BRANCH</>"
));
}
let repo_path = repo.repo_path()?.to_path_buf();

Expand Down
10 changes: 6 additions & 4 deletions src/git/recover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ fn hint_for_repo(repo: &Repository) -> String {
.flatten()
.is_some_and(|p| !repo.worktree_is_unusable(&p).unwrap_or(true))
{
return cformat!("Current directory was removed. Try: <underline>wt switch ^</>");
return cformat!(
"Current directory was removed; to switch to the default branch, run <underline>wt switch ^</>"
);
}

cformat!("Current directory was removed. Run <underline>wt list</> to see worktrees")
cformat!("Current directory was removed; to see worktrees, run <underline>wt list</>")
}

/// Attempt to recover a repository when the current directory has been deleted.
Expand Down Expand Up @@ -513,7 +515,7 @@ mod tests {
// A normal repo with a main worktree should suggest `wt switch ^`.
let test = TestRepo::with_initial_commit();
let hint = hint_for_repo(&test.repo);
insta::assert_snapshot!(hint.ansi_strip(), @"Current directory was removed. Try: wt switch ^");
insta::assert_snapshot!(hint.ansi_strip(), @"Current directory was removed; to switch to the default branch, run wt switch ^");
}

#[test]
Expand All @@ -522,6 +524,6 @@ mod tests {
// so it should suggest `wt list` instead of `wt switch ^`.
let test = TestRepo::bare();
let hint = hint_for_repo(&test.repo);
insta::assert_snapshot!(hint.ansi_strip(), @"Current directory was removed. Run wt list to see worktrees");
insta::assert_snapshot!(hint.ansi_strip(), @"Current directory was removed; to see worktrees, run wt list");
}
}
2 changes: 1 addition & 1 deletion src/git/repository/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ impl Repository {
.ok_or_else(|| {
GitError::Other {
message: cformat!(
"Cannot determine default branch. Specify target explicitly or run <bold>wt config state default-branch set BRANCH</>"
"Cannot determine default branch; specify the target explicitly, or to configure one, run <bold>wt config state default-branch set BRANCH</>"
),
}
.into()
Expand Down
4 changes: 2 additions & 2 deletions src/git/repository/worktrees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ impl Repository {
self.switch_previous().ok_or_else(|| {
GitError::Other {
message: cformat!(
"No previous branch found in history. Run <underline>wt list</> to see available worktrees."
"No previous branch found in history; to see available worktrees, run <bold>wt list</>"
),
}
.into()
Expand All @@ -359,7 +359,7 @@ impl Repository {
"^" => self.default_branch().ok_or_else(|| {
GitError::Other {
message: cformat!(
"Cannot determine default branch. Specify target explicitly or run <underline>wt config state default-branch set <bold>BRANCH</></>"
"Cannot determine default branch; specify the target explicitly, or to configure one, run <bold>wt config state default-branch set BRANCH</>"
),
}
.into()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/config_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ fn test_state_get_default_branch_fails_when_undetermined(repo: TestRepo) {
.output()
.unwrap();
assert!(!output.status.success());
assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"✗ Cannot determine default branch. To configure, run wt config state default-branch set BRANCH");
assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"✗ Cannot determine default branch; to configure one, run wt config state default-branch set BRANCH");
}

#[rstest]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ exit_code: 0

----- stderr -----
▲ Promoting creates mismatched worktree state (shown as ⚑ in wt list)
↳ Run wt step promote main to restore canonical locations
↳ To restore canonical locations, run wt step promote main
✓ Promoted: main worktree now has feature; _REPO_.feature now has main
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ exit_code: 0

----- stderr -----
▲ Promoting creates mismatched worktree state (shown as ⚑ in wt list)
↳ Run wt step promote main to restore canonical locations
↳ To restore canonical locations, run wt step promote main
✓ Promoted: main worktree now has feature; _REPO_.feature now has main
✓ Swapped 4 gitignored paths
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ exit_code: 0

----- stderr -----
▲ Promoting creates mismatched worktree state (shown as ⚑ in wt list)
↳ Run wt step promote main to restore canonical locations
↳ To restore canonical locations, run wt step promote main
✓ Promoted: main worktree now has feature; _REPO_.feature now has main
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ exit_code: 0

----- stderr -----
▲ Promoting creates mismatched worktree state (shown as ⚑ in wt list)
↳ Run wt step promote main to restore canonical locations
↳ To restore canonical locations, run wt step promote main
✓ Promoted: main worktree now has feature; _REPO_.feature now has main
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ exit_code: 1
----- stdout -----

----- stderr -----
✗ Cannot determine default branch; set with: wt config state default-branch set main
✗ Cannot determine default branch; to configure one, run wt config state default-branch set BRANCH
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ exit_code: 1
----- stdout -----

----- stderr -----
✗ No previous branch found in history. Run wt list to see available worktrees.
✗ No previous branch found in history; to see available worktrees, run wt list
Loading