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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ jobs:
- uses: actions/checkout@v6
with:
persist-credentials: true
repository: "NeoScript/homebrew-fbadmin"
repository: "NeoScript/homebrew-fire-auth"
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
# So we have access to the formula
- name: Fetch homebrew formulae
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Project overview

**fbadmin** is a Rust CLI for Firebase Authentication administration. It wraps the `rs-firebase-admin-sdk` crate and provides subcommands for user management, custom claims, auth action links, and emulator utilities.
**fire-auth** is a Rust CLI for Firebase Authentication administration. It wraps the `rs-firebase-admin-sdk` crate and provides subcommands for user management, custom claims, auth action links, and emulator utilities.

## Repository layout

Expand Down Expand Up @@ -33,7 +33,7 @@ Cargo.toml # Dependencies, package metadata, profiles
- **Error handling**: SDK calls return `Result<T, error_stack::Report<ApiClientError>>`. Use the `IntoAnyhow` trait (`.into_anyhow()`) to convert, then chain `.context("human-readable message")` for user-facing errors.
- **Interactive prompts**: When a required arg is `None`, command modules call `prompt::resolve_email()` or similar. These use `dialoguer` and are TTY-aware.
- **Output**: Always go through `output.rs` helpers (`render_single_record`, `render_table`, `render_success`, etc.) — they handle `--format` switching (table/json/csv) and colored output.
- **Config resolution**: Profile is resolved from CLI flag → `FBADMIN_PROFILE` env → `default_profile` in config. Connection merges profile settings with CLI overrides. See `config::resolve_connection()`.
- **Config resolution**: Profile is resolved from CLI flag → `FIRE_AUTH_PROFILE` env → `default_profile` in config. Connection merges profile settings with CLI overrides. See `config::resolve_connection()`.
- **Firebase init**: `firebase::init_firebase()` takes an `AuthBackend` enum (Emulator or Live with optional credentials/project). The `build_auth` helper in command modules wires config → AuthBackend → FirebaseAuth.
- **Logging**: `tracing` with `tracing-subscriber`. Controlled by `-v` flag count. Logs go to stderr. Use `tracing::debug!` for internal details, `tracing::info!` for notable operations.

Expand Down
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[package]
name = "fbadmin"
version = "0.1.0"
name = "firebase-auth-cli"
version = "0.2.0"
edition = "2024"
rust-version = "1.94"
description = "Firebase Auth administration CLI"
license = "AGPL-3.0-only"
repository = "https://github.com/NeoScript/firebase-admin-cli"
homepage = "https://github.com/NeoScript/firebase-admin-cli"
repository = "https://github.com/NeoScript/firebase-auth-cli"
homepage = "https://github.com/NeoScript/firebase-auth-cli"

[[bin]]
name = "fire-auth"
path = "src/main.rs"

[dependencies]
anyhow = "1"
Expand Down
114 changes: 57 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# fbadmin
# fire-auth

A command-line tool for managing Firebase Authentication — users, custom claims, auth action links, and emulator utilities.

Expand All @@ -14,121 +14,121 @@ cargo install --path .

```bash
# Interactive setup — creates a named profile
fbadmin config init
fire-auth config init

# Or connect directly with flags / env vars
fbadmin --credentials ~/sa-key.json users list
fbadmin -e localhost:9099 emulator clear-users
export FBADMIN_PROJECT=my-project
fbadmin users count
fire-auth --credentials ~/sa-key.json users list
fire-auth -e localhost:9099 emulator clear-users
export FIRE_AUTH_PROJECT=my-project
fire-auth users count
```

## Authentication

fbadmin resolves credentials in this order:
fire-auth resolves credentials in this order:

1. `--credentials` / `FBADMIN_CREDENTIALS` — path to a service account JSON file
2. `--project` / `FBADMIN_PROJECT` — project ID using Application Default Credentials
3. `--emulator-host` / `FBADMIN_EMULATOR_HOST` — connect to the Firebase Auth emulator
1. `--credentials` / `FIRE_AUTH_CREDENTIALS` — path to a service account JSON file
2. `--project` / `FIRE_AUTH_PROJECT` — project ID using Application Default Credentials
3. `--emulator-host` / `FIRE_AUTH_EMULATOR_HOST` — connect to the Firebase Auth emulator
4. Profile settings from config (see below)

## Configuration

Profiles store connection settings so you don't need to pass flags every time.

```bash
fbadmin config init # Guided wizard
fbadmin config add prod --credentials ~/keys/prod-sa.json
fbadmin config add local --emulator-host localhost:9099
fbadmin config default prod # Set the default profile
fbadmin config list # Show all profiles
fbadmin config which # Show resolved connection chain
fbadmin config path # Print config file locations
fire-auth config init # Guided wizard
fire-auth config add prod --credentials ~/keys/prod-sa.json
fire-auth config add local --emulator-host localhost:9099
fire-auth config default prod # Set the default profile
fire-auth config list # Show all profiles
fire-auth config which # Show resolved connection chain
fire-auth config path # Print config file locations
```

Global config is stored by `confy` in the OS-appropriate location. A local `.fbadmin.toml` in the working directory is merged on top (field-level override).
Global config is stored by `confy` in the OS-appropriate location. A local `.fire-auth.toml` in the working directory is merged on top (field-level override).

## Commands

### Users

```bash
fbadmin users get --email user@example.com
fbadmin users get --uid abc123
fbadmin users create --email new@example.com
fbadmin users create --email new@example.com --password s3cret --display-name "Jane Doe"
fbadmin users disable --email user@example.com
fbadmin users enable --email user@example.com
fbadmin users remove --csv uids.csv # Bulk delete from CSV
fbadmin users list --limit 50
fbadmin users list-inactive --days 90
fbadmin users count
fire-auth users get --email user@example.com
fire-auth users get --uid abc123
fire-auth users create --email new@example.com
fire-auth users create --email new@example.com --password s3cret --display-name "Jane Doe"
fire-auth users disable --email user@example.com
fire-auth users enable --email user@example.com
fire-auth users remove --csv uids.csv # Bulk delete from CSV
fire-auth users list --limit 50
fire-auth users list-inactive --days 90
fire-auth users count
```

Missing required arguments are prompted interactively when running in a terminal. Passwords are auto-generated if omitted.

### Custom claims

```bash
fbadmin claims get --email user@example.com
fbadmin claims merge role admin --email user@example.com
fbadmin claims merge tier 2 --email user@example.com # Auto-detects int
fbadmin claims merge prefs '{"dark":true}' --email user@example.com # JSON
fbadmin claims remove role --email user@example.com
fbadmin claims clear --email user@example.com
fbadmin claims find admin # Find all users with "admin" claim
fbadmin claims find role admin --exclusive # Only where role is the sole claim
fire-auth claims get --email user@example.com
fire-auth claims merge role admin --email user@example.com
fire-auth claims merge tier 2 --email user@example.com # Auto-detects int
fire-auth claims merge prefs '{"dark":true}' --email user@example.com # JSON
fire-auth claims remove role --email user@example.com
fire-auth claims clear --email user@example.com
fire-auth claims find admin # Find all users with "admin" claim
fire-auth claims find role admin --exclusive # Only where role is the sole claim
```

Use `--dry-run` with `merge`, `remove`, and `clear` to preview changes without writing.

### Auth action links

```bash
fbadmin links password-reset --email user@example.com
fbadmin links email-verify --email user@example.com
fbadmin links sign-in --email user@example.com
fire-auth links password-reset --email user@example.com
fire-auth links email-verify --email user@example.com
fire-auth links sign-in --email user@example.com
```

### Emulator

These commands only work when connected to an emulator.

```bash
fbadmin -e localhost:9099 emulator clear-users
fbadmin -e localhost:9099 emulator config
fire-auth -e localhost:9099 emulator clear-users
fire-auth -e localhost:9099 emulator config
```

### Connection info

```bash
fbadmin info # Shows resolved profile, project, credentials, and verifies connectivity
fire-auth info # Shows resolved profile, project, credentials, and verifies connectivity
```

## Global flags


| Flag | Short | Env var | Description |
| ----------------- | ----- | ----------------------- | ------------------------------------- |
| `--profile` | `-p` | `FBADMIN_PROFILE` | Named profile from config |
| `--project` | | `FBADMIN_PROJECT` | Firebase project ID |
| `--credentials` | `-c` | `FBADMIN_CREDENTIALS` | Path to service account JSON |
| `--emulator-host` | `-e` | `FBADMIN_EMULATOR_HOST` | Emulator host:port |
| `--format` | `-f` | | Output format: `table`, `json`, `csv` |
| `--dry-run` | | | Preview destructive operations |
| `--yes` | `-y` | | Skip confirmation prompts |
| `--verbose` | `-v` | | Increase verbosity (`-vv`, `-vvv`) |
| Flag | Short | Env var | Description |
| ----------------- | ----- | ------------------------ | ------------------------------------- |
| `--profile` | `-p` | `FIRE_AUTH_PROFILE` | Named profile from config |
| `--project` | | `FIRE_AUTH_PROJECT` | Firebase project ID |
| `--credentials` | `-c` | `FIRE_AUTH_CREDENTIALS` | Path to service account JSON |
| `--emulator-host` | `-e` | `FIRE_AUTH_EMULATOR_HOST`| Emulator host:port |
| `--format` | `-f` | | Output format: `table`, `json`, `csv` |
| `--dry-run` | | | Preview destructive operations |
| `--yes` | `-y` | | Skip confirmation prompts |
| `--verbose` | `-v` | | Increase verbosity (`-vv`, `-vvv`) |


## Output formats

```bash
fbadmin users list -f table # Human-readable table (default)
fbadmin users list -f json # NDJSON — one JSON object per line
fbadmin users list -f csv # CSV with headers
fbadmin claims get --email user@example.com -f json # Single record as JSON
fire-auth users list -f table # Human-readable table (default)
fire-auth users list -f json # NDJSON — one JSON object per line
fire-auth users list -f csv # CSV with headers
fire-auth claims get --email user@example.com -f json # Single record as JSON
```

