Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Widen help text wrapping from 80 to 100 chars for web docs (#1786)
Maximilian Roos33b87f0b952f
diff --git a/docs/content/list.md b/docs/content/list.mdindex 06585a7f6..be1e82c47 100644--- a/docs/content/list.md+++ b/docs/content/list.md@@ -266,9 +266,9 @@ Usage: <b><span class=c>wt list</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--progressive</span></b>Show fast info immediately, update with slow info- Displays local data (branches, paths, status) first, then updates with- remote data (CI, upstream) as it arrives. Use --no-progressive to- force buffered rendering. Auto-enabled for TTY.+ Displays local data (branches, paths, status) first, then updates with remote data (CI,+ upstream) as it arrives. Use --no-progressive to force buffered rendering. Auto-enabled+ for TTY.<b><span class=c>-h</span></b>, <b><span class=c>--help</span></b>Print help (see a summary with '-h')diff --git a/docs/content/merge.md b/docs/content/merge.mdindex 0c02f2333..406a6639a 100644--- a/docs/content/merge.md+++ b/docs/content/merge.md@@ -116,8 +116,7 @@ Usage: <b><span class=c>wt merge</span></b> <span class=c>[OPTIONS]</span> <spanWhat to stage before committing [default: all]Possible values:- - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked- changes+ - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked changes- <b><span class=c>tracked</span></b>: Stage tracked changes only (like <b>git add -u</b>)- <b><span class=c>none</span></b>: Stage nothing, commit only what's already in the indexdiff --git a/docs/content/remove.md b/docs/content/remove.mdindex 596e5d9aa..a599ec4b5 100644--- a/docs/content/remove.md+++ b/docs/content/remove.md@@ -101,8 +101,8 @@ Usage: <b><span class=c>wt remove</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>-f</span></b>, <b><span class=c>--force</span></b>Force worktree removal- Remove worktrees even if they contain untracked files (like build- artifacts). Without this flag, removal fails if untracked files exist.+ Remove worktrees even if they contain untracked files (like build artifacts). Without this+ flag, removal fails if untracked files exist.<b><span class=c>-h</span></b>, <b><span class=c>--help</span></b>Print help (see a summary with '-h')diff --git a/docs/content/step.md b/docs/content/step.mdindex 23dab158a..10db87718 100644--- a/docs/content/step.md+++ b/docs/content/step.md@@ -46,8 +46,7 @@ Manual merge workflow with review between steps:{% terminal() %}wt step - Run individual operations-The building blocks of <b>wt merge</b> — commit, squash, rebase, push — plus standalone-utilities.+The building blocks of <b>wt merge</b> — commit, squash, rebase, push — plus standalone utilities.Usage: <b><span class=c>wt step</span></b> <span class=c>[OPTIONS]</span> <span class=c><COMMAND></span>@@ -126,8 +125,7 @@ Usage: <b><span class=c>wt step commit</span></b> <span class=c>[OPTIONS]</span>What to stage before committing [default: all]Possible values:- - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked- changes+ - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked changes- <b><span class=c>tracked</span></b>: Stage tracked changes only (like <b>git add -u</b>)- <b><span class=c>none</span></b>: Stage nothing, commit only what's already in the index@@ -210,8 +208,7 @@ Usage: <b><span class=c>wt step squash</span></b> <span class=c>[OPTIONS]</span>What to stage before committing [default: all]Possible values:- - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked- changes+ - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked changes- <b><span class=c>tracked</span></b>: Stage tracked changes only (like <b>git add -u</b>)- <b><span class=c>none</span></b>: Stage nothing, commit only what's already in the indexdiff --git a/docs/content/switch.md b/docs/content/switch.mdindex 1ffce623f..a46c6e3c8 100644--- a/docs/content/switch.md+++ b/docs/content/switch.md@@ -128,15 +128,14 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<span class=c>[BRANCH]</span>Branch name or shortcut- Opens interactive picker if omitted. Shortcuts: '^' (default branch),- '-' (previous), '@' (current), 'pr:{N}' (GitHub PR), 'mr:{N}' (GitLab- MR)+ Opens interactive picker if omitted. Shortcuts: '^' (default branch), '-' (previous), '@'+ (current), 'pr:{N}' (GitHub PR), 'mr:{N}' (GitLab MR)<span class=c>[EXECUTE_ARGS]...</span>Additional arguments for --execute command (after --)- Arguments after <b>--</b> are appended to the execute command. Each argument- is expanded for templates, then POSIX shell-escaped.+ Arguments after <b>--</b> are appended to the execute command. Each argument is expanded for+ templates, then POSIX shell-escaped.<b><span class=g>Options:</span></b><b><span class=c>-c</span></b>, <b><span class=c>--create</span></b>@@ -150,26 +149,23 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>-x</span></b>, <b><span class=c>--execute</span></b><span class=c> <EXECUTE></span>Command to run after switch- Replaces the wt process with the command after switching, giving it- full terminal control. Useful for launching editors, AI agents, or- other interactive tools.+ Replaces the wt process with the command after switching, giving it full terminal control.+ Useful for launching editors, AI agents, or other interactive tools.- Supports <u>hook template variables</u> (<b>{{ branch }}</b>, <b>{{ worktree_path }}</b>,- etc.) and filters. <b>{{ base }}</b> and <b>{{ base_worktree_path }}</b> require- --create.+ Supports <u>hook template variables</u> (<b>{{ branch }}</b>, <b>{{ worktree_path }}</b>, etc.) and filters. <b>{{</b>+<b> base }}</b> and <b>{{ base_worktree_path }}</b> require <b>--create</b>.Especially useful with shell aliases:<b>alias wsc='wt switch --create -x claude'</b><b>wsc feature-branch -- 'Fix GH #322'</b>- Then <b>wsc feature-branch</b> creates the worktree and launches Claude Code.- Arguments after <b>--</b> are passed to the command, so <b>wsc feature -- 'Fix</b>- GH #322' runs <b>claude 'Fix GH #322'</b>, starting Claude with a prompt.+ Then <b>wsc feature-branch</b> creates the worktree and launches Claude Code. Arguments after <b>--</b>+ are passed to the command, so <b>wsc feature -- 'Fix GH #322'</b> runs <b>claude 'Fix GH #322'</b>,+ starting Claude with a prompt.- Template example: <b>-x 'code {{ worktree_path }}'</b> opens VS Code at the- worktree, <b>-x 'tmux new -s {{ branch | sanitize }}'</b> starts a tmux- session named after the branch.+ Template example: <b>-x 'code {{ worktree_path }}'</b> opens VS Code at the worktree, <b>-x 'tmux</b>+<b> new -s {{ branch | sanitize }}'</b> starts a tmux session named after the branch.<b><span class=c>--clobber</span></b>Remove stale paths at target@@ -177,11 +173,11 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--no-cd</span></b>Skip directory change after switching- Hooks still run normally. Useful when hooks handle navigation (e.g.,- tmux workflows) or for CI/automation. Use --cd to override.+ Hooks still run normally. Useful when hooks handle navigation (e.g., tmux workflows) or+ for CI/automation. Use --cd to override.- In picker mode (no branch argument), prints the selected branch name- and exits without switching. Useful for scripting.+ In picker mode (no branch argument), prints the selected branch name and exits without+ switching. Useful for scripting.<b><span class=c>-h</span></b>, <b><span class=c>--help</span></b>Print help (see a summary with '-h')diff --git a/skills/worktrunk/reference/list.md b/skills/worktrunk/reference/list.mdindex 9766fda59..b3c791853 100644--- a/skills/worktrunk/reference/list.md+++ b/skills/worktrunk/reference/list.md@@ -255,9 +255,9 @@ Usage: <b><span class=c>wt list</span></b> <span class=c>[OPTIONS]</span><b><span class=c>--progressive</span></b>Show fast info immediately, update with slow info- Displays local data (branches, paths, status) first, then updates with- remote data (CI, upstream) as it arrives. Use --no-progressive to- force buffered rendering. Auto-enabled for TTY.+ Displays local data (branches, paths, status) first, then updates with remote data (CI,+ upstream) as it arrives. Use --no-progressive to force buffered rendering. Auto-enabled+ for TTY.<b><span class=c>-h</span></b>, <b><span class=c>--help</span></b>Print help (see a summary with '-h')diff --git a/skills/worktrunk/reference/merge.md b/skills/worktrunk/reference/merge.mdindex f7be30718..270f3e3b0 100644--- a/skills/worktrunk/reference/merge.md+++ b/skills/worktrunk/reference/merge.md@@ -105,8 +105,7 @@ Usage: <b><span class=c>wt merge</span></b> <span class=c>[OPTIONS]</span> <spanWhat to stage before committing [default: all]Possible values:- - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked- changes+ - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked changes- <b><span class=c>tracked</span></b>: Stage tracked changes only (like <b>git add -u</b>)- <b><span class=c>none</span></b>: Stage nothing, commit only what's already in the indexdiff --git a/skills/worktrunk/reference/remove.md b/skills/worktrunk/reference/remove.mdindex c1dfd1226..a493df9c2 100644--- a/skills/worktrunk/reference/remove.md+++ b/skills/worktrunk/reference/remove.md@@ -96,8 +96,8 @@ Usage: <b><span class=c>wt remove</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>-f</span></b>, <b><span class=c>--force</span></b>Force worktree removal- Remove worktrees even if they contain untracked files (like build- artifacts). Without this flag, removal fails if untracked files exist.+ Remove worktrees even if they contain untracked files (like build artifacts). Without this+ flag, removal fails if untracked files exist.<b><span class=c>-h</span></b>, <b><span class=c>--help</span></b>Print help (see a summary with '-h')diff --git a/skills/worktrunk/reference/step.md b/skills/worktrunk/reference/step.mdindex 0e3e0b7ca..29c60f52f 100644--- a/skills/worktrunk/reference/step.md+++ b/skills/worktrunk/reference/step.md@@ -35,8 +35,7 @@ $ wt step commit|||wt step squash|||wt step rebase|||wt step pushwt step - Run individual operations-The building blocks of <b>wt merge</b> — commit, squash, rebase, push — plus standalone-utilities.+The building blocks of <b>wt merge</b> — commit, squash, rebase, push — plus standalone utilities.Usage: <b><span class=c>wt step</span></b> <span class=c>[OPTIONS]</span> <span class=c><COMMAND></span>@@ -117,8 +116,7 @@ Usage: <b><span class=c>wt step commit</span></b> <span class=c>[OPTIONS]</span>What to stage before committing [default: all]Possible values:- - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked- changes+ - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked changes- <b><span class=c>tracked</span></b>: Stage tracked changes only (like <b>git add -u</b>)- <b><span class=c>none</span></b>: Stage nothing, commit only what's already in the index@@ -203,8 +201,7 @@ Usage: <b><span class=c>wt step squash</span></b> <span class=c>[OPTIONS]</span>What to stage before committing [default: all]Possible values:- - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked- changes+ - <b><span class=c>all</span></b>: Stage everything: untracked files + unstaged tracked changes- <b><span class=c>tracked</span></b>: Stage tracked changes only (like <b>git add -u</b>)- <b><span class=c>none</span></b>: Stage nothing, commit only what's already in the indexdiff --git a/skills/worktrunk/reference/switch.md b/skills/worktrunk/reference/switch.mdindex 2a4ba0ff3..86517dffe 100644--- a/skills/worktrunk/reference/switch.md+++ b/skills/worktrunk/reference/switch.md@@ -106,15 +106,14 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<span class=c>[BRANCH]</span>Branch name or shortcut- Opens interactive picker if omitted. Shortcuts: '^' (default branch),- '-' (previous), '@' (current), 'pr:{N}' (GitHub PR), 'mr:{N}' (GitLab- MR)+ Opens interactive picker if omitted. Shortcuts: '^' (default branch), '-' (previous), '@'+ (current), 'pr:{N}' (GitHub PR), 'mr:{N}' (GitLab MR)<span class=c>[EXECUTE_ARGS]...</span>Additional arguments for --execute command (after --)- Arguments after <b>--</b> are appended to the execute command. Each argument- is expanded for templates, then POSIX shell-escaped.+ Arguments after <b>--</b> are appended to the execute command. Each argument is expanded for+ templates, then POSIX shell-escaped.<b><span class=g>Options:</span></b><b><span class=c>-c</span></b>, <b><span class=c>--create</span></b>@@ -128,26 +127,23 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>-x</span></b>, <b><span class=c>--execute</span></b><span class=c> <EXECUTE></span>Command to run after switch- Replaces the wt process with the command after switching, giving it- full terminal control. Useful for launching editors, AI agents, or- other interactive tools.+ Replaces the wt process with the command after switching, giving it full terminal control.+ Useful for launching editors, AI agents, or other interactive tools.- Supports <u>hook template variables</u> (<b>{{ branch }}</b>, <b>{{ worktree_path }}</b>,- etc.) and filters. <b>{{ base }}</b> and <b>{{ base_worktree_path }}</b> require- --create.+ Supports <u>hook template variables</u> (<b>{{ branch }}</b>, <b>{{ worktree_path }}</b>, etc.) and filters. <b>{{</b>+<b> base }}</b> and <b>{{ base_worktree_path }}</b> require <b>--create</b>.Especially useful with shell aliases:<b>alias wsc='wt switch --create -x claude'</b><b>wsc feature-branch -- 'Fix GH #322'</b>- Then <b>wsc feature-branch</b> creates the worktree and launches Claude Code.- Arguments after <b>--</b> are passed to the command, so <b>wsc feature -- 'Fix</b>- GH #322' runs <b>claude 'Fix GH #322'</b>, starting Claude with a prompt.+ Then <b>wsc feature-branch</b> creates the worktree and launches Claude Code. Arguments after <b>--</b>+ are passed to the command, so <b>wsc feature -- 'Fix GH #322'</b> runs <b>claude 'Fix GH #322'</b>,+ starting Claude with a prompt.- Template example: <b>-x 'code {{ worktree_path }}'</b> opens VS Code at the- worktree, <b>-x 'tmux new -s {{ branch | sanitize }}'</b> starts a tmux- session named after the branch.+ Template example: <b>-x 'code {{ worktree_path }}'</b> opens VS Code at the worktree, <b>-x 'tmux</b>+<b> new -s {{ branch | sanitize }}'</b> starts a tmux session named after the branch.<b><span class=c>--clobber</span></b>Remove stale paths at target@@ -155,11 +151,11 @@ Usage: <b><span class=c>wt switch</span></b> <span class=c>[OPTIONS]</span> <spa<b><span class=c>--no-cd</span></b>Skip directory change after switching- Hooks still run normally. Useful when hooks handle navigation (e.g.,- tmux workflows) or for CI/automation. Use --cd to override.+ Hooks still run normally. Useful when hooks handle navigation (e.g., tmux workflows) or+ for CI/automation. Use --cd to override.- In picker mode (no branch argument), prints the selected branch name- and exits without switching. Useful for scripting.+ In picker mode (no branch argument), prints the selected branch name and exits without+ switching. Useful for scripting.<b><span class=c>-h</span></b>, <b><span class=c>--help</span></b>Print help (see a summary with '-h')diff --git a/src/help.rs b/src/help.rsindex 22b7a8dcf..fbe078b10 100644--- a/src/help.rs+++ b/src/help.rs@@ -386,8 +386,8 @@ Commands with pages: merge, switch, remove, list"post_process_for_html(&text)};- // Get the help reference block (wrap at 80 chars for web docs, with colors for HTML)- let reference_block = help_reference(&[subcommand], Some(80));+ // Get the help reference block (wrap at 100 chars for web docs, with colors for HTML)+ let reference_block = help_reference(&[subcommand], Some(100));// Output the generated content (frontmatter is in skeleton files)// Uses region markers so sync can replace just this content@@ -693,8 +693,8 @@ fn format_subcommand_section(.chain(std::iter::once(subcommand_name)).collect();- // Get help reference (wrap at 80 chars for web docs, with colors for HTML)- let reference_block = help_reference(&command_path, Some(80));+ // Get help reference (wrap at 100 chars for web docs, with colors for HTML)+ let reference_block = help_reference(&command_path, Some(100));// Format the section: heading, badge (outside heading), main content, command referencelet mut section = format!("## {full_command}\n\n");diff --git a/tests/integration_tests/readme_sync.rs b/tests/integration_tests/readme_sync.rsindex 52922b563..4dc502386 100644--- a/tests/integration_tests/readme_sync.rs+++ b/tests/integration_tests/readme_sync.rs@@ -497,19 +497,57 @@ fn parse_snapshot_content_for_docs(content: &str) -> Result<String, String> {/// the ansi-to-html library will carry styles across lines (e.g., `<b>text\nmore</b>`)./// By adding a reset at the end of each line, we ensure proper HTML tag closure.fn ensure_line_resets(ansi: &str) -> String {+ ensure_line_resets_impl(ansi, false)+}++/// Like `ensure_line_resets`, but also carries active styles to the next line+///+/// Clap resets styles at line breaks when wrapping, so a bold span that wraps across+/// lines loses its bold on the continuation. This variant tracks active SGR styles+/// and re-opens them at the start of each continuation line, producing clean per-line+/// HTML like `<b>first part</b>\n<b>second part</b>` instead of `<b>first part</b>\nsecond part`.+fn ensure_line_resets_with_carry(ansi: &str) -> String {+ ensure_line_resets_impl(ansi, true)+}++fn ensure_line_resets_impl(ansi: &str, carry_styles: bool) -> String {const RESET: &str = "\x1b[0m";+ // Match SGR sequences: ESC [ <params> m+ static SGR_RE: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\x1b\[([0-9;]*)m").unwrap());- ansi.lines()- .map(|line| {- // Add reset at end of line if it doesn't already end with one- if line.ends_with(RESET) {- line.to_string()+ let lines: Vec<&str> = ansi.lines().collect();+ let mut result = Vec::with_capacity(lines.len());+ let mut active_styles: Vec<String> = Vec::new();++ for line in lines {+ // Prepend active styles from previous line (only when carrying)+ let line = if !carry_styles || active_styles.is_empty() {+ line.to_string()+ } else {+ let prefix: String = active_styles.iter().map(|s| s.as_str()).collect();+ format!("{prefix}{line}")+ };++ // Track which styles are active at end of this line+ active_styles.clear();+ for cap in SGR_RE.captures_iter(&line) {+ let params = &cap[1];+ if params.is_empty() || params == "0" {+ active_styles.clear();} else {- format!("{}{}", line, RESET)+ active_styles.push(format!("\x1b[{params}m"));}- })- .collect::<Vec<_>>()- .join("\n")+ }++ // Ensure line ends with reset+ if line.ends_with(RESET) {+ result.push(line);+ } else {+ result.push(format!("{line}{RESET}"));+ }+ }++ result.join("\n")}/// Clean up HTML output from ansi-to-html conversion@@ -559,7 +597,7 @@ fn convert_command_reference_to_html(content: &str) -> Result<String, String> {for (start, end, header, code_content) in matches.into_iter().rev() {// Convert ANSI to HTML- let with_resets = ensure_line_resets(code_content);+ let with_resets = ensure_line_resets_with_carry(code_content);let html =ansi_to_html(&with_resets).map_err(|e| format!("ANSI conversion failed: {e}"))?;let clean_html = clean_ansi_html(&html);