ara-cli 0.1.10.0__py3-none-any.whl → 0.1.13.3__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.
Files changed (140) hide show
  1. ara_cli/__init__.py +51 -6
  2. ara_cli/__main__.py +270 -103
  3. ara_cli/ara_command_action.py +106 -63
  4. ara_cli/ara_config.py +187 -128
  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/config.py +221 -0
  11. ara_cli/ara_subcommands/convert.py +43 -0
  12. ara_cli/ara_subcommands/create.py +75 -0
  13. ara_cli/ara_subcommands/delete.py +22 -0
  14. ara_cli/ara_subcommands/extract.py +22 -0
  15. ara_cli/ara_subcommands/fetch.py +41 -0
  16. ara_cli/ara_subcommands/fetch_agents.py +22 -0
  17. ara_cli/ara_subcommands/fetch_scripts.py +19 -0
  18. ara_cli/ara_subcommands/fetch_templates.py +19 -0
  19. ara_cli/ara_subcommands/list.py +139 -0
  20. ara_cli/ara_subcommands/list_tags.py +25 -0
  21. ara_cli/ara_subcommands/load.py +48 -0
  22. ara_cli/ara_subcommands/prompt.py +136 -0
  23. ara_cli/ara_subcommands/read.py +47 -0
  24. ara_cli/ara_subcommands/read_status.py +20 -0
  25. ara_cli/ara_subcommands/read_user.py +20 -0
  26. ara_cli/ara_subcommands/reconnect.py +27 -0
  27. ara_cli/ara_subcommands/rename.py +22 -0
  28. ara_cli/ara_subcommands/scan.py +14 -0
  29. ara_cli/ara_subcommands/set_status.py +22 -0
  30. ara_cli/ara_subcommands/set_user.py +22 -0
  31. ara_cli/ara_subcommands/template.py +16 -0
  32. ara_cli/artefact_autofix.py +154 -63
  33. ara_cli/artefact_converter.py +256 -0
  34. ara_cli/artefact_models/artefact_model.py +106 -25
  35. ara_cli/artefact_models/artefact_templates.py +20 -10
  36. ara_cli/artefact_models/epic_artefact_model.py +11 -2
  37. ara_cli/artefact_models/feature_artefact_model.py +31 -1
  38. ara_cli/artefact_models/userstory_artefact_model.py +15 -3
  39. ara_cli/artefact_scan.py +2 -2
  40. ara_cli/chat.py +283 -80
  41. ara_cli/chat_agent/__init__.py +0 -0
  42. ara_cli/chat_agent/agent_process_manager.py +155 -0
  43. ara_cli/chat_script_runner/__init__.py +0 -0
  44. ara_cli/chat_script_runner/script_completer.py +23 -0
  45. ara_cli/chat_script_runner/script_finder.py +41 -0
  46. ara_cli/chat_script_runner/script_lister.py +36 -0
  47. ara_cli/chat_script_runner/script_runner.py +36 -0
  48. ara_cli/chat_web_search/__init__.py +0 -0
  49. ara_cli/chat_web_search/web_search.py +263 -0
  50. ara_cli/commands/agent_run_command.py +98 -0
  51. ara_cli/commands/fetch_agents_command.py +106 -0
  52. ara_cli/commands/fetch_scripts_command.py +43 -0
  53. ara_cli/commands/fetch_templates_command.py +39 -0
  54. ara_cli/commands/fetch_templates_commands.py +39 -0
  55. ara_cli/commands/list_agents_command.py +39 -0
  56. ara_cli/commands/read_command.py +17 -4
  57. ara_cli/completers.py +180 -0
  58. ara_cli/constants.py +2 -0
  59. ara_cli/directory_navigator.py +37 -4
  60. ara_cli/file_loaders/text_file_loader.py +2 -2
  61. ara_cli/global_file_lister.py +5 -15
  62. ara_cli/llm_utils.py +58 -0
  63. ara_cli/prompt_chat.py +20 -4
  64. ara_cli/prompt_extractor.py +199 -76
  65. ara_cli/prompt_handler.py +160 -59
  66. ara_cli/tag_extractor.py +38 -18
  67. ara_cli/template_loader.py +3 -2
  68. ara_cli/template_manager.py +52 -21
  69. ara_cli/templates/global-scripts/hello_global.py +1 -0
  70. ara_cli/templates/prompt-modules/commands/add_scenarios_for_new_behaviour.feature_creation_agent.commands.md +1 -0
  71. ara_cli/templates/prompt-modules/commands/align_feature_with_implementation_changes.interview_agent.commands.md +1 -0
  72. ara_cli/templates/prompt-modules/commands/analyze_codebase_and_plan_tasks.interview_agent.commands.md +1 -0
  73. ara_cli/templates/prompt-modules/commands/choose_best_parent_artefact.interview_agent.commands.md +1 -0
  74. ara_cli/templates/prompt-modules/commands/create_tasks_from_artefact_content.interview_agent.commands.md +1 -0
  75. ara_cli/templates/prompt-modules/commands/create_tests_for_uncovered_modules.test_generation_agent.commands.md +1 -0
  76. ara_cli/templates/prompt-modules/commands/derive_features_from_video_description.feature_creation_agent.commands.md +1 -0
  77. ara_cli/templates/prompt-modules/commands/describe_agent_capabilities.agent.commands.md +1 -0
  78. ara_cli/templates/prompt-modules/commands/empty.commands.md +2 -12
  79. ara_cli/templates/prompt-modules/commands/execute_scoped_todos_in_task.interview_agent.commands.md +1 -0
  80. ara_cli/templates/prompt-modules/commands/explain_single_file_purpose.interview_agent.commands.md +1 -0
  81. ara_cli/templates/prompt-modules/commands/extract_file_information_bullets.interview_agent.commands.md +1 -0
  82. ara_cli/templates/prompt-modules/commands/extract_general.commands.md +12 -0
  83. ara_cli/templates/prompt-modules/commands/extract_markdown.commands.md +11 -0
  84. ara_cli/templates/prompt-modules/commands/extract_python.commands.md +13 -0
  85. ara_cli/templates/prompt-modules/commands/feature_add_or_modifiy_specified_behavior.commands.md +36 -0
  86. ara_cli/templates/prompt-modules/commands/feature_generate_initial_specified_bevahior.commands.md +53 -0
  87. ara_cli/templates/prompt-modules/commands/fix_failing_behave_step_definitions.interview_agent.commands.md +1 -0
  88. ara_cli/templates/prompt-modules/commands/fix_failing_pytest_tests.interview_agent.commands.md +1 -0
  89. ara_cli/templates/prompt-modules/commands/general_instruction_policy.commands.md +47 -0
  90. ara_cli/templates/prompt-modules/commands/generate_and_fix_pytest_tests.test_generation_agent.commands.md +1 -0
  91. ara_cli/templates/prompt-modules/commands/prompt_template_tech_stack_transformer.commands.md +95 -0
  92. ara_cli/templates/prompt-modules/commands/python_bug_fixing_code.commands.md +34 -0
  93. ara_cli/templates/prompt-modules/commands/python_generate_code.commands.md +27 -0
  94. ara_cli/templates/prompt-modules/commands/python_refactoring_code.commands.md +39 -0
  95. ara_cli/templates/prompt-modules/commands/python_step_definitions_generation_and_fixing.commands.md +40 -0
  96. ara_cli/templates/prompt-modules/commands/python_unittest_generation_and_fixing.commands.md +48 -0
  97. ara_cli/templates/prompt-modules/commands/suggest_next_story_child_tasks.interview_agent.commands.md +1 -0
  98. ara_cli/templates/prompt-modules/commands/summarize_or_transcribe_media.interview_agent.commands.md +1 -0
  99. ara_cli/templates/prompt-modules/commands/update_feature_to_match_implementation.feature_creation_agent.commands.md +1 -0
  100. ara_cli/templates/prompt-modules/commands/update_user_story_with_requirements.interview_agent.commands.md +1 -0
  101. ara_cli/version.py +1 -1
  102. {ara_cli-0.1.10.0.dist-info → ara_cli-0.1.13.3.dist-info}/METADATA +34 -1
  103. {ara_cli-0.1.10.0.dist-info → ara_cli-0.1.13.3.dist-info}/RECORD +123 -54
  104. tests/test_ara_command_action.py +31 -19
  105. tests/test_ara_config.py +177 -90
  106. tests/test_artefact_autofix.py +170 -97
  107. tests/test_artefact_autofix_integration.py +495 -0
  108. tests/test_artefact_converter.py +357 -0
  109. tests/test_artefact_extraction.py +564 -0
  110. tests/test_artefact_scan.py +1 -1
  111. tests/test_chat.py +162 -126
  112. tests/test_chat_givens_images.py +603 -0
  113. tests/test_chat_script_runner.py +454 -0
  114. tests/test_global_file_lister.py +1 -1
  115. tests/test_llm_utils.py +164 -0
  116. tests/test_prompt_chat.py +343 -0
  117. tests/test_prompt_extractor.py +683 -0
  118. tests/test_prompt_handler.py +12 -4
  119. tests/test_tag_extractor.py +19 -13
  120. tests/test_web_search.py +467 -0
  121. ara_cli/ara_command_parser.py +0 -605
  122. ara_cli/templates/prompt-modules/blueprints/complete_pytest_unittest.blueprint.md +0 -27
  123. ara_cli/templates/prompt-modules/blueprints/task_todo_list_implement_feature_BDD_way.blueprint.md +0 -30
  124. ara_cli/templates/prompt-modules/commands/artefact_classification.commands.md +0 -9
  125. ara_cli/templates/prompt-modules/commands/artefact_extension.commands.md +0 -17
  126. ara_cli/templates/prompt-modules/commands/artefact_formulation.commands.md +0 -14
  127. ara_cli/templates/prompt-modules/commands/behave_step_generation.commands.md +0 -102
  128. ara_cli/templates/prompt-modules/commands/code_generation_complex.commands.md +0 -20
  129. ara_cli/templates/prompt-modules/commands/code_generation_simple.commands.md +0 -13
  130. ara_cli/templates/prompt-modules/commands/error_fixing.commands.md +0 -20
  131. ara_cli/templates/prompt-modules/commands/feature_file_update.commands.md +0 -18
  132. ara_cli/templates/prompt-modules/commands/feature_formulation.commands.md +0 -43
  133. ara_cli/templates/prompt-modules/commands/js_code_generation_simple.commands.md +0 -13
  134. ara_cli/templates/prompt-modules/commands/refactoring.commands.md +0 -15
  135. ara_cli/templates/prompt-modules/commands/refactoring_analysis.commands.md +0 -9
  136. ara_cli/templates/prompt-modules/commands/reverse_engineer_feature_file.commands.md +0 -15
  137. ara_cli/templates/prompt-modules/commands/reverse_engineer_program_flow.commands.md +0 -19
  138. {ara_cli-0.1.10.0.dist-info → ara_cli-0.1.13.3.dist-info}/WHEEL +0 -0
  139. {ara_cli-0.1.10.0.dist-info → ara_cli-0.1.13.3.dist-info}/entry_points.txt +0 -0
  140. {ara_cli-0.1.10.0.dist-info → ara_cli-0.1.13.3.dist-info}/top_level.txt +0 -0
