Skip to content

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

@groksrc

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    cloudBasic Memory CloudenhancementNew feature or request
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions