mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
a1d7792bdb
Signed-off-by: phernandez <paul@basicmachines.co> Signed-off-by: Paul Hernandez <60959+phernandez@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Drew Cain <groksrc@users.noreply.github.com>
55 lines
1.4 KiB
Python
55 lines
1.4 KiB
Python
from typing import Optional
|
|
|
|
import typer
|
|
|
|
from basic_memory.config import ConfigManager
|
|
|
|
|
|
def version_callback(value: bool) -> None:
|
|
"""Show version and exit."""
|
|
if value: # pragma: no cover
|
|
import basic_memory
|
|
|
|
typer.echo(f"Basic Memory version: {basic_memory.__version__}")
|
|
raise typer.Exit()
|
|
|
|
|
|
app = typer.Typer(name="basic-memory")
|
|
|
|
|
|
@app.callback()
|
|
def app_callback(
|
|
ctx: typer.Context,
|
|
version: Optional[bool] = typer.Option(
|
|
None,
|
|
"--version",
|
|
"-v",
|
|
help="Show version and exit.",
|
|
callback=version_callback,
|
|
is_eager=True,
|
|
),
|
|
) -> None:
|
|
"""Basic Memory - Local-first personal knowledge management."""
|
|
|
|
# Run initialization for every command unless --version was specified
|
|
if not version and ctx.invoked_subcommand is not None:
|
|
from basic_memory.services.initialization import ensure_initialization
|
|
|
|
app_config = ConfigManager().config
|
|
ensure_initialization(app_config)
|
|
|
|
|
|
## import
|
|
# Register sub-command groups
|
|
import_app = typer.Typer(help="Import data from various sources")
|
|
app.add_typer(import_app, name="import")
|
|
|
|
claude_app = typer.Typer(help="Import Conversations from Claude JSON export.")
|
|
import_app.add_typer(claude_app, name="claude")
|
|
|
|
|
|
## cloud
|
|
|
|
cloud_app = typer.Typer(help="Access Basic Memory Cloud")
|
|
app.add_typer(cloud_app, name="cloud")
|