docuforge
v1.1.4
Published
Docuforge is a simple and efficient command-line tool (CLI) for automating documentation generation for any software project, regardless of the programming language or technology stack used.
Downloads
95
Readme
Docuforge
Docuforge is a simple and efficient command-line tool (CLI) for automating documentation generation for any software project, regardless of the programming language or technology stack used.
Features
- Automatic Documentation Generation: Docuforge allows developers to generate up-to-date and accessible documentation directly from the project's code structure.
- Language Agnostic: The tool is compatible with any programming language, ensuring flexibility and efficiency in any development environment.
- File/Directory Exclusion: Ability to configure the exclusion of certain files or directories from documentation generation.
- CLI Execution: Easy-to-use command-line interface for generating documentation with just a few commands.
- OpenAI Integration: Utilizes the OpenAI API to generate detailed and accurate descriptions of the project's files and directories.
- Ollama Integration: Supports integration with the Ollama API for generating documentation, providing an alternative to OpenAI.
- Intelligent Regeneration: Docuforge only regenerates documentation when changes are detected in the code, and it specifically targets only the modified files, saving time and resources.
- Automatic Deletion of Documentation: Docuforge automatically deletes documentation for files that have been removed from the project, keeping the documentation structure always updated according to the original project.
Project Origin
This project is a fork of codocx, an original documentation generation tool. Docuforge was developed based on this project, expanding its functionalities and adapting it to meet specific needs.
Setting Up Husky (Optional)
To automatically update documentation with each commit, you can set up Husky by following these steps:
Install Husky as a development dependency:
yarn add -D husky
Or using npm:
npm install --save-dev husky
Initialize Husky:
npx husky-init
Create a script in your
package.json
calledgen-docs
:{ "scripts": { "gen-docs": "docuforge" } }
Edit the
.husky/pre-commit
file to include the following:#!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" yarn gen-docs if [ -n "$(git status docs --porcelain)" ]; then git add docs fi
This setup will ensure that documentation is generated and updated automatically every time you make a commit.
Overview
Documentation is essential, but often neglected. Docuforge solves this problem by allowing developers to generate up-to-date and accessible documentation with just a few commands. The tool is compatible with any programming language, ensuring flexibility and efficiency in any development environment.
Running via CLI
The Docuforge CLI is designed to be extremely easy to use, allowing documentation generation directly from your project's code structure.
How to Use the CLI
Install the CLI globally:
npm install -g docuforge
or
yarn global add docuforge
Generate the documentation:
Navigate to your project directory and run:
docuforge -p <DIR_PROJECT>
You can replace
<DIR_PROJECT>
with the path to your project directory. If you don't provide a path, the CLI will use the current directory.
Ignoring Files
To exclude certain files or directories from documentation generation, simply create a .dcfignore
file and list the files and folders you want to ignore inside it. The tool will automatically ignore them. Additionally, there is a default list of ignored paths located in the src/constants/index.ts
file.
Using Ollama instead of OpenAI
To use the Ollama API for documentation generation instead of OpenAI, you can specify the --ollama-mode
option when running the CLI. Additionally, you can set the Ollama base URL and model using the --ollama-base-url
and --ai-model
options, respectively. Here’s an example command:
docuforge --ollama-mode --ollama-base-url http://localhost:11434/api --ai-model llama3
By default, the Ollama API is used with the llama3
model, and the --ollama-base-url
option is set to http://localhost:11434/api. You can change the model by setting the --ai-model
option to the desired model, and you can also specify a different base URL if needed.
Requirements
Before you begin, make sure your machine meets the following requirements:
- Node.js (version 14 or higher)
- npm (Node.js package manager)
How to Run the Project Manually
If you prefer to run Docuforge locally, follow these steps:
Clone the repository:
git clone <REPOSITORY_URL> cd docuforge
Install dependencies:
npm install
Start the project:
npm start
Contributing
Contributions are welcome! If you wish to contribute to Docuforge, follow these steps:
Fork the repository.
Create a branch for your feature or bug fix:
git checkout -b my-new-feature
Make your changes and commit:
git commit -m "Add new feature"
Push to the remote repository:
git push origin my-new-feature
Open a Pull Request.
Please ensure that your contributions comply with the project's code of conduct.
License
This project is licensed under the MIT License. See the LICENSE file for more information.