Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

docs: add colored approval prompt to online docs (#1766)

Maximilian Roos8c6a0149dc4a
diff --git a/docs/content/faq.md b/docs/content/faq.md
index 8c4e71620..11f028fa1 100644
--- a/docs/content/faq.md
+++ b/docs/content/faq.md
@@ -173,21 +173,18 @@ User hooks don't require approval (you defined them). Commands from project hook
### Example approval prompt
-<!-- ⚠️ AUTO-GENERATED from tests/integration_tests/snapshots/integration__integration_tests__shell_wrapper__tests__readme_example_approval_prompt.snap — edit source to update -->
-
-```
-▲ repo needs approval to execute 3 commands:
-
-○ post-create install:
- echo 'Installing dependencies...'
-○ post-create build:
- echo 'Building project...'
-○ post-create test:
- echo 'Running tests...'
-❯ Allow and remember? [y/N]
-```
-
-<!-- END AUTO-GENERATED -->
+{% terminal() %}
+<span class="y">▲ <b>repo</b> needs approval to execute <b>3</b> commands:</span>
+
+<span class="d">○</span> post-create <b>install</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">npm</span> ci</span>
+<span class="d">○</span> post-create <b>build</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">cargo</span> build <span class="c">--release</span></span>
+<span class="d">○</span> post-create <b>env</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">echo</span> <span class="g">'PORT={{ branch | hash_port }}'</span> <span class="c">></span> .env.local</span>
+
+<span class="c">❯</span> Allow and remember? <b>[y/N]</b>
+{% end %}
Use `--yes` to bypass prompts (useful for CI/automation).
diff --git a/docs/content/hook.md b/docs/content/hook.md
index 8e629f395..70fcacc3e 100644
--- a/docs/content/hook.md
+++ b/docs/content/hook.md
@@ -133,14 +133,18 @@ During `wt merge`, hooks run in this order: pre-commit → post-commit → pre-m
Project commands require approval on first run:
-```
-▲ repo needs approval to execute 3 commands:
+{% terminal() %}
+<span class="y">▲ <b>repo</b> needs approval to execute <b>3</b> commands:</span>
-○ pre-start install:
- echo 'Installing dependencies...'
+<span class="d">○</span> pre-start <b>install</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">npm</span> ci</span>
+<span class="d">○</span> pre-start <b>build</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">cargo</span> build <span class="c">--release</span></span>
+<span class="d">○</span> pre-start <b>env</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">echo</span> <span class="g">'PORT={{ branch | hash_port }}'</span> <span class="c">></span> .env.local</span>
-❯ Allow and remember? [y/N]
-```
+<span class="c">❯</span> Allow and remember? <b>[y/N]</b>
+{% end %}
- Approvals are saved to user config (`~/.config/worktrunk/config.toml`)
- If a command changes, new approval is required
diff --git a/docs/content/llm-commits.md b/docs/content/llm-commits.md
index ba0f4193c..6e8d0a08e 100644
--- a/docs/content/llm-commits.md
+++ b/docs/content/llm-commits.md
@@ -63,13 +63,12 @@ These examples assume a feature worktree with changes to commit.
Squashes all changes (uncommitted + existing commits) into one commit with an LLM-generated message, then merges to the default branch:
-```bash
-$ wt merge
-◎ Squashing 3 commits into a single commit (5 files, +48)...
-◎ Generating squash commit message...
- feat(auth): Implement JWT authentication system
- ...
-```
+{% terminal(cmd="wt merge") %}
+<span class=c>◎</span> <span class=c>Squashing 3 commits into a single commit <span style='color:var(--bright-black,#555)'>(5 files, <span class=g>+48</span></span></span><span style='color:var(--bright-black,#555)'>)</span>...
+<span class=c>◎</span> <span class=c>Generating squash commit message...</span>
+<span style='background:var(--bright-white,#fff)'> </span> <b>feat(auth): Implement JWT authentication system</b>
+<span style='background:var(--bright-white,#fff)'> </span> ...
+{% end %}
### wt step commit
diff --git a/docs/sass/custom.scss b/docs/sass/custom.scss
index 6deece637..73b561167 100644
--- a/docs/sass/custom.scss
+++ b/docs/sass/custom.scss
@@ -563,6 +563,8 @@ main {
.g { color: var(--green, #0a0); }
.r { color: var(--red, #a00); }
.c { color: var(--cyan, #0aa); }
+ .y { color: var(--yellow, #a60); }
+ .b { color: var(--blue, #00a); }
// Gutter spans - extend vertically to form continuous line
span[style*="background:var(--bright-white"] {
diff --git a/skills/worktrunk/reference/faq.md b/skills/worktrunk/reference/faq.md
index 8fa6ca0ed..fd547001d 100644
--- a/skills/worktrunk/reference/faq.md
+++ b/skills/worktrunk/reference/faq.md
@@ -166,17 +166,16 @@ User hooks don't require approval (you defined them). Commands from project hook
### Example approval prompt
-```
-▲ repo needs approval to execute 3 commands:
-
-○ post-create install:
- echo 'Installing dependencies...'
-○ post-create build:
- echo 'Building project...'
-○ post-create test:
- echo 'Running tests...'
-❯ Allow and remember? [y/N]
-```
+<span class="y">▲ <b>repo</b> needs approval to execute <b>3</b> commands:</span>
+
+<span class="d">○</span> post-create <b>install</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">npm</span> ci</span>
+<span class="d">○</span> post-create <b>build</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">cargo</span> build <span class="c">--release</span></span>
+<span class="d">○</span> post-create <b>env</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">echo</span> <span class="g">'PORT={{ branch | hash_port }}'</span> <span class="c">></span> .env.local</span>
+
+<span class="c">❯</span> Allow and remember? <b>[y/N]</b>
Use `--yes` to bypass prompts (useful for CI/automation).
diff --git a/skills/worktrunk/reference/hook.md b/skills/worktrunk/reference/hook.md
index 284f82ee9..a978f7aa9 100644
--- a/skills/worktrunk/reference/hook.md
+++ b/skills/worktrunk/reference/hook.md
@@ -124,14 +124,16 @@ During `wt merge`, hooks run in this order: pre-commit → post-commit → pre-m
Project commands require approval on first run:
-```
-▲ repo needs approval to execute 3 commands:
+<span class="y">▲ <b>repo</b> needs approval to execute <b>3</b> commands:</span>
-○ pre-start install:
- echo 'Installing dependencies...'
+<span class="d">○</span> pre-start <b>install</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">npm</span> ci</span>
+<span class="d">○</span> pre-start <b>build</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">cargo</span> build <span class="c">--release</span></span>
+<span class="d">○</span> pre-start <b>env</b>:
+<span style='background:var(--bright-white,#fff)'> </span> <span class="d"><span class="b">echo</span> <span class="g">'PORT={{ branch | hash_port }}'</span> <span class="c">></span> .env.local</span>
-❯ Allow and remember? [y/N]
-```
+<span class="c">❯</span> Allow and remember? <b>[y/N]</b>
- Approvals are saved to user config (`~/.config/worktrunk/config.toml`)
- If a command changes, new approval is required
diff --git a/skills/worktrunk/reference/llm-commits.md b/skills/worktrunk/reference/llm-commits.md
index d5baf97e6..2686b2a27 100644
--- a/skills/worktrunk/reference/llm-commits.md
+++ b/skills/worktrunk/reference/llm-commits.md
@@ -49,13 +49,12 @@ These examples assume a feature worktree with changes to commit.
Squashes all changes (uncommitted + existing commits) into one commit with an LLM-generated message, then merges to the default branch:
-```bash
-$ wt merge
-◎ Squashing 3 commits into a single commit (5 files, +48)...
-◎ Generating squash commit message...
- feat(auth): Implement JWT authentication system
- ...
-```
+{% terminal(cmd="wt merge") %}
+<span class=c>◎</span> <span class=c>Squashing 3 commits into a single commit <span style='color:var(--bright-black,#555)'>(5 files, <span class=g>+48</span></span></span><span style='color:var(--bright-black,#555)'>)</span>...
+<span class=c>◎</span> <span class=c>Generating squash commit message...</span>
+<span style='background:var(--bright-white,#fff)'> </span> <b>feat(auth): Implement JWT authentication system</b>
+<span style='background:var(--bright-white,#fff)'> </span> ...
+{% end %}
### wt step commit
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 6defeaf24..c87eb058c 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -1227,7 +1227,11 @@ Project commands require approval on first run:
▲ repo needs approval to execute 3 commands:
○ pre-start install:
- echo 'Installing dependencies...'
+ npm ci
+○ pre-start build:
+ cargo build --release
+○ pre-start env:
+ echo 'PORT={{ branch | hash_port }}' > .env.local
❯ Allow and remember? [y/N]
```
diff --git a/src/help.rs b/src/help.rs
index eec3f6ccb..8d89ab299 100644
--- a/src/help.rs
+++ b/src/help.rs
@@ -430,6 +430,7 @@ Commands with pages: merge, switch, remove, list"
/// | `` `●` green `` | `<span style='color:#0a0'>●</span> green` |
/// | `[experimental]` | `<span class="badge-experimental"></span>` (text via CSS) |
/// | plain URL | markdown link |
+/// | approval prompt code block | `{% terminal() %}` with colored symbols and gutter |
///
/// Only runs on `after_long_help` markdown — not on terminal reference blocks (those go
/// through ANSI-to-HTML via `convert_command_reference_to_html` in readme_sync.rs).
@@ -462,6 +463,35 @@ fn post_process_for_html(text: &str) -> String {
"Open an issue at https://github.com/max-sixty/worktrunk.",
"[Open an issue](https://github.com/max-sixty/worktrunk/issues).",
)
+ // Approval prompt: plain code block → terminal shortcode with colored symbols
+ // and gutter. CLI shows a plain ``` block; web shows styled terminal output
+ // matching the actual CLI appearance (yellow ▲, dim ○, cyan ❯, gutter bar).
+ .replace(
+ "```\n\
+ ▲ repo needs approval to execute 3 commands:\n\
+ \n\
+ ○ pre-start install:\n\
+ \x20\x20\x20npm ci\n\
+ ○ pre-start build:\n\
+ \x20\x20\x20cargo build --release\n\
+ ○ pre-start env:\n\
+ \x20\x20\x20echo 'PORT={{ branch | hash_port }}' > .env.local\n\
+ \n\
+ ❯ Allow and remember? [y/N]\n\
+ ```",
+ "{% terminal() %}\n\
+ <span class=\"y\">▲ <b>repo</b> needs approval to execute <b>3</b> commands:</span>\n\
+ \n\
+ <span class=\"d\">○</span> pre-start <b>install</b>:\n\
+ <span style='background:var(--bright-white,#fff)'> </span> <span class=\"d\"><span class=\"b\">npm</span> ci</span>\n\
+ <span class=\"d\">○</span> pre-start <b>build</b>:\n\
+ <span style='background:var(--bright-white,#fff)'> </span> <span class=\"d\"><span class=\"b\">cargo</span> build <span class=\"c\">--release</span></span>\n\
+ <span class=\"d\">○</span> pre-start <b>env</b>:\n\
+ <span style='background:var(--bright-white,#fff)'> </span> <span class=\"d\"><span class=\"b\">echo</span> <span class=\"g\">'PORT={{ branch | hash_port }}'</span> <span class=\"c\">></span> .env.local</span>\n\
+ \n\
+ <span class=\"c\">❯</span> Allow and remember? <b>[y/N]</b>\n\
+ {% end %}",
+ )
}
/// Move `[experimental]` from heading lines to a separate line after the heading.