Git

The @devframes/service-git wire service: typed read/write git operations over RPC on one repository, shared by every devframe on the host.

Typed read/write git operations shared over RPC by every devframe on the host, generalizing the utilities that used to live inside the Git devframe. The exec wrapper and output parsers stay internal; consumers get the typed GitServiceApi in-process (ctx.services.get) and the same ops over devframes:service:git:* RPC.

Package: @devframes/service-git · Scope: devframes:service:git

Installing

defineDevframe({
  importMetaUrl: import.meta.url,
  services: [
    { package: '@devframes/service-git', options: { cwd: process.cwd() } },
  ],
})

A hub installs a shared instance with initHub({ services: [createGitService(options)] }).

Options

GitServiceOptionscwd merges as a scalar (later installer wins).

OptionTypeDescription
cwdstringRepository directory to operate on. Defaults to the context's cwd; the repo root is discovered once (rev-parse --show-toplevel) and memoized.

RPC functions

Registered under devframes:service:git:*. Reads are query; writes are action. Write ops are always exposed — authorization is the host's connection-trust boundary. The service defines no dump/snapshot; a devframe bakes what it needs via snapshotRpc.

FunctionTypeArgsReturns
statusqueryWorking-tree status: branch, ahead/behind, staged/unstaged/untracked files.
logquery{ limit?, skip?, ref?, paths? }Commit history, newest first (paginated).
showquery{ hash, patch? }Full detail of one commit: metadata, files, unified patch.
readFilequery{ path, ref? }Contents of a file at a commit-ish (default HEAD).
diffquery{ path?, staged? }Unified diff of uncommitted changes.
branchesqueryLocal branches with tracking state and the current branch.
tagsqueryTags (newest first) with target SHA, date, and subject.
stageaction{ … }Stage paths; returns the new status.
unstageaction{ … }Unstage paths; returns the new status.
commitaction{ … }Create a commit; returns the result.

The read query functions carry agent metadata, so they surface as tools to a coding agent.

Node API

ctx.services.get('@devframes/service-git') returns the in-process GitServiceApi — the same operations without an RPC hop.

On the RPC client

const rpc = await connectDevframe()

if (rpc.services.has('@devframes/service-git')) {
  const git = rpc.services.get('@devframes/service-git')!
  const status = await git.rpc.call('status')
}

Source

services/git