Skip to content

Commit a8ee9b9

Browse files
committed
finish rewrite (actually?)
1 parent b744386 commit a8ee9b9

File tree

19 files changed

+235
-599
lines changed

19 files changed

+235
-599
lines changed

crates/chat-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ homepage.workspace = true
66
publish.workspace = true
77
version.workspace = true
88
license.workspace = true
9+
default-run = "chat_cli"
910

1011
[lints]
1112
workspace = true

crates/chat-cli/src/api_client/clients/client.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ use crate::aws_common::{
1818
UserAgentOverrideInterceptor,
1919
app_name,
2020
};
21-
use crate::database::Database;
22-
use crate::database::state::{
21+
use crate::database::{
2322
AuthProfile,
24-
StateDatabase,
23+
Database,
2524
};
2625

2726
mod inner {

crates/chat-cli/src/api_client/clients/streaming_client.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ use crate::aws_common::{
3030
UserAgentOverrideInterceptor,
3131
app_name,
3232
};
33-
use crate::database::Database;
34-
use crate::database::state::{
33+
use crate::database::{
3534
AuthProfile,
36-
StateDatabase,
35+
Database,
3736
};
3837

3938
mod inner {

crates/chat-cli/src/api_client/endpoints.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::api_client::consts::{
1414
};
1515
use crate::database::Database;
1616
use crate::database::settings::Setting;
17-
use crate::database::state::StateDatabase;
1817

1918
#[derive(Debug, Clone, PartialEq, Eq)]
2019
pub struct Endpoint {

crates/chat-cli/src/api_client/profile.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
use crate::api_client::Client;
22
use crate::api_client::endpoints::Endpoint;
33
use crate::auth::AuthError;
4-
use crate::database::Database;
5-
use crate::database::state::AuthProfile;
4+
use crate::database::{
5+
AuthProfile,
6+
Database,
7+
};
68

79
pub async fn list_available_profiles(database: &mut Database) -> Result<Vec<AuthProfile>, AuthError> {
810
let mut profiles = vec![];

crates/chat-cli/src/auth/builder_id.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,20 @@ use crate::database::secret_store::{
5757
Secret,
5858
SecretStore,
5959
};
60-
use crate::database::state::StateDatabase;
6160

6261
#[derive(Debug, Copy, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
6362
pub enum OAuthFlow {
6463
DeviceCode,
64+
// This must remain backwards compatible
65+
#[serde(rename = "PKCE")]
6566
Pkce,
6667
}
6768

6869
impl std::fmt::Display for OAuthFlow {
6970
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7071
match *self {
7172
OAuthFlow::DeviceCode => write!(f, "DeviceCode"),
72-
OAuthFlow::Pkce => write!(f, "Pkce"),
73+
OAuthFlow::Pkce => write!(f, "PKCE"),
7374
}
7475
}
7576
}
@@ -577,7 +578,7 @@ mod tests {
577578
#[test]
578579
fn test_oauth_flow_ser_deser() {
579580
test_ser_deser!(OAuthFlow, OAuthFlow::DeviceCode, "DeviceCode");
580-
test_ser_deser!(OAuthFlow, OAuthFlow::Pkce, "Pkce");
581+
test_ser_deser!(OAuthFlow, OAuthFlow::Pkce, "PKCE");
581582
}
582583

583584
#[tokio::test]

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ use crate::api_client::model::{
9797
};
9898
use crate::database::Database;
9999
use crate::database::settings::Setting;
100-
use crate::database::state::StateDatabase;
101100
use crate::platform::Context;
102101
use crate::telemetry::TelemetryThread;
103102
use crate::telemetry::core::ToolUseEventBuilder;

crates/chat-cli/src/cli/settings.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use serde_json::json;
1717
use super::OutputFormat;
1818
use crate::database::Database;
1919
use crate::database::settings::Setting;
20-
use crate::database::state::StateDatabase;
2120
use crate::util::{
2221
CliContext,
2322
directories,
@@ -32,6 +31,9 @@ pub enum SettingsSubcommands {
3231
/// Format of the output
3332
#[arg(long, short, value_enum, default_value_t)]
3433
format: OutputFormat,
34+
/// Whether or not we want to modify state instead
35+
#[arg(long, short, hide = true)]
36+
state: bool,
3537
},
3638
}
3739

@@ -52,9 +54,6 @@ pub struct SettingsArgs {
5254
/// Format of the output
5355
#[arg(long, short, value_enum, default_value_t)]
5456
format: OutputFormat,
55-
/// Whether or not we want to modify state instead
56-
#[arg(hide = true)]
57-
state: bool,
5857
}
5958

6059
impl SettingsArgs {
@@ -69,8 +68,8 @@ impl SettingsArgs {
6968
bail!("The EDITOR environment variable is not set")
7069
}
7170
},
72-
Some(SettingsSubcommands::All { format }) => {
73-
let settings = match self.state {
71+
Some(SettingsSubcommands::All { format, state }) => {
72+
let settings = match state {
7473
true => database.get_all_entries()?,
7574
false => database.settings.map().clone(),
7675
};

crates/chat-cli/src/cli/uninstall.rs

Lines changed: 0 additions & 54 deletions
This file was deleted.

crates/chat-cli/src/cli/update.rs

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)