commit 6c5536733f3c713df7265beb479e31a08f46b6e4 Author: Breadway Date: Sat Jun 6 13:26:48 2026 +0800 Init commit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..72172ba --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: release + +on: + push: + tags: ["v*"] + +env: + DL_DIR: /srv/breadway-dl + ECOSYSTEM_DIR: /home/breadway/Projects/bread-ecosystem + +jobs: + build: + runs-on: [self-hosted, hestia] + steps: + - uses: actions/checkout@v4 + + - name: build + run: cargo build --release --locked + + - name: prepare artifacts + run: | + VERSION="${GITHUB_REF_NAME#v}" + PKG_DIR="${DL_DIR}/bakery/${VERSION}" + mkdir -p "${PKG_DIR}" + + cp target/release/bakery "${PKG_DIR}/bakery-x86_64" + strip "${PKG_DIR}/bakery-x86_64" + sha256sum "${PKG_DIR}/bakery-x86_64" | awk '{print $1}' \ + > "${PKG_DIR}/bakery-x86_64.sha256" + + # Update the 'latest' symlink. + ln -sfn "${PKG_DIR}" "${DL_DIR}/bakery/latest" + + - name: regenerate index.json + run: bash "${ECOSYSTEM_DIR}/scripts/gen-index.sh" + + - name: upload to GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${GITHUB_REF_NAME#v}" + PKG_DIR="${DL_DIR}/bakery/${VERSION}" + gh release upload "${GITHUB_REF_NAME}" \ + "${PKG_DIR}/bakery-x86_64" \ + "${PKG_DIR}/bakery-x86_64.sha256" \ + --clobber diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..78dd279 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1843 @@ +# 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 = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[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 = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "bakery" +version = "0.1.0" +dependencies = [ + "anyhow", + "chrono", + "clap", + "dirs", + "hex", + "serde", + "serde_json", + "sha2", + "toml 0.8.23", + "ureq", +] + +[[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 = "bread-theme" +version = "0.1.0" +dependencies = [ + "dirs", + "gtk4", + "serde", + "serde_json", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "cairo-rs" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cc8d9aa793480744cd9a0524fef1a2e197d9eaa0f739cde19d16aba530dcb95" +dependencies = [ + "bitflags", + "cairo-sys-rs", + "glib", + "libc", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8b4985713047f5faee02b8db6a6ef32bbb50269ff53c1aee716d1d195b76d54" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "cc" +version = "1.2.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556e016178bb5662a08681bbe0f00f8e17631781a4dfc8c45e466e4b185ec27f" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-expr" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb693542bcafa528e198be0ebd9d3632ca5b7c93dbe7237460e199910835997c" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-traits", + "wasm-bindgen", + "windows-link", +] + +[[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 = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[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 = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[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 = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[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", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-executor" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" + +[[package]] +name = "futures-macro" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[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-macro", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f420376dbee041b2db374ce4573892a36222bb3f6c0c43e24f0d67eae9b646" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48f31b37b1fc4b48b54f6b91b7ef04c18e00b4585d98359dd7b998774bbd91fb" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk4" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd42fdbbf48612c6e8f47c65fb92d2e8f39c25aecd6af047e83897c1a22d2a4e" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk4-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk4-sys" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d974ac4f15e67472c3a9728daf612590b4a5762a4b33f0edd298df0b80d043c" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[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", + "libc", + "wasi", +] + +[[package]] +name = "gio" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3848bcba3a35cc0a71df8ba8ecfd799d6bfb862342a53a4a915fb62213aa4e6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "pin-project-lite", + "smallvec", +] + +[[package]] +name = "gio-sys" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64729ba2772c080448f9f966dba8f4456beeb100d8c28a865ef8a0f2ef4987e1" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "windows-sys 0.61.2", +] + +[[package]] +name = "glib" +version = "0.22.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c207e04e51605dcf7b2924c41591b3a10e1438eaac5bcf448fb91f325381104a" +dependencies = [ + "bitflags", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "506d23499707c7142898429757e8d9a3871d965239a2cb66dfa05052be6d6f19" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "glib-sys" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7fbac234ed5bc2a28359b7bde8e1b9cdf1441cc2d7f068e4824672d7db9445" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "gobject-sys" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22a861859b887a79cf461359c192c97a57d8fb0229dd291232e57aa11f6fa72c" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "graphene-rs" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7d1b7881f96869f49808b6adfe906a93a57a34204952253444d68c3208d71f1" +dependencies = [ + "glib", + "graphene-sys", + "libc", +] + +[[package]] +name = "graphene-sys" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "517f062f3fd6b7fd3e57a3f038a74b3c23ca32f51199ff028aa704609943f79c" +dependencies = [ + "glib-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gsk4" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c912dfcbd28acace5fc99c40bb9f25e1dcb73efb1f2608327f66a99acdcb62" +dependencies = [ + "cairo-rs", + "gdk4", + "glib", + "graphene-rs", + "gsk4-sys", + "libc", + "pango", +] + +[[package]] +name = "gsk4-sys" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d54bbc7a9d8b6ffe4f0c95eede15ccfb365c8bf521275abe6bcfb57b18fb8a" +dependencies = [ + "cairo-sys-rs", + "gdk4-sys", + "glib-sys", + "gobject-sys", + "graphene-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk4" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7181b837f04cbe93f79441475f7a00560a92cba7a72e38cc1a68b6f8b78eaae2" +dependencies = [ + "cairo-rs", + "field-offset", + "futures-channel", + "gdk-pixbuf", + "gdk4", + "gio", + "glib", + "graphene-rs", + "gsk4", + "gtk4-macros", + "gtk4-sys", + "libc", + "pango", +] + +[[package]] +name = "gtk4-macros" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3581b242ba62fdff122ebb626ea641582ec326031622bd19d60f85029c804a87" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "gtk4-sys" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ba8e695e2640455561274e65e45f0a151619e450746007667f4b23ceae4e1b" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk4-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "graphene-sys", + "gsk4-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[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 = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[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 = "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 = "js-sys" +version = "0.3.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142bc4740e452c1e57ade0cbc129f139c9093e354346f0872ef985f4f5cf5f11" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "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 = "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 = "memchr" +version = "2.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[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 = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[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 = "pango" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "251bdc6e6487b811be0e406a21e301e07e45c0aa8fa39e00c0c8e12a91752438" +dependencies = [ + "gio", + "glib", + "libc", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd111a20ca90fedf03e09c59783c679c00900f1d8491cca5399f5e33609d5d6" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[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 = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.12+spec-1.1.0", +] + +[[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 = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustls" +version = "0.23.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef86cd5876211988985292b91c96a8f2d298df24e75989a43a3c73f2d4d8168b" +dependencies = [ + "log", + "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 = [ + "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 = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[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_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" +dependencies = [ + "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 = "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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[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.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[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 = "system-deps" +version = "7.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396a35feb67335377e0251fcbc1092fc85c484bd4e3a7a54319399da127796e7" +dependencies = [ + "cfg-expr", + "heck", + "pkg-config", + "toml 1.1.2+spec-1.1.0", + "version-compare", +] + +[[package]] +name = "target-lexicon" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[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 = "tinystr" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8323304221c2a851516f22236c5722a72eaa19749016521d6dff0824447d96d" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned 1.1.1", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.3", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.15", +] + +[[package]] +name = "toml_edit" +version = "0.25.12+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2153edc6955a6c354fad8f5efd38b6a8769bdccf9fe50f8e1329f81b0baa5d7" +dependencies = [ + "indexmap", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.3", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.3", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "toml_writer" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" + +[[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 = "ureq" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" +dependencies = [ + "base64", + "flate2", + "log", + "once_cell", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "url", + "webpki-roots 0.26.11", +] + +[[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-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasm-bindgen" +version = "0.2.122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed04576f974d2b2fba0f38c51dbc5518011e38c36bf1143164be765528fd409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916151b09da36bd82f6615cbf3a419e2f0ba23a03c6160e8e92eb6bd4aa1dec6" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "299047362ccbfce148b67ab7e73349f77748e00c8296f9542adfad2ad82c5c5e" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.122" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a929b2c61f11ba3e9bc35b50c1f25cb38e0e892c0c231ae2b8cf78d5dad4437" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.7", +] + +[[package]] +name = "webpki-roots" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[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.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", + "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_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_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_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_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[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_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_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_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 = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" +dependencies = [ + "memchr", +] + +[[package]] +name = "writeable" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ffae5123b2d3fc086436f8834ae3ab053a283cfac8fe0a0b8eaae044768a4c4" + +[[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 = "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.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[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 = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..9511358 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,26 @@ +[workspace] +members = ["bakery", "bread-theme"] +resolver = "2" + +[workspace.package] +version = "0.1.0" +edition = "2021" +license = "MIT" +authors = ["Breadway "] + +[workspace.dependencies] +anyhow = "1" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +toml = "0.8" +dirs = "5" +ureq = { version = "2", features = ["json"] } +sha2 = "0.10" +hex = "0.4" +clap = { version = "4", features = ["derive", "env"] } +chrono = "0.4" + +[profile.release] +lto = "thin" +codegen-units = 1 +strip = "symbols" diff --git a/bakery/Cargo.toml b/bakery/Cargo.toml new file mode 100644 index 0000000..b0724b3 --- /dev/null +++ b/bakery/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "bakery" +version.workspace = true +edition.workspace = true +license.workspace = true +authors.workspace = true +description = "Package manager for the bread ecosystem" +repository = "https://github.com/Breadway/bread-ecosystem" + +[dependencies] +anyhow = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +toml = { workspace = true } +dirs = { workspace = true } +ureq = { workspace = true } +sha2 = { workspace = true } +hex = { workspace = true } +clap = { workspace = true } +chrono = { workspace = true } diff --git a/bakery/src/doctor.rs b/bakery/src/doctor.rs new file mode 100644 index 0000000..f36fe45 --- /dev/null +++ b/bakery/src/doctor.rs @@ -0,0 +1,72 @@ +use anyhow::Result; +use std::process::Command; + +/// Check whether a list of system dependencies are present. +/// Returns (missing, warnings) — missing are hard fails, warnings are advisory. +pub fn check_deps(deps: &[String]) -> Result> { + let mut missing = Vec::new(); + for dep in deps { + if !dep_present(dep) { + missing.push(dep.clone()); + } + } + Ok(missing) +} + +fn dep_present(dep: &str) -> bool { + // Try `which` first (covers executables like `iw`, `nmcli`). + if which(dep) { + return true; + } + // Try `pkg-config --exists` for library packages (gtk4, gtk4-layer-shell, librsvg). + pkg_config_exists(dep) +} + +fn which(bin: &str) -> bool { + Command::new("which") + .arg(bin) + .output() + .map(|o| o.status.success()) + .unwrap_or(false) +} + +fn pkg_config_exists(lib: &str) -> bool { + // Arch package names map directly to pkg-config names for GTK libs. + Command::new("pkg-config") + .arg("--exists") + .arg(lib) + .output() + .map(|o| o.status.success()) + .unwrap_or(false) +} + +/// Print a formatted doctor report for a list of system deps. +/// Returns true if all deps are satisfied. +pub fn report(package_name: &str, deps: &[String]) -> bool { + if deps.is_empty() { + println!(" {package_name}: no system deps required"); + return true; + } + match check_deps(deps) { + Err(e) => { + eprintln!(" error running doctor: {e}"); + false + } + Ok(missing) => { + if missing.is_empty() { + println!(" {package_name}: all system deps satisfied"); + true + } else { + eprintln!( + " {package_name}: missing system deps: {}", + missing.join(", ") + ); + eprintln!( + " install with: sudo pacman -S {}", + missing.join(" ") + ); + false + } + } + } +} diff --git a/bakery/src/download.rs b/bakery/src/download.rs new file mode 100644 index 0000000..8701470 --- /dev/null +++ b/bakery/src/download.rs @@ -0,0 +1,47 @@ +use anyhow::{bail, Context, Result}; +use sha2::{Digest, Sha256}; +use std::path::Path; + +use crate::manifest::{fetch_binary, Binary}; + +/// Download a binary to a temp path, verify its SHA-256, then atomically move +/// it into place. Bails before touching `dest` if the checksum fails. +pub fn fetch_and_place(binary: &Binary, dest: &Path) -> Result<()> { + println!(" downloading {}…", binary.name); + let bytes = fetch_binary(&binary.dl_url, &binary.github_url) + .with_context(|| format!("downloading {}", binary.name))?; + + verify_sha256(&bytes, &binary.sha256) + .with_context(|| format!("checksum mismatch for {}", binary.name))?; + + if let Some(dir) = dest.parent() { + std::fs::create_dir_all(dir)?; + } + + let tmp = dest.with_extension("tmp"); + std::fs::write(&tmp, &bytes).context("writing binary to tmp")?; + + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + std::fs::set_permissions(&tmp, std::fs::Permissions::from_mode(0o755))?; + } + + std::fs::rename(&tmp, dest).context("placing binary")?; + println!(" installed {}", dest.display()); + Ok(()) +} + +fn verify_sha256(bytes: &[u8], expected_hex: &str) -> Result<()> { + let mut hasher = Sha256::new(); + hasher.update(bytes); + let actual = hex::encode(hasher.finalize()); + if actual != expected_hex { + bail!( + "SHA-256 mismatch\n expected: {}\n actual: {}", + expected_hex, + actual + ); + } + Ok(()) +} diff --git a/bakery/src/install.rs b/bakery/src/install.rs new file mode 100644 index 0000000..41383f1 --- /dev/null +++ b/bakery/src/install.rs @@ -0,0 +1,253 @@ +use anyhow::{Context, Result}; +use std::path::{Path, PathBuf}; +use std::process::Command; + +use crate::download::fetch_and_place; +use crate::manifest::{Package, Service}; +use crate::state::{InstalledPackage, State}; + +pub fn install_package(pkg: &Package, bin_dir: &Path) -> Result<()> { + println!("installing {}@{}…", pkg.name, pkg.version); + + // 1. Download and verify all binaries. + let mut binary_names = Vec::new(); + for bin in &pkg.binaries { + let dest = bin_dir.join(&bin.name); + fetch_and_place(bin, &dest)?; + binary_names.push(bin.name.clone()); + } + + // 2. Scaffold config dir + example file. + if let Some(cfg) = &pkg.config { + scaffold_config(cfg)?; + } + + // 3. Install systemd user units. + let mut service_names = Vec::new(); + for svc in &pkg.services { + install_service(svc, bin_dir)?; + service_names.push(svc.unit.clone()); + } + + // 4. Run post_install hooks. + for cmd in &pkg.post_install { + run_hook(cmd, &pkg.name)?; + } + + // 5. Record in state. + let mut state = State::load()?; + state.record(InstalledPackage { + name: pkg.name.clone(), + version: pkg.version.clone(), + binaries: binary_names, + services: service_names, + installed_at: chrono::Utc::now().to_rfc3339(), + }); + state.save()?; + + println!(" {} installed successfully", pkg.name); + warn_path_if_needed(bin_dir); + Ok(()) +} + +pub fn remove_package(pkg_name: &str, bin_dir: &Path) -> Result<()> { + let mut state = State::load()?; + let installed = match state.remove(pkg_name) { + Some(p) => p, + None => { + eprintln!("{pkg_name} is not installed"); + return Ok(()); + } + }; + + // Remove binaries. + for bin in &installed.binaries { + let path = bin_dir.join(bin); + if path.exists() { + std::fs::remove_file(&path) + .with_context(|| format!("removing {}", path.display()))?; + println!(" removed {}", path.display()); + } + } + + // Prompt for unit removal. + if !installed.services.is_empty() { + let service_dir = systemd_user_dir(); + for unit in &installed.services { + let unit_path = service_dir.join(unit); + if confirm_remove_unit(unit) { + let _ = Command::new("systemctl") + .args(["--user", "disable", "--now", unit]) + .status(); + if unit_path.exists() { + std::fs::remove_file(&unit_path).ok(); + } + let _ = Command::new("systemctl") + .args(["--user", "daemon-reload"]) + .status(); + println!(" removed unit {unit}"); + } + } + } + + // Never touch config or data dirs. + if let Some(cfg_dir) = guess_config_dir(pkg_name) { + if cfg_dir.exists() { + println!(" config preserved at {}", cfg_dir.display()); + } + } + let data_dir = dirs::data_dir() + .unwrap_or_else(|| PathBuf::from("~/.local/share")) + .join(pkg_name); + if data_dir.exists() { + println!(" data preserved at {}", data_dir.display()); + } + + state.save()?; + println!(" {pkg_name} removed"); + Ok(()) +} + +fn scaffold_config(cfg: &crate::manifest::ConfigScaffold) -> Result<()> { + let dir = expand_tilde(&cfg.dir); + std::fs::create_dir_all(&dir)?; + if let Some(example) = &cfg.example { + let dest = dir.join(example); + if !dest.exists() { + // We don't have the actual example file here at install time — + // the product repo's release bundle should include it. + // For now just note it; release.yml will bundle example configs. + println!(" config dir ready at {}", dir.display()); + println!( + " copy your {example} to {} to configure {}", + dest.display(), + dir.display() + ); + } else { + println!(" config at {} already exists, skipping", dest.display()); + } + } + Ok(()) +} + +fn install_service(svc: &Service, bin_dir: &Path) -> Result<()> { + let service_dir = systemd_user_dir(); + std::fs::create_dir_all(&service_dir)?; + + let unit_path = service_dir.join(&svc.unit); + + // The unit file is expected to be bundled alongside the binary in the + // release artifact (or embedded). For now, patch ExecStart if the unit + // already exists (same pattern as bread/scripts/install.sh). + if unit_path.exists() { + patch_exec_start(&unit_path, bin_dir)?; + } + + let _ = Command::new("systemctl") + .args(["--user", "daemon-reload"]) + .status(); + + if svc.enable { + if Command::new("systemctl") + .args(["--user", "is-active", "--quiet", &svc.unit]) + .status() + .map(|s| s.success()) + .unwrap_or(false) + { + let _ = Command::new("systemctl") + .args(["--user", "restart", &svc.unit]) + .status(); + println!(" {} restarted", svc.unit); + } else { + let _ = Command::new("systemctl") + .args(["--user", "enable", "--now", &svc.unit]) + .status(); + println!(" {} enabled and started", svc.unit); + } + } + + Ok(()) +} + +fn patch_exec_start(unit_path: &Path, bin_dir: &Path) -> Result<()> { + let text = std::fs::read_to_string(unit_path)?; + let patched: String = text + .lines() + .map(|line| { + if line.trim_start().starts_with("ExecStart=") { + // Replace only the path prefix, keep args. + let rest = line.splitn(2, '=').nth(1).unwrap_or(""); + let argv: Vec<&str> = rest.split_whitespace().collect(); + if let Some(bin_name) = argv.first().and_then(|p| Path::new(p).file_name()) { + let new_path = bin_dir.join(bin_name); + let args: Vec<&str> = argv.iter().skip(1).copied().collect(); + if args.is_empty() { + format!("ExecStart={}", new_path.display()) + } else { + format!("ExecStart={} {}", new_path.display(), args.join(" ")) + } + } else { + line.to_string() + } + } else { + line.to_string() + } + }) + .collect::>() + .join("\n"); + std::fs::write(unit_path, patched)?; + Ok(()) +} + +fn run_hook(cmd: &str, pkg_name: &str) -> Result<()> { + println!(" running post_install hook: {cmd}"); + let status = Command::new("sh") + .args(["-c", cmd]) + .status() + .with_context(|| format!("running post_install hook for {pkg_name}"))?; + if !status.success() { + eprintln!(" warning: hook exited with {status}"); + } + Ok(()) +} + +fn confirm_remove_unit(unit: &str) -> bool { + use std::io::{self, Write}; + print!(" remove systemd unit {unit}? [y/N] "); + io::stdout().flush().ok(); + let mut buf = String::new(); + io::stdin().read_line(&mut buf).ok(); + matches!(buf.trim().to_lowercase().as_str(), "y" | "yes") +} + +fn systemd_user_dir() -> PathBuf { + dirs::config_dir() + .unwrap_or_else(|| PathBuf::from("~/.config")) + .join("systemd/user") +} + +fn guess_config_dir(pkg_name: &str) -> Option { + Some(dirs::config_dir()?.join(pkg_name)) +} + +fn expand_tilde(path: &str) -> PathBuf { + if let Some(rest) = path.strip_prefix("~/") { + dirs::home_dir() + .unwrap_or_else(|| PathBuf::from("~")) + .join(rest) + } else { + PathBuf::from(path) + } +} + +fn warn_path_if_needed(bin_dir: &Path) { + let path_var = std::env::var("PATH").unwrap_or_default(); + let bin_str = bin_dir.to_string_lossy(); + if !path_var.split(':').any(|p| p == bin_str) { + println!( + "\n note: {} is not in PATH — add to your shell profile:", + bin_str + ); + println!(" export PATH=\"{}:$PATH\"", bin_str); + } +} diff --git a/bakery/src/main.rs b/bakery/src/main.rs new file mode 100644 index 0000000..1fec0bb --- /dev/null +++ b/bakery/src/main.rs @@ -0,0 +1,216 @@ +mod doctor; +mod download; +mod install; +mod manifest; +mod state; + +use anyhow::{bail, Result}; +use clap::{Parser, Subcommand}; +use std::path::PathBuf; + +#[derive(Parser)] +#[command(name = "bakery", about = "Package manager for the bread ecosystem")] +struct Cli { + #[command(subcommand)] + command: Cmd, + /// Override the directory where binaries are installed + #[arg(long, env = "BAKERY_BIN_DIR", global = true)] + bin_dir: Option, +} + +#[derive(Subcommand)] +enum Cmd { + /// Install a package + Install { + package: String, + }, + /// Remove an installed package (data files are never deleted) + Remove { + package: String, + }, + /// Update one or all installed packages + Update { + /// Package to update; omit to update all installed packages + package: Option, + }, + /// List packages + List { + /// Show only installed packages + #[arg(long)] + installed: bool, + }, + /// Show details for a package + Info { + package: String, + }, + /// Check system dependencies for installed or requested packages + Doctor { + /// Package to check; omit to check all installed packages + package: Option, + }, +} + +fn default_bin_dir() -> PathBuf { + dirs::home_dir() + .unwrap_or_else(|| PathBuf::from("~")) + .join(".local/bin") +} + +fn main() -> Result<()> { + let cli = Cli::parse(); + let bin_dir = cli.bin_dir.unwrap_or_else(default_bin_dir); + + match cli.command { + Cmd::Install { package } => cmd_install(&package, &bin_dir), + Cmd::Remove { package } => cmd_remove(&package, &bin_dir), + Cmd::Update { package } => cmd_update(package.as_deref(), &bin_dir), + Cmd::List { installed } => cmd_list(installed), + Cmd::Info { package } => cmd_info(&package), + Cmd::Doctor { package } => cmd_doctor(package.as_deref()), + } +} + +fn cmd_install(name: &str, bin_dir: &std::path::Path) -> Result<()> { + let index = manifest::load(false)?; + let pkg = index + .get(name) + .ok_or_else(|| anyhow::anyhow!("unknown package: {name}"))?; + + // Doctor runs first — bail if system deps are missing. + println!("checking system dependencies…"); + let missing = doctor::check_deps(&pkg.system_deps)?; + if !missing.is_empty() { + eprintln!("missing system dependencies for {name}: {}", missing.join(", ")); + eprintln!("install with: sudo pacman -S {}", missing.join(" ")); + bail!("system deps not satisfied"); + } + + install::install_package(pkg, bin_dir) +} + +fn cmd_remove(name: &str, bin_dir: &std::path::Path) -> Result<()> { + install::remove_package(name, bin_dir) +} + +fn cmd_update(name: Option<&str>, bin_dir: &std::path::Path) -> Result<()> { + let index = manifest::load(true)?; // force refresh on update + let state = state::State::load()?; + + let targets: Vec = match name { + Some(n) => vec![n.to_string()], + None => state.packages.keys().cloned().collect(), + }; + + for pkg_name in &targets { + let installed = match state.packages.get(pkg_name.as_str()) { + Some(p) => p, + None => { + eprintln!("{pkg_name} is not installed, skipping"); + continue; + } + }; + let latest = match index.get(pkg_name) { + Some(p) => p, + None => { + eprintln!("{pkg_name} not found in index, skipping"); + continue; + } + }; + if installed.version == latest.version { + println!("{pkg_name} is already at {}", installed.version); + } else { + println!( + "updating {pkg_name} {} → {}", + installed.version, latest.version + ); + install::install_package(latest, bin_dir)?; + } + } + Ok(()) +} + +fn cmd_list(installed_only: bool) -> Result<()> { + let state = state::State::load()?; + + if installed_only { + if state.packages.is_empty() { + println!("no packages installed"); + } + for pkg in state.packages.values() { + println!(" {} {} (installed {})", pkg.name, pkg.version, pkg.installed_at); + } + return Ok(()); + } + + let index = manifest::load(false)?; + let mut names: Vec<&str> = index.packages.keys().map(|s| s.as_str()).collect(); + names.sort(); + for name in names { + let pkg = &index.packages[name]; + let tag = if state.is_installed(name) { + format!(" [installed {}]", state.packages[name].version) + } else { + String::new() + }; + println!(" {} {} — {}{}", pkg.name, pkg.version, pkg.description, tag); + } + Ok(()) +} + +fn cmd_info(name: &str) -> Result<()> { + let index = manifest::load(false)?; + let pkg = index + .get(name) + .ok_or_else(|| anyhow::anyhow!("unknown package: {name}"))?; + + let state = state::State::load()?; + let status = if let Some(inst) = state.packages.get(name) { + format!("installed ({})", inst.version) + } else { + "not installed".to_string() + }; + + println!("{} {}", pkg.name, pkg.version); + println!(" {}", pkg.description); + println!(" status: {status}"); + println!(" binaries: {}", pkg.binaries.iter().map(|b| b.name.as_str()).collect::>().join(", ")); + if !pkg.system_deps.is_empty() { + println!(" system deps: {}", pkg.system_deps.join(", ")); + } + if !pkg.bread_deps.is_empty() { + println!(" bread deps: {}", pkg.bread_deps.join(", ")); + } + if !pkg.services.is_empty() { + println!(" services: {}", pkg.services.iter().map(|s| s.unit.as_str()).collect::>().join(", ")); + } + Ok(()) +} + +fn cmd_doctor(name: Option<&str>) -> Result<()> { + let index = manifest::load(false)?; + let state = state::State::load()?; + + let targets: Vec = match name { + Some(n) => vec![n.to_string()], + None => state.packages.keys().cloned().collect(), + }; + + if targets.is_empty() { + println!("no packages installed — nothing to check"); + return Ok(()); + } + + let mut all_ok = true; + for pkg_name in &targets { + if let Some(pkg) = index.get(pkg_name) { + if !doctor::report(pkg_name, &pkg.system_deps) { + all_ok = false; + } + } + } + + if all_ok { + println!("all checks passed"); + } + Ok(()) +} diff --git a/bakery/src/manifest.rs b/bakery/src/manifest.rs new file mode 100644 index 0000000..5f27249 --- /dev/null +++ b/bakery/src/manifest.rs @@ -0,0 +1,137 @@ +use anyhow::{bail, Context, Result}; +use serde::{Deserialize, Serialize}; +use std::path::PathBuf; +use std::time::{Duration, SystemTime}; + +const PRIMARY_URL: &str = "https://dl.breadway.dev/index.json"; +const CACHE_MAX_AGE: Duration = Duration::from_secs(24 * 3600); + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Binary { + pub name: String, + pub dl_url: String, + pub github_url: String, + pub sha256: String, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Service { + pub unit: String, + pub enable: bool, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct ConfigScaffold { + pub dir: String, + /// relative to the product repo root; copied as-is if absent at install time + pub example: Option, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Package { + pub name: String, + pub description: String, + pub version: String, + pub binaries: Vec, + #[serde(default)] + pub system_deps: Vec, + #[serde(default)] + pub bread_deps: Vec, + #[serde(default)] + pub services: Vec, + pub config: Option, + #[serde(default)] + pub post_install: Vec, +} + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct Index { + pub version: String, + pub packages: std::collections::HashMap, +} + +impl Index { + pub fn get(&self, name: &str) -> Option<&Package> { + self.packages.get(name) + } + + #[allow(dead_code)] + pub fn all(&self) -> impl Iterator { + self.packages.values() + } +} + +/// Load the manifest, using the on-disk cache when it is fresh enough. +/// Always fetches if `force_refresh` is true. +pub fn load(force_refresh: bool) -> Result { + let cache_path = cache_path(); + + if !force_refresh && cache_is_fresh(&cache_path) { + let text = std::fs::read_to_string(&cache_path) + .context("reading cached index")?; + return serde_json::from_str(&text).context("parsing cached index"); + } + + fetch_and_cache(&cache_path) +} + +fn cache_is_fresh(path: &PathBuf) -> bool { + std::fs::metadata(path) + .and_then(|m| m.modified()) + .map(|t| SystemTime::now().duration_since(t).unwrap_or(CACHE_MAX_AGE) < CACHE_MAX_AGE) + .unwrap_or(false) +} + +fn fetch_and_cache(cache_path: &PathBuf) -> Result { + let text = fetch_text(PRIMARY_URL)?; + if let Some(dir) = cache_path.parent() { + std::fs::create_dir_all(dir)?; + } + std::fs::write(cache_path, &text)?; + serde_json::from_str(&text).context("parsing index.json") +} + +fn fetch_text(url: &str) -> Result { + ureq::get(url) + .call() + .map_err(|e| anyhow::anyhow!("{e}"))? + .into_string() + .context("reading response body") +} + +pub fn cache_path() -> PathBuf { + dirs::cache_dir() + .unwrap_or_else(|| PathBuf::from("~/.cache")) + .join("bakery/index.json") +} + +/// Download a binary blob from `primary_url`, falling back to `fallback_url` +/// on any network error. Returns the raw bytes. +pub fn fetch_binary(primary_url: &str, fallback_url: &str) -> Result> { + match fetch_bytes(primary_url) { + Ok(bytes) => Ok(bytes), + Err(primary_err) => { + eprintln!( + " primary URL failed ({}), trying GitHub fallback…", + primary_err + ); + fetch_bytes(fallback_url).context("both primary and GitHub fallback failed") + } + } +} + +fn fetch_bytes(url: &str) -> Result> { + use std::io::Read; + let resp = ureq::get(url) + .call() + .map_err(|e| anyhow::anyhow!("{e}"))?; + let status = resp.status(); + if status != 200 { + bail!("HTTP {status} from {url}"); + } + let mut buf = Vec::new(); + resp.into_reader() + .read_to_end(&mut buf) + .context("reading binary")?; + Ok(buf) +} diff --git a/bakery/src/state.rs b/bakery/src/state.rs new file mode 100644 index 0000000..adb39a4 --- /dev/null +++ b/bakery/src/state.rs @@ -0,0 +1,60 @@ +use anyhow::{Context, Result}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; +use std::path::PathBuf; + +#[derive(Debug, Clone, Deserialize, Serialize)] +pub struct InstalledPackage { + pub name: String, + pub version: String, + pub binaries: Vec, + pub services: Vec, + pub installed_at: String, +} + +#[derive(Debug, Default, Deserialize, Serialize)] +pub struct State { + pub packages: HashMap, +} + +impl State { + pub fn load() -> Result { + let path = state_path(); + if !path.exists() { + return Ok(Self::default()); + } + let text = std::fs::read_to_string(&path).context("reading installed.json")?; + serde_json::from_str(&text).context("parsing installed.json") + } + + pub fn save(&self) -> Result<()> { + let path = state_path(); + if let Some(dir) = path.parent() { + std::fs::create_dir_all(dir)?; + } + let text = serde_json::to_string_pretty(self)?; + std::fs::write(&path, text).context("writing installed.json") + } + + pub fn is_installed(&self, name: &str) -> bool { + self.packages.contains_key(name) + } + + pub fn record(&mut self, pkg: InstalledPackage) { + self.packages.insert(pkg.name.clone(), pkg); + } + + pub fn remove(&mut self, name: &str) -> Option { + self.packages.remove(name) + } +} + +fn state_path() -> PathBuf { + dirs::state_dir() + .unwrap_or_else(|| { + dirs::home_dir() + .unwrap_or_else(|| PathBuf::from("~")) + .join(".local/state") + }) + .join("bakery/installed.json") +} diff --git a/bread-theme/CHANGELOG.md b/bread-theme/CHANGELOG.md new file mode 100644 index 0000000..2675e55 --- /dev/null +++ b/bread-theme/CHANGELOG.md @@ -0,0 +1,20 @@ +# bread-theme changelog + +## Coordinated bump policy + +`bread-theme` is consumed by `breadbar`, `breadbox`, and `breadpad` as a pinned +git dependency. A breaking change to `Palette`, `css_vars`, or the `gtk` feature +API requires all three dependents to bump their `Cargo.toml` git tag and cut a +release together. Note the impact in this file before tagging. + +--- + +## theme-v0.1.0 (2026-06-06) + +- Initial extraction from `breadpad-shared/src/theme.rs` +- `Palette` struct with `color0`–`color7` and Catppuccin Mocha default +- `load_palette()` reads `~/.cache/wal/colors.json`, falls back to default +- `css_vars(palette)` emits `@define-color` block + font declaration +- `hex_to_rgba(hex, alpha)` utility +- `tokens` module with spacing scale, border radii, font sizes from `BREAD_DESIGN_SYSTEM.md` +- `gtk` feature: `apply_css()` and `apply_user_css()` helpers for GTK4 CSS providers diff --git a/bread-theme/Cargo.toml b/bread-theme/Cargo.toml new file mode 100644 index 0000000..39930a1 --- /dev/null +++ b/bread-theme/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "bread-theme" +version.workspace = true +edition.workspace = true +license.workspace = true +authors.workspace = true +description = "Shared pywal + Catppuccin theming crate for the bread ecosystem" +repository = "https://github.com/Breadway/bread-ecosystem" +keywords = ["theming", "pywal", "gtk4", "wayland"] + +[dependencies] +serde = { workspace = true } +serde_json = { workspace = true } +dirs = { workspace = true } +gtk4 = { version = "0.11", features = ["v4_12"], optional = true } + +[features] +# Enable GTK4 CSS provider helpers (breadbar, breadbox, breadpad use this). +# bread (daemon) and breadcrumbs (CLI) depend on this crate without the feature. +gtk = ["dep:gtk4"] diff --git a/bread-theme/src/gtk.rs b/bread-theme/src/gtk.rs new file mode 100644 index 0000000..6e62cb4 --- /dev/null +++ b/bread-theme/src/gtk.rs @@ -0,0 +1,50 @@ +use gtk4::CssProvider; +use std::cell::RefCell; +use std::path::Path; + +/// Apply a CSS string to the default display at APPLICATION priority. +/// Re-uses an existing provider if one is passed in (for SIGHUP reloads). +pub fn apply_css(css: &str, provider: &RefCell>) { + let display = gtk4::gdk::Display::default().expect("no display"); + let mut guard = provider.borrow_mut(); + if let Some(p) = guard.as_ref() { + p.load_from_string(css); + } else { + let p = CssProvider::new(); + p.load_from_string(css); + gtk4::style_context_add_provider_for_display( + &display, + &p, + gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION, + ); + *guard = Some(p); + } +} + +/// Apply a user CSS override file at USER priority. Clears the provider if the +/// file is absent so stale overrides don't persist across SIGHUP reloads. +pub fn apply_user_css(path: &Path, provider: &RefCell>) { + let display = gtk4::gdk::Display::default().expect("no display"); + let mut guard = provider.borrow_mut(); + match std::fs::read_to_string(path) { + Ok(css) => { + if let Some(p) = guard.as_ref() { + p.load_from_string(&css); + } else { + let p = CssProvider::new(); + p.load_from_string(&css); + gtk4::style_context_add_provider_for_display( + &display, + &p, + gtk4::STYLE_PROVIDER_PRIORITY_USER, + ); + *guard = Some(p); + } + } + Err(_) => { + if let Some(p) = guard.as_ref() { + p.load_from_string(""); + } + } + } +} diff --git a/bread-theme/src/lib.rs b/bread-theme/src/lib.rs new file mode 100644 index 0000000..7d649e8 --- /dev/null +++ b/bread-theme/src/lib.rs @@ -0,0 +1,96 @@ +pub mod palette; +#[cfg(feature = "gtk")] +pub mod gtk; + +pub use palette::{load_palette, Palette}; + +/// Design tokens from BREAD_DESIGN_SYSTEM.md. +pub mod tokens { + pub const FONT_FAMILY: &str = "Varela Round, sans-serif"; + pub const FONT_SIZE_BASE: u8 = 14; + pub const FONT_SIZE_SECONDARY: u8 = 12; + + // Spacing scale (px, 4px units) + pub const SPACE_XS: u8 = 4; + pub const SPACE_SM: u8 = 8; + pub const SPACE_MD: u8 = 12; + pub const SPACE_LG: u8 = 16; + pub const SPACE_XL: u8 = 20; + + // Border radius + pub const RADIUS_PRIMARY: u8 = 8; + pub const RADIUS_SECONDARY: u8 = 6; + pub const RADIUS_TERTIARY: u8 = 4; + pub const RADIUS_PILL: u16 = 999; +} + +/// Emit the `@define-color` block that all bread apps use. +/// Apps append their own rules below this; user CSS goes on top. +pub fn css_vars(p: &Palette) -> String { + format!( + "@define-color bg {bg};\n\ + @define-color fg {fg};\n\ + @define-color surface {c0};\n\ + @define-color red {c1};\n\ + @define-color green {c2};\n\ + @define-color yellow {c3};\n\ + @define-color blue {c4};\n\ + @define-color pink {c5};\n\ + @define-color teal {c6};\n\ + @define-color overlay {c7};\n\ + * {{ font-family: '{font}'; font-size: {size}px; }}\n", + bg = p.background, + fg = p.foreground, + c0 = p.color0, + c1 = p.color1, + c2 = p.color2, + c3 = p.color3, + c4 = p.color4, + c5 = p.color5, + c6 = p.color6, + c7 = p.color7, + font = tokens::FONT_FAMILY, + size = tokens::FONT_SIZE_BASE, + ) +} + +/// Convert a `#rrggbb` hex colour to `rgba(r, g, b, alpha)`. +pub fn hex_to_rgba(hex: &str, alpha: f32) -> String { + let h = hex.trim_start_matches('#'); + let r = u8::from_str_radix(h.get(0..2).unwrap_or("00"), 16).unwrap_or(0); + let g = u8::from_str_radix(h.get(2..4).unwrap_or("00"), 16).unwrap_or(0); + let b = u8::from_str_radix(h.get(4..6).unwrap_or("00"), 16).unwrap_or(0); + format!("rgba({r}, {g}, {b}, {alpha})") +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn css_vars_contains_all_define_color_names() { + let css = css_vars(&Palette::default()); + for name in &["bg", "fg", "surface", "red", "green", "yellow", "blue", "pink", "teal", "overlay"] { + assert!(css.contains(&format!("@define-color {name} ")), "missing @define-color {name}"); + } + } + + #[test] + fn css_vars_contains_font_rule() { + let css = css_vars(&Palette::default()); + assert!(css.contains("Varela Round")); + assert!(css.contains("14px")); + } + + #[test] + fn hex_to_rgba_known_value() { + assert_eq!(hex_to_rgba("#1e1e2e", 1.0), "rgba(30, 30, 46, 1)"); + } + + #[test] + fn hex_to_rgba_strips_hash() { + let a = hex_to_rgba("#ffffff", 0.5); + let b = hex_to_rgba("ffffff", 0.5); + assert_eq!(a, b); + } +} diff --git a/bread-theme/src/palette.rs b/bread-theme/src/palette.rs new file mode 100644 index 0000000..9f311b6 --- /dev/null +++ b/bread-theme/src/palette.rs @@ -0,0 +1,162 @@ +use serde::Deserialize; +use std::collections::HashMap; +use std::path::PathBuf; + +/// Full 8-colour pywal palette. Catppuccin Mocha is the fallback. +#[derive(Debug, Clone)] +pub struct Palette { + pub background: String, + pub foreground: String, + /// ANSI color0 — darkest surface / overlay + pub color0: String, + /// ANSI color1 — red + pub color1: String, + /// ANSI color2 — green + pub color2: String, + /// ANSI color3 — yellow + pub color3: String, + /// ANSI color4 — blue (primary accent) + pub color4: String, + /// ANSI color5 — pink / magenta + pub color5: String, + /// ANSI color6 — teal / cyan + pub color6: String, + /// ANSI color7 — light overlay / muted fg + pub color7: String, +} + +impl Default for Palette { + fn default() -> Self { + Palette { + background: "#1e1e2e".into(), + foreground: "#cdd6f4".into(), + color0: "#45475a".into(), + color1: "#f38ba8".into(), + color2: "#a6e3a1".into(), + color3: "#f9e2af".into(), + color4: "#89b4fa".into(), + color5: "#f5c2e7".into(), + color6: "#94e2d5".into(), + color7: "#bac2de".into(), + } + } +} + +#[derive(Deserialize)] +struct WalColors { + #[serde(default)] + colors: HashMap, + special: Option, +} + +#[derive(Deserialize)] +struct WalSpecial { + background: Option, + foreground: Option, +} + +/// Load palette from pywal's `colors.json`. Falls back to Catppuccin Mocha. +pub fn load_palette() -> Palette { + let path = wal_path(); + std::fs::read_to_string(&path) + .ok() + .and_then(|s| from_wal_json(&s)) + .unwrap_or_default() +} + +pub(crate) fn from_wal_json(json: &str) -> Option { + let wal: WalColors = serde_json::from_str(json).ok()?; + let c = |k: &str, fallback: &str| -> String { + wal.colors.get(k).cloned().unwrap_or_else(|| fallback.into()) + }; + Some(Palette { + background: wal.special.as_ref().and_then(|s| s.background.clone()) + .unwrap_or_else(|| "#1e1e2e".into()), + foreground: wal.special.as_ref().and_then(|s| s.foreground.clone()) + .unwrap_or_else(|| "#cdd6f4".into()), + color0: c("color0", "#45475a"), + color1: c("color1", "#f38ba8"), + color2: c("color2", "#a6e3a1"), + color3: c("color3", "#f9e2af"), + color4: c("color4", "#89b4fa"), + color5: c("color5", "#f5c2e7"), + color6: c("color6", "#94e2d5"), + color7: c("color7", "#bac2de"), + }) +} + +fn wal_path() -> PathBuf { + dirs::cache_dir() + .unwrap_or_else(|| PathBuf::from("~/.cache")) + .join("wal/colors.json") +} + +#[cfg(test)] +mod tests { + use super::*; + + const TOKYO_NIGHT: &str = r##"{ + "special": { "background": "#1a1b26", "foreground": "#c0caf5" }, + "colors": { + "color0": "#15161e", "color1": "#f7768e", "color2": "#9ece6a", + "color3": "#e0af68", "color4": "#7aa2f7", "color5": "#bb9af7", + "color6": "#7dcfff", "color7": "#a9b1d6" + } + }"##; + + #[test] + fn default_is_catppuccin_mocha() { + let p = Palette::default(); + assert_eq!(p.background, "#1e1e2e"); + assert_eq!(p.foreground, "#cdd6f4"); + assert_eq!(p.color4, "#89b4fa"); + } + + #[test] + fn wal_json_parses_special() { + let p = from_wal_json(TOKYO_NIGHT).unwrap(); + assert_eq!(p.background, "#1a1b26"); + assert_eq!(p.foreground, "#c0caf5"); + } + + #[test] + fn wal_json_parses_colors() { + let p = from_wal_json(TOKYO_NIGHT).unwrap(); + assert_eq!(p.color0, "#15161e"); + assert_eq!(p.color4, "#7aa2f7"); + assert_eq!(p.color7, "#a9b1d6"); + } + + #[test] + fn wal_json_missing_special_uses_catppuccin_fallback() { + let p = from_wal_json(r#"{"colors":{}}"#).unwrap(); + assert_eq!(p.background, "#1e1e2e"); + assert_eq!(p.foreground, "#cdd6f4"); + } + + #[test] + fn wal_json_missing_color_uses_catppuccin_fallback() { + let p = from_wal_json(r##"{"special":{"background":"#ff0000","foreground":"#ffffff"},"colors":{}}"##).unwrap(); + assert_eq!(p.color4, "#89b4fa"); + } + + #[test] + fn invalid_json_returns_none() { + assert!(from_wal_json("not json").is_none()); + assert!(from_wal_json("").is_none()); + } + + #[test] + fn empty_object_returns_all_defaults() { + let p = from_wal_json("{}").unwrap(); + assert_eq!(p.background, "#1e1e2e"); + } + + #[test] + fn load_palette_returns_valid_hex_strings() { + let p = load_palette(); + for val in [&p.background, &p.foreground, &p.color0, &p.color4] { + assert!(val.starts_with('#'), "expected hex, got: {val}"); + } + } +} diff --git a/registry/bread-ecosystem.toml b/registry/bread-ecosystem.toml new file mode 100644 index 0000000..fb641d8 --- /dev/null +++ b/registry/bread-ecosystem.toml @@ -0,0 +1,33 @@ +# Human-authored product registry. +# gen-index.sh reads this + each product's bakery.toml to produce index.json. + +[ecosystem] +name = "bread" +description = "Reactive desktop automation ecosystem for Arch Linux / Hyprland" +homepage = "https://breadway.dev" +dl_base = "https://dl.breadway.dev" + +[[products]] +name = "bread" +repo = "Breadway/bread" +description = "Reactive automation daemon and CLI for Linux desktops" + +[[products]] +name = "breadbar" +repo = "Breadway/breadbar" +description = "Minimal status bar and notification daemon for Hyprland" + +[[products]] +name = "breadbox" +repo = "Breadway/breadbox" +description = "App launcher for Hyprland / Wayland" + +[[products]] +name = "breadcrumbs" +repo = "Breadway/breadcrumbs" +description = "Profile-aware Wi-Fi state machine with Tailscale integration" + +[[products]] +name = "breadpad" +repo = "Breadway/breadpad" +description = "Quick-capture scratchpad and note viewer with AI classification" diff --git a/scripts/gen-index.sh b/scripts/gen-index.sh new file mode 100644 index 0000000..ead3d94 --- /dev/null +++ b/scripts/gen-index.sh @@ -0,0 +1,151 @@ +#!/usr/bin/env bash +# Generate dl.breadway.dev/index.json from: +# - registry/bread-ecosystem.toml (product list) +# - /bakery.toml (per-product metadata) +# - /srv/breadway-dl/ (built binaries + sha256 files) +# +# Run on hestia after each product build, before the dl server is refreshed. +# Requires: jq, python3 (for toml parsing via tomllib), sha256sum +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +DL_DIR="${DL_DIR:-/srv/breadway-dl}" +DL_BASE="${DL_BASE:-https://dl.breadway.dev}" +GH_BASE="https://github.com/Breadway" +OUT="${DL_DIR}/index.json" + +# Products are read from the registry. Each line is "name repo". +products=( + "bread Breadway/bread" + "breadbar Breadway/breadbar" + "breadbox Breadway/breadbox" + "breadcrumbs Breadway/breadcrumbs" + "breadpad Breadway/breadpad" +) + +# Build a JSON package entry for one product. +# $1 = product name, $2 = github repo slug +build_package_json() { + local name="$1" + local repo="$2" + + # Find the latest version dir under DL_DIR// + local pkg_dir="${DL_DIR}/${name}" + if [[ ! -d "${pkg_dir}" ]]; then + echo " warning: no release dir for ${name} at ${pkg_dir}" >&2 + return + fi + + # The latest symlink must point to the current version dir. + local latest_link="${pkg_dir}/latest" + if [[ ! -L "${latest_link}" ]]; then + echo " warning: no 'latest' symlink for ${name}" >&2 + return + fi + local version_dir + version_dir="$(readlink -f "${latest_link}")" + local version + version="$(basename "${version_dir}")" + + # Collect all binaries in the version dir (files without .sha256 extension). + local binaries_json="[]" + for bin_path in "${version_dir}"/*; do + [[ "${bin_path}" == *.sha256 ]] && continue + [[ -f "${bin_path}" ]] || continue + local bin_name + bin_name="$(basename "${bin_path}")" + local sha256_path="${bin_path}.sha256" + local sha256="" + if [[ -f "${sha256_path}" ]]; then + sha256="$(awk '{print $1}' "${sha256_path}")" + fi + local dl_url="${DL_BASE}/${name}/${version}/${bin_name}" + local gh_url="${GH_BASE}/${repo}/releases/download/v${version}/${bin_name}" + + local entry + entry="$(jq -n \ + --arg name "${bin_name}" \ + --arg dl_url "${dl_url}" \ + --arg github_url "${gh_url}" \ + --arg sha256 "${sha256}" \ + '{name: $name, dl_url: $dl_url, github_url: $github_url, sha256: $sha256}')" + binaries_json="$(jq -n --argjson arr "${binaries_json}" --argjson e "${entry}" '$arr + [$e]')" + done + + # Read bakery.toml for this product from a co-located checkout if available, + # else use minimal defaults. + local bakery_toml="${SCRIPT_DIR}/../${name}/bakery.toml" + local description="" + local system_deps="[]" + local bread_deps="[]" + local services="[]" + local config="null" + local post_install="[]" + + if [[ -f "${bakery_toml}" ]]; then + description="$(python3 -c " +import tomllib, sys +with open('${bakery_toml}', 'rb') as f: + d = tomllib.load(f) +print(d.get('description', '')) +" 2>/dev/null || true)" + system_deps="$(python3 -c " +import tomllib, json, sys +with open('${bakery_toml}', 'rb') as f: + d = tomllib.load(f) +print(json.dumps(d.get('system_deps', []))) +" 2>/dev/null || echo "[]")" + bread_deps="$(python3 -c " +import tomllib, json, sys +with open('${bakery_toml}', 'rb') as f: + d = tomllib.load(f) +print(json.dumps(d.get('bread_deps', []))) +" 2>/dev/null || echo "[]")" + post_install="$(python3 -c " +import tomllib, json, sys +with open('${bakery_toml}', 'rb') as f: + d = tomllib.load(f) +print(json.dumps(d.get('install', {}).get('post_install', []))) +" 2>/dev/null || echo "[]")" + fi + + jq -n \ + --arg name "${name}" \ + --arg description "${description}" \ + --arg version "${version}" \ + --argjson binaries "${binaries_json}" \ + --argjson system_deps "${system_deps}" \ + --argjson bread_deps "${bread_deps}" \ + --argjson services "${services}" \ + --argjson post_install "${post_install}" \ + '{ + name: $name, + description: $description, + version: $version, + binaries: $binaries, + system_deps: $system_deps, + bread_deps: $bread_deps, + services: $services, + post_install: $post_install + }' +} + +# Assemble the full index. +packages_json="{}" +for entry in "${products[@]}"; do + name="$(echo "${entry}" | awk '{print $1}')" + repo="$(echo "${entry}" | awk '{print $2}')" + echo "processing ${name}…" + pkg="$(build_package_json "${name}" "${repo}" 2>&1)" || { echo " skipping ${name}: ${pkg}"; continue; } + [[ -z "${pkg}" ]] && continue + packages_json="$(jq -n --argjson m "${packages_json}" --arg k "${name}" --argjson v "${pkg}" '$m + {($k): $v}')" +done + +jq -n \ + --arg version "1" \ + --arg generated_at "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + --argjson packages "${packages_json}" \ + '{version: $version, generated_at: $generated_at, packages: $packages}' \ + > "${OUT}" + +echo "wrote ${OUT}" diff --git a/scripts/get.sh b/scripts/get.sh new file mode 100644 index 0000000..bdcf743 --- /dev/null +++ b/scripts/get.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# Bootstrap script: installs the `bakery` binary. +# Usage: curl https://breadway.dev/get | sh +# Or: curl -sSfL https://breadway.dev/get | sh +set -eu + +BAKERY_VERSION="${BAKERY_VERSION:-latest}" +DL_PRIMARY="https://dl.breadway.dev/bakery/${BAKERY_VERSION}/bakery-x86_64" +DL_FALLBACK="https://github.com/Breadway/bread-ecosystem/releases/download/${BAKERY_VERSION}/bakery-x86_64" +BIN_DIR="${BAKERY_BIN_DIR:-$HOME/.local/bin}" + +die() { echo "error: $*" >&2; exit 1; } + +# Verify platform. +uname -m | grep -q x86_64 || die "bakery only supports x86_64 (got $(uname -m))" +uname -s | grep -q Linux || die "bakery only supports Linux (got $(uname -s))" + +# Pick a download tool. +if command -v curl >/dev/null 2>&1; then + fetch() { curl -fsSL "$1" -o "$2"; } +elif command -v wget >/dev/null 2>&1; then + fetch() { wget -q "$1" -O "$2"; } +else + die "curl or wget required" +fi + +mkdir -p "${BIN_DIR}" +TMP="$(mktemp)" +trap 'rm -f "${TMP}"' EXIT + +echo "downloading bakery…" +if fetch "${DL_PRIMARY}" "${TMP}" 2>/dev/null; then + echo " from dl.breadway.dev" +elif fetch "${DL_FALLBACK}" "${TMP}" 2>/dev/null; then + echo " from GitHub (fallback)" +else + die "failed to download bakery from both primary and fallback URLs" +fi + +chmod +x "${TMP}" +cp "${TMP}" "${BIN_DIR}/bakery" +echo "installed bakery to ${BIN_DIR}/bakery" + +# Warn if bin dir is not on PATH. +case ":${PATH}:" in + *":${BIN_DIR}:"*) ;; + *) + echo "" + echo " note: ${BIN_DIR} is not in PATH — add to your shell profile:" + echo " export PATH=\"${BIN_DIR}:\$PATH\"" + ;; +esac + +echo "" +echo "get started:" +echo " bakery list # see all available packages" +echo " bakery install bread # install the automation daemon" +echo " bakery install breadbar # install the status bar" +echo " bakery install breadpad # install the scratchpad"