Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 64 additions & 110 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@

---

# PKG NAME📘: `devDocs` – AI-powered automated project documentation writer
# 📘 `devDocs` – AI-Powered README Generator

`devDocs` is a **command-line tool** that automatically creates high-quality `README.md` files by analyzing your project’s **folder structure**, **source code**, and any existing documentation. It uses the **Google Gemini API** to generate clear, structured, and professional Markdown documentation.
`devDocs` is a command-line tool that automatically generates clean, professional `README.md` files by analyzing your **project structure**, **source code**, and any **existing documentation**.

Perfect for:
Powered by the **Google Gemini API**, it's ideal for:

* Open-source contributors 💡
* Developers maintaining internal tools 🛠️
* Hackathon projects needing clean docs fast 🚀
* 💡 Open-source contributors
* 🛠️ Internal dev tools
* 🚀 Hackathon projects needing docs fast

---

## 📂 Example Project Structure
## 📂 Example Project Layout

Here’s how your project might look before and after using `devDocs`:
Before and after running `devDocs`:

```bash
your-project/
Expand All @@ -25,30 +25,29 @@ your-project/
├── tests/
├── requirements.txt
├── LICENSE
└── README.md <-- Generated/Overwritten by devDocs
├── docs/ # ← Generated by devDocs
└── README.md # ← Overwritten by devDocs (if chosen)
```

---

## ⚙️ How It Works (Behind the Scenes)
## ⚙️ How It Works

Here's what happens when you run `devDocs`:
1. **Scans** project directory and source files
2. **Parses** content (code, comments, old README)
3. **Generates** documentation via Google Gemini
4. **Saves** output in Markdown format

1. **Scans your project** – Analyzes directory structure, code files, and existing README files.
2. **Parses content** – Gathers code and documentation from each relevant file/folder.
3. **Generates documentation** – Sends context to Google Gemini API to craft a structured `README.md`.
4. **Saves output** – Writes the generated Markdown into your project (or into a custom output folder).
### Optional Features

🔁 Optional features:

* Preserves your original README unless you use `--overwrite`.
* Includes/excludes specific files or folders with filters.
* Preserve existing README (unless `--overwrite` is set)
* Include/exclude specific files or folders via filters

---

## 📦 Installation

Install from PyPI:
Install via pip:

```bash
pip install devDocs
Expand All @@ -58,128 +57,84 @@ pip install devDocs

## 🔑 Requirements

* **Python 3.8+**
* **Google Gemini API Key**
Get one from [Google AI Studio](https://aistudio.google.com/).
* Python 3.8+
* Google Gemini API Key (get one at [Google AI Studio](https://aistudio.google.com/))

---

## 🚀 Usage

Inside the root folder of your project, run:
Run inside your project’s root:

```bash
devDocs [OPTIONS]
```

The CLI will prompt for your **Google Gemini API key**. Paste it once when asked.
Paste your **Gemini API key** when prompted.

### CLI Options

| Option | Description |
| --------------- | ------------------------------------------------------------- |
| `--path` | Root path to scan (default: current directory) |
| `--name` | Project name to display in the README |
| `--description` | Short description for the project |
| `--authors` | Comma-separated list of authors |
| `--keywords` | Comma-separated list of keywords (e.g., cli, docs, auto) |
| `--overwrite` | Overwrite existing `README.md` files (default: False) |
| `--output` | Output folder to save generated docs (default: `docs/`) |
| `--exclude` | Comma-separated folders/files/extensions to **exclude** |
| `--include` | Comma-separated folders/files/extensions to **force include** |
| Option | Description |
| --------------- | ------------------------------------------------- |
| `--path` | Root folder to scan (default: `.`) |
| `--name` | Project name to display in the README |
| `--description` | Short project summary |
| `--authors` | Comma-separated list of authors |
| `--keywords` | Comma-separated keywords (e.g., cli, docs, ai) |
| `--overwrite` | Overwrite existing `README.md` (default: False) |
| `--output` | Output folder (default: `docs/`) |
| `--exclude` | Comma-separated paths/extensions to exclude |
| `--include` | Comma-separated paths/extensions to force include |

---

### ✅ Example Command
### ✅ Example

```bash
devDocs --path . \
--name "Cool Dev Tool" \
--description "Generate AI-based READMEs effortlessly" \
--authors "Gantavya Bansal" \
--keywords "cli, docs, automation, openai" \
--keywords "cli, docs, automation" \
--output docs \
--overwrite
```

This will:

* Walk through all folders from current directory
* Create a `docs/README.md` and other structured markdowns
* Overwrite existing README if one exists

---

## 🧠 Features
## 🧠 Key Features

* ✅ Generates structured, professional `README.md` files automatically
* ✅ Preserves original docs unless `--overwrite` is set
* ✅ Supports **include/exclude** filtering for granular control
* ✅ Smart project tree visualization included in docs
* ✅ Outputs all documentation to a single folder (`--output`)
* ✅ Powered by Google Gemini AI (clean & readable Markdown)
✅ Auto-generates structured `README.md`
✅ Respects original files unless `--overwrite`
✅ Fine-grained include/exclude control
✅ Generates a visual folder tree
✅ Clean output in a dedicated `--output` folder
✅ Backed by Google Gemini for high-quality results

---

## 🏗️ Example Output (Generated)

Here’s a sample snippet of what the generated README might look like:

```
# Cool Dev Tool

