diff --git a/codeplain_REST_api.py b/codeplain_REST_api.py index b17e600..dd3570a 100644 --- a/codeplain_REST_api.py +++ b/codeplain_REST_api.py @@ -67,8 +67,8 @@ def _handle_retry_logic( connection_error_type = "Network error" if is_connection_error else "Error" if attempt < num_retries: if not silent: - self.console.info(f"{connection_error_type} on attempt {attempt + 1}/{num_retries + 1}: {error}") - self.console.info(f"Retrying in {retry_delay} seconds...") + self.console.debug(f"{connection_error_type} on attempt {attempt + 1}/{num_retries + 1}: {error}") + self.console.debug(f"Retrying in {retry_delay} seconds...") time.sleep(retry_delay) # Exponential backoff return retry_delay * 2 @@ -117,7 +117,7 @@ def post_request( try: response_json = response.json() except requests.exceptions.JSONDecodeError as e: - print(f"Failed to decode JSON response: {e}. Response text: {response.text}") + self.console.debug(f"Failed to decode JSON response: {e}. Response text: {response.text}") raise if response.status_code == requests.codes.bad_request and "error_code" in response_json: diff --git a/docs/generate_cli.py b/docs/generate_cli.py index 6164ab2..b9abebb 100644 --- a/docs/generate_cli.py +++ b/docs/generate_cli.py @@ -1,20 +1,25 @@ import os import sys -from plain2code_arguments import create_parser - # Add the parent directory to the path so we can import plain2code_arguments sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -# Get the parser and generate help text -parser = create_parser() -help_text = parser.format_help() +def main(): + from plain2code_arguments import create_parser + + # Get the parser and generate help text + parser = create_parser(color=False) # Disable color for markdown output + help_text = parser.format_help() + + # Create markdown + md = "# Plain2Code CLI Reference\n\n```text\n" + help_text + "\n```" + + # Run generate_cli.py in the docs folder -# Create markdown -md = "# Plain2Code CLI Reference\n\n```text\n" + help_text + "\n```" + with open("plain2code_cli.md", "w", encoding="utf-8") as f: + f.write(md) -# Run generate_cli.py in the docs folder -with open("plain2code_cli.md", "w", encoding="utf-8") as f: - f.write(md) +if __name__ == "__main__": + main() diff --git a/docs/plain2code_cli.md b/docs/plain2code_cli.md index 373526b..e02136c 100644 --- a/docs/plain2code_cli.md +++ b/docs/plain2code_cli.md @@ -1,18 +1,22 @@ # Plain2Code CLI Reference ```text -usage: generate_cli.py [-h] [--verbose] [--base-folder BASE_FOLDER] [--build-folder BUILD_FOLDER] [--log-to-file | --no-log-to-file] [--log-file-name LOG_FILE_NAME] [--config-name CONFIG_NAME] - [--render-range RENDER_RANGE | --render-from RENDER_FROM] [--force-render] [--unittests-script UNITTESTS_SCRIPT] [--conformance-tests-folder CONFORMANCE_TESTS_FOLDER] - [--conformance-tests-script CONFORMANCE_TESTS_SCRIPT] [--prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT] [--test-script-timeout TEST_SCRIPT_TIMEOUT] [--api [API]] [--api-key API_KEY] - [--full-plain] [--dry-run] [--replay-with REPLAY_WITH] [--template-dir TEMPLATE_DIR] [--copy-build] [--build-dest BUILD_DEST] [--copy-conformance-tests] - [--conformance-tests-dest CONFORMANCE_TESTS_DEST] [--render-machine-graph] [--logging-config-path] [--headless] +usage: generate_cli.py [-h] [--verbose] [--base-folder BASE_FOLDER] [--build-folder BUILD_FOLDER] [--log-to-file | --no-log-to-file] + [--log-file-name LOG_FILE_NAME] [--config-name CONFIG_NAME] [--render-range RENDER_RANGE | --render-from RENDER_FROM] + [--force-render] [--unittests-script UNITTESTS_SCRIPT] [--conformance-tests-folder CONFORMANCE_TESTS_FOLDER] + [--conformance-tests-script CONFORMANCE_TESTS_SCRIPT] [--prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT] + [--test-script-timeout TEST_SCRIPT_TIMEOUT] [--api [API]] [--api-key API_KEY] [--full-plain] [--dry-run] + [--replay-with REPLAY_WITH] [--template-dir TEMPLATE_DIR] [--copy-build] [--build-dest BUILD_DEST] + [--copy-conformance-tests] [--conformance-tests-dest CONFORMANCE_TESTS_DEST] [--render-machine-graph] + [--logging-config-path LOGGING_CONFIG_PATH] [--headless] filename Render plain code to target code. positional arguments: - filename Path to the plain file to render. The directory containing this file has highest precedence for template loading, so you can place custom templates here to override the defaults. See --template-dir - for more details about template loading. + filename Path to the plain file to render. The directory containing this file has highest precedence for template loading, so + you can place custom templates here to override the defaults. See --template-dir for more details about template + loading. options: -h, --help show this help message and exit @@ -24,49 +28,58 @@ options: --log-to-file, --no-log-to-file Enable logging to a file. Defaults to True. Set to False to disable. --log-file-name LOG_FILE_NAME - Name of the log file. Defaults to 'codeplain.log'.Always resolved relative to the plain file directory.If file on this path already exists, the already existing log file will be overwritten by the - current logs. + Name of the log file. Defaults to 'codeplain.log'.Always resolved relative to the plain file directory.If file on + this path already exists, the already existing log file will be overwritten by the current logs. --render-range RENDER_RANGE - Specify a range of functionalities to render (e.g. `1` , `2`, `3`). Use comma to separate start and end IDs. If only one ID is provided, only that requirement is rendered. Range is - inclusive of both start and end IDs. + Specify a range of functionalities to render (e.g. `1` , `2`, `3`). Use comma to separate start and end IDs. If only + one functionality ID is provided, only that functionality is rendered. Range is inclusive of both start and end IDs. --render-from RENDER_FROM - Continue generation starting from this specific functionality (e.g. `2`). The requirement with this ID will be included in the output. The ID must match one of the functionalities - in your plain file. + Continue generation starting from this specific functionality (e.g. `2`). The functionality with this ID will be + included in the output. The functionality ID must match one of the functionalities in your plain file. --force-render Force re-render of all the required modules. --unittests-script UNITTESTS_SCRIPT - Shell script to run unit tests on generated code. Receives the build folder path as its first argument (default: 'plain_modules'). + Shell script to run unit tests on generated code. Receives the build folder path as its first argument (default: + 'plain_modules'). --conformance-tests-folder CONFORMANCE_TESTS_FOLDER Folder for conformance test files --conformance-tests-script CONFORMANCE_TESTS_SCRIPT - Path to conformance tests shell script. Every conformance test script should accept two arguments: 1) Path to a folder (e.g. `plain_modules/module_name`) containing generated source code, 2) Path - to a subfolder of the conformance tests folder (e.g. `conformance_tests/subfoldername`) containing test files. + Path to conformance tests shell script. Every conformance test script should accept two arguments: 1) Path to a + folder (e.g. `plain_modules/module_name`) containing generated source code, 2) Path to a subfolder of the conformance + tests folder (e.g. `conformance_tests/subfoldername`) containing test files. --prepare-environment-script PREPARE_ENVIRONMENT_SCRIPT - Path to a shell script that prepares the testing environment. The script should accept the source code folder path as its first argument. + Path to a shell script that prepares the testing environment. The script should accept the source code folder path as + its first argument. --test-script-timeout TEST_SCRIPT_TIMEOUT Timeout for test scripts in seconds. If not provided, the default timeout of 120 seconds is used. --api [API] Alternative base URL for the API. Default: `https://api.codeplain.ai` --api-key API_KEY API key used to access the API. If not provided, the `CODEPLAIN_API_KEY` environment variable is used. - --full-plain Full preview ***plain specification before code generation.Use when you want to preview context of all ***plain primitives that are going to be included in order to render the given module. + --full-plain Full preview ***plain specification before code generation.Use when you want to preview context of all ***plain + primitives that are going to be included in order to render the given module. --dry-run Dry run preview of the code generation (without actually making any changes). --replay-with REPLAY_WITH --template-dir TEMPLATE_DIR - Path to a custom template directory. Templates are searched in the following order: 1) Directory containing the plain file, 2) Custom template directory (if provided through this argument), 3) - Built-in standard_template_library directory - --copy-build If set, copy the rendered contents of code in `--base-folder` folder to `--build-dest` folder after successful rendering. + Path to a custom template directory. Templates are searched in the following order: 1) Directory containing the plain + file, 2) Custom template directory (if provided through this argument), 3) Built-in standard_template_library + directory + --copy-build If set, copy the rendered contents of code in `--base-folder` folder to `--build-dest` folder after successful + rendering. --build-dest BUILD_DEST Target folder to copy rendered contents of code to (used only if --copy-build is set). --copy-conformance-tests - If set, copy the conformance tests of code in `--conformance-tests-folder` folder to `--conformance-tests-dest` folder successful rendering. Requires --conformance-tests-script. + If set, copy the conformance tests of code in `--conformance-tests-folder` folder to `--conformance-tests-dest` + folder successful rendering. Requires --conformance-tests-script. --conformance-tests-dest CONFORMANCE_TESTS_DEST Target folder to copy conformance tests of code to (used only if --copy-conformance-tests is set). --render-machine-graph If set, render the state machine graph. - --logging-config-path + --logging-config-path LOGGING_CONFIG_PATH Path to the logging configuration file. - --headless Run in headless mode: no TUI, no terminal output except a single render-started message. All logs are written to the log file. + --headless Run in headless mode: no TUI, no terminal output except a single render-started message. All logs are written to the + log file. configuration: --config-name CONFIG_NAME - Path to the config file, defaults to config.yaml + Name of the config file to look for. Looked up in the plain file directory and the current working directory. + Defaults to config.yaml. ``` \ No newline at end of file diff --git a/file_utils.py b/file_utils.py index d8c9ef9..bb178cc 100644 --- a/file_utils.py +++ b/file_utils.py @@ -7,6 +7,7 @@ from liquid2.exceptions import UndefinedError import plain_spec +from plain2code_console import console from plain2code_nodes import Plain2CodeIncludeTag, Plain2CodeLoaderMixin from plain_modules import CODEPLAIN_MEMORY_SUBFOLDER, CODEPLAIN_METADATA_FOLDER @@ -79,7 +80,7 @@ def list_all_text_files(directory): with open(os.path.join(root, filename), "rb") as f: f.read().decode("utf-8") except UnicodeDecodeError: - print(f"WARNING! Not listing {filename} in {root}. File is not a text file. Skipping it.") + console.debug(f"WARNING! Not listing {filename} in {root}. File is not a text file. Skipping it.") continue all_files.append(os.path.join(modified_root, filename)) @@ -178,7 +179,7 @@ def get_existing_files_content(build_folder, existing_files): try: existing_files_content[file_name] = content.decode("utf-8") except UnicodeDecodeError: - print(f"WARNING! Error loading {file_name}. File is not a text file. Skipping it.") + console.debug(f"WARNING! Error loading {file_name}. File is not a text file. Skipping it.") return existing_files_content @@ -193,7 +194,7 @@ def store_response_files(target_folder, response_files, existing_files): os.remove(full_file_name) existing_files.remove(file_name) else: - print(f"WARNING! Cannot delete file! File {full_file_name} does not exist.") + console.debug(f"WARNING! Cannot delete file! File {full_file_name} does not exist.") continue @@ -219,7 +220,9 @@ def open_from(dirs, file_name): try: content_text = content.decode("utf-8") except UnicodeDecodeError: - print(f"WARNING! Error loading {file_name} ({file_name}). File is not a text file. Skipping it.") + console.debug( + f"WARNING! Error loading {file_name} ({file_name}). File is not a text file. Skipping it." + ) return content_text return None diff --git a/memory_management.py b/memory_management.py index e9a09e7..998b7b9 100644 --- a/memory_management.py +++ b/memory_management.py @@ -21,7 +21,7 @@ def fetch_memory_files(memory_folder: str) -> tuple[list[str], dict[str, str]]: return [], {} memory_files = file_utils.list_all_text_files(memory_path) memory_files_content = file_utils.get_existing_files_content(memory_path, memory_files) - console.info(f"Loaded {len(memory_files_content)} memory files.") + console.debug(f"Loaded {len(memory_files_content)} memory files.") return memory_files, memory_files_content def __init__(self, codeplain_api, module_build_folder: str): diff --git a/module_renderer.py b/module_renderer.py index 187280e..e247649 100644 --- a/module_renderer.py +++ b/module_renderer.py @@ -203,7 +203,7 @@ def _render_module( required_modules = [] has_any_required_module_changed = False if not self.args.render_machine_graph and required_modules_list: - console.info(f"Analyzing required modules of module {module_name}...") + console.debug(f"Analyzing required modules of module {module_name}...") for required_module_name in required_modules_list: required_module_filename = required_module_name + plain_file.PLAIN_SOURCE_FILE_EXTENSION has_module_changed, sub_required_modules, rendering_failed = self._render_module( diff --git a/plain2code.py b/plain2code.py index b05c8c4..554d7f6 100644 --- a/plain2code.py +++ b/plain2code.py @@ -221,6 +221,7 @@ def render(args, run_state: RunState, event_bus: EventBus): # noqa: C901 def run_render(): try: module_renderer.render_module() + console.info(f"[#79FC96]Render {run_state.render_id} completed successfully.[/#79FC96]") except RenderCancelledError: pass # TUI already closed, nothing to report except Exception as e: @@ -228,7 +229,7 @@ def run_render(): event_bus.publish(RenderFailed(error_message=str(e))) if args.headless: - print(f"Render started. Render ID: {run_state.render_id}") + console.info(f"Render started. Render ID: {run_state.render_id}") try: module_renderer.render_module() except RenderCancelledError: diff --git a/plain2code_arguments.py b/plain2code_arguments.py index e40332c..1dbb36a 100644 --- a/plain2code_arguments.py +++ b/plain2code_arguments.py @@ -1,5 +1,7 @@ import argparse import os +import sys +from typing import Any from plain2code_console import console from plain2code_exceptions import AmbiguousConfigFileError @@ -160,9 +162,16 @@ def update_args_with_config(args, parser): return args -def create_parser(): +def create_parser(color: bool = False): """Create the argument parser without parsing arguments.""" - parser = argparse.ArgumentParser(description="Render plain code to target code.") + parser_kwargs: dict[str, Any] = { + "description": "Render plain code to target code.", + } + + if sys.version_info >= (3, 13): + parser_kwargs["color"] = color + + parser = argparse.ArgumentParser(**parser_kwargs) parser.add_argument( "filename", @@ -205,14 +214,14 @@ def create_parser(): "--render-range", type=frid_range_string, help="Specify a range of functionalities to render (e.g. `1` , `2`, `3`). " - "Use comma to separate start and end IDs. If only one ID is provided, only that functionality is rendered. " + "Use comma to separate start and end IDs. If only one functionality ID is provided, only that functionality is rendered. " "Range is inclusive of both start and end IDs.", ) render_range_group.add_argument( "--render-from", type=frid_string, help="Continue generation starting from this specific functionality (e.g. `2`). " - "The requirement with this ID will be included in the output. The ID must match one of the functionalities in your plain file.", + "The functionality with this ID will be included in the output. The functionality ID must match one of the functionalities in your plain file.", ) parser.add_argument( diff --git a/plain2code_console.py b/plain2code_console.py index 916a803..91220f7 100644 --- a/plain2code_console.py +++ b/plain2code_console.py @@ -123,11 +123,11 @@ def print_resources(self, resources_list, linked_resources): self.debug("Linked resources: None") return - self.input("Linked resources:") + self.debug("Linked resources:") for resource_name in resources_list: if resource_name["target"] in linked_resources: file_tokens = self._count_tokens(linked_resources[resource_name["target"]]) - self.input( + self.debug( f"- {resource_name['text']} [#4169E1]({resource_name['target']}, {file_tokens} tokens)[/#4169E1]" ) diff --git a/plain2code_utils.py b/plain2code_utils.py index 635fa79..d500d52 100644 --- a/plain2code_utils.py +++ b/plain2code_utils.py @@ -23,7 +23,7 @@ def print_dry_run_output(plain_source_tree: dict, render_range: Optional[list[st functional_requirement_text = specifications[plain_spec.FUNCTIONAL_REQUIREMENTS][-1] console.info( "-------------------------------------\n" - f"Rendering functionality {frid}\n" + f"Rendering functionality {frid}:\n" f"{functional_requirement_text}\n" "-------------------------------------\n" ) diff --git a/render_machine/actions/analyze_specification_ambiguity.py b/render_machine/actions/analyze_specification_ambiguity.py index a02e3b0..248954f 100644 --- a/render_machine/actions/analyze_specification_ambiguity.py +++ b/render_machine/actions/analyze_specification_ambiguity.py @@ -50,7 +50,5 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | ) console.info(rendering_analysis["guidance"]) else: - console.warning( - f"No specification ambiguity detected for functionality {render_context.frid_context.frid}." - ) + console.debug(f"No specification ambiguity detected for functionality {render_context.frid_context.frid}.") return self.SUCCESSFUL_OUTCOME, None diff --git a/render_machine/actions/create_dist.py b/render_machine/actions/create_dist.py index 17ee4a7..ef78fb9 100644 --- a/render_machine/actions/create_dist.py +++ b/render_machine/actions/create_dist.py @@ -21,6 +21,6 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | render_context.conformance_tests.get_module_conformance_tests_folder(render_context.module_name), render_context.conformance_tests_dest, ) - console.info(f"[#79FC96]Render {render_context.run_state.render_id} completed successfully.[/#79FC96]") + console.info(f"[#79FC96]Render of module {render_context.module_name} completed successfully.[/#79FC96]") return self.SUCCESSFUL_OUTCOME, None diff --git a/render_machine/actions/fix_unit_tests.py b/render_machine/actions/fix_unit_tests.py index 8541a6e..977a7dd 100644 --- a/render_machine/actions/fix_unit_tests.py +++ b/render_machine/actions/fix_unit_tests.py @@ -20,7 +20,7 @@ def execute(self, render_context: RenderContext, previous_action_payload: Any | previous_unittests_issue = previous_action_payload["previous_unittests_issue"] if previous_unittests_issue and len(previous_unittests_issue) > MAX_ISSUE_LENGTH: - console.warning( + console.debug( f"Unit tests issue text is too long and will be smartly truncated to {MAX_ISSUE_LENGTH} characters." ) diff --git a/render_machine/actions/prepare_repositories.py b/render_machine/actions/prepare_repositories.py index 04cb1fe..7663954 100644 --- a/render_machine/actions/prepare_repositories.py +++ b/render_machine/actions/prepare_repositories.py @@ -22,7 +22,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | previous_frid = plain_spec.get_previous_frid(render_context.plain_source_tree, frid) if render_context.verbose: - console.info(f"Reverting code to version implemented for {previous_frid}.") + console.debug(f"Reverting code to version implemented for {previous_frid}.") git_utils.revert_to_commit_with_frid(render_context.build_folder, previous_frid) # conformance tests are still not fully implemented @@ -36,7 +36,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | if render_context.required_modules: previous_module = render_context.required_modules[-1] if render_context.verbose: - console.info(f"Cloning git repo from module {previous_module.name}.") + console.debug(f"Cloning git repo from module {previous_module.name}.") file_utils.delete_folder(render_context.build_folder) git_utils.clone_repo( @@ -47,7 +47,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | ) else: if render_context.verbose: - console.info("Initializing git repositories for the render folders.") + console.debug("Initializing git repositories for the render folders.") git_utils.init_git_repo( render_context.build_folder, render_context.module_name, render_context.run_state.render_id diff --git a/render_machine/actions/refactor_code.py b/render_machine/actions/refactor_code.py index 78bf068..728fe00 100644 --- a/render_machine/actions/refactor_code.py +++ b/render_machine/actions/refactor_code.py @@ -17,7 +17,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | ) if render_context.verbose: - console.info(f"Refactoring iteration {render_context.frid_context.refactoring_iteration}.") + console.debug(f"Refactoring iteration {render_context.frid_context.refactoring_iteration}.") if render_context.verbose: console.print_files( @@ -38,7 +38,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | if len(response_files) == 0: if render_context.verbose: - console.info("No files refactored.") + console.debug("No files refactored.") return self.NO_FILES_REFACTORED_OUTCOME, None file_utils.store_response_files(render_context.build_folder, response_files, existing_files) diff --git a/render_machine/actions/render_conformance_tests.py b/render_machine/actions/render_conformance_tests.py index 89c8b5b..af36215 100644 --- a/render_machine/actions/render_conformance_tests.py +++ b/render_machine/actions/render_conformance_tests.py @@ -55,7 +55,7 @@ def _render_conformance_tests(self, render_context: RenderContext): ) if render_context.verbose: - console.info(f"Storing conformance test files in subfolder {conformance_tests_folder_name}/") + console.debug(f"Storing conformance test files in subfolder {conformance_tests_folder_name}/") render_context.conformance_tests_running_context.get_conformance_tests_json( render_context.conformance_tests_running_context.current_testing_module_name diff --git a/render_machine/actions/render_functional_requirement.py b/render_machine/actions/render_functional_requirement.py index 8b15bef..786e50d 100644 --- a/render_machine/actions/render_functional_requirement.py +++ b/render_machine/actions/render_functional_requirement.py @@ -29,8 +29,8 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | msg += f"Module: {render_context.module_name}\n" msg += f"Rendering functionality {render_context.frid_context.frid}" if render_context.frid_context.functional_requirement_render_attempts > 1: - msg += f", attempt number {render_context.frid_context.functional_requirement_render_attempts}/{MAX_CODE_GENERATION_RETRIES}." - msg += f"\n{render_context.frid_context.functional_requirement_text}\n" + msg += f", attempt number {render_context.frid_context.functional_requirement_render_attempts}/{MAX_CODE_GENERATION_RETRIES}" + msg += f":\n{render_context.frid_context.functional_requirement_text}\n" msg += "-------------------------------------" console.info(msg) diff --git a/render_machine/actions/run_conformance_tests.py b/render_machine/actions/run_conformance_tests.py index db789f1..06402a4 100644 --- a/render_machine/actions/run_conformance_tests.py +++ b/render_machine/actions/run_conformance_tests.py @@ -44,6 +44,7 @@ def execute(self, render_context: RenderContext, _previous_action_payload: Any | render_context.verbose, "Conformance Tests", frid=render_context.conformance_tests_running_context.current_testing_frid, + module=render_context.conformance_tests_running_context.current_testing_module_name, timeout=render_context.test_script_timeout, stop_event=render_context.stop_event, ) diff --git a/render_machine/conformance_tests.py b/render_machine/conformance_tests.py index 410c5be..2b21e66 100644 --- a/render_machine/conformance_tests.py +++ b/render_machine/conformance_tests.py @@ -42,7 +42,7 @@ def dump_conformance_tests_json(self, module_name: str, conformance_tests_json: """Dump the conformance tests definition to the file.""" if os.path.exists(self.get_module_conformance_tests_folder(module_name)): if self.verbose: - console.info( + console.debug( f"Storing conformance tests definition to {self._get_full_conformance_tests_definition_file_name(module_name)}" ) with open(self._get_full_conformance_tests_definition_file_name(module_name), "w") as f: @@ -108,7 +108,7 @@ def store_conformance_tests_files( existing_conformance_test_files: list[str], ): if module_name != current_testing_module_name: - console.info( + console.debug( f"Storing conformance tests files for module '{current_testing_module_name}' inside module '{module_name}'" ) @@ -122,7 +122,7 @@ def store_conformance_tests_files( ) if source_conformance_test_folder_name != module_name: - console.info( + console.debug( f"Creating folder {new_conformance_test_folder_name} for a copy of conformance tests {source_conformance_test_folder_name}" ) diff --git a/render_machine/render_utils.py b/render_machine/render_utils.py index 591be70..f7d8dcb 100644 --- a/render_machine/render_utils.py +++ b/render_machine/render_utils.py @@ -76,6 +76,7 @@ def execute_script( # noqa: C901 verbose: bool, script_type: str, frid: Optional[str] = None, + module: Optional[str] = None, timeout: Optional[int] = None, stop_event: Optional[threading.Event] = None, ) -> tuple[int, str, Optional[str]]: @@ -139,22 +140,24 @@ def execute_script( # noqa: C901 temp_file.write(f"{script_type} script {script} successfully passed.\n") temp_file.write(f"{script_type} script execution time: {elapsed_time:.2f} seconds.\n") - console.info(f"[#888888]{script_type} script output stored in: {temp_file_path.strip()}[/#888888]") + console.debug(f"[#888888]{script_type} script output stored in: {temp_file_path.strip()}[/#888888]") if proc.returncode != 0: if frid is not None: - console.info( - f"The {script_type} script for ID {frid} has failed. Initiating the patching mode to automatically correct the discrepancies." + console.debug( + f"The {script_type} script for functionality ID {frid} of module {module} has failed. Initiating the patching mode to automatically correct the discrepancies." ) else: - console.info( + console.debug( f"The {script_type} script has failed. Initiating the patching mode to automatically correct the discrepancies." ) else: if frid is not None: - console.info(f"[#79FC96]The {script_type} script for ID {frid} has passed successfully.[/#79FC96]") + console.info( + f"[#79FC96]The {script_type} script for functionality ID {frid} of module {module} has passed successfully.[/#79FC96]" + ) else: - console.info(f"[#79FC96]All {script_type} script passed successfully.[/#79FC96]") + console.info(f"[#79FC96]All {script_type} scripts have passed successfully.[/#79FC96]") return proc.returncode, stdout, temp_file_path