Metadata-Version: 2.4
Name: nastech-modifier
Version: 1.0.0
Summary: AI-powered bot for autonomous code modification, PR management, and continuous improvement
Home-page: https://github.com/nastech-ai/NasModifier-Bot
Author: NasTech
Author-email: NasTech <dev@nastech.ai>
License: MIT
Project-URL: Homepage, https://github.com/nastech-ai/NasModifier-Bot
Project-URL: Documentation, https://github.com/nastech-ai/NasModifier-Bot/wiki
Project-URL: Repository, https://github.com/nastech-ai/NasModifier-Bot
Project-URL: Issues, https://github.com/nastech-ai/NasModifier-Bot/issues
Keywords: ai,agent,automation,code-review,github,telegram,nastech
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: nastech-agent<1,>=0.16.0
Requires-Dist: PyGithub<3,>=2.1.0
Requires-Dist: gidgethub<6,>=5.0.0
Requires-Dist: python-telegram-bot<21,>=20.0
Requires-Dist: pydantic<3,>=2.0.0
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: aiohttp<4,>=3.8.0
Requires-Dist: click<9,>=8.0.0
Requires-Dist: colorama<1,>=0.4.0
Requires-Dist: sqlalchemy<3,>=2.0.0
Requires-Dist: alembic<2,>=1.10.0
Requires-Dist: python-dotenv<1,>=0.19.0
Provides-Extra: dev
Requires-Dist: pytest<8,>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio<1,>=0.20.0; extra == "dev"
Requires-Dist: pytest-cov<5,>=4.0.0; extra == "dev"
Requires-Dist: black<24,>=23.0.0; extra == "dev"
Requires-Dist: isort<6,>=5.11.0; extra == "dev"
Requires-Dist: flake8<6,>=5.0.0; extra == "dev"
Requires-Dist: mypy<2,>=1.0.0; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# NasModifier-Bot

🤖 **AI-powered bot for autonomous code modification, PR management, and continuous improvement**

[![GitHub](https://img.shields.io/badge/GitHub-nastech--ai%2FNasModifier--Bot-blue?logo=github)](https://github.com/nastech-ai/NasModifier-Bot)
[![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
[![Python](https://img.shields.io/badge/Python-3.9%2B-blue)](https://www.python.org)

## Overview

NasModifier-Bot is an autonomous AI agent that automatically:
- 🔍 Scans repositories for issues, security vulnerabilities, and code quality problems
- ✏️ Modifies code and creates pull requests with improvements
- 🤝 Manages PR workflows with GitHub integration
- 📱 Sends notifications and status updates via Telegram
- 🚀 Runs 24/7 for continuous codebase improvement

**Built on**: [NasTech-Agent](https://github.com/nastech-ai/NasTech-Agent) - The self-improving AI agent framework

## Features

### Core Capabilities
- **Autonomous Code Review**: Identifies bugs, security issues, and improvements
- **Automated Patching**: Generates and applies fixes to code
- **GitHub Integration**: Creates PRs, manages issues, handles approvals
- **Telegram Notifications**: Real-time updates and admin controls via Telegram
- **Health Monitoring**: 20-stage pre-flight checks before modifications
- **Governance Rules**: Enforces NasGov framework for safe operations

### Security & Compliance
- ✅ Zero hardcoded credentials (environment variables only)
- ✅ Pre-flight health checks (20 stages)
- ✅ Violation detection (credentials, unsafe code, etc.)
- ✅ Governance enforcement (NasGov framework)
- ✅ Audit logging and activity tracking

## Installation

### Requirements
- Python 3.9+
- Git
- Telegram Bot Token (for notifications)
- GitHub Personal Access Token (for code modifications)

### Quick Start

```bash
# Clone the repository
git clone https://github.com/nastech-ai/NasModifier-Bot.git
cd NasModifier-Bot

# Run the installer
bash install-modifier.sh

# Configure credentials
nano .env

# Start the bot
nasmodifier
```

### Manual Installation

```bash
# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install package
pip install .

# For development
pip install ".[dev]"
```

## Configuration

### Environment Variables (.env)

```env
# Telegram
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_ADMIN_ID=your_user_id_here

# GitHub
GITHUB_TOKEN=your_github_pat_here

# API Keys (optional)
GROQ_API_KEY=your_groq_key_here
OPENROUTER_API_KEY=your_openrouter_key_here
```

### Configuration Files

- **nasgov/**: Governance framework documentation
  - `NASAGENT_GOVERNANCE.md`: Master rules for all agents
  - `NASMODIFIER_COMMAND.md`: NasModifier-Bot specific rules
  - `COMPREHENSIVE_SCAN_REPORT.md`: Security audit findings

## Usage

### Command Line

```bash
# Show help
nasmodifier --help

# Run in production mode
nasmodifier

# Run with verbose logging
nasmodifier --verbose

# Run health checks
nasmodifier --health-check
```

### Telegram Commands

When running, the bot responds to Telegram commands:

```
/start     - Initialize bot
/status    - Get current status
/help      - Show available commands
/scan      - Run full health scan
/pause     - Pause modifications
/resume    - Resume modifications
/logs      - View recent logs
```

## Architecture

```
NasModifier-Bot/
├── nasmodifier/
│   ├── core/              # Core orchestration (state machine, scheduler)
│   ├── github/            # GitHub client and PR workflows
│   ├── skills/            # AI skills (branding, patching, analysis)
│   ├── stages/            # 20 pre-flight check stages
│   ├── telegram/          # Telegram bot integration
│   ├── memory/            # Memory providers and caching
│   ├── configs/           # Configuration templates
│   └── main.py            # Entry point
├── tests/                 # Test suite
├── nasgov/               # Governance framework documentation
├── setup.py              # Package configuration
├── pyproject.toml        # Project metadata
└── install-modifier.sh   # Installation script
```

## Dependencies

### Core
- **nastech-agent** ≥0.16.0 - Parent framework

### GitHub
- **PyGithub** - GitHub API client
- **gidgethub** - Async GitHub client

### Telegram
- **python-telegram-bot** - Telegram bot library

### Data & Processing
- **pydantic** - Data validation
- **pyyaml** - Config file parsing
- **sqlalchemy** - Database ORM
- **alembic** - Database migrations

## Security & Governance

This project follows the **NasGov framework** for AI agent operations:

### Pre-Flight Checks (20 Stages)
1. Branding scan
2. Dependency audit
3. Syntax validation
4. Import checks
5. Config validation
6. Protected paths
7. File permissions
8. Branding enforcement
9. File integrity
10. Test readiness
11. CVE tracking
12. Documentation
13. Git status
14. Patch safety
15. Deployment readiness
16. API health
17. Telegram health
18. GitHub token validity
19. Secrets audit
20. Sync status

### Safety Guarantees
- ✅ No modifications without admin approval
- ✅ All changes require passing health checks
- ✅ Violations trigger immediate halt
- ✅ Audit trail of all operations
- ✅ Hermes-Agent alignment verification

## Licensing & Credits

- **License**: MIT
- **Parent Project**: [NasTech-Agent](https://github.com/nastech-ai/NasTech-Agent)
- **Reference**: [Hermes-Agent](https://github.com/NousResearch/hermes-agent)

## Contributing

This repository is part of the NasTech ecosystem. All contributions must follow the [NasGov governance framework](nasgov/NASAGENT_GOVERNANCE.md).

### Development Setup

```bash
# Install development dependencies
pip install ".[dev]"

# Run tests
pytest tests/ -v

# Code quality
black nasmodifier/ && isort nasmodifier/
flake8 nasmodifier/ && mypy nasmodifier/
```

## Support

- 📖 [Documentation](https://github.com/nastech-ai/NasModifier-Bot/wiki)
- 🐛 [Issues](https://github.com/nastech-ai/NasModifier-Bot/issues)
- 💬 [Discussions](https://github.com/nastech-ai/NasModifier-Bot/discussions)
- 📧 Email: dev@nastech.ai

## Roadmap

- [ ] Web dashboard for monitoring
- [ ] Advanced analytics and metrics
- [ ] Multi-repository management
- [ ] Custom skill development framework
- [ ] Docker deployment templates
- [ ] Kubernetes operator

---

**Built with ❤️ by the NasTech team**
