Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions -MechanicalMind-Dependency-AI-v3.0-
Submodule -MechanicalMind-Dependency-AI-v3.0- added at 263c8c
Binary file added .coverage
Binary file not shown.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Run tests
run: |
pytest --cov=ai_core --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v4
Comment thread Dismissed
8 changes: 4 additions & 4 deletions .github/workflows/dependency_ai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ jobs:
strategy:
matrix:
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Run Dependency Analyzer
run: |
python -m ai_core.dependency_analyzer --repo $GITHUB_REPOSITORY
python -m ai_core.error_diagnosis_engine --log-path ./logs/

- name: Upload Results
uses: actions/upload-artifact@v3
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Dependency Scan

on:
push:
branches:
- main
branches: main
pull_request:

jobs:
jobs: read
scan:
runs-on: ubuntu-latest
steps:
jobs: witer
- name: Checkout Code
uses: actions/checkout@v3

- name: Dependency Scan
uses: mechmind/ai-dependency-action@v3
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/django.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
with:
python-version: '3.10'
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Debug - List Files
run: ls -la

- name: Run tests
run: |
python manage.py test
51 changes: 20 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
-- name:
uses: actions/download-artifact@v4.2.1
with:
pattern: 'report-*.json'
path: ./custom_reports/
merge-multiple: true
github-token: ${{ secrets.CI_CD_TOKEN }}
repository: mechmind-dwv/-MechanicalMind-Dependency-AI-v2.0-
run-id: ${{ github.event.workflow_run.id }}
on:
workflow_run:
workflows: ["Dependency Analysis"]
types:
- completed

jobs:
build:
runs-on: ubuntu-latest
name: CI Pipeline

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Upload artifact
uses: actions/upload-artifact@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
name: dependency-report
path: ./reports/
env:
GITHUB_TOKEN: ${{ secrets.GH_ARTIFACT_ACCESS_TOKEN }}
- name: Process Artifacts
python-version: '3.10'
- name: Install dependencies
run: |
echo "Processing downloaded artifacts..."
python ai_core/artifact_processor.py \
--input "${{ runner.temp }}/artifacts" \
--output ./reports/
[![.github/workflows/main.yml](https://github.com/mechmind-dwv/-MechanicalMind-Dependency-AI-v2.0-/actions/workflows/main.yml/badge.svg)](https://github.com/mechmind-dwv/-MechanicalMind-Dependency-AI-v2.0-/actions/workflows/main.yml)
python -m pip install --upgrade pip
pip install -e .
- name: Run tests
run: |
python -m pytest
Comment thread Dismissed
12 changes: 6 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,36 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt

- name: Run linting
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
black --check --diff .

- name: Run tests
run: |
pytest --cov=./ --cov-report=xml

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push]

jobs:
check-version:
runs-on:
runs-on:
group: ubuntu-runners
labels: ubuntu-20.04-16core
steps:
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ __pycache__/
*.egg-info/
venv/
*.log

# Archivos temporales
filtered_reqs.txt

# Entornos virtual
.venv/
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MechanicalMind Dependency AI v3.0

![MechMind Logo](https://via.placeholder.com/150x50?text=MechMind+AI)
![MechMind Logo](https://via.placeholder.com/150x50?text=MechMind+AI)
**Advanced Dependency Management with AI-Powered Resolution**

## 🚀 Key Features
Expand Down
46 changes: 23 additions & 23 deletions ai_core/auto_fix_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
from typing import Dict, List
from pathlib import Path


class DependencyAutoFixer:
def __init__(self, virtualenv_path: str = None):
self.virtualenv_path = Path(virtualenv_path) if virtualenv_path else None
self.fix_strategies = {
"VERSION_NOT_FOUND": self._fix_version_not_found,
"DISTRIBUTION_NOT_AVAILABLE": self._fix_distribution_unavailable,
"GIT_SSH_AUTH_ERROR": self._fix_git_ssh_error
"GIT_SSH_AUTH_ERROR": self._fix_git_ssh_error,
}

def apply_fix(self, error_type: str, context: Dict) -> Dict:
Expand All @@ -26,75 +27,74 @@ def _fix_version_not_found(self, context: Dict) -> Dict:
"""Handle version not found errors"""
package = context.get("package")
required_version = context.get("required_version")

# Get available versions
available_versions = self._get_available_versions(package)
if not available_versions:
return {"status": "failed", "reason": "No versions available"}

# Find closest compatible version
compatible_version = self._find_compatible_version(
required_version,
available_versions
required_version, available_versions
)

if not compatible_version:
return {"status": "failed", "reason": "No compatible version found"}

# Update requirements
self._update_requirement_file(
context["requirement_file"],
package,
required_version,
compatible_version
context["requirement_file"], package, required_version, compatible_version
)

return {
"status": "success",
"message": f"Updated {package} from {required_version} to {compatible_version}",
"actions": [
f"Modified {context['requirement_file']}",
"Run 'pip install -r requirements.txt' to apply changes"
]
"Run 'pip install -r requirements.txt' to apply changes",
],
}

def _fix_git_ssh_error(self, context: Dict) -> Dict:
"""Convert SSH URLs to HTTPS"""
cmd = [
"git", "config", "--global",
"url.https://github.com/.insteadOf", "git@github.com:"
"git",
"config",
"--global",
"url.https://github.com/.insteadOf",
"git@github.com:",
]
result = subprocess.run(cmd, capture_output=True, text=True)

if result.returncode == 0:
return {
"status": "success",
"message": "Converted Git SSH URLs to HTTPS",
"actions": ["Try installing dependencies again"]
"actions": ["Try installing dependencies again"],
}
else:
return {
"status": "failed",
"reason": result.stderr,
"fallback": "Manually edit .gitconfig"
"fallback": "Manually edit .gitconfig",
}

def _create_clean_environment(self) -> Dict:
"""Create fresh virtual environment"""
venv_path = self.virtualenv_path or Path("mechmind_clean_env")

try:
subprocess.run([sys.executable, "-m", "venv", str(venv_path)], check=True)
return {
"status": "success",
"path": str(venv_path),
"activate_cmd": f"source {venv_path}/bin/activate"
"activate_cmd": f"source {venv_path}/bin/activate",
}
except subprocess.CalledProcessError as e:
return {
"status": "failed",
"reason": str(e),
"suggestion": "Check Python venv module is available"
"suggestion": "Check Python venv module is available",
}

# [...] (Additional fix methods)
# [...] (Additional fix methods)
Loading
Loading