@@ -46,10 +46,7 @@ def providers() -> list[str]:
4646
4747
4848def require_api_key (cfg : Config ) -> None :
49- """Exit with guidance if no API key is configured (no interactive prompt).
50-
51- Used by all PostgreSQL commands where the key must be pre-configured.
52- """
49+ """Exit with guidance if no API key is configured (no interactive prompt)."""
5350 if cfg .openai_api_key :
5451 return
5552 out .error (
@@ -59,20 +56,6 @@ def require_api_key(cfg: Config) -> None:
5956 sys .exit (1 )
6057
6158
62- def require_persistent (cfg : Config , command : str ) -> None :
63- """Exit with guidance if the store backend is not PostgreSQL."""
64- if cfg .store_provider == "postgres" :
65- return
66- out .error (f"'{ command } ' requires PostgreSQL for persistent storage." )
67- print ()
68- out .info ("To try context-use without a database:" )
69- out .next_step ("context-use quickstart" )
70- print ()
71- out .info ("To set up PostgreSQL:" )
72- out .next_step ("context-use config set-store postgres" )
73- sys .exit (1 )
74-
75-
7659def ensure_api_key (cfg : Config ) -> None :
7760 """Ensure an API key is present, prompting interactively if needed.
7861
@@ -330,40 +313,23 @@ async def run(
330313 """Override with the command's actual logic."""
331314
332315
333- class PersistentCommand (ContextCommand , ABC ):
334- """Command that requires PostgreSQL .
316+ class ApiCommand (ContextCommand , ABC ):
317+ """Command that requires a configured OpenAI API key .
335318
336- ``_prepare`` enforces ``require_persistent`` before a context is built.
337- Subclasses should set ``display_name`` to the full CLI path shown in the
338- error message (e.g. ``"memories list"``).
319+ ``_prepare`` enforces ``require_api_key`` before a context is built.
339320 """
340321
341- display_name : ClassVar [str ] = ""
342-
343322 def _prepare (self , cfg : Config , args : argparse .Namespace ) -> Config :
344- require_persistent (cfg , self .display_name or self .name )
345- return super ()._prepare (cfg , args )
346-
347-
348- class PersistentApiCommand (PersistentCommand , ABC ):
349- """Command that requires PostgreSQL **and** a configured OpenAI API key.
350-
351- ``_prepare`` adds ``require_api_key`` on top of
352- :class:`PersistentCommand`'s checks.
353- """
354-
355- def _prepare (self , cfg : Config , args : argparse .Namespace ) -> Config :
356- cfg = super ()._prepare (cfg , args )
357323 require_api_key (cfg )
358- return cfg
324+ return super (). _prepare ( cfg , args )
359325
360326
361- class AgentCommand (PersistentApiCommand , ABC ):
362- """Command that requires PostgreSQL, an OpenAI API key, **and** a configured
327+ class AgentCommand (ApiCommand , ABC ):
328+ """Command that requires an OpenAI API key **and** a configured
363329 agent backend.
364330
365331 ``_prepare`` adds ``require_agent_backend`` on top of
366- :class:`PersistentApiCommand `'s checks.
332+ :class:`ApiCommand `'s checks.
367333 """
368334
369335 def _prepare (self , cfg : Config , args : argparse .Namespace ) -> Config :
@@ -373,15 +339,13 @@ def _prepare(self, cfg: Config, args: argparse.Namespace) -> Config:
373339
374340
375341class EphemeralApiCommand (ContextCommand , ABC ):
376- """Command that always runs with an SQLite store and an OpenAI API key.
342+ """Command that runs with a temporary SQLite store and an OpenAI API key.
377343
378- Intended for zero-config preview flows (e.g. ``quickstart``) where no
379- database is needed or desired .
344+ Intended for zero-config preview flows (e.g. ``quickstart``) where the
345+ data does not need to persist beyond the session .
380346
381- ``_prepare`` unconditionally sets ``store_provider = "sqlite"`` and then
382- calls ``ensure_api_key``, which prompts interactively when no key is
383- configured (unlike :class:`PersistentApiCommand` which exits with an
384- error).
347+ ``_prepare`` points the database to a temporary file and then calls
348+ ``ensure_api_key``, which prompts interactively when no key is configured.
385349 """
386350
387351 llm_mode : ClassVar [str ] = "sync"
@@ -404,7 +368,7 @@ class CommandGroup:
404368
405369 class MemoriesGroup(CommandGroup):
406370 name = "memories"
407- help = "Manage memories (requires PostgreSQL) "
371+ help = "Manage memories"
408372 subcommands = [
409373 MemoriesGenerateCommand,
410374 MemoriesListCommand,
0 commit comments