定制 conduit-ui/prs 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

conduit-ui/prs

最新稳定版本:v1.0.0

Composer 安装命令:

composer require conduit-ui/prs

包简介

Pull Request operations for the Conduit agent ecosystem

README 文档

README

Stop context-switching between PRs. Start automating approvals, merges, and bulk operations.

Approve, merge, request changes, and manage pull requests at scale with expressive PHP code. Built for teams shipping multiple releases per day.

Sentinel Certified Latest Version MIT License Total Downloads

Installation

composer require conduit-ui/pr

Why This Exists

Your team merges 30+ PRs per day. You're manually checking CI status, approving dependency updates, and enforcing review policies. This package automates the repetitive parts so your team can focus on code review that matters.

Quick Start

use ConduitUI\Pr\PullRequest;

// Approve and merge a PR
PullRequest::find('owner/repo', 123)
    ->approve('LGTM! Shipping it.')
    ->merge();

// Auto-merge all passing Dependabot PRs
PullRequest::query('owner/repo')
    ->author('dependabot[bot]')
    ->open()
    ->get()
    ->filter(fn($pr) => $pr->checksPass())
    ->each(fn($pr) => $pr->merge());

Core Features

Review Actions

Approve PRs

PullRequest::find('owner/repo', 456)
    ->approve('Great work! Tests look good.');

Request Changes

PullRequest::find('owner/repo', 789)
    ->requestChanges('Please add tests for the new feature.');

Add Review Comments

PullRequest::find('owner/repo', 101)
    ->comment('Consider extracting this logic into a separate class.');

Inline Code Comments

PullRequest::find('owner/repo', 202)
    ->addInlineComment(
        path: 'src/Service.php',
        line: 42,
        comment: 'This could cause a race condition'
    );

Merge Operations

Simple Merge

$pr = PullRequest::find('owner/repo', 123);
$pr->merge(); // Merge commit (default)

Merge Strategies

$pr->merge(strategy: 'squash'); // Squash and merge
$pr->merge(strategy: 'rebase'); // Rebase and merge

Conditional Merge

$pr = PullRequest::find('owner/repo', 123);

if ($pr->checksPass() && $pr->approved()) {
    $pr->merge();
}

State Management

Close & Reopen

// Close without merging
$pr->close();

// Reopen a closed PR
$pr->reopen();

Advanced Queries

Filter by State

PullRequest::query('owner/repo')
    ->state('open')
    ->get();

Filter by Author

PullRequest::query('owner/repo')
    ->author('username')
    ->get();

Filter by Labels

PullRequest::query('owner/repo')
    ->labels(['ready-to-merge', 'hotfix'])
    ->get();

Sort Results

PullRequest::query('owner/repo')
    ->sort('created', 'desc')
    ->get();

Convenience Methods

// All open PRs
PullRequest::query('owner/repo')->open()->get();

// All closed PRs
PullRequest::query('owner/repo')->closed()->get();

// All merged PRs
PullRequest::query('owner/repo')->merged()->get();

Real-World Automation

Auto-Merge Dependabot

// Run this on a schedule (every 15 minutes)
PullRequest::query('owner/repo')
    ->author('dependabot[bot]')
    ->open()
    ->get()
    ->filter(fn($pr) => $pr->checksPass())
    ->filter(fn($pr) => $pr->title->contains(['patch', 'minor']))
    ->each(function($pr) {
        $pr->approve('Auto-approving passing dependency update');
        $pr->merge(strategy: 'squash');
    });

Enforce Review Policy

// Block merge if not approved by 2+ reviewers
$pr = PullRequest::find('owner/repo', 123);

if ($pr->approvals()->count() < 2) {
    $pr->comment('⚠️ This PR requires 2 approvals before merging.');
    exit(1);
}

Bulk Label Management

// Add "shipped" label to all merged PRs from this week
PullRequest::query('owner/repo')
    ->merged()
    ->since(now()->startOfWeek())
    ->get()
    ->each(fn($pr) => $pr->addLabels(['shipped']));

Hotfix Fast-Track

// Auto-merge hotfixes that pass CI
PullRequest::query('owner/repo')
    ->label('hotfix')
    ->open()
    ->get()
    ->filter(fn($pr) => $pr->checksPass())
    ->each(function($pr) {
        $pr->approve('Hotfix approved via automation');
        $pr->merge(strategy: 'squash');
    });

Usage Patterns

Static API (Recommended)

use ConduitUI\Pr\PullRequest;

$pr = PullRequest::find('owner/repo', 123);
$prs = PullRequest::query('owner/repo')->open()->get();

Instance API

use ConduitUI\Pr\PullRequestManager;

$manager = new PullRequestManager('owner/repo');
$pr = $manager->find(123);
$prs = $manager->query()->open()->get();

Data Objects

All responses return strongly-typed DTOs:

$pr->id;              // int
$pr->number;          // int
$pr->title;           // string
$pr->state;           // 'open' | 'closed' | 'merged'
$pr->author;          // User object
$pr->reviewers;       // Collection of User objects
$pr->labels;          // Collection of Label objects
$pr->headBranch;      // string
$pr->baseBranch;      // string
$pr->mergeable;       // bool
$pr->createdAt;       // Carbon instance
$pr->updatedAt;       // Carbon instance
$pr->mergedAt;        // ?Carbon instance
$pr->checksPass();    // bool - All CI checks passing
$pr->approved();      // bool - Has approvals
$pr->approvals();     // Collection of Review objects

Configuration

Publish the config file:

php artisan vendor:publish --tag="pr-config"

Set your GitHub token in .env:

GITHUB_TOKEN=your-github-token

Requirements

  • PHP 8.2+
  • GitHub personal access token with repo scope

Testing

composer test

Code Quality

composer format  # Fix code style
composer analyse # Run static analysis

Related Packages

Enterprise Support

Automating PR workflows across your organization? Contact jordan@partridge.rocks for custom solutions including compliance checks, advanced approval rules, and audit logging.

License

MIT License. See LICENSE for details.

conduit-ui/prs 适用场景与选型建议

conduit-ui/prs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「github」 「Agent」 「pr」 「conduit-ui」 「pull-request」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 conduit-ui/prs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 conduit-ui/prs 我们能提供哪些服务?
定制开发 / 二次开发

基于 conduit-ui/prs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-11