定制 conduit-ui/repo 二次开发

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

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

conduit-ui/repo

最新稳定版本:v0.3.0

Composer 安装命令:

composer require conduit-ui/repo

包简介

Repository management for agents

README 文档

README

Stop manually auditing repository settings. Start enforcing compliance policies across your entire organization.

Audit, update, and manage repositories in bulk. Enforce branch protection, security policies, and team permissions across hundreds of repos with clean PHP code.

Latest Version MIT License Total Downloads

Installation

composer require conduit-ui/repo

Why This Exists

Your organization has 200+ repositories. Some have branch protection disabled. Others allow force pushes to main. Security policies are inconsistent. This package gives you the tools to audit and enforce compliance at scale.

Quick Start

use ConduitUI\Repo\Repository;

// Find a single repository
$repo = Repository::find('owner/repo');

// Audit all org repositories
Repository::forOrganization('your-org')
    ->get()
    ->filter(fn($repo) => !$repo->branchProtectionEnabled())
    ->each(fn($repo) => $repo->enableBranchProtection('main'));

// Create a new repository
Repository::create('new-repo', [
    'description' => 'API service for user management',
    'private' => true,
    'auto_init' => true,
]);

Core Features

Repository Discovery

Find by Name

$repo = Repository::find('owner/repo');

List User Repositories

$repos = Repository::forUser('username')->get();

List Organization Repositories

$repos = Repository::forOrganization('org-name')->get();

List Authenticated User's Repos

$repos = Repository::forAuthenticatedUser()->get();

Repository Creation

Basic Creation

Repository::create('my-new-repo', [
    'description' => 'A new project',
    'private' => false,
]);

Organization Repository

Repository::createForOrganization('org-name', 'repo-name', [
    'description' => 'Team project',
    'private' => true,
    'auto_init' => true,
    'gitignore_template' => 'PHP',
    'license_template' => 'mit',
]);

Repository Updates

Update Metadata

$repo = Repository::find('owner/repo');
$repo->update([
    'description' => 'Updated description',
    'homepage' => 'https://example.com',
    'private' => true,
    'has_issues' => true,
    'has_wiki' => false,
]);

Repository Details

Branches

$branches = $repo->branches();
$main = $repo->defaultBranch();

Releases

$releases = $repo->releases();
$latest = $repo->latestRelease();

Collaborators

$collaborators = $repo->collaborators();

Topics (Tags)

$topics = $repo->topics();

Languages

$languages = $repo->languages();
// ['PHP' => 75234, 'JavaScript' => 12456, ...]

Repository Deletion

Repository::find('owner/repo')->delete();

Governance & Compliance

Audit Branch Protection

// Find repos without branch protection
Repository::forOrganization('your-org')
    ->get()
    ->filter(fn($repo) => !$repo->branchProtectionEnabled())
    ->each(function($repo) {
        echo "{$repo->name} is not protected!\n";
    });

Enforce Security Policies

// Disable force pushes across all repos
Repository::forOrganization('your-org')
    ->get()
    ->each(fn($repo) => $repo->update([
        'allow_force_pushes' => false,
        'delete_branch_on_merge' => true,
    ]));

Standardize Repository Settings

// Enforce consistent settings across org
$standardSettings = [
    'has_issues' => true,
    'has_wiki' => false,
    'has_projects' => false,
    'allow_squash_merge' => true,
    'allow_merge_commit' => false,
    'allow_rebase_merge' => false,
    'delete_branch_on_merge' => true,
];

Repository::forOrganization('your-org')
    ->get()
    ->each(fn($repo) => $repo->update($standardSettings));

Archive Stale Repositories

// Archive repos with no commits in 12 months
Repository::forOrganization('your-org')
    ->get()
    ->filter(fn($repo) => $repo->pushedAt < now()->subYear())
    ->each(fn($repo) => $repo->update(['archived' => true]));

Bulk Operations

Clone All Org Repositories

Repository::forOrganization('your-org')
    ->get()
    ->each(function($repo) {
        $cloneUrl = $repo->cloneUrl;
        exec("git clone {$cloneUrl}");
    });

Generate Org Report

$report = Repository::forOrganization('your-org')
    ->get()
    ->map(fn($repo) => [
        'name' => $repo->name,
        'private' => $repo->private,
        'branch_protection' => $repo->branchProtectionEnabled(),
        'last_push' => $repo->pushedAt->diffForHumans(),
        'open_issues' => $repo->openIssuesCount,
        'language' => $repo->language,
    ]);

// Export to CSV, send to Slack, etc.

Bulk Topic Management

// Tag all PHP repos
Repository::forOrganization('your-org')
    ->get()
    ->filter(fn($repo) => $repo->language === 'PHP')
    ->each(fn($repo) => $repo->addTopics(['php', 'backend']));

Data Objects

All responses return strongly-typed DTOs:

$repo->id;                    // int
$repo->name;                  // string
$repo->fullName;              // string (owner/repo)
$repo->description;           // ?string
$repo->private;               // bool
$repo->fork;                  // bool
$repo->archived;              // bool
$repo->disabled;              // bool
$repo->owner;                 // Owner object
$repo->license;               // ?License object
$repo->language;              // ?string
$repo->defaultBranch;         // string
$repo->openIssuesCount;       // int
$repo->stargazersCount;       // int
$repo->watchersCount;         // int
$repo->forksCount;            // int
$repo->createdAt;             // Carbon instance
$repo->updatedAt;             // Carbon instance
$repo->pushedAt;              // Carbon instance
$repo->cloneUrl;              // string
$repo->sshUrl;                // string
$repo->branchProtectionEnabled(); // bool

Usage Patterns

Static API (Recommended)

use ConduitUI\Repo\Repository;

$repo = Repository::find('owner/repo');
$repos = Repository::forOrganization('org')->get();

Instance API

use ConduitUI\Repo\RepositoryManager;

$manager = new RepositoryManager();
$repo = $manager->find('owner/repo');

Configuration

Publish the config file:

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

Set your GitHub token in .env:

GITHUB_TOKEN=your-github-token

For organization-level operations, ensure your token has repo and admin:org scopes.

Requirements

  • PHP 8.2+
  • GitHub personal access token or GitHub App
  • For org operations: admin:org scope

Testing

composer test

Code Quality

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

Related Packages

Enterprise Support

Managing governance for 500+ repositories? Contact jordan@partridge.rocks for enterprise solutions including:

  • Custom compliance reporting
  • Automated policy enforcement
  • Audit trail integration
  • SOC2/ISO27001 compliance tooling
  • Multi-organization management

License

MIT License. See LICENSE for details.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固