OpenAPI-driven CLI for the Chift API.
Project description
chift-cli
OpenAPI-driven CLI for the Chift API.
Setup
uv sync
uv run chift --help
uv run chift auth setup
VS Code
Install the Ruff extension, then copy the example workspace files:
cp .vscode/settings.example.json .vscode/settings.json
cp .vscode/launch.example.json .vscode/launch.json
settings.json enables format-on-save and import sorting via ruff.toml. launch.json includes debug configurations for the CLI, the current file, and pytest.
Install From GitHub Releases
Install the latest released binary.
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/chift-oneapi/chift-cli/master/install.sh | sh
Windows (PowerShell):
irm https://raw.githubusercontent.com/chift-oneapi/chift-cli/master/install.ps1 | iex
Update an existing install (works on all platforms):
chift update
Install From PyPI
Install the published package from PyPI as an isolated CLI tool. With uv:
uv tool install chift-cli
chift --help
Or with pipx:
pipx install chift-cli
chift --help
Local Install From Source
Install the CLI from this checkout when you want to run chift directly without uv run:
uv tool install .
chift --help
This installs a fixed build of the current checkout into uv's tool environment. Use this for normal local usage.
If you are developing the CLI and want the installed chift command to point at your working tree, install it in editable mode:
uv tool install --editable .
Editable installs are convenient for contributors because local source changes are reflected by the installed command. They are not recommended for regular users because the command can change or break as the checkout changes.
After switching between regular and editable installs, or after dependency changes, reinstall with --force:
uv tool install . --force
If you do not use uv, install with pip from a Python 3.11+ environment:
python -m pip install .
chift --help
For an isolated environment without uv:
python -m venv .venv
source .venv/bin/activate
python -m pip install .
chift --help
For editable contributor installs without uv:
python -m pip install -e .
auth setup opens an interactive terminal form by default. You can skip the UI with flags:
uv run chift auth setup \
--account-id <account_id> \
--client-id <client_id> \
--client-secret <client_secret>
or with environment variables:
CHIFT_ACCOUNT_ID=<account_id> \
CHIFT_CLIENT_ID=<client_id> \
CHIFT_CLIENT_SECRET=<client_secret> \
uv run chift auth setup
The CLI also loads a .env file from the current working directory on startup, so
you can put these (and any other CHIFT_* settings) there instead. Copy
.env.example to .env and fill in the values. Real environment
variables take precedence over .env.
Check saved credentials without opening the setup form:
uv run chift auth check
Install The Agent Skill
This repo ships an agent skill (skills/chift-cli/) that teaches coding agents how to drive the CLI. Install it into your agent with the skills CLI:
npx skills add chift-oneapi/chift-cli
Environment
Environment variables are loaded once at process startup through pydantic-settings. Place them in a .env file in your working directory or export them in your shell. See .env.example for a template.
Key settings:
# API endpoint (defaults to https://api.chift.eu)
CHIFT_API_BASE_URL=https://api.chift.eu
# Default consumer — avoids passing consumer_id on every command
CHIFT_CONSUMER_ID=<consumer_id>
# Restrict which operation classes the CLI will execute
CHIFT_ALLOWED_OPERATIONS=read,write
# Route vertical requests through the datalayer
CHIFT_USE_DATALAYER=1
# Show hidden endpoint groups
CHIFT_SHOW_PLATFORM_ENDPOINTS=1 # exposes consumers, integrations
CHIFT_SHOW_INTERNAL_ENDPOINTS=1 # exposes general, datastores, syncs, issues, m-c-p, webhooks
Set CHIFT_ALLOWED_OPERATIONS to a comma-separated list of operation classes when the CLI should only execute those classes for business vertical endpoints. Supported values are read, write, dangerous, and all; leaving it unset also allows all operations. Scope metadata takes precedence when it is present: read-only scopes allow read, broad scopes allow write, and broad DELETE operations require dangerous. Without scopes, GET, HEAD, and OPTIONS are read; POST and PATCH are write; and DELETE is dangerous. For example, CHIFT_ALLOWED_OPERATIONS=read,write rejects DELETE commands in verticals like accounting, banking, and point-of-sale before any request is built or sent. Platform and internal endpoint groups keep their full command set.
Set CHIFT_USE_DATALAYER=1 to request our API through the datalayer.
Schema Cache
The command tree is generated from the OpenAPI schema. On first use, the CLI fetches and caches the schema automatically. You can refresh it manually:
uv run chift schema update
Inspect command groups:
uv run chift --help
uv run chift accounting --help
uv run chift accounting suppliers --help
Endpoint Inputs
Discovering what an endpoint needs
Use --next at any level to find out what to do next:
uv run chift --next # list available verticals
uv run chift accounting --next # list entities in that vertical
uv run chift accounting suppliers --next # list commands for that entity
uv run chift accounting suppliers get --next # show the input schema for that command
--next always delegates to the most useful view at that level: --help for navigation, --schema for endpoint inputs.
Run a command without required inputs and the CLI prints a usage hint and the merged JSON schema of expected parameters:
uv run chift accounting suppliers get
# => prints usage + schema showing required fields
Get only the schema without executing:
uv run chift accounting suppliers get --schema
Passing inputs
consumer_id is treated as route context. Set it once via env var or pass it as the first positional argument:
export CHIFT_CONSUMER_ID=<consumer_id>
uv run chift accounting folders list
# or inline:
uv run chift accounting folders list <consumer_id>
Other path and query parameters are passed as KEY=VALUE positional values or with --param:
uv run chift accounting suppliers get <consumer_id> supplier_id=<supplier_id>
uv run chift accounting suppliers get <consumer_id> \
--param supplier_id=<supplier_id> \
--param folder_id=<folder_id>
Posting data
For POST and PATCH operations pass a JSON body with --json, or use KEY=VALUE pairs which are merged into the request body:
# Using KEY=VALUE pairs (merged into JSON body)
uv run chift accounting suppliers create <consumer_id> \
--force \
name="Acme Corp" \
currency_code=EUR
# Using raw JSON
uv run chift accounting suppliers create <consumer_id> \
--force \
--json '{"name": "Acme Corp", "currency_code": "EUR"}'
Mutating operations (POST, PATCH, DELETE) require --force to prevent accidental writes.
Multiple parameters
Repeat --param or use KEY=VALUE pairs for endpoints with multiple inputs:
uv run chift accounting suppliers list <consumer_id> page=2 size=50
uv run chift accounting invoices get <consumer_id> \
--param invoice_id=<id> \
--param include_lines=true
The CLI routes each parameter to the correct location (path, query, or body) based on the OpenAPI schema. Unknown parameters are rejected before the request is sent.
Output
API commands output JSON by default:
uv run chift accounting folders list <consumer_id>
Use YAML when needed:
uv run chift accounting folders list <consumer_id> --output yaml
Logs and debug details go to stderr:
uv run chift accounting folders list <consumer_id> --debug
auth setup and auth check are intentionally human-facing: they print a success message or a plain error message, not JSON.
Filtering And Fields
--fields and --filter are client-side output helpers.
uv run chift accounting folders list <consumer_id> --fields id,name,parent.id
uv run chift accounting folders list <consumer_id> --filter name=Sales
--fields keeps selected fields after the response is received. For paginated responses ({items, page, size, total}) it is applied to each entry in items.
--filter filters list responses after the response is received. Multiple filters are ANDed together. For paginated responses it filters items and updates total.
Pagination uses the API's own page and size query parameters; pass them as endpoint inputs:
uv run chift accounting suppliers list <consumer_id> page=2 size=50
Schema Search
Search operations in the cached OpenAPI schema:
uv run chift schema search supplier
Search is currently substring-based. It checks operation JSON, paths, and summaries. It does not rank results and does not fully resolve component schemas for deep field search yet.
Feature-Gated Endpoints
Some endpoint groups are hidden from help by default:
general,datastores,syncs,issues,m-c-p,webhooksconsumers,integrations
Enable internal endpoint groups:
CHIFT_SHOW_INTERNAL_ENDPOINTS=1 uv run chift --help
Enable platform endpoint groups:
CHIFT_SHOW_PLATFORM_ENDPOINTS=1 uv run chift --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chift_cli-0.1.3.tar.gz.
File metadata
- Download URL: chift_cli-0.1.3.tar.gz
- Upload date:
- Size: 62.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7928b175200b6cbad04bc1a9ea5550e2714514c9d96370c3e4d988cef255071d
|
|
| MD5 |
cc817f284ed3e3dbd435a32e10bb2ae9
|
|
| BLAKE2b-256 |
b51e2a048a589632bdc429b77d83b53ed29dde2023fc0b524355776f5c94afe5
|
File details
Details for the file chift_cli-0.1.3-py3-none-any.whl.
File metadata
- Download URL: chift_cli-0.1.3-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0886cf0dec296590e94d2b57fdc14b51ae005d1d70383409cfae0dedf417deff
|
|
| MD5 |
a4e04ec0d0103b0a456f4a3351d0842d
|
|
| BLAKE2b-256 |
17c354c42dbd253a7254f42b64db104b6c6f280340111897741e90f45f7f5270
|