rio-cli 0.2.0__tar.gz → 0.2.2__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.
- {rio_cli-0.2.0 → rio_cli-0.2.2}/PKG-INFO +18 -7
- {rio_cli-0.2.0 → rio_cli-0.2.2}/README.md +15 -5
- {rio_cli-0.2.0 → rio_cli-0.2.2}/pyproject.toml +4 -3
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/auth.py +5 -2
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/config.py +7 -3
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/post.py +12 -5
- {rio_cli-0.2.0 → rio_cli-0.2.2}/.gitignore +0 -0
- {rio_cli-0.2.0 → rio_cli-0.2.2}/LICENSE +0 -0
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/__init__.py +0 -0
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/git.py +0 -0
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/main.py +0 -0
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/output.py +0 -0
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/rio_config.py +0 -0
- {rio_cli-0.2.0 → rio_cli-0.2.2}/rio_cli/utils.py +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: rio-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Command-line client for Rio, an automated code review tool.
|
|
5
5
|
Project-URL: Homepage, https://github.com/JayTheCoder77/rio
|
|
6
6
|
Project-URL: Repository, https://github.com/JayTheCoder77/rio
|
|
7
7
|
Author: JayTheCoder77
|
|
8
8
|
License-Expression: ISC
|
|
9
9
|
License-File: LICENSE
|
|
10
|
-
Requires-Python:
|
|
10
|
+
Requires-Python: >=3.12
|
|
11
11
|
Requires-Dist: httpx>=0.28.1
|
|
12
|
+
Requires-Dist: platformdirs>=4.0
|
|
12
13
|
Requires-Dist: pyyaml>=6.0
|
|
13
14
|
Requires-Dist: rich>=15.0.0
|
|
14
15
|
Requires-Dist: rio-review-core<0.2.0,>=0.1.0
|
|
@@ -38,8 +39,17 @@ dashboard's API keys page):
|
|
|
38
39
|
rio auth
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
This prompts for your API key, validates it against your Rio instance, and saves it to
|
|
42
|
-
|
|
42
|
+
This prompts for your API key, validates it against your Rio instance, and saves it to the
|
|
43
|
+
platform-specific config file shown below. On POSIX the file is written with restricted
|
|
44
|
+
(`0600`) permissions; on Windows it lives under your already-private `%APPDATA%`.
|
|
45
|
+
|
|
46
|
+
| OS | Config file |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| Linux | `~/.config/rio/config.toml` |
|
|
49
|
+
| macOS | `~/Library/Application Support/rio/config.toml` |
|
|
50
|
+
| Windows | `%APPDATA%\rio\config.toml` |
|
|
51
|
+
|
|
52
|
+
The directory is created for you on first run, so you never need to mkdir by hand.
|
|
43
53
|
|
|
44
54
|
## Usage
|
|
45
55
|
|
|
@@ -62,9 +72,10 @@ rio review --staged --include-untracked
|
|
|
62
72
|
|
|
63
73
|
## Configuration
|
|
64
74
|
|
|
65
|
-
`rio auth` manages
|
|
66
|
-
self-hosted `ai-engine` instance instead of
|
|
67
|
-
the `[api] url` value in that
|
|
75
|
+
`rio auth` manages the platform-specific config file for you (see the table above for the
|
|
76
|
+
exact location per OS). To point the CLI at a self-hosted `ai-engine` instance instead of
|
|
77
|
+
the default (`https://rio-ai-engine.onrender.com`), edit the `[api] url` value in that
|
|
78
|
+
file, or set it before running `rio auth`:
|
|
68
79
|
|
|
69
80
|
```toml
|
|
70
81
|
[api]
|
|
@@ -21,8 +21,17 @@ dashboard's API keys page):
|
|
|
21
21
|
rio auth
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
This prompts for your API key, validates it against your Rio instance, and saves it to
|
|
25
|
-
|
|
24
|
+
This prompts for your API key, validates it against your Rio instance, and saves it to the
|
|
25
|
+
platform-specific config file shown below. On POSIX the file is written with restricted
|
|
26
|
+
(`0600`) permissions; on Windows it lives under your already-private `%APPDATA%`.
|
|
27
|
+
|
|
28
|
+
| OS | Config file |
|
|
29
|
+
| --- | --- |
|
|
30
|
+
| Linux | `~/.config/rio/config.toml` |
|
|
31
|
+
| macOS | `~/Library/Application Support/rio/config.toml` |
|
|
32
|
+
| Windows | `%APPDATA%\rio\config.toml` |
|
|
33
|
+
|
|
34
|
+
The directory is created for you on first run, so you never need to mkdir by hand.
|
|
26
35
|
|
|
27
36
|
## Usage
|
|
28
37
|
|
|
@@ -45,9 +54,10 @@ rio review --staged --include-untracked
|
|
|
45
54
|
|
|
46
55
|
## Configuration
|
|
47
56
|
|
|
48
|
-
`rio auth` manages
|
|
49
|
-
self-hosted `ai-engine` instance instead of
|
|
50
|
-
the `[api] url` value in that
|
|
57
|
+
`rio auth` manages the platform-specific config file for you (see the table above for the
|
|
58
|
+
exact location per OS). To point the CLI at a self-hosted `ai-engine` instance instead of
|
|
59
|
+
the default (`https://rio-ai-engine.onrender.com`), edit the `[api] url` value in that
|
|
60
|
+
file, or set it before running `rio auth`:
|
|
51
61
|
|
|
52
62
|
```toml
|
|
53
63
|
[api]
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "rio-cli"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Command-line client for Rio, an automated code review tool."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "ISC"
|
|
7
7
|
authors = [{ name = "JayTheCoder77" }]
|
|
8
|
-
requires-python = ">=3.12
|
|
8
|
+
requires-python = ">=3.12"
|
|
9
9
|
dependencies = [
|
|
10
10
|
"rio-review-core>=0.1.0,<0.2.0",
|
|
11
11
|
"httpx>=0.28.1",
|
|
12
12
|
"rich>=15.0.0",
|
|
13
13
|
"typer>=0.27.1",
|
|
14
|
-
"pyyaml>=6.0"
|
|
14
|
+
"pyyaml>=6.0",
|
|
15
|
+
"platformdirs>=4.0",
|
|
15
16
|
]
|
|
16
17
|
|
|
17
18
|
[project.scripts]
|
|
@@ -29,8 +29,11 @@ def _write_config(data: dict) -> None:
|
|
|
29
29
|
lines.append(f'api_key = "{api_section["api_key"]}"')
|
|
30
30
|
|
|
31
31
|
CONFIG_PATH.write_text("\n".join(lines) + "\n")
|
|
32
|
-
# This file holds a real credential
|
|
33
|
-
|
|
32
|
+
# This file holds a real credential. On POSIX, lock it to the user via 0o600.
|
|
33
|
+
# That mode has no real meaning on Windows, where %APPDATA% is already
|
|
34
|
+
# per-user private by default.
|
|
35
|
+
if os.name != "nt":
|
|
36
|
+
os.chmod(CONFIG_PATH, stat.S_IRUSR | stat.S_IWUSR) # 0o600
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
def _validate_api_key(api_key: str, ai_engine_url: str) -> None:
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import os
|
|
2
2
|
|
|
3
|
+
import platformdirs
|
|
3
4
|
import tomllib
|
|
4
5
|
|
|
5
6
|
from rio_cli.utils import _fail
|
|
6
7
|
|
|
7
|
-
DEFAULT_AI_ENGINE_URL =
|
|
8
|
-
|
|
8
|
+
DEFAULT_AI_ENGINE_URL = os.environ.get(
|
|
9
|
+
"RIO_API_URL", "https://rio-ai-engine.onrender.com"
|
|
10
|
+
)
|
|
11
|
+
# DEFAULT_AI_ENGINE_URL = "http://localhost:8000"
|
|
12
|
+
CONFIG_PATH = platformdirs.user_config_path("rio") / "config.toml"
|
|
9
13
|
|
|
10
14
|
def get_ai_engine_url() -> str:
|
|
11
15
|
if not CONFIG_PATH.exists():
|
|
@@ -7,11 +7,12 @@ from rio_cli.utils import _fail
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def _post_review(diff_text : str) -> list[Finding]:
|
|
10
|
-
headers : dict = {}
|
|
11
10
|
api_key = get_api_key()
|
|
12
|
-
if api_key:
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if not api_key:
|
|
12
|
+
_fail("Error: not authenticated. Run `rio auth` first.")
|
|
13
|
+
|
|
14
|
+
headers = {"Authorization": f"Bearer {api_key}"}
|
|
15
|
+
|
|
15
16
|
rio_config = load_rio_config()
|
|
16
17
|
ai_engine_url = get_ai_engine_url()
|
|
17
18
|
try:
|
|
@@ -26,7 +27,13 @@ def _post_review(diff_text : str) -> list[Finding]:
|
|
|
26
27
|
|
|
27
28
|
except httpx.TimeoutException:
|
|
28
29
|
_fail("Error: ai-engine request timed out.")
|
|
29
|
-
|
|
30
|
+
|
|
31
|
+
if response.status_code == 401:
|
|
32
|
+
_fail("Error: not authenticated. Run `rio auth` first.")
|
|
33
|
+
if response.status_code == 412:
|
|
34
|
+
_fail(f"Error: {response.json().get('detail', response.text)}")
|
|
35
|
+
if response.status_code == 422:
|
|
36
|
+
_fail(f"Error: {response.json().get('detail', response.text)}")
|
|
30
37
|
if response.status_code != 200:
|
|
31
38
|
_fail(f"Error: ai-engine returned {response.status_code}: {response.text}")
|
|
32
39
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|