npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

deep_auto_git

v1.0.0

Published

`deep_auto_git` is a powerful Node.js package designed to simplify and automate common Git operations across various Git providers like GitHub and GitLab. It provides a unified interface for interacting with different Git services, making it easier to man

Readme

deep_auto_git

deep_auto_git is a powerful Node.js package designed to simplify and automate common Git operations across various Git providers like GitHub and GitLab. It provides a unified interface for interacting with different Git services, making it easier to manage repositories programmatically.

Features

  • Unified Git Operations: Perform common Git actions (clone, pull, push, commit) through a consistent API.
  • Provider Agnostic: Supports multiple Git providers with an extensible architecture.
  • Utility Functions: Includes helpful utilities for tasks like generating unique branch names and parsing repository URLs.

Installation

To install deep_auto_git, use npm:

npm install deep_auto_git

Usage

GitProvider (Base Class)

The GitProvider class provides the core Git operations. It can be extended to support specific Git providers.

const { GitProvider } = require('deep_auto_git');

async function basicGitOperations() {
  const git = new GitProvider(); // No specific config needed for basic operations
  const repoUrl = 'YOUR_REPO_URL'; // e.g., 'https://github.com/user/repo.git'
  const destinationPath = './my-repo';

  try {
    console.log('Cloning repository...');
    await git.clone(repoUrl, destinationPath);
    console.log('Repository cloned.');

    // Change directory to the cloned repository
    process.chdir(destinationPath);

    console.log('Pulling latest changes...');
    await git.pull('.');
    console.log('Latest changes pulled.');

    // Example: Make some changes and commit
    // fs.writeFileSync('newfile.txt', 'Hello, world!');
    // await git.commit('.', 'Add newfile.txt');
    // console.log('Changes committed.');

    // console.log('Pushing changes...');
    // await git.push('.', 'main'); // Replace 'main' with your branch name
    // console.log('Changes pushed.');

  } catch (error) {
    console.error('Git operation failed:', error);
  }
}

basicGitOperations();

GithubProvider

Extend GitProvider for GitHub-specific functionalities. You would typically initialize this with a GitHub API client.

const { GithubProvider } = require('deep_auto_git');

class MyGithubProvider extends GithubProvider {
  constructor(config) {
    super(config);
    // Initialize GitHub specific API client here
    // e.g., this.githubApi = new Octokit({ auth: config.token });
  }

  async getPullRequests(repoOwner, repoName) {
    // Example: Implement GitHub specific API call
    // const response = await this.githubApi.pulls.list({ owner: repoOwner, repo: repoName });
    // return response.data;
    console.log(`Getting pull requests for ${repoOwner}/${repoName} on GitHub.`);
    return [];
  }
}

// Example Usage (requires actual GitHub API integration)
// const githubConfig = { token: 'YOUR_GITHUB_TOKEN' };
// const github = new MyGithubProvider(githubConfig);
// github.getPullRequests('octocat', 'Spoon-Knife').then(prs => console.log(prs));

GitlabProvider

Extend GitProvider for GitLab-specific functionalities. You would typically initialize this with a GitLab API client.

const { GitlabProvider } = require('deep_auto_git');

class MyGitlabProvider extends GitlabProvider {
  constructor(config) {
    super(config);
    // Initialize GitLab specific API client here
    // e.g., this.gitlabApi = new Gitlab({ host: config.host, token: config.token });
  }

  async getMergeRequests(projectId) {
    // Example: Implement GitLab specific API call
    // const response = await this.gitlabApi.MergeRequests.all(projectId);
    // return response;
    console.log(`Getting merge requests for project ID ${projectId} on GitLab.`);
    return [];
  }
}

// Example Usage (requires actual GitLab API integration)
// const gitlabConfig = { host: 'https://gitlab.com', token: 'YOUR_GITLAB_TOKEN' };
// const gitlab = new MyGitlabProvider(gitlabConfig);
// gitlab.getMergeRequests(12345).then(mrs => console.log(mrs));

Utility Functions

deep_auto_git provides several utility functions to assist with common tasks.

generateUniqueBranchName(prefix)

Generates a unique branch name using a given prefix and a timestamp.

const { generateUniqueBranchName } = require('deep_auto_git');

const branchName = generateUniqueBranchName('feature');
console.log(`Generated branch name: ${branchName}`); // e.g., feature-1678886400000

parseRepoUrl(repoUrl)

Parses a repository URL to extract provider and repository details.

const { parseRepoUrl } = require('deep_auto_git');

const githubRepoUrl = 'https://github.com/octocat/Spoon-Knife.git';
const gitlabRepoUrl = 'https://gitlab.com/gitlab-org/gitlab-foss.git';
const unknownRepoUrl = 'https://example.com/my/repo.git';

console.log(parseRepoUrl(githubRepoUrl));
// Output: { provider: 'github', owner: 'octocat', repo: 'Spoon-Knife' }

console.log(parseRepoUrl(gitlabRepoUrl));
// Output: { provider: 'gitlab', owner: 'gitlab-org', repo: 'gitlab-foss' }

console.log(parseRepoUrl(unknownRepoUrl));
// Output: { provider: 'unknown', url: 'https://example.com/my/repo.git' }

Extensibility

The modular design of deep_auto_git allows for easy extension to support additional Git providers or custom functionalities. Simply extend the GitProvider class and implement the necessary methods.

Automated Release Management

This project uses semantic-release for fully automated version management and package publishing. Releases are triggered automatically based on commit messages following the Conventional Commits specification. This ensures consistent versioning and simplifies the release process.

Testing

To run tests, execute:

npm test

Contributing

We welcome contributions! Please see our CONTRIBUTING.md for details on how to get started.