ara-cli 0.1.9.96__py3-none-any.whl → 0.1.10.1__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.

Potentially problematic release.


This version of ara-cli might be problematic. Click here for more details.

Files changed (48) hide show
  1. ara_cli/__init__.py +1 -1
  2. ara_cli/__main__.py +141 -103
  3. ara_cli/ara_command_action.py +65 -7
  4. ara_cli/ara_config.py +118 -94
  5. ara_cli/ara_subcommands/__init__.py +0 -0
  6. ara_cli/ara_subcommands/autofix.py +26 -0
  7. ara_cli/ara_subcommands/chat.py +27 -0
  8. ara_cli/ara_subcommands/classifier_directory.py +16 -0
  9. ara_cli/ara_subcommands/common.py +100 -0
  10. ara_cli/ara_subcommands/create.py +75 -0
  11. ara_cli/ara_subcommands/delete.py +22 -0
  12. ara_cli/ara_subcommands/extract.py +22 -0
  13. ara_cli/ara_subcommands/fetch_templates.py +14 -0
  14. ara_cli/ara_subcommands/list.py +65 -0
  15. ara_cli/ara_subcommands/list_tags.py +25 -0
  16. ara_cli/ara_subcommands/load.py +48 -0
  17. ara_cli/ara_subcommands/prompt.py +136 -0
  18. ara_cli/ara_subcommands/read.py +47 -0
  19. ara_cli/ara_subcommands/read_status.py +20 -0
  20. ara_cli/ara_subcommands/read_user.py +20 -0
  21. ara_cli/ara_subcommands/reconnect.py +27 -0
  22. ara_cli/ara_subcommands/rename.py +22 -0
  23. ara_cli/ara_subcommands/scan.py +14 -0
  24. ara_cli/ara_subcommands/set_status.py +22 -0
  25. ara_cli/ara_subcommands/set_user.py +22 -0
  26. ara_cli/ara_subcommands/template.py +16 -0
  27. ara_cli/artefact_models/artefact_model.py +88 -19
  28. ara_cli/artefact_models/artefact_templates.py +18 -9
  29. ara_cli/artefact_models/userstory_artefact_model.py +2 -2
  30. ara_cli/artefact_scan.py +2 -2
  31. ara_cli/chat.py +204 -142
  32. ara_cli/commands/read_command.py +17 -4
  33. ara_cli/completers.py +144 -0
  34. ara_cli/prompt_handler.py +268 -127
  35. ara_cli/tag_extractor.py +33 -16
  36. ara_cli/template_loader.py +245 -0
  37. ara_cli/version.py +1 -1
  38. {ara_cli-0.1.9.96.dist-info → ara_cli-0.1.10.1.dist-info}/METADATA +3 -1
  39. {ara_cli-0.1.9.96.dist-info → ara_cli-0.1.10.1.dist-info}/RECORD +47 -23
  40. tests/test_artefact_scan.py +1 -1
  41. tests/test_chat.py +1840 -574
  42. tests/test_prompt_handler.py +40 -4
  43. tests/test_tag_extractor.py +19 -13
  44. tests/test_template_loader.py +192 -0
  45. ara_cli/ara_command_parser.py +0 -565
  46. {ara_cli-0.1.9.96.dist-info → ara_cli-0.1.10.1.dist-info}/WHEEL +0 -0
  47. {ara_cli-0.1.9.96.dist-info → ara_cli-0.1.10.1.dist-info}/entry_points.txt +0 -0
  48. {ara_cli-0.1.9.96.dist-info → ara_cli-0.1.10.1.dist-info}/top_level.txt +0 -0
ara_cli/ara_config.py CHANGED
@@ -10,6 +10,7 @@ import warnings
10
10
 
11
11
  DEFAULT_CONFIG_LOCATION = "./ara/.araconfig/ara_config.json"
12
12
 
13
+
13
14
  class LLMConfigItem(BaseModel):
14
15
  provider: str
15
16
  model: str
@@ -17,6 +18,7 @@ class LLMConfigItem(BaseModel):
17
18
  max_tokens: Optional[int] = None
18
19
  max_completion_tokens: Optional[int] = None
19
20
 
21
+
20
22
  class ARAconfig(BaseModel):
21
23
  ext_code_dirs: List[Dict[str, str]] = Field(default_factory=lambda: [
22
24
  {"source_dir": "./src"},
@@ -28,98 +30,104 @@ class ARAconfig(BaseModel):
28
30
  local_prompt_templates_dir: str = "./ara/.araconfig"
29
31
  custom_prompt_templates_subdir: Optional[str] = "custom-prompt-modules"
30
32
  local_ara_templates_dir: str = "./ara/.araconfig/templates/"
31
- ara_prompt_given_list_includes: List[str] = Field(default_factory=lambda: [
32
- "*.businessgoal",
33
- "*.vision",
34
- "*.capability",
35
- "*.keyfeature",
36
- "*.epic",
37
- "*.userstory",
38
- "*.example",
39
- "*.feature",
40
- "*.task",
41
- "*.py",
42
- "*.md",
43
- "*.png",
44
- "*.jpg",
45
- "*.jpeg",
46
- ])
47
- llm_config: Dict[str, LLMConfigItem] = Field(default_factory=lambda: {
48
- "gpt-5": LLMConfigItem(
49
- provider="openai",
50
- model="openai/gpt-5",
51
- temperature=1,
52
- max_completion_tokens=16000
53
- ),
54
- "gpt-5-mini": LLMConfigItem(
55
- provider="openai",
56
- model="openai/gpt-5-mini-2025-08-07",
57
- temperature=1
58
- ),
59
- "gpt-4o": LLMConfigItem(
60
- provider="openai",
61
- model="openai/gpt-4o",
62
- temperature=0.8,
63
- max_tokens=16000
64
- ),
65
- "gpt-4.1": LLMConfigItem(
66
- provider="openai",
67
- model="openai/gpt-4.1",
68
- temperature=0.8,
69
- max_tokens=16000
70
- ),
71
- "o3-mini": LLMConfigItem(
72
- provider="openai",
73
- model="openai/o3-mini",
74
- temperature=1.0,
75
- max_tokens=8000
76
- ),
77
- "opus-4": LLMConfigItem(
78
- provider="anthropic",
79
- model="anthropic/claude-opus-4-20250514",
80
- temperature=0.5,
81
- max_tokens=32000
82
- ),
83
- "sonnet-4": LLMConfigItem(
84
- provider="anthropic",
85
- model="anthropic/claude-sonnet-4-20250514",
86
- temperature=0.5,
87
- max_tokens=32000
88
- ),
89
- "together-ai-llama-2": LLMConfigItem(
90
- provider="together_ai",
91
- model="together_ai/togethercomputer/llama-2-70b",
92
- temperature=0.8,
93
- max_tokens=4000
94
- ),
95
- "groq-llama-3": LLMConfigItem(
96
- provider="groq",
97
- model="groq/llama3-70b-8192",
98
- temperature=0.8,
99
- max_tokens=4000
100
- )
101
- })
33
+ ara_prompt_given_list_includes: List[str] = Field(
34
+ default_factory=lambda: [
35
+ "*.businessgoal",
36
+ "*.vision",
37
+ "*.capability",
38
+ "*.keyfeature",
39
+ "*.epic",
40
+ "*.userstory",
41
+ "*.example",
42
+ "*.feature",
43
+ "*.task",
44
+ "*.py",
45
+ "*.md",
46
+ "*.png",
47
+ "*.jpg",
48
+ "*.jpeg",
49
+ ]
50
+ )
51
+ llm_config: Dict[str, LLMConfigItem] = Field(
52
+ default_factory=lambda: {
53
+ "gpt-5": LLMConfigItem(
54
+ provider="openai",
55
+ model="openai/gpt-5",
56
+ temperature=1,
57
+ max_completion_tokens=16000,
58
+ ),
59
+ "gpt-5-mini": LLMConfigItem(
60
+ provider="openai", model="openai/gpt-5-mini-2025-08-07", temperature=1
61
+ ),
62
+ "gpt-4o": LLMConfigItem(
63
+ provider="openai",
64
+ model="openai/gpt-4o",
65
+ temperature=0.8,
66
+ max_tokens=16000,
67
+ ),
68
+ "gpt-4.1": LLMConfigItem(
69
+ provider="openai",
70
+ model="openai/gpt-4.1",
71
+ temperature=0.8,
72
+ max_tokens=16000,
73
+ ),
74
+ "o3-mini": LLMConfigItem(
75
+ provider="openai",
76
+ model="openai/o3-mini",
77
+ temperature=1.0,
78
+ max_tokens=8000,
79
+ ),
80
+ "opus-4": LLMConfigItem(
81
+ provider="anthropic",
82
+ model="anthropic/claude-opus-4-20250514",
83
+ temperature=0.5,
84
+ max_tokens=32000,
85
+ ),
86
+ "sonnet-4": LLMConfigItem(
87
+ provider="anthropic",
88
+ model="anthropic/claude-sonnet-4-20250514",
89
+ temperature=0.5,
90
+ max_tokens=32000,
91
+ ),
92
+ "together-ai-llama-2": LLMConfigItem(
93
+ provider="together_ai",
94
+ model="together_ai/togethercomputer/llama-2-70b",
95
+ temperature=0.8,
96
+ max_tokens=4000,
97
+ ),
98
+ "groq-llama-3": LLMConfigItem(
99
+ provider="groq",
100
+ model="groq/llama3-70b-8192",
101
+ temperature=0.8,
102
+ max_tokens=4000,
103
+ ),
104
+ }
105
+ )
102
106
  default_llm: Optional[str] = None
103
107
  extraction_llm: Optional[str] = None
104
108
 
105
- @model_validator(mode='after')
106
- def check_critical_fields(self) -> 'ARAconfig':
109
+ @model_validator(mode="after")
110
+ def check_critical_fields(self) -> "ARAconfig":
107
111
  """Check for empty critical fields and validate default_llm and extraction_llm."""
108
112
  critical_fields = {
109
- 'ext_code_dirs': [{"source_dir": "./src"}, {"source_dir": "./tests"}],
110
- 'local_ara_templates_dir': "./ara/.araconfig/templates/",
111
- 'local_prompt_templates_dir': "./ara/.araconfig",
112
- 'glossary_dir': "./glossary"
113
+ "ext_code_dirs": [{"source_dir": "./src"}, {"source_dir": "./tests"}],
114
+ "local_ara_templates_dir": "./ara/.araconfig/templates/",
115
+ "local_prompt_templates_dir": "./ara/.araconfig",
116
+ "glossary_dir": "./glossary",
113
117
  }
114
118
 
115
119
  for field, default_value in critical_fields.items():
116
120
  current_value = getattr(self, field)
117
121
  if not current_value:
118
- print(f"Warning: Value for '{field}' is missing or empty. Using default.")
122
+ print(
123
+ f"Warning: Value for '{field}' is missing or empty. Using default."
124
+ )
119
125
  setattr(self, field, default_value)
120
-
126
+
121
127
  if not self.llm_config:
122
- print("Warning: 'llm_config' is empty. 'default_llm' and 'extraction_llm' cannot be set.")
128
+ print(
129
+ "Warning: 'llm_config' is empty. 'default_llm' and 'extraction_llm' cannot be set."
130
+ )
123
131
  self.default_llm = None
124
132
  self.extraction_llm = None
125
133
  return self
@@ -127,23 +135,34 @@ class ARAconfig(BaseModel):
127
135
  first_available_llm = next(iter(self.llm_config))
128
136
 
129
137
  if not self.default_llm:
130
- print(f"Warning: 'default_llm' is not set. Defaulting to the first available model: '{first_available_llm}'.")
138
+ print(
139
+ f"Warning: 'default_llm' is not set. Defaulting to the first available model: '{first_available_llm}'."
140
+ )
131
141
  self.default_llm = first_available_llm
132
142
  elif self.default_llm not in self.llm_config:
133
- print(f"Warning: The configured 'default_llm' ('{self.default_llm}') does not exist in 'llm_config'.")
134
- print(f"-> Reverting to the first available model: '{first_available_llm}'.")
143
+ print(
144
+ f"Warning: The configured 'default_llm' ('{self.default_llm}') does not exist in 'llm_config'."
145
+ )
146
+ print(
147
+ f"-> Reverting to the first available model: '{first_available_llm}'."
148
+ )
135
149
  self.default_llm = first_available_llm
136
150
 
137
151
  if not self.extraction_llm:
138
- print(f"Warning: 'extraction_llm' is not set. Setting it to the same as 'default_llm': '{self.default_llm}'.")
152
+ print(
153
+ f"Warning: 'extraction_llm' is not set. Setting it to the same as 'default_llm': '{self.default_llm}'."
154
+ )
139
155
  self.extraction_llm = self.default_llm
140
156
  elif self.extraction_llm not in self.llm_config:
141
- print(f"Warning: The configured 'extraction_llm' ('{self.extraction_llm}') does not exist in 'llm_config'.")
157
+ print(
158
+ f"Warning: The configured 'extraction_llm' ('{self.extraction_llm}') does not exist in 'llm_config'."
159
+ )
142
160
  print(f"-> Reverting to the 'default_llm' value: '{self.default_llm}'.")
143
161
  self.extraction_llm = self.default_llm
144
-
162
+
145
163
  return self
146
164
 
165
+
147
166
  # Function to ensure the necessary directories exist
148
167
  @lru_cache(maxsize=None)
149
168
  def ensure_directory_exists(directory: str):
@@ -153,6 +172,7 @@ def ensure_directory_exists(directory: str):
153
172
  print(f"New directory created at {directory}")
154
173
  return directory
155
174
 
175
+
156
176
  def handle_unrecognized_keys(data: dict) -> dict:
157
177
  """Removes unrecognized keys from the data and warns the user."""
158
178
  known_fields = set(ARAconfig.model_fields.keys())
@@ -211,13 +231,15 @@ def read_data(filepath: str) -> ARAconfig:
211
231
  return config
212
232
  except ValidationError as e:
213
233
  print("--- Configuration Error Detected ---")
214
- print("Some settings in your configuration file are invalid. Attempting to fix them.")
215
-
234
+ print(
235
+ "Some settings in your configuration file are invalid. Attempting to fix them."
236
+ )
237
+
216
238
  corrected_data = data.copy()
217
239
  defaults = ARAconfig().model_dump()
218
-
219
- error_fields = {err['loc'][0] for err in e.errors() if err['loc']}
220
-
240
+
241
+ error_fields = {err["loc"][0] for err in e.errors() if err["loc"]}
242
+
221
243
  for field_name in error_fields:
222
244
  print(f"-> Field '{field_name}' is invalid and will be reverted to its default value.")
223
245
  if field_name in corrected_data:
@@ -228,15 +250,17 @@ def read_data(filepath: str) -> ARAconfig:
228
250
  final_config = ARAconfig(**corrected_data)
229
251
  save_data(filepath, final_config)
230
252
  print(f"Configuration has been corrected and saved to '{filepath}'.")
231
-
253
+
232
254
  return final_config
233
255
 
256
+
234
257
  # Function to save the modified configuration back to the JSON file
235
258
  def save_data(filepath: str, config: ARAconfig):
236
259
  """Saves the Pydantic config model to a JSON file."""
237
260
  with open(filepath, "w", encoding="utf-8") as file:
238
261
  json.dump(config.model_dump(), file, indent=4)
239
262
 
263
+
240
264
  # Singleton for configuration management
241
265
  class ConfigManager:
242
266
  _config_instance = None
@@ -246,9 +270,9 @@ class ConfigManager:
246
270
  if cls._config_instance is None:
247
271
  cls._config_instance = read_data(filepath)
248
272
  return cls._config_instance
249
-
273
+
250
274
  @classmethod
251
275
  def reset(cls):
252
276
  """Reset the configuration instance (useful for testing)."""
253
277
  cls._config_instance = None
254
- read_data.cache_clear()
278
+ read_data.cache_clear()
File without changes
@@ -0,0 +1,26 @@
1
+ import typer
2
+ from .common import MockArgs
3
+ from ara_cli.ara_command_action import autofix_action
4
+
5
+
6
+ def autofix_main(
7
+ single_pass: bool = typer.Option(False, "--single-pass", help="Run the autofix once for every scanned file"),
8
+ deterministic: bool = typer.Option(False, "-d", "--deterministic", help="Run only deterministic fixes e.g Title-FileName Mismatch fix"),
9
+ non_deterministic: bool = typer.Option(False, "-nd", "--non-deterministic", help="Run only non-deterministic fixes")
10
+ ):
11
+ """Fix ARA tree with llm models for scanned artefacts with ara scan command."""
12
+ if deterministic and non_deterministic:
13
+ typer.echo("Error: --deterministic and --non-deterministic are mutually exclusive", err=True)
14
+ raise typer.Exit(1)
15
+
16
+ args = MockArgs(
17
+ single_pass=single_pass,
18
+ deterministic=deterministic,
19
+ non_deterministic=non_deterministic
20
+ )
21
+ autofix_action(args)
22
+
23
+
24
+ def register(parent: typer.Typer):
25
+ help_text = "Fix ARA tree with llm models for scanned artefacts"
26
+ parent.command(name="autofix", help=help_text)(autofix_main)
@@ -0,0 +1,27 @@
1
+ import typer
2
+ from typing import Optional, List
3
+ from .common import MockArgs, ChatNameArgument
4
+ from ara_cli.ara_command_action import chat_action
5
+
6
+
7
+ def chat_main(
8
+ chat_name: Optional[str] = ChatNameArgument("Optional name for a specific chat. Pass the .md file to continue an existing chat", None),
9
+ reset: Optional[bool] = typer.Option(None, "-r", "--reset/--no-reset", help="Reset the chat file if it exists"),
10
+ output_mode: bool = typer.Option(False, "--out", help="Output the contents of the chat file instead of entering interactive chat mode"),
11
+ append: Optional[List[str]] = typer.Option(None, "--append", help="Append strings to the chat file"),
12
+ restricted: Optional[bool] = typer.Option(None, "--restricted/--no-restricted", help="Start with a limited set of commands")
13
+ ):
14
+ """Command line chatbot. Chat control with SEND/s | RERUN/r | QUIT/q"""
15
+ args = MockArgs(
16
+ chat_name=chat_name,
17
+ reset=reset,
18
+ output_mode=output_mode,
19
+ append=append,
20
+ restricted=restricted
21
+ )
22
+ chat_action(args)
23
+
24
+
25
+ def register(parent: typer.Typer):
26
+ help_text = "Command line chatbot. Chat control with SEND/s | RERUN/r | QUIT/q"
27
+ parent.command(name="chat", help=help_text)(chat_main)
@@ -0,0 +1,16 @@
1
+ import typer
2
+ from .common import ClassifierEnum, MockArgs, ClassifierArgument
3
+ from ara_cli.ara_command_action import classifier_directory_action
4
+
5
+
6
+ def classifier_directory_main(
7
+ classifier: ClassifierEnum = ClassifierArgument("Classifier of the artefact type")
8
+ ):
9
+ """Print the ara subdirectory for an artefact classifier."""
10
+ args = MockArgs(classifier=classifier.value)
11
+ classifier_directory_action(args)
12
+
13
+
14
+ def register(parent: typer.Typer):
15
+ help_text = "Print the ara subdirectory for an artefact classifier"
16
+ parent.command(name="classifier-directory", help=help_text)(classifier_directory_main)
@@ -0,0 +1,100 @@
1
+ from typing import Optional
2
+ from enum import Enum
3
+ import typer
4
+ from ara_cli.classifier import Classifier
5
+ from ara_cli.template_manager import SpecificationBreakdownAspects
6
+ from ara_cli.completers import DynamicCompleters
7
+
8
+
9
+ # Get classifiers and aspects
10
+ classifiers = Classifier.ordered_classifiers()
11
+ aspects = SpecificationBreakdownAspects.VALID_ASPECTS
12
+
13
+
14
+ # Create enums for better type safety
15
+ ClassifierEnum = Enum('ClassifierEnum', {c: c for c in classifiers})
16
+ AspectEnum = Enum('AspectEnum', {a: a for a in aspects})
17
+ TemplateTypeEnum = Enum('TemplateTypeEnum', {
18
+ 'rules': 'rules',
19
+ 'intention': 'intention',
20
+ 'commands': 'commands',
21
+ 'blueprint': 'blueprint'
22
+ })
23
+
24
+
25
+ # Create typed arguments and options with autocompletion
26
+ def ClassifierArgument(help_text: str, default=...):
27
+ """Create a classifier argument with autocompletion."""
28
+ return typer.Argument(
29
+ default,
30
+ help=help_text,
31
+ autocompletion=DynamicCompleters.create_classifier_completer()
32
+ )
33
+
34
+
35
+ def ClassifierOption(help_text: str, *names):
36
+ """Create a classifier option with autocompletion."""
37
+ return typer.Option(
38
+ None,
39
+ *names,
40
+ help=help_text,
41
+ autocompletion=DynamicCompleters.create_classifier_completer()
42
+ )
43
+
44
+
45
+ def ArtefactNameArgument(help_text: str, default=...):
46
+ """Create an artefact name argument with autocompletion."""
47
+ return typer.Argument(
48
+ default,
49
+ help=help_text,
50
+ autocompletion=DynamicCompleters.create_artefact_name_completer()
51
+ )
52
+
53
+
54
+
55
+ def ParentNameArgument(help_text: str):
56
+ """Create a parent name argument with autocompletion."""
57
+ return typer.Argument(
58
+ help=help_text,
59
+ autocompletion=DynamicCompleters.create_parent_name_completer()
60
+ )
61
+
62
+
63
+ def AspectArgument(help_text: str):
64
+ """Create an aspect argument with autocompletion."""
65
+ return typer.Argument(
66
+ help=help_text,
67
+ autocompletion=DynamicCompleters.create_aspect_completer()
68
+ )
69
+
70
+
71
+ def StatusArgument(help_text: str):
72
+ """Create a status argument with autocompletion."""
73
+ return typer.Argument(
74
+ help=help_text,
75
+ autocompletion=DynamicCompleters.create_status_completer()
76
+ )
77
+
78
+
79
+ def TemplateTypeArgument(help_text: str):
80
+ """Create a template type argument with autocompletion."""
81
+ return typer.Argument(
82
+ help=help_text,
83
+ autocompletion=DynamicCompleters.create_template_type_completer()
84
+ )
85
+
86
+
87
+ def ChatNameArgument(help_text: str, default=None):
88
+ """Create a chat name argument with autocompletion."""
89
+ return typer.Argument(
90
+ default,
91
+ help=help_text,
92
+ autocompletion=DynamicCompleters.create_chat_file_completer()
93
+ )
94
+
95
+
96
+ # Mock args class to maintain compatibility with existing action functions
97
+ class MockArgs:
98
+ def __init__(self, **kwargs):
99
+ for key, value in kwargs.items():
100
+ setattr(self, key, value)
@@ -0,0 +1,75 @@
1
+ import typer
2
+ from typing import Optional
3
+ from .common import (
4
+ ClassifierEnum, AspectEnum, MockArgs,
5
+ ClassifierArgument, ArtefactNameArgument, ParentNameArgument, AspectArgument
6
+ )
7
+ from ara_cli.ara_command_action import create_action
8
+
9
+
10
+ def create_contributes_to(
11
+ ctx: typer.Context,
12
+ parent_classifier: ClassifierEnum = ClassifierArgument("Classifier of the parent"),
13
+ parent_name: str = ParentNameArgument("Name of a parent artefact"),
14
+ rule: Optional[str] = typer.Option(None, "-r", "--rule", help="Rule for contribution")
15
+ ):
16
+ """Create an artefact that contributes to a parent artefact."""
17
+ # Get classifier and parameter from parent context
18
+ parent_params = ctx.parent.params
19
+ classifier = parent_params['classifier']
20
+ parameter = parent_params['parameter']
21
+
22
+ args = MockArgs(
23
+ classifier=classifier,
24
+ parameter=parameter,
25
+ option="contributes-to",
26
+ parent_classifier=parent_classifier.value,
27
+ parent_name=parent_name,
28
+ rule=rule
29
+ )
30
+ create_action(args)
31
+
32
+
33
+ def create_aspect(
34
+ ctx: typer.Context,
35
+ aspect: AspectEnum = AspectArgument("Adds additional specification breakdown aspects")
36
+ ):
37
+ """Create an artefact with additional specification breakdown aspects."""
38
+ # Get classifier and parameter from parent context
39
+ parent_params = ctx.parent.params
40
+ classifier = parent_params['classifier']
41
+ parameter = parent_params['parameter']
42
+
43
+ args = MockArgs(
44
+ classifier=classifier,
45
+ parameter=parameter,
46
+ option="aspect",
47
+ aspect=aspect.value
48
+ )
49
+ create_action(args)
50
+
51
+
52
+ def create_main(
53
+ ctx: typer.Context,
54
+ classifier: ClassifierEnum = ClassifierArgument("Classifier that also serves as file extension"),
55
+ parameter: str = ArtefactNameArgument("Artefact name that serves as filename")
56
+ ):
57
+ """Create a classified artefact with data directory."""
58
+ if ctx.invoked_subcommand is None:
59
+ args = MockArgs(
60
+ classifier=classifier.value,
61
+ parameter=parameter,
62
+ option=None
63
+ )
64
+ create_action(args)
65
+
66
+
67
+ def register(parent: typer.Typer):
68
+ create_app = typer.Typer(
69
+ help="Create a classified artefact with data directory",
70
+ add_completion=False # Disable completion on subcommand
71
+ )
72
+ create_app.command("contributes-to")(create_contributes_to)
73
+ create_app.command("aspect")(create_aspect)
74
+ create_app.callback(invoke_without_command=True)(create_main)
75
+ parent.add_typer(create_app, name="create")
@@ -0,0 +1,22 @@
1
+ import typer
2
+ from .common import ClassifierEnum, MockArgs, ClassifierArgument, ArtefactNameArgument
3
+ from ara_cli.ara_command_action import delete_action
4
+
5
+
6
+ def delete_main(
7
+ classifier: ClassifierEnum = ClassifierArgument("Classifier of the artefact to be deleted"),
8
+ parameter: str = ArtefactNameArgument("Filename of artefact"),
9
+ force: bool = typer.Option(False, "-f", "--force", help="ignore nonexistent files and arguments, never prompt")
10
+ ):
11
+ """Delete an artefact file including its data directory."""
12
+ args = MockArgs(
13
+ classifier=classifier.value,
14
+ parameter=parameter,
15
+ force=force
16
+ )
17
+ delete_action(args)
18
+
19
+
20
+ def register(parent: typer.Typer):
21
+ help_text = "Delete an artefact file including its data directory"
22
+ parent.command(name="delete", help=help_text)(delete_main)
@@ -0,0 +1,22 @@
1
+ import typer
2
+ from .common import MockArgs
3
+ from ara_cli.ara_command_action import extract_action
4
+
5
+
6
+ def extract_main(
7
+ filename: str = typer.Argument(help="Input file to extract from"),
8
+ force: bool = typer.Option(False, "-f", "--force", help="Answer queries with yes when extracting"),
9
+ write: bool = typer.Option(False, "-w", "--write", help="Overwrite existing files without using LLM for merging")
10
+ ):
11
+ """Extract blocks of marked content from a given file."""
12
+ args = MockArgs(
13
+ filename=filename,
14
+ force=force,
15
+ write=write
16
+ )
17
+ extract_action(args)
18
+
19
+
20
+ def register(parent: typer.Typer):
21
+ help_text = "Extract blocks of marked content from a given file"
22
+ parent.command(name="extract", help=help_text)(extract_main)
@@ -0,0 +1,14 @@
1
+ import typer
2
+ from .common import MockArgs
3
+ from ara_cli.ara_command_action import fetch_templates_action
4
+
5
+
6
+ def fetch_templates_main():
7
+ """Fetches templates and stores them in .araconfig."""
8
+ args = MockArgs()
9
+ fetch_templates_action(args)
10
+
11
+
12
+ def register(parent: typer.Typer):
13
+ help_text = "Fetches templates and stores them in .araconfig"
14
+ parent.command(name="fetch-templates", help=help_text)(fetch_templates_main)