Skip to content

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.md
index 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 &#39;-h&#39;)
diff --git a/docs/content/merge.md b/docs/content/merge.md
index 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> <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&#39;s already in the index
diff --git a/docs/content/remove.md b/docs/content/remove.md
index 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 &#39;-h&#39;)
diff --git a/docs/content/step.md b/docs/content/step.md
index 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>&lt;COMMAND&gt;</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&#39;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&#39;s already in the index
diff --git a/docs/content/switch.md b/docs/content/switch.md
index 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: &#39;^&#39; (default branch),
- &#39;-&#39; (previous), &#39;@&#39; (current), &#39;pr:{N}&#39; (GitHub PR), &#39;mr:{N}&#39; (GitLab
- MR)
+ Opens interactive picker if omitted. Shortcuts: &#39;^&#39; (default branch), &#39;-&#39; (previous), &#39;@&#39;
+ (current), &#39;pr:{N}&#39; (GitHub PR), &#39;mr:{N}&#39; (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> &lt;EXECUTE&gt;</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=&#39;wt switch --create -x claude&#39;</b>
<b>wsc feature-branch -- &#39;Fix GH #322&#39;</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 -- &#39;Fix</b>
- GH #322&#39; runs <b>claude &#39;Fix GH #322&#39;</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 -- &#39;Fix GH #322&#39;</b> runs <b>claude &#39;Fix GH #322&#39;</b>,
+ starting Claude with a prompt.
- Template example: <b>-x &#39;code {{ worktree_path }}&#39;</b> opens VS Code at the
- worktree, <b>-x &#39;tmux new -s {{ branch | sanitize }}&#39;</b> starts a tmux
- session named after the branch.
+ Template example: <b>-x &#39;code {{ worktree_path }}&#39;</b> opens VS Code at the worktree, <b>-x &#39;tmux</b>
+<b> new -s {{ branch | sanitize }}&#39;</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 &#39;-h&#39;)
diff --git a/skills/worktrunk/reference/list.md b/skills/worktrunk/reference/list.md
index 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 &#39;-h&#39;)
diff --git a/skills/worktrunk/reference/merge.md b/skills/worktrunk/reference/merge.md
index 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> <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&#39;s already in the index
diff --git a/skills/worktrunk/reference/remove.md b/skills/worktrunk/reference/remove.md
index 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 &#39;-h&#39;)
diff --git a/skills/worktrunk/reference/step.md b/skills/worktrunk/reference/step.md
index 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 push
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>&lt;COMMAND&gt;</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&#39;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&#39;s already in the index
diff --git a/skills/worktrunk/reference/switch.md b/skills/worktrunk/reference/switch.md
index 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: &#39;^&#39; (default branch),
- &#39;-&#39; (previous), &#39;@&#39; (current), &#39;pr:{N}&#39; (GitHub PR), &#39;mr:{N}&#39; (GitLab
- MR)
+ Opens interactive picker if omitted. Shortcuts: &#39;^&#39; (default branch), &#39;-&#39; (previous), &#39;@&#39;
+ (current), &#39;pr:{N}&#39; (GitHub PR), &#39;mr:{N}&#39; (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> &lt;EXECUTE&gt;</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=&#39;wt switch --create -x claude&#39;</b>
<b>wsc feature-branch -- &#39;Fix GH #322&#39;</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 -- &#39;Fix</b>
- GH #322&#39; runs <b>claude &#39;Fix GH #322&#39;</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 -- &#39;Fix GH #322&#39;</b> runs <b>claude &#39;Fix GH #322&#39;</b>,
+ starting Claude with a prompt.
- Template example: <b>-x &#39;code {{ worktree_path }}&#39;</b> opens VS Code at the
- worktree, <b>-x &#39;tmux new -s {{ branch | sanitize }}&#39;</b> starts a tmux
- session named after the branch.
+ Template example: <b>-x &#39;code {{ worktree_path }}&#39;</b> opens VS Code at the worktree, <b>-x &#39;tmux</b>
+<b> new -s {{ branch | sanitize }}&#39;</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 &#39;-h&#39;)
diff --git a/src/help.rs b/src/help.rs
index 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 reference
let mut section = format!("## {full_command}\n\n");
diff --git a/tests/integration_tests/readme_sync.rs b/tests/integration_tests/readme_sync.rs
index 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);