Skip to content

[DX-1143] Docs: add environment variables usage documentation#373

Merged
umair-ably merged 13 commits intomainfrom
feature/update-env-variables-usage-docs
May 1, 2026
Merged

[DX-1143] Docs: add environment variables usage documentation#373
umair-ably merged 13 commits intomainfrom
feature/update-env-variables-usage-docs

Conversation

@sacOO7
Copy link
Copy Markdown
Contributor

@sacOO7 sacOO7 commented Apr 27, 2026

  • Fixes https://ably.atlassian.net/browse/DX-1143
  • Added ably env command and docs covering usage for all env. variables in the ably-cli source code.
  • Adds a new top-level ably env command that surfaces the environment variables supported by the CLI
    directly in the terminal.
  • The command is restricted in web CLI mode since env vars are a local-CLI configuration mechanism that
    doesn't apply when auth is managed by the surrounding web UI.

Examples

# Overview with examples for all variables
ably env    
ably env --help                                                                                               
                                                                    
# Full reference for one variable
ably env ABLY_API_KEY
ably env ABLY_TOKEN                                                                                        
ably env ABLY_ACCESS_TOKEN
ably env ABLY_ENDPOINT                                                                                                                                                                          

# Machine-readable                                                                                  
ably env ABLY_API_KEY --json

Summary

  • Add docs/ENV_VARIABLES_USAGE.md — a comprehensive reference for all 25 environment variables used by the CLI,
    organized into General Usage (auth, config, behavior, host overrides) and Development Stage Usage (debugging,
    testing, tooling, internal vars)
  • Update 8 existing docs (Auto-completion, Debugging, E2E-Testing-CLI-Runner, Exit-Codes, Interactive-REPL,
    Project-Structure, Testing, Troubleshooting) with "Related" cross-link sections for improved discoverability
  • Fix minor issues: typo in Interactive-REPL.md ("taht" → "that"), add text language tags to fenced code blocks,
    correct ABLY_API_KEYE2E_ABLY_API_KEY in Testing.md, clarify exit code descriptions and history trimming
    behavior

Highlights

  • Auth resolution order documented with precedence rules and login-bypass behavior for each auth variable
  • CI/CD usage patterns with GitHub Actions examples for scripted and one-shot usage
  • Source code cross-reference table mapping each env var to its source files (useful for LLM agents and
    contributors)
  • Commands-by-auth-type tables showing which command groups use data plane vs Control API auth

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cli-web-cli Ready Ready Preview, Comment May 1, 2026 10:58am

Request Review

@sacOO7 sacOO7 requested a review from Copilot April 27, 2026 07:55
@sacOO7 sacOO7 changed the title docs: add environment variables reference and cross-link documentation [DX-1143] Docs: add environment variables reference and cross-link documentation Apr 27, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a centralized documentation reference for all Ably CLI environment variables and improves discoverability by cross-linking related docs across the contributor documentation set.

Changes:

  • Introduces docs/ENV_VARIABLES_USAGE.md as a comprehensive reference for CLI environment variables (auth, config, behavior, dev/test/internal modes).
  • Adds “Related” cross-link sections to multiple existing docs to make the env var reference and adjacent guides easier to find.
  • Applies small doc corrections (e.g., code fence language tags, typo fix, and E2E env var naming in Testing docs).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/ENV_VARIABLES_USAGE.md New comprehensive env var reference and cross-links (some auth precedence/details need correction per review comments).
docs/Troubleshooting.md Adds text code fences, clarifies interactive exit/history behavior, and adds related links.
docs/Testing.md Fixes E2E env var naming, adds env var cross-links, and adds a “Related” section.
docs/Project-Structure.md Adds “Related” cross-links (including env var reference).
docs/Interactive-REPL.md Fixes typo, clarifies history env var, adds “Related” section.
docs/Exit-Codes.md Adds “Related” section and minor formatting tweak.
docs/E2E-Testing-CLI-Runner.md Adds text code fences, whitespace cleanup, and “Related” links.
docs/Debugging.md Adds terminal diagnostics example, config override example, and “Related” links.
docs/Auto-completion.md Notes ABLY_SHOW_DEV_FLAGS impact and adds “Related” links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/Environment-Variables/General-Usage.md Outdated
Comment thread docs/ENV_VARIABLES_USAGE.md Outdated
Comment thread docs/ENV_VARIABLES_USAGE.md Outdated
Comment thread docs/Environment-Variables/General-Usage.md Outdated
Comment thread docs/ENV_VARIABLES_USAGE.md Outdated
@sacOO7 sacOO7 marked this pull request as ready for review April 27, 2026 08:23
@sacOO7 sacOO7 changed the title [DX-1143] Docs: add environment variables reference and cross-link documentation [DX-1143] Docs: add environment variables usage doc with reference from web doc Apr 27, 2026
claude-code-ably-assistant[bot]

This comment was marked as duplicate.

Copy link
Copy Markdown

@claude-code-ably-assistant claude-code-ably-assistant Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete - see detailed findings below

@sacOO7 sacOO7 changed the title [DX-1143] Docs: add environment variables usage doc with reference from web doc [DX-1143] Docs: add environment variables usage documentation Apr 27, 2026
@sacOO7 sacOO7 force-pushed the feature/update-env-variables-usage-docs branch from 5330228 to 244b63e Compare April 27, 2026 10:31
@sacOO7 sacOO7 requested a review from Copilot April 27, 2026 10:32
@sacOO7
Copy link
Copy Markdown
Contributor Author

sacOO7 commented Apr 27, 2026

@claude review

Copy link
Copy Markdown

@claude-code-ably-assistant claude-code-ably-assistant Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Documentation-only PR — Factual Accuracy Check

This PR adds a comprehensive env var reference doc and cross-links it from 8 existing docs. The structure and content are solid overall. I found three factual errors worth fixing before merge.


Issue 1 — stats commands misplaced in the Data Plane table (significant)

File: docs/ENV_VARIABLES_USAGE.md, "Commands by Auth Type" → Data Plane section

The table lists stats | (all) under Data Plane (ABLY_API_KEY / ABLY_TOKEN), but stats commands extend ControlBaseCommand and call the Control API. They need ABLY_ACCESS_TOKEN, not ABLY_API_KEY.

// src/stats-base-command.ts
export abstract class StatsBaseCommand extends ControlBaseCommand {

A user who reads this doc and tries ABLY_API_KEY="..." ably stats app will get an unexpected auth failure, since they needed ABLY_ACCESS_TOKEN instead.

Fix: Move stats | app, account to the Control API table.


Issue 2 — connections: list doesn't exist (significant)

File: docs/ENV_VARIABLES_USAGE.md, Data Plane table

The table shows connections | list, but there is no connections list command. The actual subcommand is connections test.

src/commands/connections/
  index.ts   (topic command, not leaf)
  test.ts    ← the only real leaf command

Fix: Change listtest.


Issue 3 — Source file table: ABLY_APP_ID row has wrong count and missing files (minor)

File: docs/ENV_VARIABLES_USAGE.md, "Source Code Reference" table

The row reads:

src/commands/auth/*.ts (12 files) → ABLY_APP_ID

The actual count of auth files using ABLY_APP_ID is 10, and the variable is also used in two non-auth files that aren't listed:

  • src/commands/channels/inspect.ts
  • src/commands/apps/delete.ts

(Total 12 files, but not all in auth/.)

Fix: Correct the row to reflect the actual file set, or simplify to a pattern that covers all 12.

Copy link
Copy Markdown

@claude-code-ably-assistant claude-code-ably-assistant Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. Three factual errors in ENV_VARIABLES_USAGE.md: (1) stats commands are in the wrong table — they use the Control API, not data plane; (2) connections: list doesn't exist, the subcommand is connections test; (3) the source file table counts 12 auth files for ABLY_APP_ID but only 10 are in auth/ — the other two are in channels/ and apps/. Everything else checked out: auth resolution order, ABLY_TOKEN banner suppression note, env var count (25), and the cross-links in other docs are all accurate.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a comprehensive environment-variable reference for the Ably CLI and cross-links it from other contributor docs to improve discoverability and reduce “tribal knowledge” around auth/config/test/debug behavior.

Changes:

  • Added docs/ENV_VARIABLES_USAGE.md as a central reference for all CLI env vars (plus test-runner env vars).
  • Updated multiple existing docs with “Related” sections linking to the new reference and to each other.
  • Made small doc fixes (code-fence language tags, a typo fix, clarified exit code/history trimming notes, and corrected E2E API key naming in Testing docs).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/Troubleshooting.md Adds env-var guidance (ABLY_CLI_CONFIG_DIR, history trimming note) and cross-links to the new env-var reference.
docs/Testing.md Clarifies E2E credential env var name (E2E_ABLY_API_KEY) and adds cross-links to env-var reference + E2E runner docs.
docs/Project-Structure.md Adds “Related” links to env-var reference and other key contributor docs.
docs/Interactive-REPL.md Fixes typo and documents ABLY_HISTORY_FILE; adds related links to env-var reference.
docs/Exit-Codes.md Adds “Related” links to env-var reference and interactive mode docs.
docs/ENV_VARIABLES_USAGE.md Introduces the new comprehensive env-var reference (auth/config/behavior/dev/testing/internal).
docs/E2E-Testing-CLI-Runner.md Adds “Related” section linking into env-var reference and other contributor docs.
docs/Debugging.md Adds TERMINAL_DIAGNOSTICS mention and related links to env-var reference.
docs/Auto-completion.md Notes ABLY_SHOW_DEV_FLAGS impact and adds related links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/ENV_VARIABLES_USAGE.md Outdated
Comment thread docs/ENV_VARIABLES_USAGE.md Outdated
Comment thread docs/E2E-Testing-CLI-Runner.md Outdated
@sacOO7
Copy link
Copy Markdown
Contributor Author

sacOO7 commented Apr 27, 2026

@claude review

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a dedicated reference doc for all environment variables used by ably-cli and improves documentation discoverability by cross-linking relevant docs to that reference.

Changes:

  • Added docs/ENV_VARIABLES_USAGE.md, documenting all CLI env vars (auth/config/behavior/dev/internal) plus source-code cross references.
  • Updated multiple existing docs to add “Related” sections linking back to the env-var reference (and other key docs).
  • Misc doc fixes: code fence language tags, a typo fix, and some clarifications around testing/auth and interactive history/exit codes.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docs/ENV_VARIABLES_USAGE.md New comprehensive env-var reference, including precedence, behavior notes, and source-code mapping table.
docs/Troubleshooting.md Adds env-var pointers and clarifies interactive/history troubleshooting; adds Related links.
docs/Testing.md Corrects E2E credential var naming, adds env-var pointers, and adds Related links.
docs/Project-Structure.md Adds Related links to help navigate to env-var reference and other docs.
docs/Interactive-REPL.md Fixes typo, clarifies history env var, and adds Related links.
docs/Exit-Codes.md Adds Related links for env vars impacting interactive mode.
docs/E2E-Testing-CLI-Runner.md Improves code block tagging, trims whitespace, and adds Related links with env-var notes.
docs/Debugging.md Adds terminal diagnostics + config override examples and Related links.
docs/Auto-completion.md Adds note about ABLY_SHOW_DEV_FLAGS and Related links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/ENV_VARIABLES_USAGE.md Outdated
Comment thread docs/ENV_VARIABLES_USAGE.md Outdated
Comment thread docs/Troubleshooting.md Outdated
@sacOO7 sacOO7 force-pushed the feature/update-env-variables-usage-docs branch from 35d4a82 to 0061a7b Compare April 27, 2026 11:36
@sacOO7 sacOO7 requested a review from AndyTWF April 27, 2026 11:41
@sacOO7 sacOO7 force-pushed the feature/update-env-variables-usage-docs branch from 0061a7b to 87b921c Compare April 27, 2026 11:43

> For development, testing, debugging, and internal variables, see [Development Stage Usage](Development-Usage.md).

---
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything below this line can be deleted with your newest changes imo

| [`ABLY_CURRENT_COMMAND`](#ably_current_command) | Internal | Current command tracking | Set automatically |
| [`NODE_ENV`](#node_env) | Internal | Node environment override | Not set |

---
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything below this line can also go...

The quick reference above already makes it very clear what each one does + they're only internal dev flags. Also, way less to maintain

@umair-ably umair-ably mentioned this pull request May 1, 2026
6 tasks
@sacOO7 sacOO7 dismissed claude-code-ably-assistant[bot]’s stale review May 1, 2026 10:12

Outdated review, all comments are well addressed

sacOO7 and others added 10 commits May 1, 2026 11:35
…k all docs

Add ENV_VARIABLES_USAGE.md documenting all 25 environment variables with
usage examples, auth resolution order, CI/CD patterns, and source code
cross-references. Update existing docs with Related sections for better
discoverability. Fix minor typos and add fenced code block language tags.
…o avoid

bloating in a single page, updated references across other docs
…info

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@umair-ably umair-ably force-pushed the feature/update-env-variables-usage-docs branch from 7b69e49 to 00cd1aa Compare May 1, 2026 10:35
Comment thread src/data/env-vars.ts Outdated
new DetailSection("Client ID", [
{
kind: "paragraph",
text: "`--client-id` is ignored when `ABLY_TOKEN` is set — the client ID is embedded in the token. A warning is logged if `--client-id` is passed.",
Copy link
Copy Markdown
Contributor Author

@sacOO7 sacOO7 May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to delete

--client-id` is ignored when `ABLY_TOKEN` is set — the client ID is embedded in the token. A warning is logged if `--client-id` is passed.` ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh one sec.. some of these changes should not be in here

Comment thread src/data/env-vars.ts Outdated
new DetailSection("Login bypass", [
{
kind: "paragraph",
text: "Bypasses the `ably login` workflow and skips interactive app/key selection. Useful in scripts and CI/CD pipelines.",
Copy link
Copy Markdown
Contributor Author

@sacOO7 sacOO7 May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous review comment at https://ably-real-time.slack.com/archives/D06FYTN91U5/p1777574075208169 mentioned to move login bypass per command help page. Do we intentionally want to remove it?

…sential info"

This reverts commit 00cd1aa.

The trim removed detailed sections that should be kept (e.g. client ID
behavior for ABLY_API_KEY/ABLY_TOKEN, login bypass notes, scope details
for ABLY_CLI_NON_INTERACTIVE, and per-variable property tables/examples
in the docs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…l sections

Re-applies the trim of docs (Development-Usage, General-Usage,
Troubleshooting), src/commands/env.ts, env-vars.ts cosmetic changes,
and test updates from 00cd1aa, but keeps the per-variable
DetailSection blocks in src/data/env-vars.ts (Login bypass, Client ID,
Token expiry, Scope) so the focused single-variable view still surfaces
the substantive guidance.

Tests that asserted on the trimmed-only details shape were updated to
match the restored content (length checks bumped to actual counts; the
ABLY_TOKEN issue-token assertion now relies on the substring check
alone; renderSingleVar line cap raised from 20 to 30).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The minimal `ably env` view no longer renders the Prerequisites or
Examples headings — it shows the per-variable summary table prefixed
with `ably env <NAME>` and the `ably env --help` footer instead.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor Author

@sacOO7 sacOO7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@umair-ably umair-ably enabled auto-merge (squash) May 1, 2026 10:58
@umair-ably umair-ably merged commit fb7b371 into main May 1, 2026
11 checks passed
@umair-ably umair-ably deleted the feature/update-env-variables-usage-docs branch May 1, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants