ara-cli 0.1.9.60__py3-none-any.whl → 0.1.9.62__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/__main__.py CHANGED
@@ -18,7 +18,8 @@ from ara_cli.ara_command_action import (
18
18
  set_status_action,
19
19
  set_user_action,
20
20
  classifier_directory_action,
21
- scan_action
21
+ scan_action,
22
+ autofix_action
22
23
  )
23
24
  import argcomplete
24
25
  import sys
@@ -42,7 +43,8 @@ def define_action_mapping():
42
43
  "set-status": set_status_action,
43
44
  "set-user": set_user_action,
44
45
  "classifier-directory": classifier_directory_action,
45
- "scan": scan_action
46
+ "scan": scan_action,
47
+ "autofix": autofix_action
46
48
  }
47
49
 
48
50
 
@@ -538,3 +538,27 @@ def scan_action(args):
538
538
  if invalid:
539
539
  invalid_artefacts[classifier] = invalid
540
540
  show_results(invalid_artefacts)
541
+
542
+
543
+ def autofix_action(args):
544
+ from ara_cli.artefact_autofix import parse_report, apply_autofix, read_report_file
545
+
546
+ content = read_report_file()
547
+
548
+ if not content:
549
+ return False
550
+
551
+ issues = parse_report(content)
552
+
553
+ if not issues:
554
+ print("No issues found in the report. Nothing to fix.")
555
+ return
556
+
557
+ # print("Found issues to fix:")
558
+ for classifier, files in issues.items():
559
+ print(f"\nClassifier: {classifier}")
560
+ for file_path, reason in files:
561
+ print(f"Attempting to fix {file_path} for reason: {reason}")
562
+ apply_autofix(file_path, classifier, reason)
563
+
564
+ print("\nAutofix process completed. Please review the changes.")
@@ -220,6 +220,10 @@ def scan_parser(subparsers):
220
220
  subparsers.add_parser("scan", help="Scan ARA tree for incompatible artefacts.")
221
221
 
222
222
 
223
+ def autofix_parser(subparsers):
224
+ subparsers.add_parser("autofix", help="Fix ARA tree with llm models for scanned artefacts with ara scan command.")
225
+
226
+
223
227
  class CustomHelpFormatter(argparse.HelpFormatter):
224
228
  def format_help(self):
225
229
  from sys import argv
@@ -307,5 +311,6 @@ def action_parser():
307
311
  set_user_parser(subparsers)
308
312
  classifier_directory_parser(subparsers)
309
313
  scan_parser(subparsers)
314
+ autofix_parser(subparsers)
310
315
 
311
316
  return parser
@@ -0,0 +1,134 @@
1
+ def read_report_file():
2
+ file_path = "incompatible_artefacts_report.md"
3
+ try:
4
+ with open(file_path, "r", encoding="utf-8") as f:
5
+ content = f.read()
6
+ except OSError:
7
+ print('Artefact scan results file not found. Did you run the "ara scan" command?')
8
+ return
9
+
10
+ return content
11
+
12
+
13
+ def parse_report(content: str) -> dict:
14
+ """
15
+ Parses the incompatible artefacts report and returns structured data.
16
+ Returns a dictionary where keys are artefact classifiers, and values are lists of (file_path, reason) tuples.
17
+ """
18
+ lines = content.splitlines()
19
+ issues = {}
20
+ current_classifier = None
21
+
22
+ if not lines or lines[0] != "# Artefact Check Report":
23
+ return issues # Geçersiz rapor formatı
24
+
25
+ if len(lines) >= 3 and lines[2] == "No problems found.":
26
+ return issues # Hiç sorun bulunamadı
27
+
28
+ for line in lines[1:]: # Başlıktan sonraki satırları işle
29
+ line = line.strip()
30
+ if not line:
31
+ continue
32
+
33
+ # Classifier başlığı tespiti (## ile başlayan)
34
+ if line.startswith("## "):
35
+ current_classifier = line[3:].strip()
36
+ issues[current_classifier] = []
37
+
38
+ # Dosya listesi tespiti (- ile başlayan)
39
+ elif line.startswith("- ") and current_classifier is not None:
40
+ # Format: "- `file_path`: reason"
41
+ parts = line.split("`", 2)
42
+ if len(parts) < 3:
43
+ continue # Geçersiz format
44
+
45
+ file_path = parts[1]
46
+ reason = parts[2].split(
47
+ ":", 1)[1].strip() if ":" in parts[2] else ""
48
+ issues[current_classifier].append((file_path, reason))
49
+
50
+ return issues
51
+
52
+
53
+ def read_artefact(file_path):
54
+ """Reads the artefact text from the given file path."""
55
+ try:
56
+ with open(file_path, 'r') as file:
57
+ return file.read()
58
+ except FileNotFoundError:
59
+ print(f"File not found: {file_path}")
60
+ return None
61
+
62
+
63
+ def determine_artefact_type_and_class(classifier):
64
+ from ara_cli.artefact_models.artefact_mapping import artefact_type_mapping
65
+ from ara_cli.artefact_models.artefact_model import ArtefactType
66
+
67
+ try:
68
+ artefact_type = ArtefactType(classifier)
69
+ except ValueError:
70
+ print(f"Invalid classifier: {classifier}")
71
+ return None, None
72
+
73
+ artefact_class = artefact_type_mapping.get(artefact_type)
74
+ if not artefact_class:
75
+ print(f"No artefact class found for {artefact_type}")
76
+ return None, None
77
+
78
+ return artefact_type, artefact_class
79
+
80
+
81
+ def construct_prompt(artefact_type, reason, file_path, artefact_text):
82
+ from ara_cli.artefact_models.artefact_model import ArtefactType
83
+
84
+ prompt = (
85
+ f"Correct the following {artefact_type} artefact to fix the issue: {reason}. "
86
+ f"Provide the complete, corrected artefact. Don't change the artefact's content, "
87
+ f"just fix the pydantic model errors. You should follow the name of the file "
88
+ f"from its path {file_path} for naming the arteafact's title. The current artefact is:\n{artefact_text}"
89
+ )
90
+
91
+ if artefact_type == ArtefactType.task:
92
+ prompt += (
93
+ "\nFor task artefacts, if the action items looks like template or empty "
94
+ "then just delete those action items."
95
+ "\nFor user tag it should be '@user_{username}'. So you should be careful to "
96
+ "not make it @user_user_{username}"
97
+ )
98
+
99
+ return prompt
100
+
101
+
102
+ def run_agent(prompt, artefact_class):
103
+ from pydantic_ai import Agent
104
+
105
+ agent = Agent(model="openai:gpt-4o",
106
+ result_type=artefact_class, instrument=True)
107
+ result = agent.run_sync(prompt)
108
+ return result.data
109
+
110
+
111
+ def write_corrected_artefact(file_path, corrected_text):
112
+ with open(file_path, 'w') as file:
113
+ file.write(corrected_text)
114
+ print(f"Fixed artefact at {file_path}")
115
+
116
+
117
+ def apply_autofix(file_path, classifier, reason):
118
+ artefact_text = read_artefact(file_path)
119
+ if artefact_text is None:
120
+ return
121
+
122
+ artefact_type, artefact_class = determine_artefact_type_and_class(
123
+ classifier)
124
+ if artefact_type is None or artefact_class is None:
125
+ return
126
+
127
+ prompt = construct_prompt(artefact_type, reason, file_path, artefact_text)
128
+
129
+ try:
130
+ corrected_artefact = run_agent(prompt, artefact_class)
131
+ corrected_text = corrected_artefact.serialize()
132
+ write_corrected_artefact(file_path, corrected_text)
133
+ except Exception as e:
134
+ print(f"Failed to fix artefact at {file_path}: {e}")
@@ -59,9 +59,9 @@ class ArtefactCreator:
59
59
 
60
60
  return True
61
61
 
62
- def handle_existing_files(self, file_exists, dir_exists):
63
- if file_exists or dir_exists:
64
- user_choice = input("File or directory already exists. Do you want to overwrite the existing file and directory? (y/N): ")
62
+ def handle_existing_files(self, file_exists):
63
+ if file_exists:
64
+ user_choice = input("File already exists. Do you want to overwrite the existing file and directory? (y/N): ")
65
65
  if user_choice.lower() != "y":
66
66
  print("No changes were made to the existing file and directory.")
67
67
  return False
@@ -102,12 +102,8 @@ class ArtefactCreator:
102
102
  dir_path = self.file_system.path.join(sub_directory, f"{filename}.data")
103
103
 
104
104
  file_exists = self.file_system.path.exists(file_path)
105
- dir_exists = self.file_system.path.exists(dir_path)
106
105
 
107
- if dir_exists and not os.listdir(dir_path):
108
- dir_exists = False
109
-
110
- if not self.handle_existing_files(file_exists, dir_exists):
106
+ if not self.handle_existing_files(file_exists):
111
107
  return
112
108
 
113
109
  artefact = template_artefact_of_type(classifier, filename)
@@ -48,6 +48,7 @@ class BusinessgoalIntent(Intent):
48
48
 
49
49
  in_order_to_prefix = "In order to "
50
50
  as_a_prefix = "As a "
51
+ as_a_prefix_alt = "As an "
51
52
  i_want_prefix = "I want "
52
53
 
53
54
  index = start_index
@@ -57,6 +58,8 @@ class BusinessgoalIntent(Intent):
57
58
  in_order_to = line[len(in_order_to_prefix):].strip()
58
59
  elif line.startswith(as_a_prefix) and not as_a:
59
60
  as_a = line[len(as_a_prefix):].strip()
61
+ elif line.startswith(as_a_prefix_alt) and not as_a:
62
+ as_a = line[len(as_a_prefix_alt):].strip()
60
63
  elif line.startswith(i_want_prefix) and not i_want:
61
64
  i_want = line[len(i_want_prefix):].strip()
62
65
  index += 1
@@ -49,6 +49,7 @@ class EpicIntent(Intent):
49
49
 
50
50
  in_order_to_prefix = "In order to "
51
51
  as_a_prefix = "As a "
52
+ as_a_prefix_alt = "As an "
52
53
  i_want_prefix = "I want "
53
54
 
54
55
  index = start_index
@@ -58,6 +59,8 @@ class EpicIntent(Intent):
58
59
  in_order_to = line[len(in_order_to_prefix):].strip()
59
60
  elif line.startswith(as_a_prefix) and not as_a:
60
61
  as_a = line[len(as_a_prefix):].strip()
62
+ elif line.startswith(as_a_prefix_alt) and not as_a:
63
+ as_a = line[len(as_a_prefix_alt):].strip()
61
64
  elif line.startswith(i_want_prefix) and not i_want:
62
65
  i_want = line[len(i_want_prefix):].strip()
63
66
  index += 1
