Skip to content

aevrHQ/devflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

240 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DevFlow - AI-Powered DevOps Platform

Status: βœ… Production Ready | Version: 0.2.0 | Challenge: GitHub Copilot CLI Challenge

DevFlow is a complete SaaS platform + self-hosted CLI agent that orchestrates AI-powered development workflows using the GitHub Copilot SDK.

🎯 What is DevFlow?

Unlike traditional CLI tools, DevFlow enables teams to:

  • 🌐 Use a cloud-based SaaS dashboard for task management
  • πŸ”’ Run a self-hosted agent locally for code privacy
  • πŸ€– Execute complex workflows powered by GitHub Copilot (fix bugs, implement features, explain code, review PRs)
  • πŸ“± Receive real-time notifications via Slack/Telegram
  • πŸ”— Integrate seamlessly with GitHub repositories

πŸš€ Quick Start

Install the CLI

npm install -g @untools/devflow

Initialize

devflow init
# Authenticate with GitHub

Start the Agent

devflow start
# Agent polls for tasks every 5 seconds

Create a Task

Visit the web dashboard and create a task. Watch your agent execute AI workflows!

πŸ“¦ What's Included

1. Pinga Web Platform (SaaS Dashboard)

  • Next.js 14 + MongoDB
  • OAuth authentication
  • Task creation & monitoring
  • Real-time notifications
  • 11 REST API endpoints

2. DevFlow CLI Agent (@untools/devflow)

  • 3 simple commands: init, start, status
  • Task polling every 5 seconds
  • Secure JWT token management
  • Runs locally on your machine

3. Agent-Host (Copilot SDK Engine)

  • Real integration with @github/copilot-sdk
  • 4 AI-powered workflows
  • 7 integrated tools (git, files, tests, GitHub API, etc.)
  • Executes on your machineβ€”code never leaves

πŸ’‘ Workflows

Workflow What It Does
fix-bug Analyzes issue β†’ implements fix β†’ runs tests β†’ creates PR
feature Implements new feature with tests and documentation
explain Generates documentation for code
review-pr Reviews pull requests for best practices

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Web Platform (SaaS Dashboard)  β”‚
β”‚  - Task management              β”‚
β”‚  - Notifications                β”‚
β”‚  - User management              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              ↑ (HTTP/REST)
              β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  CLI Agent (Self-Hosted)        β”‚
β”‚  - Polls for tasks              β”‚
β”‚  - Secure authentication        β”‚
β”‚  - Task execution coordination  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              ↓ (Local HTTP)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Agent-Host (Local)             β”‚
β”‚  - Copilot SDK integration      β”‚
β”‚  - Workflow execution           β”‚
β”‚  - Tool management              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Project Statistics

  • 40,000+ lines of TypeScript
  • 3 independent applications
  • 11 REST API endpoints
  • 4 AI-powered workflows
  • 7 integrated tools
  • 60,000+ words of documentation
  • 0 TypeScript errors (all 3 apps compile)

πŸ“š Documentation

Comprehensive guides available:

πŸ“– Comprehensive Getting Started Guide

1. System Requirements

Before you begin, ensure you have the following installed:

  • Node.js: 18.0.0 or later
  • npm: 9.0.0 or later
  • MongoDB: Local instance or MongoDB Atlas connection
  • Git: For repository cloning
  • Operating System: macOS, Linux, or Windows (WSL2 recommended for Windows)

Check your versions:

node --version    # Should output v18.0.0 or higher
npm --version     # Should output 9.0.0 or higher

2. Initial Setup

Step 1: Clone and Install

# Clone the repository
git clone https://github.com/untools/devflow.git
cd devflow

# Install dependencies for all workspaces
npm install

This installs dependencies for three applications:

  • apps/web - Next.js SaaS dashboard
  • apps/agent-host - Copilot SDK engine
  • apps/agent - CLI agent

Step 2: Environment Configuration

Create .env.local files for each application:

apps/web/.env.local

# Database
MONGODB_URI=mongodb://localhost:27017/devflow

# Authentication
JWT_SECRET=your-super-secret-key-change-this
JWT_EXPIRY=2592000  # 30 days in seconds

# GitHub OAuth (create app at https://github.com/settings/developers)
GITHUB_OAUTH_CLIENT_ID=your-github-app-id
GITHUB_OAUTH_CLIENT_SECRET=your-github-app-secret

# Telegram Integration (optional)
TELEGRAM_BOT_TOKEN=your-bot-token
TELEGRAM_CHAT_ID=your-chat-id

# Slack Integration (optional)
SLACK_WEBHOOK_URL=your-webhook-url

# Agent-Host
AGENT_HOST_URL=http://localhost:3001
DEVFLOW_API_SECRET=test-secret-123

apps/agent-host/.env.local

# GitHub
GITHUB_TOKEN=ghp_your-personal-access-token

# Copilot
COPILOT_API_KEY=your-copilot-key

# Platform Communication
DEVFLOW_API_SECRET=test-secret-123
DEVFLOW_API_URL=http://localhost:3000

# Server
PORT=3001
NODE_ENV=development

apps/agent/.env.local

# Platform
DEVFLOW_PLATFORM_URL=http://localhost:3000

# Agent
AGENT_ID=local-agent-dev
AGENT_NAME=My DevFlow Agent

# Authentication
DEVFLOW_AGENT_TOKEN=your-jwt-token
DEVFLOW_API_SECRET=test-secret-123

Step 3: Database Setup

Option A: Local MongoDB

# Install MongoDB via Homebrew (macOS)
brew tap mongodb/brew
brew install mongodb-community

# Start MongoDB
brew services start mongodb-community

# Verify it's running
mongo --eval "db.version()"

Option B: MongoDB Atlas (Cloud)

  1. Create account at https://www.mongodb.com/cloud/atlas
  2. Create a cluster and get connection string
  3. Update MONGODB_URI in apps/web/.env.local

3. Running Services Locally

DevFlow consists of 3 independent services. Run each in a separate terminal:

Terminal 1: Web Platform (Next.js)

npm run dev --workspace=apps/web
# Runs on http://localhost:3000
# Dashboard for task management and monitoring

Terminal 2: Agent-Host (Copilot Engine)

npm run dev --workspace=apps/agent-host
# Runs on http://localhost:3001
# Real-time workflow execution engine

Terminal 3: CLI Agent

npm run dev --workspace=apps/agent -- cli start
# Polls platform every 5 seconds for tasks
# Executes tasks via Agent-Host

Once all three are running, you should see:

  • Web Platform: "βœ“ Next.js ready in Xms"
  • Agent-Host: "Server running on port 3001"
  • CLI Agent: "βœ“ Connected successfully" and "Waiting for tasks..."

4. Your First Workflow

Option A: Web Dashboard (Easiest)

  1. Open the dashboard

    http://localhost:3000
    
  2. Authenticate

    • Click "Sign In"
    • GitHub OAuth flow
    • Complete authentication
  3. Create an Agent

    • Dashboard β†’ Agents β†’ Register
    • Name: "local-dev"
    • Save the Agent ID
  4. Create Your First Task

    • Click "Create Task"
    • Select Intent: explain
    • Paste this code:
    function fibonacci(n) {
      if (n <= 1) return n;
      return fibonacci(n - 1) + fibonacci(n - 2);
    }
    • Click "Execute"
  5. Watch the Agent Work

    • Monitor in CLI agent terminal
    • See progress updates in real-time
    • View generated documentation

Option B: Direct CLI Usage

# 1. Initialize the agent
devflow init
# Follow prompts for platform URL and authentication

# 2. Start polling for tasks
devflow start

# 3. In another terminal, create a task via API
curl -X POST http://localhost:3000/api/tasks \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "local-agent-dev",
    "intent": "explain",
    "description": "Explain the fibonacci function",
    "payload": {
      "code": "function fib(n) { if (n <= 1) return n; return fib(n-1) + fib(n-2); }"
    }
  }'

5. Common Workflows

Fix a Bug

  1. Identify the issue:

    • Repository: owner/repo
    • Issue description: "Fix authentication error on login"
  2. Create task:

    devflow task create \
      --intent fix-bug \
      --repo owner/repo \
      --description "Fix authentication error on login"
  3. Agent executes:

    • Clones repository
    • Analyzes issue
    • Implements fix
    • Runs tests
    • Creates pull request

Implement a Feature

  1. Plan the feature:

    • Specification: "Add dark mode toggle"
  2. Create task:

    devflow task create \
      --intent feature \
      --repo owner/repo \
      --description "Implement dark mode with persistent storage"
  3. Agent builds:

    • Analyzes codebase
    • Plans architecture
    • Writes implementation
    • Adds tests
    • Creates documentation
    • Opens PR

Explain Code

devflow task create \
  --intent explain \
  --description "Explain how the auth middleware works" \
  --code-path src/middleware/auth.ts

Review Pull Request

devflow task create \
  --intent review-pr \
  --repo owner/repo \
  --pr-number 42 \
  --description "Review for security and performance"

6. Troubleshooting Common Issues

Issue: "Cannot connect to MongoDB"

# Verify MongoDB is running
ps aux | grep mongod

# Start MongoDB if not running
brew services start mongodb-community

Issue: "Agent won't start - ECONNREFUSED"

# Ensure all 3 services are running
curl http://localhost:3000/health  # Web platform
curl http://localhost:3001/health  # Agent-Host

# If not responding, restart the service

Issue: "Authentication failed - Invalid token"

# Re-initialize with fresh credentials
devflow init

# Or manually update token in config
cat ~/.devflow/config.json  # View config

Issue: "Tasks not completing"

# Check service logs for errors
# View CLI Agent terminal for error messages

# Verify all services have proper environment variables
env | grep DEVFLOW

# Check network connectivity
curl -I http://localhost:3000
curl -I http://localhost:3001

7. Development Tips

Live Reload: All services support hot-reload during development.

Debugging: View detailed logs:

# In CLI agent terminal
devflow start --log-level debug

# Check web platform logs
npm run dev --workspace=apps/web -- --debug

Testing Your Changes:

# Run linter across all apps
npm run lint

# Run tests if available
npm test

# Build all applications
npm run build

Database Reset:

# Connect to MongoDB and drop database
mongo
> use devflow
> db.dropDatabase()
> exit

8. Next Steps

Once you're familiar with the basics:

  1. Connect to Real GitHub

    • Register your GitHub App
    • Deploy to production server
    • Monitor real workflow executions
  2. Set Up Notifications

    • Configure Telegram integration
    • Set up Slack webhooks
    • Real-time updates to your chat
  3. Advanced Configuration

    • Custom workflows
    • Extended tool integration
    • Performance optimization
  4. Production Deployment

πŸ›  Development Setup

Prerequisites

  • Node.js 18+
  • MongoDB (local or Atlas)
  • GitHub account

Installation

# Clone repository
git clone https://github.com/untools/devflow.git
cd devflow

# Install dependencies
npm install

# Start services (3 terminals)
# Terminal 1: Web Platform
npm run dev --workspace=apps/web
# http://localhost:3000

# Terminal 2: Agent-Host
npm run dev --workspace=apps/agent-host
# http://localhost:3001

# Terminal 3: CLI Agent
npm run dev --workspace=apps/agent -- cli start

Environment Variables

# apps/web/.env.local
MONGODB_URI=mongodb://localhost:27017/devflow
JWT_SECRET=<random-secret>
GITHUB_OAUTH_CLIENT_ID=<your-github-app-id>
GITHUB_OAUTH_CLIENT_SECRET=<your-github-app-secret>

πŸ” Security

  • βœ… OAuth 2.0 authentication
  • βœ… JWT tokens (30-day expiry)
  • βœ… Secure config storage (mode 0o600)
  • βœ… Local code execution (code never uploaded)
  • βœ… Bearer token authentication on all APIs

πŸ“¦ Applications

apps/web

Next.js 14 SaaS platform with MongoDB

  • User authentication
  • Agent management
  • Task creation & monitoring
  • Real-time notifications

apps/agent

npm package @untools/devflow

  • CLI: devflow init, devflow start, devflow status
  • Task polling from platform
  • Secure configuration management

apps/agent-host

Express.js server with Copilot SDK

  • Real @github/copilot-sdk integration
  • Workflow execution engine
  • Tool definitions and execution

πŸš€ Publishing

Ready to publish to npm:

cd apps/agent
npm publish --access public

Users can then install globally:

npm install -g @untools/devflow

πŸ“‹ Checklist

  • βœ… Built with GitHub Copilot SDK
  • βœ… Complete CLI tool
  • βœ… Innovative two-tier architecture
  • βœ… Production-ready code (40,000+ LOC)
  • βœ… Comprehensive documentation (60,000+ words)
  • βœ… All 3 apps compile (0 errors)
  • βœ… Ready for GitHub Copilot CLI Challenge

πŸ“„ License

MIT

πŸ”— Links


Built with ❀️ for the GitHub Copilot CLI Challenge

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •