Skip to content

Commit d954f22

Browse files
author
Finn
committed
revert: remove accidentally committed accounts module and storage changes
Commit 3a207da included untracked/unstaged files from the working tree alongside the intended cargo fmt fixes. This reverts only the unrelated additions (accounts CLI module, storage/accounts.rs changes). The fmt fixes in approval_poster/{mod.rs, queue.rs} are kept.
1 parent 3a207da commit d954f22

File tree

4 files changed

+0
-296
lines changed

4 files changed

+0
-296
lines changed

crates/tuitbot-cli/src/commands/accounts.rs

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

crates/tuitbot-cli/src/commands/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
///
33
/// Each subcommand struct defines its flags and arguments
44
/// matching the CLI interface contract.
5-
pub mod accounts;
65
pub mod approve;
76
pub mod auth;
87
pub mod backup;
@@ -268,13 +267,6 @@ pub struct UninstallArgs {
268267
pub data_only: bool,
269268
}
270269

271-
/// Arguments for the `accounts` subcommand.
272-
#[derive(Debug, Args)]
273-
pub struct AccountsArgs {
274-
#[command(subcommand)]
275-
pub command: accounts::AccountsSubcommand,
276-
}
277-
278270
/// Arguments for the `mcp` subcommand.
279271
#[derive(Debug, Args)]
280272
pub struct McpArgs {

crates/tuitbot-cli/src/main.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ struct Cli {
5151

5252
#[derive(clap::Subcommand)]
5353
enum Commands {
54-
/// Manage X accounts
55-
Accounts(commands::AccountsArgs),
5654
/// Set up configuration (interactive wizard)
5755
Init(commands::InitArgs),
5856
/// Start the autonomous agent
@@ -204,9 +202,6 @@ async fn run() -> anyhow::Result<()> {
204202
if let Commands::Doctor(_) = cli.command {
205203
return commands::doctor::execute(&cli.config).await;
206204
}
207-
if let Commands::Accounts(args) = cli.command {
208-
return commands::accounts::execute(args.command, &cli.config, out).await;
209-
}
210205

211206
// Load configuration.
212207
let config = match Config::load(Some(&cli.config)) {

crates/tuitbot-core/src/storage/accounts.rs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -335,35 +335,6 @@ pub fn account_token_path(data_dir: &Path, account_id: &str) -> PathBuf {
335335
account_data_dir(data_dir, account_id).join("tokens.json")
336336
}
337337

338-
// ---- Active account tracking ----
339-
340-
/// Get the currently active account ID from the sentinel file (~/.tuitbot/active_account).
341-
///
342-
/// Returns DEFAULT_ACCOUNT_ID if the sentinel does not exist.
343-
pub fn get_active_account_id() -> String {
344-
use crate::startup::data_dir;
345-
346-
let sentinel = data_dir().join("active_account");
347-
match std::fs::read_to_string(&sentinel) {
348-
Ok(content) => content.trim().to_string(),
349-
Err(_) => DEFAULT_ACCOUNT_ID.to_string(),
350-
}
351-
}
352-
353-
/// Set the active account ID in the sentinel file (~/.tuitbot/active_account).
354-
///
355-
/// Creates the directory if it does not exist.
356-
pub fn set_active_account_id(account_id: &str) -> Result<(), std::io::Error> {
357-
use crate::startup::data_dir;
358-
359-
let dir = data_dir();
360-
std::fs::create_dir_all(&dir)?;
361-
362-
let sentinel = dir.join("active_account");
363-
std::fs::write(&sentinel, account_id)?;
364-
Ok(())
365-
}
366-
367338
#[cfg(test)]
368339
mod tests {
369340
use super::*;
@@ -704,30 +675,4 @@ mod tests {
704675
assert!(account.x_user_id.is_none()); // unchanged
705676
assert!(account.x_username.is_none()); // unchanged
706677
}
707-
708-
#[test]
709-
fn test_get_active_account_id_default() {
710-
// When sentinel doesn't exist, should return DEFAULT_ACCOUNT_ID
711-
let active = get_active_account_id();
712-
assert_eq!(active, DEFAULT_ACCOUNT_ID);
713-
}
714-
715-
#[test]
716-
fn test_set_and_get_active_account_id() {
717-
// Create temp dir for test
718-
let tmpdir = std::env::temp_dir().join(format!("tuitbot_test_{}", uuid::Uuid::new_v4()));
719-
std::fs::create_dir_all(&tmpdir).expect("create tmpdir");
720-
721-
// Fake: set an active account manually to a temp sentinel
722-
let test_id = "abc-123-def";
723-
let sentinel = tmpdir.join("active_account");
724-
std::fs::write(&sentinel, test_id).expect("write sentinel");
725-
726-
// Read it back
727-
let content = std::fs::read_to_string(&sentinel).expect("read");
728-
assert_eq!(content.trim(), test_id);
729-
730-
// Cleanup
731-
let _ = std::fs::remove_dir_all(&tmpdir);
732-
}
733678
}

0 commit comments

Comments
 (0)