This is a CLI tool for generating clean README.md files using Google Gemini.

## Folder Structure
your-project/
├── src/
│ ├── main.py
│ └── utils.py
├── README.md
...
## 🧱 Tech Stack

## Usage
...
```

---

## 🧱 Technologies Used

* `Python 3.8+`
* Python 3.8+
* [`google-genai`](https://pypi.org/project/google-generativeai/)
* `argparse`, `os`, `logging`, `time` – for CLI and system interaction
* Built-in: `argparse`, `os`, `logging`, `time`

---

## 🧰 Developer Notes

If you're contributing or extending this project:
## 🛠️ Dev Notes

### Core Files
### Workflow

| File | Purpose |
| ------------------ | ----------------------------------------------- |
| `cli.py` | CLI interface + core logic |
| `README.md` | The README template output (can be regenerated) |
| `LookFolder()` | Recursive folder/file scanner |
| `GenerateReadMe()` | Sends data to Gemini and processes results |
| `print_tree()` | Generates folder structure view in tree format |

### Data Flow

1. CLI parses args →
2. Filters folders/files →
3. Reads source + existing docs →
4. Calls `GenerateReadMe()` →
5. Writes Markdown to output
```
CLI args → Filter files → Extract context → Call Gemini → Write docs
```

### API Instruction Logic (Simplified)
### API Prompt Template

```python
system_instruction = '''
You are Gantavya Bansal, a senior engineer and tech writer.
Generate clean, professional Markdown documentation using code + structure context.
You are Gantavya Bansal, a senior engineer and technical writer.
Generate professional Markdown documentation using context from code and folder structure.
Include:
- Title
- Folder Tree
Expand All @@ -193,25 +148,24 @@ Include:

---

## ⚠️ Known Limitations
## ⚠️ Limitations

* 📡 Needs an internet connection for Gemini API
* 🔁 Limited retry logic for failed API calls
* ⚙️ Include/exclude filters don't yet support regex
* 📄 Only supports `.md` output format
* 📶 Requires internet (for Gemini API)
* 🔁 Retry logic for failed API calls is minimal
* ❌ Regex not yet supported in filters
* 📄 Only outputs `.md` format (Markdown)

---

## 📜 License

**MIT License** – You’re free to use, modify, and share.
Attribution is appreciated!
Released under the **MIT License**. Use, modify, and share freely — attribution appreciated.

---

## 💬 Contributing
## 🤝 Contribute

Feel free to open issues, suggest improvements, or contribute directly.
Pull requests are always welcome!
Found a bug or have an idea?
Open an issue or submit a PR — contributions are always welcome!

---
---
Loading
Loading