Skip to main content

Class: GitVcsAdapter

Defined in: packages/core/src/infrastructure/git/vcs-adapter.ts:10

Git CLI implementation of the VcsAdapter port.

Shells out to the git binary for all queries. All methods operate relative to cwd, which defaults to process.cwd() when not specified.

Implements​

Constructors​

Constructor​

new GitVcsAdapter(cwd?): GitVcsAdapter

Defined in: packages/core/src/infrastructure/git/vcs-adapter.ts:18

Creates a new GitVcsAdapter.

Parameters​

cwd?​

string = ...

Working directory for git commands; defaults to process.cwd()

Returns​

GitVcsAdapter

Methods​

branch()​

branch(): Promise<string>

Defined in: packages/core/src/infrastructure/git/vcs-adapter.ts:28

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

Implementation of​

VcsAdapter.branch


isClean()​

isClean(): Promise<boolean>

Defined in: packages/core/src/infrastructure/git/vcs-adapter.ts:37

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

Implementation of​

VcsAdapter.isClean


ref()​

ref(): Promise<string | null>

Defined in: packages/core/src/infrastructure/git/vcs-adapter.ts:43

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

Implementation of​

VcsAdapter.ref


rootDir()​

rootDir(): Promise<string>

Defined in: packages/core/src/infrastructure/git/vcs-adapter.ts:23

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

Implementation of​

VcsAdapter.rootDir


show()​

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

Defined in: packages/core/src/infrastructure/git/vcs-adapter.ts:52

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

Implementation of​

VcsAdapter.show