CtrlK
BlogDocsLog inGet started
Tessl Logo

finkel/jgit

JGit documentation and API reference with code examples

92

1.09x
Quality

Pending

Does it follow best practices?

Impact

92%

1.09x

Average score across 10 eval scenarios

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

task.mdevals/scenario-5/

Repository Factory and Manager

Problem/Feature Description

Our multi-repository build system needs to manage hundreds of Git repositories across different projects. The current codebase has scattered repository initialization logic with inconsistent error handling and resource management.

We need a centralized repository factory and manager that provides:

  • Consistent repository creation/opening with configurable defaults
  • Lifecycle management (opening, caching, closing)
  • Connection pooling for frequently accessed repositories
  • Statistics tracking (open count, error rates, performance metrics)
  • Graceful shutdown of all open repositories
  • Support for both bare and non-bare repositories
  • Integration with dependency injection frameworks

The factory should follow established design patterns (Factory, Pool, Manager) and provide a clean API for the rest of the application. It should handle edge cases like concurrent access, repository corruption, and disk space issues.

Requirements:

  • Singleton or dependency-injected factory instance
  • Configurable defaults (auto-close timeout, cache size, retry behavior)
  • Metrics collection for monitoring
  • Support for both programmatic and declarative configuration
  • Pluggable strategies for repository validation and repair
  • Integration with application lifecycle (startup/shutdown hooks)

Output Specification

Create a Java class RepositoryManager that implements the following:

  1. getRepository(path): Gets or creates repository instance for given path
  2. createRepository(path, bare): Creates new repository at path
  3. closeRepository(path): Closes repository and removes from cache
  4. closeAll(): Closes all managed repositories
  5. getStats(): Returns usage statistics
  6. shutdown(): Graceful shutdown with timeout

Include supporting classes for configuration, caching, and metrics.

Expected output files:

  • RepositoryManager.java - Main factory/manager class
  • RepositoryConfig.java - Configuration for repository defaults
  • RepositoryPool.java - Pool implementation for repository instances
  • RepositoryMetrics.java - Metrics collection class
  • RepositoryLifecycle.java - Lifecycle management interface
  • build.gradle or pom.xml - Build configuration
  • README.md - Documentation on integration and configuration

The solution should demonstrate sophisticated use of design patterns with JGit, proper resource lifecycle management, and production-ready configuration options.

tile.json