Skip to content

chaturvarma/CMDCraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMDCraft

Introduction

CMDCraft is a desktop application designed to execute Command Prompt (CMD) commands based on natural language prompts. By leveraging the power of the Gemini API, it translates user-friendly requests into precise system commands to troubleshoot Windows issues, provide detailed information about a user's PC, and perform repetitive or manual tasks in a single prompt

Key Features

  • Get System Information Retrieve details about the user's PC, such as IP address, system specifications, and OS version. Example:

    "What's my IP address?"

  • Troubleshoot Windows Issues & Install Missing Tools Automatically fix common Windows problems or check and install missing dependencies. Examples:

    "Fix my Bluetooth driver" "Why am I getting an error that Python is not installed?" "Install PyTorch"

  • Command Information & Usage If a user wants to know how a command works or how to use it, the system provides detailed information and examples without executing the command. This helps users understand the command's function and syntax before running it.

  • Malicious Command Detection and Prevention 🛡️ Utilizes Sigma rules in the backend and API to detect and block malicious requests, such as "delete my c drive". This ensures the safety and integrity of the user's system.

  • Consent for Risky Operations 🚨 For commands that could lead to data loss or significant changes (e.g., deleting a folder), the system will prompt the user for explicit consent before proceeding. This acts as a crucial safety net.

  • Generate and Save Scripts 📜 Generates a bash script based on the user's request and saves it for later use. This is helpful for automating complex or repetitive tasks.

  • Execution Summary & Output Transformation For every request with commands, the system transforms the raw console output into a user-friendly format. It also provides a summary of the execution, detailing the commands used and what each command does.

  • Perform Manual Tasks Handle multi-step operations in one natural language prompt. Examples:

    "Create 100 text files in the Documents folder" "Zip all the reports in the Reports folder of Documents in C drive created between June 2025 and August 2025"

  • Automate Repetitive Tasks Carry out repetitive actions automatically without manual intervention. Examples:

    "Clear my google chrome browser cache" "Delete all windows log files"

  • Manual Debugging Steps 🛠️ For issues that cannot be fixed with commands (e.g., "why is my printer not printing"), the system provides a clear, step-by-step guide for the user to debug the problem manually.

Use Cases & Target Users

  • Non-Technical PC Users
    Resolve common computer issues and perform system tasks by simply chatting with AI — no need to learn CMD commands, call customer support, or take your PC to a repair shop.

  • System Administrators
    Automate repetitive maintenance tasks like log cleanup and cache clearing.

  • Developers
    Install dependencies, check system setup, and manage local environments with a single prompt.

  • Users with Large Manual Tasks
    Easily handle time-consuming operations — like creating and naming hundreds of files, sorting large datasets into folders, or archiving months of reports — simply by telling the AI what you need.

Tech Stack

Frontend / Desktop Application

  • PySide 6 – Used to build the GUI for the desktop application.
  • Requests – Fetches data and sends natural language prompts to backend APIs.
  • Python Subprocess – Executes CMD commands or batch scripts locally.
  • PyInstaller – Packages the Python application into a standalone .exe file for Windows distribution.

Backend

  • Node.js – Backend runtime environment.
  • Express.js – Handles API creation and routing.
  • Gemini API – Processes natural language prompts and generates CMD instructions.
  • Sigma Rules – Used for detecting malicious commands.

Tools

  • Postman – Used for testing and debugging backend APIs.

Architectural Overview

  1. CMDCraft is installed as a standalone .exe file and runs on any Windows system.
  2. The user is greeted with a chat-based interface where they type a natural language prompt describing the task or issue.
  3. The prompt is sent from the desktop application to the backend API.
  4. The backend uses the Gemini LLM API to generate an appropriate CMD command from the prompt.
  5. If the Gemini API determines that more information is required to generate an accurate command, it sends a request to the frontend to prompt the user for the necessary details.
  6. Once the additional information is provided by the user, the backend finalizes the CMD command.
  7. Before processing the request, the backend immediately checks for any malicious commands using Sigma rules. If a malicious command is detected, it is blocked to ensure the safety of the user's system.
  8. The generated command or batch script is sent back to the desktop application, which executes it locally using the Windows CMD environment.
  9. The operating system logs the output of the executed command, and the application retrieves this output.
  10. The backend processes this raw data and transforms it into a meaningful, user-friendly language, making it easy for the user to understand the result.
  11. The final result is displayed in the chat interface for the user to review.

Steps to Run

Backend Server

  • Navigate to the Backend Folder: Open your terminal or command prompt and go to the backend-server directory.
  • Configure Environment Variables: Copy the .env.sample file and rename it to .env.
  • Set API Keys: In the new .env file, replace the placeholder values for GEMINI_API_KEY and GEMINI_API_MODEL with your own API keys.
  • Set Sigma Rules: For testing purposes, you can set SIGMA_RULES to false to disable the malicious command detection. To impose the security rules, set the value to true.
  • Install Dependencies: Run npm install in the terminal to install all the required Node.js packages.
  • Run the Server: Use npm run dev to start the server in development mode, or npm run start to run it in production.

Desktop Application

  • For Development and Testing:

    • Navigate to the desktop-app directory.
    • Copy the .env.sample file and rename it to .env. In the new .env file, set API_ENDPOINT to your backend API's URL. If you are running the backend locally, you can keep the default value.
    • Run pip install -r requirements.txt to install all the necessary Python packages.
    • Execute the command python main.py. The desktop application will open as a new window.
  • For Direct Testing:

    • The CMDCraft.exe file is available in the root folder.
    • Simply run CMDCraft.exe to launch the application.
    • This executable uses http://localhost:5000 as the backend API URL by default, so ensure your backend server is running locally on that port.

(Optional) Testing Backend APIs with Postman

  • To import the Postman collection, locate and import the provided CMDCraft.postman_collection.json file from the root directory into your Postman workspace.
  • Select an API from the collection and open its Body tab (set to raw JSON). The collection already includes a sample input JSON that you can modify to suit your test case.
  • You can keep the live deployment URL (for testing the Render-hosted API) or replace it in the Postman request with: http://localhost:5000/ if you are running the backend locally.

About

AI agent to generate and execute CMD/PowerShell commands for Windows automation and troubleshooting

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors