diff --git a/Cargo.toml b/Cargo.toml index 65e9679..68ae8bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,13 +4,9 @@ version = "0.1.0" edition = "2021" description = "CLI tool for publishing stream.thought.blip records to ATProto" -[[bin]] -name = "think" -path = "src/main.rs" - [[bin]] name = "thought" -path = "src/thought.rs" +path = "src/main.rs" [dependencies] clap = { version = "4.4", features = ["derive"] } diff --git a/README.md b/README.md index da11210..058cd66 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Think CLI +# Thought CLI A terminal UI for real-time streaming and posting to the ATProto/Bluesky network using `stream.thought.blip` records. @@ -20,7 +20,7 @@ cargo build --release ### 2. Login ```bash -./target/release/think login +./target/release/thought login ``` Enter your Bluesky handle/email and app password when prompted. @@ -32,33 +32,26 @@ This launches the full TUI experience where you can see all blips in real-time a ## Commands -### think +### thought The main CLI tool with multiple modes: ```bash # Login to Bluesky -think login +thought login # Post a single blip -think "Your thought here" +thought "Your thought here" # Enter simple REPL mode -think interactive +thought interactive # Enter full TUI mode with live feed -think interactive --tui +thought stream # Logout and clear credentials -think logout +thought logout ``` -### thought -Direct entry to the streaming TUI: - -```bash -# Launch the TUI directly (same as think interactive --tui) -thought stream -``` ## TUI Interface @@ -86,14 +79,13 @@ cd think cargo build --release ``` -The binaries will be available at: -- `target/release/think` +The binary will be available at: - `target/release/thought` ### App Password Setup 1. Go to [Bluesky Settings](https://bsky.app/settings/app-passwords) 2. Generate a new app password -3. Use this password (not your main password) when running `think login` +3. Use this password (not your main password) when running `thought login` ## Configuration @@ -113,7 +105,7 @@ Credentials are securely stored in your system's configuration directory: ### Post a quick thought ```bash -think "Just built something cool!" +thought "Just built something cool!" ``` ### Start a streaming session @@ -124,7 +116,7 @@ thought stream ### Interactive REPL ```bash -think interactive +thought interactive # Enter multiple thoughts line by line ``` diff --git a/src/client.rs b/src/client.rs index 5c58972..a604040 100644 --- a/src/client.rs +++ b/src/client.rs @@ -94,7 +94,7 @@ impl AtProtoClient { pub async fn publish_blip(&self, content: &str) -> Result { let session = self.session.as_ref() - .context("Not authenticated. Please run 'think login' first.")?; + .context("Not authenticated. Please run 'thought login' first.")?; let record = BlipRecord { record_type: "stream.thought.blip".to_string(), diff --git a/src/main.rs b/src/main.rs index b637a96..ba1caff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use client::AtProtoClient; use credentials::{CredentialStore, Credentials}; #[derive(Parser)] -#[command(name = "think")] +#[command(name = "thought")] #[command(about = "CLI tool for publishing stream.thought.blip records")] #[command(version = "0.1.0")] struct Cli { @@ -35,6 +35,8 @@ enum Commands { #[arg(long)] tui: bool, }, + /// Enter the thought stream (TUI mode with live feed) + Stream, } fn prompt_for_input(prompt: &str) -> Result { @@ -53,7 +55,7 @@ async fn handle_login() -> Result<()> { let store = CredentialStore::new()?; if store.exists() { - println!("You are already logged in. Use 'think logout' to clear credentials first."); + println!("You are already logged in. Use 'thought logout' to clear credentials first."); return Ok(()); } @@ -102,7 +104,7 @@ async fn handle_publish(message: &str) -> Result<()> { let store = CredentialStore::new()?; let credentials = store.load()? - .context("Not logged in. Please run 'think login' first.")?; + .context("Not logged in. Please run 'thought login' first.")?; let mut client = AtProtoClient::new(&credentials.pds_uri); client.login(&credentials).await?; @@ -117,7 +119,7 @@ async fn handle_interactive(use_tui: bool) -> Result<()> { let store = CredentialStore::new()?; let credentials = store.load()? - .context("Not logged in. Please run 'think login' first.")?; + .context("Not logged in. Please run 'thought login' first.")?; let mut client = AtProtoClient::new(&credentials.pds_uri); client.login(&credentials).await?; @@ -135,16 +137,17 @@ async fn main() -> Result<()> { Some(Commands::Login) => handle_login().await?, Some(Commands::Logout) => handle_logout().await?, Some(Commands::Interactive { tui }) => handle_interactive(tui).await?, + Some(Commands::Stream) => handle_interactive(true).await?, None => { if let Some(message) = cli.message { handle_publish(&message).await?; } else { println!("Usage:"); - println!(" think login # Login to Bluesky"); - println!(" think logout # Logout and clear credentials"); - println!(" think interactive # Enter simple REPL mode"); - println!(" think interactive --tui # Enter TUI mode with live feed"); - println!(" think \"message\" # Publish a blip"); + println!(" thought login # Login to Bluesky"); + println!(" thought logout # Logout and clear credentials"); + println!(" thought interactive # Enter simple REPL mode"); + println!(" thought stream # Enter TUI mode with live feed"); + println!(" thought \"message\" # Publish a blip"); } } } diff --git a/src/thought.rs b/src/thought.rs deleted file mode 100644 index 341d216..0000000 --- a/src/thought.rs +++ /dev/null @@ -1,49 +0,0 @@ -mod client; -mod credentials; -mod interactive; -mod jetstream; -mod tui; - -use anyhow::{Context, Result}; -use clap::Parser; - -use client::AtProtoClient; -use credentials::CredentialStore; - -#[derive(Parser)] -#[command(name = "thought")] -#[command(about = "Stream your thoughts to the bluesky firehose", long_about = None)] -#[command(version = "0.1.0")] -struct Cli { - /// Subcommand - #[command(subcommand)] - command: Option, -} - -#[derive(clap::Subcommand)] -enum Commands { - /// Enter the thought stream (TUI mode) - Stream, -} - -#[tokio::main] -async fn main() -> Result<()> { - let cli = Cli::parse(); - - match cli.command { - Some(Commands::Stream) | None => { - // Always launch TUI mode - let store = CredentialStore::new()?; - - let credentials = store.load()? - .context("Not logged in. Please run 'think login' first to set up your credentials.")?; - - let mut client = AtProtoClient::new(&credentials.pds_uri); - client.login(&credentials).await?; - - interactive::run_interactive_mode(&client, true).await?; - } - } - - Ok(()) -} \ No newline at end of file