npm package: @gayanpathirana/autopilot-ai-cicd
Description: AI-driven CI/CD pipeline automation for GitHub projects using Claude-Flow and SPARC methodology
Author: Autopilot Team
Latest version: 0.1.0

# @autopilot/ai-cicd

🚀 **AI-driven CI/CD pipeline automation for GitHub projects**

Transform your GitHub repository into an AI-powered development environment that automatically implements features from issues using Claude AI and the SPARC methodology.

## Features

- 🤖 **Automated Development**: AI processes GitHub issues labeled "ready-for-dev"
- 🔄 **Complete CI/CD Pipeline**: From issue to pull request automatically
- 🧪 **Test-Driven Development**: Built with TDD principles using SPARC methodology
- 🔐 **Secure by Design**: Enterprise-grade secrets management
- 📊 **Supabase Integration**: Persistent memory and real-time monitoring
- 🎯 **GitHub Actions Native**: Seamless integration with your workflows

## Quick Start

### 1. Install the Package

```bash
npm install -g @autopilot/ai-cicd
```

### 2. Interactive Setup

Run the setup wizard in your project directory:

```bash
autopilot-setup
```

This will:
- Create configuration files
- Set up GitHub Actions workflows
- Generate environment templates
- Configure project structure

### 3. Configure Secrets

Add these secrets to your GitHub repository:

- `ANTHROPIC_API_KEY` - Your Claude API key
- `SUPABASE_URL` - Your Supabase project URL (optional)
- `SUPABASE_KEY` - Your Supabase anon key (optional)

### 4. Start Using

Label any issue with `ready-for-dev` and watch the AI:
1. Create a feature branch
2. Implement the solution
3. Run tests
4. Create a pull request
5. Assign reviewers

## CLI Commands

### Initialize Project
```bash
autopilot init --repo owner/repo
```

### Run Development
```bash
autopilot run --issue 123
```

### Check Status
```bash
autopilot status --issue 123
```

## Configuration

Edit `autopilot.config.json`:

```json
{
  "version": "1.0.0",
  "github": {
    "owner": "your-org",
    "repo": "your-repo",
    "defaultBranch": "main",
    "autoAssignReviewers": true
  },
  "autopilot": {
    "enabled": true,
    "runnerType": "ubuntu-latest",
    "containerSupport": false,
    "memoryBackend": "supabase"
  },
  "security": {
    "enableSecurityScanning": true,
    "enableDependencyCheck": true
  }
}
```

## GitHub Actions Workflow

The package automatically creates workflows in `.github/workflows/`:

```yaml
name: Autopilot AI Development
on:
  issues:
    types: [labeled]
    
jobs:
  ai-development:
    if: github.event.label.name == 'ready-for-dev'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npx @autopilot/ai-cicd run --issue ${{ github.event.issue.number }}
```

## Advanced Features

### Self-Hosted Runners
```bash
autopilot init --runner-type self-hosted --container autopilot/claude-flow:latest
```

### Custom Workflows
```javascript
const { WorkflowGenerator } = require('@autopilot/ai-cicd');

const generator = new WorkflowGenerator();
const workflow = generator.generateSecureWorkflow({
  enableSecurityScanning: true,
  enableSAST: true,
  enableDependencyCheck: true
});
```

### Programmatic Usage
```javascript
const { AutopilotCLI, GitHubIntegration } = require('@autopilot/ai-cicd');

const cli = new AutopilotCLI();
await cli.init({
  projectPath: './my-project',
  githubRepo: 'owner/repo',
  interactive: false
});
```

## Architecture

```
@autopilot/ai-cicd
├── CLI Tools           # Command-line interface
├── GitHub Integration  # API operations
├── Workflow Generator  # GitHub Actions templates
├── Project Scaffolder  # Setup automation
└── MCP Servers        # AI tool access (coming soon)
```

## Security

- 🔒 All API keys stored as GitHub secrets
- 🛡️ Optional security scanning in workflows
- 🔐 Encrypted memory storage with Supabase
- ✅ Human review required for all AI PRs

## Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md).

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Support

- 📚 [Documentation](https://github.com/autopilot/ai-cicd/docs)
- 🐛 [Issue Tracker](https://github.com/autopilot/ai-cicd/issues)
- 💬 [Discussions](https://github.com/autopilot/ai-cicd/discussions)

---

Built with ❤️ using Claude AI and the SPARC methodology