/bolt.new-ai-integrations

Bolt.new AI and Mercurial integration: Step-by-Step Guide 2025

Discover a step-by-step guide to integrating Bolt.new AI with Mercurial for seamless automation and improved code management in your development workflow.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to integrate Bolt.new AI with Mercurial?

 

Integrating Mercurial with Your Bolt.new AI Project

 
  • Create or update your package.json file to include the Mercurial dependency.

In your project’s root, open (or create) the package.json file and add the following lines inside the "dependencies" section to install the node-hg package. (This package allows your TypeScript code to run Mercurial commands.)


{
  "name": "bolt-ai-project",
  "version": "1.0.0",
  "dependencies": {
    "node-hg": "latest"
  }
}
  • No terminal is available in Bolt.new AI, so adding this code ensures the dependency is installed during project build.

 

Creating the Mercurial Integration Module

 
  • Create a new file in your project’s root directory called mercurialIntegration.ts. This file will contain functions that wrap common Mercurial commands.
  • Paste the following TypeScript code into mercurialIntegration.ts:

import { exec } from 'child_process';

export function hgStatus(repoPath: string): Promise<string> {
  return new Promise((resolve, reject) => {
    exec('hg status', { cwd: repoPath }, (error, stdout, stderr) => {
      if (error) {
        reject(Error fetching status: ${stderr});
      } else {
        resolve(stdout);
      }
    });
  });
}

export function hgCommit(repoPath: string, message: string): Promise<string> {
  return new Promise((resolve, reject) => {
    exec(hg commit -m "${message}", { cwd: repoPath }, (error, stdout, stderr) => {
      if (error) {
        reject(Error committing changes: ${stderr});
      } else {
        resolve(stdout);
      }
    });
  });
}

export function hgPush(repoPath: string): Promise<string> {
  return new Promise((resolve, reject) => {
    exec('hg push', { cwd: repoPath }, (error, stdout, stderr) => {
      if (error) {
        reject(Error pushing changes: ${stderr});
      } else {
        resolve(stdout);
      }
    });
  });
}
  • This module uses Node.js’s built-in child_process to execute Mercurial commands on your repository located at the specified path.

 

Integrating Mercurial Functions in Your Main Application Code

 
  • Open your main application file (for example, index.ts or app.ts).
  • Import and use the functions from mercurialIntegration.ts to perform Mercurial operations. Insert the following code where you need version control actions:

import { hgStatus, hgCommit, hgPush } from './mercurialIntegration';

// Replace with the absolute or relative path to your repository folder
const repoPath = '/path/to/your/mercurial/repository';

async function performMercurialOperations() {
  try {
    const status = await hgStatus(repoPath);
    console.log('Mercurial Status:', status);

    // Commit changes with a custom message
    const commitResult = await hgCommit(repoPath, 'Automated commit from Bolt.new AI');
    console.log('Commit Result:', commitResult);

    // Push the committed changes to the remote repository
    const pushResult = await hgPush(repoPath);
    console.log('Push Result:', pushResult);
  } catch (error) {
    console.error('An error occurred:', error);
  }
}

// Call this function at the appropriate time in your application workflow
performMercurialOperations();
  • This code imports the Mercurial integration functions and uses them to check the repository status, commit changes, and push updates. Adjust repoPath to point to your Mercurial repository location.

 

Finalizing Your Setup

 
  • Ensure all your files are saved in the Bolt.new AI project.
  • No terminal commands are required because dependency installation will occur automatically during the project build process.
  • Test your project by running it through the Bolt.new AI interface. The console output should display the Mercurial operation results.

 

Using and Extending Integration

 
  • You can add additional Mercurial operations by following the pattern demonstrated in the mercurialIntegration.ts file.
  • Adjust function calls in your main file as needed to integrate version control seamlessly with your application workflow.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022