diff --git a/.github/workflows/community-chatbot-backend.yml b/.github/workflows/community-chatbot-backend.yml deleted file mode 100644 index 281709b4..00000000 --- a/.github/workflows/community-chatbot-backend.yml +++ /dev/null @@ -1,36 +0,0 @@ -# .github/workflows/backend.yml -name: Backend CI - -on: - push: - paths: - - 'community-chatbot/scripts/**' - - 'community-chatbot/requirements.txt' - pull_request: - paths: - - 'community-chatbot/scripts/**' - - 'community-chatbot/requirements.txt' - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - - name: Install dependencies - run: | - cd community-chatbot - python -m pip install --upgrade pip - pip install -r requirements.txt - - - name: Run backend script - run: | - cd community-chatbot/scripts - bash run_backend.sh || echo "No backend service started" diff --git a/.github/workflows/community-chatbot-frontend.yml b/.github/workflows/community-chatbot-frontend.yml deleted file mode 100644 index dc4c0c47..00000000 --- a/.github/workflows/community-chatbot-frontend.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Community Chatbot Frontend CI - -on: - push: - paths: - - 'community-chatbot/**' - pull_request: - paths: - - 'community-chatbot/**' - -jobs: - frontend-build-and-test: - runs-on: ubuntu-latest - defaults: - run: - working-directory: community-chatbot - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: 18 - - - name: Install pnpm - run: npm install -g pnpm - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Create .env.local from secrets - run: | - echo "NEXT_PUBLIC_FIREBASE_API_KEY=${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}" >> .env.local - echo "NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}" >> .env.local - echo "NEXT_PUBLIC_FIREBASE_PROJECT_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}" >> .env.local - echo "NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}" >> .env.local - echo "NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}" >> .env.local - echo "NEXT_PUBLIC_FIREBASE_APP_ID=${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}" >> .env.local - - - name: Run tests - run: pnpm test - - - name: Build frontend - run: pnpm run build \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7b12f1a7..ec86ba77 100644 Binary files a/.gitignore and b/.gitignore differ diff --git a/MCP_Enhancement/agent_start.py b/MCP_Enhancement/agent_start.py new file mode 100644 index 00000000..b7695f89 --- /dev/null +++ b/MCP_Enhancement/agent_start.py @@ -0,0 +1,127 @@ +from fastmcp import FastMCP +import os +from dotenv import load_dotenv +from atlassian import Jira +from github import Github + +# Initialize FastMCP Server +mcp = FastMCP("Mifos Knowledge Librarian") + +# Load credentials +load_dotenv() + +# Initialize clients +jira_client = Jira( + url=os.environ["JIRA_INSTANCE_URL"], + username=os.environ["JIRA_USERNAME"], + password=os.environ["JIRA_API_TOKEN"] +) +github_client = Github(os.environ["GITHUB_TOKEN"]) + +@mcp.tool() +def search_jira_tickets(query: str): + """ + Search for Jira tickets using JQL. + Used for tracking feature progress and identifying developer consensus. + """ + try: + issues = jira_client.jql(query, limit=5) + results = [] + for issue_data in issues['issues']: + # The jql result gives us the key and summary, let's get comments + comments_data = jira_client.get_issue_comments(issue_data['key']) + comments = [ + f"{c['author']['displayName']}: {c['body']}" + for c in comments_data['comments'][-3:] + ] + results.append({ + "key": issue_data['key'], + "summary": issue_data['fields']['summary'], + "comments": comments, + }) + return results + except Exception as e: + return f"Error searching Jira: {e}" + +@mcp.tool() +def get_github_pr_details(pr_number: int, repo_name: str): + """ + Fetch description and changed files from a specific GitHub Pull Request. + Used for synthesizing release notes. + """ + try: + repo = github_client.get_repo(repo_name) + pr = repo.get_pull(pr_number) + files = [f.filename for f in pr.get_files()] + return { + "title": pr.title, + "description": pr.body, + "changed_files": files, + } + except Exception as e: + return f"Error fetching GitHub PR: {e}" + +@mcp.tool() +def generate_knowledge_summary(jira_key: str, repo_name: str = "apache/fineract"): + """ + Takes a Jira Key, searches for a corresponding GitHub PR in a specified repo, + and returns a combined summary of the ticket and the PR. + Defaults to the 'apache/fineract' repository. + """ + try: + # 1. Get Jira ticket info + jira_info_list = search_jira_tickets(f'key = {jira_key}') + if not jira_info_list or isinstance(jira_info_list, str): + return f"Could not retrieve Jira ticket {jira_key}." + jira_info = jira_info_list[0] + + # 2. Find corresponding GitHub PR + query = f'repo:{repo_name} is:pr "{jira_key}"' + prs = github_client.search_issues(query) + if prs.totalCount == 0: + return { + "jira_summary": jira_info['summary'], + "jira_comments": jira_info['comments'], + "github_pr": "No corresponding GitHub PR found." + } + + # 3. Get PR details from the first match + pr_number = prs[0].number + pr_details = get_github_pr_details(pr_number, repo_name) + + # 4. Combine and return + return { + "jira_key": jira_key, + "jira_summary": jira_info['summary'], + "jira_comments": jira_info['comments'], + "github_pr_title": pr_details.get('title'), + "github_pr_description": pr_details.get('description'), + "github_pr_changed_files": pr_details.get('changed_files'), + } + except Exception as e: + return f"Error generating knowledge summary: {e}" + +@mcp.tool() +def search_project_docs(query: str): + """ + Search through static Mifos documentation and READMEs. + Use this for architectural questions or project setup guides. + """ + # Simple implementation: search for keywords in .md files + docs_path = "./docs" # Or root if docs/ doesn't exist + results = [] + if not os.path.exists(docs_path): + docs_path = "." # Fallback to root + + for root, dirs, files in os.walk(docs_path): + for file in files: + if file.endswith(".md"): + with open(os.path.join(root, file), 'r', encoding='utf-8') as f: + content = f.read() + if query.lower() in content.lower(): + results.append(f"--- {file} ---\n{content[:500]}...") + + return "\n".join(results) if results else "No matching documentation found." + +if __name__ == "__main__": + mcp.run() \ No newline at end of file diff --git a/MCP_Enhancement/src/__init__.py b/MCP_Enhancement/src/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/Repo Clone Automation/repo_cloner.py b/Repo Clone Automation/repo_cloner.py index 5511c437..61165b6d 100644 --- a/Repo Clone Automation/repo_cloner.py +++ b/Repo Clone Automation/repo_cloner.py @@ -2,68 +2,75 @@ import time import zipfile from selenium import webdriver -from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC -# Set your download directory (absolute path) -download_dir = os.path.abspath("downloads") -if not os.path.exists(download_dir): - os.makedirs(download_dir) +def clone_repository(repo_url, download_dir): + """ + Clones a GitHub repository by downloading it as a ZIP file and extracting it. + """ + # Set your download directory (absolute path) + if not os.path.exists(download_dir): + os.makedirs(download_dir) -chrome_options = webdriver.ChromeOptions() -prefs = { - "download.default_directory": download_dir, - "download.prompt_for_download": False, - "download.directory_upgrade": True, - "safebrowsing.enabled": True -} -chrome_options.add_experimental_option("prefs", prefs) + chrome_options = webdriver.ChromeOptions() + prefs = { + "download.default_directory": download_dir, + "download.prompt_for_download": False, + "download.directory_upgrade": True, + "safebrowsing.enabled": True + } + chrome_options.add_experimental_option("prefs", prefs) -# Initialize the Chrome driver (ensure chromedriver is in your PATH) -driver = webdriver.Chrome(options=chrome_options) + # Initialize the Chrome driver (ensure chromedriver is in your PATH) + driver = webdriver.Chrome(options=chrome_options) -try: - # Navigate to the GitHub repository page - repo_url = "https://github.com/openMF/mifos-gazelle?tab=readme-ov-file" # add ur repos, if needed i will write a function take multiple repo input to extract effectively - driver.get(repo_url) - - # Wait until the "Code" button is clickable and click it.But here (//span[contains(text(), 'Code')]) isnt a unique locator so i have to use below provided one, this has tendency to change if github updates their frontend - wait = WebDriverWait(driver, 10) - code_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[@data-variant='primary']//span[contains(@class, 'prc-Button-Label-pTQ')]"))) - code_button.click() - - # this is the download zip locator which is unique - download_zip = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[contains(text(), 'Download ZIP')]"))) - download_zip.click() - - # Wait for the ZIP file to appear in the download folder (timeout after 60 seconds) - zip_filename = None - timeout = 60 # seconds - start_time = time.time() - while time.time() - start_time < timeout: - for filename in os.listdir(download_dir): - if filename.endswith(".zip"): - zip_filename = filename + try: + # Navigate to the GitHub repository page + driver.get(repo_url) + + # Wait until the "Code" button is clickable and click it + wait = WebDriverWait(driver, 10) + code_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[@data-variant='primary']//span[contains(@class, 'prc-Button-Label-pTQ')]"))) + code_button.click() + + # this is the download zip locator which is unique + download_zip = wait.until(EC.element_to_be_clickable((By.XPATH, "//span[contains(text(), 'Download ZIP')]"))) + download_zip.click() + + # Wait for the ZIP file to appear in the download folder + zip_filename = None + timeout = 60 # seconds + start_time = time.time() + while time.time() - start_time < timeout: + for filename in os.listdir(download_dir): + if filename.endswith(".zip"): + zip_filename = filename + break + if zip_filename: break - if zip_filename: - break - time.sleep(1) - - if not zip_filename: - print("Download timed out or ZIP file not found.") - else: - zip_path = os.path.join(download_dir, zip_filename) - print(f"Downloaded file: {zip_path}") + time.sleep(1) - # Unzip the downloaded archive into a subfolder called "extracted" - extract_dir = os.path.join(download_dir, "extracted") - if not os.path.exists(extract_dir): - os.makedirs(extract_dir) - with zipfile.ZipFile(zip_path, 'r') as zip_ref: - zip_ref.extractall(extract_dir) - print(f"Extracted ZIP contents to: {extract_dir}") + if not zip_filename: + print("Download timed out or ZIP file not found.") + else: + zip_path = os.path.join(download_dir, zip_filename) + print(f"Downloaded file: {zip_path}") + + # Unzip the downloaded archive into a subfolder called "extracted" + extract_dir = os.path.join(download_dir, "extracted") + if not os.path.exists(extract_dir): + os.makedirs(extract_dir) + with zipfile.ZipFile(zip_path, 'r') as zip_ref: + zip_ref.extractall(extract_dir) + print(f"Extracted ZIP contents to: {extract_dir}") + + finally: + driver.quit() -finally: - driver.quit() +if __name__ == "__main__": + # Original hardcoded values + repo_to_clone = "https://github.com/openMF/mifos-gazelle?tab=readme-ov-file" + download_destination = os.path.abspath("downloads") + clone_repository(repo_to_clone, download_destination) \ No newline at end of file diff --git a/Slack_scraper_bot/scripts/pii_remocval.py b/Slack_scraper_bot/scripts/pii_remocval.py index ce0083e4..e509813e 100644 --- a/Slack_scraper_bot/scripts/pii_remocval.py +++ b/Slack_scraper_bot/scripts/pii_remocval.py @@ -1,7 +1,7 @@ -import scrubadub -import scrubadub_spacy import re import sys +import scrubadub +import scrubadub_spacy def create_scrubber(): scrubber = scrubadub.Scrubber() @@ -19,7 +19,7 @@ def remove_user_tags(text): return re.sub(timestamp_user_pattern, lambda m: m.group(0).split('] User:')[0] + ']', text) def remove_name_lines(text): - name_pattern = r'^.*(?:my name is|I am|I\'m)\s+(?:{{NAME}}|[A-Z][a-z]+(?:\s+[A-Z][a-z]+)*).*$\n?' + name_pattern = r'^.*(?:my name is|I am|I\'m).*\n' return re.sub(name_pattern, '', text, flags=re.MULTILINE | re.IGNORECASE) def process_file(input_path, output_path): diff --git a/Voice-Driven_banking-Lam/Backend/__pycache__/main.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/__pycache__/main.cpython-311.pyc deleted file mode 100644 index e0f84447..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/__pycache__/main.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/__pycache__/main.cpython-313.pyc b/Voice-Driven_banking-Lam/Backend/__pycache__/main.cpython-313.pyc deleted file mode 100644 index 013ae079..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/__pycache__/main.cpython-313.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/models/__pycache__/api_models.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/models/__pycache__/api_models.cpython-311.pyc deleted file mode 100644 index 96bed3f7..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/models/__pycache__/api_models.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/models/__pycache__/audio_models.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/models/__pycache__/audio_models.cpython-311.pyc deleted file mode 100644 index 741b804b..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/models/__pycache__/audio_models.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/models/__pycache__/banking_models.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/models/__pycache__/banking_models.cpython-311.pyc deleted file mode 100644 index 5fc9a30b..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/models/__pycache__/banking_models.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/eamil_services.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/eamil_services.cpython-311.pyc deleted file mode 100644 index 7cd451fa..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/eamil_services.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/email_service.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/email_service.cpython-311.pyc deleted file mode 100644 index 2e90e931..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/email_service.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-311.pyc deleted file mode 100644 index c8dee6dd..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-313.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-313.pyc deleted file mode 100644 index cdd0c483..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-313.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-37.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-37.pyc deleted file mode 100644 index e10af5f0..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_db.cpython-37.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_session.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_session.cpython-311.pyc deleted file mode 100644 index ca03e224..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/firestore_session.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/intent_nlu.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/intent_nlu.cpython-311.pyc deleted file mode 100644 index 63652ee1..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/intent_nlu.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_gemini.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_gemini.cpython-311.pyc deleted file mode 100644 index 40e6a88e..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_gemini.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_gemini.cpython-313.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_gemini.cpython-313.pyc deleted file mode 100644 index 1b6078ed..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_gemini.cpython-313.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_local_hf.cpython-313.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_local_hf.cpython-313.pyc deleted file mode 100644 index 628a8ec4..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/llm_local_hf.cpython-313.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/stt_whisper.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/stt_whisper.cpython-311.pyc deleted file mode 100644 index 9012f432..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/stt_whisper.cpython-311.pyc and /dev/null differ diff --git a/Voice-Driven_banking-Lam/Backend/services/__pycache__/tts_hf.cpython-311.pyc b/Voice-Driven_banking-Lam/Backend/services/__pycache__/tts_hf.cpython-311.pyc deleted file mode 100644 index 0146cd8e..00000000 Binary files a/Voice-Driven_banking-Lam/Backend/services/__pycache__/tts_hf.cpython-311.pyc and /dev/null differ