Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Update README merge examples with more realistic output
Maximilian Rooscd4a558ef565
diff --git a/README.md b/README.mdindex 96700b8fd..4885f7c1b 100644--- a/README.md+++ b/README.md@@ -13,8 +13,7 @@ afterward is manual. Worktrunk automates that lifecycle.Automates the full lifecycle: create worktree, work, merge back, remove worktree.-<!-- Output generated from: tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap -->-+<!-- Output generated from: tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap (snapshot output includes [SHA]/[REPO]; replace with representative values when copying into README) -->```bash$ wt switch --create fix-auth# Shell now in ../repo.fix-auth/@@ -23,14 +22,12 @@ $ wt switch --create fix-auth$ wt mergeπ Merging 1 commit to main @ a1b2c3d (no commit/squash/rebase needed)-* a1b2c3d (HEAD -> fix-auth) Implement JWT validation-- auth.rs | 1 +- 1 file changed, 1 insertion(+)--β Merged to main (1 commit, 1 file, +1)-β Returned to primary at ../repo/+ * a1b2c3d (HEAD -> fix-auth) Implement JWT validation+ auth.rs | 13 ++++++++++++++ 1 file changed, 13 insertions(+)+β Merged to main (1 commit, 1 file, +13)π Removing worktree & branch...+β Removed worktree & branch for fix-auth, returned to primary at ../repo/# Shell back in main```@@ -333,31 +330,24 @@ Automate common tasks by creating `.config/wt.toml` in your repository root. Run**Example output with hooks:**-<!-- Output generated from: tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap -->+<!-- Output generated from: tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap (snapshot output includes [SHA]/[REPO]; replace with representative values when copying into README) -->```bash$ wt merge-π Squashing 3 commits into 1 (3 files, +3)...+π Squashing 3 commits into 1 (3 files, +33)...π Generating squash commit message...- feat(auth): Implement JWT authentication system+ feat(auth): Implement JWT authentication system- Add comprehensive JWT token handling including validation, refresh logic,- and authentication tests. This establishes the foundation for secure- API authentication.-- - Implement token refresh mechanism with expiry handling- - Add JWT encoding/decoding with signature verification- - Create test suite covering all authentication flows+ Add comprehensive JWT token handling including validation, refresh logic,+ and authentication tests. This establishes the foundation for secure+ API authentication.+ - Implement token refresh mechanism with expiry handling+ - Add JWT encoding/decoding with signature verification+ - Create test suite covering all authentication flowsβ Squashed @ a1b2c3d-π Running pre-merge lint- cargo clippy-- Checking worktrunk v0.1.0- Finished dev [unoptimized + debuginfo] target(s) in 1.23s--π Running pre-merge test- cargo test+π Running pre-merge test:+ cargo testFinished test [unoptimized + debuginfo] target(s) in 0.12sRunning unittests src/lib.rs (target/debug/deps/worktrunk-abc123)@@ -370,20 +360,26 @@ test auth::tests::test_token_validation ... oktest result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.08s-π Merging 1 commit to main @ a1b2c3d (no rebasing needed)+π Running pre-merge lint:+ cargo clippy++ Checking worktrunk v0.1.0+ Finished dev [unoptimized + debuginfo] target(s) in 1.23s++π Merging 1 commit to main @ a1b2c3d (no rebase needed)-* a1b2c3d (HEAD -> feature-auth) feat(auth): Implement JWT authentication system+ * a1b2c3d (HEAD -> feature-auth) feat(auth): Implement JWT authentication system- auth.rs | 1 +- auth_test.rs | 1 +- jwt.rs | 1 +- 3 files changed, 3 insertions(+)+ auth.rs | 8 +++++++++ auth_test.rs | 17 ++++++++++++++++++ jwt.rs | 8 +++++++++ 3 files changed, 33 insertions(+)-β Merged to main (1 commit, 3 files, +3)-β Returned to primary at ../repo/+β Merged to main (1 commit, 3 files, +33)π Removing worktree & branch...-π Running post-merge install- cargo install --path .+β Removed worktree & branch for feature-auth, returned to primary at ../repo/+π Running post-merge install:+ cargo install --path .Installing worktrunk v0.1.0Compiling worktrunk v0.1.0diff --git a/tests/integration_tests/merge.rs b/tests/integration_tests/merge.rsindex 3ad48d602..a8b03b324 100644--- a/tests/integration_tests/merge.rs+++ b/tests/integration_tests/merge.rs@@ -1573,8 +1573,21 @@ fn test_readme_example_simple() {// Create a fix-auth worktree and make a commitlet feature_wt = repo.add_worktree("fix-auth", "fix-auth");- std::fs::write(feature_wt.join("auth.rs"), "// JWT validation code")- .expect("Failed to write file");+ let auth_rs = r#"// JWT validation utilities+pub struct JwtClaims {+ pub sub: String,+ pub scope: String,+}++pub fn validate(token: &str) -> bool {+ token.starts_with("Bearer ") && token.split('.').count() == 3+}++pub fn refresh(refresh_token: &str) -> String {+ format!("{}::refreshed", refresh_token)+}+"#;+ std::fs::write(feature_wt.join("auth.rs"), auth_rs).expect("Failed to write file");let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);@@ -1718,8 +1731,16 @@ EOFlet feature_wt = repo.add_worktree("feature-auth", "feature-auth");// First commit: token refresh- std::fs::write(feature_wt.join("auth.rs"), "// Token refresh logic\n")- .expect("Failed to write file");+ let commit_one = r#"// Token refresh logic+pub fn refresh(secret: &str, expires_in: u32) -> String {+ format!("{}::{}", secret, expires_in)+}++pub fn needs_rotation(issued_at: u64, ttl: u64, now: u64) -> bool {+ now.saturating_sub(issued_at) > ttl+}+"#;+ std::fs::write(feature_wt.join("auth.rs"), commit_one).expect("Failed to write file");let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth.rs"])@@ -1734,7 +1755,16 @@ EOF.expect("Failed to commit");// Second commit: JWT validation- std::fs::write(feature_wt.join("jwt.rs"), "// JWT validation\n").expect("Failed to write file");+ let commit_two = r#"// JWT validation+pub fn validate_signature(payload: &str, signature: &str) -> bool {+ !payload.is_empty() && signature.len() > 12+}++pub fn decode_claims(token: &str) -> Option<&str> {+ token.split('.').nth(1)+}+"#;+ std::fs::write(feature_wt.join("jwt.rs"), commit_two).expect("Failed to write file");let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "jwt.rs"])@@ -1749,7 +1779,25 @@ EOF.expect("Failed to commit");// Third commit: tests- std::fs::write(feature_wt.join("auth_test.rs"), "// Tests\n").expect("Failed to write file");+ let commit_three = r#"// Tests+#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn refresh_rotates_secret() {+ let token = refresh("token", 30);+ assert!(token.contains("token::30"));+ }++ #[test]+ fn decode_claims_returns_payload() {+ let token = "header.payload.signature";+ assert_eq!(decode_claims(token), Some("payload"));+ }+}+"#;+ std::fs::write(feature_wt.join("auth_test.rs"), commit_three).expect("Failed to write file");let mut cmd = Command::new("git");repo.configure_git_cmd(&mut cmd);cmd.args(["add", "auth_test.rs"])diff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snapindex 0a0539ef0..77f74df93 100644--- a/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_complex.snap@@ -1,5 +1,6 @@---source: tests/integration_tests/merge.rs+assertion_line: 29info:program: wtargs:@@ -15,14 +16,14 @@ info:GIT_CONFIG_SYSTEM: /dev/nullLANG: CLC_ALL: C- PATH: "/private/var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmputZ22Q/test-repo/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"+ PATH: "/private/var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpcSwkET/test-repo/.bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"SOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmputZ22Q/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpcSwkET/test-config.toml---success: trueexit_code: 0----- stdout ------π [36mSquashing 3 commits into 1[0m (3 files, [32m+3[0m)...+π [36mSquashing 3 commits into 1[0m (3 files, [32m+33[0m)...π [36mGenerating squash commit message...[0m[40m [0m [1mfeat(auth): Implement JWT authentication system[0m[40m [0m@@ -41,11 +42,11 @@ exit_code: 0π [36mMerging 1 commit to [1m[36mmain[0m[36m @ [2m[SHA][0m (no rebase needed)[40m [0m * [SHA][33m ([m[1;36mHEAD[m[33m -> [m[1;32mfeature-auth[m[33m)[m feat(auth): Implement JWT authentication system-[40m [0m auth.rs | 1 [32m+[m-[40m [0m auth_test.rs | 1 [32m+[m-[40m [0m jwt.rs | 1 [32m+[m-[40m [0m 3 files changed, 3 insertions(+)-β [32mMerged to [1m[32mmain[0m[0m (1 commit, 3 files, [32m+3[0m)+[40m [0m auth.rs | 8 [32m++++++++[m+[40m [0m auth_test.rs | 17 [32m+++++++++++++++++[m+[40m [0m jwt.rs | 8 [32m++++++++[m+[40m [0m 3 files changed, 33 insertions(+)+β [32mMerged to [1m[32mmain[0m[0m (1 commit, 3 files, [32m+33[0m)π [36mRemoving worktree & branch...[0mβ [32mRemoved worktree & branch for [1m[32mfeature-auth[0m[32m, returned to primary at [1m[32m[REPO][0m[0mπ [36mRunning post-merge [1minstall[0m:[0mdiff --git a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snapindex f56e3feb1..74cac249c 100644--- a/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap+++ b/tests/snapshots/integration__integration_tests__merge__readme_example_simple.snap@@ -1,5 +1,6 @@---source: tests/integration_tests/merge.rs+assertion_line: 11info:program: wtargs:@@ -15,7 +16,7 @@ info:LANG: CLC_ALL: CSOURCE_DATE_EPOCH: "1761609600"- WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpRLrXwu/test-config.toml+ WORKTRUNK_CONFIG_PATH: /var/folders/wf/s6ycxvvs4ln8qsdbfx40hnc40000gn/T/.tmpl3Y22A/test-config.toml---success: trueexit_code: 0@@ -23,9 +24,9 @@ exit_code: 0π [36mMerging 1 commit to [1m[36mmain[0m[36m @ [2m[SHA][0m (no commit/squash/rebase needed)[40m [0m * [SHA][33m ([m[1;36mHEAD[m[33m -> [m[1;32mfix-auth[m[33m)[m Implement JWT validation-[40m [0m auth.rs | 1 [32m+[m-[40m [0m 1 file changed, 1 insertion(+)-β [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+1[0m)+[40m [0m auth.rs | 13 [32m+++++++++++++[m+[40m [0m 1 file changed, 13 insertions(+)+β [32mMerged to [1m[32mmain[0m[0m (1 commit, 1 file, [32m+13[0m)π [36mRemoving worktree & branch...[0mβ [32mRemoved worktree & branch for [1m[32mfix-auth[0m[32m, returned to primary at [1m[32m[REPO][0m[0m