@@ -1,5 +1,5 @@
1
1
  from pydantic import BaseModel, field_validator, model_validator, Field
2
- from typing import Optional, List, Dict, Tuple, Union
2
+ from typing import List, Dict, Tuple, Union
3
3
  from ara_cli.artefact_models.artefact_model import Artefact, ArtefactType, Intent
4
4
  import re
5
5
 
@@ -48,6 +48,7 @@ class FeatureIntent(Intent):
48
48
  so_that = None
49
49
 
50
50
  as_a_prefix = "As a "
51
+ as_a_prefix_alt = "As an "
51
52
  i_want_to_prefix = "I want to "
52
53
  so_that_prefix = "So that "
53
54
 
@@ -56,6 +57,8 @@ class FeatureIntent(Intent):
56
57
  line = lines[index]
57
58
  if line.startswith(as_a_prefix) and not as_a:
58
59
  as_a = line[len(as_a_prefix):].strip()
60
+ if line.startswith(as_a_prefix_alt) and not as_a:
61
+ as_a = line[len(as_a_prefix_alt):].strip()
59
62
  elif line.startswith(i_want_to_prefix) and not i_want_to:
60
63
  i_want_to = line[len(i_want_to_prefix):].strip()
61
64
  elif line.startswith(so_that_prefix) and not so_that:
@@ -48,6 +48,7 @@ class KeyfeatureIntent(Intent):
48
48
 
49
49
  in_order_to_prefix = "In order to "
50
50
  as_a_prefix = "As a "
51
+ as_a_prefix_alt = "As an "
51
52
  i_want_prefix = "I want "
52
53
 
53
54
  index = start_index
@@ -57,6 +58,8 @@ class KeyfeatureIntent(Intent):
57
58
  in_order_to = line[len(in_order_to_prefix):].strip()
58
59
  elif line.startswith(as_a_prefix) and not as_a:
59
60
  as_a = line[len(as_a_prefix):].strip()
61
+ elif line.startswith(as_a_prefix_alt) and not as_a:
62
+ as_a = line[len(as_a_prefix_alt):].strip()
60
63
  elif line.startswith(i_want_prefix) and not i_want:
61
64
  i_want = line[len(i_want_prefix):].strip()
62
65
  index += 1
@@ -48,6 +48,7 @@ class UserstoryIntent(Intent):
48
48
 
49
49
  in_order_to_prefix = "In order to "
50
50
  as_a_prefix = "As a "
51
+ as_a_prefix_alt = "As an "
51
52
  i_want_prefix = "I want "
52
53
 
53
54
  index = start_index
@@ -57,6 +58,8 @@ class UserstoryIntent(Intent):
57
58
  in_order_to = line[len(in_order_to_prefix):].strip()
58
59
  elif line.startswith(as_a_prefix) and not as_a:
59
60
  as_a = line[len(as_a_prefix):].strip()
61
+ elif line.startswith(as_a_prefix_alt) and not as_a:
62
+ as_a = line[len(as_a_prefix_alt):].strip()
60
63
  elif line.startswith(i_want_prefix) and not i_want:
61
64
  i_want = line[len(i_want_prefix):].strip()
62
65
  index += 1
ara_cli/artefact_scan.py CHANGED
@@ -1,3 +1,6 @@
1
+ from textwrap import indent
2
+
3
+
1
4
  def check_file(file_path, artefact_class):
2
5
  from pydantic import ValidationError
3
6
  try:
@@ -38,7 +41,8 @@ def show_results(invalid_artefacts):
38
41
  print(f"\nIncompatible {classifier} Files:")
39
42
  report.write(f"## {classifier}\n")
40
43
  for file, reason in files:
41
- print(f"\t- {file}")
44
+ indented_reason = indent(reason, prefix="\t\t")
45
+ print(f"\t- {file}\n{indented_reason}")
42
46
  report.write(f"- `{file}`: {reason}\n")
43
47
  report.write("\n")
44
48
  if not has_issues:
@@ -68,6 +68,8 @@ class FileClassifier:
68
68
  files_by_classifier = {classifier: [] for classifier in Classifier.ordered_classifiers()}
69
69
 
70
70
  for root, _, files in self.file_system.walk("."):
71
+ if root.endswith(".data"):
72
+ continue
71
73
  for file in files:
72
74
  file_path = self.file_system.path.join(root, file)
73
75
  classifier = self.classify_file(file_path, tags)
@@ -0,0 +1,113 @@
1
+ import pytest
2
+ from unittest.mock import patch, mock_open, MagicMock
3
+ from ara_cli.artefact_autofix import (
4
+ read_report_file,
5
+ parse_report,
6
+ apply_autofix,
7
+ read_artefact,
8
+ determine_artefact_type_and_class,
9
+ run_agent,
10
+ write_corrected_artefact
11
+ )
12
+ from ara_cli.ara_command_action import autofix_action
13
+
14
+
15
+ def test_read_report_file():
16
+ mock_content = "# Artefact Check Report\n\n## classifier\n- `file_path`: reason\n"
17
+ with patch("builtins.open", mock_open(read_data=mock_content)) as m:
18
+ content = read_report_file()
19
+ assert content == mock_content
20
+ m.assert_called_once_with(
21
+ "incompatible_artefacts_report.md", "r", encoding="utf-8")
22
+
23
+
24
+ def test_parse_report():
25
+ content = "# Artefact Check Report\n\n## classifier\n- `file_path`: reason\n"
26
+ expected_issues = {"classifier": [("file_path", "reason")]}
27
+ issues = parse_report(content)
28
+ assert issues == expected_issues
29
+
30
+
31
+ @patch("ara_cli.artefact_autofix.run_agent")
32
+ @patch("ara_cli.artefact_autofix.write_corrected_artefact")
33
+ def test_apply_autofix(mock_write_corrected_artefact, mock_run_agent):
34
+ mock_run_agent.return_value.serialize.return_value = "corrected content"
35
+ with patch("ara_cli.artefact_autofix.read_artefact", return_value="artefact text"):
36
+ with patch("ara_cli.artefact_autofix.determine_artefact_type_and_class", return_value=("ArtefactType", MagicMock())):
37
+ apply_autofix("file_path", "classifier", "reason")
38
+ mock_run_agent.assert_called_once()
39
+ mock_write_corrected_artefact.assert_called_once_with(
40
+ "file_path", "corrected content")
41
+
42
+
43
+ @patch("ara_cli.artefact_autofix.apply_autofix")
44
+ @patch("ara_cli.artefact_autofix.parse_report")
45
+ @patch("ara_cli.artefact_autofix.read_report_file")
46
+ def test_autofix_action(mock_read_report_file, mock_parse_report, mock_apply_autofix, capsys):
47
+ mock_read_report_file.return_value = "# Artefact Check Report\n\n## classifier\n- `file_path`: reason\n"
48
+ mock_parse_report.return_value = {"classifier": [("file_path", "reason")]}
49
+
50
+ args = MagicMock()
51
+ autofix_action(args)
52
+
53
+ captured = capsys.readouterr()
54
+ assert "Attempting to fix file_path for reason: reason" in captured.out
55
+ mock_apply_autofix.assert_called_once_with(
56
+ "file_path", "classifier", "reason")
57
+
58
+
59
+ def test_read_artefact():
60
+ mock_content = "artefact content"
61
+ with patch("builtins.open", mock_open(read_data=mock_content)) as m:
62
+ content = read_artefact("file_path")
63
+ assert content == mock_content
64
+ m.assert_called_once_with("file_path", "r")
65
+
66
+
67
+ def test_read_report_file_not_found(capsys):
68
+ with patch("builtins.open", side_effect=OSError("File not found")):
69
+ content = read_report_file()
70
+ captured = capsys.readouterr()
71
+ assert content is None
72
+ assert "Artefact scan results file not found" in captured.out
73
+
74
+
75
+ def test_parse_report_no_issues():
76
+ content = "# Artefact Check Report\n\nNo problems found.\n"
77
+ issues = parse_report(content)
78
+ assert issues == {}
79
+
80
+
81
+ def test_parse_report_invalid_format():
82
+ content = "Invalid Format"
83
+ issues = parse_report(content)
84
+ assert issues == {}
85
+
86
+
87
+ def test_determine_artefact_type_and_class_invalid():
88
+ artefact_type, artefact_class = determine_artefact_type_and_class(
89
+ "invalid_classifier")
90
+ assert artefact_type is None
91
+ assert artefact_class is None
92
+
93
+
94
+ def test_write_corrected_artefact():
95
+ corrected_content = "corrected content"
96
+ with patch("builtins.open", mock_open()) as m:
97
+ write_corrected_artefact("file_path", corrected_content)
98
+ m.assert_called_once_with("file_path", "w")
99
+ handle = m()
100
+ handle.write.assert_called_once_with(corrected_content)
101
+
102
+
103
+ @patch("ara_cli.artefact_autofix.read_artefact", return_value=None)
104
+ def test_apply_autofix_file_not_found(mock_read_artefact):
105
+ apply_autofix("file_path", "classifier", "reason")
106
+ mock_read_artefact.assert_called_once_with("file_path")
107
+
108
+
109
+ @patch("pydantic_ai.Agent")
110
+ def test_run_agent_exception_handling(mock_agent):
111
+ mock_agent.return_value.run_sync.side_effect = Exception("Agent error")
112
+ with pytest.raises(Exception, match="Agent error"):
113
+ run_agent("prompt", MagicMock())
@@ -11,7 +11,8 @@ from ara_cli.ara_command_action import (
11
11
  set_status_action,
12
12
  set_user_action,
13
13
  classifier_directory_action,
14
- scan_action
14
+ scan_action,
15
+ autofix_action
15
16
  )
16
17
 
17
18
 
@@ -647,6 +648,7 @@ def test_scan_action_with_issues(capsys):
647
648
  expected_output = (
648
649
  "\nIncompatible classifier1 Files:\n"
649
650
  "\t- file1.txt\n"
651
+ "\t\treason1\n"
650
652
  )
651
653
  assert captured.out == expected_output
652
654
  m.assert_called_once_with("incompatible_artefacts_report.md", "w")
@@ -106,9 +106,12 @@ def test_show_results_with_issues(capsys):
106
106
  expected_output = (
107
107
  "\nIncompatible classifier1 Files:\n"
108
108
  "\t- file1.txt\n"
109
+ "\t\treason1\n"
109
110
  "\t- file2.txt\n"
111
+ "\t\treason2\n"
110
112
  "\nIncompatible classifier2 Files:\n"
111
113
  "\t- file3.txt\n"
114
+ "\t\treason3\n"
112
115
  )
113
116
  assert captured.out == expected_output
114
117
  m.assert_called_once_with("incompatible_artefacts_report.md", "w")
@@ -247,4 +247,25 @@ def test_find_closest_artefact_name_match(mock_file_system):
247
247
  mock_fuzzy.assert_called_once_with('file3', ['file1', 'file2'])
248
248
 
249
249
  # No match for classifier
250
- assert classifier.find_closest_artefact_name_match('file1', 'txt') is None
250
+ assert classifier.find_closest_artefact_name_match('file1', 'txt') is None
251
+
252
+
253
+ @pytest.mark.parametrize("walk_return_value, expected_result", [
254
+ (
255
+ [('.', ['subdir'], ['file1.py']), ('subdir.data', [], ['file_in_data.txt'])],
256
+ {'py': [{'file_path': './file1.py', 'title': 'file1'}], 'txt': [], 'bin': []}
257
+ ),
258
+ (
259
+ [('.', ['subdir'], ['file1.py']), ('subdir', [], ['file2.txt'])],
260
+ {'py': [{'file_path': './file1.py', 'title': 'file1'}], 'txt': [{'file_path': 'subdir/file2.txt', 'title': 'file2'}], 'bin': []}
261
+ )
262
+ ])
263
+ def test_classify_files_skips_data_directories(mock_file_system, mock_classifier, walk_return_value, expected_result):
264
+ mock_file_system.walk.return_value = walk_return_value
265
+ mock_file_system.path.join.side_effect = lambda root, file: f"{root}/{file}"
266
+
267
+ classifier = FileClassifier(mock_file_system)
268
+
269
+ result = classifier.classify_files()
270
+
271
+ assert result == expected_result
ara_cli/version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # version.py
2
- __version__ = "0.1.9.60" # fith parameter like .0 for local install test purposes only. official numbers should be 4 digit numbers
2
+ __version__ = "0.1.9.62" # fith parameter like .0 for local install test purposes only. official numbers should be 4 digit numbers
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ara_cli
3
- Version: 0.1.9.60
3
+ Version: 0.1.9.62
4
4
  Requires-Dist: litellm
5
5
  Requires-Dist: llama-index
6
6
  Requires-Dist: llama-index-llms-openai
@@ -12,4 +12,5 @@ Requires-Dist: argparse
12
12
  Requires-Dist: argcomplete
13
13
  Requires-Dist: cmd2>=2.5
14
14
  Requires-Dist: pydantic
15
+ Requires-Dist: pydantic_ai
15
16
  Dynamic: requires-dist
@@ -1,24 +1,24 @@
1
1
  ara_cli/__init__.py,sha256=0zl7IegxTid26EBGLav_fXZ4CCIV3H5TfAoFQiOHjvg,148
2
- ara_cli/__main__.py,sha256=3fYaQUcudgjqtJa2gj2LoYnhy-Wy1OfZIfXEYQf4m0U,1806
3
- ara_cli/analyse_artefacts.py,sha256=JwA2zxkCy8vNOHoU9f3TICJesXRRXndHi2hT5m_uQ8Q,4965
4
- ara_cli/ara_command_action.py,sha256=OsmNJ9XHVMPveVO0kxlYNU5vR16bX9Sn7mGKaOieZqg,18925
5
- ara_cli/ara_command_parser.py,sha256=HluFJimQbxS_yuZ2IzLcsfUPrmIJbKJB71YvsGiUXQE,16883
2
+ ara_cli/__main__.py,sha256=Z6XYWRLceIoZPvfC-X9EXouSZdtFOOe84kKVWJGA4r4,1861
3
+ ara_cli/ara_command_action.py,sha256=a2NP1cfWnqSkWWGFG_7iMkIkkOTYd83e_kWzdNyKDTI,19618
4
+ ara_cli/ara_command_parser.py,sha256=qsPo1nsln-vdQUGykH2Zaa3-f1gqcf3c-td0WwSn4r0,17067
6
5
  ara_cli/ara_config.py,sha256=_Arkr-b9XnrNHbBlFKb9tAo3OmdP4ZZiWvbY9m6Sbo0,4178
7
- ara_cli/artefact_creator.py,sha256=Kbs0hloEGUUyInZVPimeqYtJYc70px6m7aFtJWeJU5U,6159
6
+ ara_cli/artefact_autofix.py,sha256=If9a7C6B2i7hpyquQ4pDGCUtXvmHVhFkjF2I0QtqaLg,4533
7
+ ara_cli/artefact_creator.py,sha256=mkxKHkVIK2GdmUrKHAjKvhq66eg21S3x_cvK1ZA9DPw,5964
8
8
  ara_cli/artefact_deleter.py,sha256=Co4wwCH3yW8H9NrOq7_2p5571EeHr0TsfE-H8KqoOfY,1900
9
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
13
  ara_cli/artefact_renamer.py,sha256=loIn1DF9kVnjhH7wP1v5qUvt3s0uKeWXuQPrHXenQGE,4025
14
- ara_cli/artefact_scan.py,sha256=DgFGv4hnbCjYdIgPA2PbAuGDWg1q2fCjtIqxGs57b9w,1762
14
+ ara_cli/artefact_scan.py,sha256=bIk_xa_nB2oQHjBeYChwHwHIxo5hDjYhzq-KWCWmUFE,1879
15
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
19
19
  ara_cli/commandline_completer.py,sha256=b00Dqb5n7SecpxYIDLxAfYhp8X6e3c8a5qYz6ko0i3E,1192
20
20
  ara_cli/directory_navigator.py,sha256=6QbSAjJrJ5a6Lutol9J4HFgVDMiAQ672ny9TATrh04U,3318
21
- ara_cli/file_classifier.py,sha256=rKgF2_tyxHUlpr_vclaZN1CKzidErRXzOng3SbSYR6Q,3903
21
+ ara_cli/file_classifier.py,sha256=JsY7Y_D8WL-fiWz57zwzttg6SEajxWVxpDkFG_149-Q,3967
22
22
  ara_cli/file_lister.py,sha256=VFpUmHU1d6sQvJWSeuFqkZZ0Ci3ZYCUtAUfvgWypaYU,2314
23
23
  ara_cli/filename_validator.py,sha256=Aw9PL8d5-Ymhp3EY6lDrUBk3cudaNqo1Uw5RzPpI1jA,118
24
24
  ara_cli/list_filter.py,sha256=Not17hIngI37gZsLtIKxopB-BmyWoOGlBzSqBwh-Zpc,5273
@@ -31,20 +31,20 @@ ara_cli/run_file_lister.py,sha256=XbrrDTJXp1LFGx9Lv91SNsEHZPP-PyEMBF_P4btjbDA,23
31
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=lJSAoY11nbjwbD8FiJoiAKgyv0FNBfcMfo_JyCTBpjw,146
34
+ ara_cli/version.py,sha256=UDea-52RJGs95q2okzxXLTnZ6sNY38mCpNb6vavgKKU,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
37
  ara_cli/artefact_models/artefact_model.py,sha256=vV-Hhtl6DwVt7qcFTnxxr_WqyTZnKtkFU-nryVnTbUg,14853
38
38
  ara_cli/artefact_models/artefact_templates.py,sha256=Vd7SwoRVKNGKZmxBKS6f9FE1ThUOCqZLScu0ClPfIu8,8321
39
- ara_cli/artefact_models/businessgoal_artefact_model.py,sha256=u9-Rr7VDYoNP6Vy2iKE64yAxDPOnrJJFozO6Ji9s8pI,4570
39
+ ara_cli/artefact_models/businessgoal_artefact_model.py,sha256=mgLOgVRR8MrUqWX6ovcHo7octdfi8AaJiJcbrL4F9R4,4728
40
40
  ara_cli/artefact_models/capability_artefact_model.py,sha256=SZqHx4O2mj4urn77Stnj4_Jxtlq3-LgBBU9SMkByppI,3079
41
- ara_cli/artefact_models/epic_artefact_model.py,sha256=MuK6n0Tl0TM3364pH_j5R8XvwJZFyNwrZGCYaaqzxvs,5490
41
+ ara_cli/artefact_models/epic_artefact_model.py,sha256=KKwW-vZkdso2L-wAWNWbLfGXGQK8M4A10sldDxi8QVE,5648
42
42
  ara_cli/artefact_models/example_artefact_model.py,sha256=UXrKbaPotg1jwcrVSdCeo-XH4tTD_-U1e3giaBn5_xg,1384
43
- ara_cli/artefact_models/feature_artefact_model.py,sha256=HuHLPZW4HptHhKaDHekobB29ZDWXqU4LXMHUP7gMIS8,12979
43
+ ara_cli/artefact_models/feature_artefact_model.py,sha256=7QgX0C5WC0QCUX29xbZFwUNaD74gb7l4PQFcA8GhULU,13125
44
44
  ara_cli/artefact_models/issue_artefact_model.py,sha256=v6CpKnkqiUh6Wch2kkEmyyW49c8ysdy1qz8l1Ft9uJA,2552
45
- ara_cli/artefact_models/keyfeature_artefact_model.py,sha256=nkRNQyoJrDqmRxmqJZBQId6fNv6gI3EoKtXsI7BPqdY,3968
45
+ ara_cli/artefact_models/keyfeature_artefact_model.py,sha256=sD4tBgQQGTZ-PcYVDb3cp81rT2SQy8kQ-V9NxRGrYu8,4126
46
46
  ara_cli/artefact_models/task_artefact_model.py,sha256=kHMw_Tr-Ud3EeHWpRWy4jI0xFnPzGZ-FT52c5rSrT1k,3558
47
- ara_cli/artefact_models/userstory_artefact_model.py,sha256=qDT6TJyP4eKO4ETsx8kPQoHWFZmerl739k_5Wood538,6307
47
+ ara_cli/artefact_models/userstory_artefact_model.py,sha256=oJ8sHX-RbqGotehfUF43xs-5TsZh8PTmEtgjUfc7lWQ,6465
48
48
  ara_cli/artefact_models/vision_artefact_model.py,sha256=KcNE3QQjyT29ZMMhCQo4pOcXKTkI6pXLvyfqoN2kuUQ,5920
49
49
  ara_cli/templates/agile.artefacts,sha256=nTA8dp98HWKAD-0qhmNpVYIfkVGoJshZqMJGnphiOsE,7932
50
50
  ara_cli/templates/template.businessgoal,sha256=3OU-y8dOCRbRsB9ovBzwFPxHSbG0dqbkok0uJnZIOd4,524
@@ -130,26 +130,27 @@ ara_cli/templates/specification_breakdown_files/template.step.md,sha256=nzDRl9Xo
130
130
  ara_cli/templates/specification_breakdown_files/template.technology.exploration.md,sha256=zQyiJcmbUfXdte-5uZwZUpT6ey0zwfZ00P4VwI97jQk,2274
131
131
  ara_cli/templates/specification_breakdown_files/template.technology.md,sha256=bySiksz-8xtq0Nnj4svqe2MgUftWrVkbK9AcrDUE3KY,952
132
132
  ara_cli/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
133
- ara_cli/tests/test_ara_command_action.py,sha256=N7712HbmN86ziGBKI5GoHQPp75OSyD0kHsHRxna8d9w,25446
133
+ ara_cli/tests/test_ara_autofix.py,sha256=8AaSuherD2dvo2wMFafgHnkLhSnMs6ZW6RtX-5VKsls,4248
134
+ ara_cli/tests/test_ara_command_action.py,sha256=s7XlNMX1lohnwlRwdCHMKFpJdM7BxyEjYuOcba2BClw,25494
134
135
  ara_cli/tests/test_ara_config.py,sha256=1LWby_iSestTIIqK-1clggL8kmbGGbtlYfsxAHaMMF8,2232
135
136
  ara_cli/tests/test_artefact_fuzzy_search.py,sha256=5Sh3_l9QK8-WHn6JpGPU1b6h4QEnl2JoMq1Tdp2cj1U,1261
136
137
  ara_cli/tests/test_artefact_link_updater.py,sha256=gN5KFF1uY7OoBh8Mr5jWpqXp02YCU5OSIpSU76Rm4Gs,2137
137
138
  ara_cli/tests/test_artefact_lister.py,sha256=VCEOCgDgnAOeUUgIoGAbWgz60hf9UT-tdHg18LGfB34,22656
138
139
  ara_cli/tests/test_artefact_reader.py,sha256=660K-d8ed-j8hulsUB_7baPD2-hhbg9TffUR5yVc4Uo,927
139
140
  ara_cli/tests/test_artefact_renamer.py,sha256=syL3qH8pPRmxPkpmKXInZ7WTI8X487YJXsgiZOtv2C4,3490
140
- ara_cli/tests/test_artefact_scan.py,sha256=m0V3HMLJtrOBXpJIRUI0D6MbHssgxDU_c935Wc3jatQ,4696
141
+ ara_cli/tests/test_artefact_scan.py,sha256=I2rpSoRQ2auBbWjmGnm7VdTSS811tkAgUyK2dS69KVQ,4780
141
142
  ara_cli/tests/test_chat.py,sha256=V75baLk2ZFz5WDSFTlvdbmMb6Dm7o12xoFEulmMgMDI,46765
142
143
  ara_cli/tests/test_classifier.py,sha256=grYGPksydNdPsaEBQxYHZTuTdcJWz7VQtikCKA6BNaQ,1920
143
144
  ara_cli/tests/test_directory_navigator.py,sha256=7G0MVrBbtBvbrFUpL0zb_9EkEWi1dulWuHsrQxMJxDY,140
144
- ara_cli/tests/test_file_classifier.py,sha256=6OYM-lYVYjxq4Qwl8U1btv_FYJhc5t3rKjYr2CXZ4uI,10069
145
+ ara_cli/tests/test_file_classifier.py,sha256=hbGp0-_A_LgQ0pGv1jWDEIyCgvDyfChcvvVfbxjNY2U,10938
145
146
  ara_cli/tests/test_file_creator.py,sha256=G257M1duenDrgLCSql3wVWNuzcxyQqLQDybfbxiGYN0,2100
146
147
  ara_cli/tests/test_file_lister.py,sha256=f6B_vIv-wAulKH2ZGgNg4SG79XqGGbfwoIvZlbEnYyM,4306
147
148
  ara_cli/tests/test_list_filter.py,sha256=gSRKirTtFuhRS3QlFHqWl89WvCvAdVEnFsCWTYmgB2o,7928
148
149
  ara_cli/tests/test_tag_extractor.py,sha256=n2xNApbDciqKO3QuaveEWSPXU1PCUa_EhxlZMrukONw,2074
149
150
  ara_cli/tests/test_template_manager.py,sha256=bRxka6cxHsCAOvXjfG8MrVO8qSZXhxW01tnph80UtNk,3143
150
151
  ara_cli/tests/test_update_config_prompt.py,sha256=vSsLvc18HZdVjVM93qXWVbJt752xTLL6VGjSVCrPufk,6729
151
- ara_cli-0.1.9.60.dist-info/METADATA,sha256=WTu3iMjkrTJdAdbFBxMqAgF3CI8sVqnqIM9zxzGLvos,388
152
- ara_cli-0.1.9.60.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
153
- ara_cli-0.1.9.60.dist-info/entry_points.txt,sha256=v4h7MzysTgSIDYfEo3oj4Kz_8lzsRa3hq-KJHEcLVX8,45
154
- ara_cli-0.1.9.60.dist-info/top_level.txt,sha256=zzee_PwFmKqfBi9XgIunP6xy2S4TIt593CLLxenNaAE,8
155
- ara_cli-0.1.9.60.dist-info/RECORD,,
152
+ ara_cli-0.1.9.62.dist-info/METADATA,sha256=qcj03ih0hWhPZ3etcPqr99iZNELjw53lz63Q5AsG8Zo,415
153
+ ara_cli-0.1.9.62.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
154
+ ara_cli-0.1.9.62.dist-info/entry_points.txt,sha256=v4h7MzysTgSIDYfEo3oj4Kz_8lzsRa3hq-KJHEcLVX8,45
155
+ ara_cli-0.1.9.62.dist-info/top_level.txt,sha256=zzee_PwFmKqfBi9XgIunP6xy2S4TIt593CLLxenNaAE,8
156
+ ara_cli-0.1.9.62.dist-info/RECORD,,
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- analyse_artefacts.py
4
-
5
- Walk a directory tree, try to deserialize every *.vision *.epic *.task … file
6
- with the appropriate Pydantic artefact model, and write the list of files that
7
- fail validation (plus the reason) to 'invalid_artefacts.txt'.
8
- """
9
-
10
- """
11
- python analyse_artefacts.py <path_to_ara_folder ex: ./ara/>
12
- """
13
-
14
- from ara_cli.artefact_models import businessgoal_artefact_model, capability_artefact_model, epic_artefact_model, example_artefact_model, feature_artefact_model, issue_artefact_model, keyfeature_artefact_model, userstory_artefact_model, task_artefact_model, vision_artefact_model
15
- from ara_cli.artefact_models.artefact_model import Artefact, ArtefactType
16
- from pydantic import ValidationError
17
- from typing import Dict, Type, List, Tuple
18
- from pathlib import Path
19
- import os
20
- import sys
21
-
22
-
23
- # --- import your domain model ----------------------------------------------
24
- # Make sure this import path matches your project layout.
25
- # (e.g. from ara_cli.artefact_model import Artefact, ArtefactType)
26
- # ---------------------------------------------------------------------------
27
-
28
-
29
- def build_type_map() -> Dict[ArtefactType, Type[Artefact]]:
30
- type_map: Dict[ArtefactType, Type[Artefact]] = {}
31
- queue: List[Type[Artefact]] = list(Artefact.__subclasses__())
32
- while queue:
33
- cls = queue.pop()
34
- try:
35
- artefact_type = cls._artefact_type()
36
- type_map[artefact_type] = cls
37
- except Exception:
38
- pass # abstract / helper subclass
39
- queue.extend(cls.__subclasses__())
40
- if not type_map:
41
- raise RuntimeError("No concrete Artefact subclasses found!")
42
- return type_map
43
-
44
-
45
- def find_artefact_files(root: Path, valid_exts: List[str]) -> List[Path]:
46
- return [
47
- p for p in root.rglob("*")
48
- if p.is_file() and p.suffix.lstrip(".") in valid_exts
49
- ]
50
-
51
-
52
- def scan_folder(
53
- root_folder: Path,
54
- detailed_report: Path,
55
- names_only_report: Path,
56
- checklist_report: Path
57
- ) -> Tuple[int, int]:
58
- type_map = build_type_map()
59
- valid_exts = [t.value for t in type_map]
60
-
61
- artefact_files = find_artefact_files(root_folder, valid_exts)
62
- bad: List[Tuple[Path, str]] = []
63
-
64
- for file_path in artefact_files:
65
- artefact_type = ArtefactType(file_path.suffix.lstrip("."))
66
- artefact_cls = type_map[artefact_type]
67
- text = file_path.read_text(encoding="utf-8")
68
-
69
- try:
70
- artefact_cls.deserialize(text)
71
- except (ValidationError, ValueError, AssertionError) as e:
72
- bad.append((file_path, str(e)))
73
- except Exception as e:
74
- bad.append((file_path, f"Unexpected error: {e!r}"))
75
-
76
- # ───────────── write reports ────────────────────────────────────────────
77
- if bad:
78
- # 1) detailed txt
79
- with detailed_report.open("w", encoding="utf-8") as f:
80
- f.write("Invalid artefacts (file → reason)\n\n")
81
- for path, err in bad:
82
- f.write(f"{path} --> {err}\n")
83
-
84
- # 2) names-only txt
85
- with names_only_report.open("w", encoding="utf-8") as f:
86
- for path, _ in bad:
87
- f.write(f"{path}\n")
88
-
89
- # 3) markdown checklist
90
- with checklist_report.open("w", encoding="utf-8") as f:
91
- f.write("# 📋 Artefact-fix checklist\n\n")
92
- f.write("Tick a box once you’ve fixed & validated the file.\n\n")
93
- for path, err in bad:
94
- f.write(f"- [ ] `{path}` – {err}\n")
95
-
96
- print(
97
- f"\nFinished. {len(bad)}/{len(artefact_files)} files are invalid."
98
- f"\nReports generated:"
99
- f"\n • {detailed_report}"
100
- f"\n • {names_only_report}"
101
- f"\n • {checklist_report}"
102
- )
103
- else:
104
- print(f"\nFinished. All {len(artefact_files)} artefacts are valid ✔️")
105
- # clean up stale files from previous runs
106
- for p in (detailed_report, names_only_report, checklist_report):
107
- if p.exists():
108
- p.unlink()
109
-
110
- return len(artefact_files), len(bad)
111
-
112
-
113
- # ─────────────────────────────── main ──────────────────────────────────────
114
- def main() -> None:
115
- if len(sys.argv) < 2:
116
- print("Usage: python scan_artefacts.py <folder_to_scan>")
117
- sys.exit(1)
118
-
119
- root_folder = Path(sys.argv[1]).expanduser().resolve()
120
- if not root_folder.is_dir():
121
- print(f"Error: '{root_folder}' is not a directory.")
122
- sys.exit(1)
123
-
124
- scan_folder(
125
- root_folder=root_folder,
126
- detailed_report=Path("invalid_artefacts.txt"),
127
- names_only_report=Path("invalid_artefact_names.txt"),
128
- checklist_report=Path("invalid_artefacts_checklist.md"),
129
- )
130
-
131
-
132
- if __name__ == "__main__":
133
- main()