ara_cli/__init__.py CHANGED
@@ -1,20 +1,65 @@
1
1
  import warnings
2
2
  from .error_handler import ErrorHandler
3
3
 
4
-
5
- whitelisted_commands = ["RERUN", "SEND", "EXTRACT", "LOAD_IMAGE", "CHOOSE_MODEL", "CHOOSE_EXTRACTION_MODEL", "CURRENT_MODEL", "CURRENT_EXTRACTION_MODEL", "LIST_MODELS"]
6
-
4
+ whitelisted_commands = [
5
+ "RERUN",
6
+ "SEND",
7
+ "EXTRACT",
8
+ "LOAD_IMAGE",
9
+ "CHOOSE_MODEL",
10
+ "CHOOSE_EXTRACTION_MODEL",
11
+ "CURRENT_MODEL",
12
+ "CURRENT_EXTRACTION_MODEL",
13
+ "LIST_MODELS",
14
+ ]
7
15
 
8
16
  error_handler = ErrorHandler()
9
17
 
10
18
 
11
19
  # ANSI escape codes for coloring
12
- YELLOW = '\033[93m'
13
- RESET = '\033[0m'
20
+ YELLOW = "\033[93m"
21
+ RESET = "\033[0m"
14
22
 
15
23
 
16
24
  def format_warning(message, category, *args, **kwargs):
