Skip to main content
Git operations for managing repositories. Push automatically triggers code embedding for semantic search (see Semantic Search).

Installation

npm install @morphllm/morphsdk

Quick Start

import { MorphClient } from '@morphllm/morphsdk';

const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });

// Initialize repo
await morph.git.init({
  repoId: 'my-project',
  dir: './my-project'
});

// Make changes, then commit
await morph.git.add({ dir: './my-project', filepath: '.' });
await morph.git.commit({
  dir: './my-project',
  message: 'Add feature'
});

// Push (triggers code embedding in background, 3-8s)
await morph.git.push({ dir: './my-project' });
Push automatically triggers code embedding for semantic search. After 3-8 seconds, your code is searchable. See Semantic Search for search usage.

Git Operations

All standard Git operations are supported. Push automatically triggers code embedding for semantic search.
// Initialize
await morph.git.init({ repoId: 'my-project', dir: './my-project' });

// Clone
await morph.git.clone({ repoId: 'my-project', dir: './local-copy' });

// Stage and commit
await morph.git.add({ dir: './my-project', filepath: '.' });
await morph.git.commit({ dir: './my-project', message: 'Add feature' });

// Push (triggers code embedding in background)
await morph.git.push({ dir: './my-project' });

// Check status
const files = await morph.git.statusMatrix({ dir: './my-project' });
files.forEach(f => console.log(f.filepath, f.status));

// Get history
const commits = await morph.git.log({ dir: './my-project', depth: 10 });

// Branch operations
await morph.git.branch({ dir: './my-project', name: 'feature-branch' });
const branches = await morph.git.listBranches({ dir: './my-project' });
const current = await morph.git.currentBranch({ dir: './my-project' });

// Checkout
await morph.git.checkout({ dir: './my-project', ref: 'main' });

Git Methods

MethodDescription
init(options)Initialize new repository
clone(options)Clone existing repository
add(options)Stage file for commit
commit(options)Commit staged changes
push(options)Push to remote (triggers code embedding)
pull(options)Pull from remote
status(options)Get file status
statusMatrix(options)Get all file statuses
log(options)Get commit history
checkout(options)Checkout branch or commit
branch(options)Create new branch
listBranches(options)List all branches
currentBranch(options)Get current branch name
resolveRef(options)Get commit hash for ref

Code Embedding

When you push code, Morph automatically embeds it for semantic search. This happens in the background and takes 3-8 seconds. Once complete, you can search your codebase using natural language queries. See Semantic Search for search functionality.