jvcli 2.0.6__tar.gz → 2.0.7__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.
- {jvcli-2.0.6/jvcli.egg-info → jvcli-2.0.7}/PKG-INFO +1 -1
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/__init__.py +1 -1
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/api.py +23 -5
- {jvcli-2.0.6 → jvcli-2.0.7/jvcli.egg-info}/PKG-INFO +1 -1
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_api.py +60 -6
- {jvcli-2.0.6 → jvcli-2.0.7}/LICENSE +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/MANIFEST.in +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/README.md +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/auth.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/cli.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/__init__.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/app.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/lib/__init__.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/lib/page.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/lib/utils.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/lib/widgets.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/pages/__init__.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/pages/analytics_page.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/pages/chat_page.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/pages/dashboard_page.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/client/pages/graph_page.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/__init__.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/auth.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/client.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/create.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/download.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/info.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/publish.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/startproject.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/studio.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/commands/update.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/studio/assets/index-BtFItD2q.js +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/studio/assets/index-CIEsu-TC.css +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/studio/index.html +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/studio/jac_logo.png +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/studio/tauri.svg +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/studio/vite.svg +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/action_info.yaml +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/agent_descriptor.yaml +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/agent_info.yaml +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/agent_knowledge.yaml +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/agent_memory.yaml +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/project/env.example +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/project/globals.jac +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/2.0.0/project/main.jac +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/CHANGELOG.md +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/templates/README.md +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli/utils.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli.egg-info/SOURCES.txt +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli.egg-info/dependency_links.txt +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli.egg-info/entry_points.txt +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli.egg-info/requires.txt +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/jvcli.egg-info/top_level.txt +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/setup.cfg +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/setup.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_auth.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_cli.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_create.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_download.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_info.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_publish.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_startproject.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_studio.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_update.py +0 -0
- {jvcli-2.0.6 → jvcli-2.0.7}/tests/test_utils.py +0 -0
@@ -57,13 +57,20 @@ class RegistryAPI:
|
|
57
57
|
|
58
58
|
@staticmethod
|
59
59
|
def get_package_info(
|
60
|
-
name: str,
|
60
|
+
name: str,
|
61
|
+
version: str = "",
|
62
|
+
token: Optional[str] = None,
|
63
|
+
api_key: Optional[str] = None,
|
61
64
|
) -> dict:
|
62
65
|
"""Get action info.yaml content as json"""
|
63
66
|
endpoint = "info"
|
64
67
|
|
65
68
|
try:
|
66
|
-
headers = {"Authorization": f"Bearer {token}"} if token else
|
69
|
+
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
70
|
+
|
71
|
+
if api_key:
|
72
|
+
headers["x-api-key"] = api_key
|
73
|
+
|
67
74
|
data = {
|
68
75
|
"name": name,
|
69
76
|
"version": "" if version == "latest" else version,
|
@@ -91,12 +98,16 @@ class RegistryAPI:
|
|
91
98
|
info: bool = False,
|
92
99
|
suppress_error: bool = False,
|
93
100
|
token: Optional[str] = None,
|
101
|
+
api_key: Optional[str] = None,
|
94
102
|
) -> dict:
|
95
103
|
"""Download a Jivas Package."""
|
96
104
|
endpoint = "download"
|
97
105
|
|
98
106
|
try:
|
99
|
-
headers = {"Authorization": f"Bearer {token}"} if token else
|
107
|
+
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
108
|
+
|
109
|
+
if api_key:
|
110
|
+
headers["x-api-key"] = api_key
|
100
111
|
|
101
112
|
data = {
|
102
113
|
"name": name,
|
@@ -124,13 +135,20 @@ class RegistryAPI:
|
|
124
135
|
|
125
136
|
@staticmethod
|
126
137
|
def get_action_info(
|
127
|
-
name: str,
|
138
|
+
name: str,
|
139
|
+
version: str = "",
|
140
|
+
token: Optional[str] = None,
|
141
|
+
api_key: Optional[str] = None,
|
128
142
|
) -> dict:
|
129
143
|
"""Get action info.yaml content as json"""
|
130
144
|
endpoint = "info"
|
131
145
|
|
132
146
|
try:
|
133
|
-
headers = {"Authorization": f"Bearer {token}"} if token else
|
147
|
+
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
148
|
+
|
149
|
+
if api_key:
|
150
|
+
headers["x-api-key"] = api_key
|
151
|
+
|
134
152
|
data = {
|
135
153
|
"name": name,
|
136
154
|
"version": "" if version == "latest" else version,
|
@@ -197,7 +197,7 @@ class TestRegistryAPI:
|
|
197
197
|
mock_requests.assert_called_once_with(
|
198
198
|
RegistryAPI.url + "info",
|
199
199
|
params={"name": "test-pkg", "version": "1.0.0"},
|
200
|
-
headers=
|
200
|
+
headers={},
|
201
201
|
)
|
202
202
|
mock_secho.assert_called_once_with(
|
203
203
|
"Error retrieving action: Network error", fg="red"
|
@@ -246,7 +246,7 @@ class TestRegistryAPI:
|
|
246
246
|
mock_requests.assert_called_once_with(
|
247
247
|
RegistryAPI.url + "download",
|
248
248
|
params={"name": "test-package", "info": "false", "version": "1.0.0"},
|
249
|
-
headers=
|
249
|
+
headers={},
|
250
250
|
)
|
251
251
|
mock_secho.assert_called_once_with(
|
252
252
|
"Error downloading package: Network error", fg="red"
|
@@ -272,7 +272,7 @@ class TestRegistryAPI:
|
|
272
272
|
mock_requests.assert_called_once_with(
|
273
273
|
f"{RegistryAPI.url}info",
|
274
274
|
params={"name": "test-action", "version": ""},
|
275
|
-
headers=
|
275
|
+
headers={},
|
276
276
|
)
|
277
277
|
assert result == {"name": "test-action", "description": "Test action"}
|
278
278
|
|
@@ -291,7 +291,7 @@ class TestRegistryAPI:
|
|
291
291
|
mock_requests.assert_called_once_with(
|
292
292
|
f"{RegistryAPI.url}info",
|
293
293
|
params={"name": "test-action", "version": ""},
|
294
|
-
headers=
|
294
|
+
headers={},
|
295
295
|
)
|
296
296
|
mock_secho.assert_called_once_with(
|
297
297
|
"Error retrieving action: Network error", fg="red"
|
@@ -316,7 +316,7 @@ class TestRegistryAPI:
|
|
316
316
|
mock_requests.assert_called_once_with(
|
317
317
|
f"{RegistryAPI.url}info",
|
318
318
|
params={"name": "test-action", "version": ""},
|
319
|
-
headers=
|
319
|
+
headers={},
|
320
320
|
)
|
321
321
|
mock_secho.assert_called_once_with(
|
322
322
|
"Error retrieving action: Not Found", fg="red"
|
@@ -742,7 +742,7 @@ class TestRegistryAPI:
|
|
742
742
|
mock_get.assert_called_once_with(
|
743
743
|
RegistryAPI.url + "download",
|
744
744
|
params={"name": test_name, "info": "false", "version": test_version},
|
745
|
-
headers=
|
745
|
+
headers={},
|
746
746
|
)
|
747
747
|
assert result == {}
|
748
748
|
|
@@ -947,3 +947,57 @@ class TestRegistryAPI:
|
|
947
947
|
|
948
948
|
# Assert
|
949
949
|
assert result == {}
|
950
|
+
|
951
|
+
def test_package_download_with_api_key(self, mocker: MockerFixture) -> None:
|
952
|
+
"""Test downloading package with API key."""
|
953
|
+
# Arrange
|
954
|
+
mock_response = mocker.Mock()
|
955
|
+
mock_response.status_code = 200
|
956
|
+
mock_response.json.return_value = {"package": "content"}
|
957
|
+
|
958
|
+
mock_get = mocker.patch("requests.get", return_value=mock_response)
|
959
|
+
|
960
|
+
test_name = "test-action"
|
961
|
+
test_api_key = "test-api-key" # pragma: allowlist secret
|
962
|
+
|
963
|
+
# Act
|
964
|
+
result = RegistryAPI.download_package(name=test_name, api_key=test_api_key)
|
965
|
+
|
966
|
+
# Assert
|
967
|
+
mock_get.assert_called_once_with(
|
968
|
+
f"{RegistryAPI.url}download",
|
969
|
+
params={"name": test_name, "info": "false", "version": ""},
|
970
|
+
headers={"x-api-key": test_api_key},
|
971
|
+
)
|
972
|
+
assert result == {"package": "content"}
|
973
|
+
|
974
|
+
def test_package_info_with_api_key(self, mocker: MockerFixture) -> None:
|
975
|
+
"""Test getting package info with API key."""
|
976
|
+
# Arrange
|
977
|
+
mock_response = mocker.Mock()
|
978
|
+
mock_response.status_code = 200
|
979
|
+
mock_response.json.return_value = {
|
980
|
+
"name": "test-action",
|
981
|
+
"version": "1.0.0",
|
982
|
+
"description": "Test action",
|
983
|
+
}
|
984
|
+
|
985
|
+
mock_get = mocker.patch("requests.get", return_value=mock_response)
|
986
|
+
|
987
|
+
test_name = "test-action"
|
988
|
+
test_api_key = "test-api-key" # pragma: allowlist secret
|
989
|
+
|
990
|
+
# Act
|
991
|
+
result = RegistryAPI.get_package_info(name=test_name, api_key=test_api_key)
|
992
|
+
|
993
|
+
# Assert
|
994
|
+
mock_get.assert_called_once_with(
|
995
|
+
f"{RegistryAPI.url}info",
|
996
|
+
params={"name": test_name, "version": ""},
|
997
|
+
headers={"x-api-key": test_api_key},
|
998
|
+
)
|
999
|
+
assert result == {
|
1000
|
+
"name": "test-action",
|
1001
|
+
"version": "1.0.0",
|
1002
|
+
"description": "Test action",
|
1003
|
+
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|