jvcli 2.0.3__tar.gz → 2.0.5__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.3/jvcli.egg-info → jvcli-2.0.5}/PKG-INFO +7 -1
- {jvcli-2.0.3 → jvcli-2.0.5}/README.md +6 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/__init__.py +1 -1
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/cli.py +2 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/lib/utils.py +1 -1
- jvcli-2.0.5/jvcli/commands/startproject.py +67 -0
- jvcli-2.0.5/jvcli/templates/2.0.0/project/env.example +13 -0
- jvcli-2.0.5/jvcli/templates/2.0.0/project/globals.jac +2 -0
- jvcli-2.0.5/jvcli/templates/2.0.0/project/main.jac +2 -0
- {jvcli-2.0.3 → jvcli-2.0.5/jvcli.egg-info}/PKG-INFO +7 -1
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli.egg-info/SOURCES.txt +5 -0
- jvcli-2.0.5/tests/test_startproject.py +85 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/LICENSE +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/MANIFEST.in +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/api.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/auth.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/__init__.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/app.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/lib/__init__.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/lib/page.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/lib/widgets.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/pages/__init__.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/pages/analytics_page.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/pages/chat_page.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/pages/dashboard_page.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/client/pages/graph_page.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/__init__.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/auth.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/client.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/create.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/download.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/info.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/publish.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/studio.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/commands/update.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/studio/assets/index-BtFItD2q.js +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/studio/assets/index-CIEsu-TC.css +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/studio/index.html +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/studio/jac_logo.png +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/studio/tauri.svg +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/studio/vite.svg +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/templates/2.0.0/action_info.yaml +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/templates/2.0.0/agent_descriptor.yaml +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/templates/2.0.0/agent_info.yaml +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/templates/2.0.0/agent_knowledge.yaml +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/templates/2.0.0/agent_memory.yaml +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/templates/CHANGELOG.md +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/templates/README.md +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli/utils.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli.egg-info/dependency_links.txt +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli.egg-info/entry_points.txt +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli.egg-info/requires.txt +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/jvcli.egg-info/top_level.txt +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/setup.cfg +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/setup.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_api.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_auth.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_cli.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_create.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_download.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_info.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_publish.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_studio.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_update.py +0 -0
- {jvcli-2.0.3 → jvcli-2.0.5}/tests/test_utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: jvcli
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.5
|
4
4
|
Summary: CLI tool for Jivas Package Repository
|
5
5
|
Home-page: https://github.com/TrueSelph/jvcli
|
6
6
|
Author: TrueSelph Inc.
|
@@ -70,6 +70,12 @@ To publish an action:
|
|
70
70
|
jvcli publish action --path ./my_action --visibility public
|
71
71
|
```
|
72
72
|
|
73
|
+
To start a new project:
|
74
|
+
|
75
|
+
```sh
|
76
|
+
jvcli startproject my_project
|
77
|
+
```
|
78
|
+
|
73
79
|
For more detailed usage, refer to the help command:
|
74
80
|
|
75
81
|
```sh
|
@@ -9,6 +9,7 @@ from jvcli.commands.create import create
|
|
9
9
|
from jvcli.commands.download import download
|
10
10
|
from jvcli.commands.info import info
|
11
11
|
from jvcli.commands.publish import publish
|
12
|
+
from jvcli.commands.startproject import startproject
|
12
13
|
from jvcli.commands.studio import studio
|
13
14
|
from jvcli.commands.update import update
|
14
15
|
|
@@ -28,6 +29,7 @@ jvcli.add_command(publish)
|
|
28
29
|
jvcli.add_command(info)
|
29
30
|
jvcli.add_command(studio)
|
30
31
|
jvcli.add_command(client)
|
32
|
+
jvcli.add_command(startproject)
|
31
33
|
|
32
34
|
# Register standalone commands
|
33
35
|
jvcli.add_command(signup)
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"""Start project command."""
|
2
|
+
|
3
|
+
import os
|
4
|
+
|
5
|
+
import click
|
6
|
+
|
7
|
+
from jvcli import __supported__jivas__versions__
|
8
|
+
from jvcli.utils import TEMPLATES_DIR
|
9
|
+
|
10
|
+
|
11
|
+
@click.command()
|
12
|
+
@click.argument("project_name")
|
13
|
+
@click.option(
|
14
|
+
"--version",
|
15
|
+
default=max(__supported__jivas__versions__),
|
16
|
+
show_default=True,
|
17
|
+
help="Jivas project version to use for scaffolding.",
|
18
|
+
)
|
19
|
+
def startproject(project_name: str, version: str) -> None:
|
20
|
+
"""
|
21
|
+
Initialize a new Jivas project with the necessary structure.
|
22
|
+
|
23
|
+
Usage:
|
24
|
+
jvcli startproject <project_name> [--version <jivas_version>]
|
25
|
+
"""
|
26
|
+
template_path = os.path.join(TEMPLATES_DIR, version, "project")
|
27
|
+
|
28
|
+
if not os.path.exists(template_path):
|
29
|
+
click.secho(f"Template for Jivas version {version} not found.", fg="red")
|
30
|
+
return
|
31
|
+
|
32
|
+
project_structure: dict = {
|
33
|
+
"tests": [],
|
34
|
+
"actions": [],
|
35
|
+
"daf": [],
|
36
|
+
"scripts": [],
|
37
|
+
}
|
38
|
+
|
39
|
+
try:
|
40
|
+
print(f"Creating project: {project_name} (Version: {version})")
|
41
|
+
os.makedirs(project_name, exist_ok=True)
|
42
|
+
|
43
|
+
# Create directories
|
44
|
+
for folder in project_structure.keys():
|
45
|
+
os.makedirs(os.path.join(project_name, folder), exist_ok=True)
|
46
|
+
|
47
|
+
# Copy template files from the selected version
|
48
|
+
for filename in ["main.jac", "globals.jac", "env.example"]:
|
49
|
+
template_file_path = os.path.join(template_path, filename)
|
50
|
+
if os.path.exists(template_file_path):
|
51
|
+
with open(template_file_path, "r") as template_file:
|
52
|
+
contents = template_file.read()
|
53
|
+
|
54
|
+
# Write `.env` instead of `env.example`
|
55
|
+
target_filename = ".env" if filename == "env.example" else filename
|
56
|
+
with open(
|
57
|
+
os.path.join(project_name, target_filename), "w"
|
58
|
+
) as project_file:
|
59
|
+
project_file.write(contents)
|
60
|
+
|
61
|
+
click.secho(
|
62
|
+
f"Successfully created Jivas project: {project_name} (Version: {version})",
|
63
|
+
fg="green",
|
64
|
+
)
|
65
|
+
|
66
|
+
except Exception as e:
|
67
|
+
click.secho(f"Error creating project: {e}", fg="red")
|
@@ -0,0 +1,13 @@
|
|
1
|
+
JIVAS_USER=admin@jivas.com
|
2
|
+
JIVAS_PASSWORD=password
|
3
|
+
JIVAS_PORT=8000
|
4
|
+
JIVAS_BASE_URL=http://localhost:8000
|
5
|
+
JIVAS_STUDIO_URL=http://localhost:8989
|
6
|
+
JIVAS_FILES_URL=http://localhost:8000/files
|
7
|
+
JIVAS_DESCRIPTOR_ROOT_PATH=".jvdata"
|
8
|
+
JIVAS_ACTIONS_ROOT_PATH="actions"
|
9
|
+
JIVAS_DAF_ROOT_PATH="daf"
|
10
|
+
JIVAS_FILES_ROOT_PATH=".files"
|
11
|
+
JIVAS_WEBHOOK_SECRET_KEY="ABCDEFGHIJK"
|
12
|
+
JIVAS_ENVIRONMENT=development
|
13
|
+
JACPATH="./"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: jvcli
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.5
|
4
4
|
Summary: CLI tool for Jivas Package Repository
|
5
5
|
Home-page: https://github.com/TrueSelph/jvcli
|
6
6
|
Author: TrueSelph Inc.
|
@@ -70,6 +70,12 @@ To publish an action:
|
|
70
70
|
jvcli publish action --path ./my_action --visibility public
|
71
71
|
```
|
72
72
|
|
73
|
+
To start a new project:
|
74
|
+
|
75
|
+
```sh
|
76
|
+
jvcli startproject my_project
|
77
|
+
```
|
78
|
+
|
73
79
|
For more detailed usage, refer to the help command:
|
74
80
|
|
75
81
|
```sh
|
@@ -31,6 +31,7 @@ jvcli/commands/create.py
|
|
31
31
|
jvcli/commands/download.py
|
32
32
|
jvcli/commands/info.py
|
33
33
|
jvcli/commands/publish.py
|
34
|
+
jvcli/commands/startproject.py
|
34
35
|
jvcli/commands/studio.py
|
35
36
|
jvcli/commands/update.py
|
36
37
|
jvcli/studio/index.html
|
@@ -46,6 +47,9 @@ jvcli/templates/2.0.0/agent_descriptor.yaml
|
|
46
47
|
jvcli/templates/2.0.0/agent_info.yaml
|
47
48
|
jvcli/templates/2.0.0/agent_knowledge.yaml
|
48
49
|
jvcli/templates/2.0.0/agent_memory.yaml
|
50
|
+
jvcli/templates/2.0.0/project/env.example
|
51
|
+
jvcli/templates/2.0.0/project/globals.jac
|
52
|
+
jvcli/templates/2.0.0/project/main.jac
|
49
53
|
tests/test_api.py
|
50
54
|
tests/test_auth.py
|
51
55
|
tests/test_cli.py
|
@@ -53,6 +57,7 @@ tests/test_create.py
|
|
53
57
|
tests/test_download.py
|
54
58
|
tests/test_info.py
|
55
59
|
tests/test_publish.py
|
60
|
+
tests/test_startproject.py
|
56
61
|
tests/test_studio.py
|
57
62
|
tests/test_update.py
|
58
63
|
tests/test_utils.py
|
@@ -0,0 +1,85 @@
|
|
1
|
+
"""Tests for jvcli startproject command."""
|
2
|
+
|
3
|
+
import os
|
4
|
+
|
5
|
+
from click.testing import CliRunner
|
6
|
+
from pytest_mock import MockerFixture
|
7
|
+
|
8
|
+
from jvcli import __supported__jivas__versions__
|
9
|
+
from jvcli.commands.startproject import startproject
|
10
|
+
|
11
|
+
|
12
|
+
class TestStartProjectCommand:
|
13
|
+
"""Test cases for the startproject command."""
|
14
|
+
|
15
|
+
def test_create_project_with_default_version(self, mocker: MockerFixture) -> None:
|
16
|
+
"""Create project with default version and verify structure."""
|
17
|
+
|
18
|
+
# Mock file system operations
|
19
|
+
mock_makedirs = mocker.patch("os.makedirs")
|
20
|
+
mocker.patch("os.path.exists", return_value=True)
|
21
|
+
|
22
|
+
# Mock open with support for both text and binary modes
|
23
|
+
mock_file = mocker.mock_open(read_data=b"template content")
|
24
|
+
mock_open = mocker.patch("builtins.open", mock_file)
|
25
|
+
|
26
|
+
# Mock click.secho to prevent actual console output
|
27
|
+
mock_click = mocker.patch("click.secho")
|
28
|
+
|
29
|
+
# Run command
|
30
|
+
runner = CliRunner()
|
31
|
+
result = runner.invoke(startproject, ["test_project"])
|
32
|
+
|
33
|
+
# Verify project directory creation
|
34
|
+
mock_makedirs.assert_any_call("test_project", exist_ok=True)
|
35
|
+
|
36
|
+
# Verify subdirectories creation
|
37
|
+
expected_dirs = ["tests", "actions", "daf", "scripts"]
|
38
|
+
for dir_name in expected_dirs:
|
39
|
+
mock_makedirs.assert_any_call(
|
40
|
+
os.path.join("test_project", dir_name), exist_ok=True
|
41
|
+
)
|
42
|
+
|
43
|
+
# Verify template files creation
|
44
|
+
expected_files = ["main.jac", "globals.jac", ".env"]
|
45
|
+
mock_calls = mock_open.mock_calls
|
46
|
+
written_files = [
|
47
|
+
call.args[0] for call in mock_calls if "test_project" in str(call)
|
48
|
+
]
|
49
|
+
assert len(written_files) == len(expected_files)
|
50
|
+
|
51
|
+
# Verify success message
|
52
|
+
mock_click.assert_called_with(
|
53
|
+
f"Successfully created Jivas project: test_project (Version: {max(__supported__jivas__versions__)})",
|
54
|
+
fg="green",
|
55
|
+
)
|
56
|
+
|
57
|
+
assert result.exit_code == 0
|
58
|
+
|
59
|
+
def test_template_path_does_not_exist(self, mocker: MockerFixture) -> None:
|
60
|
+
"""Test behavior when the template path does not exist."""
|
61
|
+
mocker.patch("os.path.exists", return_value=False)
|
62
|
+
mock_click = mocker.patch("click.secho")
|
63
|
+
|
64
|
+
runner = CliRunner()
|
65
|
+
result = runner.invoke(startproject, ["test_project"])
|
66
|
+
|
67
|
+
assert result.exit_code == 0
|
68
|
+
mock_click.assert_called_once_with(
|
69
|
+
"Template for Jivas version 2.0.0 not found.", fg="red"
|
70
|
+
)
|
71
|
+
|
72
|
+
def test_exception_handling_during_project_creation(
|
73
|
+
self, mocker: MockerFixture
|
74
|
+
) -> None:
|
75
|
+
"""Test exception handling during project creation."""
|
76
|
+
mocker.patch("os.makedirs", side_effect=Exception("Mocked exception"))
|
77
|
+
mock_click = mocker.patch("click.secho")
|
78
|
+
|
79
|
+
runner = CliRunner()
|
80
|
+
result = runner.invoke(startproject, ["test_project", "--version", "2.0.0"])
|
81
|
+
|
82
|
+
assert result.exit_code == 0
|
83
|
+
mock_click.assert_called_once_with(
|
84
|
+
"Error creating project: Mocked exception", fg="red"
|
85
|
+
)
|
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
|