Skip to content

Add bm cloud share command (create / list / unshare) #880

Closed

Description

@groksrc

Problem

There's no way to create or revoke a public share of a note from the CLI. The cloud product fully supports public shares, and the cloud API already exposes the endpoints — but bm cloud has no command to reach them. Today sharing is only doable from the web UI.

Existing cloud share API (in basic-memory-cloud, apps/cloud/src/basic_memory_cloud/api/public_shares.py):

Method Path Purpose
POST /api/shares Create a share (project_name, note_permalink, optional expires_at)
GET /api/shares List shares
PATCH /api/shares/{token} Enable/disable, set expiration
DELETE /api/shares/{token} Revoke/delete the share

There is no share-related code in this repo (basic-memory) at all today — it's purely a cloud concern that the CLI has never surfaced.

Proposed solution

Add a bm cloud share subcommand group under src/basic_memory/cli/commands/cloud/ (new shares.py, registered with cloud_app.add_typer(..., name="share")), using the existing make_api_request() helper + ConfigManager().config.cloud_host pattern that snapshot.py / core_commands.py already use.

Suggested surface:

  • bm cloud share <project> <note-permalink> [--expires-at <date>] → POST /api/shares; print the resulting share_url
  • bm cloud share list [--project <name>] → GET /api/shares
  • Unshare → DELETE /api/shares/{token}. Two options on the table:
    • bm cloud unshare <token> (dedicated command), or
    • bm cloud share --delete <token> (flag on the share command)

Open questions

  • Unshare ergonomics: dedicated unshare command vs. share --delete? A dedicated bm cloud share revoke <token> subcommand may read most consistently with the group style.
  • Revoke vs. disable: DELETE revokes; PATCH {enabled:false} disables without deleting. Do we want both (revoke and an --enable/--disable toggle), or is delete-only enough for v1?
  • Note identifier: the create endpoint takes note_permalink + project_name. Should the CLI accept a friendlier note path/title and resolve it, or require the exact permalink?

Related

  • basicmachines-co/basic-memory-cloud#1015 (Share note from the web context menu — same underlying share API)

Activity

  1. added
    enhancement
    cloud
    on Jun 1, 2026
  2. claude commented on Jun 1, 2026

    @claude
    Contributor

    Claude finished @groksrc's task in 1m 23s —— View job


    Issue Triage

    • Gather context and read issue
    • Examine existing cloud CLI code for context
    • Check for duplicate issues
    • Add appropriate labels
    • Provide triage assessment

    Analysis

    Type: Feature Request — new CLI command group to surface existing cloud API endpoints

    Priority: Medium — the cloud API already supports shares; this is a CLI convenience gap, not a blocker

    Component: CLI / Cloud

    Complexity: Medium — the implementation pattern is well-established (snapshot.py is a near-exact template), but there are open design questions that need resolution before coding begins

    Duplicates: None found.


    Implementation Notes

    The snapshot.py / workspace.py commands are the right template. The pattern is:

    1. Create src/basic_memory/cli/commands/cloud/shares.py with a shares_app = typer.Typer(...)
    2. Add subcommands: create, list, revoke (and optionally disable/enable via PATCH)
    3. Register in __init__.py: cloud_app.add_typer(shares_app, name="share")

    All auth, error handling, and config lookup (ConfigManager().config.cloud_host) is already handled by make_api_request() in api_client.py.

    Open Design Questions (from the issue)

    These should be resolved before implementation:

    1. Unshare ergonomics — bm cloud share revoke <token> reads cleanly as a subcommand of the share group, consistent with bm cloud snapshot delete. Recommend this over a top-level bm cloud unshare.

    2. Revoke vs. disable — For v1, delete-only (DELETE /api/shares/{token}) is sufficient. A --enable/--disable toggle (PATCH) can come later if there's demand.

    3. Note identifier — Accepting a friendly title/path and resolving it to a permalink adds complexity. For v1, requiring the exact permalink keeps scope minimal and avoids a round-trip lookup. The list output can display permalinks so users can copy-paste.

    Suggested minimal v1 surface:

    bm cloud share create <project> <permalink> [--expires-at <date>]   # POST /api/shares
    bm cloud share list [--project <name>]                               # GET  /api/shares
    bm cloud share revoke <token>                                        # DELETE /api/shares/{token}
    
  3. added this to the v0.23 milestone on Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cloudenhancement

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions