diff --git a/AGENTS.md b/AGENTS.md index f405a18..5bc120f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -16,7 +16,7 @@ Staging is a config override for Amendable developers, not a different command s - `AMENDABLE_API_URL=https://stage.api.amendable.io` - `AMENDABLE_APP_URL=https://stage.amendable.io` -Do not document those URL env vars in customer docs (`../amendable-docs`). Hardcode production hosts there. +`--staging` is hidden from `amendable --help`. Keep it that way. Do not put staging hostnames, `--staging`, or `AMENDABLE_API_URL` / `AMENDABLE_APP_URL` in `README.md` or customer docs (`../amendable-docs`). Hardcode production hosts there. Staging URLs stay in this file and in `src/config.rs`. Config file: `~/.config/amendable/config.toml` (mode `0600`). diff --git a/README.md b/README.md index 389579c..12df4ef 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,7 @@ amendable repo create hello amendable repo clone hello ``` -Defaults are production (`https://api.amendable.io`). Change hosts only when developing Amendable against the staging server: - -```bash -amendable login --staging -# or -export AMENDABLE_API_URL=https://stage.api.amendable.io -export AMENDABLE_APP_URL=https://stage.amendable.io -``` +Talks to `https://api.amendable.io` by default. ## Install from a checkout diff --git a/src/cli.rs b/src/cli.rs index 692243d..fbc8dfe 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -22,8 +22,8 @@ use crate::error::Error; arg_required_else_help = true )] struct Cli { - /// Talk to stage.amendable.io (site, Git, and stage.api.amendable.io). - #[arg(long, global = true)] + /// Internal: talk to the Amendable staging server. + #[arg(long, global = true, hide = true)] staging: bool, #[command(subcommand)] command: Commands, diff --git a/tests/cli.rs b/tests/cli.rs index 2186cf3..3472678 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -243,6 +243,27 @@ fn missing_token_fails() { .stderr(contains("Not logged in")); } +#[test] +fn help_omits_staging() { + Command::cargo_bin("amendable") + .expect("binary") + .arg("--help") + .assert() + .success() + .stdout(contains("--staging").not()) + .stdout(contains("stage.amendable.io").not()) + .stdout(contains("stage.api.amendable.io").not()); +} + +#[test] +fn hidden_staging_flag_is_accepted() { + Command::cargo_bin("amendable") + .expect("binary") + .args(["--staging", "--help"]) + .assert() + .success(); +} + #[test] fn git_credential_get() { let server = MockApiServer::start();