RepositoryService class

A high-level, typed façade over a RepositoryAdapter — the entry point for using ApolloVM's repository features from any Dart host (a web IDE, a desktop editor, an agent, a test), independently of MCP.

It bundles three things behind one typed API:

  • the filesystem/search/git operations of the underlying adapter,
  • a RepoConfig enforced by a PermissionGuard (read-only by default), and
  • language-aware code navigation (outline/definition/references/ hover/diagnostics/workspaceSymbols/searchSymbols) powered by ApolloVM's own parsers via an in-process LspService — the file contents are read through the adapter, so navigation works on the real workspace.

Like the rest of the repository library this is web-safe (no dart:io); pair it with an InMemoryRepositoryAdapter in the browser or a LocalRepositoryAdapter on the VM. The MCP apollovm.fs.*/search.*/ code.*/git.* tools are a thin JSON layer over this same service.

final repo = RepositoryService(InMemoryRepositoryAdapter(files));
final file = await repo.read('lib/main.dart');
final outline = await repo.outline('lib/main.dart');
await repo.close();

Constructors

RepositoryService(RepositoryAdapter adapter, {RepoConfig config = const RepoConfig()})
Wraps adapter with config (via a PermissionGuard, unless adapter is already one) and exposes it as a typed service.

Properties

adapter RepositoryAdapter
The permission-guarded adapter every operation goes through.
final
capabilities RepoCapabilities
What the underlying backend (as configured) can and may do.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() Future<void>
Releases the internal language service (if any).
definition(String path, int line, int character) Future<Location?>
The declaration location of the symbol at line:character in path.
delete(String path) Future<void>
diagnostics(String path) Future<List<Diagnostic>>
Parse diagnostics for path.
edit(String path, String oldString, String newString, {bool replaceAll = false, int? atLine}) Future<RepoEdit>
find({String? glob, int? limit}) Future<List<String>>
gitAdd(List<String> paths) Future<GitResult>
gitBlame(String path) Future<List<GitBlameLine>>
gitCheckout(String rev) Future<GitResult>
gitCommit(String message, {List<String>? paths}) Future<GitResult>
gitDiff({String? rev, bool staged = false, String? path}) Future<String>
gitLog({int? limit, String? path}) Future<List<GitCommit>>
gitRestore(List<String> paths, {bool staged = false}) Future<GitResult>
gitShow({required String rev, String? path}) Future<String>
gitStatus() Future<List<GitStatusEntry>>
hover(String path, int line, int character) Future<Hover?>
Hover info at line:character (zero-based) in path.
list(String path, {bool recursive = false, int? maxDepth, String? glob}) Future<List<RepoEntry>>
mkdir(String path) Future<void>
move(String from, String to) Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
outline(String path) Future<List<DocumentSymbol>>
The document outline (hierarchical symbols) of path.
read(String path, {LineRange? range}) Future<RepoFile>
references(String path, int line, int character, {bool includeDeclaration = true}) Future<List<Location>>
References to the symbol at line:character in path.
searchSymbols(String query, {String? kind, String? glob}) Future<List<WorkspaceSymbol>>
Language-aware declaration search: workspaceSymbols filtered by an optional symbol kind name (e.g. class, method, function).
searchText(String pattern, {String? glob, bool ignoreCase = false, int context = 0, int? limit}) Future<List<TextMatch>>
stat(String path) Future<RepoStat>
toString() String
A string representation of this object.
inherited
workspaceSymbols(String query, {String? glob}) Future<List<WorkspaceSymbol>>
Workspace-wide symbols matching query, loading every parseable source file under glob (all files when null) through the adapter.
write(String path, String content) Future<RepoEdit>

Operators

operator ==(Object other) bool
The equality operator.
inherited