@@ -338,28 +338,6 @@ def review(
338338 if issue .suggestion :
339339 logging .info (f" 💡 Suggestion: { issue .suggestion } " )
340340 logging .info (f" ```\n { issue .suggestion } \n ```" )
341-
342- if task_id :
343- logging .info ("\n --- Assessing Task Relevance ---" )
344-
345- review_summary = f"Found { len (all_issues )} issue(s)."
346-
347- relevance = relevance_assessor .assess_relevance (
348- jira_details = jira_details_text ,
349- commit_messages = commit_messages ,
350- diff_text = "\n " .join (changed_files_map .values ()),
351- review_summary = review_summary ,
352- llm_config = llm_config
353- )
354-
355- if relevance :
356- comment_body = (
357- f"🤖 **AI Assessment Complete for this PR**\n \n "
358- f"/!\\ The code changes have a **{ relevance .score } %** relevance score to this task.\n \n "
359- f"**Justification:** { relevance .justification } "
360- )
361- jira_client .add_comment (task_id , comment_body )
362-
363341
364342 if not all_issues :
365343 logging .info ("🎉 Great job! No issues found." )
@@ -370,4 +348,55 @@ def main():
370348 app ()
371349
372350if __name__ == "__main__" :
373- main ()
351+ main ()
352+
353+ @app .command ()
354+ def assess (
355+ repo_path : Annotated [str , typer .Option ()] = "." ,
356+ base_ref : Annotated [str , typer .Option ()] = "HEAD~1" ,
357+ head_ref : Annotated [str , typer .Option ()] = "HEAD" ,
358+ ):
359+ """Finds the Jira task and posts a relevance assessment comment."""
360+ setup_logging (trace_mode = False )
361+ load_dotenv (override = True )
362+
363+ if not os .getenv ("JIRA_URL" ):
364+ logging .info ("Jira integration is not configured. Skipping assessment." )
365+ raise typer .Exit ()
366+
367+ logging .info ("🔍 Gathering data for Jira assessment..." )
368+ commit_messages = git_utils .get_commit_messages (repo_path , base_ref , head_ref )
369+ diff_text = git_utils .get_diff (repo_path , base_ref , head_ref )
370+
371+ task_id = _get_task_id_from_git_info (commit_messages )
372+
373+ if task_id :
374+ task_details = jira_client .get_task_details (task_id )
375+ if task_details :
376+ jira_details_text = (
377+ f"**--- JIRA TASK CONTEXT ({ task_id } ) ---**\n "
378+ f"**Title:** { task_details .get ('summary' , 'N/A' )} \n "
379+ f"**Description:**\n { task_details .get ('description' , 'N/A' )} \n "
380+ f"**---------------------------------**\n \n "
381+ )
382+ logging .info (f"✅ Successfully fetched context from Jira task { task_id } ." )
383+ else :
384+ logging .warning (f"Found Jira task ID '{ task_id } ', but could not fetch its details." )
385+
386+ logging .info ("\n --- Assessing Task Relevance ---" )
387+
388+ relevance = relevance_assessor .assess_relevance (
389+ jira_details = jira_details_text ,
390+ commit_messages = commit_messages ,
391+ diff_text = diff_text ,
392+ review_summary = "Code has been merged." ,
393+ llm_config = load_config (repo_path ).get ('llm' , {})
394+ )
395+
396+ if relevance :
397+ comment_body = (
398+ f"🤖 **AI Assessment Complete for this PR**\n \n "
399+ f"/!\\ The code changes have a **{ relevance .score } %** relevance score to this task.\n \n "
400+ f"**Justification:** { relevance .justification } "
401+ )
402+ jira_client .add_comment (task_id , comment_body )
0 commit comments