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 🙏

© 2025 – Pkg Stats / Ryan Hefner

diff-conflict-marker

v0.1.2

Published

diff-conflict-marker is a command-line tool that reads the saved file state from `.git` and converts the `diff` into a merge-conflict marker format. This enables easier line-by-line inspection and review of changes.

Downloads

17

Readme

Diff Conflict Marker is a command-line tool that adds merge-conflict markers to a file based on the diff between the file and its version in the Git repository. This simplifies line-by-line inspection and review of changes.

Screenshot

Background

Modern development increasingly relies on AI-assisted tools like VS Code, Cursor, and others. These tools are not limited to programming—they are also used for tasks like documentation editing. However, a common risk is that AI systems can introduce unnecessary or unintended modifications. To maintain reliability, users need a mechanism to verify AI-generated edits against the existing repository state.

Diff Conflict Marker solves this problem by generating conflict markers that compare AI-generated content with the committed version in Git. This allows users to review both versions side-by-side and decide which changes to accept.

An IDE like VS Code can read the output and display the conflict markers in a user-friendly format, allowing you to browse the changes and decide which ones to keep.

Example Usage

For example, suppose you have a README.md file committed to Git. You have added the file to the Git repository.

git add README.md

You then run the following prompt in the Gemini CLI:

Fix the grammar mistakes in @README.md

The AI then applies grammar corrections. At this point, you can check the changes with git diff.

Alternatively, you can run:

diff-conflict-marker README.md

Opening the file in VS Code (or any VS Code-powered IDE) will display the AI's edits alongside the original content, formatted as merge-conflict markers. This provides a clear, line-by-line comparison, so you can confidently choose the correct version.

Screenshot

Gemini CLI

If you are using the Gemini CLI, you can combine the process above into a single custom command.

description = "Grammar Correction"

prompt = """
Act as a Senior Technical Editor. Your primary task is to review and edit a provided document for two purposes: correcting all grammatical errors and adjusting the tone to ensure it is professional, precise, and appropriate for a technical document. 

If no file content is provided, state: 'Please provide the document content to be reviewed.' 

Before editing the document, run the following command and ignore the output and error:

git add "${filename}"

After editing the document, run the following command and ignore the output and error:

diff-conflict-marker --backup "${filename}"
"""

Installation

npm install -g diff-conflict-marker

Usage

Apply Conflict Markers

diff-conflict-marker your_file

Set Original Version

diff-conflict-marker --orig README.orig.md README.md

By default, Diff Conflict Marker reads the original version from the Git repository (HEAD or the index). You can override this by providing a local file path.

Backup

When diff-conflict-marker modifies a file, you can create a backup of the original content by using the --backup flag.

diff-conflict-marker --backup your_file

This command saves a copy of your_file before adding conflict markers. The backup is stored in the same directory with a .bk extension.

If a backup file with the same name already exists, the tool will automatically rotate the existing backups by renaming them with an incremental suffix (e.g., .bk-001, .bk-002).

Development

To set up the development environment, clone this repository and install the dependencies:

npm install

Building the project

To build the project, run:

npm install
npm run build

Install locally

npm install -g .

Running tests

To run the tests, use the following command:

npm test

Linting

To lint the code, use:

npm run lint

Formatting

To format the code, run:

npm run format