Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ cp target/release/hotdata /usr/local/bin/hotdata

## Connect

Run the following command to authenticate:
Run either of the following (they are equivalent):

```sh
hotdata auth login
# or
hotdata auth
```

Expand All @@ -60,7 +62,7 @@ API key priority (lowest to highest): config file → `HOTDATA_API_KEY` env var

| Command | Subcommands | Description |
| :-- | :-- | :-- |
| `auth` | `status`, `logout` | Authenticate (run without subcommand to log in) |
| `auth` | `login`, `status`, `logout` | `login` or bare `auth` opens browser login; `status` / `logout` manage the saved profile |
| `workspaces` | `list`, `set` | Manage workspaces |
| `connections` | `list`, `create`, `refresh`, `new` | Manage connections |
| `tables` | `list` | List tables and columns |
Expand Down
7 changes: 4 additions & 3 deletions skills/hotdata/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Or if installed on PATH: `hotdata <command> [args]`

## Authentication

Run `hotdata auth` to authenticate via browser login. Config is stored in `~/.hotdata/config.yml`.
Run **`hotdata auth login`** (or **`hotdata auth`** with no subcommand—same behavior) to authenticate via browser login. Config is stored in `~/.hotdata/config.yml`.

API key resolution (lowest to highest priority):
1. Config file (saved by `hotdata auth`)
1. Config file (saved by `hotdata auth login` / `hotdata auth`)
2. `HOTDATA_API_KEY` environment variable (or `.env` file)
3. `--api-key <key>` flag (works on any command)

Expand Down Expand Up @@ -325,7 +325,8 @@ hotdata jobs <job_id> [--workspace-id <workspace_id>] [--output table|json|yaml]

### Auth
```
hotdata auth # Browser-based login
hotdata auth login # Browser-based login (same as: hotdata auth)
hotdata auth # Browser-based login (same as: hotdata auth login)
hotdata auth status # Check current auth status
hotdata auth logout # Remove saved auth for the default profile
```
Expand Down
6 changes: 3 additions & 3 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl ApiClient {
let api_key = match &profile_config.api_key {
Some(key) if key != "PLACEHOLDER" => key.clone(),
_ => {
eprintln!("error: not authenticated. Run 'hotdata auth' to log in.");
eprintln!("error: not authenticated. Run 'hotdata auth login' (or 'hotdata auth') to log in.");
std::process::exit(1);
}
};
Expand Down Expand Up @@ -294,7 +294,7 @@ fn format_fail_message(
) -> String {
if status.is_client_error() {
if let Some(auth::AuthStatus::Invalid(_)) = auth_status {
return "error: API key is invalid. Run 'hotdata auth' to re-authenticate.".to_string();
return "error: API key is invalid. Run 'hotdata auth login' (or 'hotdata auth') to re-authenticate.".to_string();
}
}
util::api_error(body.to_string())
Expand All @@ -313,7 +313,7 @@ mod tests {
Some(&AuthStatus::Invalid(401)),
);
assert!(msg.contains("API key is invalid"));
assert!(msg.contains("hotdata auth"));
assert!(msg.contains("hotdata auth login") || msg.contains("hotdata auth"));
}

#[test]
Expand Down
3 changes: 3 additions & 0 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ pub enum QueryCommands {

#[derive(Subcommand)]
pub enum AuthCommands {
/// Log in via browser (same as `hotdata auth` with no subcommand)
Login,

/// Remove authentication for a profile
Logout,

Expand Down
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub fn resolve_workspace_id(provided: Option<String>, profile_config: &ProfileCo
.workspaces
.first()
.map(|w| w.public_id.clone())
.ok_or_else(|| "no workspace-id provided and no default workspace found. Run 'hotdata auth' or specify --workspace-id.".to_string())
.ok_or_else(|| "no workspace-id provided and no default workspace found. Run 'hotdata auth login' (or 'hotdata auth') or specify --workspace-id.".to_string())
}

/// Global API key override set via --api-key flag.
Expand All @@ -285,7 +285,7 @@ pub fn load(profile: &str) -> Result<ProfileConfig, String> {
fs::read_to_string(&config_file).map_err(|e| format!("error reading config file: {e}"))?;
let config_file: ConfigFile = serde_yaml::from_str(&content).unwrap_or_else(|_| {
eprintln!("{}", "error parsing config file.".red());
eprintln!("Run 'hotdata auth' to generate a new config file.");
eprintln!("Run 'hotdata auth login' (or 'hotdata auth') to generate a new config file.");
std::process::exit(1);
});
config_file.profiles.get(profile).cloned().unwrap_or_default()
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn main() {
}
Some(cmd) => match cmd {
Commands::Auth { command } => match command {
None => auth::login(),
None | Some(AuthCommands::Login) => auth::login(),
Some(AuthCommands::Status) => auth::status("default"),
Some(AuthCommands::Logout) => auth::logout("default"),
},
Expand Down
Loading