summarizer-cli
Version:
CLI tool to summarize functions or whole file using LLM
87 lines (59 loc) โข 3.22 kB
Markdown
# ๐ Summarizer CLI
#### Instantly summarize code files, functions, or custom prompts using LLM โ right from your terminal. Whether you're reviewing unfamiliar codebases, writing documentation, onboarding new developers, or just need a quick overview of complex logic, Summarizer CLI is your AI-powered assistant. It works with full files or extracts specific functions on demand, and can even handle free-form prompt instructions. With beautifully formatted CLI output and optional export to Markdown, txt, or JSON files, this tool saves hours of reading and guessing. Simple, blazing fast, and developer-friendly โ perfect for individuals, teams, and code reviewers alike.
## โจ Features
* โ
Summarize any functions, text or full files
* โ
Extract and summarize specific functions from a file
* โ
Beautiful CLI output with syntax highlighting
* โ
Option to export summaries to `.md`, `.txt`, or `.json` in a `./summaries/` folder
* โ
LLM-powered, fast and accurate summaries
## ๐ Usage
### ๐น Summarize a Prompt
```bash
summarizer "Summarize what the login function in auth.js does" --apikey your_gemini_key
```
### ๐น Summarize a Full File
```bash
summarizer -f ./utils/auth.js [PROMPT] --apikey your_gemini_key
summarizer --file ./utils/auth.js --apikey your_gemini_key
```
### ๐น Summarize a Specific Function
```bash
summarizer -f ./src/utils/auth.js -n loginHandler [PROMPT] --apikey your_gemini_key
```
### ๐น Save Output to File
```bash
summarizer -f ./src/utils/utils.js --save --apikey your_gemini_key # (saves in .md by default)
```
### ๐น Save in Custom Format
```bash
summarizer -f ./src/utils.js --save --format txt --apikey your_gemini_key
summarizer "Summarize OTP validation flow" --save --format json --apikey your_gemini_key
```
> ๐ All saved summaries are stored inside the `./summaries/` folder.
## ๐งพ Options
| Option | Description |
| ----------------- | -------------------------------------------------------------- |
| `[prompt]` | Free-form prompt to generate a summary |
| `-f, --file` | Path to a file to summarize |
| `-n, --function` | Name of the function to extract and summarize (requires `-f`) |
| `--save` | If provided, saves the summary to the `./summaries/` directory |
| `--format <type>` | Output format: `md`, `txt`, or `json` (used with `--save`) |
| `--apikey <apikey>` | API key for summary generation using LLM |
## ๐ง Output Example
```bash
๐ Summary:
๐ Function: sendPasswordResetEmail
โข Sends an email with a one-time password (OTP)
โข Uses sendEmail() helper
โข Logs any errors that occur
๐ Function: getAllConversationSummaries
โข Retrieves summaries from database
โข Calls AI service if summaries are missing
โข Filters visible conversations
โข Returns JSON response
```
## ๐ง Output Example (Snapshot)
