Documentation
¶
Index ¶
- func RunServer(utility command.Utility, repo *local_working_copy.Repo, ...) error
- type Bridge
- func (b Bridge) RunCommand(ctx context.Context, cmdName string, cliArgs []string, maxBytes int) (BridgeResult, error)
- func (b Bridge) RunCommandWithRepoId(ctx context.Context, cmdName string, cliArgs []string, maxBytes int, ...) (BridgeResult, error)
- func (b Bridge) WithRepo(ctx context.Context, repoIdParam string, ...) error
- type BridgeResult
- type LimitingWriter
- func (w *LimitingWriter) BytesKept() int
- func (w *LimitingWriter) BytesSeen() int
- func (w *LimitingWriter) Reset()
- func (w *LimitingWriter) String() string
- func (w *LimitingWriter) Truncated() bool
- func (w *LimitingWriter) Write(p []byte) (n int, err error)
- func (w *LimitingWriter) WriteString(s string) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
func MakeBridge ¶
func (Bridge) RunCommand ¶
func (b Bridge) RunCommand( ctx context.Context, cmdName string, cliArgs []string, maxBytes int, ) (BridgeResult, error)
RunCommand runs a command against the bridge's default repo (the server's startup repo). Use RunCommandWithRepoId to target a specific repo per call.
func (Bridge) RunCommandWithRepoId ¶ added in v0.2.6
func (b Bridge) RunCommandWithRepoId( ctx context.Context, cmdName string, cliArgs []string, maxBytes int, repoIdParam string, ) (BridgeResult, error)
RunCommandWithRepoId runs a command targeting the given repo (see resolveRepoId). An empty repoIdParam means the server's default repo.
func (Bridge) WithRepo ¶ added in v0.2.6
func (b Bridge) WithRepo( ctx context.Context, repoIdParam string, fn func(*local_working_copy.Repo) error, ) error
WithRepo builds a fresh local working copy for the repo addressed by repoIdParam (empty = the server's default repo), gated by the same pin/CheckSupported resolution as the tool path (resolveRepoId), and runs fn against it. It is the store-backed counterpart to RunCommandWithRepoId: the handlers that need a real *Repo rather than a CLI run — edit, reset-lock, and blob-format listing (FDR-0019 #278) — call this.
fn runs INSIDE the build's error context, exactly as RunCommandWithRepoId runs cmd.Run inside it. This is load-bearing: MakeLocalWorkingCopy registers the env's temp-dir cleanup (and the repo Flush) as After hooks on that context, so they must fire AFTER fn finishes — returning the repo for use after the context completed would tear its temp dirs down first, and a subsequent blob write would chmod into a removed directory.
A fresh repo is built per call, mirroring how RunCommandWithRepoId builds one per command run: no held-open cache, so no lock-holding or index staleness. The build duration is emitted as a statsd timer so the build-per-call cost is observable; if it ever dominates MCP latency, switch to a lazy per-repo cache (the FDR "MCP repo cache" lever).
type BridgeResult ¶
type LimitingWriter ¶
type LimitingWriter struct {
// contains filtered or unexported fields
}
func MakeLimitingWriter ¶
func MakeLimitingWriter(maxBytes int) *LimitingWriter
func (*LimitingWriter) BytesKept ¶
func (w *LimitingWriter) BytesKept() int
func (*LimitingWriter) BytesSeen ¶
func (w *LimitingWriter) BytesSeen() int
func (*LimitingWriter) Reset ¶
func (w *LimitingWriter) Reset()
func (*LimitingWriter) String ¶
func (w *LimitingWriter) String() string
func (*LimitingWriter) Truncated ¶
func (w *LimitingWriter) Truncated() bool
func (*LimitingWriter) WriteString ¶
func (w *LimitingWriter) WriteString(s string) (n int, err error)