orca-cli-sdk 0.1.0__py3-none-any.whl
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.
- orca_cli_sdk-0.1.0.dist-info/METADATA +226 -0
- orca_cli_sdk-0.1.0.dist-info/RECORD +16 -0
- orca_cli_sdk-0.1.0.dist-info/WHEEL +4 -0
- orca_cli_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
- orca_sdk/__init__.py +41 -0
- orca_sdk/_async_client.py +171 -0
- orca_sdk/_client.py +195 -0
- orca_sdk/_core.py +314 -0
- orca_sdk/_exceptions.py +105 -0
- orca_sdk/_generated.py +11094 -0
- orca_sdk/_resource.py +85 -0
- orca_sdk/_version.py +4 -0
- orca_sdk/data/agent-context.json +7811 -0
- orca_sdk/data/flag-types.json +2146 -0
- orca_sdk/py.typed +0 -0
- orca_sdk/schema.py +33 -0
orca_sdk/py.typed
ADDED
|
File without changes
|
orca_sdk/schema.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Access to the bundled Orca CLI command schema (``orca agent-context --json``)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from functools import lru_cache
|
|
7
|
+
from importlib import resources
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from ._generated import COMMANDS
|
|
11
|
+
|
|
12
|
+
__all__ = ["COMMANDS", "command_names", "get_command", "load_schema"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@lru_cache(maxsize=1)
|
|
16
|
+
def load_schema() -> dict[str, Any]:
|
|
17
|
+
"""Return the schema the SDK was generated from."""
|
|
18
|
+
text = resources.files("orca_sdk").joinpath("data/agent-context.json").read_text("utf-8")
|
|
19
|
+
return json.loads(text)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def command_names() -> list[str]:
|
|
23
|
+
"""All command paths, e.g. ``["account add", ..., "worktree show"]``."""
|
|
24
|
+
return [" ".join(c["path"]) for c in load_schema()["commands"]]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def get_command(name: str) -> dict[str, Any]:
|
|
28
|
+
"""Schema entry for one command (``"worktree create"``), including aliases."""
|
|
29
|
+
wanted = name.split()
|
|
30
|
+
for cmd in load_schema()["commands"]:
|
|
31
|
+
if cmd["path"] == wanted or wanted in cmd.get("aliases", []):
|
|
32
|
+
return cmd
|
|
33
|
+
raise KeyError(name)
|