Skip to content

feat: Multi-profile support for multiple Cookidoo accounts #12

@TheTrustedAdvisor

Description

@TheTrustedAdvisor

Motivation

Many households have two people using the same Thermomix with separate Cookidoo accounts. Currently tmx-cli supports only one set of cookies/config at a time. Switching accounts requires re-logging in, which overwrites the existing session.

Note: Cookidoo itself does NOT support sub-profiles within one account. This feature manages multiple separate Cookidoo accounts on the CLI level.

Proposed Feature

Profile Management

tmx profile add "Maria"         # Create a new profile
tmx profile add "Lars"          # Create another profile
tmx profile list                # List all profiles (* = active)
tmx profile switch "Maria"      # Switch active profile
tmx profile remove "Lars"       # Delete a profile
tmx profile show                # Show active profile details

Per-Command Profile Override

tmx --profile Maria plan show        # Use Maria's session
tmx --profile Lars shopping show     # Use Lars's session

Example Output

$ tmx profile list

👥 Profile
──────────────────────────────────────
  * Maria  (maria@example.com, eingeloggt)
    Lars   (lars@example.com, eingeloggt)

Aktiv: Maria
Wechseln: tmx profile switch <name>

Technical Approach

Storage Structure

Move from single files to profile-based directories (builds on Issue #2):

~/.tmx-cli/
├── active_profile              # Contains name of active profile
├── profiles/
│   ├── maria/
│   │   ├── cookies.json        # Maria's session
│   │   ├── search_token.json
│   │   ├── weekplan.json
│   │   └── config.json         # Maria's TM version, diet prefs
│   └── lars/
│       ├── cookies.json
│       ├── search_token.json
│       ├── weekplan.json
│       └── config.json
└── categories.json             # Shared (not user-specific)

Implementation

  1. Profile manager — functions to create/list/switch/remove profiles
  2. Dynamic path resolutionget_profile_dir() returns the active profile's directory
  3. Global --profile flag — added to the root parser, overrides active profile for one command
  4. Backward compatibility — if no profiles exist, behave exactly as today (single implicit "default" profile). On first profile add, migrate existing data to a "default" profile.
def get_profile_dir(profile_name: str = None) -> Path:
    base = Path.home() / ".tmx-cli" / "profiles"
    if profile_name:
        return base / profile_name
    # Read active profile
    active_file = Path.home() / ".tmx-cli" / "active_profile"
    if active_file.exists():
        name = active_file.read_text().strip()
        return base / name
    # Fallback: default profile or legacy single-file mode
    return base / "default"

Migration Path

When tmx profile add is first called:

  1. Create ~/.tmx-cli/profiles/default/
  2. Move existing cookies/config/cache into the default profile
  3. Set "default" as active profile
  4. Create the new named profile

Dependencies

Effort

Medium — requires refactoring all path constants to be dynamic, plus new profile CRUD commands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions