npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

docmagic

v1.0.0

Published

Automate JSDoc documentation with AI-powered generation.

Downloads

68

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

  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:

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

  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:


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