Skip to content

Commit 2cde8d2

Browse files
committed
clean up cli commands
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent 9515130 commit 2cde8d2

30 files changed

Lines changed: 1852 additions & 1844 deletions

docs/SPEC-PER-PROJECT-ROUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ When explicit routing is active, project mode does not override the selected rou
4545
"main": {
4646
"path": "/Users/me/basic-memory",
4747
"mode": "local",
48-
"cloud_sync_path": null,
48+
"local_sync_path": null,
4949
"bisync_initialized": false,
5050
"last_sync": null
5151
},
5252
"specs": {
5353
"path": "specs",
5454
"mode": "cloud",
55-
"cloud_sync_path": "/Users/me/dev/specs",
55+
"local_sync_path": "/Users/me/dev/specs",
5656
"bisync_initialized": true,
5757
"last_sync": "2026-02-06T17:36:38.544153"
5858
}

docs/cloud-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ bm project sync-setup research ~/Documents/research
120120

121121
When you add a project with `--local-path`:
122122
1. Project created on cloud at `/app/data/research`
123-
2. Local path stored in config for that project (`cloud_sync_path`)
123+
2. Local path stored in config for that project (`local_sync_path`)
124124
3. Local directory created if it doesn't exist
125125
4. Bisync state directory created at `~/.basic-memory/bisync-state/research/`
126126

src/basic_memory/cli/commands/__init__.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
project,
99
format,
1010
schema,
11-
watch,
12-
workspace,
1311
)
1412

1513
__all__ = [
@@ -25,6 +23,4 @@
2523
"project",
2624
"format",
2725
"schema",
28-
"watch",
29-
"workspace",
3026
]

src/basic_memory/cli/commands/cloud/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
from basic_memory.cli.commands.cloud.core_commands import * # noqa: F401,F403
77
from basic_memory.cli.commands.cloud.api_client import get_authenticated_headers, get_cloud_config # noqa: F401
88
from basic_memory.cli.commands.cloud.upload_command import * # noqa: F401,F403
9+
from basic_memory.cli.commands.cloud.project_sync import * # noqa: F401,F403
910

1011
# Register snapshot sub-command group
1112
from basic_memory.cli.commands.cloud.snapshot import snapshot_app
13+
from basic_memory.cli.commands.cloud.workspace import workspace_app
1214

1315
cloud_app.add_typer(snapshot_app, name="snapshot")
16+
cloud_app.add_typer(workspace_app, name="workspace")
1417

1518
# Register restore command (directly on cloud_app via decorator)
1619
from basic_memory.cli.commands.cloud.restore import restore # noqa: F401, E402

src/basic_memory/cli/commands/cloud/core_commands.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def status() -> None:
113113
has_credentials = bool(config.cloud_api_key) or tokens is not None
114114
if not has_credentials:
115115
console.print(
116-
"\n[dim]No cloud credentials found. Run: bm cloud login or bm cloud set-key <key>[/dim]"
116+
"\n[dim]No cloud credentials found. Run: bm cloud login or bm cloud api-key save <key>[/dim]"
117117
)
118118
return
119119

@@ -140,7 +140,7 @@ def status() -> None:
140140
except CloudAPIError as e:
141141
console.print(f"[yellow]Cloud health check failed: {e}[/yellow]")
142142
console.print(
143-
"[dim]Try re-authenticating with 'bm cloud login' or setting API key with 'bm cloud set-key'.[/dim]"
143+
"[dim]Try re-authenticating with 'bm cloud login' or setting API key with 'bm cloud api-key save'.[/dim]"
144144
)
145145
except Exception as e:
146146
console.print(f"[yellow]Unexpected health check error: {e}[/yellow]")
@@ -219,17 +219,22 @@ def promo(enabled: bool = typer.Option(True, "--on/--off", help="Enable or disab
219219
console.print("[yellow]Cloud promo messages disabled[/yellow]")
220220

221221

222-
@cloud_app.command("set-key")
223-
def set_key(
222+
# --- API key management subcommand group ---
223+
224+
api_key_app = typer.Typer(help="Manage cloud API keys")
225+
cloud_app.add_typer(api_key_app, name="api-key")
226+
227+
228+
@api_key_app.command("save")
229+
def api_key_save(
224230
api_key: str = typer.Argument(..., help="API key (bmc_ prefixed) for cloud access"),
225231
) -> None:
226-
"""Save a cloud API key for per-project cloud routing.
232+
"""Save an existing API key to local config.
227233
228-
The API key is account-level and used by projects set to cloud mode.
229-
Create a key in the web app or use 'bm cloud create-key'.
234+
Use when you already have an API key (e.g., from the web app).
230235
231236
Example:
232-
bm cloud set-key bmc_abc123...
237+
bm cloud api-key save bmc_abc123...
233238
"""
234239
if not api_key.startswith("bmc_"):
235240
console.print("[red]Error: API key must start with 'bmc_'[/red]")
@@ -245,17 +250,16 @@ def set_key(
245250
console.print("[dim]Set a project to cloud mode: bm project set-cloud <name>[/dim]")
246251

247252

248-
@cloud_app.command("create-key")
249-
def create_key(
253+
@api_key_app.command("create")
254+
def api_key_create(
250255
name: str = typer.Argument(..., help="Human-readable name for the API key"),
251256
) -> None:
252-
"""Create a new cloud API key and save it locally.
257+
"""Create a new API key via the cloud API and save it locally.
253258
254259
Requires active OAuth session (run 'bm cloud login' first).
255-
The key is created via the cloud API and saved to local config.
256260
257261
Example:
258-
bm cloud create-key "my-laptop"
262+
bm cloud api-key create "my-laptop"
259263
"""
260264

261265
async def _create_key():

0 commit comments

Comments
 (0)