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.4.tar.gz (50.3 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.4-py3-none-any.whl (40.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ctxme-0.1.4.tar.gz
  • Upload date:
  • Size: 50.3 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.4.tar.gz
Algorithm Hash digest
SHA256 de5db959494322821f2c1cd1be693d90b75368a9694e61aef56e326cc17dd9cd
MD5 733e7b56ac8d5fd35c84fd08947d661f
BLAKE2b-256 00bfc6e6be5698318c01cd533384222ea76bea35e1f547fda067738fd12d331c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ctxme-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 40.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5f1b0909d93791b5cc6fb36386df8d31efb854c51d93d7d6551dcfbee92cfb42
MD5 91a869a2a765f2c18e83f60fb691c368
BLAKE2b-256 70213fd05f8afb8d2554f570cce2f31cdc0c933664325d5021a591dcf81a869a

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