Skip to main content

Interface: VcsAdapter

Defined in: packages/core/src/application/ports/vcs-adapter.ts:16

Port for querying version-control system state.

Provides technology-neutral VCS operations that use cases and CLI commands need — repository root for path resolution, current branch for context, working-tree cleanliness as a safety guard, current revision reference, and file content retrieval at a given revision.

Implementations exist for git, hg, svn, and a null fallback for environments with no VCS.

Unlike the repository ports, VcsAdapter has no invariant constructor arguments shared across all implementations, so it is declared as an interface rather than an abstract class.

Methods​

branch()​

branch(): Promise<string>

Defined in: packages/core/src/application/ports/vcs-adapter.ts:36

Returns the name of the currently checked-out branch.

Returns "HEAD" (git) or an equivalent in detached/unknown state.

Returns​

Promise<string>

Current branch name

Throws​

When the current working directory is not inside a VCS repository


isClean()​

isClean(): Promise<boolean>

Defined in: packages/core/src/application/ports/vcs-adapter.ts:44

Returns true when the working tree has no uncommitted changes.

Returns​

Promise<boolean>

true if working tree is clean, false if there are uncommitted changes

Throws​

When the current working directory is not inside a VCS repository


ref()​

ref(): Promise<string | null>

Defined in: packages/core/src/application/ports/vcs-adapter.ts:53

Returns the short revision identifier for the current commit/changeset.

Returns null when VCS is unavailable or the repository has no commits.

Returns​

Promise<string | null>

Short revision hash/id, or null


rootDir()​

rootDir(): Promise<string>

Defined in: packages/core/src/application/ports/vcs-adapter.ts:26

Returns the absolute path to the root of the current repository.

Useful for resolving all other project-relative paths (specs, changes, archive, schemas).

Returns​

Promise<string>

Absolute path to the repository root

Throws​

When the current working directory is not inside a VCS repository


show()​

show(ref, filePath): Promise<string | null>

Defined in: packages/core/src/application/ports/vcs-adapter.ts:64

Returns the content of a file at a given revision.

Returns null when the revision or file path does not exist.

Parameters​

ref​

string

Revision identifier (e.g. commit hash, branch name)

filePath​

string

Repository-relative path to the file

Returns​

Promise<string | null>

File content as a string, or null