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 AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`).

Expand Down
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
21 changes: 21 additions & 0 deletions tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading