Skip to main content

sbm-cli

A generic command-line client for the SBM (Serena Business Manager) 12.0 JSON API.

Designed for day-to-day L3 support work and for use as a tool by AI assistants (Claude Code).

Install

# Recommended — isolated environment
uv tool install sbm-cli

# Also works
pip install sbm-cli

PATH issues? If python, uv, or sbm are not found after installation, see the PATH setup guide in the manual.

Quick start

sbm configure setup  # interactive setup wizard
sbm schema           # verify config and see available transitions
sbm list             # list open tickets
sbm get 02440942     # get ticket details

Configuration

Config is stored at ~/.sbm-cli/config.toml. Run sbm configure setup to create it interactively.

The password is stored in the system keyring — Windows Credential Manager, macOS Keychain, or GNOME Keyring/KWallet on Linux (never in the config file). On headless Linux without a keyring daemon, you are prompted for your password on each run. If you have an existing config with a plaintext password field, it is migrated automatically on the next run.

Use sbm configure transition <name> to add or update a named transition interactively. Manual editing is still needed for teams (transition IDs are instance-specific):

[connection]
host       = "https://sbm.example.com"
username   = "myuser"
verify_ssl = false          # set true for trusted certs

[defaults]
table_id   = 1000
report_ids = [2208, 2209]   # one or more reports; sbm list merges and de-duplicates them
list_fields = ["TITLE","STATE","FUNCTIONALITY","URGENCY"]  # optional; blank uses built-in default

[transitions.assign]
id              = 155
fields          = ["OWNER", "3RD_LEVEL_SPECIALIST"]
optional_fields = ["SOLUTION_STEPS"]   # optional comment field

[transitions.close]
id                      = 19
fields                  = ["RESOLUTION", "ROOT_CAUSE"]
optional_fields         = ["SOLUTION_STEPS"]
pre_transition_id       = 148
pre_transition_optional = true

[transitions.return-l2]
id     = 88
fields = ["RETURN_REASON", "RETURN_NOTE", "SOLUTION_STEPS"]  # SOLUTION_STEPS required here

[transitions.transfer]
id              = 140
fields          = ["L3_SPECIALIST_GROUP"]
optional_fields = ["SOLUTION_STEPS"]

[transitions.transfer.field_types]
L3_SPECIALIST_GROUP = "list"

[teams]
my-team = { id = 155, name = "L3 My Team" }

Transition IDs are instance-specific. Find them by inspecting browser developer tools while performing actions in the SBM web UI, or ask your SBM admin.

Multiple reports. defaults.report_ids is a list. sbm list (with no --report) queries every configured report, merges the results, and drops duplicate tickets (a ticket appearing in more than one report is listed once). If one report fails, the others still return and a warning is printed to stderr; sbm list only errors when every report fails. Override the config for a single run with a repeatable --report flag: sbm list --report 2208 --report 2209.

Migration: an older config with a single report_id = 2208 is still read (treated as report_ids = [2208]) and rewritten to report_ids the next time the config is saved.

Commands

Command Description
sbm configure setup Interactive setup wizard
sbm configure transition <name> Add/update a named transition interactively
sbm schema Machine-readable capabilities JSON
sbm list [--report N]... [--filter N] List tickets (--report is repeatable; merges + de-dups across reports)
sbm get <ticket-id> Get ticket by display ID
sbm fields <ticket-id> [--fields F1,F2] List field definitions (dbnames, types, labels)
sbm transition <name> <ticket-id> --field K=V Run named transition
sbm transition run <ticket-id> --id N --field K=V Run raw transition by ID
sbm field-values <field> --table <table-id> Discover valid relational field values
sbm teams List configured teams

Global flags

Global flags must appear before the subcommand: sbm --pretty list, not sbm list --pretty.

--version       Show installed version and exit
--pretty / -H   Human-readable output (rich tables)
--config PATH   Override config file location
--quiet         Suppress stderr status messages
--indent        Output formatted JSON with indentation

Output format

All commands output a JSON envelope:

{"ok": true, "command": "get", "data": {...}}
{"ok": false, "command": "transition", "error": {"type": "api_error", "message": "..."}}

Exit codes: 0 success · 1 API error · 2 config/auth error · 3 validation error

Development