17
- return f'{YELLOW}[WARNING] {category.__name__}: {message}{RESET}\n'
25
+ return f"{YELLOW}[WARNING] {category.__name__}: {message}{RESET}\n"
18
26
 
19
27
 
20
28
  warnings.formatwarning = format_warning
29
+
30
+ ### CHAT VALUES ###
31
+
32
+ CATEGORY_CHAT_CONTROL = "Chat control commands"
33
+ CATEGORY_LLM_CONTROL = "Language model controls"
34
+ CATEGORY_SCRIPT_CONTROL = "Script control commands"
35
+ CATEGORY_AGENT_CONTROL = "Agent control commands"
36
+
37
+ ROLE_PROMPT = "ara prompt"
38
+ ROLE_RESPONSE = "ara response"
39
+
40
+ INTRO = """/***************************************/
41
+ araarar
42
+ aa ara
43
+ aa aa aara
44
+ a araarar
45
+ a ar ar
46
+ aa ara
47
+ a a
48
+ a aa
49
+ a a
50
+ ar aa aa
51
+ (c) ara chat by talsen team
52
+ aa aa
53
+ aa a
54
+ a aa
55
+ aa
56
+ /***************************************/
57
+ Start chatting (type 'HELP'/'h' for available commands, 'QUIT'/'q' to exit chat mode):"""
58
+
59
+ BINARY_TYPE_MAPPING = {
60
+ ".png": "image/png",
61
+ ".jpg": "image/jpeg",
62
+ ".jpeg": "image/jpeg",
63
+ }
64
+
65
+ DOCUMENT_TYPE_EXTENSIONS = [".docx", ".doc", ".odt", ".pdf"]
ara_cli/__main__.py CHANGED
@@ -1,129 +1,296 @@
1
- # PYTHON_ARGCOMPLETE_OK
2
- from ara_cli.ara_command_parser import action_parser
3
- from ara_cli.error_handler import AraError
1
+ import typer
2
+ import os
3
+ from typing import Optional
4
+ from os import getenv
4
5
  from ara_cli.version import __version__
