Compare commits

..

1 Commits

Author SHA1 Message Date
release-plz-for-ac-qu-ai-nt[bot]
bae29d7f20 chore: release 2024-10-11 17:38:44 +00:00
20 changed files with 91 additions and 1723 deletions

View File

@@ -18,35 +18,23 @@ env:
CARGO_TERM_COLOR: always
jobs:
audit-and-deny-and-clippy-and-formatting:
name: Check cargo-audit, cargo-deny, clippy, and formatting
formatting-and-deny:
name: Check formatting and cargo-deny
runs-on: ubuntu-latest
timeout-minutes: 4
timeout-minutes: 2
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
uses: taiki-e/install-action@cargo-audit
- uses: Swatinem/rust-cache@v2
- name: cargo-audit
run: cargo-audit audit --deny warnings
- name: cargo-deny
uses: EmbarkStudios/cargo-deny-action@v2
- name: Clippy
run: cargo clippy
env:
RUSTFLAGS: "--deny warnings"
- name: Formatting
run: cargo fmt --check --verbose
- name: cargo-deny
uses: EmbarkStudios/cargo-deny-action@v2
check-and-build:
strategy:
matrix:
@@ -100,7 +88,7 @@ jobs:
target: x86_64-pc-windows-msvc
name: Check and build ${{ matrix.supporteds.target }} (on ${{ matrix.supporteds.runner }}) ${{ matrix.minimal_or_latest.job_name_suffix }}
runs-on: ${{ matrix.supporteds.runner }}
timeout-minutes: 8
timeout-minutes: 5
env:
# https://github.com/rust-lang/stacker/issues/80#issuecomment-1547991131
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
@@ -177,7 +165,7 @@ jobs:
target: x86_64-pc-windows-msvc
name: Test ${{ matrix.supporteds.target }} (on ${{ matrix.supporteds.runner }})
runs-on: ${{ matrix.supporteds.runner }}
timeout-minutes: 8
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -199,34 +187,32 @@ jobs:
shared-key: ${{ matrix.supporteds.target }}-latest
cache-on-failure: "true"
- name: Build tests
run: cargo build --tests --target ${{ matrix.supporteds.target }}
- name: Test
run: cargo nextest run --target ${{ matrix.supporteds.target }}
msrv:
strategy:
matrix:
crate_directory:
- ./core
- ./cli-clap
- ./gui-eframe
- ./tui-ratatui
- ./multibinary
supporteds:
- runner: macos-latest
target: aarch64-apple-darwin
- runner: macos-latest
target: x86_64-apple-darwin
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools && sudo ln -s /bin/g++ /bin/musl-g++
runner: ubuntu-latest
target: x86_64-unknown-linux-musl
- prerequisite_step: rm ~/.cargo/bin/cargo.exe; rm ~/.cargo/bin/rust-analyzer.exe; rm ~/.cargo/bin/rustfmt.exe; rustup update
runner: windows-latest
target: x86_64-pc-windows-msvc
name: Verify MSRV for ${{ matrix.supporteds.target }} (on ${{ matrix.supporteds.runner }})
name: Verify MSRV of ${{ matrix.crate_directory }} for ${{ matrix.supporteds.target }} (on ${{ matrix.supporteds.runner }})
runs-on: ${{ matrix.supporteds.runner }}
timeout-minutes: 8
timeout-minutes: 4
steps:
- name: Checkout repository
uses: actions/checkout@v4
@@ -245,18 +231,6 @@ jobs:
with:
tool: cargo-msrv
- name: Verify core's declared MSRV (minimum supported Rust version)
- name: Verify declared MSRV (minimum supported Rust version)
run: cargo-msrv verify --output-format json
working-directory: ./core
- name: Verify cli-clap's declared MSRV (minimum supported Rust version)
run: cargo-msrv verify --output-format json
working-directory: ./cli-clap
- name: Verify gui-eframe's declared MSRV (minimum supported Rust version)
run: cargo-msrv verify --output-format json
working-directory: ./gui-eframe
- name: Verify tui-ratatui's declared MSRV (minimum supported Rust version)
run: cargo-msrv verify --output-format json
working-directory: ./tui-ratatui
- name: Verify multibinary's declared MSRV (minimum supported Rust version)
run: cargo-msrv verify --output-format json
working-directory: ./multibinary
working-directory: ${{ matrix.crate_directory }}

View File

@@ -65,8 +65,6 @@ jobs:
- name: Install stable Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.supporteds.target }}
- uses: Swatinem/rust-cache@v2
with:
@@ -74,7 +72,7 @@ jobs:
cache-on-failure: "true"
- name: Build for release
run: cargo build --release --verbose --target ${{ matrix.supporteds.target }}
run: cargo build --release --verbose
# Have to do it like this because of https://github.com/actions/runner/issues/1985
- if: startsWith(github.event.release.tag_name, 'ac-qu-ai-nt-v')

View File

@@ -1,157 +0,0 @@
name: Daily
on:
schedule:
- cron: "26 9 * * *"
jobs:
audit:
name: Use `cargo-audit` to create issues for vulnerabilities or other problems
runs-on: ubuntu-latest
timeout-minutes: 4
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: rustsec/audit-check@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
check-and-build-with-nightly:
strategy:
matrix:
supporteds:
- runner: macos-latest
target: aarch64-apple-darwin
- runner: macos-latest
target: x86_64-apple-darwin
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && sudo ln -s /bin/g++ /bin/musl-g++
runner: ubuntu-latest
target: aarch64-unknown-linux-gnu
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools gcc-aarch64-linux-gnu g++-aarch64-linux-gnu && sudo ln -s /bin/g++ /bin/musl-g++
runner: ubuntu-latest
target: aarch64-unknown-linux-musl
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools && sudo ln -s /bin/g++ /bin/musl-g++
runner: ubuntu-latest
target: x86_64-unknown-linux-musl
# I would like to support this but I don't know how to install the dependencies to be able to
# - runner: windows-latest
# target: aarch64-pc-windows-gnullvm
- runner: windows-latest
target: aarch64-pc-windows-msvc
# I don't think supporting this is up to me
# I forgot where I learned this, but
# I don't think I can use a non-Rust dependency (i.e. llama.cpp) here
# - runner: windows-latest
# target: x86_64-pc-windows-gnu
- runner: windows-latest
target: x86_64-pc-windows-msvc
name: Check and build ${{ matrix.supporteds.target }} with nightly Rust (on ${{ matrix.supporteds.runner }}) ${{ matrix.minimal_or_latest.job_name_suffix }}
runs-on: ${{ matrix.supporteds.runner }}
timeout-minutes: 8
env:
# https://github.com/rust-lang/stacker/issues/80#issuecomment-1547991131
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc # TODO: shouldn't this be something to do with musl, not gcc?
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install prerequisite build chain
if: matrix.supporteds.install_prerequisite
run: ${{ matrix.supporteds.install_prerequisite }}
- name: Install nightly Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.supporteds.target }}
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.supporteds.target }}-latest-nightly
cache-on-failure: "true"
- name: Check
run: cargo check --verbose
- name: Build
run: cargo build --verbose
test-with-nightly:
strategy:
matrix:
supporteds:
- runner: macos-latest
target: aarch64-apple-darwin
- runner: macos-latest
target: x86_64-apple-darwin
# Not able to be tested in GitHub Actions (without emulation, at least)
# - runner: ubuntu-latest
# target: aarch64-unknown-linux-gnu
# Not able to be tested in GitHub Actions (without emulation, at least)
# - runner: ubuntu-latest
# target: aarch64-unknown-linux-musl
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
- install_prerequisite: sudo apt-get update && sudo apt-get install musl-dev musl-tools && sudo ln -s /bin/g++ /bin/musl-g++
runner: ubuntu-latest
target: x86_64-unknown-linux-musl
# Not able to be tested in GitHub Actions (without emulation, at least)
# - runner: windows-latest
# target: aarch64-pc-windows-gnullvm
# Not able to be tested in GitHub Actions (without emulation, at least)
# - runner: windows-latest
# target: aarch64-pc-windows-msvc
# I don't think supporting this is up to me
# I forgot where I learned this, but
# I don't think I can use a non-Rust dependency (i.e. llama.cpp) here
# - runner: windows-latest
# target: x86_64-pc-windows-gnu
- runner: windows-latest
target: x86_64-pc-windows-msvc
name: Test ${{ matrix.supporteds.target }} with nightly Rust (on ${{ matrix.supporteds.runner }})
runs-on: ${{ matrix.supporteds.runner }}
timeout-minutes: 8
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install prerequisite build chain
if: matrix.supporteds.install_prerequisite
run: ${{ matrix.supporteds.install_prerequisite }}
- name: Install nightly Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.supporteds.target }}
- name: Install Nextest
uses: taiki-e/install-action@cargo-nextest
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.supporteds.target }}-latest-nightly
cache-on-failure: "true"
- name: Test
run: cargo nextest run --target ${{ matrix.supporteds.target }}

1273
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -10,4 +10,7 @@ repository = "https://github.com/babichjacob/ac-qu-ai-nt"
[workspace.dependencies]
clap = "4"
snafu = "0.8"
tracing = "0.1.35"
tracing = "0.1.23"
[patch.crates-io]
llama-cpp-2 = { version = "0.1.81", git = "https://github.com/babichjacob/llama-cpp-rs", branch = "fix-use-c-char-instead-of-i8" }

View File

@@ -5,7 +5,6 @@ This is a placeholder while I take small steps to build out the project.
# Installation
## Automatically Updatable
You won't find it very useful yet, because it doesn't really do much of anything, but you can install the multibinary with [Binstall](https://github.com/cargo-bins/cargo-binstall). This means you don't need to have the same development environment (which will require the Vulkan SDK and CUDA Toolkit in the future) in order to use the program, because you'll just download a precompiled executable.
```sh
@@ -13,35 +12,28 @@ cargo-binstall -y ac-qu-ai-nt
```
Install [`cargo-update`](https://github.com/nabijaczleweli/cargo-update) and periodically run
```sh
cargo install-update --all
```
in order to keep this program up to date.
I'm not sure if you need a Rust compiler installed for either or if they can work standalone.
## Just the Executable
Head to [the Releases page](https://github.com/babichjacob/ac-qu-ai-nt/releases) and download the asset corresponding to your computer architecture and operating system.
Decompress the archive and place the executable contained within it somewhere useful to you (e.g. in a directory in [your `PATH` variable](https://superuser.com/a/284351)).
# Usage
If it's your preference, you should be able to double click the executable in the folder to be able to run it (defaulting to launching a graphical interface (once I actually make one lol)).
You could also type
```sh
ac-qu-ai-nt
```
on the command line to run it. This is also a way to launch a GUI (once there actually is one) for the application.
## Command Line Interface
It's going to be a goal of this project for there to be feature parity between the GUI, CLI, and TUI.
If you want to use its command line interface, start with
@@ -49,22 +41,13 @@ If you want to use its command line interface, start with
```sh
ac-qu-ai-nt cli
```
to see what capabilities are available.
(This is an alias for `ac-qu-ai-nt cli-clap` to allow the possibility of experimenting with different implementations of the same type of interface.)
# Contributing
## Issues and Pull Requests
Please create an issue before working on a pull request. It's helpful for you to know if the idea you have in mind will for sure be incorporated into the project, and won't require you to _acquaint_ yourself with the project internals. It even opens the floor for someone else to do the work implementing it for you.
Some [existing issues are labeled `straightforward`](https://github.com/babichjacob/ac-qu-ai-nt/issues?q=is%3Aissue+is%3Aopen+label%3Astraightforward) and expected to be the easiest to work on, if you'd like to try.
## Project Breakdown
This is a summary of the crates in this project and how they are used:
This is a summary of the crates I expect to be in this project and how they are used:
```mermaid
flowchart TD
@@ -76,28 +59,6 @@ gui-eframe --> multibinary
tui-ratatui --> multibinary
```
### `core`
The core of the project, where code for large language model and embedding model inference using [`llama-cpp-2`](https://crates.io/crates/llama-cpp-2) will be (because it's not started yet at the time of writing), where ingesting data will be done, and where public APIs that the other crates (`cli-clap`, `gui-eframe`, and `tui-ratatui`) use will be.
Each of the interface crates are expected to have feature parity (as in capability, not as in a Cargo feature) where possible, but we'll see how that goes.
### `cli-clap`
A command line interface (CLI) for the project written with [`clap`](https://crates.io/crates/clap).
### `gui-eframe`
A graphical user interface (GUI) for the project written with [`eframe`](https://crates.io/crates/eframe) for [`egui`](https://crates.io/crates/egui).
As of right now, it isn't started yet.
### `tui-ratatui`
A terminal user interface (TUI) for the project written with [`ratatui`](https://crates.io/crates/ratatui).
As of right now, it isn't started yet.
## Versioning
This project aims to adhere to [semantic versioning](https://semver.org/) using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#summary), conducted by [Release-plz](https://release-plz.ieni.dev/).
@@ -113,9 +74,8 @@ All the crates in this project have a [minimum supported Rust version (MSRV)](ht
## License
All contents of this repository are licensed under either the
- [MIT license](LICENSE-MIT), or
- [Apache 2.0 license](LICENSE-APACHE), or
- [Unlicense](LICENSE-UNLICENSE)
* [MIT license](LICENSE-MIT), or
* [Apache 2.0 license](LICENSE-APACHE), or
* [Unlicense](LICENSE-UNLICENSE)
at your option.

View File

@@ -7,23 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.0.10](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-cli-clap-v0.0.9...ac-qu-ai-nt-cli-clap-v0.0.10) - 2024-10-18
### Other
- update Cargo.toml dependencies
## [0.0.9](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-cli-clap-v0.0.8...ac-qu-ai-nt-cli-clap-v0.0.9) - 2024-10-15
## [0.0.9](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-cli-clap-v0.0.8...ac-qu-ai-nt-cli-clap-v0.0.9) - 2024-10-11
### Fixed
- *(ac-qu-ai-nt-cli-clap)* write a `main` function instead of re-exporting so that the declared MSRV can be met
### Other
- *(cli-clap)* ignore the `Args` argument because it doesn't get used yet (to satisfy Clippy)
- build out the infrastructure for commands to be passed to the clap CLI
## [0.0.8](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-cli-clap-v0.0.7...ac-qu-ai-nt-cli-clap-v0.0.8) - 2024-10-07
### Other

View File

@@ -1,7 +1,7 @@
[package]
name = "ac-qu-ai-nt-cli-clap"
description = "A CLI (written with clap) for ac-qu-ai-nt"
version = "0.0.10"
version = "0.0.9"
edition = "2021"
rust-version = "1.76"

View File

@@ -1,15 +1,4 @@
use clap::{Parser, Subcommand};
#[derive(Debug, Subcommand)]
enum Command {}
#[derive(Debug, Parser)]
pub struct Args {
#[command(subcommand)]
command: Command,
}
pub fn main(_args: Args) {
pub fn main() {
#[cfg(feature = "tracing")]
tracing::info!("What's up, world?");
}

View File

@@ -1,7 +1,3 @@
use clap::Parser;
fn main() {
let args = ac_qu_ai_nt_cli_clap::Args::parse();
ac_qu_ai_nt_cli_clap::main(args);
ac_qu_ai_nt_cli_clap::main();
}

View File

@@ -7,34 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.0.6](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-core-v0.0.5...ac-qu-ai-nt-core-v0.0.6) - 2024-10-18
### Fixed
- *(ac-qu-ai-nt-core)* raise the minimum version of the `reqwest` dependency to the first one that includes the `zstd` feature
## [0.0.4](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-core-v0.0.3...ac-qu-ai-nt-core-v0.0.4) - 2024-10-11
### Other
- *(ac-qu-ai-nt-core)* add `reqwest` as a dependency because I expect to use it and I'd like to make sure everything works out
## [0.0.5](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-core-v0.0.4...ac-qu-ai-nt-core-v0.0.5) - 2024-10-17
### Fixed
- *(ac-qu-ai-nt-core)* raise the minimum acceptable version of `rten` to `0.13.1`
### Other
- *(ac-qu-ai-nt-core)* remove `surrealdb` as a dependency because the BUSL doesn't fit what I want this project to be. sorry. we'll see if I feel inclined to give it another chance
- *(ac-qu-ai-nt-core)* upgrade `surrealdb` to `2` and I'm not sure why it defaulted to an old version
- *(ac-qu-ai-nt-core)* add `ocrs`, `rten`, and `surrealdb` as dependencies because I expect to use them in the future and this will allow GitHub Actions to build cache for them or to report back to me that they're incompatible with the currently `supporteds`
- *(ac-qu-ai-nt-core)* [**breaking**] make `tracing` no longer a default feature
## [0.0.4](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-core-v0.0.3...ac-qu-ai-nt-core-v0.0.4) - 2024-10-15
### Other
- update `llama-cpp-2` and other packages
- *(ac-qu-ai-nt-core)* update `llama-cpp-2`
- *(core)* add `snafu` as a dependency

View File

@@ -1,7 +1,7 @@
[package]
name = "ac-qu-ai-nt-core"
description = "The core library of ac-qu-ai-nt. If you're looking for the application, see cli-clap or gui-eframe or tui-ratatui or the multibinary"
version = "0.0.6"
version = "0.0.4"
edition = "2021"
rust-version = "1.76"
@@ -10,27 +10,11 @@ license = { workspace = true }
repository = { workspace = true }
[features]
default = []
default = ["tracing"]
tracing = ["dep:tracing"]
[dependencies]
llama-cpp-2 = "0.1.82"
ocrs = "0.9"
reqwest = { version = "0.12.4", default-features = false, features = [
"http2",
"macos-system-configuration",
"rustls-tls-webpki-roots",
"json",
"multipart",
"brotli",
"deflate",
"gzip",
"zstd",
] }
rten = "0.13.1"
llama-cpp-2 = "0.1.81"
snafu = { workspace = true }
tracing = { workspace = true, optional = true }

View File

@@ -93,10 +93,7 @@ allow = [
"BSD-3-Clause",
"ISC",
"MIT",
"MPL-2.0",
"OpenSSL",
"Unicode-DFS-2016",
"Unlicense",
"Unicode-DFS-2016"
]
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
@@ -114,20 +111,20 @@ exceptions = [
# Some crates don't have (easily) machine readable licensing information,
# adding a clarification entry for it allows you to manually specify the
# licensing information
[[licenses.clarify]]
#[[licenses.clarify]]
# The package spec the clarification applies to
crate = "ring"
#crate = "ring"
# The SPDX expression for the license requirements of the crate
expression = "MIT AND ISC AND OpenSSL"
#expression = "MIT AND ISC AND OpenSSL"
# One or more files in the crate's source used as the "source of truth" for
# the license expression. If the contents match, the clarification will be used
# when running the license check, otherwise the clarification will be ignored
# and the crate will be checked normally, which may produce warnings or errors
# depending on the rest of your configuration
license-files = [
# Each entry is a crate relative path, and the (opaque) hash of its contents
{ path = "LICENSE", hash = 0xbd0eed23 },
]
#license-files = [
# Each entry is a crate relative path, and the (opaque) hash of its contents
#{ path = "LICENSE", hash = 0xbd0eed23 }
#]
[licenses.private]
# If true, ignores workspace crates that aren't published, or are only

View File

@@ -7,13 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.0.7](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-gui-eframe-v0.0.6...ac-qu-ai-nt-gui-eframe-v0.0.7) - 2024-10-18
### Other
- update Cargo.toml dependencies
## [0.0.6](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-gui-eframe-v0.0.5...ac-qu-ai-nt-gui-eframe-v0.0.6) - 2024-10-15
## [0.0.6](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-gui-eframe-v0.0.5...ac-qu-ai-nt-gui-eframe-v0.0.6) - 2024-10-11
### Fixed

View File

@@ -1,7 +1,7 @@
[package]
name = "ac-qu-ai-nt-gui-eframe"
description = "A GUI (written with egui / eframe) for ac-qu-ai-nt"
version = "0.0.7"
version = "0.0.6"
edition = "2021"
rust-version = "1.76"

View File

@@ -7,28 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.0.15](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-v0.0.14...ac-qu-ai-nt-v0.0.15) - 2024-10-18
## [0.0.13](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-v0.0.12...ac-qu-ai-nt-v0.0.13) - 2024-10-11
### Other
- updated the following local packages: ac-qu-ai-nt-cli-clap, ac-qu-ai-nt-gui-eframe, ac-qu-ai-nt-tui-ratatui
## [0.0.14](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-v0.0.13...ac-qu-ai-nt-v0.0.14) - 2024-10-16
### Added
- *(multibinary)* support running the binary without arguments (using a sensible user interface as the default), and improve error reporting by using `snafu`
### Other
- *(multibinary)* mark the Clippy lint against manually implementing `Default` for `Command` as allowed
- *(multibinary)* add `cfg-if` and `snafu` as dependencies
## [0.0.13](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-v0.0.12...ac-qu-ai-nt-v0.0.13) - 2024-10-15
### Other
- build out the infrastructure for commands to be passed to the clap CLI
- update Cargo.lock dependencies
## [0.0.12](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-v0.0.11...ac-qu-ai-nt-v0.0.12) - 2024-10-07

View File

@@ -1,7 +1,7 @@
[package]
name = "ac-qu-ai-nt"
description = "A WIP project using AI to break down a user's query, acquire the knowledge to answer it, then transfer those insights to the user"
version = "0.0.15"
version = "0.0.13"
edition = "2021"
rust-version = "1.76"
@@ -27,13 +27,11 @@ tracing = [
]
[dependencies]
ac-qu-ai-nt-cli-clap = { version = "0.0.10", path = "../cli-clap", optional = true }
ac-qu-ai-nt-gui-eframe = { version = "0.0.7", path = "../gui-eframe", optional = true }
ac-qu-ai-nt-tui-ratatui = { version = "0.0.7", path = "../tui-ratatui", optional = true }
ac-qu-ai-nt-cli-clap = { version = "0.0.9", path = "../cli-clap", optional = true }
ac-qu-ai-nt-gui-eframe = { version = "0.0.6", path = "../gui-eframe", optional = true }
ac-qu-ai-nt-tui-ratatui = { version = "0.0.6", path = "../tui-ratatui", optional = true }
cfg-if = "1.0.0"
clap = { workspace = true, features = ["derive", "env"] }
dirs-next = "2.0.0"
snafu = { workspace = true }
tracing-subscriber = { version = "0.3.18", optional = true }

View File

@@ -1,12 +1,6 @@
use std::{
fs::create_dir_all,
io::ErrorKind,
path::{Path, PathBuf},
};
use std::{fs::create_dir_all, io::ErrorKind, path::PathBuf};
use cfg_if::cfg_if;
use clap::{Parser, Subcommand};
use snafu::{ResultExt, Snafu};
#[derive(Debug, Parser)]
struct Args {
@@ -17,93 +11,24 @@ struct Args {
)]
application_data_directory: PathBuf,
// If there is a GUI or TUI available from this binary,
// then calling this program without arguments
// is acceptable: it will launch a user interface
#[cfg(any(feature = "gui-eframe", feature = "tui-ratatui"))]
#[command(subcommand)]
command: Option<Command>,
#[cfg(not(any(feature = "gui-eframe", feature = "tui-ratatui")))]
#[command(subcommand)]
command: Command,
}
#[derive(Debug, Subcommand)]
enum Command {
#[cfg(feature = "cli-clap")]
#[command(alias = "cli")]
CliClap,
#[cfg(feature = "gui-eframe")]
#[command(alias = "gui")]
GuiEframe,
#[cfg(feature = "tui-ratatui")]
#[command(alias = "tui")]
TuiRatatui,
#[cfg(feature = "cli-clap")]
#[command(alias = "cli")]
CliClap(ac_qu_ai_nt_cli_clap::Args),
}
// When this program is run without arguments,
// it will launch a user interface
cfg_if!(
// with the GUI (made with eframe)
// being considered more appealing (made the default)
if #[cfg(feature = "gui-eframe")] {
#[allow(clippy::derivable_impls)]
impl Default for Command {
fn default() -> Self {
Command::GuiEframe
}
}
}
// than the TUI (made with Ratatui)
else if #[cfg(feature = "tui-ratatui")] {
#[allow(clippy::derivable_impls)]
impl Default for Command {
fn default() -> Self {
Command::TuiRatatui
}
}
}
// with it not being logical to specify
// the CLI (made with clap)
// as an option,
// because if `ac-qu-ai-nt ask "why is the sky blue?"`
// were accepted and worked when `cli-clap` was the only
// interface enabled, then when another interface
// like `gui-eframe` were enabled, it would stop working
// (only able to work as `ac-qu-ai-nt cli-clap ask "why is the sky blue?"`)
// so it should be required to do it the way that would work
// in both cases from the beginning
);
#[derive(Debug, Snafu)]
enum ApplicationError {
#[snafu(display("failed to create the {path:?} directory"))]
DirectoryCreationError {
path: PathBuf,
source: std::io::Error,
},
}
/// Create the directory and its parents,
/// but don't return an error if it already exists and is a directory
fn create_dir_all_exist_ok(path: impl AsRef<Path>) -> Result<(), std::io::Error> {
match create_dir_all(&path) {
Ok(()) => Ok(()),
Err(e) => {
if e.kind() == ErrorKind::AlreadyExists && path.as_ref().is_dir() {
Ok(())
} else {
Err(e)
}
}
}
}
#[snafu::report]
fn main() -> Result<(), ApplicationError> {
fn main() {
let Args {
application_data_directory,
command,
@@ -112,28 +37,30 @@ fn main() -> Result<(), ApplicationError> {
#[cfg(feature = "tracing")]
tracing_subscriber::fmt::init();
create_dir_all_exist_ok(&application_data_directory).with_context(|_| {
DirectoryCreationSnafu {
path: application_data_directory.clone(),
match create_dir_all(&application_data_directory) {
Ok(()) => {}
Err(e) if e.kind() == ErrorKind::AlreadyExists => {}
Err(e) => {
panic!("{}", e);
}
}
})?;
let tracing_directory = application_data_directory.join("logs");
create_dir_all_exist_ok(&tracing_directory).with_context(|_| DirectoryCreationSnafu {
path: tracing_directory.clone(),
})?;
#[cfg(any(feature = "gui-eframe", feature = "tui-ratatui"))]
let command = command.unwrap_or_default();
match create_dir_all(&tracing_directory) {
Ok(()) => {}
Err(e) if e.kind() == ErrorKind::AlreadyExists => {}
Err(e) => {
panic!("{}", e);
}
}
match command {
#[cfg(feature = "cli-clap")]
Command::CliClap(args) => ac_qu_ai_nt_cli_clap::main(args),
Command::CliClap => ac_qu_ai_nt_cli_clap::main(),
#[cfg(feature = "gui-eframe")]
Command::GuiEframe => ac_qu_ai_nt_gui_eframe::main(),
#[cfg(feature = "tui-ratatui")]
Command::TuiRatatui => ac_qu_ai_nt_tui_ratatui::main(),
}
Ok(())
}

View File

@@ -7,13 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.0.7](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-tui-ratatui-v0.0.6...ac-qu-ai-nt-tui-ratatui-v0.0.7) - 2024-10-18
### Other
- update Cargo.toml dependencies
## [0.0.6](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-tui-ratatui-v0.0.5...ac-qu-ai-nt-tui-ratatui-v0.0.6) - 2024-10-15
## [0.0.6](https://github.com/babichjacob/ac-qu-ai-nt/compare/ac-qu-ai-nt-tui-ratatui-v0.0.5...ac-qu-ai-nt-tui-ratatui-v0.0.6) - 2024-10-11
### Fixed

View File

@@ -1,7 +1,7 @@
[package]
name = "ac-qu-ai-nt-tui-ratatui"
description = "A TUI (written with Ratatui) for ac-qu-ai-nt"
version = "0.0.7"
version = "0.0.6"
edition = "2021"
rust-version = "1.76"