Skip to content

Improve CLI: support --palace argument after subcommands for consistent usage#861

Open
iron-prog wants to merge 3 commits intoMemPalace:developfrom
iron-prog:feature/cli-palace-flag-support
Open

Improve CLI: support --palace argument after subcommands for consistent usage#861
iron-prog wants to merge 3 commits intoMemPalace:developfrom
iron-prog:feature/cli-palace-flag-support

Conversation

@iron-prog
Copy link
Copy Markdown

Problem

The --palace argument only works when provided before the subcommand:
mempalace –palace ./p1 mine project
However, passing it after the subcommand (which is more intuitive) results in an error:


Solution

  • Added --palace argument support to relevant subcommands:

    • init
    • mine
    • search
    • compress
    • wake-up
    • status
    • migrate
  • Introduced a helper resolve_palace() to centralize palace path resolution

  • Updated command handlers to use the helper for consistency

  • Used environment override (MEMPALACE_PALACE) in init to respect custom palace path


Why this matters

This aligns MemPalace CLI behavior with common CLI tools (e.g., git, docker, kubectl), making it more intuitive and user-friendly.


  • Verified both usage styles work:

Checklist

  • Tests pass (python -m pytest tests/ -v)
  • No hardcoded paths
  • Linter passes (ruff check .)

@igorls igorls added enhancement New feature or request area/cli CLI commands labels Apr 14, 2026
@iron-prog
Copy link
Copy Markdown
Author

Any update on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cli CLI commands enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants