in devai-cli/src/devai/commands/review.py [0:0]
def impact(current, target):
"""
This function performs an impact analysis using the Generative Model API.
Args:
current (str): Path to current version of code.
target (str): Path to target version of code.
"""
current_source='''
CURRENT VERSION:
{}
'''
target_source='''
TARGET VERSION:
{}
'''
qry = get_prompt('review_query')
if qry is None:
qry='''
INSTRUCTIONS:
You need to analyze two versions of a codebase and provide impact analysis that will help with migration from current version to target version.
You have two versions of a codebase: [CURRENT] and [TARGET].
Its possible that TARGET code does not exist, if thats the case, review CURRENT code only.
Please perform a detailed impact analysis comparing these versions. Specifically, I need you to:
Step 1) Identify the changes:
List all files modified, added, or deleted between the two versions.
For each modified file, highlight the specific lines of code that were changed.
Step 2) Categorize the changes:
Classify the changes into categories like bug fixes, new features, performance improvements, refactoring, etc.
Provide a brief explanation for each category.
Step 3) Analyze the impact:
For each change, explain its potential impact on the application's functionality, performance, security, and any other relevant aspects.
Identify any potential risks or regressions introduced by the changes.
Step 4) Provide code snippets:
Whenever possible, include relevant code snippets to illustrate the changes and their potential impact.
Please present your analysis in a clear and concise manner, using Markdown formatting for readability.
Step 5) Suggest testing areas:
Based on the analysis, recommend specific areas of the application that require thorough testing to ensure the changes haven't introduced any unexpected behavior.
If the codebase has unit tests, you can suggest which tests need to be updated or created based on your analysis.
'''
# Load files as text into source variable
current_source=current_source.format(format_files_as_string(current))
target_source=target_source.format(format_files_as_string(target))
code_chat_model = GenerativeModel(MODEL_NAME)
with telemetry.tool_context_manager(USER_AGENT):
code_chat = code_chat_model.start_chat(response_validation=False)
code_chat.send_message(qry)
response = code_chat.send_message(current_source)
response = code_chat.send_message(target_source)
click.echo(f"{response.text}")