deepflow-opendesk-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. deepflow_opendesk_cli-0.1.0/PKG-INFO +152 -0
  2. deepflow_opendesk_cli-0.1.0/README.md +130 -0
  3. deepflow_opendesk_cli-0.1.0/pyproject.toml +34 -0
  4. deepflow_opendesk_cli-0.1.0/setup.cfg +4 -0
  5. deepflow_opendesk_cli-0.1.0/setup.py +18 -0
  6. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/__init__.py +3 -0
  7. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/__main__.py +7 -0
  8. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/batch.py +53 -0
  9. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/cli.py +696 -0
  10. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/client.py +323 -0
  11. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/profiles.py +91 -0
  12. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/schema.py +384 -0
  13. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli/workflows.py +37 -0
  14. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli.egg-info/PKG-INFO +152 -0
  15. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli.egg-info/SOURCES.txt +21 -0
  16. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli.egg-info/dependency_links.txt +1 -0
  17. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli.egg-info/entry_points.txt +2 -0
  18. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli.egg-info/requires.txt +5 -0
  19. deepflow_opendesk_cli-0.1.0/src/deepflow_opendesk_cli.egg-info/top_level.txt +1 -0
  20. deepflow_opendesk_cli-0.1.0/tests/test_cli.py +110 -0
  21. deepflow_opendesk_cli-0.1.0/tests/test_client.py +67 -0
  22. deepflow_opendesk_cli-0.1.0/tests/test_profiles.py +21 -0
  23. deepflow_opendesk_cli-0.1.0/tests/test_schema.py +107 -0
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: deepflow-opendesk-cli
3
+ Version: 0.1.0
4
+ Summary: Command-line client for OpenDesk admin configuration APIs.
5
+ Author: DeepFlow AI
6
+ Project-URL: Repository, https://github.com/DeepFlowAI/opendesk-dev
7
+ Keywords: deepflow,opendesk,cli,openapi,admin,configuration
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ Provides-Extra: dev
18
+ Requires-Dist: build>=1.0; extra == "dev"
19
+ Requires-Dist: pytest>=8.0; extra == "dev"
20
+ Requires-Dist: twine>=5.0; extra == "dev"
21
+ Dynamic: requires-python
22
+
23
+ # deepflow-opendesk-cli
24
+
25
+ Python command-line client for OpenDesk admin configuration APIs.
26
+
27
+ 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.
28
+
29
+ ## Scope
30
+
31
+ 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.
32
+
33
+ Included examples:
34
+
35
+ - System settings
36
+ - Roles, employees, employee groups
37
+ - Service hours
38
+ - Channels
39
+ - Field definitions, form layouts, interaction rules
40
+ - User, ticket, and organization view configuration
41
+ - Satisfaction and welcome-message settings
42
+ - Voice flows, ticket workflows, inbound/session routing rules
43
+ - Queue policies
44
+ - Optional tenant, SIP trunk, and phone-number configuration endpoints when extensions are loaded
45
+
46
+ ## Install For Development
47
+
48
+ ```bash
49
+ cd packages/deepflow-opendesk-cli
50
+ pip install -e ".[dev]"
51
+ ```
52
+
53
+ ## Configure Host And Token
54
+
55
+ ```bash
56
+ export OPENDESK_HOST="http://localhost:5001"
57
+ export OPENDESK_TOKEN="..."
58
+ ```
59
+
60
+ Or log in and save a local profile:
61
+
62
+ ```bash
63
+ deepflow_opendesk_cli auth login \
64
+ --tenant 12058577c8114513 \
65
+ --username test \
66
+ --save-token
67
+ ```
68
+
69
+ Profile files are stored under `~/.opendesk/cli/{profile}/` with owner-only permissions where supported.
70
+
71
+ ## Common Commands
72
+
73
+ ```bash
74
+ deepflow_opendesk_cli schema fetch
75
+ deepflow_opendesk_cli docs list --tag FieldDefinitions
76
+ deepflow_opendesk_cli docs show fields.create --json
77
+
78
+ deepflow_opendesk_cli request GET /api/v1/system/info
79
+ deepflow_opendesk_cli call fields.list --query domain=ticket
80
+ deepflow_opendesk_cli call fields.create --json-file field.json
81
+
82
+ deepflow_opendesk_cli system settings
83
+ deepflow_opendesk_cli roles permission-tree
84
+ deepflow_opendesk_cli employees list
85
+ deepflow_opendesk_cli channels list
86
+ deepflow_opendesk_cli routing session list
87
+ deepflow_opendesk_cli queue policies
88
+ ```
89
+
90
+ Equivalent module invocation:
91
+
92
+ ```bash
93
+ python -m deepflow_opendesk_cli docs list
94
+ ```
95
+
96
+ ## AI Agent Flow
97
+
98
+ Recommended execution loop:
99
+
100
+ ```text
101
+ 1. schema fetch or docs list
102
+ 2. docs show <endpoint-key>
103
+ 3. request/call --dry-run
104
+ 4. present plan to a human
105
+ 5. batch run / workflow run --yes
106
+ 6. verify with config list/get commands
107
+ ```
108
+
109
+ ## Batch
110
+
111
+ `batch run` accepts JSONL. Each line is a config operation:
112
+
113
+ ```jsonl
114
+ {"key":"auth.me"}
115
+ {"key":"fields.create","body":{"domain":"ticket","name":"Customer Tier","field_type":"select"}}
116
+ {"method":"PUT","path":"/api/v1/system-settings","body":{"default_language":"zh","default_timezone":"Asia/Shanghai"}}
117
+ ```
118
+
119
+ Run:
120
+
121
+ ```bash
122
+ deepflow_opendesk_cli batch run ops.jsonl --dry-run
123
+ deepflow_opendesk_cli batch run ops.jsonl --continue-on-error --output results.jsonl
124
+ ```
125
+
126
+ ## Development
127
+
128
+ ```bash
129
+ cd packages/deepflow-opendesk-cli
130
+ PYTHONPATH=src python -m pytest tests -q
131
+ python -m build
132
+ ```
133
+
134
+ ## Distribution
135
+
136
+ Releases are automated. Pushing a `v*` git tag (e.g. `v0.1.1`) triggers
137
+ `.github/workflows/release.yml`, which runs the tests, builds the sdist + wheel,
138
+ publishes `deepflow-opendesk-cli` to PyPI, and cuts a GitHub Release.
139
+
140
+ ```bash
141
+ pip install deepflow-opendesk-cli
142
+ ```
143
+
144
+ To cut a patch release, run the helper script (bumps the version across
145
+ `pyproject.toml`, `setup.py`, and `__init__.py`, then tags and pushes):
146
+
147
+ ```bash
148
+ bash .claude/skills/release-publish/scripts/release-tag.sh --dry-run
149
+ bash .claude/skills/release-publish/scripts/release-tag.sh
150
+ ```
151
+
152
+ To build locally without publishing: `python -m build`.
@@ -0,0 +1,130 @@
1
+ # deepflow-opendesk-cli
2
+
3
+ Python command-line client for OpenDesk admin configuration APIs.
4
+
5
+ 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.
6
+
7
+ ## Scope
8
+
9
+ 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.
10
+
11
+ Included examples:
12
+
13
+ - System settings
14
+ - Roles, employees, employee groups
15
+ - Service hours
16
+ - Channels
17
+ - Field definitions, form layouts, interaction rules
18
+ - User, ticket, and organization view configuration
19
+ - Satisfaction and welcome-message settings
20
+ - Voice flows, ticket workflows, inbound/session routing rules
21
+ - Queue policies
22
+ - Optional tenant, SIP trunk, and phone-number configuration endpoints when extensions are loaded
23
+
24
+ ## Install For Development
25
+
26
+ ```bash
27
+ cd packages/deepflow-opendesk-cli
28
+ pip install -e ".[dev]"
29
+ ```
30
+
31
+ ## Configure Host And Token
32
+
33
+ ```bash
34
+ export OPENDESK_HOST="http://localhost:5001"
35
+ export OPENDESK_TOKEN="..."
36
+ ```
37
+
38
+ Or log in and save a local profile:
39
+
40
+ ```bash
41
+ deepflow_opendesk_cli auth login \
42
+ --tenant 12058577c8114513 \
43
+ --username test \
44
+ --save-token
45
+ ```
46
+
47
+ Profile files are stored under `~/.opendesk/cli/{profile}/` with owner-only permissions where supported.
48
+
49
+ ## Common Commands
50
+
51
+ ```bash
52
+ deepflow_opendesk_cli schema fetch
53
+ deepflow_opendesk_cli docs list --tag FieldDefinitions
54
+ deepflow_opendesk_cli docs show fields.create --json
55
+
56
+ deepflow_opendesk_cli request GET /api/v1/system/info
57
+ deepflow_opendesk_cli call fields.list --query domain=ticket
58
+ deepflow_opendesk_cli call fields.create --json-file field.json
59
+
60
+ deepflow_opendesk_cli system settings
61
+ deepflow_opendesk_cli roles permission-tree
62
+ deepflow_opendesk_cli employees list
63
+ deepflow_opendesk_cli channels list
64
+ deepflow_opendesk_cli routing session list
65
+ deepflow_opendesk_cli queue policies
66
+ ```
67
+
68
+ Equivalent module invocation:
69
+
70
+ ```bash
71
+ python -m deepflow_opendesk_cli docs list
72
+ ```
73
+
74
+ ## AI Agent Flow
75
+
76
+ Recommended execution loop:
77
+
78
+ ```text
79
+ 1. schema fetch or docs list
80
+ 2. docs show <endpoint-key>
81
+ 3. request/call --dry-run
82
+ 4. present plan to a human
83
+ 5. batch run / workflow run --yes
84
+ 6. verify with config list/get commands
85
+ ```
86
+
87
+ ## Batch
88
+
89
+ `batch run` accepts JSONL. Each line is a config operation:
90
+
91
+ ```jsonl
92
+ {"key":"auth.me"}
93
+ {"key":"fields.create","body":{"domain":"ticket","name":"Customer Tier","field_type":"select"}}
94
+ {"method":"PUT","path":"/api/v1/system-settings","body":{"default_language":"zh","default_timezone":"Asia/Shanghai"}}
95
+ ```
96
+
97
+ Run:
98
+
99
+ ```bash
100
+ deepflow_opendesk_cli batch run ops.jsonl --dry-run
101
+ deepflow_opendesk_cli batch run ops.jsonl --continue-on-error --output results.jsonl
102
+ ```
103
+
104
+ ## Development
105
+
106
+ ```bash
107
+ cd packages/deepflow-opendesk-cli
108
+ PYTHONPATH=src python -m pytest tests -q
109
+ python -m build
110
+ ```
111
+
112
+ ## Distribution
113
+
114
+ Releases are automated. Pushing a `v*` git tag (e.g. `v0.1.1`) triggers
115
+ `.github/workflows/release.yml`, which runs the tests, builds the sdist + wheel,
116
+ publishes `deepflow-opendesk-cli` to PyPI, and cuts a GitHub Release.
117
+
118
+ ```bash
119
+ pip install deepflow-opendesk-cli
120
+ ```
121
+
122
+ To cut a patch release, run the helper script (bumps the version across
123
+ `pyproject.toml`, `setup.py`, and `__init__.py`, then tags and pushes):
124
+
125
+ ```bash
126
+ bash .claude/skills/release-publish/scripts/release-tag.sh --dry-run
127
+ bash .claude/skills/release-publish/scripts/release-tag.sh
128
+ ```
129
+
130
+ To build locally without publishing: `python -m build`.
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "deepflow-opendesk-cli"
7
+ version = "0.1.0"
8
+ description = "Command-line client for OpenDesk admin configuration APIs."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ authors = [{ name = "DeepFlow AI" }]
12
+ keywords = ["deepflow", "opendesk", "cli", "openapi", "admin", "configuration"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
21
+ ]
22
+ dependencies = []
23
+
24
+ [project.optional-dependencies]
25
+ dev = ["build>=1.0", "pytest>=8.0", "twine>=5.0"]
26
+
27
+ [project.urls]
28
+ Repository = "https://github.com/DeepFlowAI/opendesk-dev"
29
+
30
+ [project.scripts]
31
+ deepflow_opendesk_cli = "deepflow_opendesk_cli.cli:main"
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,18 @@
1
+ """Setuptools compatibility entrypoint for older editable-install tooling."""
2
+
3
+ from pathlib import Path
4
+
5
+ from setuptools import find_packages, setup
6
+
7
+
8
+ setup(
9
+ name="deepflow-opendesk-cli",
10
+ version="0.1.0",
11
+ description="Command-line client for OpenDesk admin configuration APIs.",
12
+ long_description=Path("README.md").read_text(encoding="utf-8"),
13
+ long_description_content_type="text/markdown",
14
+ python_requires=">=3.11",
15
+ package_dir={"": "src"},
16
+ packages=find_packages(where="src"),
17
+ entry_points={"console_scripts": ["deepflow_opendesk_cli=deepflow_opendesk_cli.cli:main"]},
18
+ )
@@ -0,0 +1,3 @@
1
+ """OpenDesk admin configuration API CLI."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,7 @@
1
+ """Module entrypoint for ``python -m deepflow_opendesk_cli``."""
2
+
3
+ from .cli import main
4
+
5
+
6
+ if __name__ == "__main__":
7
+ raise SystemExit(main())
@@ -0,0 +1,53 @@
1
+ """JSONL batch helpers for OpenDesk CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from collections.abc import Callable
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ from .client import CliError, HttpResult
11
+
12
+ OperationRunner = Callable[[dict[str, Any]], HttpResult]
13
+
14
+
15
+ def load_jsonl(path: str | Path) -> list[dict[str, Any]]:
16
+ """Load batch operations from a JSONL file."""
17
+ operations: list[dict[str, Any]] = []
18
+ for lineno, raw in enumerate(Path(path).read_text(encoding="utf-8").splitlines(), start=1):
19
+ line = raw.strip()
20
+ if not line or line.startswith("#"):
21
+ continue
22
+ try:
23
+ payload = json.loads(line)
24
+ except json.JSONDecodeError as exc:
25
+ raise CliError(f"Invalid JSONL at line {lineno}: {exc.msg}") from exc
26
+ if not isinstance(payload, dict):
27
+ raise CliError(f"Batch line {lineno} must be a JSON object")
28
+ operations.append(payload)
29
+ return operations
30
+
31
+
32
+ def run_batch(
33
+ operations: list[dict[str, Any]],
34
+ runner: OperationRunner,
35
+ *,
36
+ continue_on_error: bool = False,
37
+ ) -> list[dict[str, Any]]:
38
+ """Run operations through a callback and return structured line results."""
39
+ results: list[dict[str, Any]] = []
40
+ for index, operation in enumerate(operations, start=1):
41
+ try:
42
+ result = runner(operation)
43
+ item = {"index": index, **result.to_dict()}
44
+ except Exception as exc: # noqa: BLE001 - batch output should capture user-facing failures.
45
+ item = {"index": index, "ok": False, "error": str(exc), "operation": operation}
46
+ results.append(item)
47
+ if not continue_on_error:
48
+ break
49
+ continue
50
+ results.append(item)
51
+ if not result.ok and not continue_on_error:
52
+ break
53
+ return results