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

mds-file-committer

v1.0.0

Published

Automate versioning of a folder using Git with intelligent file purpose detection using AI or heuristics

Downloads

12

Readme

File Committer

A TypeScript class and CLI tool that automates versioning of a folder using Git with intelligent file purpose detection.

🚀 Features

  • 🚀 Automated Git Commits: Automatically commit each file individually with meaningful messages
  • 🤖 AI-Powered Purpose Detection: Use OpenAI GPT-4 to intelligently determine each file's purpose
  • 🔍 Heuristic Analysis: Fallback to language-agnostic heuristics when AI is disabled
  • 📁 Flexible Exclusions: Exclude specific paths or file patterns
  • 🌐 GitHub Integration: Automatically push to GitHub after committing
  • 🔒 Dry Run Mode: Simulate operations without making actual changes
  • 📅 Preserved Timestamps: Commit dates match file modification times
  • 🖥️ CLI Interface: Easy-to-use command line interface
  • 📦 NPM Package: Ready to install and use in any project

📦 Installation

Global Installation (CLI Usage)

npm install -g mds-file-committer

Local Installation (Programmatic Usage)

npm install mds-file-committer

🖥️ CLI Usage

Quick Start

# Commit files in current directory with basic heuristic analysis
file-committer commit --name "Your Name" --email "[email protected]"

# Dry run to see what would happen
file-committer commit --name "Your Name" --email "[email protected]" --dry-run

# Use AI for purpose detection
file-committer commit --name "Your Name" --email "[email protected]" --ai

# Push to GitHub after committing
file-committer commit --name "Your Name" --email "[email protected]" --github "username/repo"

Full CLI Options

file-committer commit [options]

Options:
  -p, --path <path>              Path to folder (default: ".")
  -n, --name <name>              Git user name
  -e, --email <email>            Git user email  
  -x, --exclude <patterns...>    Exclude patterns (default: node_modules,dist,*.log,.env)
  -d, --dry-run                  Simulate without changes
  -a, --ai                       Use AI purpose detection
  -g, --github <username/repo>   Push to GitHub
  -h, --help                     Display help

Initialize Configuration

# Create a .env file with example configuration
file-committer init

Configuration

  1. Environment Variables (optional but recommended):
# Create .env file
file-committer init

# Or manually create .env with:
OPENAI_API_KEY=your_openai_api_key_here
GIT_USER_NAME=Your Name
[email protected]
  1. CLI Flags (override environment variables):
file-committer commit --name "John Doe" --email "[email protected]"

📚 Programmatic Usage

import { FileCommitter, GitUser, FileCommitterOptions } from 'mds-file-committer';

const gitUser: GitUser = {
  name: 'Your Name',
  email: '[email protected]'
};

const options: FileCommitterOptions = {
  excludePaths: ['node_modules', '*.log', 'dist', '.env'],
  dryRun: false,
  aiPurpose: true, // Requires OPENAI_API_KEY
  githubUsername: 'your-username',
  githubRepoName: 'your-repo'
};

const committer = new FileCommitter('/path/to/your/project', gitUser, options);
await committer.commit();

🔧 Configuration

API Reference

FileCommitter

Main class for automating Git versioning.

Constructor

new FileCommitter(folderPath: string, gitUser: GitUser, options?: FileCommitterOptions)

Parameters

  • folderPath: Absolute or relative path to the folder to version
  • gitUser: Object with name and email for Git commits
  • options: Optional configuration object

Options

interface FileCommitterOptions {
  excludePaths?: string[];        // Paths/patterns to exclude
  dryRun?: boolean;              // Simulate without making changes
  githubUsername?: string;       // GitHub username for pushing
  githubRepoName?: string;       // GitHub repository name
  aiPurpose?: boolean;           // Use AI for purpose detection
}

Methods

  • commit(): Execute the full commit process

File Purpose Detection

AI-Powered (when aiPurpose: true)

Uses OpenAI GPT-4 to analyze filename and content (first 1000 characters) to determine the file's purpose.

Heuristic-Based (default)

Uses pattern matching and content analysis to detect:

  • Configuration files: package.json, *.config.js, *.yml, etc.
  • Documentation: README.md, LICENSE, *.md files
  • Test files: Files containing test, spec, or test patterns
  • Database files: Migrations, schemas, seeds
  • Source code: Components, controllers, models, services
  • Assets: Stylesheets, images, static files

Example Commit Messages

Add package.json (Package configuration and dependency management)
Add UserController.ts (Controller handling HTTP requests and responses)
Add README.md (Documentation file providing project information)
Add auth.service.ts (Service layer for business logic implementation)

Error Handling

  • Gracefully handles unreadable or binary files
  • Continues processing if individual files fail
  • Provides detailed logging with [FileCommitter] prefix
  • Falls back to heuristic analysis if AI fails

Development

# Clone and install dependencies
git clone https://github.com/mwenaro/mds-file-committer.git
cd mds-file-committer
npm install

# Build the project
npm run build

# Run tests
npm test

# Run in development mode
npm run dev

# Run examples
npm run example
npm run example:advanced

📦 Publishing to NPM

Prerequisites

  1. Create an npm account at npmjs.com
  2. Login to npm: npm login
  3. Update package.json with your details:
    • Change @your-username/file-committer to @yourusername/file-committer
    • Update author, repository URLs, etc.

Publishing Steps

# 1. Update version in package.json
npm version patch  # or minor/major

# 2. Build and test
npm run build
npm test

# 3. Publish to npm
npm publish

# 4. Install globally to test
npm install -g mds-file-committer

Automated Publishing with GitHub Actions

The package includes GitHub Actions workflow for automated testing and publishing on version tags.

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

🐛 Issues and Support

License

MIT