docmagic
v1.0.0
Published
Automate JSDoc documentation with AI-powered generation.
Downloads
73
Maintainers
Readme
DocMagic: Automate Your JSDoc Documentation with AI
DocMagic is an intelligent command-line tool designed to automatically generate high-quality JSDoc or Typedoc comments for your JavaScript and TypeScript projects. Powered by AI (Google Gemini), DocMagic simplifies the process of documenting your code with minimal effort and maximum accuracy.
🚀 Features
- AI-Powered Documentation: Generate JSDoc/Typedoc comments for your methods using Google Gemini.
- Language Support: Generate documentation in both English and Spanish.
- Customizable Documentation Length: Choose between short, medium, or long comment lengths.
- Intuitive CLI: A beautiful, easy-to-use terminal interface.
- File and Folder Support: Process individual files or entire directories of code.
- Persistence: Save your configuration preferences (API keys, file paths, language settings) for a seamless workflow.
- Safe Processing: Generates documentation without altering the original file. New
.processed.js
or.processed.ts
files are created to ensure the integrity of your code.
✨ Table of Contents
🛠️ Installation
To get started with DocMagic, you can install it globally via npm:
npm install -g docmagic
This will give you access to the docmagic
command-line tool from anywhere on your system.
⚡ Quick Start
Set up your API Key: Before using DocMagic, you need to set up your Google Gemini API Key.
docmagic set-api-key YOUR_API_KEY
Configure your workspace: Select the folder or file you want to process:
docmagic
Process files: Generate JSDoc documentation for your JavaScript or TypeScript files:
docmagic process-files
And voilà! Your code is now fully documented.
📝 Commands
Here are the primary commands available in DocMagic:
| Command | Description |
|-----------------------------|-----------------------------------------------------------------------------|
| docmagic
| Launches the interactive CLI for configuration and file processing. |
| docmagic set-api-key
| Configures the Google Gemini API key for JSDoc generation. |
| docmagic configure-files
| Select files or folders to process. |
| docmagic process-files
| Processes the selected files and generates JSDoc/Typedoc documentation. |
| docmagic configure-process
| Customizes process settings like language (English/Spanish) and comment length. |
| docmagic change-folder
| Updates the folder path for file processing. |
Updates the folder path for file processing.
⚙️ Configuration
DocMagic automatically saves your configuration preferences in a config.json
file, including:
- Google Gemini API Key: Securely stored once you set it up via the
docmagic set-api-key
command. - Workspace Folder: The path to your project folder or file.
- Language Settings: Choose between English and Spanish for your JSDoc documentation.
- Documentation Length: Set short, medium, or long comments according to your preference.
These preferences allow DocMagic to offer a smooth, customized experience.
💡 Usage Examples
Example 1: Simple File Processing
docmagic
Follow the prompts to select a file or folder and generate JSDoc documentation.
Example 2: Process All Files in a Directory
docmagic process-files
DocMagic will iterate through all the .js
and .ts
files in the directory, generating professional documentation for each.
🧠 Advanced Features
1. Google Gemini Integration
By leveraging the power of Google Gemini, DocMagic can:
- Generate highly detailed comments based on the complexity of each method.
- Understand method inputs and outputs to craft accurate parameter descriptions.
2. Configuration Persistence
You don’t need to reconfigure your settings each time. All your preferences (e.g., API Key, language, workspace) are saved locally for future use.
3. Safe Mode Processing
DocMagic generates new .processed
files instead of overwriting your original files. This ensures that your source code is not modified unexpectedly.
🌟 Why DocMagic?
- Time Saver: Automatically generates documentation for you in seconds.
- Code Quality: Improves code readability and helps onboard new developers faster.
- Intuitive UX: A command-line interface that’s both powerful and user-friendly.
- Language Flexibility: Supports both English and Spanish for documentation.
🤝 Contributing
We welcome contributions to improve DocMagic! Please follow these steps:
- Fork this repository.
- Create a new branch (
feature/your-feature
). - Commit your changes.
- Open a pull request.
For more detailed information, see our Contributing Guidelines.
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
📧 Contact
If you have any questions, suggestions, or feedback, feel free to reach out:
- Email: [email protected]
- Twitter: @docmagic
🎉 Join the Community
Stay updated on new features, tips, and best practices by joining our community:
That's it! 🎉
With DocMagic, documenting your code has never been easier or faster. Give it a try, and take your project documentation to the next level.