Metadata-Version: 2.4
Name: deepflow-opendesk-cli
Version: 0.1.0
Summary: Command-line client for OpenDesk admin configuration APIs.
Author: DeepFlow AI
Project-URL: Repository, https://github.com/DeepFlowAI/opendesk-dev
Keywords: deepflow,opendesk,cli,openapi,admin,configuration
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Description-Content-Type: text/markdown
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Dynamic: requires-python

# deepflow-opendesk-cli

Python command-line client for OpenDesk admin configuration APIs.

The CLI is designed for implementation engineers, operators, and AI agents that need to configure OpenDesk through the same APIs used by the admin console.

## Scope

This package intentionally exposes only admin configuration APIs. Runtime workspace data, public visitor APIs, reports, and call-center agent actions are excluded by a schema whitelist.

Included examples:

- System settings
- Roles, employees, employee groups
- Service hours
- Channels
- Field definitions, form layouts, interaction rules
- User, ticket, and organization view configuration
- Satisfaction and welcome-message settings
- Voice flows, ticket workflows, inbound/session routing rules
- Queue policies
- Optional tenant, SIP trunk, and phone-number configuration endpoints when extensions are loaded

## Install For Development

```bash
cd packages/deepflow-opendesk-cli
pip install -e ".[dev]"
```

## Configure Host And Token

```bash
export OPENDESK_HOST="http://localhost:5001"
export OPENDESK_TOKEN="..."
```

Or log in and save a local profile:

```bash
deepflow_opendesk_cli auth login \
  --tenant 12058577c8114513 \
  --username test \
  --save-token
```

Profile files are stored under `~/.opendesk/cli/{profile}/` with owner-only permissions where supported.

## Common Commands

```bash
deepflow_opendesk_cli schema fetch
deepflow_opendesk_cli docs list --tag FieldDefinitions
deepflow_opendesk_cli docs show fields.create --json

deepflow_opendesk_cli request GET /api/v1/system/info
deepflow_opendesk_cli call fields.list --query domain=ticket
deepflow_opendesk_cli call fields.create --json-file field.json

deepflow_opendesk_cli system settings
deepflow_opendesk_cli roles permission-tree
deepflow_opendesk_cli employees list
deepflow_opendesk_cli channels list
deepflow_opendesk_cli routing session list
deepflow_opendesk_cli queue policies
```

Equivalent module invocation:

```bash
python -m deepflow_opendesk_cli docs list
```

## AI Agent Flow

Recommended execution loop:

```text
1. schema fetch or docs list
2. docs show <endpoint-key>
3. request/call --dry-run
4. present plan to a human
5. batch run / workflow run --yes
6. verify with config list/get commands
```

## Batch

`batch run` accepts JSONL. Each line is a config operation:

```jsonl
{"key":"auth.me"}
{"key":"fields.create","body":{"domain":"ticket","name":"Customer Tier","field_type":"select"}}
{"method":"PUT","path":"/api/v1/system-settings","body":{"default_language":"zh","default_timezone":"Asia/Shanghai"}}
```

Run:

```bash
deepflow_opendesk_cli batch run ops.jsonl --dry-run
deepflow_opendesk_cli batch run ops.jsonl --continue-on-error --output results.jsonl
```

## Development

```bash
cd packages/deepflow-opendesk-cli
PYTHONPATH=src python -m pytest tests -q
python -m build
```

## Distribution

Releases are automated. Pushing a `v*` git tag (e.g. `v0.1.1`) triggers
`.github/workflows/release.yml`, which runs the tests, builds the sdist + wheel,
publishes `deepflow-opendesk-cli` to PyPI, and cuts a GitHub Release.

```bash
pip install deepflow-opendesk-cli
```

To cut a patch release, run the helper script (bumps the version across
`pyproject.toml`, `setup.py`, and `__init__.py`, then tags and pushes):

```bash
bash .claude/skills/release-publish/scripts/release-tag.sh --dry-run
bash .claude/skills/release-publish/scripts/release-tag.sh
```

To build locally without publishing: `python -m build`.
