ara-cli 0.1.9.52__py3-none-any.whl → 0.1.9.54__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.
- ara_cli/ara_command_action.py +11 -1
- ara_cli/ara_command_parser.py +1 -0
- ara_cli/ara_config.py +2 -7
- ara_cli/artefact_fuzzy_search.py +1 -1
- ara_cli/artefact_models/artefact_model.py +12 -0
- ara_cli/artefact_renamer.py +43 -22
- ara_cli/chat.py +2 -1
- ara_cli/tag_extractor.py +4 -1
- ara_cli/tests/test_artefact_renamer.py +0 -61
- ara_cli/tests/test_chat.py +18 -13
- ara_cli/tests/test_tag_extractor.py +23 -14
- ara_cli/version.py +1 -1
- {ara_cli-0.1.9.52.dist-info → ara_cli-0.1.9.54.dist-info}/METADATA +1 -1
- {ara_cli-0.1.9.52.dist-info → ara_cli-0.1.9.54.dist-info}/RECORD +17 -17
- {ara_cli-0.1.9.52.dist-info → ara_cli-0.1.9.54.dist-info}/WHEEL +0 -0
- {ara_cli-0.1.9.52.dist-info → ara_cli-0.1.9.54.dist-info}/entry_points.txt +0 -0
- {ara_cli-0.1.9.52.dist-info → ara_cli-0.1.9.54.dist-info}/top_level.txt +0 -0
ara_cli/ara_command_action.py
CHANGED
|
@@ -123,8 +123,12 @@ def list_action(args):
|
|
|
123
123
|
def list_tags_action(args):
|
|
124
124
|
from ara_cli.tag_extractor import TagExtractor
|
|
125
125
|
|
|
126
|
+
tag_classifier = None
|
|
127
|
+
if args.include_classifier:
|
|
128
|
+
tag_classifier = args.include_classifier
|
|
129
|
+
|
|
126
130
|
tag_extractor = TagExtractor()
|
|
127
|
-
tags = tag_extractor.extract_tags()
|
|
131
|
+
tags = tag_extractor.extract_tags(include_classifier=tag_classifier)
|
|
128
132
|
|
|
129
133
|
if args.json:
|
|
130
134
|
output = json.dumps({"tags": tags})
|
|
@@ -266,6 +270,12 @@ def fetch_templates_action(args):
|
|
|
266
270
|
target = join(target_dir, item)
|
|
267
271
|
shutil.copy2(source, target)
|
|
268
272
|
|
|
273
|
+
custom_prompt_templates_subdir = config.custom_prompt_templates_subdir
|
|
274
|
+
local_prompt_modules_dir = join(prompt_templates_dir, custom_prompt_templates_subdir)
|
|
275
|
+
os.makedirs(local_prompt_modules_dir, exist_ok=True)
|
|
276
|
+
for subdir in subdirs:
|
|
277
|
+
os.makedirs(join(local_prompt_modules_dir, subdir), exist_ok=True)
|
|
278
|
+
|
|
269
279
|
|
|
270
280
|
def read_action(args):
|
|
271
281
|
from ara_cli.artefact_reader import ArtefactReader
|
ara_cli/ara_command_parser.py
CHANGED
|
@@ -120,6 +120,7 @@ def list_parser(subparsers):
|
|
|
120
120
|
def list_tags_parser(subparsers):
|
|
121
121
|
tags_parser = subparsers.add_parser("list-tags", help="Show tags")
|
|
122
122
|
tags_parser.add_argument("--json", "-j", help="Output tags as JSON", action=argparse.BooleanOptionalAction)
|
|
123
|
+
tags_parser.add_argument("--include-classifier", choices=classifiers, help="Show tags for an artefact type")
|
|
123
124
|
|
|
124
125
|
|
|
125
126
|
def add_chat_arguments(chat_parser):
|
ara_cli/ara_config.py
CHANGED
|
@@ -2,7 +2,7 @@ from typing import List, Dict, Union, Optional
|
|
|
2
2
|
from pydantic import BaseModel
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
|
-
from os.path import exists,
|
|
5
|
+
from os.path import exists, dirname
|
|
6
6
|
from os import makedirs
|
|
7
7
|
from functools import lru_cache
|
|
8
8
|
|
|
@@ -18,6 +18,7 @@ class ARAconfig(BaseModel):
|
|
|
18
18
|
glossary_dir: str = "./glossary"
|
|
19
19
|
doc_dir: str = "./docs"
|
|
20
20
|
local_prompt_templates_dir: str = "./ara/.araconfig"
|
|
21
|
+
custom_prompt_templates_subdir: Optional[str] = "custom-prompt-modules"
|
|
21
22
|
local_ara_templates_dir: str = "./ara/.araconfig/templates/"
|
|
22
23
|
ara_prompt_given_list_includes: List[str] = [
|
|
23
24
|
"*.businessgoal",
|
|
@@ -136,12 +137,6 @@ class ConfigManager:
|
|
|
136
137
|
|
|
137
138
|
if not exists(config_dir):
|
|
138
139
|
makedirs(config_dir)
|
|
139
|
-
# create defined default path structure for custom prompts
|
|
140
|
-
makedirs(join(config_dir, "custom-prompt-modules"))
|
|
141
|
-
makedirs(join(config_dir, "custom-prompt-modules", "commands"))
|
|
142
|
-
makedirs(join(config_dir, "custom-prompt-modules", "rule"))
|
|
143
|
-
makedirs(join(config_dir, "custom-prompt-modules", "intentions"))
|
|
144
|
-
makedirs(join(config_dir, "custom-prompt-modules", "blueprints"))
|
|
145
140
|
|
|
146
141
|
cls._config_instance = read_data(filepath)
|
|
147
142
|
return cls._config_instance
|
ara_cli/artefact_fuzzy_search.py
CHANGED
|
@@ -26,7 +26,7 @@ def suggest_close_name_matches_for_parent(artefact_name: str, all_artefact_names
|
|
|
26
26
|
message = f"No match found for parent of '{artefact_name}' with name '{parent_name}'"
|
|
27
27
|
|
|
28
28
|
suggest_close_names(
|
|
29
|
-
artefact_name=
|
|
29
|
+
artefact_name=parent_name,
|
|
30
30
|
all_artefact_names=all_artefact_names,
|
|
31
31
|
message=message
|
|
32
32
|
)
|
|
@@ -6,6 +6,7 @@ from abc import ABC, abstractmethod
|
|
|
6
6
|
from ara_cli.classifier import Classifier
|
|
7
7
|
import warnings
|
|
8
8
|
import string
|
|
9
|
+
import os
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
ALLOWED_STATUS_VALUES = ("to-do", "in-progress", "review", "done", "closed")
|
|
@@ -188,6 +189,17 @@ class Artefact(BaseModel, ABC):
|
|
|
188
189
|
sub_dir = Classifier.get_sub_directory(self.artefact_type)
|
|
189
190
|
return f"{sub_dir}/{self.title}.{self.artefact_type}"
|
|
190
191
|
|
|
192
|
+
@model_validator(mode="after")
|
|
193
|
+
def ensure_file_path_consistency(self):
|
|
194
|
+
if not self._file_path:
|
|
195
|
+
return self
|
|
196
|
+
file_path = self._file_path
|
|
197
|
+
dir_path = os.path.dirname(file_path)
|
|
198
|
+
artefact_type = self._artefact_type()
|
|
199
|
+
file_path = f"{dir_path}/{self.title}.{artefact_type}"
|
|
200
|
+
self._file_path = file_path
|
|
201
|
+
return self
|
|
202
|
+
|
|
191
203
|
@field_validator('artefact_type')
|
|
192
204
|
def validate_artefact_type(cls, v):
|
|
193
205
|
if not isinstance(v, ArtefactType):
|
ara_cli/artefact_renamer.py
CHANGED
|
@@ -2,7 +2,10 @@ import os
|
|
|
2
2
|
from functools import lru_cache
|
|
3
3
|
from ara_cli.classifier import Classifier
|
|
4
4
|
from ara_cli.artefact_link_updater import ArtefactLinkUpdater
|
|
5
|
+
from ara_cli.artefact_reader import ArtefactReader
|
|
6
|
+
from ara_cli.artefact_models.artefact_model import Contribution
|
|
5
7
|
from ara_cli.template_manager import DirectoryNavigator
|
|
8
|
+
from ara_cli.artefact_fuzzy_search import suggest_close_name_matches
|
|
6
9
|
import re
|
|
7
10
|
|
|
8
11
|
|
|
@@ -22,47 +25,65 @@ class ArtefactRenamer:
|
|
|
22
25
|
return re.compile(pattern)
|
|
23
26
|
|
|
24
27
|
def rename(self, old_name, new_name, classifier):
|
|
25
|
-
original_directory = self.navigate_to_target()
|
|
26
|
-
|
|
27
28
|
if not new_name:
|
|
28
29
|
raise ValueError("New name must be provided for renaming.")
|
|
29
|
-
|
|
30
30
|
if not Classifier.is_valid_classifier(classifier):
|
|
31
31
|
raise ValueError("Invalid classifier provided. Please provide a valid classifier.")
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
original_directory = self.navigate_to_target()
|
|
34
|
+
|
|
35
|
+
classified_artefacts = ArtefactReader.read_artefacts()
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
artefacts_by_current_classifier = classified_artefacts.get(classifier, [])
|
|
38
|
+
matching_artefacts = list(filter(lambda a: a.title == old_name, artefacts_by_current_classifier))
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
if not matching_artefacts:
|
|
41
|
+
all_artefact_names = [artefact.title for artefact in artefacts_by_current_classifier]
|
|
42
|
+
suggest_close_name_matches(old_name, all_artefact_names)
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
matching_artefact = matching_artefacts[0]
|
|
46
|
+
|
|
47
|
+
old_file_path = matching_artefact.file_path
|
|
48
|
+
old_base_path = self.file_system.path.dirname(old_file_path)
|
|
49
|
+
old_dir_path = f"{old_base_path}/{old_name}.data"
|
|
41
50
|
|
|
42
|
-
# Check if the original file exists
|
|
43
51
|
if not self.file_system.path.exists(old_file_path):
|
|
44
52
|
raise FileNotFoundError(f"The file {old_file_path} does not exist.")
|
|
45
53
|
|
|
46
|
-
|
|
54
|
+
children_by_classifier = ArtefactReader.find_children(
|
|
55
|
+
artefact_name=old_name,
|
|
56
|
+
classifier=classifier,
|
|
57
|
+
classified_artefacts=classified_artefacts
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
matching_artefact.title = new_name
|
|
61
|
+
new_file_path = matching_artefact.file_path
|
|
62
|
+
new_base_path = self.file_system.path.dirname(new_file_path)
|
|
63
|
+
new_dir_path = f"{new_base_path}/{new_name}.data"
|
|
47
64
|
if self.file_system.path.exists(new_file_path):
|
|
48
65
|
raise FileExistsError(f"The new file name {new_file_path} already exists.")
|
|
49
66
|
if self.file_system.path.exists(new_dir_path):
|
|
50
67
|
raise FileExistsError(f"The new directory name {new_dir_path} already exists.")
|
|
51
68
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
self.file_system.rename(old_dir_path, new_dir_path)
|
|
57
|
-
print(f"Renamed directory: {old_dir_path} to {new_dir_path}")
|
|
69
|
+
serialized_artefact = matching_artefact.serialize()
|
|
70
|
+
with open(matching_artefact.file_path, 'w') as file:
|
|
71
|
+
file.write(serialized_artefact)
|
|
72
|
+
self.file_system.remove(old_file_path)
|
|
58
73
|
|
|
59
|
-
|
|
60
|
-
|
|
74
|
+
if self.file_system.path.exists(old_dir_path):
|
|
75
|
+
self.file_system.rename(old_dir_path, new_dir_path)
|
|
61
76
|
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
for children in children_by_classifier.values():
|
|
78
|
+
for child in children:
|
|
79
|
+
contribution = child.contribution
|
|
80
|
+
contribution.artefact_name = new_name
|
|
81
|
+
child.contribution = contribution
|
|
82
|
+
serialized_artefact = child.serialize()
|
|
83
|
+
with open(child.file_path, 'w') as file:
|
|
84
|
+
file.write(serialized_artefact)
|
|
64
85
|
|
|
65
|
-
|
|
86
|
+
self.file_system.chdir(original_directory)
|
|
66
87
|
|
|
67
88
|
def _update_title_in_artefact(self, artefact_path, new_title, classifier):
|
|
68
89
|
# Format the new title: replace underscores with spaces
|
ara_cli/chat.py
CHANGED
|
@@ -662,7 +662,8 @@ Start chatting (type 'HELP'/'h' for available commands, 'QUIT'/'q' to exit chat
|
|
|
662
662
|
local_templates_path = os.path.join(os.getcwd(), local_templates_path)
|
|
663
663
|
os.chdir(original_directory)
|
|
664
664
|
|
|
665
|
-
|
|
665
|
+
custom_prompt_templates_subdir = self.config.custom_prompt_templates_subdir
|
|
666
|
+
template_directory = f"{local_templates_path}/{custom_prompt_templates_subdir}/{plural}"
|
|
666
667
|
self._load_helper(template_directory, template_name, template_type)
|
|
667
668
|
|
|
668
669
|
def _load_template_helper(self, template_name, template_type, default_pattern):
|
ara_cli/tag_extractor.py
CHANGED
|
@@ -6,7 +6,7 @@ class TagExtractor:
|
|
|
6
6
|
def __init__(self, file_system=None):
|
|
7
7
|
self.file_system = file_system or os
|
|
8
8
|
|
|
9
|
-
def extract_tags(self, navigate_to_target=False):
|
|
9
|
+
def extract_tags(self, navigate_to_target=False, include_classifier=None):
|
|
10
10
|
from ara_cli.template_manager import DirectoryNavigator
|
|
11
11
|
from ara_cli.artefact_reader import ArtefactReader
|
|
12
12
|
|
|
@@ -16,6 +16,9 @@ class TagExtractor:
|
|
|
16
16
|
|
|
17
17
|
artefacts = ArtefactReader.read_artefacts()
|
|
18
18
|
|
|
19
|
+
if include_classifier:
|
|
20
|
+
artefacts = {include_classifier: artefacts[include_classifier]}
|
|
21
|
+
|
|
19
22
|
unique_tags = set()
|
|
20
23
|
|
|
21
24
|
for artefact_list in artefacts.values():
|
|
@@ -19,13 +19,6 @@ def cleanup():
|
|
|
19
19
|
shutil.rmtree(new_data_dir)
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
@patch("ara_cli.artefact_renamer.os.path.exists")
|
|
23
|
-
def test_rename_checks_filename_exists(mock_exists):
|
|
24
|
-
mock_exists.return_value = False
|
|
25
|
-
ar = ArtefactRenamer(os)
|
|
26
|
-
with pytest.raises(FileNotFoundError):
|
|
27
|
-
ar.rename("nonexistent_file", "new_file", "vision")
|
|
28
|
-
|
|
29
22
|
def test_rename_checks_classifier_valid():
|
|
30
23
|
ar = ArtefactRenamer(os)
|
|
31
24
|
with pytest.raises(ValueError):
|
|
@@ -38,60 +31,6 @@ def test_rename_checks_new_name_provided():
|
|
|
38
31
|
ar.rename("existing_file", None, None)
|
|
39
32
|
|
|
40
33
|
|
|
41
|
-
@patch("builtins.open", new_callable=mock_open, read_data="Vision: Old Title\nOther content.")
|
|
42
|
-
@patch("ara_cli.artefact_renamer.os.rename")
|
|
43
|
-
@patch("ara_cli.artefact_renamer.os.path.exists", side_effect=[True, True, False, False, True])
|
|
44
|
-
def test_rename_filename_with_new_name(mock_exists, mock_rename, mock_open):
|
|
45
|
-
ar = ArtefactRenamer(os)
|
|
46
|
-
ar.rename("existing_file", "new_file", "vision")
|
|
47
|
-
assert mock_rename.call_count == 2
|
|
48
|
-
mock_rename.assert_has_calls([
|
|
49
|
-
call("vision/existing_file.vision", "vision/new_file.vision"),
|
|
50
|
-
call("vision/existing_file.data", "vision/new_file.data")
|
|
51
|
-
])
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
@patch("ara_cli.artefact_renamer.os.path.exists", side_effect=[True, True, True, False])
|
|
55
|
-
def test_rename_throws_error_if_new_file_or_directory_exists(mock_exists):
|
|
56
|
-
ar = ArtefactRenamer(os)
|
|
57
|
-
with pytest.raises(FileExistsError):
|
|
58
|
-
ar.rename("existing_file", "existing_file", "vision")
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
@patch("ara_cli.artefact_renamer.os.path.exists", side_effect=[True, False, False])
|
|
62
|
-
def test_rename_checks_related_data_folder_exists(mock_exists):
|
|
63
|
-
ar = ArtefactRenamer(os)
|
|
64
|
-
with pytest.raises(FileNotFoundError):
|
|
65
|
-
ar.rename("old_name", "new_name", "userstory")
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@patch("builtins.open", new_callable=mock_open, read_data="Userstory: Old Title\nOther content.")
|
|
69
|
-
@patch("ara_cli.artefact_renamer.os.rename")
|
|
70
|
-
@patch("ara_cli.artefact_renamer.os.path.exists", side_effect=[True, True, False, False, True])
|
|
71
|
-
def test_rename_also_renames_related_data_folder(mock_exists, mock_rename, mock_open):
|
|
72
|
-
ar = ArtefactRenamer(os)
|
|
73
|
-
ar.rename("old_name", "new_name", "userstory")
|
|
74
|
-
assert mock_rename.call_count == 2
|
|
75
|
-
mock_rename.assert_has_calls([
|
|
76
|
-
call("userstories/old_name.userstory", "userstories/new_name.userstory"),
|
|
77
|
-
call("userstories/old_name.data", "userstories/new_name.data")
|
|
78
|
-
])
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
@patch("ara_cli.artefact_renamer.os.path.exists", side_effect=[True, True, True])
|
|
82
|
-
def test_rename_throws_error_if_new_file_path_exists(mock_exists):
|
|
83
|
-
ar = ArtefactRenamer()
|
|
84
|
-
with pytest.raises(FileExistsError):
|
|
85
|
-
ar.rename("old_name", "new_name", "userstory")
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
@patch("ara_cli.artefact_renamer.os.path.exists", side_effect=[True, True, False, True])
|
|
89
|
-
def test_rename_throws_error_if_new_data_directory_exists(mock_exists):
|
|
90
|
-
ar = ArtefactRenamer()
|
|
91
|
-
with pytest.raises(FileExistsError):
|
|
92
|
-
ar.rename("old_name", "new_name", "userstory")
|
|
93
|
-
|
|
94
|
-
|
|
95
34
|
@pytest.mark.parametrize("classifier,artefact_name,read_data_prefix,old_title,new_title", [
|
|
96
35
|
("vision", "Vision", "Vision: ", "Old Title", "New title"),
|
|
97
36
|
("businessgoal", "Businessgoal", "Businessgoal: ", "Old Title", "New title"),
|
ara_cli/tests/test_chat.py
CHANGED
|
@@ -930,20 +930,24 @@ def test_do_LOAD_COMMANDS(monkeypatch, temp_chat_file, commands_name, expected_d
|
|
|
930
930
|
mock_load_template_helper.assert_called_once_with(commands_name, "commands", "*.commands.md")
|
|
931
931
|
|
|
932
932
|
|
|
933
|
-
@pytest.mark.parametrize("template_name, template_type, default_pattern, expected_directory, expected_pattern", [
|
|
934
|
-
("global/test_command", "commands", "*.commands.md", "mocked_template_base_path/prompt-modules/commands/", "test_command"),
|
|
935
|
-
("local_command", "commands", "*.commands.md", "/project/mocked_local_templates_path/custom-prompt-modules/commands", "local_command"),
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
("
|
|
939
|
-
|
|
940
|
-
("
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
("
|
|
944
|
-
("
|
|
933
|
+
@pytest.mark.parametrize("template_name, template_type, default_pattern, custom_template_subdir, expected_directory, expected_pattern", [
|
|
934
|
+
("global/test_command", "commands", "*.commands.md", "mocked_custom_modules_path", "mocked_template_base_path/prompt-modules/commands/", "test_command"),
|
|
935
|
+
("local_command", "commands", "*.commands.md", "custom-prompt-modules", "/project/mocked_local_templates_path/custom-prompt-modules/commands", "local_command"),
|
|
936
|
+
("local_command", "commands", "*.commands.md", "mocked_custom_modules_path", "/project/mocked_local_templates_path/mocked_custom_modules_path/commands", "local_command"),
|
|
937
|
+
|
|
938
|
+
("global/test_rule", "rules", "*.rules.md", "mocked_custom_modules_path", "mocked_template_base_path/prompt-modules/rules/", "test_rule"),
|
|
939
|
+
("local_rule", "rules", "*.rules.md", "custom-prompt-modules", "/project/mocked_local_templates_path/custom-prompt-modules/rules", "local_rule"),
|
|
940
|
+
("local_rule", "rules", "*.rules.md", "mocked_custom_modules_path", "/project/mocked_local_templates_path/mocked_custom_modules_path/rules", "local_rule"),
|
|
941
|
+
|
|
942
|
+
("global/test_intention", "intention", "*.intentions.md", "mocked_custom_modules_path", "mocked_template_base_path/prompt-modules/intentions/", "test_intention"),
|
|
943
|
+
("local_intention", "intention", "*.intentions.md", "custom-prompt-modules", "/project/mocked_local_templates_path/custom-prompt-modules/intentions", "local_intention"),
|
|
944
|
+
("local_intention", "intention", "*.intentions.md", "mocked_custom_modules_path", "/project/mocked_local_templates_path/mocked_custom_modules_path/intentions", "local_intention"),
|
|
945
|
+
|
|
946
|
+
("global/test_blueprint", "blueprint", "*.blueprints.md", "mocked_custom_modules_path", "mocked_template_base_path/prompt-modules/blueprints/", "test_blueprint"),
|
|
947
|
+
("local_blueprint", "blueprint", "*.blueprints.md", "custom-prompt-modules", "/project/mocked_local_templates_path/custom-prompt-modules/blueprints", "local_blueprint"),
|
|
948
|
+
("local_blueprint", "blueprint", "*.blueprints.md", "mocked_custom_modules_path", "/project/mocked_local_templates_path/mocked_custom_modules_path/blueprints", "local_blueprint")
|
|
945
949
|
])
|
|
946
|
-
def test_load_template_from_global_or_local(monkeypatch, temp_chat_file, template_name, template_type, default_pattern, expected_directory, expected_pattern):
|
|
950
|
+
def test_load_template_from_global_or_local(monkeypatch, temp_chat_file, template_name, template_type, default_pattern, custom_template_subdir, expected_directory, expected_pattern):
|
|
947
951
|
mock_config = get_default_config()
|
|
948
952
|
with patch('ara_cli.prompt_handler.ConfigManager.get_config', return_value=mock_config):
|
|
949
953
|
chat = Chat(temp_chat_file.name, reset=False)
|
|
@@ -956,6 +960,7 @@ def test_load_template_from_global_or_local(monkeypatch, temp_chat_file, templat
|
|
|
956
960
|
|
|
957
961
|
config = chat.config
|
|
958
962
|
config.local_prompt_templates_dir = mock_local_templates_path
|
|
963
|
+
config.custom_prompt_templates_subdir = custom_template_subdir
|
|
959
964
|
chat.config = config
|
|
960
965
|
|
|
961
966
|
with patch.object(chat, '_load_helper') as mock_load_helper:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
from unittest.mock import MagicMock, patch
|
|
3
|
-
from ara_cli.tag_extractor import TagExtractor
|
|
3
|
+
from ara_cli.tag_extractor import TagExtractor
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
@pytest.fixture
|
|
6
7
|
def artefact():
|
|
@@ -10,22 +11,29 @@ def artefact():
|
|
|
10
11
|
self.tags = tags
|
|
11
12
|
self.status = status
|
|
12
13
|
self.users = users
|
|
13
|
-
|
|
14
14
|
return Artefact
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
|
|
17
|
+
@pytest.mark.parametrize("navigate_to_target, include_classifier, artefact_data, expected_tags", [
|
|
18
|
+
(False, None, {'artefacts': [
|
|
19
|
+
(['tag1', 'tag2'], 'status1', ['user1', 'user2']),
|
|
20
|
+
(['tag3'], 'status2', ['user3'])
|
|
21
|
+
]}, ['status1', 'status2', 'tag1', 'tag2', 'tag3', 'user_user1', 'user_user2', 'user_user3']),
|
|
22
|
+
|
|
23
|
+
(False, 'key', {'key': [
|
|
24
|
+
(['tag1', 'tag2'], 'status1', ['user1', 'user2'])
|
|
25
|
+
]}, ['status1', 'tag1', 'tag2', 'user_user1', 'user_user2']),
|
|
26
|
+
|
|
27
|
+
(True, None, {'artefacts': [
|
|
28
|
+
(['tag3'], 'status2', ['user3'])
|
|
29
|
+
]}, ['status2', 'tag3', 'user_user3'])
|
|
23
30
|
])
|
|
24
31
|
@patch('ara_cli.template_manager.DirectoryNavigator')
|
|
25
32
|
@patch('ara_cli.artefact_reader.ArtefactReader')
|
|
26
|
-
def test_extract_tags(mock_artefact_reader, mock_directory_navigator, artefact, navigate_to_target, artefact_data, expected_tags):
|
|
33
|
+
def test_extract_tags(mock_artefact_reader, mock_directory_navigator, artefact, navigate_to_target, include_classifier, artefact_data, expected_tags):
|
|
27
34
|
# Mock the artefact reader to return artefact data
|
|
28
|
-
mock_artefact_reader.read_artefacts.return_value = {
|
|
35
|
+
mock_artefact_reader.read_artefacts.return_value = {key: [artefact(
|
|
36
|
+
*data) for data in artefact_list] for key, artefact_list in artefact_data.items()}
|
|
29
37
|
|
|
30
38
|
# Mock the directory navigator
|
|
31
39
|
mock_navigator_instance = mock_directory_navigator.return_value
|
|
@@ -33,8 +41,9 @@ def test_extract_tags(mock_artefact_reader, mock_directory_navigator, artefact,
|
|
|
33
41
|
|
|
34
42
|
tag_extractor = TagExtractor()
|
|
35
43
|
|
|
36
|
-
# Run the extract_tags method
|
|
37
|
-
result = tag_extractor.extract_tags(
|
|
44
|
+
# Run the extract_tags method with include_classifier
|
|
45
|
+
result = tag_extractor.extract_tags(
|
|
46
|
+
navigate_to_target=navigate_to_target, include_classifier=include_classifier)
|
|
38
47
|
|
|
39
48
|
# Assertions
|
|
40
49
|
if navigate_to_target:
|
|
@@ -42,4 +51,4 @@ def test_extract_tags(mock_artefact_reader, mock_directory_navigator, artefact,
|
|
|
42
51
|
else:
|
|
43
52
|
mock_navigator_instance.navigate_to_target.assert_not_called()
|
|
44
53
|
|
|
45
|
-
assert result == expected_tags
|
|
54
|
+
assert result == expected_tags
|
ara_cli/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
# version.py
|
|
2
|
-
__version__ = "0.1.9.
|
|
2
|
+
__version__ = "0.1.9.54" # fith parameter like .0 for local install test purposes only. official numbers should be 4 digit numbers
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
ara_cli/__init__.py,sha256=0zl7IegxTid26EBGLav_fXZ4CCIV3H5TfAoFQiOHjvg,148
|
|
2
2
|
ara_cli/__main__.py,sha256=3fYaQUcudgjqtJa2gj2LoYnhy-Wy1OfZIfXEYQf4m0U,1806
|
|
3
3
|
ara_cli/analyse_artefacts.py,sha256=JwA2zxkCy8vNOHoU9f3TICJesXRRXndHi2hT5m_uQ8Q,4965
|
|
4
|
-
ara_cli/ara_command_action.py,sha256=
|
|
5
|
-
ara_cli/ara_command_parser.py,sha256=
|
|
6
|
-
ara_cli/ara_config.py,sha256=
|
|
4
|
+
ara_cli/ara_command_action.py,sha256=OsmNJ9XHVMPveVO0kxlYNU5vR16bX9Sn7mGKaOieZqg,18925
|
|
5
|
+
ara_cli/ara_command_parser.py,sha256=HluFJimQbxS_yuZ2IzLcsfUPrmIJbKJB71YvsGiUXQE,16883
|
|
6
|
+
ara_cli/ara_config.py,sha256=_Arkr-b9XnrNHbBlFKb9tAo3OmdP4ZZiWvbY9m6Sbo0,4178
|
|
7
7
|
ara_cli/artefact_creator.py,sha256=s0hY8-X0EAwEfZvIRK1F67bW55tB-EvgnvH2gYNTGpY,6022
|
|
8
8
|
ara_cli/artefact_deleter.py,sha256=Co4wwCH3yW8H9NrOq7_2p5571EeHr0TsfE-H8KqoOfY,1900
|
|
9
|
-
ara_cli/artefact_fuzzy_search.py,sha256=
|
|
9
|
+
ara_cli/artefact_fuzzy_search.py,sha256=XAvoiRafd1u21uKbX5-bow7hdq7uiLLy1KtxHNAFbCk,1337
|
|
10
10
|
ara_cli/artefact_link_updater.py,sha256=itMS_Z64jE8bBly9WA01z8PqkBeNW6ntTO7ryMeCTRg,3703
|
|
11
11
|
ara_cli/artefact_lister.py,sha256=jhk4n4eqp7hDIq07q43QzS7-36BM3OfZ4EABxCeOGcw,4764
|
|
12
12
|
ara_cli/artefact_reader.py,sha256=qNaMPWShmWtDU5LLdh9efFB27djI4NAoq6zEFwdTd38,6983
|
|
13
|
-
ara_cli/artefact_renamer.py,sha256=
|
|
13
|
+
ara_cli/artefact_renamer.py,sha256=g9rM6GN6mZgjF1Ct6wrH-PuPH1HVF7vhjdyttOfHS1E,4865
|
|
14
14
|
ara_cli/artefact_scan.py,sha256=DgFGv4hnbCjYdIgPA2PbAuGDWg1q2fCjtIqxGs57b9w,1762
|
|
15
|
-
ara_cli/chat.py,sha256=
|
|
15
|
+
ara_cli/chat.py,sha256=7xTtPEDk052_wmIzoti7GavEJ1vpRxe5c084WQ1C7dg,28617
|
|
16
16
|
ara_cli/classifier.py,sha256=zWskj7rBYdqYBGjksBm46iTgVU5IIf2PZsJr4qeiwVU,1878
|
|
17
17
|
ara_cli/codefusionretriever.py,sha256=fCHgXdIBRzkVAnapX-KI2NQ44XbrrF4tEQmn5J6clUI,1980
|
|
18
18
|
ara_cli/codehierachieretriever.py,sha256=Xd3EgEWWhkSf1TmTWtf8X5_YvyE_4B66nRrqarwSiTU,1182
|
|
@@ -28,13 +28,13 @@ ara_cli/prompt_extractor.py,sha256=gidrCI8wTLfPL0ktqiXyPeGdQEB0S0sZegSOiF1Nn0Y,7
|
|
|
28
28
|
ara_cli/prompt_handler.py,sha256=PzHoIPTAWtRleOMtprhyYlFfo59S5T_kzHHkrwL-cNU,17155
|
|
29
29
|
ara_cli/prompt_rag.py,sha256=vmlt4-rSboWibwgO_KUF79TK99YXT5KXjmbD9FeWdZY,7449
|
|
30
30
|
ara_cli/run_file_lister.py,sha256=XbrrDTJXp1LFGx9Lv91SNsEHZPP-PyEMBF_P4btjbDA,2360
|
|
31
|
-
ara_cli/tag_extractor.py,sha256=
|
|
31
|
+
ara_cli/tag_extractor.py,sha256=R5T103Y60NppYifKV7b8KoI5kE1M66fULz6f_Fdc9VU,1081
|
|
32
32
|
ara_cli/template_manager.py,sha256=YXPj2jGNDb-diIHFEK_vGJ-ZucodnXSGAPofKTnOofI,6633
|
|
33
33
|
ara_cli/update_config_prompt.py,sha256=PZgNIN3dTw6p80GyX8Sp5apkAhSoykwnkEbHo3IOkUo,4571
|
|
34
|
-
ara_cli/version.py,sha256=
|
|
34
|
+
ara_cli/version.py,sha256=joWtfEHQKcqd_HWWG1S1SAlSYqkEtgwJ2k-0v2dWJTk,146
|
|
35
35
|
ara_cli/artefact_models/artefact_load.py,sha256=dNcwZDW2Dk0bts9YnPZ0ESmWD2NbsLIvl4Z-qQeGmTQ,401
|
|
36
36
|
ara_cli/artefact_models/artefact_mapping.py,sha256=8aD0spBjkJ8toMAmFawc6UTUxB6-tEEViZXv2I-r88Q,1874
|
|
37
|
-
ara_cli/artefact_models/artefact_model.py,sha256=
|
|
37
|
+
ara_cli/artefact_models/artefact_model.py,sha256=UQaLeuFzVOJViuMbFOgMY8zW7ihgxZZMV86Li7Tpjds,14847
|
|
38
38
|
ara_cli/artefact_models/artefact_templates.py,sha256=Vd7SwoRVKNGKZmxBKS6f9FE1ThUOCqZLScu0ClPfIu8,8321
|
|
39
39
|
ara_cli/artefact_models/businessgoal_artefact_model.py,sha256=u9-Rr7VDYoNP6Vy2iKE64yAxDPOnrJJFozO6Ji9s8pI,4570
|
|
40
40
|
ara_cli/artefact_models/capability_artefact_model.py,sha256=SZqHx4O2mj4urn77Stnj4_Jxtlq3-LgBBU9SMkByppI,3079
|
|
@@ -136,20 +136,20 @@ ara_cli/tests/test_artefact_fuzzy_search.py,sha256=5Sh3_l9QK8-WHn6JpGPU1b6h4QEnl
|
|
|
136
136
|
ara_cli/tests/test_artefact_link_updater.py,sha256=gN5KFF1uY7OoBh8Mr5jWpqXp02YCU5OSIpSU76Rm4Gs,2137
|
|
137
137
|
ara_cli/tests/test_artefact_lister.py,sha256=VCEOCgDgnAOeUUgIoGAbWgz60hf9UT-tdHg18LGfB34,22656
|
|
138
138
|
ara_cli/tests/test_artefact_reader.py,sha256=660K-d8ed-j8hulsUB_7baPD2-hhbg9TffUR5yVc4Uo,927
|
|
139
|
-
ara_cli/tests/test_artefact_renamer.py,sha256=
|
|
139
|
+
ara_cli/tests/test_artefact_renamer.py,sha256=syL3qH8pPRmxPkpmKXInZ7WTI8X487YJXsgiZOtv2C4,3490
|
|
140
140
|
ara_cli/tests/test_artefact_scan.py,sha256=m0V3HMLJtrOBXpJIRUI0D6MbHssgxDU_c935Wc3jatQ,4696
|
|
141
|
-
ara_cli/tests/test_chat.py,sha256=
|
|
141
|
+
ara_cli/tests/test_chat.py,sha256=V75baLk2ZFz5WDSFTlvdbmMb6Dm7o12xoFEulmMgMDI,46765
|
|
142
142
|
ara_cli/tests/test_classifier.py,sha256=grYGPksydNdPsaEBQxYHZTuTdcJWz7VQtikCKA6BNaQ,1920
|
|
143
143
|
ara_cli/tests/test_directory_navigator.py,sha256=7G0MVrBbtBvbrFUpL0zb_9EkEWi1dulWuHsrQxMJxDY,140
|
|
144
144
|
ara_cli/tests/test_file_classifier.py,sha256=6OYM-lYVYjxq4Qwl8U1btv_FYJhc5t3rKjYr2CXZ4uI,10069
|
|
145
145
|
ara_cli/tests/test_file_creator.py,sha256=ssrl7gfU13H4ogrrX1BXx4WO4bQ7OG1R2tXZC1MP8EY,2004
|
|
146
146
|
ara_cli/tests/test_file_lister.py,sha256=f6B_vIv-wAulKH2ZGgNg4SG79XqGGbfwoIvZlbEnYyM,4306
|
|
147
147
|
ara_cli/tests/test_list_filter.py,sha256=gSRKirTtFuhRS3QlFHqWl89WvCvAdVEnFsCWTYmgB2o,7928
|
|
148
|
-
ara_cli/tests/test_tag_extractor.py,sha256=
|
|
148
|
+
ara_cli/tests/test_tag_extractor.py,sha256=n2xNApbDciqKO3QuaveEWSPXU1PCUa_EhxlZMrukONw,2074
|
|
149
149
|
ara_cli/tests/test_template_manager.py,sha256=bRxka6cxHsCAOvXjfG8MrVO8qSZXhxW01tnph80UtNk,3143
|
|
150
150
|
ara_cli/tests/test_update_config_prompt.py,sha256=vSsLvc18HZdVjVM93qXWVbJt752xTLL6VGjSVCrPufk,6729
|
|
151
|
-
ara_cli-0.1.9.
|
|
152
|
-
ara_cli-0.1.9.
|
|
153
|
-
ara_cli-0.1.9.
|
|
154
|
-
ara_cli-0.1.9.
|
|
155
|
-
ara_cli-0.1.9.
|
|
151
|
+
ara_cli-0.1.9.54.dist-info/METADATA,sha256=OPj9OD4lnrIgr6rBNggL63nB9ITFSgEfDsFVzbT7Bms,367
|
|
152
|
+
ara_cli-0.1.9.54.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
|
|
153
|
+
ara_cli-0.1.9.54.dist-info/entry_points.txt,sha256=v4h7MzysTgSIDYfEo3oj4Kz_8lzsRa3hq-KJHEcLVX8,45
|
|
154
|
+
ara_cli-0.1.9.54.dist-info/top_level.txt,sha256=zzee_PwFmKqfBi9XgIunP6xy2S4TIt593CLLxenNaAE,8
|
|
155
|
+
ara_cli-0.1.9.54.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|