git clone https://github.com/xdoko01/sbm-cli
cd sbm-cli
uv sync
uv run sbm configure
uv run pytest
uv run pytest -m integration  # requires live SBM connection

Changelog

0.6.0

  • Headless / non-interactive support: SBM_CLI_PASSWORD is checked before the system keyring, so CI runners, containers and AI agents need no keyring daemon and no piping tricks. The password is never written to disk
  • SBM_CLI_CONFIG sets the config file path without repeating --config on every call (precedence: --config > SBM_CLI_CONFIG > ~/.sbm-cli/config.toml)
  • sbm configure export prints the full config as raw TOML on stdout (never includes a password); sbm configure import [PATH|-] validates and installs it, refusing to overwrite without --force and tolerating a UTF-8 BOM
  • sbm auth check verifies credentials against the host and reports which source the password came from
  • The interactive password prompt is now gated on stdin being a terminal — on redirected stdin it used to block forever, and now exits 2 with a message naming SBM_CLI_PASSWORD
  • Fixed: sbm configure transition wrote to ~/.sbm-cli/config.toml unconditionally, ignoring --config

0.5.0

  • Multi-report support: defaults.report_ids is now a list; sbm list (with no --report) queries every configured report, merges the results, and de-duplicates tickets
  • --report is now repeatable (sbm list --report 2208 --report 2209) and overrides report_ids for that run
  • Best-effort listing: a failing report is skipped with a stderr warning; sbm list errors only when every report fails
  • sbm configure setup prompts for a comma-separated list of report IDs; sbm schema reports report_ids
  • Backward compatible: a legacy singular report_id is read as [report_id] and migrated to report_ids on next save

0.4.0

  • Cross-platform support: Windows, macOS, and Linux (previously Windows-only)
  • Platform-aware credential storage messages (Windows Credential Manager / macOS Keychain / system keyring)
  • Interactive password prompt fallback on headless Linux (no keyring daemon required)
  • Safe config migration when no keyring is available — plaintext password preserved rather than silently lost
  • pyproject.toml classifier updated to OS Independent

0.3.2

  • sbm --pretty get now renders relational fields (OWNER, SUBMITTER, CONTACT, etc.) correctly — they were always blank due to a formatter bug

0.3.1

  • sbm --version flag added
  • README: version changelog, updated config example with optional_fields

0.3.0

  • optional_fields per transition — SOLUTION_STEPS ("Add your comment") is now discoverable on all transitions via sbm schema
  • sbm --pretty schema shows — optional: SOLUTION_STEPS for each supporting transition
  • Named transition command warns on stderr when an unrecognised field is passed
  • CLAUDE.md updated with AI instruction to ask users whether to add a comment before executing any transition

0.2.0

  • Passwords stored in Windows Credential Manager (keyring); auto-migrated from plaintext config
  • configure transition subcommand for interactive transition setup
  • list_fields config key for customisable default columns in sbm list
  • [users] config section — resolve login names to user IDs in transitions
  • sbm fields command — list field dbnames, types, and labels from a sample ticket
  • --indent global flag for pretty-printed JSON output

0.1.0

  • Initial release: configure, schema, list, get, transition, field-values, teams
  • Named transitions with required fields, pre-transition support, relational field type handling

License

MIT

Metadata

Release files for sbm-cli 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sbm-cli 0.6.0
File Size Uploaded
sbm_cli-0.6.0.tar.gz 75.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sbm-cli 0.6.0
File Interpreter ABI Platform
sbm_cli-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 97.7 kB

Release files / sbm_cli-0.6.0.tar.gz

Download URL sbm_cli-0.6.0.tar.gz
Size 75.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dd4b440da8b6a72bea4c4d1d5d896c7c7c0c6f390d672c6d012fdb1770365220
BLAKE2b-256 checksum
How to use checksums
fd129f728631fb9fd9e864e0fb6453601b342900761276c17b7e0c364e3d90c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sbm_cli-0.6.0-py3-none-any.whl

Download URL sbm_cli-0.6.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a21a547b5d26c4ec20091276606e9c9023ee94b8a675d5c8f8a57d4438ea4a14
BLAKE2b-256 checksum
How to use checksums
3c83f3096b270d44a0de3cca2df34421e6ecc2a7d64ca1ecfceda283d521b2dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page