Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Implement `arbor list` command and git worktree parsing
Maximilian Roos0e1df51a39b2
diff --git a/Cargo.lock b/Cargo.locknew file mode 100644index 000000000..8c957d583--- /dev/null+++ b/Cargo.lock@@ -0,0 +1,783 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "aho-corasick"+version = "1.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"+dependencies = [+ "memchr",+]++[[package]]+name = "anstream"+version = "0.6.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a"+dependencies = [+ "anstyle",+ "anstyle-parse",+ "anstyle-query",+ "anstyle-wincon",+ "colorchoice",+ "is_terminal_polyfill",+ "utf8parse",+]++[[package]]+name = "anstyle"+version = "1.0.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"++[[package]]+name = "anstyle-parse"+version = "0.2.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2"+dependencies = [+ "utf8parse",+]++[[package]]+name = "anstyle-query"+version = "1.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2"+dependencies = [+ "windows-sys 0.60.2",+]++[[package]]+name = "anstyle-wincon"+version = "3.0.10"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a"+dependencies = [+ "anstyle",+ "once_cell_polyfill",+ "windows-sys 0.60.2",+]++[[package]]+name = "arbor"+version = "0.1.0"+dependencies = [+ "assert_cmd",+ "clap",+ "insta",+ "insta-cmd",+ "tempfile",+]++[[package]]+name = "assert_cmd"+version = "2.0.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2bd389a4b2970a01282ee455294913c0a43724daedcd1a24c3eb0ec1c1320b66"+dependencies = [+ "anstyle",+ "bstr",+ "doc-comment",+ "libc",+ "predicates",+ "predicates-core",+ "predicates-tree",+ "wait-timeout",+]++[[package]]+name = "bitflags"+version = "2.9.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394"++[[package]]+name = "block-buffer"+version = "0.10.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"+dependencies = [+ "generic-array",+]++[[package]]+name = "bstr"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4"+dependencies = [+ "memchr",+ "regex-automata",+ "serde",+]++[[package]]+name = "cfg-if"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"++[[package]]+name = "clap"+version = "4.5.49"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f"+dependencies = [+ "clap_builder",+ "clap_derive",+]++[[package]]+name = "clap_builder"+version = "4.5.49"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730"+dependencies = [+ "anstream",+ "anstyle",+ "clap_lex",+ "strsim",+]++[[package]]+name = "clap_derive"+version = "4.5.49"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671"+dependencies = [+ "heck",+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "clap_lex"+version = "0.7.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d"++[[package]]+name = "colorchoice"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"++[[package]]+name = "console"+version = "0.15.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "054ccb5b10f9f2cbf51eb355ca1d05c2d279ce1804688d0db74b4733a5aeafd8"+dependencies = [+ "encode_unicode",+ "libc",+ "once_cell",+ "windows-sys 0.59.0",+]++[[package]]+name = "cpufeatures"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"+dependencies = [+ "libc",+]++[[package]]+name = "crypto-common"+version = "0.1.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"+dependencies = [+ "generic-array",+ "typenum",+]++[[package]]+name = "difflib"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8"++[[package]]+name = "digest"+version = "0.10.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"+dependencies = [+ "block-buffer",+ "crypto-common",+]++[[package]]+name = "doc-comment"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"++[[package]]+name = "encode_unicode"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"++[[package]]+name = "errno"+version = "0.3.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"+dependencies = [+ "libc",+ "windows-sys 0.60.2",+]++[[package]]+name = "fastrand"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"++[[package]]+name = "generic-array"+version = "0.14.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2"+dependencies = [+ "typenum",+ "version_check",+]++[[package]]+name = "getrandom"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"+dependencies = [+ "cfg-if",+ "libc",+ "r-efi",+ "wasip2",+]++[[package]]+name = "heck"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"++[[package]]+name = "insta"+version = "1.43.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "46fdb647ebde000f43b5b53f773c30cf9b0cb4300453208713fa38b2c70935a0"+dependencies = [+ "console",+ "once_cell",+ "pest",+ "pest_derive",+ "regex",+ "serde",+ "similar",+]++[[package]]+name = "insta-cmd"+version = "0.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ffeeefa927925cced49ccb01bf3e57c9d4cd132df21e576eb9415baeab2d3de6"+dependencies = [+ "insta",+ "serde",+ "serde_json",+]++[[package]]+name = "is_terminal_polyfill"+version = "1.70.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"++[[package]]+name = "itoa"+version = "1.0.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"++[[package]]+name = "libc"+version = "0.2.177"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976"++[[package]]+name = "linux-raw-sys"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"++[[package]]+name = "memchr"+version = "2.7.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"++[[package]]+name = "once_cell"+version = "1.21.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"++[[package]]+name = "once_cell_polyfill"+version = "1.70.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad"++[[package]]+name = "pest"+version = "2.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "989e7521a040efde50c3ab6bbadafbe15ab6dc042686926be59ac35d74607df4"+dependencies = [+ "memchr",+ "ucd-trie",+]++[[package]]+name = "pest_derive"+version = "2.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "187da9a3030dbafabbbfb20cb323b976dc7b7ce91fcd84f2f74d6e31d378e2de"+dependencies = [+ "pest",+ "pest_generator",+]++[[package]]+name = "pest_generator"+version = "2.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "49b401d98f5757ebe97a26085998d6c0eecec4995cad6ab7fc30ffdf4b052843"+dependencies = [+ "pest",+ "pest_meta",+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "pest_meta"+version = "2.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72f27a2cfee9f9039c4d86faa5af122a0ac3851441a34865b8a043b46be0065a"+dependencies = [+ "pest",+ "sha2",+]++[[package]]+name = "predicates"+version = "3.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573"+dependencies = [+ "anstyle",+ "difflib",+ "predicates-core",+]++[[package]]+name = "predicates-core"+version = "1.0.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa"++[[package]]+name = "predicates-tree"+version = "1.0.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c"+dependencies = [+ "predicates-core",+ "termtree",+]++[[package]]+name = "proc-macro2"+version = "1.0.101"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "quote"+version = "1.0.41"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "r-efi"+version = "5.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"++[[package]]+name = "regex"+version = "1.12.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "regex-automata"+version = "0.4.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-syntax",+]++[[package]]+name = "regex-syntax"+version = "0.8.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"++[[package]]+name = "rustix"+version = "1.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e"+dependencies = [+ "bitflags",+ "errno",+ "libc",+ "linux-raw-sys",+ "windows-sys 0.60.2",+]++[[package]]+name = "ryu"+version = "1.0.20"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"++[[package]]+name = "serde"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_core"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]++[[package]]+name = "serde_json"+version = "1.0.145"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"+dependencies = [+ "itoa",+ "memchr",+ "ryu",+ "serde",+ "serde_core",+]++[[package]]+name = "sha2"+version = "0.10.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"+dependencies = [+ "cfg-if",+ "cpufeatures",+ "digest",+]++[[package]]+name = "similar"+version = "2.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbbb5d9659141646ae647b42fe094daf6c6192d1620870b449d9557f748b2daa"++[[package]]+name = "strsim"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"++[[package]]+name = "syn"+version = "2.0.107"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "tempfile"+version = "3.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16"+dependencies = [+ "fastrand",+ "getrandom",+ "once_cell",+ "rustix",+ "windows-sys 0.60.2",+]++[[package]]+name = "termtree"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"++[[package]]+name = "typenum"+version = "1.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"++[[package]]+name = "ucd-trie"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"++[[package]]+name = "unicode-ident"+version = "1.0.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"++[[package]]+name = "utf8parse"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"++[[package]]+name = "version_check"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"++[[package]]+name = "wait-timeout"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11"+dependencies = [+ "libc",+]++[[package]]+name = "wasip2"+version = "1.0.1+wasi-0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7"+dependencies = [+ "wit-bindgen",+]++[[package]]+name = "windows-link"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"++[[package]]+name = "windows-sys"+version = "0.59.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"+dependencies = [+ "windows-targets 0.52.6",+]++[[package]]+name = "windows-sys"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"+dependencies = [+ "windows-targets 0.53.5",+]++[[package]]+name = "windows-targets"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"+dependencies = [+ "windows_aarch64_gnullvm 0.52.6",+ "windows_aarch64_msvc 0.52.6",+ "windows_i686_gnu 0.52.6",+ "windows_i686_gnullvm 0.52.6",+ "windows_i686_msvc 0.52.6",+ "windows_x86_64_gnu 0.52.6",+ "windows_x86_64_gnullvm 0.52.6",+ "windows_x86_64_msvc 0.52.6",+]++[[package]]+name = "windows-targets"+version = "0.53.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"+dependencies = [+ "windows-link",+ "windows_aarch64_gnullvm 0.53.1",+ "windows_aarch64_msvc 0.53.1",+ "windows_i686_gnu 0.53.1",+ "windows_i686_gnullvm 0.53.1",+ "windows_i686_msvc 0.53.1",+ "windows_x86_64_gnu 0.53.1",+ "windows_x86_64_gnullvm 0.53.1",+ "windows_x86_64_msvc 0.53.1",+]++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"++[[package]]+name = "windows_aarch64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"++[[package]]+name = "windows_aarch64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"++[[package]]+name = "windows_i686_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"++[[package]]+name = "windows_i686_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"++[[package]]+name = "windows_i686_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"++[[package]]+name = "windows_i686_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"++[[package]]+name = "windows_i686_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"++[[package]]+name = "windows_i686_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"++[[package]]+name = "windows_x86_64_gnu"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"++[[package]]+name = "windows_x86_64_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"++[[package]]+name = "windows_x86_64_msvc"+version = "0.52.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"++[[package]]+name = "windows_x86_64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"++[[package]]+name = "wit-bindgen"+version = "0.46.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59"diff --git a/Cargo.toml b/Cargo.tomlindex 268a5179d..ac20bf542 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -4,3 +4,10 @@ version = "0.1.0"edition = "2024"[dependencies]+clap = { version = "4.5", features = ["derive"] }++[dev-dependencies]+insta = { version = "1.40", features = ["yaml", "redactions", "filters"] }+insta-cmd = "0.6"+assert_cmd = "2.0"+tempfile = "3.14"diff --git a/TODO.md b/TODO.mdindex ea25eac57..629748009 100644--- a/TODO.md+++ b/TODO.md@@ -24,7 +24,7 @@ Core git operations that all other components depend on.- Check merge ancestry and fast-forward status- Detect operations in progress (merge, rebase, cherry-pick)-**Dependencies:** `std::process::Command`, likely `git2` crate for some operations+**Dependencies:** `std::process::Command` for shelling out to git### 2. Worktree CorePrimary worktree management operations.@@ -131,9 +131,168 @@ Ensure correctness with real git repositories.3. **Cross-platform support**: Focus on Unix-like systems only or support Windows?- Fish-specific features may not translate-4. **Git library choice**: Use `git2-rs` for everything or mix with command execution?- - `git2` is more robust but less flexible- - Commands are easier to debug but more fragile+4. **Git library choice**: ✅ **DECIDED: Shell out to git commands**+ - Use `std::process::Command` directly (no wrapper crates needed)+ - Parse `--porcelain` formats for stability+ - Rationale: libgit2 lags behind git on worktree features, proven approach from vergen-gitcl and PRQL+ - Git is already required for worktrees to exist, so no additional runtime dependency++## Testing Strategy++### Approach: Snapshot Testing with Insta++We'll use `insta` and `insta_cmd` for snapshot-based testing of both library functions and CLI commands.++**Rationale:**+- Snapshot tests capture actual git behavior, not mocked approximations+- Easy to review changes to output formats+- Faster to write comprehensive tests (no manual assertion writing)+- Tests serve as living documentation of expected behavior++### Test Structure++Following Rust 2018+ conventions:++```+tests/+ common/+ mod.rs # Shared test helpers (TestRepo, etc.)+ test_list.rs # Integration tests for `arbor list`+ test_switch.rs # Integration tests for `arbor switch` (future)+ test_finish.rs # Integration tests for `arbor finish` (future)+ snapshots/ # Generated by insta+ test_list__*.snap+```++### Test Helpers (tests/common/mod.rs)++**Core helpers:**+1. `TestRepo::new()` - Create temp git repo with isolated environment+2. `TestRepo::add_worktree(name, branch)` - Add worktree, return path, track by name+3. `TestRepo::commit(message)` - Make commit with fixed author/committer dates+4. `TestRepo::detach_head()` - Create detached HEAD state+5. `TestRepo::lock_worktree(name, reason)` - Lock a worktree with optional reason+6. `TestRepo::root_path()` - Get root repo path for normalization+7. `TestRepo::worktree_path(name)` - Get worktree path by semantic name++**Environment Isolation (critical for test stability):**+- Set `GIT_CONFIG_GLOBAL=/dev/null` - Ignore user's global config+- Set `GIT_CONFIG_SYSTEM=/dev/null` - Ignore system config+- Set `user.name = "Test User"` and `user.email = "[email protected]"`+- Set `GIT_AUTHOR_DATE = "2025-01-01T00:00:00Z"` - Fixed commit timestamps+- Set `GIT_COMMITTER_DATE = "2025-01-01T00:00:00Z"`+- Set `LC_ALL=C` and `LANG=C` - Force English git messages+- Set `SOURCE_DATE_EPOCH=1704067200` - Reproducible builds++### Snapshot Normalization Strategy++**Challenge:** Git output contains non-deterministic data:+- Absolute paths (different per test run, per machine)+- Git SHAs (different per test run)+- Path separators (Windows `\` vs Unix `/`)++**Solution:** Use insta's built-in filter system++```rust+use insta::Settings;+use std::process::Command;++fn snapshot_cmd(repo: &TestRepo, args: &[&str]) -> String {+ let mut settings = Settings::clone_current();++ // Normalize paths - replace absolute paths with semantic names+ settings.add_filter(repo.root_path().to_str().unwrap(), "[REPO]");+ for (name, path) in &repo.worktrees {+ settings.add_filter(path.to_str().unwrap(), &format!("[WORKTREE_{}]", name.to_uppercase()));+ }++ // Normalize git SHAs (7-40 hex chars) to [SHA]+ settings.add_regex(r"\b[0-9a-f]{7,40}\b", "[SHA]");++ // Normalize Windows paths to Unix style+ settings.add_regex(r"\\", "/");++ settings.bind(|| {+ assert_cmd_snapshot!(Command::new(get_cargo_bin("arbor")).args(args));+ });+}+```++**Key decisions:**+- ✅ **Use insta filters from the start** (not custom string replacement)+- ✅ **Track worktrees by semantic name** (not index) for stability+- ✅ **Normalize path separators** for cross-platform snapshots+- ✅ **Use regex for SHA normalization** (requires `regex` crate in filters)++### Test Scenarios++**Basic scenarios (Phase 1):**+1. Single worktree (main only)+2. Multiple worktrees on different branches+3. Detached HEAD worktree+4. Bare repository worktree+5. Locked worktree (with and without reason)+6. Prunable worktree (removed directory)++**Edge cases (Phase 2):**+7. Worktree with dirty state+8. Worktree with merge in progress+9. Worktree with rebase in progress+10. Missing worktree directory+11. Worktree at repository root+12. Nested worktree paths++**Advanced scenarios (Phase 3):**+13. Fast-forward push scenarios+14. Merge conflict scenarios+15. Squash merge scenarios+16. Multiple worktrees with same base commit++**Error cases (all phases):**+17. Running outside a git repository+18. Invalid command arguments+19. Attempting to create worktree with existing name+20. Permission denied on worktree directory+21. Corrupted git state (missing refs, invalid objects)++### Dependencies++```toml+[dev-dependencies]+insta = { version = "1.40", features = ["yaml", "redactions", "filters"] }+insta-cmd = "0.6"+assert_cmd = "2.0" # For get_cargo_bin() helper+tempfile = "3.14" # For temporary test directories+```++**Notes:**+- `yaml` feature for readable snapshots+- `redactions` and `filters` for path/SHA normalization with regex+- `assert_cmd` provides `get_cargo_bin()` for locating test binaries++### Workflow++**Development:**+1. Build binary: `cargo build` (required before insta-cmd tests)+2. Write test that creates git repo scenario+3. Run `cargo insta test` - creates initial snapshots+4. Review snapshots with `cargo insta review`+5. Accept/reject changes, commit accepted snapshots+6. Future changes: `cargo insta test` shows diffs, review and accept/reject++**CI:**+- Run `cargo insta test --check` - fails if snapshots need review+- Rejects PRs with pending snapshot reviews or missing snapshots+- Use `--test-threads=1` if global state isolation issues arise++### Implementation Decisions++1. ✅ **Normalization:** Use insta's built-in filters (not custom string replacement)+2. ✅ **Binary build:** Explicit `cargo build` step documented in workflow+3. ✅ **Snapshot format:** External files for all tests (easier PR review)+4. ✅ **Test structure:** Follow Rust 2018+ conventions (`tests/common/`, not `tests/integration/`)+5. ✅ **Worktree tracking:** Semantic names (not indices) for stable snapshots+6. ✅ **Git version:** Document minimum required version (2.5+) in tests## Success Criteriadiff --git a/snapshots/test_list__detached_head.snap b/snapshots/test_list__detached_head.snapnew file mode 100644index 000000000..3b8c09f67--- /dev/null+++ b/snapshots/test_list__detached_head.snap@@ -0,0 +1,16 @@+---+source: tests/test_list.rs+info:+ program: arbor+ args:+ - list+---+success: true+exit_code: 0+----- stdout -----+[REPO]+ HEAD: [SHA]+ (detached)+++----- stderr -----diff --git a/snapshots/test_list__locked_no_reason.snap b/snapshots/test_list__locked_no_reason.snapnew file mode 100644index 000000000..249d74604--- /dev/null+++ b/snapshots/test_list__locked_no_reason.snap@@ -0,0 +1,21 @@+---+source: tests/test_list.rs+info:+ program: arbor+ args:+ - list+---+success: true+exit_code: 0+----- stdout -----+[REPO]+ HEAD: [SHA]+ branch: main++[WORKTREE_LOCKED_NO_REASON]+ HEAD: [SHA]+ branch: locked-no-reason+ (locked)+++----- stderr -----diff --git a/snapshots/test_list__locked_worktree.snap b/snapshots/test_list__locked_worktree.snapnew file mode 100644index 000000000..fd99620ae--- /dev/null+++ b/snapshots/test_list__locked_worktree.snap@@ -0,0 +1,21 @@+---+source: tests/test_list.rs+info:+ program: arbor+ args:+ - list+---+success: true+exit_code: 0+----- stdout -----+[REPO]+ HEAD: [SHA]+ branch: main++[WORKTREE_LOCKED_FEATURE]+ HEAD: [SHA]+ branch: locked-feature+ (locked: Testing lock functionality)+++----- stderr -----diff --git a/snapshots/test_list__multiple_worktrees.snap b/snapshots/test_list__multiple_worktrees.snapnew file mode 100644index 000000000..cf3d4a3c9--- /dev/null+++ b/snapshots/test_list__multiple_worktrees.snap@@ -0,0 +1,24 @@+---+source: tests/test_list.rs+info:+ program: arbor+ args:+ - list+---+success: true+exit_code: 0+----- stdout -----+[REPO]+ HEAD: [SHA]+ branch: main++[WORKTREE_FEATURE_A]+ HEAD: [SHA]+ branch: feature-a++[WORKTREE_FEATURE_B]+ HEAD: [SHA]+ branch: feature-b+++----- stderr -----diff --git a/snapshots/test_list__single_worktree.snap b/snapshots/test_list__single_worktree.snapnew file mode 100644index 000000000..b40406a09--- /dev/null+++ b/snapshots/test_list__single_worktree.snap@@ -0,0 +1,16 @@+---+source: tests/test_list.rs+info:+ program: arbor+ args:+ - list+---+success: true+exit_code: 0+----- stdout -----+[REPO]+ HEAD: [SHA]+ branch: main+++----- stderr -----diff --git a/src/git.rs b/src/git.rsnew file mode 100644index 000000000..9d8e27928--- /dev/null+++ b/src/git.rs@@ -0,0 +1,200 @@+use std::path::PathBuf;+use std::process::Command;++#[derive(Debug, Clone, PartialEq)]+pub struct Worktree {+ pub path: PathBuf,+ pub head: String,+ pub branch: Option<String>,+ pub bare: bool,+ pub detached: bool,+ pub locked: Option<String>,+ pub prunable: Option<String>,+}++#[derive(Debug)]+pub enum GitError {+ CommandFailed(String),+ ParseError(String),+}++impl std::fmt::Display for GitError {+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {+ match self {+ GitError::CommandFailed(msg) => write!(f, "Git command failed: {}", msg),+ GitError::ParseError(msg) => write!(f, "Parse error: {}", msg),+ }+ }+}++impl std::error::Error for GitError {}++pub fn list_worktrees() -> Result<Vec<Worktree>, GitError> {+ let output = Command::new("git")+ .args(["worktree", "list", "--porcelain"])+ .output()+ .map_err(|e| GitError::CommandFailed(e.to_string()))?;++ if !output.status.success() {+ let stderr = String::from_utf8_lossy(&output.stderr);+ return Err(GitError::CommandFailed(stderr.to_string()));+ }++ let stdout = String::from_utf8_lossy(&output.stdout);+ parse_worktree_list(&stdout)+}++fn parse_worktree_list(output: &str) -> Result<Vec<Worktree>, GitError> {+ let mut worktrees = Vec::new();+ let mut current = None;++ for line in output.lines() {+ if line.is_empty() {+ if let Some(wt) = current.take() {+ worktrees.push(wt);+ }+ continue;+ }++ let parts: Vec<&str> = line.splitn(2, ' ').collect();+ let key = parts[0];+ let value = parts.get(1).copied();++ match key {+ "worktree" => {+ let path = value.ok_or_else(|| {+ GitError::ParseError("worktree line missing path".to_string())+ })?;+ current = Some(Worktree {+ path: PathBuf::from(path),+ head: String::new(),+ branch: None,+ bare: false,+ detached: false,+ locked: None,+ prunable: None,+ });+ }+ "HEAD" => {+ if let Some(ref mut wt) = current {+ wt.head = value+ .ok_or_else(|| GitError::ParseError("HEAD line missing SHA".to_string()))?+ .to_string();+ }+ }+ "branch" => {+ if let Some(ref mut wt) = current {+ // Strip refs/heads/ prefix if present+ let branch = value+ .ok_or_else(|| GitError::ParseError("branch line missing ref".to_string()))?+ .strip_prefix("refs/heads/")+ .unwrap_or(value.unwrap())+ .to_string();+ wt.branch = Some(branch);+ }+ }+ "bare" => {+ if let Some(ref mut wt) = current {+ wt.bare = true;+ }+ }+ "detached" => {+ if let Some(ref mut wt) = current {+ wt.detached = true;+ }+ }+ "locked" => {+ if let Some(ref mut wt) = current {+ wt.locked = Some(value.unwrap_or("").to_string());+ }+ }+ "prunable" => {+ if let Some(ref mut wt) = current {+ wt.prunable = Some(value.unwrap_or("").to_string());+ }+ }+ _ => {+ // Ignore unknown attributes for forward compatibility+ }+ }+ }++ // Push the last worktree if the output doesn't end with a blank line+ if let Some(wt) = current {+ worktrees.push(wt);+ }++ Ok(worktrees)+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_parse_worktree_list() {+ let output = "worktree /path/to/main+HEAD abcd1234+branch refs/heads/main++worktree /path/to/feature+HEAD efgh5678+branch refs/heads/feature++";++ let worktrees = parse_worktree_list(output).unwrap();+ assert_eq!(worktrees.len(), 2);++ assert_eq!(worktrees[0].path, PathBuf::from("/path/to/main"));+ assert_eq!(worktrees[0].head, "abcd1234");+ assert_eq!(worktrees[0].branch, Some("main".to_string()));+ assert!(!worktrees[0].bare);+ assert!(!worktrees[0].detached);++ assert_eq!(worktrees[1].path, PathBuf::from("/path/to/feature"));+ assert_eq!(worktrees[1].head, "efgh5678");+ assert_eq!(worktrees[1].branch, Some("feature".to_string()));+ }++ #[test]+ fn test_parse_detached_worktree() {+ let output = "worktree /path/to/detached+HEAD abcd1234+detached++";++ let worktrees = parse_worktree_list(output).unwrap();+ assert_eq!(worktrees.len(), 1);+ assert!(worktrees[0].detached);+ assert_eq!(worktrees[0].branch, None);+ }++ #[test]+ fn test_parse_locked_worktree() {+ let output = "worktree /path/to/locked+HEAD abcd1234+branch refs/heads/main+locked reason for lock++";++ let worktrees = parse_worktree_list(output).unwrap();+ assert_eq!(worktrees.len(), 1);+ assert_eq!(worktrees[0].locked, Some("reason for lock".to_string()));+ }++ #[test]+ fn test_parse_bare_worktree() {+ let output = "worktree /path/to/bare+HEAD abcd1234+bare++";++ let worktrees = parse_worktree_list(output).unwrap();+ assert_eq!(worktrees.len(), 1);+ assert!(worktrees[0].bare);+ }+}diff --git a/src/main.rs b/src/main.rsindex e7a11a969..19dc0d12e 100644--- a/src/main.rs+++ b/src/main.rs@@ -1,3 +1,72 @@+mod git;++use clap::{Parser, Subcommand};+use git::{GitError, list_worktrees};++#[derive(Parser)]+#[command(name = "arbor")]+#[command(about = "Git worktree management tool", long_about = None)]+struct Cli {+ #[command(subcommand)]+ command: Commands,+}++#[derive(Subcommand)]+enum Commands {+ /// List all worktrees+ List,+}+fn main() {- println!("Hello, world!");+ let cli = Cli::parse();++ let result = match cli.command {+ Commands::List => list_command(),+ };++ if let Err(e) = result {+ eprintln!("Error: {}", e);+ std::process::exit(1);+ }+}++fn list_command() -> Result<(), GitError> {+ let worktrees = list_worktrees()?;++ for wt in worktrees {+ println!("{}", wt.path.display());+ println!(" HEAD: {}", &wt.head[..8]);++ if let Some(branch) = wt.branch {+ println!(" branch: {}", branch);+ }++ if wt.detached {+ println!(" (detached)");+ }++ if wt.bare {+ println!(" (bare)");+ }++ if let Some(reason) = wt.locked {+ if reason.is_empty() {+ println!(" (locked)");+ } else {+ println!(" (locked: {})", reason);+ }+ }++ if let Some(reason) = wt.prunable {+ if reason.is_empty() {+ println!(" (prunable)");+ } else {+ println!(" (prunable: {})", reason);+ }+ }++ println!();+ }++ Ok(())}diff --git a/tests/common/mod.rs b/tests/common/mod.rsnew file mode 100644index 000000000..7fcf01461--- /dev/null+++ b/tests/common/mod.rs@@ -0,0 +1,162 @@+use std::collections::HashMap;+use std::path::{Path, PathBuf};+use std::process::Command;+use tempfile::TempDir;++pub struct TestRepo {+ temp_dir: TempDir, // Keep temp_dir accessible+ root: PathBuf,+ pub worktrees: HashMap<String, PathBuf>,+}++impl TestRepo {+ /// Create a new test repository with isolated git environment+ pub fn new() -> Self {+ let temp_dir = TempDir::new().expect("Failed to create temp directory");+ // Create main repo as a subdirectory so worktrees can be siblings+ let root = temp_dir.path().join("main");+ std::fs::create_dir(&root).expect("Failed to create main repo directory");+ // Canonicalize to resolve symlinks (important on macOS where /var is symlink to /private/var)+ let root = root+ .canonicalize()+ .expect("Failed to canonicalize temp path");++ // Set up isolated git environment+ unsafe {+ std::env::set_var("GIT_CONFIG_GLOBAL", "/dev/null");+ std::env::set_var("GIT_CONFIG_SYSTEM", "/dev/null");+ std::env::set_var("GIT_AUTHOR_DATE", "2025-01-01T00:00:00Z");+ std::env::set_var("GIT_COMMITTER_DATE", "2025-01-01T00:00:00Z");+ std::env::set_var("LC_ALL", "C");+ std::env::set_var("LANG", "C");+ std::env::set_var("SOURCE_DATE_EPOCH", "1704067200");+ }++ // Initialize git repo+ Command::new("git")+ .args(["init", "-b", "main"])+ .current_dir(&root)+ .output()+ .expect("Failed to init git repo");++ // Configure git user+ Command::new("git")+ .args(["config", "user.name", "Test User"])+ .current_dir(&root)+ .output()+ .expect("Failed to set user.name");++ Command::new("git")+ .args(["config", "user.email", "[email protected]"])+ .current_dir(&root)+ .output()+ .expect("Failed to set user.email");++ Self {+ temp_dir,+ root,+ worktrees: HashMap::new(),+ }+ }++ /// Get the root path of the repository+ pub fn root_path(&self) -> &Path {+ &self.root+ }++ /// Get the path to a named worktree+ pub fn worktree_path(&self, name: &str) -> &Path {+ self.worktrees+ .get(name)+ .unwrap_or_else(|| panic!("Worktree '{}' not found", name))+ }++ /// Create a commit with the given message+ pub fn commit(&self, message: &str) {+ // Create a file to ensure there's something to commit+ let file_path = self.root.join("file.txt");+ std::fs::write(&file_path, message).expect("Failed to write file");++ Command::new("git")+ .args(["add", "."])+ .current_dir(&self.root)+ .output()+ .expect("Failed to git add");++ Command::new("git")+ .args(["commit", "-m", message])+ .current_dir(&self.root)+ .output()+ .expect("Failed to git commit");+ }++ /// Add a worktree with the given name and branch+ pub fn add_worktree(&mut self, name: &str, branch: &str) -> PathBuf {+ // Create worktree inside temp directory to ensure cleanup+ let worktree_path = self.temp_dir.path().join(name);++ let output = Command::new("git")+ .args([+ "worktree",+ "add",+ "-b",+ branch,+ worktree_path.to_str().unwrap(),+ ])+ .current_dir(&self.root)+ .output()+ .expect("Failed to execute git worktree add");++ if !output.status.success() {+ panic!(+ "Failed to add worktree:\nstdout: {}\nstderr: {}",+ String::from_utf8_lossy(&output.stdout),+ String::from_utf8_lossy(&output.stderr)+ );+ }++ // Canonicalize worktree path to match what git returns+ let canonical_path = worktree_path+ .canonicalize()+ .expect("Failed to canonicalize worktree path");+ self.worktrees+ .insert(name.to_string(), canonical_path.clone());+ canonical_path+ }++ /// Detach HEAD in the repository+ pub fn detach_head(&self) {+ // Get current commit SHA+ let output = Command::new("git")+ .args(["rev-parse", "HEAD"])+ .current_dir(&self.root)+ .output()+ .expect("Failed to get HEAD SHA");++ let sha = String::from_utf8_lossy(&output.stdout).trim().to_string();++ Command::new("git")+ .args(["checkout", "--detach", &sha])+ .current_dir(&self.root)+ .output()+ .expect("Failed to detach HEAD");+ }++ /// Lock a worktree with an optional reason+ pub fn lock_worktree(&self, name: &str, reason: Option<&str>) {+ let worktree_path = self.worktree_path(name);++ let mut args = vec!["worktree", "lock"];+ if let Some(r) = reason {+ args.push("--reason");+ args.push(r);+ }+ args.push(worktree_path.to_str().unwrap());++ Command::new("git")+ .args(&args)+ .current_dir(&self.root)+ .output()+ .expect("Failed to lock worktree");+ }+}diff --git a/tests/test_list.rs b/tests/test_list.rsnew file mode 100644index 000000000..5577d1e6d--- /dev/null+++ b/tests/test_list.rs@@ -0,0 +1,87 @@+mod common;++use common::TestRepo;+use insta::Settings;+use insta_cmd::{assert_cmd_snapshot, get_cargo_bin};+use std::process::Command;++/// Helper to create snapshot with normalized paths and SHAs+fn snapshot_list(test_name: &str, repo: &TestRepo) {+ let mut settings = Settings::clone_current();+ settings.set_snapshot_path("../snapshots");++ // Normalize paths - replace absolute paths with semantic names+ settings.add_filter(repo.root_path().to_str().unwrap(), "[REPO]");+ for (name, path) in &repo.worktrees {+ settings.add_filter(+ path.to_str().unwrap(),+ &format!("[WORKTREE_{}]", name.to_uppercase().replace('-', "_")),+ );+ }++ // Normalize git SHAs (7-40 hex chars) to [SHA]+ settings.add_filter(r"\b[0-9a-f]{7,40}\b", "[SHA]");++ // Normalize Windows paths to Unix style+ settings.add_filter(r"\\", "/");++ settings.bind(|| {+ assert_cmd_snapshot!(+ test_name,+ Command::new(get_cargo_bin("arbor"))+ .arg("list")+ .current_dir(repo.root_path())+ );+ });+}++#[test]+fn test_list_single_worktree() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ snapshot_list("single_worktree", &repo);+}++#[test]+fn test_list_multiple_worktrees() {+ let mut repo = TestRepo::new();+ repo.commit("Initial commit");++ repo.add_worktree("feature-a", "feature-a");+ repo.add_worktree("feature-b", "feature-b");++ snapshot_list("multiple_worktrees", &repo);+}++#[test]+fn test_list_detached_head() {+ let repo = TestRepo::new();+ repo.commit("Initial commit");++ repo.detach_head();++ snapshot_list("detached_head", &repo);+}++#[test]+fn test_list_locked_worktree() {+ let mut repo = TestRepo::new();+ repo.commit("Initial commit");++ repo.add_worktree("locked-feature", "locked-feature");+ repo.lock_worktree("locked-feature", Some("Testing lock functionality"));++ snapshot_list("locked_worktree", &repo);+}++#[test]+fn test_list_locked_no_reason() {+ let mut repo = TestRepo::new();+ repo.commit("Initial commit");++ repo.add_worktree("locked-no-reason", "locked-no-reason");+ repo.lock_worktree("locked-no-reason", None);++ snapshot_list("locked_no_reason", &repo);+}