feat: Add SPEC-15 for configuration persistence via Tigris (#343) · basicmachines-co/basic-memory@53438d1 · GitHub
Skip to content

Commit 53438d1

Browse files
phernandezclaude
andauthored
feat: Add SPEC-15 for configuration persistence via Tigris (#343)
Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 032de7e commit 53438d1

4 files changed

Lines changed: 306 additions & 16 deletions

File tree

Lines changed: 264 additions & 0 deletions

src/basic_memory/cli/commands/status.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,21 @@ def display_changes(
129129
async def run_status(project: Optional[str] = None, verbose: bool = False): # pragma: no cover
130130
"""Check sync status of files vs database."""
131131

132-
try:
133-
from basic_memory.config import ConfigManager
132+
from basic_memory.config import ConfigManager
134133

135-
config = ConfigManager().config
136-
auth_headers = {}
137-
if config.cloud_mode_enabled:
138-
auth_headers = await get_authenticated_headers()
134+
config = ConfigManager().config
135+
auth_headers = {}
136+
if config.cloud_mode_enabled:
137+
auth_headers = await get_authenticated_headers()
139138

140-
project_item = await get_active_project(client, project, None)
141-
response = await call_post(
142-
client, f"{project_item.project_url}/project/status", headers=auth_headers
143-
)
144-
sync_report = SyncReportResponse.model_validate(response.json())
139+
project_item = await get_active_project(client, project, None, auth_headers)
140+
response = await call_post(
141+
client, f"{project_item.project_url}/project/status", headers=auth_headers
142+
)
143+
sync_report = SyncReportResponse.model_validate(response.json())
145144

146-
display_changes(project_item.name, "Status", sync_report, verbose)
145+
display_changes(project_item.name, "Status", sync_report, verbose)
147146

148-
except (ValueError, ToolError) as e:
149-
console.print(f"[red]✗ Error: {e}[/red]")
150-
raise typer.Exit(1)
151147

152148

153149
@app.command()

src/basic_memory/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,12 @@ def __init__(self) -> None:
251251
if isinstance(home, str):
252252
home = Path(home)
253253

254-
self.config_dir = home / DATA_DIR_NAME
254+
# Allow override via environment variable
255+
if config_dir := os.getenv("BASIC_MEMORY_CONFIG_DIR"):
256+
self.config_dir = Path(config_dir)
257+
else:
258+
self.config_dir = home / DATA_DIR_NAME
259+
255260
self.config_file = self.config_dir / CONFIG_FILE_NAME
256261

257262
# Ensure config directory exists

tests/test_config.py

Lines changed: 25 additions & 0 deletions

0 commit comments

Comments
 (0)