ohmyfix
A CLI tool to fix or generate code in files with AI, featuring theme selection and shortcuts
A powerful, AI-driven CLI tool to enhance your coding experience. Fix JavaScript errors, generate code from comments, resolve dependency conflicts, and boost productivity with a customizable UI and oh-my-zsh-inspired shortcuts!
-
AI Code Review
: Automatically fixes errors in all JavaScript.js
files in your project (ohmyfix ai
). -
Dependency Conflict Checker
: Scanspackage.json
for version mismatches (ohmyfix depfix
). -
Interactive Theme Selection
: Choose from 4 themes (Dark, Pookie Pink, Nord, Solarized) on first run, saved toohmyfix.config.json
. -
Code Snippets
: Suggests reusable JavaScript snippets based on your codebase (ohmyfix snippets
). -
Real-Time Linting
: Flags JavaScript-specific issues like uncommentedconsole.log
or missing semicolons (ohmyfix lint
). -
Debug Helper
: Provides AI-powered debugging steps for any error message (ohmyfix debug
). -
Shortcuts
: Manage oh-my-zsh-style aliases for JavaScript coding (ohmyfix shortcuts
). -
Snippet Fixer
: Fixes errors in pasted code snippets for any language (e.g., Python, Java) (ohmyfix snippetfix
). -
File-Specific Fix/Generate
:ohmyfix <file> --shortcut
fixes JavaScript errors or generates code based on a top comment, overwriting the file. -
Customizable UI
: Toggle between compact or detailed prompts and switch themes viaohmyfix.config.json
.
-
Node.js
: 18.x or higher (tested with 22.13.0). -
npm
: Latest version (npm install -g npm
). -
Google Generative AI API Key
: Obtain from Google Maker Suite.
Install globally via npm:
npm install -g ohmyfix
Run OhMyFix:
ohmyfix
On first run, select a theme (e.g., Dark, Pookie Pink). This is saved to ohmyfix.config.json
.
Set Up API Key:
ohmyfix setup
Enter your Google Generative AI API key (starts with AI). Saved to .env
.
Run without arguments to access the main menu:
ohmyfix
Choose from options like "Fix dependency conflicts" or "Fix Selected Snippet".
Fix errors or generate code in a specific file:
ohmyfix hello.js --shortcut
- If
hello.js
contains valid JavaScript, it fixes syntax errors. - If not, or if it lacks a comment, it adds
// Generate code based on this comment
and generates code accordingly. - Overwrites
hello.js
with the result.
-
ohmyfix ai
: AI-powered review and fix for all.js
files. -
ohmyfix setup
: Configure your Google API key. -
ohmyfix snippets
: Suggest reusable code snippets. -
ohmyfix lint
: Lint your JavaScript codebase. -
ohmyfix debug
: Get debugging suggestions. -
ohmyfix shortcuts
: Manage productivity shortcuts. -
ohmyfix snippetfix
: Fix a pasted code snippet in any language.
hello.js (before):
// Generate a simple webpage
<!DOCTYPE html>
Run:
ohmyfix hello.js --shortcut
Output:
// Generate a simple webpage
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Simple Webpage</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>
✓ hello.js
has been updated with generated code!
hello.js (before):
// Log a greeting
conole.log("Hi"
Run:
ohmyfix hello.js --shortcut
Output:
// Log a greeting
console.log("Hi");
✓ hello.js
has been updated with generated code!
hello.js (before):
(empty)
Run:
ohmyfix hello.js --shortcut
Output:
// Generate code based on this comment
console.log("Generated code based on comment");
✓ hello.js
has been updated with generated code!
Edit ohmyfix.config.json
to customize:
{
"theme": "pookiepink",
"promptStyle": "compact",
"shortcuts": {
"log": "console.log"
}
}
-
theme
:dark
,pookiepink
,nord
, orsolarized
. -
promptStyle
:detailed
(default) orcompact
. -
shortcuts
: Add custom aliases.
-
"theme.gray is not a function"
: Ensure you’re using version 1.0.8 or higher (npm install -g ohmyfix
). -
"No Google API key"
: Runohmyfix setup
and provide a valid key. -
"File not found"
: Verify the file exists in the current directory. -
Unexpected output
: Add a clear comment (e.g.,// Generate a calculator app
) to guide the AI.
- Fork the repository: github.com/thedvlprguy/ohmyfix.
- Create a feature branch (
git checkout -b feature/new-thing
). - Commit changes (
git commit -m "Add new thing"
). - Push to the branch (
git push origin feature/new-thing
). - Open a Pull Request.
MIT © thedvlprguy tejsvapandey keertikayo Rounakag16
- Powered by Google Generative AI.
- Built with Node.js, Chalk, and Clack Prompts.