UNPKG

summarizer-cli

Version:

CLI tool to summarize functions or whole file using LLM

87 lines (59 loc) โ€ข 3.22 kB
# ๐Ÿš€ 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) ![CLI Example Snapshot](https://github.com/YashLoriya02/npm-summarizer-cli/blob/main/image-1.png)