1.0.0 β€’ Published 9 months ago

docmagic v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

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

  1. 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

  2. Configure your workspace: Select the folder or file you want to process:

    docmagic

  3. 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:

CommandDescription
docmagicLaunches the interactive CLI for configuration and file processing.
docmagic set-api-keyConfigures the Google Gemini API key for JSDoc generation.
docmagic configure-filesSelect files or folders to process.
docmagic process-filesProcesses the selected files and generates JSDoc/Typedoc documentation.
docmagic configure-processCustomizes process settings like language (English/Spanish) and comment length.
docmagic change-folderUpdates 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:

  1. Fork this repository.
  2. Create a new branch (feature/your-feature).
  3. Commit your changes.
  4. 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: support@docmagic.com
  • 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.