## License

AGPL-3.0-only — see [LICENSE](LICENSE).
AGPL-3.0-only — see [LICENSE](LICENSE).
10 changes: 10 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# v0.2.0

Renamed from `fbadmin` to `fire-auth`.

- **Binary**: `fbadmin` → `fire-auth`
- **Package**: `fbadmin` → `firebase-auth-cli`
- **Env vars**: `FBADMIN_*` → `FIRE_AUTH_*`
- **Config**: confy app name `fire-auth`, local override `.fire-auth.toml`
- **Homebrew tap**: `NeoScript/homebrew-fbadmin` → `NeoScript/homebrew-fire-auth`

# v0.1.0

Initial release of fbadmin — Firebase Auth administration CLI.
Expand Down
2 changes: 1 addition & 1 deletion dist-workspace.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ installers = ["shell", "powershell", "homebrew"]
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"]
# Homebrew tap
tap = "NeoScript/homebrew-fbadmin"
tap = "NeoScript/homebrew-fire-auth"
publish-jobs = ["homebrew"]
14 changes: 7 additions & 7 deletions docs/RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Releasing fbadmin
# Releasing fire-auth

Releases are automated via [cargo-dist](https://opensource.axo.dev/cargo-dist/). Pushing a semver tag triggers GitHub Actions which builds binaries, creates a GitHub Release, and publishes a Homebrew formula.

## Prerequisites

- Push access to `NeoScript/firebase-admin-cli`
- `HOMEBREW_TAP_TOKEN` repo secret set on `firebase-admin-cli` — a fine-grained PAT with **Contents: Read and write** on `NeoScript/homebrew-fbadmin`
- Push access to `NeoScript/firebase-auth-cli`
- `HOMEBREW_TAP_TOKEN` repo secret set on `firebase-auth-cli` — a fine-grained PAT with **Contents: Read and write** on `NeoScript/homebrew-fire-auth`

## Release checklist

Expand Down Expand Up @@ -45,7 +45,7 @@ Releases are automated via [cargo-dist](https://opensource.axo.dev/cargo-dist/).
git push origin main --tags
```

6. **Monitor** the Release workflow at https://github.com/NeoScript/firebase-admin-cli/actions
6. **Monitor** the Release workflow at https://github.com/NeoScript/firebase-auth-cli/actions

## What the workflow does

Expand All @@ -60,7 +60,7 @@ The `release.yml` workflow:
- `x86_64-pc-windows-msvc` (Windows x64)
3. **build-global-artifacts** — generates shell/powershell installer scripts and checksums
4. **host** — creates the GitHub Release and uploads all artifacts
5. **publish-homebrew-formula** — pushes a `.rb` formula to `NeoScript/homebrew-fbadmin`
5. **publish-homebrew-formula** — pushes a `.rb` formula to `NeoScript/homebrew-fire-auth`
6. **announce** — finalizes the release

## Configuration
Expand All @@ -73,7 +73,7 @@ cargo-dist-version = "0.31.0"
ci = "github"
installers = ["shell", "powershell", "homebrew"]
targets = [...]
tap = "NeoScript/homebrew-fbadmin"
tap = "NeoScript/homebrew-fire-auth"
publish-jobs = ["homebrew"]
```

Expand All @@ -96,6 +96,6 @@ To change targets, installers, or upgrade cargo-dist, edit this file and run `di
git push origin vX.Y.Z
```

- **Homebrew publish failed**: verify the `HOMEBREW_TAP_TOKEN` secret is set and the PAT hasn't expired. The token needs **Contents: Read and write** on `NeoScript/homebrew-fbadmin`.
- **Homebrew publish failed**: verify the `HOMEBREW_TAP_TOKEN` secret is set and the PAT hasn't expired. The token needs **Contents: Read and write** on `NeoScript/homebrew-fire-auth`.

- **Build failed for a target**: check the build logs in GitHub Actions. Common causes are missing system deps for cross-compilation or Rust version mismatches.
6 changes: 3 additions & 3 deletions src/commands/config_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async fn add(
{
bail!(
"At least one of --project, --credentials, or --emulator-host is required.\n\
Use 'fbadmin config init' for an interactive wizard."
Use 'fire-auth config init' for an interactive wizard."
);
}

Expand Down Expand Up @@ -152,7 +152,7 @@ async fn list(cli: &Cli) -> Result<()> {
let config = load_config()?;

if config.profiles.is_empty() {
render_message("No profiles configured. Run 'fbadmin config init' to create one.");
render_message("No profiles configured. Run 'fire-auth config init' to create one.");
return Ok(());
}

Expand Down Expand Up @@ -267,7 +267,7 @@ async fn path(_cli: &Cli) -> Result<()> {
let global_path = config_dir()?;
render_message(&format!("Global: {}", global_path.display()));

let local_path = std::path::PathBuf::from(".fbadmin.toml");
let local_path = std::path::PathBuf::from(".fire-auth.toml");
if local_path.exists() {
render_message(&format!("Local: {}", local_path.display()));
} else {
Expand Down
Loading