[docs]asyncdefget_git_version_info(context=None):"""Get git commit hash and date of last commit. Returns a dictionary with commit hash and date, or None if not in a git repo. Example: { "get_git_version_info": {} } """try:# Get the current working directory or use a default pathrepo_path=os.getcwd()if'/files/mindroot'inrepo_pathorrepo_path.endswith('mindroot'):# We're likely in the right placepasselse:# Try to find mindroot directoryifos.path.exists('/files/mindroot'):repo_path='/files/mindroot'else:returnNone# Get commit hashresult=subprocess.run(['git','rev-parse','HEAD'],cwd=repo_path,capture_output=True,text=True,timeout=10)ifresult.returncode!=0:returnNonecommit_hash=result.stdout.strip()# Get commit dateresult=subprocess.run(['git','log','-1','--format=%ci'],cwd=repo_path,capture_output=True,text=True,timeout=10)ifresult.returncode!=0:returnNonecommit_date=result.stdout.strip()return{'commit_hash':commit_hash,'commit_date':commit_date,'retrieved_at':datetime.now().isoformat()}exceptExceptionase:returnNone