commit aef7d973ec224ce817b519f6ec8cdd0372a01ece Author: siujamo Date: Thu Jun 18 17:30:52 2026 +0800 feat: add Claude Code Skill Marketplace manager diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..17f0a29 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2123 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" + +[[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 = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "bzip2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47" +dependencies = [ + "bzip2-sys", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.13+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" +dependencies = [ + "cc", + "pkg-config", +] + +[[package]] +name = "cc" +version = "1.2.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dad887fd958be91b5098c0248def011f4523ab786cd411be668777e55063501f" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "claude-code-skill-manager" +version = "0.1.0" +dependencies = [ + "clap", + "dirs", + "flate2", + "reqwest", + "serde", + "serde_json", + "tar", + "zip", +] + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "deflate64" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac6b926516df9c60bfa16e107b21086399f8285a44ca9711344b9e553c5146e2" + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" + +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "displaydoc" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ac70aa55017e108007fbaf5aa0f54b021c98f92ff8af59d42eda9da96e3dd4f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "flate2" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6970f50e31d6fc17d3fa27329444bfa74e196cf62e95052a3f6fee181dba6425" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55281c53a1894c864990125767da440a4e630446785086f52523b20033b74498" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ca68d021ef39cf6463ab54c1d0f5daf03377b70561305bb89a8f83aab66e0f" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "icu_collections" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2984d1cd16c883d7935b9e07e44071dca8d917fd52ecc02c04d5fa0b5a3f191c" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92219b62b3e2b4d88ac5119f8904c10f8f61bf7e95b640d25ba3075e6cac2c29" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c56e5ee99d6e3d33bd91c5d85458b6005a22140021cc324cea84dd0e72cff3b4" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3be0ae77ea334f4da67c12f149704f19f81d1adf7c51cf482943e84a2bad38" + +[[package]] +name = "icu_properties" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee3b67d0ea5c2cca5003417989af8996f8604e34fb9ddf96208a033901e70de" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2bbb201e0c04f7b4b3e14382af113e17ba4f63e2c9d2ee626b720cbce54a14" + +[[package]] +name = "icu_provider" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139c4cf31c8b5f33d7e199446eff9c1e02decfc2f0eec2c8d71f65befa45b421" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03d04c30968dffe80775bd4d7fb676131cd04a1fb46d2686dbffbaec2d9dfd31" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "libredox" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f02ab6bace2054fb888a3c16f990117b579d14a3088e472d63c6011fa185c9d3" +dependencies = [ + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92daf443525c4cce67b150400bc2316076100ce0b3686209eb8cf3c31612e6f0" + +[[package]] +name = "log" +version = "0.4.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953f07c43838f8e6f9758cab68bf5bed85465e7587ebe0b823f1bcd81978ad3a" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] + +[[package]] +name = "lzma-sys" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "memchr" +version = "2.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pkg-config" +version = "0.3.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19f132c84eca552bf34cab8ec81f1c1dcc229b811638f9d283dceabe58c5569e" + +[[package]] +name = "potential_utf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0103b1cef7ec0cf76490e969665504990193874ea05c85ff9bab8b911d0a0564" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +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 = "rand" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c5af06bb1b7d3216d91932aed5265164bf384dc89cd6ba05cf59a35f5f76ea" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 1.0.69", +] + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe" + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a7197ae7eb376e574fe940d068c30fe0462554a3ddbe4eca7838e049c937a9" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[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.150" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "simd-adler32" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" + +[[package]] +name = "socket2" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52d1cfed4120b4d927bf7c0f86d2087a4a7d6027c906d9f9d525a80573b9be51" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.118" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711a53c2d47bbd818258c498c8dbfe186a2526c631495cfe7e078567f86b8469" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc7f01b389ac15039e4dc9531aa973a135d7a4135281b12d7c1bc79fd57fffe" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[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 = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ddb3f79143bced6de84270411622a2699cee572fc0875aeaf1e7867cf9fca1a" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "503b14d284f2c8dac03b819967e155ea753f573586193b2b2c95990cb5d69280" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e21a184b13fb19e157296e2c46056aec9092264fab83e4ba59e68c61b323c3d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fecefd9c35bd935a20fc3fc344b5f29138961e4f47fb03297d88f2587afb5ebd" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.125" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23939e44bb9a5d7576fa2b563dc2e136628f1224e88a8deed09e04858b77871f" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6430a72df5eb332242960fe84b3002a241163998241eb596d4f739b9757061d" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf85cb06032201fa7c6f829d7db5a7e5aa45bcc0655327713065f6f0576731bf" +dependencies = [ + "rustls-pki-types", +] + +[[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.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +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-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[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.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[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.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[package]] +name = "xattr" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" +dependencies = [ + "libc", + "rustix", +] + +[[package]] +name = "xz2" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" +dependencies = [ + "lzma-sys", +] + +[[package]] +name = "yoke" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de844c262c8848816172cef550288e7dc6c7b7814b4ee56b3e1553f275f1858e" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce1022995ff5ff5d841ad7d994facc23098cd40152f2c1d11cd607c6f530653f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ae7f38b72ec2a254e2b87ef277cf2cd4fb97cbebf944faa6f33354da0867930" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11532158c46691caf0f2593ea8358fed6bbf68a0315e80aae9bd41fbade684a1" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerotrie" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f9152d31db0792fa83f70fb2f83148effb5c1f5b8c7686c3459e361d9bc20bf" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90f911cbc359ab6af17377d242225f4d75119aec87ea711a880987b18cd7b239" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "625dc425cab0dca6dc3c3319506e6593dcb08a9f387ea3b284dbd52a92c40555" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zip" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50" +dependencies = [ + "aes", + "arbitrary", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "deflate64", + "displaydoc", + "flate2", + "getrandom 0.3.4", + "hmac", + "indexmap", + "lzma-rs", + "memchr", + "pbkdf2", + "sha1", + "thiserror 2.0.18", + "time", + "xz2", + "zeroize", + "zopfli", + "zstd", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" + +[[package]] +name = "zopfli" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] + +[[package]] +name = "zstd" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91ee311a569c327171651566e07972200e76fcfe2242a4fa446149a3881c08a" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.16+zstd.1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c591c7e --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "claude-code-skill-manager" +version = "0.1.0" +edition = "2021" + +[[bin]] +name = "ccsm" +path = "src/main.rs" + +[dependencies] +clap = { version = "4", features = ["derive"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" +dirs = "5" +reqwest = { version = "0.12", features = ["blocking", "rustls-tls"], default-features = false } +zip = "2" +flate2 = "1" +tar = "0.4" diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..5baeadb --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,103 @@ +use clap::{Args, Parser, Subcommand}; + +#[derive(Parser)] +#[command( + name = "ccsm", + about = "Claude Code Skill Marketplace — discover and install skills from Git marketplaces", + version +)] +pub struct Cli { + #[command(subcommand)] + pub command: Command, +} + +#[derive(Subcommand)] +pub enum Command { + /// Manage skill marketplaces + #[command(subcommand)] + Marketplace(MarketplaceCommand), + /// Search for skills across all marketplaces + Search(SearchArgs), + /// Install a skill from a marketplace + Install(InstallArgs), + /// List installed skills in the local store + List, + /// Remove an installed skill + Remove(RemoveArgs), + /// Update installed skills + Update(UpdateArgs), + /// Show details about an installed skill + Info(InfoArgs), +} + +#[derive(Subcommand)] +pub enum MarketplaceCommand { + /// Add a new skill marketplace + Add(MarketplaceAddArgs), + /// Remove a marketplace + Remove(MarketplaceRemoveArgs), + /// List configured marketplaces + List, + /// Update marketplace catalogues + Update(MarketplaceUpdateArgs), +} + +#[derive(Args)] +pub struct MarketplaceAddArgs { + /// Git repository URL of the marketplace + pub url: String, + /// Custom name for this marketplace (defaults to repo name) + #[arg(short, long)] + pub name: Option, +} + +#[derive(Args)] +pub struct MarketplaceRemoveArgs { + /// Name of the marketplace to remove + pub name: String, +} + +#[derive(Args)] +pub struct MarketplaceUpdateArgs { + /// Name of the marketplace to update (updates all if omitted) + pub name: Option, +} + +#[derive(Args)] +pub struct SearchArgs { + /// Filter skills by keyword + pub query: Option, +} + +#[derive(Args)] +pub struct InstallArgs { + /// Name of the skill to install + pub name: String, + /// Specify which marketplace to use (required when skill exists in multiple) + #[arg(short, long)] + pub marketplace: Option, + /// Copy skill files into Claude skills directory (default) + #[arg(long)] + pub copy: bool, + /// Create a symlink into Claude skills directory instead of copying + #[arg(long)] + pub link: bool, +} + +#[derive(Args)] +pub struct RemoveArgs { + /// Name of the skill to remove + pub name: String, +} + +#[derive(Args)] +pub struct UpdateArgs { + /// Name of the skill to update (updates all if omitted) + pub name: Option, +} + +#[derive(Args)] +pub struct InfoArgs { + /// Name of the skill + pub name: String, +} diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..bea52a0 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,95 @@ +use serde::{Deserialize, Serialize}; +use std::fs; +use std::io; +use std::path::PathBuf; + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] +#[serde(rename_all = "lowercase")] +pub enum InstallMode { + Copy, + Link, +} + +impl std::fmt::Display for InstallMode { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + InstallMode::Copy => write!(f, "copy"), + InstallMode::Link => write!(f, "link"), + } + } +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct MarketplaceEntry { + pub name: String, + pub url: String, + #[serde(default)] + pub branch: Option, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct Config { + #[serde(default)] + pub marketplaces: Vec, + #[serde(default = "default_mode")] + pub default_mode: InstallMode, +} + +fn default_mode() -> InstallMode { + InstallMode::Copy +} + +impl Config { + pub fn load() -> io::Result { + let path = config_path(); + if path.exists() { + let data = fs::read_to_string(&path)?; + Ok(serde_json::from_str(&data).unwrap_or_default()) + } else { + Ok(Config::default()) + } + } + + pub fn save(&self) -> io::Result<()> { + let path = config_path(); + if let Some(parent) = path.parent() { + fs::create_dir_all(parent)?; + } + let data = serde_json::to_string_pretty(self)?; + fs::write(path, data) + } +} + +impl Default for Config { + fn default() -> Self { + Config { + marketplaces: Vec::new(), + default_mode: default_mode(), + } + } +} + +pub fn ccsm_dir() -> PathBuf { + dirs::config_dir() + .unwrap_or_else(|| PathBuf::from(".")) + .join("ccsm") +} + +fn config_path() -> PathBuf { + ccsm_dir().join("config.json") +} + +pub fn marketplaces_cache_dir() -> PathBuf { + ccsm_dir().join("marketplaces") +} + +pub fn skills_store_dir() -> PathBuf { + ccsm_dir().join("skills") +} + +pub fn claude_skills_dir() -> PathBuf { + dirs::home_dir() + .unwrap_or_else(|| PathBuf::from(".")) + .join(".claude") + .join("skills") +} diff --git a/src/download.rs b/src/download.rs new file mode 100644 index 0000000..242d9c2 --- /dev/null +++ b/src/download.rs @@ -0,0 +1,208 @@ +use std::fs; +use std::io::{self, Cursor, Read}; +use std::path::Path; + +pub fn get_json(url: &str) -> Result { + let resp = reqwest::blocking::get(url) + .map_err(|e| format!("HTTP request failed: {e}"))?; + + let status = resp.status(); + if !status.is_success() { + return Err(format!("HTTP {status} from {url}")); + } + + resp.text() + .map_err(|e| format!("Cannot read response body: {e}")) +} + +pub fn fetch_marketplace_manifest(repo_url: &str) -> Result<(String, String), String> { + let base = repo_url.trim_end_matches('/').trim_end_matches(".git"); + + for branch in &["main", "master"] { + let url = format!("{base}/raw/branch/{branch}/skills.json"); + match get_json(&url) { + Ok(json) => return Ok((json, branch.to_string())), + Err(_) => continue, + } + } + + Err(format!( + "Cannot fetch skills.json from {base}. Tried branches 'main' and 'master'.\n\ + Make sure the repository is public and contains skills.json at its root." + )) +} + +pub fn download_skill(repo_url: &str, branch: &str, dest: &Path) -> Result<(), String> { + let base = repo_url.trim_end_matches('/').trim_end_matches(".git"); + + let mut last_err = String::new(); + + for ext in &["zip", "tar.gz"] { + let url = format!("{base}/archive/{branch}.{ext}"); + match download_and_extract(&url, dest) { + Ok(()) => return Ok(()), + Err(e) => { + last_err = e; + continue; + } + } + } + + Err(format!("Cannot download skill from {base}: {last_err}")) +} + +fn download_and_extract(url: &str, dest: &Path) -> Result<(), String> { + let resp = reqwest::blocking::get(url) + .map_err(|e| format!("HTTP request failed: {e}"))?; + + let status = resp.status(); + if !status.is_success() { + return Err(format!("HTTP {status}")); + } + + let bytes = resp + .bytes() + .map_err(|e| format!("Cannot read response body: {e}"))?; + + if url.ends_with(".zip") { + extract_zip(&bytes, dest) + } else if url.ends_with(".tar.gz") { + extract_tar_gz(&bytes, dest) + } else if bytes.len() >= 2 && &bytes[..2] == b"PK" { + extract_zip(&bytes, dest) + } else if bytes.len() >= 2 && &bytes[..2] == b"\x1f\x8b" { + extract_tar_gz(&bytes, dest) + } else { + Err("Unknown archive format".to_string()) + } +} + +fn extract_zip(data: &[u8], dest: &Path) -> Result<(), String> { + let cursor = Cursor::new(data); + let mut archive = + zip::ZipArchive::new(cursor).map_err(|e| format!("Cannot open zip: {e}"))?; + + let prefix = detect_strip_prefix_zip(&mut archive); + + for i in 0..archive.len() { + let mut file = archive + .by_index(i) + .map_err(|e| format!("Cannot read zip entry: {e}"))?; + + let name = file.name().to_string(); + let entry_path = match &prefix { + Some(p) => match name.strip_prefix(p) { + Some(rest) if !rest.is_empty() => rest, + _ => continue, + }, + None => &name, + }; + + let out_path = dest.join(entry_path); + + if file.is_dir() { + fs::create_dir_all(&out_path) + .map_err(|e| format!("Cannot create dir {}: {e}", out_path.display()))?; + } else { + if let Some(parent) = out_path.parent() { + fs::create_dir_all(parent) + .map_err(|e| format!("Cannot create dir {}: {e}", parent.display()))?; + } + let mut out = fs::File::create(&out_path) + .map_err(|e| format!("Cannot create file {}: {e}", out_path.display()))?; + io::copy(&mut file, &mut out) + .map_err(|e| format!("Cannot write file {}: {e}", out_path.display()))?; + } + } + + Ok(()) +} + +fn extract_tar_gz(data: &[u8], dest: &Path) -> Result<(), String> { + let decoder = flate2::read::GzDecoder::new(data); + let mut archive = tar::Archive::new(decoder); + + let entries: Vec<_> = archive + .entries() + .map_err(|e| format!("Cannot read tar: {e}"))? + .collect::, _>>() + .map_err(|e| format!("Cannot read tar entry: {e}"))?; + + let prefix = detect_strip_prefix_tar(&entries); + + for mut entry in entries { + let path = entry + .path() + .map_err(|e| format!("Cannot read entry path: {e}"))?; + let path_str = path.to_string_lossy().to_string(); + + let entry_path = match &prefix { + Some(p) => match path_str.strip_prefix(p) { + Some(rest) if !rest.is_empty() => rest, + _ => continue, + }, + None => &path_str, + }; + + let out_path = dest.join(entry_path); + + if entry.header().entry_type().is_dir() { + fs::create_dir_all(&out_path) + .map_err(|e| format!("Cannot create dir {}: {e}", out_path.display()))?; + } else { + if let Some(parent) = out_path.parent() { + fs::create_dir_all(parent) + .map_err(|e| format!("Cannot create dir {}: {e}", parent.display()))?; + } + entry + .unpack(&out_path) + .map_err(|e| format!("Cannot unpack {}: {e}", out_path.display()))?; + } + } + + Ok(()) +} + +fn detect_strip_prefix_zip(archive: &mut zip::ZipArchive>) -> Option { + let mut top_dirs: Vec = Vec::new(); + for i in 0..archive.len() { + if let Ok(file) = archive.by_index(i) { + let name = file.name(); + if let Some(slash_pos) = name.find('/') { + let top = &name[..=slash_pos]; + if top_dirs.is_empty() || top_dirs[0] == top { + top_dirs.push(top.to_string()); + } else { + return None; + } + } else if !name.is_empty() { + return None; + } + } + } + if top_dirs.len() >= 2 { + Some(top_dirs[0].clone()) + } else { + None + } +} + +fn detect_strip_prefix_tar(entries: &[tar::Entry]) -> Option { + let mut prefix: Option = None; + for entry in entries { + if let Ok(path) = entry.path() { + let path_str = path.to_string_lossy().to_string(); + if let Some(slash_pos) = path_str.find('/') { + let top = &path_str[..=slash_pos]; + match &prefix { + Some(p) if p != top => return None, + None => prefix = Some(top.to_string()), + _ => {} + } + } else if !path_str.is_empty() { + return None; + } + } + } + prefix +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..523dd11 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,210 @@ +mod cli; +mod config; +mod download; +mod marketplace; +mod skill; + +use clap::Parser; +use cli::{Cli, Command, MarketplaceCommand}; +use config::InstallMode; + +fn main() { + let cli = Cli::parse(); + + if let Err(e) = run(cli) { + eprintln!("Error: {e}"); + std::process::exit(1); + } +} + +fn run(cli: Cli) -> Result<(), String> { + match cli.command { + Command::Marketplace(cmd) => run_marketplace(cmd), + Command::Search(args) => { + let results = marketplace::search(args.query.as_deref())?; + if results.is_empty() { + println!("No skills found."); + if args.query.is_none() { + println!( + "No marketplaces configured, or all marketplaces are empty." + ); + println!("Use `ccsm marketplace add ` to add a marketplace."); + } + } else { + println!("Found {} skill(s):\n", results.len()); + for (market, skill) in &results { + println!(" {} ({})", skill.name, market); + println!(" {}\n", skill.description); + } + } + Ok(()) + } + Command::Install(args) => { + let mode = if args.link { + Some(InstallMode::Link) + } else if args.copy { + Some(InstallMode::Copy) + } else { + None + }; + + let mode_label = match &mode { + Some(InstallMode::Link) => " (link)", + Some(InstallMode::Copy) => " (copy)", + None => "", + }; + + let s = skill::install(&args.name, args.marketplace.as_deref(), mode)?; + println!( + "Installed skill '{}'{}", + s.name, mode_label + ); + println!(" Store: {}", s.path.display()); + println!(" Claude: {}", config::claude_skills_dir().join(&s.name).display()); + println!(" Remote: {}", s.remote_url); + println!(" Branch: {}", s.branch); + Ok(()) + } + Command::List => { + let skills = skill::list()?; + if skills.is_empty() { + println!("No skills installed."); + println!("Store: {}", config::skills_store_dir().display()); + println!( + "Use `ccsm search` to browse available skills, then `ccsm install `." + ); + } else { + println!("Installed skills ({})\n", skills.len()); + for s in &skills { + let has_manifest = has_skill_manifest(&s.path); + let marker = if has_manifest { " " } else { "?" }; + let mode_str = match &s.mode { + Some(InstallMode::Link) => "[link]".to_string(), + Some(InstallMode::Copy) => "[copy]".to_string(), + None => String::new(), + }; + println!(" {marker} {} {mode_str}", s.name); + } + if skills + .iter() + .any(|s| !has_skill_manifest(&s.path)) + { + println!( + "\n (?) No SKILL.md or CLAUDE.md found — these may not be valid skill repos." + ); + } + } + Ok(()) + } + Command::Remove(args) => { + skill::remove(&args.name)?; + println!("Removed skill '{}'", args.name); + Ok(()) + } + Command::Update(args) => { + let results = skill::update(args.name.as_deref())?; + if results.is_empty() { + println!("No skills to update."); + } + for (name, msg) in &results { + println!("{name}: {msg}"); + } + Ok(()) + } + Command::Info(args) => { + let s = skill::info(&args.name)?; + println!("Skill: {}", s.name); + println!(" Store: {}", s.path.display()); + println!( + " Claude: {}", + config::claude_skills_dir().join(&s.name).display() + ); + + let deploy_status = match &s.mode { + Some(InstallMode::Link) => "linked", + Some(InstallMode::Copy) => "copied", + None => "not deployed", + }; + println!(" Status: {deploy_status}"); + + let skill_md = s.path.join("SKILL.md"); + let claude_md = s.path.join("CLAUDE.md"); + if skill_md.exists() { + println!(" Manifest: SKILL.md"); + } else if claude_md.exists() { + println!(" Manifest: CLAUDE.md"); + } else { + println!(" Manifest: none found"); + } + + let entries = std::fs::read_dir(&s.path) + .map_err(|e| format!("Cannot read skill directory: {e}"))?; + let mut files = Vec::new(); + for entry in entries { + let entry = entry.map_err(|e| format!("I/O error: {e}"))?; + let fname = entry.file_name().to_string_lossy().to_string(); + if !fname.starts_with('.') && fname != "target" { + let ft = if entry.path().is_dir() { "/" } else { "" }; + files.push(format!("{fname}{ft}")); + } + } + if !files.is_empty() { + files.sort(); + println!(" Files:"); + for f in &files { + println!(" - {f}"); + } + } + + Ok(()) + } + } +} + +fn run_marketplace(cmd: MarketplaceCommand) -> Result<(), String> { + match cmd { + MarketplaceCommand::Add(args) => { + marketplace::add(&args.url, args.name.as_deref())?; + Ok(()) + } + MarketplaceCommand::Remove(args) => { + marketplace::remove(&args.name)?; + println!("Removed marketplace '{}'", args.name); + Ok(()) + } + MarketplaceCommand::List => { + let markets = marketplace::list()?; + if markets.is_empty() { + println!("No marketplaces configured."); + println!( + "Use `ccsm marketplace add ` to add a skill marketplace." + ); + } else { + println!("Marketplaces ({})\n", markets.len()); + for (entry, count) in &markets { + let branch = entry.branch.as_deref().unwrap_or("?"); + println!( + " {} ({} skills, branch: {})", + entry.name, count, branch + ); + println!(" {}\n", entry.url); + } + } + Ok(()) + } + MarketplaceCommand::Update(args) => { + let results = marketplace::update(args.name.as_deref())?; + for (name, msg) in &results { + println!("{name}: {msg}"); + } + Ok(()) + } + } +} + +fn has_skill_manifest(path: &std::path::Path) -> bool { + path.join("SKILL.md").exists() + || path.join("skill.md").exists() + || path.join("CLAUDE.md").exists() + || path.join("claude.md").exists() +} diff --git a/src/marketplace.rs b/src/marketplace.rs new file mode 100644 index 0000000..8c6bd88 --- /dev/null +++ b/src/marketplace.rs @@ -0,0 +1,273 @@ +use crate::config::{self, Config, MarketplaceEntry}; +use crate::download; +use serde::{Deserialize, Serialize}; +use std::fs; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Manifest { + pub name: String, + #[serde(default)] + pub version: Option, + #[serde(default)] + pub skills: Vec, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct SkillEntry { + pub name: String, + pub description: String, + pub repository: String, + #[serde(default)] + pub branch: Option, +} + +pub fn add(url: &str, name: Option<&str>) -> Result { + let market_name = name + .map(|n| n.to_string()) + .unwrap_or_else(|| repo_name_from_url(url)); + + let mut config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + + if config.marketplaces.iter().any(|m| m.name == market_name) { + return Err(format!( + "Marketplace '{market_name}' is already registered. Use `ccsm marketplace update {market_name}` to refresh." + )); + } + + let (json, branch) = download::fetch_marketplace_manifest(url)?; + let manifest: Manifest = + serde_json::from_str(&json).map_err(|e| format!("Invalid skills.json: {e}"))?; + + // Cache the manifest locally + let cache_dir = config::marketplaces_cache_dir(); + fs::create_dir_all(&cache_dir) + .map_err(|e| format!("Cannot create cache dir: {e}"))?; + fs::write(cache_dir.join(format!("{market_name}.json")), &json) + .map_err(|e| format!("Cannot cache manifest: {e}"))?; + + let entry = MarketplaceEntry { + name: market_name.clone(), + url: url.to_string(), + branch: Some(branch), + }; + config.marketplaces.push(entry.clone()); + config.save().map_err(|e| format!("Cannot save config: {e}"))?; + + println!( + "Marketplace '{}' added ({} skills from \"{}\")", + market_name, + manifest.skills.len(), + manifest.name + ); + + Ok(entry) +} + +pub fn remove(name: &str) -> Result<(), String> { + let mut config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + + let pos = config + .marketplaces + .iter() + .position(|m| m.name == name) + .ok_or_else(|| format!("Marketplace '{name}' not found."))?; + + config.marketplaces.remove(pos); + config.save().map_err(|e| format!("Cannot save config: {e}"))?; + + let cache_path = config::marketplaces_cache_dir().join(format!("{name}.json")); + if cache_path.exists() { + fs::remove_file(&cache_path).ok(); + } + + Ok(()) +} + +pub fn list() -> Result, String> { + let config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + + let mut result = Vec::new(); + for entry in &config.marketplaces { + let manifest = load_cached_manifest(&entry.name); + let count = manifest.map(|m| m.skills.len()).unwrap_or(0); + result.push((entry.clone(), count)); + } + + Ok(result) +} + +pub fn update(name: Option<&str>) -> Result, String> { + let config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + + let targets: Vec = match name { + Some(n) => { + let entry = config + .marketplaces + .iter() + .find(|m| m.name == n) + .ok_or_else(|| format!("Marketplace '{n}' not found."))? + .clone(); + vec![entry] + } + None => config.marketplaces.clone(), + }; + + if targets.is_empty() { + return Err("No marketplaces configured. Use `ccsm marketplace add ` first." + .to_string()); + } + + let mut results = Vec::new(); + for entry in &targets { + let name = entry.name.clone(); + match download::fetch_marketplace_manifest(&entry.url) { + Ok((json, _branch)) => { + let manifest: Manifest = match serde_json::from_str(&json) { + Ok(m) => m, + Err(e) => { + results.push((name, format!("Error: invalid skills.json — {e}"))); + continue; + } + }; + + let cache_dir = config::marketplaces_cache_dir(); + fs::create_dir_all(&cache_dir).ok(); + fs::write(cache_dir.join(format!("{name}.json")), &json).ok(); + + results.push(( + name, + format!("Updated — {} skills available", manifest.skills.len()), + )); + } + Err(e) => results.push((name, format!("Error: {e}"))), + } + } + + Ok(results) +} + +pub fn search(query: Option<&str>) -> Result, String> { + let config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + + if config.marketplaces.is_empty() { + return Err("No marketplaces configured. Use `ccsm marketplace add ` first." + .to_string()); + } + + let mut results = Vec::new(); + let query_lower = query.map(|q| q.to_lowercase()); + + for entry in &config.marketplaces { + let manifest = match load_cached_manifest(&entry.name) { + Ok(m) => m, + Err(_) => continue, + }; + + for skill in manifest.skills { + let matches = match &query_lower { + Some(q) => { + skill.name.to_lowercase().contains(q) + || skill.description.to_lowercase().contains(q) + } + None => true, + }; + + if matches { + results.push((entry.name.clone(), skill)); + } + } + } + + results.sort_by(|a, b| a.1.name.cmp(&b.1.name)); + Ok(results) +} + +pub fn resolve_skill( + name: &str, + marketplace: Option<&str>, +) -> Result<(MarketplaceEntry, SkillEntry), String> { + let config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + + let mut matches = Vec::new(); + + for entry in &config.marketplaces { + if let Some(ref mkt) = marketplace { + if entry.name != *mkt { + continue; + } + } + + let manifest = match load_cached_manifest(&entry.name) { + Ok(m) => m, + Err(_) => continue, + }; + + for skill in &manifest.skills { + if skill.name == name { + matches.push((entry.clone(), skill.clone())); + } + } + } + + match matches.len() { + 0 => Err(format!( + "Skill '{name}' not found in any marketplace. Use `ccsm search` to browse available skills." + )), + 1 => Ok(matches.pop().unwrap()), + _ => { + let market_names: Vec = + matches.iter().map(|(m, _)| m.name.clone()).collect(); + Err(format!( + "Skill '{name}' found in multiple marketplaces: {}. Use --marketplace to specify which one.", + market_names.join(", ") + )) + } + } +} + +pub fn load_cached_manifest(name: &str) -> Result { + let path = config::marketplaces_cache_dir().join(format!("{name}.json")); + if !path.exists() { + return Err(format!("Marketplace '{name}' cache not found. Run `ccsm marketplace update {name}`.")); + } + let data = fs::read_to_string(&path).map_err(|e| format!("Cannot read cache: {e}"))?; + serde_json::from_str(&data).map_err(|e| format!("Invalid cached manifest: {e}")) +} + +fn repo_name_from_url(url: &str) -> String { + url.trim_end_matches('/') + .trim_end_matches(".git") + .rsplit('/') + .next() + .unwrap_or("marketplace") + .to_string() +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_repo_name_from_url_https() { + assert_eq!( + repo_name_from_url("https://github.com/user/my-skill.git"), + "my-skill" + ); + } + + #[test] + fn test_repo_name_from_url_no_git_suffix() { + assert_eq!( + repo_name_from_url("https://github.com/user/my-skill"), + "my-skill" + ); + } + + #[test] + fn test_repo_name_from_url_trailing_slash() { + assert_eq!( + repo_name_from_url("https://github.com/user/my-skill/"), + "my-skill" + ); + } +} diff --git a/src/skill.rs b/src/skill.rs new file mode 100644 index 0000000..c234a1b --- /dev/null +++ b/src/skill.rs @@ -0,0 +1,309 @@ +use crate::config::{self, Config, InstallMode}; +use crate::download; +use crate::marketplace; +use serde::{Deserialize, Serialize}; +use std::fs; +use std::io; +use std::path::PathBuf; + +#[derive(Debug, Serialize, Deserialize)] +pub struct Skill { + pub name: String, + pub path: PathBuf, + pub remote_url: String, + pub branch: String, + #[serde(default)] + pub mode: Option, +} + +pub fn install( + name: &str, + marketplace_name: Option<&str>, + mode: Option, +) -> Result { + let (_, entry) = marketplace::resolve_skill(name, marketplace_name)?; + + let store_dir = config::skills_store_dir(); + fs::create_dir_all(&store_dir) + .map_err(|e| format!("Cannot create skills store: {e}"))?; + + let target = store_dir.join(name); + + if target.exists() { + return Err(format!( + "Skill '{name}' is already in the store. Use `ccsm update {name}` to refresh, or `ccsm remove {name}` first." + )); + } + + let branch = entry.branch.as_deref().unwrap_or("main"); + download::download_skill(&entry.repository, branch, &target)?; + + // Deploy to Claude skills directory (copy or link) + let config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + let deploy_mode = mode.unwrap_or_else(|| config.default_mode.clone()); + deploy_skill(name, &target, &deploy_mode)?; + + Ok(Skill { + name: name.to_string(), + path: target, + remote_url: entry.repository, + branch: branch.to_string(), + mode: Some(deploy_mode), + }) +} + +fn deploy_skill(name: &str, source: &PathBuf, mode: &InstallMode) -> Result<(), String> { + let claude_dir = config::claude_skills_dir(); + fs::create_dir_all(&claude_dir) + .map_err(|e| format!("Cannot create Claude skills dir: {e}"))?; + + let dest = claude_dir.join(name); + + match mode { + InstallMode::Copy => { + if dest.exists() { + fs::remove_dir_all(&dest).ok(); + } + copy_dir_all(source, &dest) + .map_err(|e| format!("Cannot copy skill to {}: {e}", dest.display()))?; + } + InstallMode::Link => { + if dest.exists() { + // Remove existing link or directory + if dest.is_symlink() || dest.is_dir() { + fs::remove_dir_all(&dest).ok(); + #[cfg(windows)] + { + // On Windows, directory symlinks may need junction handling + fs::remove_dir(&dest).ok(); + } + } + } + symlink_dir(source, &dest)?; + } + } + + Ok(()) +} + +fn copy_dir_all(src: &PathBuf, dst: &PathBuf) -> io::Result<()> { + fs::create_dir_all(dst)?; + for entry in fs::read_dir(src)? { + let entry = entry?; + let ty = entry.file_type()?; + let src_path = entry.path(); + let dst_path = dst.join(entry.file_name()); + + if ty.is_dir() { + copy_dir_all(&src_path, &dst_path)?; + } else { + fs::copy(&src_path, &dst_path)?; + } + } + Ok(()) +} + +#[cfg(unix)] +fn symlink_dir(src: &PathBuf, dst: &PathBuf) -> Result<(), String> { + std::os::unix::fs::symlink(src, dst) + .map_err(|e| format!("Cannot create symlink: {e}")) +} + +#[cfg(windows)] +fn symlink_dir(src: &PathBuf, dst: &PathBuf) -> Result<(), String> { + std::os::windows::fs::symlink_dir(src, dst) + .map_err(|e| format!("Cannot create symlink: {e}. Directory symlinks require Windows 10+ with Developer Mode enabled, or administrator privileges.")) +} + +pub fn list() -> Result, String> { + let dir = config::skills_store_dir(); + + if !dir.exists() { + return Ok(Vec::new()); + } + + let entries = fs::read_dir(&dir).map_err(|e| format!("Cannot read skills store: {e}"))?; + + let mut skills = Vec::new(); + + for entry in entries { + let entry = entry.map_err(|e| format!("I/O error: {e}"))?; + let path = entry.path(); + + if !path.is_dir() { + continue; + } + + let name = path + .file_name() + .unwrap_or_default() + .to_string_lossy() + .to_string(); + + // We don't have git remotes anymore, so omit remote_url and branch for now + let mode = detect_deploy_mode(&path); + skills.push(Skill { + name, + path, + remote_url: String::new(), + branch: String::new(), + mode, + }); + } + + skills.sort_by(|a, b| a.name.cmp(&b.name)); + Ok(skills) +} + +pub fn remove(name: &str) -> Result<(), String> { + let store_dir = config::skills_store_dir(); + let target = store_dir.join(name); + + // Remove from Claude skills if present (copy or link) + let claude_target = config::claude_skills_dir().join(name); + if claude_target.exists() { + fs::remove_dir_all(&claude_target) + .map_err(|e| format!("Cannot remove skill from Claude dir: {e}"))?; + } + + // Remove from store + if target.exists() { + fs::remove_dir_all(&target) + .map_err(|e| format!("Cannot remove skill from store: {e}"))?; + } else { + return Err(format!("Skill '{name}' is not installed.")); + } + + Ok(()) +} + +pub fn update(name: Option<&str>) -> Result, String> { + let store_dir = config::skills_store_dir(); + if !store_dir.exists() { + return Err("No skills installed.".to_string()); + } + + let config = Config::load().map_err(|e| format!("Cannot read config: {e}"))?; + + let targets: Vec<(String, PathBuf, Option)> = match name { + Some(n) => { + let p = store_dir.join(n); + if !p.exists() { + return Err(format!("Skill '{n}' is not installed.")); + } + let mode = detect_deploy_mode(&p); + vec![(n.to_string(), p, mode)] + } + None => { + let entries = + fs::read_dir(&store_dir).map_err(|e| format!("Cannot read skills store: {e}"))?; + let mut paths = Vec::new(); + for entry in entries { + let entry = entry.map_err(|e| format!("I/O error: {e}"))?; + let path = entry.path(); + if path.is_dir() { + let skill_name = path + .file_name() + .unwrap_or_default() + .to_string_lossy() + .to_string(); + let mode = detect_deploy_mode(&path); + paths.push((skill_name, path, mode)); + } + } + paths + } + }; + + let mut results = Vec::new(); + + for (skill_name, _path, deploy_mode) in &targets { + // Find the skill in a marketplace to get its repo URL + let manifest_skill = find_skill_in_marketplaces(skill_name, &config); + + match manifest_skill { + Some((_mkt_entry, skill_entry)) => { + let branch = skill_entry.branch.as_deref().unwrap_or("main"); + + // Remove old version + let old_path = store_dir.join(skill_name); + if old_path.exists() { + fs::remove_dir_all(&old_path).ok(); + } + + match download::download_skill(&skill_entry.repository, branch, &old_path) { + Ok(()) => { + // Redeploy if previously deployed + if deploy_mode.is_some() || config.default_mode != InstallMode::Copy { + let mode = deploy_mode + .clone() + .unwrap_or_else(|| config.default_mode.clone()); + match deploy_skill(skill_name, &old_path, &mode) { + Ok(()) => results.push((skill_name.clone(), "Updated".to_string())), + Err(e) => results.push((skill_name.clone(), format!("Downloaded but deploy failed: {e}"))), + } + } else { + results.push((skill_name.clone(), "Updated".to_string())); + } + } + Err(e) => results.push((skill_name.clone(), format!("Error: {e}"))), + } + } + None => { + results.push(( + skill_name.clone(), + "Warning: skill not found in any marketplace; cannot update".to_string(), + )); + } + } + } + + Ok(results) +} + +pub fn info(name: &str) -> Result { + let target = config::skills_store_dir().join(name); + if !target.exists() { + return Err(format!("Skill '{name}' is not installed.")); + } + + let mode = detect_deploy_mode(&target); + Ok(Skill { + name: name.to_string(), + path: target, + remote_url: String::new(), + branch: String::new(), + mode, + }) +} + +fn detect_deploy_mode(path: &PathBuf) -> Option { + let claude_target = config::claude_skills_dir().join( + path.file_name().unwrap_or_default(), + ); + + if !claude_target.exists() { + return None; + } + + if claude_target.is_symlink() { + Some(InstallMode::Link) + } else { + Some(InstallMode::Copy) + } +} + +fn find_skill_in_marketplaces( + name: &str, + config: &Config, +) -> Option<(config::MarketplaceEntry, marketplace::SkillEntry)> { + for entry in &config.marketplaces { + let manifest = marketplace::load_cached_manifest(&entry.name).ok()?; + for skill in &manifest.skills { + if skill.name == name { + return Some((entry.clone(), skill.clone())); + } + } + } + None +}