ClonedRepositoryReference

class ClonedRepositoryReference(val url: String, val localPath: Path, val shouldDeleteOnClose: Boolean = true, val fileFormatLimits: FileFormatLimits = FileFormatLimits()) : AutoCloseable, FileReadTools, FileReadLog, LlmReference

Reference to a cloned Git repository with automatic cleanup capabilities. Exposes LLM tools and ensures proper cleanup on application shutdown.

Parameters

url

The URL of the Git repository we cloned

localPath

The local path where the repository is cloned.

shouldDeleteOnClose

If true, the repository will be deleted when closed.

fileFormatLimits

Limits for file processing operations.

Constructors

Link copied to clipboard
constructor(url: String, localPath: Path, shouldDeleteOnClose: Boolean = true, fileFormatLimits: FileFormatLimits = FileFormatLimits())

Properties

Link copied to clipboard
Link copied to clipboard

Provide sanitizers that run on file content before returning it. They must be sure not to change any content that may need to be replaced as this will break editing if editing is done in the same session.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val name: String
Link copied to clipboard
open override val root: String

Root on host machine

Link copied to clipboard
Link copied to clipboard
open override val toolCallbacks: List<<Error class: unknown class>>

Tool callbacks referenced or exposed.

Link copied to clipboard
val url: String

Functions

Link copied to clipboard

Expose the ToolGroup as an interface

Link copied to clipboard
open override fun close()
Link copied to clipboard
open fun contribution(): String
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Equality based on localPath only, not on cleanup behavior or limits.

Link copied to clipboard
open fun exists(): Boolean

Does this file exist?

Link copied to clipboard
open fun fileCount(): Int

Count the total number of files in the repository (excluding .git directory). Uses FileVisitor for cross-platform compatibility (Windows and Linux).

Link copied to clipboard
open fun findFiles(glob: String): List<String>

open fun findFiles(glob: String, findHighest: Boolean): List<String>

Find files using glob patterns.

Link copied to clipboard
open override fun flushReads()
Link copied to clipboard
open override fun getPathsAccessed(): List<String>
Link copied to clipboard
open override fun getPathsRead(): List<String>
Link copied to clipboard
open override fun getReads(): List<FileReads>
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open fun listFiles(path: String): List<String>
Link copied to clipboard
open override fun notes(): String

Return a prompt contributor if the repo is small enough

Link copied to clipboard
open fun readFile(path: String): String
Link copied to clipboard
open override fun recordRead(path: String)
Link copied to clipboard
Link copied to clipboard
open fun resolvePath(path: String): Path
Link copied to clipboard
open fun safeReadFile(path: String): String?

Use for safe reading of files. Returns null if the file doesn't exist or is not readable.

Link copied to clipboard

Create a tool object for this reference.

Link copied to clipboard
open fun toolPrefix(): String

A safe prefix for LLM tools associated with this reference. Defaults to the name lowercased with spaces replaced by underscores. Subclasses can override it

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Write all files in the repository to a single string. Only use this for small repositories as it loads everything into memory. Applies file content transformers (like removing Apache license headers). Uses FileVisitor for cross-platform compatibility.