@morphllm/morph-git-sdk TypeScript SDK.
GitMorph (Client)
The main client. Handles authentication and provides access to repositories.Constructor Options
repo(slug)
Returns a GitMorphRepo handle for the given repository.
getRepositoryInfo(slug)
Fetch metadata for a repository.
Repository object.
mirror(source, options?)
Mirror a repository from GitHub, GitLab, or another Gitea instance.
Returns
{ repository: Repository, repo: GitMorphRepo }.
grepAll(options)
Search code across all accessible repositories.
Returns
{ matches: GrepAllMatch[], total: number }.
GitMorphRepo
Per-repository operations. Obtained viagm.repo("owner/name").
readFile(path, options?)
Read a file from the repository. Optionally read only specific line ranges.
Returns
{ path, content, totalLines, lines? }.
grep(options)
Search code within the repository using server-side search.
Returns
{ matches: GrepMatch[], total: number }.
Each GrepMatch contains:
path- file pathlineNumber- line numberlineContent- the matching line (plain text)submatches- array of{ match, startOffset, endOffset }within the line
getFileContents(paths, options?)
Batch-read multiple files in a single request.
FileContentEntry | null (null for files that don’t exist). Content is automatically decoded from base64.
glob(options)
Find files matching glob patterns.
Returns
{ entries: TreeEntry[], truncated: boolean }.
listDir(options?)
List directory contents.
Returns
{ entries: ListDirEntry[], truncated: boolean }.
listBranches(options?)
List repository branches.
Branch[] with name, commit, and protected fields.
listCommits(options?)
List commits with optional filters.
Error Handling
The SDK throws typed errors for different failure modes:Types
Repository
User
CLI Reference
Thegm CLI covers repositories, issues, PRs, releases, workflows, secrets, and more. It follows the same patterns as GitHub’s gh CLI.
Repositories
Issues
Pull Requests
Code Search
Workflows & Runs
Releases
Secrets & Variables
Raw API
Configuration
Config is stored at~/.config/gm/config.json (or $GM_CONFIG_DIR/config.json).