Git operations for branch management, commits, tags, and workspace state.
All operations return Result instead of throwing errors.
current_branch_name
Gets the current branch name.
type (options?: {
cwd?: string;
}) => Promise<Result<{value: string}, {message: string}>>
current_commit_hash
Gets the current commit hash.
type (options?: {
branch?: string;
cwd?: string;
}) => Promise<Result<{value: string}, {message: string}>>
check_clean_workspace
Checks if the workspace is clean (no uncommitted changes).
type (options?: {
cwd?: string;
}) => Promise<Result<{value: boolean}, {message: string}>>
checkout
type (options: {branch: string; cwd?: string}) => Promise<Result<object, {message: string}>>
pull
Pulls changes from remote.
type (options?: {
origin?: string;
branch?: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>
switch_branch
Switches to a branch, optionally pulling.
type (options: {
branch: string;
pull?: boolean;
cwd?: string;
}) => Promise<Result<object, {message: string}>>
has_remote
Checks if a remote exists.
type (options?: {
remote?: string;
cwd?: string;
}) => Promise<Result<{value: boolean}, {message: string}>>
add
type (options: {
files: string | Array<string>;
cwd?: string;
}) => Promise<Result<object, {message: string}>>
commit
type (options: {message: string; cwd?: string}) => Promise<Result<object, {message: string}>>
add_and_commit
Stages files and creates a commit.
type (options: {
files: string | Array<string>;
message: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>
has_changes
Checks if there are any uncommitted changes.
type (options?: {cwd?: string}) => Promise<Result<{value: boolean}, {message: string}>>
get_changed_files
Gets a list of changed files.
type (options?: {
cwd?: string;
}) => Promise<Result<{value: Array<string>}, {message: string}>>
tag
type (options: {
tag_name: string;
message?: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>
push_tag
type (options: {
tag_name: string;
origin?: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>
stash
Stashes uncommitted changes.
type (options?: {message?: string; cwd?: string}) => Promise<Result<object, {message: string}>>
stash_pop
Pops the most recent stash.
type (options?: {cwd?: string}) => Promise<Result<object, {message: string}>>
has_file_changed
Checks if a specific file changed between two commits.
type (options: {
from_commit: string;
to_commit: string;
file_path: string;
cwd?: string;
}) => Promise<Result<{value: boolean}, {message: string}>>