miyabi-agent-workflow 0.1.2

Miyabi Workflow Agents - PR, Issue, and Deployment automation
docs.rs failed to build miyabi-agent-workflow-0.1.2
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

miyabi-agent-workflow

GitHub workflow automation agents: PR creation, Issue analysis, and Deployment for the Miyabi framework.

Crates.io Documentation License

πŸ“‹ Overview

miyabi-agent-workflow provides three specialized agents for automating GitHub-based development workflows:

  • PRAgent (まとめるん): Automatic Pull Request creation with Conventional Commits
  • IssueAgent (み぀けるん): Issue analysis, classification, and label inference
  • DeploymentAgent (はこぢん): CI/CD automation with build, test, deploy, and rollback

Key Capabilities:

  • πŸ“ Conventional Commits: Auto-generates PR titles following feat(scope): description format
  • 🏷️ Smart Labeling: Infers appropriate labels from Miyabi's 57-label system
  • πŸ€– Agent Assignment: Automatically assigns tasks to the right agent (Coordinator, CodeGen, etc.)
  • πŸš€ CI/CD Pipeline: End-to-end deployment from build to health check
  • πŸ”„ Auto-Rollback: Automatic rollback on deployment failure
  • πŸ“Š Impact Assessment: Evaluates issue severity and business impact

πŸš€ Features

PRAgent (まとめるん)

  • Conventional Commits Compliance: Generates feat, fix, refactor, docs, test, ci prefixes
  • Scope Detection: Extracts scope from title (e.g., "Auth: login bug" β†’ fix(auth): login bug)
  • PR Body Generation: Includes overview, changes, test results, checklist, and related issues
  • Label Assignment: Automatically applies labels based on task type and priority
  • Reviewer Assignment: Assigns appropriate reviewers based on code owners

IssueAgent (み぀けるん)

  • Type Inference: Detects Feature, Bug, Refactor, Docs, Test, or Deployment
  • Severity Assessment: Evaluates Critical, High, Medium, or Low severity
  • Impact Evaluation: Determines System, User, or Cosmetic impact level
  • Agent Routing: Assigns to Coordinator, CodeGen, Review, PR, or Deployment agents
  • Duration Estimation: Predicts task completion time (e.g., Feature: 60 min, Bug: 30 min)
  • Dependency Extraction: Parses dependencies from issue body (e.g., Depends on #123)
  • Label Generation: Selects from 57-label system across 11 categories

DeploymentAgent (はこぢん)

  • Build Execution: Runs cargo build --release with error handling
  • Test Execution: Runs cargo test --all with pass/fail tracking
  • Environment Support: Staging (auto-deploy) and Production (approval-required)
  • Health Checks: Validates deployment success with HTTP health checks
  • Auto-Rollback: Reverts to previous version on failure
  • Deployment Status: Tracks Pending β†’ Building β†’ Testing β†’ Deploying β†’ HealthChecking β†’ Success

πŸ“¦ Installation

Add to your Cargo.toml:

[dependencies]
miyabi-agent-workflow = "0.1.0"

Or install the CLI:

cargo install miyabi-cli

πŸ”§ Usage

PRAgent Example

use miyabi_agent_workflow::PRAgent;
use miyabi_agent_core::BaseAgent;
use miyabi_types::{AgentConfig, Task, TaskType};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = AgentConfig {
        github_token: std::env::var("GITHUB_TOKEN")?,
        repo_owner: Some("your-org".to_string()),
        repo_name: Some("your-repo".to_string()),
        ..Default::default()
    };

    let pr_agent = PRAgent::new(config);

    let task = Task {
        id: "task-001".to_string(),
        title: "Auth: Add Google OAuth support".to_string(),
        description: "Implement Google OAuth 2.0 authentication".to_string(),
        task_type: TaskType::Feature,
        ..Default::default()
    };

    // Generates PR:
    // Title: feat(auth): Add Google OAuth support
    // Body: Overview, changes, checklist
    // Labels: ✨ type:feature, πŸ—οΈ state:implementing
    let result = pr_agent.execute(&task).await?;

    println!("PR created: {:?}", result.data);
    Ok(())
}

IssueAgent Example

use miyabi_agent_workflow::IssueAgent;
use miyabi_types::{AgentConfig, Issue};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = AgentConfig::default();
    let issue_agent = IssueAgent::new(config);

    let issue = Issue {
        number: 42,
        title: "Critical: Database connection timeout".to_string(),
        body: "Users cannot login. Database times out after 5s.".to_string(),
        labels: vec!["bug".to_string()],
        ..Default::default()
    };

    let analysis = issue_agent.analyze_issue(&issue)?;

    // Output:
    // Type: Bug
    // Severity: Critical
    // Impact: System
    // Agent: CodeGenAgent
    // Duration: 30 minutes
    // Labels: ["πŸ› type:bug", "πŸ”₯ priority:P0-Critical", "πŸ€– agent:codegen"]

    println!("Analysis: {:?}", analysis);
    Ok(())
}

DeploymentAgent Example

use miyabi_agent_workflow::{DeploymentAgent, Environment};
use miyabi_agent_core::BaseAgent;
use miyabi_types::{AgentConfig, Task, TaskType};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = AgentConfig {
        firebase_staging_project: Some("miyabi-staging".to_string()),
        staging_url: Some("https://staging.miyabi.dev".to_string()),
        ..Default::default()
    };

    let deploy_agent = DeploymentAgent::new(config);

    let task = Task {
        id: "deploy-001".to_string(),
        title: "Deploy to staging".to_string(),
        task_type: TaskType::Deployment,
        ..Default::default()
    };

    // Executes:
    // 1. cargo build --release
    // 2. cargo test --all
    // 3. Deploy to staging
    // 4. Health check (https://staging.miyabi.dev/health)
    // 5. Rollback if health check fails

    let result = deploy_agent.execute(&task).await?;

    println!("Deployment: {:?}", result.status);
    Ok(())
}

πŸ“Š Label System Integration

IssueAgent integrates with Miyabi's 57-label system across 11 categories:

Category Labels Examples
Type 7 ✨ type:feature, πŸ› type:bug, ♻️ type:refactor
Priority 5 πŸ”₯ priority:P0-Critical, ⚠️ priority:P1-High
State 8 πŸ“₯ state:pending, πŸ—οΈ state:implementing, βœ… state:done
Agent 7 πŸ€– agent:coordinator, πŸ€– agent:codegen, πŸ€– agent:review
Phase 6 🎯 phase:planning, πŸ—οΈ phase:implementation
Size 5 πŸ“ size:XS, πŸ“ size:S, πŸ“ size:M, πŸ“ size:L, πŸ“ size:XL
Impact 3 πŸ’₯ impact:system, πŸ‘€ impact:user, 🎨 impact:cosmetic
Severity 4 πŸ”₯ severity:critical, ⚠️ severity:high
Technical 7 πŸ”§ tech:api, πŸ—„οΈ tech:db, 🎨 tech:ui
Business 3 πŸ’Ό biz:marketing, πŸ’° biz:sales, πŸ“Š biz:analytics
Meta 2 🏷️ good first issue, πŸ™‹ help wanted

See LABEL_SYSTEM_GUIDE.md for full documentation.

πŸ”„ Deployment Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  cargo build        β”‚ β†’ BuildResult
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  cargo test         β”‚ β†’ TestResult
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Deploy (Staging)   β”‚ β†’ Automatic
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Health Check       β”‚ β†’ GET /health
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Success / Rollback β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—οΈ Architecture

PRAgent

PRAgent::execute(task)
  β”œβ”€β”€ generate_pr_title()         β†’ feat(scope): description
  β”œβ”€β”€ generate_pr_body()          β†’ Markdown body
  β”œβ”€β”€ infer_labels()              β†’ [type:feature, state:implementing]
  └── create_pull_request()       β†’ GitHub PR

IssueAgent

IssueAgent::analyze_issue(issue)
  β”œβ”€β”€ infer_issue_type()          β†’ Feature/Bug/Refactor...
  β”œβ”€β”€ assess_severity()           β†’ Critical/High/Medium/Low
  β”œβ”€β”€ evaluate_impact()           β†’ System/User/Cosmetic
  β”œβ”€β”€ determine_agent()           β†’ CodeGenAgent/ReviewAgent...
  β”œβ”€β”€ estimate_duration()         β†’ 30-120 minutes
  β”œβ”€β”€ extract_dependencies()      β†’ [#123, #456]
  └── generate_labels()           β†’ [57-label system]

DeploymentAgent

DeploymentAgent::deploy(task)
  β”œβ”€β”€ execute_build()             β†’ cargo build --release
  β”œβ”€β”€ execute_tests()             β†’ cargo test --all
  β”œβ”€β”€ deploy_to_environment()     β†’ Staging/Production
  β”œβ”€β”€ run_health_check()          β†’ GET /health (3 retries)
  └── rollback_if_failed()        β†’ git revert + redeploy

πŸ”— Dependencies

  • Core: miyabi-agent-core, miyabi-types, miyabi-core, miyabi-github
  • Runtime: tokio, async-trait
  • GitHub: octocrab, reqwest
  • Serialization: serde, serde_json
  • Utilities: chrono, regex, thiserror, tracing

πŸ§ͺ Testing

# Run all tests
cargo test --package miyabi-agent-workflow

# Test specific agent
cargo test --package miyabi-agent-workflow pr_agent
cargo test --package miyabi-agent-workflow issue_agent
cargo test --package miyabi-agent-workflow deployment_agent

# Integration tests (requires GitHub token)
GITHUB_TOKEN=ghp_xxx cargo test --package miyabi-agent-workflow --test integration

πŸ“š Related Crates

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

πŸ“„ License

Licensed under the MIT License. See LICENSE for details.

πŸ”– Version History

  • v0.1.0 (2025-10-25): Initial release
    • PRAgent with Conventional Commits support
    • IssueAgent with 57-label system integration
    • DeploymentAgent with build/test/deploy/rollback workflow
    • Automatic agent routing and label inference

Part of the Miyabi Framework - Autonomous AI Development Platform