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.6.tar.gz (54.8 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.6-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ctxme-0.1.6.tar.gz
  • Upload date:
  • Size: 54.8 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.6.tar.gz
Algorithm Hash digest
SHA256 c3fb82a9d66444bb38de90b5d76ce1165b873d87604f65e56e13c0499652beec
MD5 e04cdcad012d27124a647d85965121c5
BLAKE2b-256 8e0c18f9447ceb0c8b78e91b343775e76773289b7e66e2219cfa7206401a70da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ctxme-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 42.2 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b9cd68a6d963c9b6eec7625521324bfc36f29356c8ed5ce1eea649e24cc8638a
MD5 063a685712f2b2249a6194651b2e65d2
BLAKE2b-256 c9e94dfc8ef9cb5cc85f6dbdeff2f4e0344ee4c37cb7c3403c5d0c72ea8cd4ff

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