Skip to main content

Context Platform CLI

Project description

Context Platform CLI

Typer-powered command-line interface for managing Context Platform projects and items.

Installation

From the repo root (uv workspace):

uv sync --all-extras --all-groups

ctxme will then be available via uv run ctxme ... (or activate .venv and call directly).

Configuration

The CLI stores settings under the platform-specific config directory (see platformdirs). Override the path in scripts/tests with the CTXME_CONFIG_DIR environment variable.

Key commands:

  • ctxme config --api <url> – set the backend API base URL (switches to live mode)
  • ctxme config --mode mock|live – toggle between the built-in mock client and HTTP client
  • ctxme set-project <project> – set the default project key
  • ctxme auth login – device flow sign-in (opens browser, stores API key in keychain)
  • ctxme auth status – show stored API key prefix + backend metadata
  • ctxme auth set-key <key> – manually persist API keys using the OS keychain
  • ctxme auth logout – remove stored API key

API keys are never written to disk; only stored through keyring.

Commands

  • ctxme ls – list items for the default (set-project) or --project project
  • ctxme get <item> – download an item to the current directory (use --stdout to print)
  • ctxme put <item> --data "<text>" – create or update an item (--title, --tag optional)
  • ctxme remove <item> – delete an item (use --force to skip confirmation)
  • ctxme projects list / ctxme projects ls – list available projects
  • ctxme projects current – show the current default project (local only)
  • ctxme set-project <project> – set the default project key
  • ctxme status – show local config + auth status (no API call)

All commands emit Rich-formatted tables/panels with user-friendly messaging.

Environment Variables

Variable Description
CTXME_DEBUG Set to 1 to enable debug output (shows API URL, mode, and full tracebacks on errors)
CTXME_CONFIG_DIR Override the default config directory path
CTXME_CACHE_DIR Override the default cache directory path
CTXME_UPDATE_CHECK Set to 0, false, or no to disable automatic update checks at startup
CTXME_UPDATE_CHECK_INTERVAL Override the update check interval in seconds (default: 86400 / 24 hours)
CLI__API_BASE_URL Override the backend API URL (takes precedence over config file)
CLI__DEFAULT_PROJECT Override the default project (takes precedence over config file)
CLI__USE_MOCK_CLIENT Set to true to use the mock client

Example: View full configuration details

CTXME_DEBUG=1 ctxme status
# Output:
# API: https://api.example.com
# Mode: live
# Auth: Signed in
# Project: my-project (default)

When ctxme get saves to a directory, it sanitizes item keys into safe filenames (no path separators or ..).

Tests

uv run pytest cli/tests

Tests cover configuration round-trips, keyring helpers (via an in-memory backend), and representative Typer command flows.

Shell Completion

Enable tab completion for commands, subcommands, and flags.

Installation

Bash:

ctxme --install-completion bash

Zsh:

ctxme --install-completion zsh

Fish:

ctxme --install-completion fish

PowerShell:

ctxme --install-completion powershell

Usage

ctxme <TAB>        # Shows: auth, config, get, ls, put, ...
ctxme auth <TAB>   # Shows: login, logout, status, set-key
ctxme get --<TAB>  # Shows: --project, --dest, --stdout, --force, ...

Troubleshooting

  • Restart shell after installation
  • Ensure completion script is sourced in shell config
  • Check ctxme --show-completion <shell> for manual setup

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ctxme-0.1.5.tar.gz (52.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ctxme-0.1.5-py3-none-any.whl (41.0 kB view details)

Uploaded Python 3

File details

Details for the file ctxme-0.1.5.tar.gz.

File metadata

  • Download URL: ctxme-0.1.5.tar.gz
  • Upload date:
  • Size: 52.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ctxme-0.1.5.tar.gz
Algorithm Hash digest
SHA256 360b0c684103ca4ac5d5f02398a9c30951406d914d9804279991a18003b51c8b
MD5 61de2c7f3474ac3c4ff1add13c1791b8
BLAKE2b-256 cce6411c58ea152774b325d79d5b7189c24bd470bc3259ebb31dd787ce12bdc0

See more details on using hashes here.

File details

Details for the file ctxme-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: ctxme-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 41.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ctxme-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 da68acf99e809cdd5669625d1ba1d5c170cd8198843da49156fb7617c671e9f9
MD5 fcb30747aa255bb54b3aac281ff39ba6
BLAKE2b-256 f441fb5f16e5e66de1a2c8b9d4a9e9e6229fd1f777242481d998addcebff7a3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page