Skip to content

rename spaces get-all to get to align with the rest of the cli#192

Open
umair-ably wants to merge 2 commits intomainfrom
spaces-get
Open

rename spaces get-all to get to align with the rest of the cli#192
umair-ably wants to merge 2 commits intomainfrom
spaces-get

Conversation

@umair-ably
Copy link
Collaborator

@umair-ably umair-ably commented Mar 25, 2026

This PR renames all spaces * get-all subcommands to spaces * get for consistency with the rest of the CLI. For spaces locks, the two separate commands (get and get-all) are merged into a single get command where LOCKID is now optional — omitting it returns all locks, providing it returns a single lock.

@vercel
Copy link

vercel bot commented Mar 25, 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 Mar 26, 2026 1:16pm

Request Review

@claude-code-ably-assistant
Copy link

Walkthrough

This PR renames all spaces * get-all subcommands to spaces * get for consistency with the rest of the CLI. For spaces locks, the two separate commands (get and get-all) are merged into a single get command where LOCKID is now optional — omitting it returns all locks, providing it returns a single lock.

Changes

Area Files Summary
Commands src/commands/spaces/cursors/get-all.tsget.ts Renamed file and class; updated component string from cursorGetAll to cursorGet
Commands src/commands/spaces/locations/get-all.ts → (deleted), get.ts (new) Deleted old file; new get.ts is functionally equivalent with updated examples
Commands src/commands/spaces/locks/get.ts LOCKID made optional; now dispatches to locks.get() or locks.getAll() based on presence of arg; get-all.ts deleted
Commands src/commands/spaces/members/get-all.tsget.ts Renamed; also adds missing --client-id flag
Commands src/commands/spaces/cursors.ts, cursors/index.ts, locations.ts, locations/index.ts, members/index.ts, locks/index.ts Updated example strings from get-all to get
Base src/base-command.ts Added _suppressSdkErrorLogs flag to silence SDK error-level logs during teardown (e.g. Spaces cursors 80017 on disconnect)
Utils src/utils/spaces-output.ts formatLockBlock updated to accept optional indent option for consistent indentation in multi-lock output
Tests test/unit/commands/spaces/cursors/get-all.test.tsget.test.ts Renamed; error test tightened (now expects error instead of accepting any stdout)
Tests test/unit/commands/spaces/locations/get-all.test.tsget.test.ts Renamed; no logic changes
Tests test/unit/commands/spaces/members/get-all.test.tsget.test.ts Renamed; no logic changes
Tests test/unit/commands/spaces/locks/get-all.test.ts Deleted; coverage migrated into get.test.ts
Tests test/unit/commands/spaces/locks/get.test.ts Expanded with all-locks scenarios; standardArgValidationTests replaces manual arg checks; LOCKID is now optional so space-only arg is valid
Tests test/e2e/spaces/spaces-e2e.test.ts Updated get-allget in e2e cursor test
Docs README.md Regenerated to reflect renamed commands and updated locks get signature

Review Notes

  • Breaking change: Any scripts or tooling using ably spaces cursors get-all, ably spaces locations get-all, or ably spaces members get-all will break. The ably spaces locks get-all command is also removed. No deprecation shim or alias is provided.
  • Behavioral change in locks get: Previously LOCKID was required; now it is optional. This is a loosening of the argument contract, which is backwards-compatible for callers passing a lock ID but removes the guard for callers that omitted it accidentally.
  • members get gains --client-id: The old get-all command lacked this flag; the new get command includes it. Low risk, but worth confirming the flag has no unintended side-effect on the passive (non-entering) read path.
  • _suppressSdkErrorLogs in base command: This is a shared mutable flag set by SpacesBaseCommand.finally(). Reviewers should verify it's only set after run() completes and cannot suppress errors that should be visible during normal operation.
  • No migration guide or changelog entry is included — consider whether one is needed for consumers of this CLI.

"$ ably spaces locks get my-space",
"$ ably spaces locks get my-space --json",
"$ ably spaces locks get my-space my-lock",
"$ ably spaces locks get my-space my-lock --json",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"$ ably spaces locks get my-space my-lock --json",
"$ ably spaces locks get my-space my-lock --json",
"$ ably spaces locks get my-space my-lock --pretty-json",

All other spaces get commands show three examples (plain, --json, --pretty-json):

static override examples = [
"$ ably spaces locks get my-space",
"$ ably spaces locks get my-space --json",
"$ ably spaces locks get my-space my-lock",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"$ ably spaces locks get my-space my-lock",
"$ ably spaces locks get my-space lock-id",

Seems, you can query any lock by it's lock-id instead of just your own lock -> https://ably.com/docs/spaces/locking#query.
Same is applicable for all commands


try {
await this.initializeSpace(flags, spaceName, {
enterSpace: false,
Copy link
Contributor

@sacOO7 sacOO7 Mar 26, 2026

Choose a reason for hiding this comment

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

Suggested change
enterSpace: false,
enterSpace: true,

Existing bug, was trying to fix as a part of #185

  • The SDK's Locks class stores locks in a Map<lockId, Map<connectionId, Lock>> and it starts empty.
  • So, it returns empty locks even when locks are set on space
  • enterSpace: true makes sure proper syncing happens before accessing map.

Ably capabilities are operation-based, not clientId-based, so client
identity is irrelevant for pure read queries. Removed clientIdFlag from
spaces members/locations/cursors/locks get and rooms occupancy get.
Updated docs and skills to clarify when --client-id should be used.
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.

2 participants