5
- from ara_cli.ara_command_action import (
6
- create_action,
7
- delete_action,
8
- rename_action,
9
- list_action,
10
- list_tags_action,
11
- prompt_action,
12
- chat_action,
13
- template_action,
14
- fetch_templates_action,
15
- read_action,
16
- reconnect_action,
17
- read_status_action,
18
- read_user_action,
19
- set_status_action,
20
- set_user_action,
21
- classifier_directory_action,
22
- scan_action,
23
- autofix_action,
24
- extract_action,
25
- load_action
6
+ from ara_cli import error_handler
7
+ from ara_cli.ara_subcommands.create import register as register_create_cli
8
+ from ara_cli.ara_subcommands.delete import register as register_delete_cli
9
+ from ara_cli.ara_subcommands.rename import register as register_rename_cli
10
+ from ara_cli.ara_subcommands.list import register as register_list_cli
11
+ from ara_cli.ara_subcommands.list_tags import register as register_list_tags_cli
12
+ from ara_cli.ara_subcommands.prompt import register as register_prompt_cli
13
+ from ara_cli.ara_subcommands.chat import register as register_chat_cli
14
+ from ara_cli.ara_subcommands.template import register as register_template_cli
15
+ from ara_cli.ara_subcommands.fetch_templates import (
16
+ register as register_fetch_templates_cli,
26
17
  )
27
- from . import error_handler
28
- import argcomplete
29
- import sys
30
- from os import getenv
18
+ from ara_cli.ara_subcommands.fetch_scripts import register as register_fetch_scripts_cli
19
+ from ara_cli.ara_subcommands.fetch_agents import register as register_fetch_agents_cli
20
+ from ara_cli.ara_subcommands.fetch import register as register_fetch_cli
21
+ from ara_cli.ara_subcommands.read import register as register_read_cli
22
+ from ara_cli.ara_subcommands.reconnect import register as register_reconnect_cli
23
+ from ara_cli.ara_subcommands.read_status import register as register_read_status_cli
24
+ from ara_cli.ara_subcommands.read_user import register as register_read_user_cli
25
+ from ara_cli.ara_subcommands.set_status import register as register_set_status_cli
26
+ from ara_cli.ara_subcommands.set_user import register as register_set_user_cli
27
+ from ara_cli.ara_subcommands.classifier_directory import (
28
+ register as register_classifier_directory_cli,
29
+ )
30
+ from ara_cli.ara_subcommands.scan import register as register_scan_cli
31
+ from ara_cli.ara_subcommands.autofix import register as register_autofix_cli
32
+ from ara_cli.ara_subcommands.extract import register as register_extract_cli
33
+ from ara_cli.ara_subcommands.load import register as register_load_cli
34
+ from ara_cli.ara_subcommands.config import register as register_config_cli
35
+ from ara_cli.ara_subcommands.convert import register as register_convert_cli
31
36
 
37
+ from ara_cli.directory_navigator import DirectoryNavigator
32
38
 
33
- def define_action_mapping():
34
- return {
35
- "create": create_action,
36
- "delete": delete_action,
37
- "rename": rename_action,
38
- "list": list_action,
39
- "list-tags": list_tags_action,
40
- "prompt": prompt_action,
41
- "chat": chat_action,
42
- "template": template_action,
43
- "fetch-templates": fetch_templates_action,
44
- "read": read_action,
45
- "reconnect": reconnect_action,
46
- "read-status": read_status_action,
47
- "read-user": read_user_action,
48
- "set-status": set_status_action,
49
- "set-user": set_user_action,
50
- "classifier-directory": classifier_directory_action,
51
- "scan": scan_action,
52
- "autofix": autofix_action,
53
- "extract": extract_action,
54
- "load": load_action
55
- }
56
-
57
-
58
- def handle_invalid_action(args):
59
- raise AraError("Invalid action provided. Type ara -h for help", error_code=1)
39
+
40
+ def version_callback(value: bool):
41
+ if value:
42
+ typer.echo(f"ara {__version__}")
43
+ raise typer.Exit()
60
44
 
61
45
 
62
46
  def is_debug_mode_enabled():
63
47
  """Check if debug mode is enabled via environment variable."""
64
- return getenv('ARA_DEBUG', '').lower() in ('1', 'true', 'yes')
65
-
66
-
67
- def setup_parser():
68
- """Create and configure the argument parser."""
69
- parser = action_parser()
70
-
71
- # Show examples when help is called
72
- if any(arg in sys.argv for arg in ["-h", "--help"]):
73
- parser.add_examples = True
74
-
75
- parser.add_argument(
76
- "-v", "--version", action="version", version=f"%(prog)s {__version__}"
77
- )
78
-
79
- parser.add_argument(
80
- "--debug", action="store_true", help="Enable debug mode for detailed error output"
81
- )
82
-
83
- return parser
48
+ return getenv("ARA_DEBUG", "").lower() in ("1", "true", "yes")
84
49
 
85
50
 
86
- def configure_debug_mode(args, env_debug_mode):
51
+ def configure_debug_mode(debug: bool, env_debug_mode: bool):
87
52
  """Configure debug mode based on arguments and environment."""
88
- if (hasattr(args, 'debug') and args.debug) or env_debug_mode:
53
+ if debug or env_debug_mode:
89
54
  error_handler.debug_mode = True
90
55
 
91
56
 
92
- def should_show_help(args):
93
- """Check if help should be displayed."""
94
- return not hasattr(args, "action") or not args.action
57
+ def check_ara_directory_exists():
58
+ """Check if ara directory exists or if we're inside ara directory tree."""
59
+ return DirectoryNavigator.find_ara_directory_root() is not None
60
+
61
+
62
+ def prompt_create_ara_directory():
63
+ """Prompt user to create ara directory and create it if confirmed."""
64
+ # Print the prompt message
65
+ print(
66
+ "No 'ara' directory found. Create one in the current directory? (Y/n)",
67
+ end=" ",
68
+ flush=True,
69
+ )
70
+
71
+ # Read user input
72
+ try:
73
+ response = input().strip()
74
+ except (EOFError, KeyboardInterrupt):
75
+ typer.echo("\nOperation cancelled.")
76
+ raise typer.Exit(1)
77
+
78
+ if response.lower() in ("y", "yes", ""):
79
+ current_dir = os.getcwd()
80
+ ara_path = os.path.join(current_dir, "ara")
81
+
82
+ # Create ara directory structure
83
+ subdirectories = [
84
+ "businessgoals",
85
+ "capabilities",
86
+ "epics",
87
+ "examples",
88
+ "features",
89
+ "keyfeatures",
90
+ "tasks",
91
+ "userstories",
92
+ "vision",
93
+ ]
94
+
95
+ try:
96
+ # Create main ara directory
97
+ os.makedirs(ara_path, exist_ok=True)
98
+
99
+ # Create subdirectories for artefact types
100
+ for subdir in subdirectories:
101
+ os.makedirs(os.path.join(ara_path, subdir), exist_ok=True)
102
+
103
+ # Create .araconfig directory
104
+ araconfig_path = os.path.join(ara_path, ".araconfig")
105
+ os.makedirs(araconfig_path, exist_ok=True)
106
+
107
+ # Create default ara_config.json using ConfigManager
108
+ from ara_cli.ara_config import ConfigManager, ARAconfig
109
+
110
+ config_file_path = os.path.join(araconfig_path, "ara_config.json")
111
+
112
+ # Reset ConfigManager to ensure clean state
113
+ ConfigManager.reset()
114
+
115
+ # Create default config and save it
116
+ default_config = ARAconfig()
117
+ from ara_cli.ara_config import save_data
118
+
119
+ save_data(config_file_path, default_config)
120
+
121
+ typer.echo(f"Created ara directory structure at {ara_path}")
122
+ typer.echo(f"Created default configuration at {config_file_path}")
123
+ return True
124
+
125
+ except OSError as e:
126
+ typer.echo(f"Error creating ara directory: {e}", err=True)
127
+ raise typer.Exit(1)
128
+ except Exception as e:
129
+ typer.echo(f"Error creating configuration file: {e}", err=True)
130
+ raise typer.Exit(1)
131
+ else:
132
+ typer.echo("Ara directory creation cancelled.")
133
+ raise typer.Exit(0)
134
+
135
+
136
+ def requires_ara_directory():
137
+ """Check if ara directory exists and prompt to create if not."""
138
+ if not check_ara_directory_exists():
139
+ return prompt_create_ara_directory()
140
+ return True
141
+
142
+
143
+ def create_app():
144
+ app = typer.Typer(
145
+ help="""The ara cli terminal tool is a management tool for classified ara artefacts.
146
+
147
+ Valid classified artefacts are: businessgoal, vision, capability, keyfeature, feature, epic, userstory, example, feature, task.
148
+
149
+ The default ara directory structure of classified artefact of the ara cli tool is:
150
+ .
151
+ └── ara
152
+ ├── businessgoals
153
+ ├── capabilities
154
+ ├── epics
155
+ ├── examples
156
+ ├── features
157
+ ├── keyfeatures
158
+ ├── tasks
159
+ ├── userstories
160
+ └── vision
161
+
162
+ ara artefact handling examples:
163
+ > create a new artefact for e.g. a feature: ara create feature {feature_name}
164
+ > create a new artefact for e.g. a feature that contributes to an userstory: ara create feature {feature_name} contributes-to userstory {story_name}
165
+ > read an artefact and return the content as terminal output, for eg. of a task: ara read task {task_name}
166
+ > read an artefact and its full chain of contributions to its parents and return
167
+ the content as terminal output, for eg. of a task: ara read task {task_name} --branch
168
+ > delete an artefact for e.g. feature: ara delete feature {feature_name}
169
+ > rename artefact and artefact data directory for e.g. a feature: ara rename feature {initial_feature_name} {new_feature_name}
170
+ > create additional templates for a specific aspect (valid aspects are: customer,
171
+ persona, concept, technology) related to an existing artefact like a feature: ara create feature {feature_name} aspect {aspect_name}
172
+ > list artefact data with .md file extension ara list {classifier} {artefact_name} --data --include-extension .md
173
+ > list artefact data with .md and .json file extensions ara list {classifier} {artefact_name} --data --include-extension .md .json
174
+ > list everything but userstories ara list --exclude-extension .userstory
175
+ > list all existing features: ara list --include-extension .feature
176
+ > list all artefacts of a specific classifier: ara list {classifier}
177
+ > list all child artefacts contributing value to a parent artefact: ara list --include-content "Contributes to {name_of_parent_artefact} {ara classifier_of_parent_artefact}"
178
+ > list tasks which contain 'example content' ara list --include-extension .task --include-content "example content"
179
+ > list children artefacts of a userstory ara list userstory {name_of_userstory} --children
180
+ > list parent artefacts of a userstory ara list userstory {name_of_userstory} --branch
181
+ > list parent businessgoal artefact of a userstory ara list userstory {name_of_userstory} --branch --include-extension .businessgoal
182
+ > print any artefact template for e.g. a feature file template in the terminal: ara template feature
183
+
184
+ ara prompt templates examples:
185
+ > get and copy all prompt templates (blueprints, rules, intentions, commands
186
+ in the ara/.araconfig/global-prompt-modules directory: ara fetch-templates
187
+
188
+ ara chat examples:
189
+ > chat with ara and save the default chat.md file in the working directory: ara chat
190
+ > chat with ara and save the default task_chat.md file in the task.data directory: ara prompt chat task {task_name}
191
+
192
+ > initialize a macro prompt for a task: ara prompt init task {task_name}
193
+ > load selected templates in config_prompt_templates.md for the task {task_name}: ara prompt load task {task_name}
194
+ > create and send configured prompt of the task {task_name} to the configured LLM: ara prompt send task {task_name}
195
+ > extract the selected LLM response in task.exploration.md and save to disk: ara prompt extract task {task_name}
196
+
197
+ ara config examples:
198
+ > show current configuration status: ara config show
199
+ > show only LLM configurations: ara config show --llm
200
+ > reset LLM configurations to defaults: ara config reset --llm-config -y
201
+ > preview reset without making changes: ara config reset --all --dry-run
202
+ """,
203
+ no_args_is_help=True,
204
+ add_completion=True,
205
+ rich_markup_mode="rich",
206
+ )
207
+
208
+ @app.callback(invoke_without_command=True)
209
+ def main(
210
+ ctx: typer.Context,
211
+ version: Optional[bool] = typer.Option(
212
+ None,
213
+ "--version",
214
+ "-v",
215
+ callback=version_callback,
216
+ is_eager=True,
217
+ help="Show version and exit",
218
+ ),
219
+ debug: bool = typer.Option(
220
+ False, "--debug", help="Enable debug mode for detailed error output"
221
+ ),
222
+ ):
223
+ """The ara cli terminal tool is a management tool for classified ara artefacts."""
224
+ debug_mode = is_debug_mode_enabled()
225
+ configure_debug_mode(debug, debug_mode)
226
+
227
+ # Only show help if no subcommand is invoked
228
+ if ctx.invoked_subcommand is None:
229
+ ctx.get_help()
230
+ ctx.exit()
231
+
232
+ # Check for ara directory before executing any command
233
+ # Skip check for commands that don't require ara directory
234
+ commands_requiring_ara = {
235
+ "create",
236
+ "delete",
237
+ "rename",
238
+ "list",
239
+ "list-tags",
240
+ "prompt",
241
+ "read",
242
+ "reconnect",
243
+ "read-status",
244
+ "read-user",
245
+ "set-status",
246
+ "set-user",
247
+ "scan",
248
+ "autofix",
249
+ }
250
+
251
+ if ctx.invoked_subcommand in commands_requiring_ara:
252
+ requires_ara_directory()
95
253
 
254
+ # Register all commands
255
+ register_create_cli(app)
256
+ register_delete_cli(app)
257
+ register_rename_cli(app)
258
+ register_list_cli(app)
259
+ register_list_tags_cli(app)
260
+ register_prompt_cli(app)
261
+ register_chat_cli(app)
262
+ register_template_cli(app)
263
+ register_fetch_templates_cli(app)
264
+ register_fetch_scripts_cli(app)
265
+ register_fetch_agents_cli(app)
266
+ register_fetch_cli(app)
267
+ register_read_cli(app)
268
+ register_reconnect_cli(app)
269
+ register_read_status_cli(app)
270
+ register_read_user_cli(app)
271
+ register_set_status_cli(app)
272
+ register_set_user_cli(app)
273
+ register_classifier_directory_cli(app)
274
+ register_scan_cli(app)
275
+ register_autofix_cli(app)
276
+ register_extract_cli(app)
277
+ register_load_cli(app)
278
+ register_config_cli(app)
279
+ register_convert_cli(app)
96
280
 
97
- def execute_action(args, action_mapping):
98
- """Execute the specified action."""
99
- action = action_mapping.get(args.action, handle_invalid_action)
100
- action(args)
281
+ return app
101
282
 
102
283
 
103
284
  def cli():
104
- debug_mode = is_debug_mode_enabled()
105
-
285
+ app = create_app()
106
286
  try:
107
- parser = setup_parser()
108
- action_mapping = define_action_mapping()
109
-
110
- argcomplete.autocomplete(parser)
111
- args = parser.parse_args()
112
-
113
- configure_debug_mode(args, debug_mode)
114
-
115
- if should_show_help(args):
116
- parser.print_help()
117
- return
118
-
119
- execute_action(args, action_mapping)
120
-
287
+ app()
121
288
  except KeyboardInterrupt:
122
- print("\n[INFO] Operation cancelled by user", file=sys.stderr)
123
- sys.exit(130) # Standard exit code for Ctrl+C
289
+ typer.echo("\n[INFO] Operation cancelled by user", err=True)
290
+ raise typer.Exit(130) # Standard exit code for Ctrl+C
124
291
  except Exception as e:
125
292
  error_handler.handle_error(e, context="cli")
126
293
 
127
294
 
128
295
  if __name__ == "__main__":
129
- cli()
296
+ cli()