diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index c2f16c7..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Rust - -on: - push: - branches: [ "main" ] - paths: - - 'src/**' - - 'Cargo.toml' - - 'Cargo.lock' - - pull_request: - branches: [ "main" ] - paths: - - 'src/**' - - 'Cargo.toml' - - 'Cargo.lock' - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Cache dependencies - uses: Swatinem/rust-cache@v2 - - - name: Check - run: cargo check --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.gitignore b/.gitignore index 77bfe43..777038b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,36 @@ -/target -win_ggw.zip -**/*.DS_Store -/release/ -test_config.toml -src_old/ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store + +target/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index d57b0b8..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cSpell.words": [ - "dialoguer", - "gitdiff" - ] -} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 0027927..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,2845 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[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 = "async-stream" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "async-trait" -version = "0.1.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" - -[[package]] -name = "aws-lc-rs" -version = "1.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a054912289d18629dc78375ba2c3726a3afe3ff71b4edba9dedfca0e3446d1fc" -dependencies = [ - "aws-lc-sys", - "zeroize", -] - -[[package]] -name = "aws-lc-sys" -version = "0.39.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a25cf98105baa966497416dbd42565ce3a8cf8dbfd59803ec9ad46f3126399" -dependencies = [ - "cc", - "cmake", - "dunce", - "fs_extra", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" - -[[package]] -name = "bumpalo" -version = "3.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" - -[[package]] -name = "bytes" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" - -[[package]] -name = "cc" -version = "1.2.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" -dependencies = [ - "find-msvc-tools", - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[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 = "chrono" -version = "0.4.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" -dependencies = [ - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - -[[package]] -name = "clap" -version = "4.5.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52fa72306bb30daf11bc97773431628e5b4916e97aaa74b7d3f625d4d495da02" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2071365c5c56eae7d77414029dde2f4f4ba151cf68d5a3261c9a40de428ace93" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec5be1eea072311774b7b84ded287adbd9f293f9d23456817605c6042f4f5e0" -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 = "cmake" -version = "0.1.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0f78a02292a74a88ac736019ab962ece0bc380e3f977bf72e376c5d78ff0678" -dependencies = [ - "cc", -] - -[[package]] -name = "colorchoice" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" - -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "console" -version = "0.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d64e8af5551369d19cf50138de61f1c42074ab970f74e99be916646777f8fc87" -dependencies = [ - "encode_unicode", - "libc", - "unicode-width", - "windows-sys 0.61.2", -] - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "derive-getters" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74ef43543e701c01ad77d3a5922755c6a1d71b22d942cb8042be4994b380caff" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "dyn-clone" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" - -[[package]] -name = "easy_storage" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc3a6e6d480b15527812afe3d20c047e1b856b53deec78d33371ed25bac761d" -dependencies = [ - "serde", - "serde_json", - "thiserror 2.0.18", - "toml", -] - -[[package]] -name = "encode_unicode" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" - -[[package]] -name = "encoding_rs" -version = "0.8.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" -dependencies = [ - "cfg-if", -] - -[[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 = "fastrand" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "find-msvc-tools" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[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 = "fs_extra" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" - -[[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-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-task", - "pin-project-lite", - "slab", -] - -[[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 5.3.0", - "wasip2", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" -dependencies = [ - "cfg-if", - "libc", - "r-efi 6.0.0", - "wasip2", - "wasip3", -] - -[[package]] -name = "ghost_git_writer" -version = "0.19.0" -dependencies = [ - "atty", - "chrono", - "clap", - "derive-getters", - "easy_storage", - "git2", - "home", - "indicatif", - "llm-api-rs", - "ollama-rs", - "reqwest 0.13.2", - "serde", - "serde_json", - "tokio", - "unicode-width", - "url", -] - -[[package]] -name = "git2" -version = "0.20.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b88256088d75a56f8ecfa070513a775dd9107f6530ef14919dac831af9cfe2b" -dependencies = [ - "bitflags", - "libc", - "libgit2-sys", - "log", - "openssl-probe 0.1.6", - "openssl-sys", - "url", -] - -[[package]] -name = "h2" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "foldhash", -] - -[[package]] -name = "hashbrown" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "home" -version = "0.5.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "http" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" -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.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" -dependencies = [ - "atomic-waker", - "bytes", - "futures-channel", - "futures-core", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "pin-project-lite", - "pin-utils", - "smallvec", - "tokio", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.27.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" -dependencies = [ - "http", - "hyper", - "hyper-util", - "rustls", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", -] - -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - -[[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", - "system-configuration", - "tokio", - "tower-service", - "tracing", - "windows-registry", -] - -[[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.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" -dependencies = [ - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" - -[[package]] -name = "icu_properties" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" -dependencies = [ - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" - -[[package]] -name = "icu_provider" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" -dependencies = [ - "displaydoc", - "icu_locale_core", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "id-arena" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" - -[[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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "indexmap" -version = "2.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" -dependencies = [ - "equivalent", - "hashbrown 0.16.1", - "serde", - "serde_core", -] - -[[package]] -name = "indicatif" -version = "0.18.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25470f23803092da7d239834776d653104d551bc4d7eacaf31e6837854b8e9eb" -dependencies = [ - "console", - "portable-atomic", - "unicode-width", - "unit-prefix", - "web-time", -] - -[[package]] -name = "ipnet" -version = "2.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" - -[[package]] -name = "iri-string" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" -dependencies = [ - "memchr", - "serde", -] - -[[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 = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys 0.3.1", - "log", - "thiserror 1.0.69", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" -dependencies = [ - "jni-sys 0.4.1", -] - -[[package]] -name = "jni-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" -dependencies = [ - "jni-sys-macros", -] - -[[package]] -name = "jni-sys-macros" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" -dependencies = [ - "quote", - "syn", -] - -[[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.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "leb128fmt" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" - -[[package]] -name = "libc" -version = "0.2.183" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" - -[[package]] -name = "libgit2-sys" -version = "0.18.3+1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - -[[package]] -name = "libssh2-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "220e4f05ad4a218192533b300327f5150e809b54c4ec83b5a1d91833601811b9" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52f4c29e2a68ac30c9087e1b772dc9f44a2b66ed44edf2266cf2be9b03dafc1" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" - -[[package]] -name = "llm-api-rs" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2caadd5d8b4be5d532af35f898161b86412d3e3fb50eeff97d30650af18710f2" -dependencies = [ - "async-trait", - "reqwest 0.12.28", - "serde", - "serde_json", - "thiserror 1.0.69", - "tokio", -] - -[[package]] -name = "lock_api" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" - -[[package]] -name = "lru-slab" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" - -[[package]] -name = "memchr" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mio" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" -dependencies = [ - "libc", - "wasi", - "windows-sys 0.61.2", -] - -[[package]] -name = "native-tls" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe 0.2.1", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "ollama-rs" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f647d8676b95a6b6205e11453c9fac338d73c9cdcc011c94d1ba9c9bfea582cd" -dependencies = [ - "async-stream", - "log", - "reqwest 0.12.28", - "schemars", - "serde", - "serde_json", - "static_assertions", - "thiserror 2.0.18", - "url", -] - -[[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 = "openssl" -version = "0.10.76" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "951c002c75e16ea2c65b8c7e4d3d51d5530d8dfa7d060b4776828c88cfb18ecf" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "openssl-probe" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" - -[[package]] -name = "openssl-probe" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" - -[[package]] -name = "openssl-sys" -version = "0.9.112" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d55af3b3e226502be1526dfdba67ab0e9c96fc293004e79576b2b9edb0dbdb" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "parking_lot" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-link", -] - -[[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 = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" - -[[package]] -name = "portable-atomic" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" - -[[package]] -name = "potential_utf" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" -dependencies = [ - "zerovec", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "prettyplease" -version = "0.2.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" -dependencies = [ - "proc-macro2", - "syn", -] - -[[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 = [ - "aws-lc-rs", - "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.52.0", -] - -[[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 = "r-efi" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" - -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -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_syscall" -version = "0.5.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" -dependencies = [ - "bitflags", -] - -[[package]] -name = "ref-cast" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "reqwest" -version = "0.12.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-tls", - "hyper-util", - "js-sys", - "log", - "mime", - "native-tls", - "percent-encoding", - "pin-project-lite", - "rustls-pki-types", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "tokio", - "tokio-native-tls", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "reqwest" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3f43e3283ab1488b624b44b0e988d0acea0b3214e694730a055cb6b2efa801" -dependencies = [ - "base64", - "bytes", - "encoding_rs", - "futures-core", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "js-sys", - "log", - "mime", - "percent-encoding", - "pin-project-lite", - "quinn", - "rustls", - "rustls-pki-types", - "rustls-platform-verifier", - "serde", - "serde_json", - "sync_wrapper", - "tokio", - "tokio-rustls", - "tower", - "tower-http", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[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.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" -dependencies = [ - "aws-lc-rs", - "once_cell", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-native-certs" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "612460d5f7bea540c490b2b6395d8e34a953e52b491accd6c86c8164c5932a63" -dependencies = [ - "openssl-probe 0.2.1", - "rustls-pki-types", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pki-types" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" -dependencies = [ - "web-time", - "zeroize", -] - -[[package]] -name = "rustls-platform-verifier" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784" -dependencies = [ - "core-foundation 0.10.1", - "core-foundation-sys", - "jni", - "log", - "once_cell", - "rustls", - "rustls-native-certs", - "rustls-platform-verifier-android", - "rustls-webpki", - "security-framework", - "security-framework-sys", - "webpki-root-certs", - "windows-sys 0.61.2", -] - -[[package]] -name = "rustls-platform-verifier-android" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" - -[[package]] -name = "rustls-webpki" -version = "0.103.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df33b2b81ac578cabaf06b89b0631153a3f416b0a886e8a7a1707fb51abbd1ef" -dependencies = [ - "aws-lc-rs", - "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 = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "schannel" -version = "0.1.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "schemars" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" -dependencies = [ - "dyn-clone", - "ref-cast", - "schemars_derive", - "serde", - "serde_json", -] - -[[package]] -name = "schemars_derive" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f" -dependencies = [ - "proc-macro2", - "quote", - "serde_derive_internals", - "syn", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "security-framework" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" -dependencies = [ - "bitflags", - "core-foundation 0.10.1", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "1.0.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" - -[[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_derive_internals" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.149" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" -dependencies = [ - "indexmap", - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", -] - -[[package]] -name = "serde_spanned" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" -dependencies = [ - "serde_core", -] - -[[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 = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" -dependencies = [ - "errno", - "libc", -] - -[[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 = "socket2" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" -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 = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[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 = "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 = "system-configuration" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" -dependencies = [ - "bitflags", - "core-foundation 0.9.4", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tempfile" -version = "3.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" -dependencies = [ - "fastrand", - "getrandom 0.4.2", - "once_cell", - "rustix", - "windows-sys 0.61.2", -] - -[[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 = "tinystr" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" -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.49.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" -dependencies = [ - "bytes", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.61.2", -] - -[[package]] -name = "tokio-macros" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[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 = "tokio-util" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.9.12+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf92845e79fc2e2def6a5d828f0801e29a2f8acc037becc5ab08595c7d5e9863" -dependencies = [ - "indexmap", - "serde_core", - "serde_spanned", - "toml_datetime", - "toml_parser", - "toml_writer", - "winnow 0.7.15", -] - -[[package]] -name = "toml_datetime" -version = "0.7.5+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" -dependencies = [ - "serde_core", -] - -[[package]] -name = "toml_parser" -version = "1.0.10+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df25b4befd31c4816df190124375d5a20c6b6921e2cad937316de3fccd63420" -dependencies = [ - "winnow 1.0.0", -] - -[[package]] -name = "toml_writer" -version = "1.0.7+spec-1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17aaa1c6e3dc22b1da4b6bba97d066e354c7945cac2f7852d4e4e7ca7a6b56d" - -[[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.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" -dependencies = [ - "bitflags", - "bytes", - "futures-util", - "http", - "http-body", - "iri-string", - "pin-project-lite", - "tower", - "tower-layer", - "tower-service", -] - -[[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 = "unicode-ident" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" - -[[package]] -name = "unicode-width" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254" - -[[package]] -name = "unicode-xid" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" - -[[package]] -name = "unit-prefix" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81e544489bf3d8ef66c953931f56617f423cd4b5494be343d9b9d3dda037b9a3" - -[[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 = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[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.2+wasi-0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasip3" -version = "0.4.0+wasi-0.3.0-rc-2026-01-06" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" -dependencies = [ - "wit-bindgen", -] - -[[package]] -name = "wasm-bindgen" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" -dependencies = [ - "cfg-if", - "futures-util", - "js-sys", - "once_cell", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" -dependencies = [ - "bumpalo", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "wasm-encoder" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" -dependencies = [ - "leb128fmt", - "wasmparser", -] - -[[package]] -name = "wasm-metadata" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" -dependencies = [ - "anyhow", - "indexmap", - "wasm-encoder", - "wasmparser", -] - -[[package]] -name = "wasmparser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" -dependencies = [ - "bitflags", - "hashbrown 0.15.5", - "indexmap", - "semver", -] - -[[package]] -name = "web-sys" -version = "0.3.91" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" -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-root-certs" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804f18a4ac2676ffb4e8b5b5fa9ae38af06df08162314f96a68d2a363e21a8ca" -dependencies = [ - "rustls-pki-types", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" -dependencies = [ - "windows-sys 0.61.2", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[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-registry" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" -dependencies = [ - "windows-link", - "windows-result", - "windows-strings", -] - -[[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.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[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.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[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" - -[[package]] -name = "winnow" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a90e88e4667264a994d34e6d1ab2d26d398dcdca8b7f52bec8668957517fc7d8" - -[[package]] -name = "wit-bindgen" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" -dependencies = [ - "wit-bindgen-rust-macro", -] - -[[package]] -name = "wit-bindgen-core" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" -dependencies = [ - "anyhow", - "heck", - "wit-parser", -] - -[[package]] -name = "wit-bindgen-rust" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" -dependencies = [ - "anyhow", - "heck", - "indexmap", - "prettyplease", - "syn", - "wasm-metadata", - "wit-bindgen-core", - "wit-component", -] - -[[package]] -name = "wit-bindgen-rust-macro" -version = "0.51.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" -dependencies = [ - "anyhow", - "prettyplease", - "proc-macro2", - "quote", - "syn", - "wit-bindgen-core", - "wit-bindgen-rust", -] - -[[package]] -name = "wit-component" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" -dependencies = [ - "anyhow", - "bitflags", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder", - "wasm-metadata", - "wasmparser", - "wit-parser", -] - -[[package]] -name = "wit-parser" -version = "0.244.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" -dependencies = [ - "anyhow", - "id-arena", - "indexmap", - "log", - "semver", - "serde", - "serde_derive", - "serde_json", - "unicode-xid", - "wasmparser", -] - -[[package]] -name = "writeable" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" - -[[package]] -name = "yoke" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" -dependencies = [ - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.8.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -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.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" -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 deleted file mode 100644 index 8df7411..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,39 +0,0 @@ -[package] -name = "ghost_git_writer" -description = "write a git commit message, README or Diff Summary by LLM services." -version = "0.19.0" -repository = "https://github.com/Uliboooo/ghost_git_writer" -edition = "2024" -license = "MIT OR Apache-2.0" -authors = ["Uliboooo uliboulibo@gmail.com"] -homepage = "https://uliboooo.github.io/ghost_git_writer" - -[[bin]] -name = "ggw" -path = "src/main.rs" - -[profile.release] -opt-level = "z" -strip = true -lto = true -codegen-units = 1 -panic = "abort" - -[dependencies] -clap = { version = "4.5.*", features = ["derive"] } -git2 = "0.20.*" -ollama-rs = "0.3.*" -tokio = { version = "1.49.*", features = ["rt", "rt-multi-thread"] } -llm-api-rs = "0.1.*" -serde = { version = "1.0.*", features = ["derive"] } -serde_json = "1.0.149" -derive-getters = "0.5.*" -chrono = "0.4.*" -home = "0.5.*" -easy_storage = "0.4.*" -indicatif = "0.18.*" -unicode-width = "0.2.1" -url = "2.5.7" -atty = "0.2.14" -reqwest = { version = "0.13.2", features = ["json"] } - diff --git a/README.md b/README.md index c772b13..81d5017 100644 --- a/README.md +++ b/README.md @@ -1,82 +1,20 @@ -# ghost writer - `ggw` +# this branch WIP: move to TS + Bun -

- Icon
- Ghost git writer -

+## How to run -[![made-with-Rust](https://img.shields.io/badge/Made%20with-Rust-1f425f.svg)](https://www.rust-lang.org/) +if you have bun, give executable permission to `main.ts` and run it to run command because scripts use shebang. -https://uliboooo.github.io/ghost_git_writer/ +## TODO -**⚠️ beta ⚠️** and this doc is unstable to updating now... +- [ ] setup Lib +- [ ] Tests -## installing +## RoadMap -```zsh -cargo install ghost_git_writer -``` - -### set api key in enviroment variables - -- Gemini - - `GGW_GEMINI_API` - - `GEMINI_API_KEY` -- Anthropic - - `GGW_ANTHROPIC_API` -- OpenAI - - `GGW_OPENAI_API` -- Deepseek - - `GGW_DEEPSEEK_API` - -## usage - -```zsh -ggw [Options] -``` - -### use other source as diff - -```zsh -❯ gda --staged | ggw commit --stdin -m gemini/gemini-2.5-flash -⠏ LLM call...finished. Generated msg: -╭────────────────────────────────────────────────────────────╮ -│ feat: Set up Emacs with configuration migrated from Neovim │ -╰────────────────────────────────────────────────────────────╯ -continue?(y/n)>y -``` - -- Sub Commands - - `commit`: generate a git commit message from git diff by llm - - `readme`: generate a README from codebase. - - `sumdiff`: generate a summry of changes from git diff - - `which-sem`: in Sem Ver, Output which field should be incremented. -- Global Options(mainly) - - `-m --model`: model sepcific tag. there are tow pattern to specific model. - - `-p --path`: specific woek path. if it's empty, set current dir path. - - `-l --lang`: change output language.(default=english). e.g. `-l japanese` - - `-e --extra`: extra prompt. if you need to append order to llm. - - `--config`: config file path. if you need to locate other than `~/.config/ggw/config.toml` or `~/.ggw.toml`. - - `--oneline`: output only llm's return for cli pipes -- Options for `commit` - - `--auto-commit`: allow auto git commit by generated message - - `-D --diff `: specify commit hash or tag or git symbolic ref(e.g. 'HEAD') -- Options for `readme` - - `-s --source `: source files path. A list of file paths separated by ','. - - `-d --directory `: souce file folder - - `--merge-readme`: allow merge to existing README.md -- Options for `sumdiff` - - `-D --diff `: specify commit hash or tag or git symbolic ref(e.g. 'HEAD') -- Options for `which-sem` - - `-D --diff `: specify commit hash or tag or git symbolic ref(e.g. 'HEAD') - -## Examples - -```shell -# give `git diff` to command -ggw commit -m gemini/gemini-2.0-flash -ggw commit -m gemini/gemini-3-flash-preview - -# gice `git diff 76fd1d0` to command -ggw sumdiff -D 76fd1d0 -m gemini/gemini-2.5-pro -``` +- [ ] impl `ggw`: wip + - [ ] tests works + - [ ] reproduct args: ns +- [ ] impl `readme`: ns +- [ ] impl `sumdiff`: ns +- [ ] impl `which-sem`: ns +- [ ] distribute as 1file: ns diff --git a/README_resource/icon.svg b/README_resource/icon.svg deleted file mode 100644 index 1c87506..0000000 --- a/README_resource/icon.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/README_resource/log-ggw.png b/README_resource/log-ggw.png deleted file mode 100644 index 08025e7..0000000 Binary files a/README_resource/log-ggw.png and /dev/null differ diff --git a/apps/ggw/main.ts b/apps/ggw/main.ts new file mode 100755 index 0000000..33318c5 --- /dev/null +++ b/apps/ggw/main.ts @@ -0,0 +1,83 @@ +#!/usr/bin/env bun + +import { Command } from "commander"; +import simpleGit from "simple-git"; +import { callLLM } from "packages/core/src/llm"; +import { spinner } from "packages/core/src/cui/spinner"; +import { fmt_output, yes_no } from "packages/core/src/cui/prompt"; +import { model_name_resolver } from "packages/core/src/cli/parser"; + +type Options = { + model: string; + config?: string; + lang?: string; + path?: string; + stdin: boolean; + diff?: [string, string]; +} + +const program = new Command(); +program.name("ggw").description("Ghost git Writer - CLI tool for AI-powered commits").version("0.2.0"); +program + .option("-m, --model ", "LLM model to use (gemini)", "gemini/gemini-3-flash-preview") + // .option("-c, --config ", "path to config file") + .option("-l, --lang ", "select lang") + .option("-p, --path ", "work path. git project root path.") + .option("-I, --stdin", "use sdtin as diff content") + .option("-D, --diff ", "diff range"); +program.parse(); + +const options = program.opts(); +const lang = options.lang ?? "English"; +const [provider, model] = model_name_resolver(options.model); +const git_repo_path = options.path ?? process.cwd(); + +const git = simpleGit(git_repo_path); + +const diff = await (async (use_stdin: boolean) => { + if (use_stdin) { + const input = await Bun.stdin.text(); + return input; + } else { + return await git.diff(options.diff); + } +})(options.stdin); + +const git_st = JSON.stringify(await git.status()); + +const prompt = `You are an assistant that writes Git commit messages.\ +When code changes include modifications to documentation files (e.g., README.md, docs/), ignore those changes and generate the commit message based solely on source code changes.\ +Given a description of code changes, output only a single-line commit message in Conventional Commits format (e.g., \"feat:\", \"fix:\", \"docs:\", etc.).\ +Do not include any extra text, code blocks, or formatting. Only output the commit message.\ +git status info and diff changes:\ +status: +${git_st} + +diff: +${diff} + +Please answer in ${lang}` + +const cmt_msg_p = callLLM(provider, model, prompt); + +const cmt_msg = await spinner(cmt_msg_p, `Calling ${model} ...`); + +console.log(fmt_output(cmt_msg)); + +const git_res = await (async (y_n: boolean) => { + if (y_n) { + const res_git_add = await git.add("."); + const res_git_cmt = await git.commit(cmt_msg); + return [res_git_add, res_git_cmt]; + } else { + console.error("cannceld."); + process.exit(1); + } +})(await yes_no("git commit as this message?")); + +if (git_res == null) { + console.log("failed to git add or commit"); +} else { + console.log("ok."); +} + diff --git a/apps/sumdiff/main.ts b/apps/sumdiff/main.ts new file mode 100755 index 0000000..ca03f15 --- /dev/null +++ b/apps/sumdiff/main.ts @@ -0,0 +1,65 @@ +#!/usr/bin/env bun + +import { Command } from "commander"; +import simpleGit from "simple-git"; +import { callLLM } from "packages/core/src/llm"; +import { spinner } from "packages/core/src/cui/spinner"; +import { model_name_resolver } from "packages/core/src/cli/parser"; + +type Options = { + model: string; + config?: string; + lang?: string; + path?: string; + stdin: boolean; + diff?: [string, string]; +} + +const program = new Command(); +program.name("ggw").description("Ghost git Writer - CLI tool for AI-powered commits").version("0.1.0"); +program + .option("-m, --model ", "LLM model to use (gemini)", "gemini/gemini-3-flash-preview") + // .option("-c, --config ", "path to config file") + .option("-l, --lang ", "select lang") + .option("-p, --path ", "work path. git project root path.") + .option("-I, --stdin", "use sdtin as diff content") + .option("-D, --diff ", "diff range"); +program.parse(); + +const options = program.opts(); +const lang = options.lang ?? "English"; +const [provider, model] = model_name_resolver(options.model); +const git_repo_path = options.path ?? process.cwd(); + +const git = simpleGit(git_repo_path); + +const diff = await (async (use_stdin: boolean) => { + if (use_stdin) { + const input = await Bun.stdin.text(); + return input; + } else { + return await git.diff(options.diff); + } +})(options.stdin); + +const git_st = JSON.stringify(await git.status()); + +const prompt = `summarize the git diff changes. +List the key modifications, what was added, removed, or modified, and briefly explain their purpose or impact if possible. +about only changes. must not write about project. you don't readme writer, you summarize diff changes: + +status: +${git_st} + +diff: +${diff} + +Please answer in ${lang}.; +` + +const cmt_msg_p = callLLM(provider, model, prompt); + +const cmt_msg = await spinner(cmt_msg_p, `Calling ${model} ...`); + +console.log(cmt_msg); + diff --git a/apps/which-sem/main.ts b/apps/which-sem/main.ts new file mode 100755 index 0000000..7ed4da3 --- /dev/null +++ b/apps/which-sem/main.ts @@ -0,0 +1,78 @@ +#!/usr/bin/env bun + +import { Command } from "commander"; +import simpleGit from "simple-git"; +import { callLLM } from "packages/core/src/llm"; +import { spinner } from "packages/core/src/cui/spinner"; +import { model_name_resolver } from "packages/core/src/cli/parser"; +import { parseSemVerPart, semVerSelector } from "packages/core/src/cui/semver"; + +type Options = { + model: string; + lang?: string; + path?: string; + stdin: boolean; + diff?: [string, string]; + oneline: boolean; +} + +const program = new Command(); +program.name("which-sem").description("Determine which SemVer part (Major/Minor/Patch) should be bumped based on git diff").version("0.1.0"); +program + .option("-m, --model ", "LLM model to use (gemini)", "gemini/gemini-3-flash-preview") + .option("-l, --lang ", "select lang") + .option("-p, --path ", "work path. git project root path.") + .option("-I, --stdin", "use stdin as diff content") + .option("-D, --diff ", "diff range") + .option("-o, --oneline", "output only the SemVer part name"); +program.parse(); + +const options = program.opts(); +const lang = options.lang ?? "English"; +const [provider, model] = model_name_resolver(options.model); +const git_repo_path = options.path ?? process.cwd(); + +const git = simpleGit(git_repo_path); + +const diff = await (async (use_stdin: boolean) => { + if (use_stdin) { + const input = await Bun.stdin.text(); + return input; + } else { + return await git.diff(options.diff); + } +})(options.stdin); + +const git_st = JSON.stringify(await git.status()); + +const prompt = `**Output 'SemVer field name' and 'the reason' separated by '|'. About version field name, only contain semver name (Major or Minor or Patch)** Must strictly adhere to this format: 'Minor | Reasons'. In Semantic Versioning, which field version should be incremented? Think with reference to the git diff data: + +git status: +${git_st} + +diff: +${diff} + +Please answer in ${lang}.` + +const res_p = callLLM(provider, model, prompt); +const res = await spinner(res_p, `Calling ${model} ...`); + +const parts = res.split("|"); +const semver_raw = parts[0] ?? ""; +const reason = parts[1]?.trim() ?? ""; + +if (options.oneline) { + console.log(semver_raw.trim()); +} else { + const part = parseSemVerPart(semver_raw); + if (part === null) { + console.log(semver_raw.trim()); + } else { + const selector = semVerSelector(part); + console.log(`should increase at\n${selector}`); + if (reason) { + console.log(`reasons:\n${reason}`); + } + } +} diff --git a/auto_release.bash b/auto_release.bash deleted file mode 100644 index ed9a0c0..0000000 --- a/auto_release.bash +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -ver="$1" - -success_builds=0 -success_zips=0 - -# build -if cargo build --release; then - success_builds=$((success_builds + 1)) -else - echo "❌ failed to build for arm mac" -fi - -if cargo build --release --target x86_64-pc-windows-gnu; then - success_builds=$((success_builds + 1)) -else - echo "❌ failed to build for windows" -fi - -if cargo build --release --target x86_64-unknown-linux-gnu; then - success_builds=$((success_builds + 1)) -else - echo "❌ failed to build for linux" -fi - -# zip -rm -r ./release && mkdir -p ./release - -if zip -j ./release/ggw_${ver}_arm_mac.zip ./target/release/ggw; then - success_zips=$((success_zips + 1)) -else - echo "❌ failed to zip for arm mac" -fi - -if zip -j ./release/ggw_${ver}_win.zip ./target/x86_64-pc-windows-gnu/release/ggw.exe; then - success_zips=$((success_zips + 1)) -else - echo "❌ failed to zip for windows" -fi - -if zip -j ./release/ggw_${ver}_linux.zip ./target/x86_64-unknown-linux-gnu/release/ggw; then - success_zips=$((success_zips + 1)) -else - echo "❌ failed to zip for linux" -fi - -# build results -[ "$success_builds" -ge 1 ] && echo "✅ success arm mac build" -[ "$success_builds" -ge 2 ] && echo "✅ success windows build" -[ "$success_builds" -ge 3 ] && echo "✅ success linux build" - -# zip results -[ "$success_zips" -ge 1 ] && echo "✅ success arm mac zip" -[ "$success_zips" -ge 2 ] && echo "✅ success windows zip" -[ "$success_zips" -ge 3 ] && echo "✅ success linux zip" diff --git a/bun.lock b/bun.lock new file mode 100644 index 0000000..a5c55fc --- /dev/null +++ b/bun.lock @@ -0,0 +1,126 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "ghost_git_writer_bun", + "dependencies": { + "@google/genai": "^1.50.1", + "commander": "^14.0.3", + "openai": "^6.34.0", + "simple-git": "^3.36.0", + }, + "devDependencies": { + "@types/bun": "latest", + }, + "peerDependencies": { + "typescript": "^5", + }, + }, + }, + "packages": { + "@google/genai": ["@google/genai@1.50.1", "", { "dependencies": { "google-auth-library": "^10.3.0", "p-retry": "^4.6.2", "protobufjs": "^7.5.4", "ws": "^8.18.0" }, "peerDependencies": { "@modelcontextprotocol/sdk": "^1.25.2" }, "optionalPeers": ["@modelcontextprotocol/sdk"] }, "sha512-YbkX7H9+1Pt8wOt7DDREy8XSoiL6fRDzZQRyaVBarFf8MR3zHGqVdvM4cLbDXqPhxqvegZShgfxb8kw9C7YhAQ=="], + + "@kwsites/file-exists": ["@kwsites/file-exists@1.1.1", "", { "dependencies": { "debug": "^4.1.1" } }, "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw=="], + + "@kwsites/promise-deferred": ["@kwsites/promise-deferred@1.1.1", "", {}, "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="], + + "@protobufjs/aspromise": ["@protobufjs/aspromise@1.1.2", "", {}, "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ=="], + + "@protobufjs/base64": ["@protobufjs/base64@1.1.2", "", {}, "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="], + + "@protobufjs/codegen": ["@protobufjs/codegen@2.0.4", "", {}, "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="], + + "@protobufjs/eventemitter": ["@protobufjs/eventemitter@1.1.0", "", {}, "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q=="], + + "@protobufjs/fetch": ["@protobufjs/fetch@1.1.0", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" } }, "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ=="], + + "@protobufjs/float": ["@protobufjs/float@1.0.2", "", {}, "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ=="], + + "@protobufjs/inquire": ["@protobufjs/inquire@1.1.0", "", {}, "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q=="], + + "@protobufjs/path": ["@protobufjs/path@1.1.2", "", {}, "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA=="], + + "@protobufjs/pool": ["@protobufjs/pool@1.1.0", "", {}, "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw=="], + + "@protobufjs/utf8": ["@protobufjs/utf8@1.1.0", "", {}, "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw=="], + + "@simple-git/args-pathspec": ["@simple-git/args-pathspec@1.0.3", "", {}, "sha512-ngJMaHlsWDTfjyq9F3VIQ8b7NXbBLq5j9i5bJ6XLYtD6qlDXT7fdKY2KscWWUF8t18xx052Y/PUO1K1TRc9yKA=="], + + "@simple-git/argv-parser": ["@simple-git/argv-parser@1.1.1", "", { "dependencies": { "@simple-git/args-pathspec": "^1.0.3" } }, "sha512-Q9lBcfQ+VQCpQqGJFHe5yooOS5hGdLFFbJ5R+R5aDsnkPCahtn1hSkMcORX65J2Z5lxSkD0lQorMsncuBQxYUw=="], + + "@types/bun": ["@types/bun@1.3.13", "", { "dependencies": { "bun-types": "1.3.13" } }, "sha512-9fqXWk5YIHGGnUau9TEi+qdlTYDAnOj+xLCmSTwXfAIqXr2x4tytJb43E9uCvt09zJURKXwAtkoH4nLQfzeTXw=="], + + "@types/node": ["@types/node@25.6.0", "", { "dependencies": { "undici-types": "~7.19.0" } }, "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ=="], + + "@types/retry": ["@types/retry@0.12.0", "", {}, "sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA=="], + + "agent-base": ["agent-base@7.1.4", "", {}, "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ=="], + + "base64-js": ["base64-js@1.5.1", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="], + + "bignumber.js": ["bignumber.js@9.3.1", "", {}, "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ=="], + + "buffer-equal-constant-time": ["buffer-equal-constant-time@1.0.1", "", {}, "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA=="], + + "bun-types": ["bun-types@1.3.13", "", { "dependencies": { "@types/node": "*" } }, "sha512-QXKeHLlOLqQX9LgYaHJfzdBaV21T63HhFJnvuRCcjZiaUDpbs5ED1MgxbMra71CsryN/1dAoXuJJJwIv/2drVA=="], + + "commander": ["commander@14.0.3", "", {}, "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw=="], + + "data-uri-to-buffer": ["data-uri-to-buffer@4.0.1", "", {}, "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A=="], + + "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="], + + "ecdsa-sig-formatter": ["ecdsa-sig-formatter@1.0.11", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ=="], + + "extend": ["extend@3.0.2", "", {}, "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="], + + "fetch-blob": ["fetch-blob@3.2.0", "", { "dependencies": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" } }, "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ=="], + + "formdata-polyfill": ["formdata-polyfill@4.0.10", "", { "dependencies": { "fetch-blob": "^3.1.2" } }, "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g=="], + + "gaxios": ["gaxios@7.1.4", "", { "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", "node-fetch": "^3.3.2" } }, "sha512-bTIgTsM2bWn3XklZISBTQX7ZSddGW+IO3bMdGaemHZ3tbqExMENHLx6kKZ/KlejgrMtj8q7wBItt51yegqalrA=="], + + "gcp-metadata": ["gcp-metadata@8.1.2", "", { "dependencies": { "gaxios": "^7.0.0", "google-logging-utils": "^1.0.0", "json-bigint": "^1.0.0" } }, "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg=="], + + "google-auth-library": ["google-auth-library@10.6.2", "", { "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", "gaxios": "^7.1.4", "gcp-metadata": "8.1.2", "google-logging-utils": "1.1.3", "jws": "^4.0.0" } }, "sha512-e27Z6EThmVNNvtYASwQxose/G57rkRuaRbQyxM2bvYLLX/GqWZ5chWq2EBoUchJbCc57eC9ArzO5wMsEmWftCw=="], + + "google-logging-utils": ["google-logging-utils@1.1.3", "", {}, "sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA=="], + + "https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], + + "json-bigint": ["json-bigint@1.0.0", "", { "dependencies": { "bignumber.js": "^9.0.0" } }, "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ=="], + + "jwa": ["jwa@2.0.1", "", { "dependencies": { "buffer-equal-constant-time": "^1.0.1", "ecdsa-sig-formatter": "1.0.11", "safe-buffer": "^5.0.1" } }, "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg=="], + + "jws": ["jws@4.0.1", "", { "dependencies": { "jwa": "^2.0.1", "safe-buffer": "^5.0.1" } }, "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA=="], + + "long": ["long@5.3.2", "", {}, "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA=="], + + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + + "node-domexception": ["node-domexception@1.0.0", "", {}, "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ=="], + + "node-fetch": ["node-fetch@3.3.2", "", { "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", "formdata-polyfill": "^4.0.10" } }, "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA=="], + + "openai": ["openai@6.34.0", "", { "peerDependencies": { "ws": "^8.18.0", "zod": "^3.25 || ^4.0" }, "optionalPeers": ["ws", "zod"], "bin": { "openai": "bin/cli" } }, "sha512-yEr2jdGf4tVFYG6ohmr3pF6VJuveP0EA/sS8TBx+4Eq5NT10alu5zg2dmxMXMgqpihRDQlFGpRt2XwsGj+Fyxw=="], + + "p-retry": ["p-retry@4.6.2", "", { "dependencies": { "@types/retry": "0.12.0", "retry": "^0.13.1" } }, "sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ=="], + + "protobufjs": ["protobufjs@7.5.5", "", { "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", "@protobufjs/codegen": "^2.0.4", "@protobufjs/eventemitter": "^1.1.0", "@protobufjs/fetch": "^1.1.0", "@protobufjs/float": "^1.0.2", "@protobufjs/inquire": "^1.1.0", "@protobufjs/path": "^1.1.2", "@protobufjs/pool": "^1.1.0", "@protobufjs/utf8": "^1.1.0", "@types/node": ">=13.7.0", "long": "^5.0.0" } }, "sha512-3wY1AxV+VBNW8Yypfd1yQY9pXnqTAN+KwQxL8iYm3/BjKYMNg4i0owhEe26PWDOMaIrzeeF98Lqd5NGz4omiIg=="], + + "retry": ["retry@0.13.1", "", {}, "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg=="], + + "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], + + "simple-git": ["simple-git@3.36.0", "", { "dependencies": { "@kwsites/file-exists": "^1.1.1", "@kwsites/promise-deferred": "^1.1.1", "@simple-git/args-pathspec": "^1.0.3", "@simple-git/argv-parser": "^1.1.0", "debug": "^4.4.0" } }, "sha512-cGQjLjK8bxJw4QuYT7gxHw3/IouVESbhahSsHrX97MzCL1gu2u7oy38W6L2ZIGECEfIBG4BabsWDPjBxJENv9Q=="], + + "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + + "undici-types": ["undici-types@7.19.2", "", {}, "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg=="], + + "web-streams-polyfill": ["web-streams-polyfill@3.3.3", "", {}, "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw=="], + + "ws": ["ws@8.20.0", "", { "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": ">=5.0.2" }, "optionalPeers": ["bufferutil", "utf-8-validate"] }, "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA=="], + } +} diff --git a/chglog.md b/chglog.md deleted file mode 100644 index a0ee44a..0000000 --- a/chglog.md +++ /dev/null @@ -1,124 +0,0 @@ -# change log - -## 0.14.1(Aug 29) (written by gemini 2.5 pro) - -### Key Modifications - -The most significant change is the introduction of **multi-language support**. A new global command-line option, `-l` or `--lang`, has been added to allow users to specify the output language for LLM-generated content. This feature required extensive refactoring across the application to pass the language parameter to all LLM prompt generation functions. - -Accompanying this feature is a major codebase refactoring: -* The `main` function is now `async`. -* Modules for generating commits, READMEs, and summaries have been restructured. -* The LLM calling logic has been centralized and improved to be more modular. -* Configuration handling was updated to support more advanced options, like custom base URLs for Ollama. -* The command-line interface (CLI) helpers were improved, replacing a manual spinner with the `indicatif` crate. - -### Added - -* **`.github/workflows/rust.yml`**: A `cargo check` step was added to the CI pipeline for faster error checking. -* **`src/cli_helper.rs`**: A new `Spinner` struct (using the `indicatif` crate) and a `Printer` struct (for formatted box output) were added. -* **`Cargo.toml`**: Dependencies for `indicatif`, `unicode-width`, and `url` were added to support the new UI and functionality. -* **`src/main.rs`**: - * A global `-l, --lang` CLI option was added to the `RootOptions` struct. - * Logic to handle the new `lang` parameter and pass it to LLM functions. -* **`.gitignore`**: The `src_old/` directory was added to the ignore list. - -### Removed - -Multiple files were deleted as part of a major code reorganization and cleanup. The functionality from these files was moved into new, refactored modules. - -* **Source Files Deleted:** - * `src/cmt_msg.rs` - * `src/custom_prompt.rs` - * `src/read_codes.rs` - * `src/readme.rs` - * `src/sum.rs` - * `src/storage.rs` (Functionality replaced by the `easy_storage` crate). -* **Project Files Deleted:** - * `a.diff`: A temporary diff file. - * `release/*.zip`: Old binary release artifacts. - * `resource/wwg_demo_0_2_1.gif`: An old demo GIF. - * `test_config.json`, `test_diff.txt`: Old test configuration and data files. - * `ulib_owl_release/`: Directory containing old, specific build scripts. -* **Dependencies Removed:** - * The `dialoguer` dependency was removed from `Cargo.toml`. - -### Modified - -* **`Cargo.toml` & `Cargo.lock`**: Project version was bumped to `0.14.1`. Dependency versions were updated, with many now using wildcard versions (e.g., `4.5.*`). -* **`README.md`**: Significantly rewritten to simplify usage instructions, remove outdated information, and document the new `--lang` option. -* **`src/config.rs`**: Configuration structs were refactored. The `Model` struct now includes a `base_url` field. The logic for resolving models from aliases or defaults has been updated. -* **`src/get_input.rs`**: Functions now return `Result` instead of panicking on I/O errors, improving robustness. -* **`src/git.rs`**: The `get_diff` function was enhanced to allow generating a diff between specific commit points, not just against the working directory. -* **`src/llm.rs`**: Heavily refactored. LLM calls are now managed through a new `LlmReqInfo` struct and a `Provider` enum, making the code more modular and extensible. Spinner logic is now integrated here. -* **`src/main.rs`**: This file saw the most changes, orchestrating the new multi-language feature and reflecting the overall code restructuring. Error handling was also completely revamped. -* **`auto_release.bash`**: The script was modified to clean the `release` directory before creating new zip files. - -## 0.9.1(Aug 15) - -- change priority of config path, - - primary: `~/.config/ggw/config.toml` - - secoundary: `~/.ggw.toml` -- improve `sum` prompt - - suppress summaries other than changes - -## 0.9.0 - -- config format change to toml from json - -## 0.8.0 - -- change additional prompt for `cmt`. `-c --cutom-prompt` -> `-e --extra`. -- remove `-d --default` option - -## 0.6.0 - -- feat: multi lang support - -## 0.5.0 - -- add feat: oneline mode that print only result e.g. generated commit message and summarize diff -- change option format, `ggw -m gemini/foo cmt` -> `ggw cmt -m gemini/foo` - -## 0.4.2 - -- feat: add custom prompt - -## 0.4.0 - -- feat: add feat to spin a spinner during llm processing - -## 0.3.6 - -Here's a breakdown of the changes in the provided Rust code diff: - -**Key Modifications:** - -- **Argument Handling in `Readme` struct:** - - The `source_path_list` field in the `Readme` struct was changed from `Vec` to `Option>` - - Added logic to handle the mutually exclusive arguments `source_path_list` and `dir` - -**Purpose and Impact:** - -- **Flexibility in Readme Creation:** - - * The change in `source_path_list` to be optional enables the user to specify either a list of source files or a directory for generating a README. Previously, only a list of source files was supported. - * The `dir` argument allows the program to read all files in a specified directory for README generation. - * The `required_unless_present` and `conflicts_with` arguments ensure that either `source_path_list` or `dir` must be provided, but not both. This improves the command-line interface by making the usage cl - - earer and preventing ambiguous configurations. - -- **Directory Traversal for Readme Generation:** - - The code now handles the case where a directory is provided as input for README generation. It reads all files within the directory and uses them as input for the README creation process. - - The error handling ensures that if neither `source_path_list` nor `dir` is provided, the program will return an error indicating that a file path is not set. - -## 0.3.2 - -### fix - -- fix bug; don't require `-s` in rdm subcommand. - -## 0.3.0 Jul 17 13:30 - -- now, abolish `--servie` option. integrated to format: `-m provider/model` -- now, abolish model format: `-s gemini -m gemini-2.0-flash` because 👆 diff --git a/config_template.toml b/config_template.toml deleted file mode 100644 index 036897e..0000000 --- a/config_template.toml +++ /dev/null @@ -1,7 +0,0 @@ -[llms.default_model] -provider = "gemini" -model = "gemini-2.0-flash" - -[llms.models.ge] -provider = "gemini" -model = "gemini-2.5-flash" diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 7cf0da6..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -ggw.uliboooo.dev \ No newline at end of file diff --git a/docs/icon.svg b/docs/icon.svg deleted file mode 100644 index 1c87506..0000000 --- a/docs/icon.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index aacb0ab..0000000 --- a/docs/index.html +++ /dev/null @@ -1,354 +0,0 @@ - - - - - - - Ghost Git Writer (ggw) - AI-Powered Git Assistant - - - - - - - - - - - -
-
- Rust製 高速AI Gitアシスタント -
- -

- AIにコミットを任せよう -

- -

- コミットメッセージ、README、Diffの要約をLLMが自動生成。
- Rust製のCLIツール ggw でGitワークフローを加速させましょう。 -

- - -
-
-
-
-
- user@dev:~/project -
-
-
- - ggw commit -
-
- LLM call...finished. -
-
-
- Generated msg:
- feat: Set up Emacs with configuration migrated from Neovim -
-
continue?(y/n)> y
-
-
-
- - -
-
-
-
- $ - cargo install ghost_git_writer - -
-
- - GitHubを見る - -
-
- - -
-
-

Supported LLM Providers

-
- Gemini - OpenAI - Anthropic - DeepSeek - Ollama (Local) -
-
-
- - -
-

Git作業を自動化する4つの機能

-
- -
-
- -
-

スマートなコミット生成

-

- 変更内容(diff)を解析し、Conventional Commits形式の適切なメッセージを提案します。日本語出力も対応。 -

-
- - -
-
- -
-

README 自動作成

-

- ソースコードを読み込み、プロジェクトの概要、インストール方法、使い方を含むREADME.mdを生成します。 -

-
- - -
-
- -
-

Diff サマリー

-

- 大量の差分を読むのは大変です。AIが変更点の要約を作成し、何が変わったのかを即座に把握できます。 -

-
- - -
-
- -
-

SemVer 推奨

-

- 変更内容に基づいて、セマンティックバージョニングのどのフィールド(Major/Minor/Patch)を上げるべきかアドバイスします。 -

-
-
-
- - -
-
-

Usage Examples

- -
- -
-

# 特定のモデルと日本語を指定してコミットメッセージを生成

-
- ggw commit -m gemini/gemini-2.0-flash -l japanese -
-
- - -
-

# パイプを使ってステージングされた変更を処理

-
- git diff --staged | ggw commit --stdin -
-
- - -
-

# 特定のコミットとの差分を要約

-
- ggw sumdiff -D 76fd1d0 -
-
-
-
-
- - -
-
- GitHub - License -
-

© 2025 Uliboooo. All rights reserved.

-

Made with Rust 🦀

-
- - - - - - \ No newline at end of file diff --git a/docs/log-ggw.png b/docs/log-ggw.png deleted file mode 100644 index 08025e7..0000000 Binary files a/docs/log-ggw.png and /dev/null differ diff --git a/icon.svg b/icon.svg deleted file mode 100644 index 1c87506..0000000 --- a/icon.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/package.json b/package.json new file mode 100644 index 0000000..b67734e --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "ghost_git_writer_bun", + "module": "index.ts", + "type": "module", + "private": true, + "devDependencies": { + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5" + }, + "dependencies": { + "@google/genai": "^1.50.1", + "commander": "^14.0.3", + "openai": "^6.34.0", + "simple-git": "^3.36.0" + } +} diff --git a/packages/core/package.json b/packages/core/package.json new file mode 100644 index 0000000..e14f4a8 --- /dev/null +++ b/packages/core/package.json @@ -0,0 +1,9 @@ +{ + "name": "@ggw/core", + "version": "0.0.1", + "type": "module", + "exports": { + "types": "./src/index.ts", + "default": "./src/index.ts" + } +} diff --git a/packages/core/src/cli/index.ts b/packages/core/src/cli/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/core/src/cli/parser.ts b/packages/core/src/cli/parser.ts new file mode 100644 index 0000000..94fdbbc --- /dev/null +++ b/packages/core/src/cli/parser.ts @@ -0,0 +1,14 @@ +export type ModelInfo = [provider: string, model_name: string]; + +export function model_name_resolver(m: string): ModelInfo { + const input_model = ((inp => { + const cut = String(inp).split("/"); + if (cut.length >= 2) { + return [String(cut[0]), String(cut[1])] + } + })(m)); + + const pro = (input_model?.[0] ?? "gemini").toLowerCase(); + const model = input_model?.[1] ?? "gemini-3-flash-preview"; + return [pro, model]; +} diff --git a/packages/core/src/cui/index.ts b/packages/core/src/cui/index.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/core/src/cui/prompt.ts b/packages/core/src/cui/prompt.ts new file mode 100644 index 0000000..7ade974 --- /dev/null +++ b/packages/core/src/cui/prompt.ts @@ -0,0 +1,26 @@ +import { createInterface } from "node:readline/promises"; + +export async function yes_no(prompt: string) { + const rl = createInterface({ + input: process.stdin, + output: process.stdout, + }); + + const ans = await rl.question(`${prompt} (y/n): `); + rl.close(); + + return ans.toLowerCase() === "y"; +} + +export function fmt_output(s: string) { + const l = s.length; + const padding = 2; + const bar = "─".repeat(l + padding); + const top_bar = "╭" + bar + "╮"; + const bottom_bar = "╰" + bar + "╯"; + + const boddys = s.split("\n").map(line => `│ ${line} │`).join("\n"); + + return `${top_bar}\n${boddys}\n${bottom_bar}`; +} + diff --git a/packages/core/src/cui/semver.ts b/packages/core/src/cui/semver.ts new file mode 100644 index 0000000..8ab5f48 --- /dev/null +++ b/packages/core/src/cui/semver.ts @@ -0,0 +1,47 @@ +export type SemVerPart = "major" | "minor" | "patch"; + +const PARTS: { key: SemVerPart; label: string }[] = [ + { key: "major", label: "MAJOR" }, + { key: "minor", label: "MINOR" }, + { key: "patch", label: "PATCH" }, +]; + +export function parseSemVerPart(s: string): SemVerPart | null { + const lower = s.trim().toLowerCase(); + if (lower === "major" || lower === "minor" || lower === "patch") { + return lower as SemVerPart; + } + return null; +} + +export function semVerSelector(selected: SemVerPart): string { + let top = ""; + let mid = ""; + let bot = ""; + + for (let i = 0; i < PARTS.length; i++) { + const { label } = PARTS[i]; + const w = label.length; + const isSel = PARTS[i].key === selected; + const prevIsSel = i > 0 && PARTS[i - 1].key === selected; + + // Add separator before this item (skip if adjacent to selected) + if (i > 0 && !prevIsSel && !isSel) { + top += " "; + mid += "│"; + bot += " "; + } + + if (isSel) { + top += `╭${"─".repeat(w + 2)}╮`; + mid += `│ ${label} │`; + bot += `╰${"─".repeat(w + 2)}╯`; + } else { + top += " ".repeat(w + 2); + mid += ` ${label} `; + bot += " ".repeat(w + 2); + } + } + + return `${top}\n${mid}\n${bot}`; +} diff --git a/packages/core/src/cui/spinner.ts b/packages/core/src/cui/spinner.ts new file mode 100644 index 0000000..22ddae6 --- /dev/null +++ b/packages/core/src/cui/spinner.ts @@ -0,0 +1,35 @@ +export function spinner(promise: Promise, text = "Processing") { + const frames = ["-", "\\", "|", "/"]; + return withSpinner(promise, text); + + async function withSpinner( + promise: Promise, + text: string + ): Promise { + let i = 0; + + process.stdout.write("\x1b[?25l"); // hide cursor + + const interval = setInterval(() => { + const frame = frames[i = (i + 1) % frames.length]; + process.stdout.write(`\r${frame} ${text}`); + }, 100); + + try { + try { + const result = await promise; + clearInterval(interval); + process.stdout.write(`\r✔ Done\n`); + return result; + } catch (err) { + clearInterval(interval); + process.stdout.write(`\r✖ Error\n`); + throw err; + } + } finally { + process.stdout.write("\x1b[?25h"); // show cursor + } + } + +} + diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts new file mode 100644 index 0000000..3b5d2aa --- /dev/null +++ b/packages/core/src/index.ts @@ -0,0 +1,3 @@ +export function hello(name: string) { + return `hello ${name}`; +} diff --git a/packages/core/src/llm/gemini.ts b/packages/core/src/llm/gemini.ts new file mode 100644 index 0000000..1921197 --- /dev/null +++ b/packages/core/src/llm/gemini.ts @@ -0,0 +1,11 @@ +import { GoogleGenAI } from "@google/genai"; + +export async function call_gemini(model: string, prompt: string) { + const ai = new GoogleGenAI({}); + const res = await ai.models.generateContent({ + model: model, + contents: prompt + }); + + return res.text ?? "nothing"; +} diff --git a/packages/core/src/llm/index.ts b/packages/core/src/llm/index.ts new file mode 100644 index 0000000..24efe19 --- /dev/null +++ b/packages/core/src/llm/index.ts @@ -0,0 +1,13 @@ +import { call_gemini } from "./gemini"; +import { call_openAI } from "./openai"; + +export function callLLM(provider: string, model: string, prompt: string) { + switch (provider.toLowerCase()) { + case "gemini": + return call_gemini(model, prompt); + case "openai": + return call_openAI(model, prompt); + default: + throw new Error("unknown provider"); + } +} diff --git a/packages/core/src/llm/openai.ts b/packages/core/src/llm/openai.ts new file mode 100644 index 0000000..4b26806 --- /dev/null +++ b/packages/core/src/llm/openai.ts @@ -0,0 +1,20 @@ +import OpenAI from "openai"; + +export async function call_openAI(model: string, prompt: string) { + const client = new OpenAI({ + apiKey: process.env["OPENAI_API_KEY"], + }); + + const chatComp = await client.chat.completions.create({ + messages: [{ role: 'user', content: prompt }], + model: model, + stream: true, + }); + let buf = "" + for await (const Chunk of chatComp) { + buf += Chunk; + } + return buf; + +} + diff --git a/reference/config.md b/reference/config.md deleted file mode 100644 index 9883e51..0000000 --- a/reference/config.md +++ /dev/null @@ -1,3 +0,0 @@ -# config - -## model diff --git a/reference/logic_map.md b/reference/logic_map.md deleted file mode 100644 index 7223d3b..0000000 --- a/reference/logic_map.md +++ /dev/null @@ -1,7 +0,0 @@ -# map - -- root - - main: parse cli args & io process - - llms: llm controller - - git: git controller - diff --git a/src/cli.rs b/src/cli.rs deleted file mode 100644 index 912ee3e..0000000 --- a/src/cli.rs +++ /dev/null @@ -1,288 +0,0 @@ -use crate::get_input::yes_no; -use clap::{self}; -use derive_getters::Getters; -use std::{fmt::Display, fs, path::PathBuf}; - -#[derive(Debug)] -pub enum Error { - Io(std::io::Error), - DoesNotExistSource, - NotFoundSrc, -} - -impl Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Error::Io(e) => write!(f, "io error: {}", e), - Error::DoesNotExistSource => write!(f, "No source specified."), - Error::NotFoundSrc => write!(f, "not dound src folder"), - } - } -} - -impl From for Error { - fn from(value: std::io::Error) -> Self { - Self::Io(value) - } -} - -#[derive(Debug, clap::Parser, Clone)] -#[command(name = "ggw", version, about = "generate git commit msg by llm")] -pub struct Cli { - #[command(subcommand)] - pub subcommand: Commands, -} - -impl RootOption for Cli { - fn get_root_options(&self) -> RootOptions { - self.subcommand.get_root_options() - } -} - -pub trait RootOption { - fn get_root_options(&self) -> RootOptions; -} - -#[derive(Debug, clap::Args, Clone, Getters)] -pub struct RootOptions { - #[arg( - short = 'm', - long = "model", - // conflicts_with = "alias", - help = "`-m gemini/gemino-2.0-flash` or `-m config's model name`" - )] - model: Option, - - #[arg(long = "temperature")] - temperature: Option, - - #[arg(long = "max-tokens")] - max_tokens: Option, - - #[arg(long = "base-url")] - base_url: Option, - - #[arg(short = 'p', long = "path", help = "work path. git project root path.")] - path: Option, - - #[arg(short = 'l', long = "lang", help = "language. `-l japanese`")] - lang: Option, - - #[arg( - short = 'e', - long = "extra", - help = "extra prompt. append to default prompt" - )] - extra: Option, - - #[arg(long = "config", help = "config file path")] - config_path: Option, - - #[arg(long = "oneline", help = "show only llm's return for cli pipes")] - oneline: bool, - - #[arg(long = "stdin", help = "use stdin as diff content")] - stdin: bool, -} - -pub trait DiffOption { - fn get_diff_options(&self) -> DiffOptions; - fn resolve_diff_commit(&self) -> (Option, Option) { - match self.get_diff_options().diff_commit { - Some(v) => { - let sp_v = v.split('/').collect::>(); - let ops_num = sp_v.len(); - if ops_num >= 2 { - (Some(sp_v[0].to_string()), Some(sp_v[1].to_string())) - } else if ops_num == 1 { - (Some(sp_v[0].to_string()), None) - } else { - (None, None) - } - } - None => (None, None), - } - } -} - -#[derive(Debug, clap::Args, Clone, Getters)] -pub struct DiffOptions { - #[arg(short = 'D', long = "diff", help = "diff points")] - diff_commit: Option, -} - -#[derive(Debug, clap::Subcommand, Clone)] -pub enum Commands { - #[command(name = "commit", about = "gen git commit msg")] - Commit(Commit), - - #[command(name = "readme", about = "gen README by codebase")] - Readme(Readme), - - #[command(name = "sumdiff", about = "summarize changes by git diff")] - SumDiff(SumDiff), - - #[command( - name = "which-sem", - about = "in Sem Ver, Output which field should be incremented." - )] - WhichSem(WhichSem), -} - -impl RootOption for Commands { - fn get_root_options(&self) -> RootOptions { - match self { - Commands::Commit(commit) => commit.get_root_options(), - Commands::Readme(readme) => readme.get_root_options(), - Commands::SumDiff(diff_sum) => diff_sum.get_root_options(), - Commands::WhichSem(which_sem) => which_sem.get_root_options(), - } - } -} - -#[derive(Debug, clap::Args, Clone, Getters)] -pub struct Commit { - #[command(flatten)] - root_options: RootOptions, - - #[command(flatten)] - diff_opts: DiffOptions, - - #[arg(long = "auto-commit", help = "allow auto git commit")] - auto_commit: bool, -} - -impl DiffOption for Commit { - fn get_diff_options(&self) -> DiffOptions { - self.diff_opts.clone() - } -} - -#[derive(Debug, clap::Args, Clone, Getters)] -pub struct Readme { - #[command(flatten)] - root_options: RootOptions, - - #[arg( - short = 's', - long = "sources", - help = "source files path list. e.g. `-s path1,path2,path3`" - )] - source_path: Option, - - #[arg(short = 'd', long = "directory", help = "source folder")] - source_dir: Option, - - #[arg(long = "merge-readme", help = "allow to merge to `./README.md`")] - allow_merge: bool, - // #[arg(long = "over-write", help = "allow to overwrite `./README.md`")] - // allow_over_write: bool, -} - -impl Readme { - pub fn export_path_list(&self) -> Result, Error> { - let mut list = Vec::new(); - if let Some(p) = &self.source_path { - let spd = p.split(',').collect::>(); - let res = spd.iter().map(PathBuf::from).collect::>(); - list.extend(res); - } - if let Some(l) = &self.source_dir { - let path = PathBuf::from(l); - let path_list = fs::read_dir(path)?; - for i in path_list { - let i = i?.path(); - list.push(i); - } - } - - if self.source_path.is_none() && self.source_dir.is_none() { - if yes_no("No source specified. Do you want to process the 'src/' directory? (y/n)") { - let src_path = { - let p = std::env::current_dir()?.join("src"); - if p.exists() { - p - } else { - return Err(Error::NotFoundSrc); - } - }; - let path_list = std::fs::read_dir(src_path)?; - let res = path_list - .filter_map(|f| f.ok()) - .map(|d| d.path()) - .collect::>(); - list.extend(res); - } else { - return Err(Error::DoesNotExistSource); - } - } - - Ok(list) - } -} - -#[derive(Debug, clap::Args, Clone, Getters)] -pub struct SumDiff { - #[command(flatten)] - root_options: RootOptions, - - #[command(flatten)] - diff_opts: DiffOptions, -} - -impl DiffOption for SumDiff { - fn get_diff_options(&self) -> DiffOptions { - self.diff_opts.clone() - } -} - -#[derive(Debug, clap::Args, Clone)] -struct Config { - #[command(flatten)] - root_options: RootOptions, - - #[arg(short = 'c', long = "check", help = "check config")] - check: bool, - - #[arg(short = 's', long = "show", help = "show current config")] - show: bool, -} - -#[derive(Debug, clap::Args, Clone)] -pub struct WhichSem { - #[command(flatten)] - root_options: RootOptions, - - #[command(flatten)] - diff_opts: DiffOptions, -} - -impl DiffOption for WhichSem { - fn get_diff_options(&self) -> DiffOptions { - self.diff_opts.clone() - } -} - -impl RootOption for Commit { - fn get_root_options(&self) -> RootOptions { - self.root_options.clone() - } -} - -impl RootOption for Readme { - fn get_root_options(&self) -> RootOptions { - self.root_options.clone() - } -} - -impl RootOption for SumDiff { - fn get_root_options(&self) -> RootOptions { - self.root_options.clone() - } -} - -impl RootOption for WhichSem { - fn get_root_options(&self) -> RootOptions { - self.root_options.clone() - } -} diff --git a/src/cli_helper.rs b/src/cli_helper.rs deleted file mode 100644 index e9e7f75..0000000 --- a/src/cli_helper.rs +++ /dev/null @@ -1,253 +0,0 @@ -use indicatif::{ProgressBar, ProgressStyle}; -use std::{fmt::Display, time::Duration}; -use unicode_width::UnicodeWidthChar; - -// pub enum Error { -// Io(std::io::Error), -// } -// -// impl Display for Error { -// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { -// match self { -// Error::Io(e) => write!(f, "io error: {}", e), -// } -// } -// } -// -// impl From for Error { -// fn from(value: std::io::Error) -> Self { -// Self::Io(value) -// } -// } - -pub struct Spinner { - pb: ProgressBar, -} - -impl Spinner { - pub fn new(message: &str) -> Self { - let pb = ProgressBar::new_spinner(); - pb.enable_steady_tick(Duration::from_millis(120)); - pb.set_style( - ProgressStyle::default_spinner() - .tick_strings(&["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]) - .template("{spinner:.blue} {msg}") - .unwrap(), - ); - pb.set_message(message.to_string()); - Self { pb } - } - - pub fn stop(&self, message: &str) { - self.pb.finish_with_message(message.to_string()); - } -} - -#[derive(Debug)] -pub struct Printer { - content: String, -} - -impl Printer { - pub fn new>(content: T) -> Self { - Self { - content: content.as_ref().to_string(), - } - } -} - -impl From for Printer { - fn from(value: String) -> Self { - Self::new(value) - } -} - -impl From<&String> for Printer { - fn from(value: &String) -> Self { - Self::new(value) - } -} - -impl From<&str> for Printer { - fn from(value: &str) -> Self { - Self::new(value) - } -} - -impl Display for Printer { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let max_chars = get_max_len(&self.content); - let start_l = format!("╭{}╮", mul_str(&"─", max_chars + 2)); - let end_l = format!("╰{}╯", mul_str(&"─", max_chars + 2)); - - let mut res = String::new(); - res.push_str(&start_l); - for l in self.content.lines() { - let rem = max_chars - get_str_len(l); - let fill_space = mul_str(&" ", rem); - res.push_str(format!("\n│ {l}{fill_space} │").as_str()); - } - res.push_str(format!("\n{}", end_l.as_str()).as_str()); - - write!(f, "{res}") - } -} - -fn get_str_len>(strg: T) -> u32 { - let mut len = 0; - for c in strg.as_ref().chars() { - len += c.width().unwrap_or(0); - } - len as u32 -} - -fn mul_str>(msg: &T, mul: u32) -> String { - let mut res = String::new(); - for _ in 0..mul { - res.push_str(msg.as_ref()); - } - res -} - -fn get_max_len>(strg: T) -> u32 { - let mut max = 0; - for l in strg.as_ref().lines() { - let len = get_str_len(l); - if max < len { - max = len; - } - } - max -} - -#[derive(Debug, PartialEq, Eq, Clone, Copy)] -pub enum SemVerPart { - Major, - Minor, - Patch, -} - -impl SemVerPart { - fn label(self) -> &'static str { - match self { - SemVerPart::Major => "MAJOR", - SemVerPart::Minor => "MINOR", - SemVerPart::Patch => "PATCH", - } - } -} - -impl std::str::FromStr for SemVerPart { - type Err = String; - - fn from_str(s: &str) -> Result { - match s.trim().to_lowercase().as_str() { - "major" => Ok(SemVerPart::Major), - "minor" => Ok(SemVerPart::Minor), - "patch" => Ok(SemVerPart::Patch), - other => Err(format!("unknown SemVer part: {other}")), - } - } -} - -pub struct SemVerSelector { - selected: SemVerPart, -} - -impl SemVerSelector { - pub fn new(selected: SemVerPart) -> Self { - Self { selected } - } -} - -impl Display for SemVerSelector { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let parts = [SemVerPart::Major, SemVerPart::Minor, SemVerPart::Patch]; - let mut top = String::new(); - let mut mid = String::new(); - let mut bot = String::new(); - - for (i, &part) in parts.iter().enumerate() { - let label = part.label(); - let w = get_str_len(label); - let is_sel = part == self.selected; - - // Add a column separator before this item (except for the first). - // Skip when one of the adjacent items is selected — the box wall serves as the separator. - if i > 0 && !(parts[i - 1] == self.selected) && !is_sel { - top.push(' '); - mid.push('│'); - bot.push(' '); - } - - if is_sel { - top.push_str(&format!("╭{}╮", mul_str(&"─", w + 2))); - mid.push_str(&format!("│ {label} │")); - bot.push_str(&format!("╰{}╯", mul_str(&"─", w + 2))); - } else { - top.push_str(&mul_str(&" ", w + 2)); - mid.push_str(&format!(" {label} ")); - bot.push_str(&mul_str(&" ", w + 2)); - } - } - - write!(f, "{top}\n{mid}\n{bot}") - } -} - -#[cfg(test)] -mod tests { - use crate::cli_helper::{Printer, SemVerPart, SemVerSelector, mul_str}; - - #[test] - fn str_mul_test() { - let c = "hi"; - let res = mul_str(&c, 10); - assert_eq!("hihihihihihihihihihi".to_string(), res); - } - - #[test] - fn print_test() { - let test_str = [ - ( - "line1\nline2line2line2\nline3line3", - "╭─────────────────╮\n│ line1 │\n│ line2line2line2 │\n│ line3line3 │\n╰─────────────────╯", - ), - ( - "line全角21\nli全角ne2line2line2\nline3line3", - "╭─────────────────────╮\n│ line全角21 │\n│ li全角ne2line2line2 │\n│ line3line3 │\n╰─────────────────────╯", - ), - ]; - - for r in test_str { - assert_eq!(format!("{}", Printer::new(r.0)), r.1.to_string()); - } - } - - #[test] - fn sem_ver_part_from_str_test() { - assert_eq!("major".parse::(), Ok(SemVerPart::Major)); - assert_eq!("Minor".parse::(), Ok(SemVerPart::Minor)); - assert_eq!("PATCH".parse::(), Ok(SemVerPart::Patch)); - assert!("unknown".parse::().is_err()); - } - - #[test] - fn sem_ver_selector_test() { - // MAJOR selected (first item) - assert_eq!( - format!("{}", SemVerSelector::new(SemVerPart::Major)), - "╭───────╮ \n│ MAJOR │ MINOR │ PATCH \n╰───────╯ " - ); - // MINOR selected (middle item) - assert_eq!( - format!("{}", SemVerSelector::new(SemVerPart::Minor)), - " ╭───────╮ \n MAJOR │ MINOR │ PATCH \n ╰───────╯ " - ); - // PATCH selected (last item) - assert_eq!( - format!("{}", SemVerSelector::new(SemVerPart::Patch)), - " ╭───────╮\n MAJOR │ MINOR │ PATCH │\n ╰───────╯" - ); - } -} diff --git a/src/commit_gen.rs b/src/commit_gen.rs deleted file mode 100644 index 2eb6c30..0000000 --- a/src/commit_gen.rs +++ /dev/null @@ -1,50 +0,0 @@ -// use std::fmt::Display; - -use crate::llm; - -// #[derive(Debug)] -// pub enum Error { -// Llm(llm::Error), -// } - -// impl Display for Error { -// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { -// match self { -// Error::Llm(e) => write!(f, "llm error: {}", e), -// } -// } -// } -// -// impl From for Error { -// fn from(value: llm::Error) -> Self { -// Self::Llm(value) -// } -// } - -const GEN_MSG_PMT: &str = "You are an assistant that writes Git commit messages.\ -When code changes include modifications to documentation files (e.g., README.md, docs/), ignore those changes and generate the commit message based solely on source code changes.\ -Given a description of code changes, output only a single-line commit message in Conventional Commits format (e.g., \"feat:\", \"fix:\", \"docs:\", etc.).\ -Do not include any extra text, code blocks, or formatting. Only output the commit message.\ -git status info and diff changes:"; - -pub async fn gen_commit_msg>( - diff: T, - status: T, - model: llm::LlmReqInfo, - lang: Option<&T>, - extra: Option<&T>, -) -> Result { - let diff = diff.as_ref(); - let st = status.as_ref(); - let lang = lang - .map(|f| f.as_ref().to_string()) - .unwrap_or("english".to_string()); - let extra = format!( - " # Additional Instructions: {}", - extra.map_or("".to_string(), |f| f.as_ref().to_string()) - ); - - let prompt = format!("Please in {lang}.\n{GEN_MSG_PMT}\nstauts: {st}\ndiff:{diff}.\n{extra}"); - - llm::call_llm(model, prompt).await -} diff --git a/src/config.rs b/src/config.rs deleted file mode 100644 index 2ea786f..0000000 --- a/src/config.rs +++ /dev/null @@ -1,177 +0,0 @@ -use std::fmt::Display; - -use derive_getters::Getters; -use serde::{Deserialize, Serialize}; -use std::collections::HashMap; -use url::Url; - -#[derive(Debug, PartialEq)] -pub enum Error { - Url(url::ParseError), - NotFoundPort, - NotFoundHost, -} - -impl Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Error::Url(parse_error) => write!(f, "failed parse url {parse_error}"), - Error::NotFoundPort => write!(f, "not found port in base_url"), - Error::NotFoundHost => write!(f, "not found host (exmaple.com)"), - } - } -} - -impl From for Error { - fn from(value: url::ParseError) -> Self { - Self::Url(value) - } -} - -#[derive(Debug, Getters, Serialize, Deserialize)] -pub struct Config { - llms: Option, -} - -impl easy_storage::Storeable for Config {} - -#[derive(Debug, Getters, Serialize, Deserialize, Clone)] -pub struct Llm { - default_model: Option, - models: Option>, - ollama: Option, -} - -impl Llm { - pub fn get_default(&self) -> Option { - self.default_model.clone() - } - - pub fn get_model>(&self, name: T) -> Option { - let res = match &self.models { - Some(v) => Some(v.get(&name.as_ref().to_string())), - None => None, - } - .flatten(); - res.cloned() - } -} - -#[derive(Debug, Getters, Serialize, Deserialize, Clone)] -pub struct Model { - provider: String, - model: String, - temperature: Option, - max_tokens: Option, - base_url: Option, -} - -impl Model { - pub fn new>( - provider: T, - model: T, - temperature: Option, - max_tokens: Option, - base_url: Option, - ) -> Self { - Self { - provider: provider.as_ref().to_string(), - model: model.as_ref().to_string(), - temperature, - max_tokens, - base_url, - } - } - - pub fn resolve_base_url(&self) -> Result, Error> { - // let url = match &self.base_url { - // Some(v) => v, - // None => return Ok(None), - // }; - // let parsed_url = Url::parse(url)?; - // let port = parsed_url.port().unwrap(); - // let sh = parsed_url.scheme(); - // let host = parsed_url.host_str().unwrap(); - // let url = format!("{sh}://{host}{}", parsed_url.path()); - // Ok(Some((url, port))) - self.base_url.as_ref().map(parse_port).transpose() - } -} - -fn parse_port>(url: T) -> Result<(String, u16), Error> { - let parsed_url = Url::parse(url.as_ref())?; - let port = parsed_url.port().ok_or(Error::NotFoundPort)?; - let sh = parsed_url.scheme(); - let host = parsed_url.host_str().ok_or(Error::NotFoundHost)?; - let url = format!("{sh}://{host}{}", parsed_url.path()); - Ok((url, port)) -} - -#[derive(Debug, Getters, Serialize, Deserialize, Clone)] -pub struct OllamaConfig { - base_url: Option, -} - -impl Default for OllamaConfig { - fn default() -> Self { - Self { - base_url: Some(String::from("http://localhost:11434")), - } - } -} - -#[cfg(test)] -mod tests { - use std::collections::HashMap; - - use easy_storage::Storeable; - - use crate::config::{self, Error, Model, parse_port}; - - #[test] - fn save_config() { - let def = Model::new("gemini", "gemini-2.0-flash", None, None, None); - let mut models = HashMap::new(); - models.insert( - "ge".to_string(), - Model::new("gemini", "gemini-2.5-flash", None, None, None), - ); - - let config = config::Config { - llms: Some(config::Llm { - default_model: Some(def), - models: Some(models), - ollama: None, - }), - }; - let c = std::env::current_dir() - .unwrap() - .join("config_template") - .with_extension("toml"); - config.save_by_extension(c, true).unwrap(); - } - - #[test] - fn parsed_url_test() { - let test_urls = [ - ( - "http://localhost:11434", - Ok(("http://localhost/".to_string(), 11434)), - ), - ( - "http://foo.com:11434/bar", - Ok(("http://foo.com/bar".to_string(), 11434)), - ), - ("foo.com:11434/bar", Err(Error::NotFoundPort)), - ( - "foo.com/bar", - Err(Error::Url(url::ParseError::RelativeUrlWithoutBase)), - ), - ]; - - for u in test_urls { - let parsed = parse_port(u.0); - assert_eq!(parsed, u.1); - } - } -} diff --git a/src/diff_sum_gen.rs b/src/diff_sum_gen.rs deleted file mode 100644 index 1cd6e0b..0000000 --- a/src/diff_sum_gen.rs +++ /dev/null @@ -1,22 +0,0 @@ -use crate::{helper, llm}; - -const DEFAULT_PROMPT: &str = "summarize the git diff changes. -List the key modifications, what was added, removed, or modified, and briefly explain their purpose or impact if possible. -about only changes. must not write about project. you don't readme writer, you summarize diff changes."; - -pub async fn sum_diff>( - diff: T, - status: T, - model: llm::LlmReqInfo, - lang: Option, - extra: Option, -) -> Result { - let lang = helper::init_lang(lang); - let st = status.as_ref(); - let extra = helper::init_extra(extra); - let diff = diff.as_ref(); - let prompt = - format!("Please in {lang}.\n{DEFAULT_PROMPT}\nstatus: {st}\ndiff: {diff}.\n{extra}"); - - llm::call_llm(model, prompt).await -} diff --git a/src/get_input.rs b/src/get_input.rs deleted file mode 100644 index 3f0d635..0000000 --- a/src/get_input.rs +++ /dev/null @@ -1,35 +0,0 @@ -use std::io::{self, Write, stdout}; - -/// get user's input. return String. -/// -/// ## how to get input without message. -/// ``` -/// let input = get_input(""); -/// ``` -/// -/// ## how to get input with message. -/// ``` -/// let input = get_input("please title>"); -/// ``` -/// -/// ```bash -/// // 👇console -/// please title>foo 👈foo is user's input. -/// // input == "foo" -/// ``` -pub fn get_input>(message: S) -> Result { - print!("{}", message.as_ref()); - stdout().flush()?; - let mut word = String::new(); - std::io::stdin().read_line(&mut word)?; - Ok(word.trim().to_string()) -} - -/// if user's input is "y" or "yes", return true. -pub fn yes_no>(message: S) -> bool { - let input = match get_input(message.as_ref()) { - Ok(v) => v, - Err(_) => return false, - }; - input.is_empty() || matches!(input.as_ref(), "y" | "yes") -} diff --git a/src/git.rs b/src/git.rs deleted file mode 100644 index 436dfd9..0000000 --- a/src/git.rs +++ /dev/null @@ -1,133 +0,0 @@ -use std::path::Path; - -use git2::{DiffOptions, IndexAddOption, Repository, Signature}; - -// #[derive(Debug)] -// pub enum Error { -// Git(git2::Error), -// } -// -// impl Display for Error { -// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { -// match self { -// Error::Git(e) => write!(f, "git error: {}", e), -// } -// } -// } -// -// impl From for Error { -// fn from(value: git2::Error) -> Self { -// Self::Git(value) -// } -// } - -pub fn get_diff, P: AsRef>( - points: (Option, Option), - path: P, -) -> Result { - let repo = Repository::open(path)?; - - let points = ( - points.0.map(|f| f.as_ref().to_string()), - points.1.map(|f| f.as_ref().to_string()), - ); - - let diff = match points { - (None, None) => repo.diff_index_to_workdir(None, Some(&mut DiffOptions::new())), - (None, Some(c2)) => { - let com1 = repo.find_commit(repo.revparse_single(c2.as_str())?.id())?; - let tree = com1.tree()?; - repo.diff_tree_to_workdir(Some(&tree), Some(&mut DiffOptions::new())) - } - (Some(c1), None) => { - let com1 = repo.find_commit(repo.revparse_single(c1.as_str())?.id())?; - let tree = com1.tree()?; - repo.diff_tree_to_workdir(Some(&tree), Some(&mut DiffOptions::new())) - } - (Some(c1), Some(c2)) => { - let com1 = repo.find_commit(repo.revparse_single(c1.as_str())?.id())?; - let com2 = repo.find_commit(repo.revparse_single(c2.as_str())?.id())?; - - let tree1 = com1.tree()?; - let tree2 = com2.tree()?; - repo.diff_tree_to_tree(Some(&tree1), Some(&tree2), Some(&mut DiffOptions::new())) - } - }?; - - let mut pa = String::new(); - diff.print(git2::DiffFormat::Patch, |_, _, line| { - if let Ok(t) = std::str::from_utf8(line.content()) { - pa.push_str(t); - } - true - })?; - Ok(pa) -} - -pub fn git_commit, M: AsRef, T: AsRef>( - path: P, - msg: &M, - name: T, - email: T, -) -> Result<(), git2::Error> { - let repo = Repository::open(path)?; - let mut index = repo.index()?; - index.add_all(["*"].iter(), IndexAddOption::CHECK_PATHSPEC, None)?; - index.write()?; - - let tree_id = index.write_tree()?; - let tree = repo.find_tree(tree_id)?; - - let parent_commit = repo - .head() - .ok() - .and_then(|h| h.resolve().ok()) - .and_then(|r| r.peel_to_commit().ok()); - - let sig = Signature::now(name.as_ref(), email.as_ref())?; - - let _commit_id = if let Some(pa) = parent_commit { - repo.commit(Some("HEAD"), &sig, &sig, msg.as_ref(), &tree, &[&pa])? - } else { - // first commit - repo.commit(Some("HEAD"), &sig, &sig, msg.as_ref(), &tree, &[])? - }; - - Ok(()) -} - -pub fn get_user_email() -> Result<(String, String), git2::Error> { - let config = git2::Config::open_default()?; - - Ok(( - config.get_string("user.name")?, - config.get_string("user.email")?, - )) -} - -pub fn get_git_status>(path: T) -> Result { - let repo = Repository::open(path)?; - - let st = repo.statuses(Some(&mut git2::StatusOptions::default()))?; - - Ok(st - .into_iter() - .map(|f| { - let s = f.status(); - let p = f.path().unwrap_or("???").to_string(); - format!("{s:?}: {p}\n") - }) - .collect::()) -} - -#[cfg(test)] -mod tests { - use crate::git::get_git_status; - - #[test] - fn sts_test() { - let c = std::env::current_dir().unwrap(); - let res = get_git_status(c).unwrap(); - println!("{res}"); - } -} diff --git a/src/helper.rs b/src/helper.rs deleted file mode 100644 index c46ec40..0000000 --- a/src/helper.rs +++ /dev/null @@ -1,69 +0,0 @@ -use std::{ - fs, io, - path::{Path, PathBuf}, -}; - -// #[derive(Debug)] -// pub enum Error { -// Io(std::io::Error), -// } -// -// impl Display for Error { -// fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { -// match self { -// Error::Io(e) => write!(f, "io error: {}", e), -// } -// } -// } -// -// impl From for Error { -// fn from(value: std::io::Error) -> Self { -// Self::Io(value) -// } -// } - -pub fn init_lang>(lang: Option) -> String { - lang.map(|f| f.as_ref().to_string()) - .unwrap_or("english".to_string()) -} - -pub fn init_extra>(extra: Option) -> String { - format!( - " # Additional Instructions: {}", - extra - .map(|f| f.as_ref().to_string()) - .unwrap_or("".to_string()) - ) -} - -pub fn load_codebase>(path_list: &Vec

) -> Result { - let mut file_contes = Vec::new(); - - for f in path_list { - let p = f.as_ref(); - if p.exists() - && let Ok(s) = fs::read_to_string(p) - { - file_contes.push(format!("path: {}\n\n{s}", f.as_ref().to_string_lossy())); - } - } - - Ok(file_contes.into_iter().collect::()) -} - -pub fn find_readme>(work_path: T) -> Option { - fs::read_dir(work_path) - .ok()? - .filter_map(|et| et.ok()) - .find_map(|et| { - et.path() - .file_name() - .and_then(|n| n.to_str()) - .filter(|s| s.eq_ignore_ascii_case("readme.md")) - .map(|_| et.path()) - }) -} - -pub fn get_now() -> String { - chrono::Local::now().format("%b-%d-%H-%M").to_string() -} diff --git a/src/llm.rs b/src/llm.rs deleted file mode 100644 index 9f432f2..0000000 --- a/src/llm.rs +++ /dev/null @@ -1,293 +0,0 @@ -use crate::cli_helper::Spinner; -use crate::config; -use derive_getters::Getters; -use llm_api_rs::{ - LlmProvider, - core::{ChatCompletionRequest, ChatMessage}, - providers::{Anthropic, DeepSeek, OpenAI}, -}; -use ollama_rs::{Ollama, generation::completion::request::GenerationRequest}; -use reqwest::header::CONTENT_TYPE; -use serde_json::json; -use std::fmt::Display; - -#[derive(Debug)] -pub enum Error { - NotSuppoeredProvider, - FailedGetAPIKey, - FailedGetBaseURL, - ChatCompletion(String), - // CliHelper(String), - OllamaE(ollama_rs::error::OllamaError), - Conf(config::Error), - InvalidResponse, - ApiErr(reqwest::Error), -} - -impl Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Error::NotSuppoeredProvider => write!(f, "not supported provider"), - Error::FailedGetAPIKey => write!(f, "failed to get api key"), - Error::FailedGetBaseURL => write!(f, "failed to get base url"), - Error::ChatCompletion(e) => write!(f, "chat completion error: {}", e), - Error::OllamaE(e) => write!(f, "ollama error: {}", e), - Error::Conf(e) => write!(f, "config error {e}"), - Error::InvalidResponse => write!(f, "invalid response"), - Error::ApiErr(e) => write!(f, "api error: {e}"), - } - } -} - -impl From for Error { - fn from(value: ollama_rs::error::OllamaError) -> Self { - Self::OllamaE(value) - } -} - -impl From for Error { - fn from(value: config::Error) -> Self { - Self::Conf(value) - } -} - -#[derive(Debug, PartialEq, PartialOrd, Clone)] -pub enum Provider { - Ollama, - OpenAI, - Gemini, - Anthropic, - DeepSeek, -} - -impl TryFrom<&str> for Provider { - type Error = Error; - - fn try_from(value: &str) -> Result { - match value.to_lowercase().as_str() { - "ollama" => Ok(Self::Ollama), - "openai" => Ok(Self::OpenAI), - "gemini" => Ok(Self::Gemini), - "anthropic" => Ok(Self::Anthropic), - "deepseek" => Ok(Self::DeepSeek), - _ => Err(Error::NotSuppoeredProvider), - } - } -} - -impl Provider { - fn is>(&self, prov: T) -> Result { - let p = Provider::try_from(prov.as_ref())?; - Ok(self == &p) - } -} - -#[derive(Debug, Getters, Clone)] -pub struct LlmReqInfo { - provider: Provider, - model: String, - api_key: Option, - temp: Option, - max_tokens: Option, - base_url: Option<(String, u16)>, -} - -impl LlmReqInfo { - pub fn resolve_api_key(&self) -> Result { - Ok(match self.api_key.clone() { - Some(key) => key, - None => { - if self.provider().is("ollama")? { - return Err(Error::FailedGetAPIKey); - } else { - String::new() - } - } - }) - } - - pub fn new( - provider: Provider, - model: String, - api_key: Option, - temp: Option, - max_tokens: Option, - base_url: Option<(String, u16)>, - ) -> Self { - Self { - provider, - model, - api_key, - temp, - max_tokens, - base_url, - } - } - - pub fn new_with_api(model: config::Model, api_key: Option) -> Result { - let prov = Provider::try_from(model.provider().as_str())?; - let base = model.resolve_base_url()?; - Ok(Self::new( - prov, - model.model().clone(), - api_key, - *model.temperature(), - *model.max_tokens(), - base, - )) - } -} - -fn make_gemini_body(model: String, prompt: String) -> serde_json::Value { - json!({ - "model": model, - "contents": [{ - "parts": [ - { - "text": prompt - } - ] - }] - }) -} - -// { -// "candidates": [ -// { -// "content": { -// "parts": [ -// { -// "text": "text", -// "thoughtSignature": "" -// } -// ], -// "role": "model" -// }, -// "finishReason": "STOP", -// "index": 0 -// } -// ], -// "usageMetadata": { -// "promptTokenCount": 11853, -// "candidatesTokenCount": 415, -// "totalTokenCount": 12986, -// "promptTokensDetails": [ -// { -// "modality": "TEXT", -// "tokenCount": 11853 -// } -// ], -// "thoughtsTokenCount": 718 -// }, -// "modelVersion": "gemini-3-flash-preview", -// "responseId": "96TLaaPKOKnY2roPx9DxCQ" -// } - -use serde::{Deserialize, Serialize}; - -// Discard any content other than text. -#[derive(Debug, Serialize, Deserialize)] -pub struct GeminiResp { - pub candidates: Vec, -} - -impl GeminiResp { - fn get_resp_text(&self) -> Option { - self.candidates - .first() - .and_then(|f| f.content.parts.first().map(|f| f.text.to_string())) - } -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Candidate { - pub content: Content, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Content { - pub parts: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Part { - pub text: String, -} - -pub async fn call_llm>(llm_info: LlmReqInfo, prompt: T) -> Result { - let spinner = Spinner::new("Calling LLM..."); - let api = llm_info.resolve_api_key()?; - let res = match llm_info.provider { - Provider::Ollama => { - let base_url = llm_info.clone().base_url.ok_or(Error::FailedGetBaseURL)?; - let o_res = Ollama::new(base_url.0, base_url.1); - let res = o_res - .generate(GenerationRequest::new( - llm_info.clone().model, - prompt.as_ref(), - )) - .await; - match res { - Ok(v) => Ok(v.response.to_string()), - Err(e) => Err(Error::OllamaE(e)), - } - } - Provider::Gemini => { - let client = reqwest::Client::new(); - - // let url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent".to_string(); - let url = format!( - "https://generativelanguage.googleapis.com/v1beta/models/{}:generateContent", - llm_info.model - ); - let body = make_gemini_body(llm_info.model, prompt.as_ref().to_string()); - - let resp = client - .post(url) - .header("x-goog-api-key", api) - .header(CONTENT_TYPE, "application/json") - .json(&body) - .send() - .await - .map_err(Error::ApiErr)? - // .unwrap() - .json::() - .await - .map_err(Error::ApiErr)?; - - resp.get_resp_text().ok_or(Error::InvalidResponse) - } - _ => { - let client: Box = match llm_info.provider { - Provider::OpenAI => Box::new(OpenAI::new(api)), - Provider::Anthropic => Box::new(Anthropic::new(api)), - Provider::DeepSeek => Box::new(DeepSeek::new(api)), - _ => return Err(Error::NotSuppoeredProvider), - }; - - let request = ChatCompletionRequest { - model: llm_info.model().clone(), - messages: vec![ChatMessage { - role: "user".to_string(), - content: prompt.as_ref().to_string(), - }], - temperature: *llm_info.temp(), - max_tokens: *llm_info.max_tokens(), - }; - - match client.chat_completion(request).await { - Ok(response) => { - if let Some(choice) = response.choices.first() { - Ok(choice.message.content.clone()) - } else { - Ok(String::new()) - } - } - Err(e) => Err(Error::ChatCompletion(e.to_string())), - } - } - }; - let result = async { res }.await; - spinner.stop("LLM call finished."); - result -} diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index ed1a58a..0000000 --- a/src/main.rs +++ /dev/null @@ -1,436 +0,0 @@ -mod cli; -mod cli_helper; -mod commit_gen; -mod config; -mod diff_sum_gen; -mod get_input; -mod git; -mod helper; -mod llm; -mod readme_gen; -mod which_sem; - -use crate::{ - cli::{DiffOption, RootOption}, - config::Config, - get_input::yes_no, - git::get_git_status, - helper::{find_readme, get_now}, -}; -use clap::Parser; -use easy_storage::Storeable; -use std::{ - env, - fmt::Display, - fs::{File, OpenOptions}, - io::{BufRead, BufReader, Read, Write, stdout}, - path::{Path, PathBuf}, -}; - -const ANTHROPIC_API: &str = "GGW_ANTHROPIC_API"; -const GEMINI_API: &str = "GGW_GEMINI_API"; -const GEMINI_API_FALL: &str = "GEMINI_API_KEY"; -const OPENAI_API: &str = "GGW_OPENAI_API"; -const DEEPSEEK: &str = "GGW_DEEPSEEK_API"; - -#[derive(Debug)] -enum Error { - Io(std::io::Error), - Store(easy_storage::Error), - Llm(llm::Error), - Config(config::Error), - Cli(cli::Error), - Git(git2::Error), - // Cmt(commit_gen::Error), - Rdm(readme_gen::Error), - EnvVar, - NotFoundHome, - NotFoundConfig(String), - NotFoundLlmField, - NotFoundSelectedModel, - NotFoundDefaultModel, - NotFoundWorkFolder, - Cancel, - InvalidSemVer(String), -} - -impl From for Error { - fn from(value: std::io::Error) -> Self { - Self::Io(value) - } -} - -impl From for Error { - fn from(value: easy_storage::Error) -> Self { - Self::Store(value) - } -} - -impl From for Error { - fn from(value: config::Error) -> Self { - Self::Config(value) - } -} - -impl From for Error { - fn from(value: cli::Error) -> Self { - Self::Cli(value) - } -} - -impl From for Error { - fn from(value: git2::Error) -> Self { - Self::Git(value) - } -} - -// impl From for Error { -// fn from(value: commit_gen::Error) -> Self { -// Self::Cmt(value) -// } -// } - -impl From for Error { - fn from(value: readme_gen::Error) -> Self { - Self::Rdm(value) - } -} - -impl From for Error { - fn from(value: llm::Error) -> Self { - Self::Llm(value) - } -} - -impl From for Error { - fn from(_value: env::VarError) -> Self { - Self::EnvVar - } -} - -impl Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Error::Io(error) => write!(f, "io error: {error}"), - Error::Store(error) => write!(f, "save error: {error}"), - Error::Llm(error) => write!(f, "llm error: {error}"), - Error::Config(error) => write!(f, "config error: {error}"), - Error::Cli(error) => write!(f, "cli error: {error}"), - Error::Git(error) => write!(f, "git error: {error}"), - // Error::Cmt(error) => write!(f, "commit gen error: {error}"), - Error::Rdm(error) => write!(f, "readme gen error: {error}"), - Error::NotFoundHome => write!( - f, - "not found home directory. Please ensure the HOME environment variable is set." - ), - Error::NotFoundConfig(ctx) => write!(f, "not found config file. {ctx}"), - Error::NotFoundWorkFolder => write!( - f, - "not found work folder. Please verify the path passed with --path exists." - ), - Error::Cancel => write!(f, "commit canceled"), - Error::EnvVar => write!( - f, - "failed to get API key from environment variable. Please set the appropriate variable (e.g. GGW_GEMINI_API, GGW_OPENAI_API, GGW_ANTHROPIC_API, or GGW_DEEPSEEK_API)." - ), - Error::NotFoundLlmField => write!( - f, - "not found 'llms' field in config file. Please add an [llms] section to your config. See the config template for reference." - ), - Error::NotFoundSelectedModel => write!( - f, - "not found selected model alias in config. Please verify the alias exists under [llms.models] in your config file." - ), - Error::NotFoundDefaultModel => write!( - f, - "not found default model in config. Please set 'default_model' under the [llms] section of your config file." - ), - Error::InvalidSemVer(s) => write!(f, "invalid SemVer part from LLM response: {s}"), - } - } -} - -/// Resolves the configuration file path. -/// -/// If a path is provided, returns it. Otherwise, searches for config files in standard locations: -/// 1. `~/.config/ggw/config.toml` -/// 2. `~/.ggw.toml` -/// -/// # Arguments -/// * `path` - Optional config file path -/// -/// # Errors -/// Returns `Error::NotFoundHome` if home directory cannot be determined. -/// Returns `Error::NotFoundConfig` if no config file is found in standard locations. -fn resolve_config_path>(path: &Option) -> Result { - let home_path = home::home_dir().ok_or(Error::NotFoundHome)?; - - if let Some(p) = path { - return Ok(p.as_ref().to_path_buf()); - } - - let primary = home_path - .join(".config") - .join("ggw") - .join("config") - .with_extension("toml"); - let secondary = home_path.join(".ggw").with_extension("toml"); - - if primary.exists() { - Ok(primary) - } else if secondary.exists() { - Ok(secondary) - } else { - Err(Error::NotFoundConfig(format!( - "Searched at '{}' and '{}'. \ - Please create a config file at one of those locations. \ - You can use the bundled config_template.toml as a starting point.", - primary.display(), - secondary.display() - ))) - } -} - -fn resolve_work_path(opt: &T) -> Result { - let p = match opt.get_root_options().path() { - Some(p) => PathBuf::from(p), - None => env::current_dir()?, - }; - - if !p.exists() { - Err(Error::NotFoundWorkFolder) - } else { - Ok(p) - } -} - -/// * `gemini/gemini-2.0-flash` -> (gemini, gemini-2.0-flash) -/// * `g2f` -> `(gemini, gemini-2.0-flash)` (if an alias is registered) -/// * `` -> default in config -fn resolve_model( - config: &Option, - root_opts: &cli::RootOptions, -) -> Result { - match root_opts.model() { - Some(v) => match v.split_once('/') { - // `-m gemini/gemini-2.0-flash` - Some(vv) => Ok(config::Model::new( - vv.0, - vv.1, - *root_opts.temperature(), - *root_opts.max_tokens(), - root_opts.base_url().clone(), - )), - // `-m gem2` - None => match config { - Some(loaded_config) => loaded_config.llms().clone().ok_or(Error::NotFoundLlmField), - None => Err(Error::NotFoundConfig( - "A config file is required to resolve model aliases. \ - Please create ~/.config/ggw/config.toml, or pass the model as \ - 'provider/model' (e.g. `-m gemini/gemini-2.0-flash`)." - .to_string(), - )), - }? - .get_model(v) - .ok_or(Error::NotFoundSelectedModel), - }, - // without mode arg - None => match config { - Some(v) => v.llms().clone().ok_or(Error::NotFoundLlmField), - None => Err(Error::NotFoundConfig( - "No config file found and no model specified. \ - Please create ~/.config/ggw/config.toml with a default_model, \ - or specify a model with `-m provider/model` (e.g. `-m gemini/gemini-2.0-flash`)." - .to_string(), - )), - }? - .get_default() - .ok_or(Error::NotFoundDefaultModel), - } -} - -fn resolve_api_key(model: &config::Model) -> Result, Error> { - let prov = llm::Provider::try_from(model.provider().as_str())?; - Ok(match prov { - llm::Provider::Ollama => None, - llm::Provider::OpenAI => Some(env::var(OPENAI_API)), - llm::Provider::Gemini => Some(match env::var(GEMINI_API) { - Ok(v) => Ok(v), - Err(_) => match env::var(GEMINI_API_FALL) { - Ok(vv) => Ok(vv), - Err(e) => Err(e), - }, - }), - llm::Provider::Anthropic => Some(env::var(ANTHROPIC_API)), - llm::Provider::DeepSeek => Some(env::var(DEEPSEEK)), - } - .transpose()?) -} - -#[tokio::main] -async fn main() -> Result<(), Error> { - let cli = cli::Cli::parse(); - - let config_path = resolve_config_path(cli.get_root_options().config_path()).ok(); - let loaded_config = config_path - .map(config::Config::load_by_extension) - .transpose() - .ok() - .flatten(); - - let work_path = resolve_work_path(&cli)?; - - let model = resolve_model(&loaded_config, &cli.get_root_options())?; - let api_key = resolve_api_key(&model)?; - - let model_info = llm::LlmReqInfo::new_with_api(model, api_key)?; - - //let diff = git::get_diff((None, None), &work_path)?; - - let git_user = git::get_user_email()?; - - let root_options = cli.get_root_options(); - let lang = root_options.lang().as_ref(); - let extra = root_options.extra().as_ref(); - - let git_status = get_git_status(&work_path)?; - // - // let diff = if root_options.stdin() { - // todo!() - // } else { - // } - - match &cli.subcommand { - cli::Commands::Commit(commit) => { - // 👇 is from pipe. - let diff = if !atty::is(atty::Stream::Stdin) && *root_options.stdin() { - let mut input = String::new(); - std::io::stdin().lock().read_to_string(&mut input)?; - stdout().flush()?; - input - } else { - let diff_opt = commit.resolve_diff_commit(); - git::get_diff(diff_opt, &work_path)? - }; - - let msg = commit_gen::gen_commit_msg(diff, git_status, model_info, lang, extra).await?; - let conti = || { - let mut tty = BufReader::new(File::open("/dev/tty").unwrap()); - stdout().flush().unwrap(); - // let mut ans = String::new(); - // tty.read_line(&mut ans).unwrap(); - print!("continue?(y/n)> "); - std::io::stdout().flush().unwrap(); - let mut ans = String::new(); - tty.read_line(&mut ans).unwrap(); - - matches!(ans.trim(), "y" | "Y" | "Yes" | "yes") - }; - if *commit.get_root_options().oneline() { - println!("{msg}"); - Ok(()) - } else { - let fd_msg = cli_helper::Printer::from(&msg); - println!("Generated msg:\n{fd_msg}"); - - if *commit.auto_commit() || - //yes_no("commit?(y/n)") - conti() - { - git::git_commit(&work_path, &msg, git_user.0, git_user.1)?; - Ok(()) - } else { - Err(Error::Cancel) - } - } - } - cli::Commands::Readme(readme) => { - let path_list = readme.export_path_list()?; - let readme_content = - readme_gen::gen_readme(&path_list, model_info, lang, extra).await?; - if *readme.get_root_options().oneline() { - println!("{readme_content}"); - Ok(()) - } else { - println!("Generated README:\n{readme_content}\n\n"); - let readme_file = find_readme(&work_path); - let mut f = if let Some(v) = readme_file { - if *readme.allow_merge() || yes_no("merge to README.md? (y/n)") { - OpenOptions::new().append(true).open(v)? - } else { - let now = get_now(); - let path = work_path.join(format!("{}.md", now)); - if yes_no("save to {now}.md?(y/n)") { - OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(path)? - } else { - return Err(Error::Cancel); - } - } - } else { - let path = work_path.join(format!("{}.md", get_now())); - OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(path)? - }; - Ok(f.write_all(readme_content.as_bytes())?) - } - } - cli::Commands::SumDiff(diff_sum) => { - let diff = if *root_options.stdin() { - let mut input = String::new(); - std::io::stdin().read_to_string(&mut input)?; - input - } else { - let diff_s = diff_sum.resolve_diff_commit(); - git::get_diff(diff_s, &work_path)? - }; - - let res = - diff_sum_gen::sum_diff(diff, git_status, model_info, lang.cloned(), extra.cloned()) - .await?; - if *diff_sum.get_root_options().oneline() { - println!("{res}"); - Ok(()) - } else { - println!("diff summarize:\n{res}"); - Ok(()) - } - } - cli::Commands::WhichSem(which) => { - let diff = if *root_options.stdin() { - let mut input = String::new(); - std::io::stdin().read_to_string(&mut input)?; - input - } else { - let diff_s = which.resolve_diff_commit(); - git::get_diff(diff_s, &work_path)? - }; - let res = - which_sem::whichi_sem(diff, git_status, model_info, lang.cloned(), extra.cloned()) - .await?; - - if *which.get_root_options().oneline() { - println!("{}", res.0); - Ok(()) - } else { - let part = res - .0 - .trim() - .parse::() - .map_err(Error::InvalidSemVer)?; - let s = cli_helper::SemVerSelector::new(part); - println!( - "should increase at\n{s}\nreasons:\n{}", - res.1.unwrap_or(String::new()).trim() - ); - Ok(()) - } - } - } -} diff --git a/src/readme_gen.rs b/src/readme_gen.rs deleted file mode 100644 index e89e3d0..0000000 --- a/src/readme_gen.rs +++ /dev/null @@ -1,60 +0,0 @@ -use std::{fmt::Display, io, path::Path}; - -use crate::{helper, llm}; - -const DEFAULT_PROMT: &str = - "You are a helpful assistant that generates professional README.md files. -Please read the following codebase and generate a README.md that includes: -- Project name and brief description -- Key features -- Technologies used -- Installation instructions -- How to run the project -- Example usage (if applicable) -- License section (if available in the code) -- Any relevant badges or links (GitHub repo, docs, etc.) - -Here is the project code or file list:"; - -#[derive(Debug)] -pub enum Error { - Io(std::io::Error), - Llm(llm::Error), -} - -impl Display for Error { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - //Error::Io(e) => write!(f, "io error: {}", e), - Error::Io(e) => write!(f, "helper error: {}", e), - Error::Llm(e) => write!(f, "llm error: {}", e), - } - } -} - -impl From for Error { - fn from(value: io::Error) -> Self { - Self::Io(value) - } -} - -impl From for Error { - fn from(value: llm::Error) -> Self { - Self::Llm(value) - } -} - -pub async fn gen_readme, P: AsRef>( - path_list: &Vec

, - model: llm::LlmReqInfo, - lang: Option, - extra: Option, -) -> Result { - let lang = helper::init_lang(lang); - let code_base = helper::load_codebase(path_list)?; - let extra = helper::init_extra(extra); - - let prompt = format!("Please in {lang}.\n{DEFAULT_PROMT} {code_base}.\n{extra}"); - - Ok(llm::call_llm(model, prompt).await?) -} diff --git a/src/which_sem.rs b/src/which_sem.rs deleted file mode 100644 index 5a52047..0000000 --- a/src/which_sem.rs +++ /dev/null @@ -1,29 +0,0 @@ -use crate::{helper, llm}; - -const DEFAULT_PROMT: &str = "**Output 'SemVer filed name' and 'the reason' separated by ‘|’.about version filed name, Only contain semver name(Major or Minor or Patch)** must strictly adhere to this format: 'Minor | Reasons'. in Semantic Versioning, which field version should be incremented? think to reference git diff data:"; - -pub async fn whichi_sem>( - diff: T, - status: T, - model: llm::LlmReqInfo, - lang: Option, - extra: Option, -) -> Result<(String, Option), llm::Error> { - let diff = diff.as_ref(); - let st = status.as_ref(); - let extra = helper::init_extra(extra); - let lang = helper::init_lang(lang); - - let promt = - format!("Please in {lang}.\n{DEFAULT_PROMT}\ngit status: {st}\ndiff: {diff}\n{extra}"); - - let res = llm::call_llm(model, promt).await?; - - let res = res.split('|').collect::>(); - let ress = if res.len() < 3 { - (res[0].to_string(), Some(res[1].to_string())) - } else { - (res[0].to_string(), None) - }; - Ok(ress) -} diff --git a/tools/api_test/test.sh b/tools/api_test/test.sh deleted file mode 100755 index 19786ae..0000000 --- a/tools/api_test/test.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -call() { - model_name="$1" - url="https://generativelanguage.googleapis.com/v1beta/models/${model_name}:generateContent" - echo "$url" - - curl "${url}" \ - -H "x-goog-api-key: $GEMINI_API_KEY" \ - -H 'Content-Type: application/json' \ - -X POST \ - -d '{ - "contents": [ - { - "parts": [ - { - "text": "Explain how AI works in a few words" - } - ] - } - ] - }' -} - -# call "gemini-3-flash-preview" -call "gemini-2.5-flash" diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..a60d926 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "Bundler", + "strict": true, + + "baseUrl": ".", + "paths": { + "@ggw/core": ["packages/core/src"] + } + }, + "include": [ + "apps/**/*.ts", + "packages/**/*.ts" + ] +}