@ridit/lens 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LENS.md CHANGED
@@ -1,68 +1,32 @@
1
- # Lens - Codebase Intelligence Tool
2
-
3
- Lens is a CLI tool that helps developers understand, navigate, and interact with codebases using AI-powered analysis.
4
-
5
- ## Core Features
6
-
7
- - **Repository Analysis**: Analyze both local and remote repositories
8
- - **AI-Powered Insights**: Uses LLMs to understand code structure and content
9
- - **Interactive Chat**: Converse with your codebase using natural language
10
- - **Code Review**: Automated code reviews with specific suggestions
11
- - **Timeline Exploration**: Explore commit history and code evolution
12
- - **Task Automation**: Apply natural language changes to codebases
13
-
14
- ## Supported AI Providers
15
-
16
- - Anthropic
17
- - Gemini (Google AI)
18
- - OpenAI
19
- - Ollama (local models)
20
- - Custom endpoints
21
-
22
- ## Technical Architecture
23
-
24
- - Built with React components rendered in terminal via Ink
25
- - TypeScript throughout for type safety
26
- - Bun as build tool and runtime
27
- - Commander.js for CLI structure
28
- - Modular command system with separate handlers
29
-
30
- ## Commands
31
-
32
- - `lens repo <url>` - Analyze a remote repository
33
- - `lens review [path]` - Review a local codebase
34
- - `lens task <text>` - Apply natural language changes
35
- - `lens chat` - Interactive chat with codebase
36
- - `lens timeline` - Explore commit history
37
- - `lens provider` - Configure AI providers
38
-
39
- ## Key Components
40
-
41
- - **Smart File Selection**: AI determines which files are most important
42
- - **Structured Analysis**: Provides overviews, folder insights, and suggestions
43
- - **Security Scanning**: Identifies potential security issues
44
- - **Multi-Model Support**: Flexible AI backend configuration
45
-
46
- ## Installation
47
-
48
- ```bash
49
- npm install -g @ridit/lens
50
- ```
51
-
52
- ## Usage
53
-
54
- ```bash
55
- # Analyze a GitHub repository
56
- lens repo https://github.com/user/repo
57
-
58
- # Review local codebase
59
- lens review .
60
-
61
- # Chat with your code
62
- lens chat --path .
63
-
64
- # Make changes with natural language
65
- lens task "Add TypeScript types to this component" --path .
66
- ```
67
-
68
- Lens helps developers quickly understand complex codebases through AI-assisted analysis and natural language interaction.
1
+ # Lens Analysis
2
+ > Generated: 2026-03-21T11:15:38.543Z
3
+
4
+ ## Overview
5
+ Lens is a CLI tool built with React components rendered in the terminal via Ink, designed to help developers understand, navigate, and interact with codebases using AI-powered analysis. The tool provides repository analysis, AI-powered insights, interactive chat, code review, timeline exploration, and task automation capabilities. Key components include ChatRunner for interactive conversations, RepoAnalysis for repository examination, and various command handlers like ReviewCommand and TaskCommand. The project uses Bun as a build tool and runtime, with Commander.js for CLI structure and TypeScript throughout for type safety.
6
+
7
+ ## Important Folders
8
+ - src/components: Contains core UI components like ChatRunner (handles interactive chat), RepoAnalysis (analyzes repositories), DiffViewer (shows code differences), and ProviderPicker (selects AI providers). These components use Ink for terminal rendering and provide the main user interface.
9
+ - src/commands: Implements all CLI commands including repo (analyze remote repositories), review (local codebase analysis), task (apply natural language changes), chat (interactive conversation), timeline (commit history exploration), and commit (smart commit message generation).
10
+ - src/utils: Contains utility functions for AI integration (ai.ts), chat processing (chat.ts), configuration management (config.ts), file operations (files.ts), git operations (git.ts), memory management (memory.ts), and thinking animations (thinking.tsx).
11
+ - src/tools: Provides various tool implementations including files (file operations), shell (command execution), web (URL fetching), pdf (PDF generation), and git (version control operations). These tools are used throughout the chat functionality.
12
+
13
+ ## Missing Configs
14
+ - ESLint configuration: The project uses TypeScript but lacks an ESLint config file (.eslintrc.js or eslint.config.js) for code quality enforcement
15
+ - Testing setup: No test framework configuration (Jest/Vitest) or test files found, which is important for a developer tool of this complexity
16
+ - GitHub Actions CI/CD: Missing workflow files for automated testing and deployment, which would help maintain quality for a CLI tool
17
+
18
+ ## Security Issues
19
+ - In src/utils/chat.ts: The parseResponse function uses regex-based XML parsing which could be vulnerable to injection attacks if malformed responses are processed
20
+ - In src/utils/repo.ts: The cloneRepo function uses exec() with user-provided URLs without proper sanitization, potentially allowing command injection
21
+ - In multiple files: API keys and sensitive information are handled without encryption in config files stored in ~/.lens directory
22
+
23
+ ## Suggestions
24
+ - In src/utils/chat.ts: Replace regex-based XML parsing with a proper XML parser library to prevent injection vulnerabilities and improve reliability
25
+ - In src/utils/repo.ts: Use execFile with proper argument sanitization instead of exec() for git operations to prevent command injection attacks
26
+ - In src/utils/config.ts: Implement encryption for storing API keys in the config file rather than plaintext storage
27
+ - In src/components/chat/ChatRunner.tsx: Add pagination or virtualization for long chat histories to improve performance with many messages
28
+ - In package.json: Add linting and testing scripts to establish better code quality practices for the project
29
+
30
+ <!--lens-json
31
+ {"overview":"Lens is a CLI tool built with React components rendered in the terminal via Ink, designed to help developers understand, navigate, and interact with codebases using AI-powered analysis. The tool provides repository analysis, AI-powered insights, interactive chat, code review, timeline exploration, and task automation capabilities. Key components include ChatRunner for interactive conversations, RepoAnalysis for repository examination, and various command handlers like ReviewCommand and TaskCommand. The project uses Bun as a build tool and runtime, with Commander.js for CLI structure and TypeScript throughout for type safety.","importantFolders":["src/components: Contains core UI components like ChatRunner (handles interactive chat), RepoAnalysis (analyzes repositories), DiffViewer (shows code differences), and ProviderPicker (selects AI providers). These components use Ink for terminal rendering and provide the main user interface.","src/commands: Implements all CLI commands including repo (analyze remote repositories), review (local codebase analysis), task (apply natural language changes), chat (interactive conversation), timeline (commit history exploration), and commit (smart commit message generation).","src/utils: Contains utility functions for AI integration (ai.ts), chat processing (chat.ts), configuration management (config.ts), file operations (files.ts), git operations (git.ts), memory management (memory.ts), and thinking animations (thinking.tsx).","src/tools: Provides various tool implementations including files (file operations), shell (command execution), web (URL fetching), pdf (PDF generation), and git (version control operations). These tools are used throughout the chat functionality."],"missingConfigs":["ESLint configuration: The project uses TypeScript but lacks an ESLint config file (.eslintrc.js or eslint.config.js) for code quality enforcement","Testing setup: No test framework configuration (Jest/Vitest) or test files found, which is important for a developer tool of this complexity","GitHub Actions CI/CD: Missing workflow files for automated testing and deployment, which would help maintain quality for a CLI tool"],"securityIssues":["In src/utils/chat.ts: The parseResponse function uses regex-based XML parsing which could be vulnerable to injection attacks if malformed responses are processed","In src/utils/repo.ts: The cloneRepo function uses exec() with user-provided URLs without proper sanitization, potentially allowing command injection","In multiple files: API keys and sensitive information are handled without encryption in config files stored in ~/.lens directory"],"suggestions":["In src/utils/chat.ts: Replace regex-based XML parsing with a proper XML parser library to prevent injection vulnerabilities and improve reliability","In src/utils/repo.ts: Use execFile with proper argument sanitization instead of exec() for git operations to prevent command injection attacks","In src/utils/config.ts: Implement encryption for storing API keys in the config file rather than plaintext storage","In src/components/chat/ChatRunner.tsx: Add pagination or virtualization for long chat histories to improve performance with many messages","In package.json: Add linting and testing scripts to establish better code quality practices for the project"],"generatedAt":"2026-03-21T11:15:38.543Z"}
32
+ lens-json-->
package/README.md CHANGED
@@ -0,0 +1,91 @@
1
+ # Lens
2
+
3
+ Lens is an AI-powered CLI tool that lets you explore, understand, and modify any codebase through natural language. Built with React and Ink for a rich terminal UI, Lens connects to multiple LLM providers and gives the AI direct access to your filesystem, shell, and the web.
4
+
5
+ ## Features
6
+
7
+ - **Chat with your codebase** — ask questions, request changes, scaffold new files
8
+ - **Multi-provider support** — Anthropic, OpenAI, Gemini, Ollama, or any OpenAI-compatible API
9
+ - **Tool system** — AI can read/write files, run shell commands, fetch URLs, search the web, clone repos, generate PDFs, and more
10
+ - **Plugin registry** — extend Lens with custom tools via `@ridit/lens-sdk`
11
+ - **Diff preview** — proposed code changes are shown as a diff before applying
12
+ - **Auto-approve mode** — `/auto` skips confirmation for safe read/search tools
13
+ - **Force-all mode** — `/auto --force-all` approves everything including shell and writes
14
+ - **Persistent memory** — Lens remembers project-specific context across sessions
15
+ - **Chat history** — save, load, rename, and delete chat sessions per repo
16
+ - **Smart commits** — generate conventional commit messages from staged changes
17
+ - **Timeline** — browse and explore commit history
18
+ - **Repo analysis** — deep codebase review from a remote URL or local path
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ # using bun
24
+ bun add @ridit/lens -g
25
+
26
+ # using npm
27
+ npm install -g @ridit/lens
28
+ ```
29
+
30
+ ## CLI Commands
31
+
32
+ ```
33
+ lens chat chat with your codebase
34
+ lens chat -p /path/to/repo chat in a specific repo
35
+
36
+ lens review AI review of the current directory
37
+ lens review /path/to/repo AI review of a specific repo
38
+
39
+ lens repo <url> analyze a remote GitHub repository
40
+
41
+ lens task <text> apply a natural language change to the codebase
42
+ lens task <text> -p /path apply change to a specific repo
43
+
44
+ lens commit generate a smart commit message from staged changes
45
+ lens commit [files...] stage specific files and generate a commit message
46
+ lens commit --auto stage all changes and commit without confirmation
47
+ lens commit --confirm show preview before committing when using --auto
48
+ lens commit --preview show the generated message without committing
49
+ lens commit --push push to remote after committing
50
+
51
+ lens timeline explore commit history
52
+ lens timeline -p /path explore history of a specific repo
53
+
54
+ lens provider configure AI providers
55
+ ```
56
+
57
+ ## Chat Commands
58
+
59
+ Once inside a `lens chat` session, use slash commands:
60
+
61
+ ```
62
+ /timeline browse commit history
63
+ /review AI review of the current codebase
64
+ /auto toggle auto-approve for safe tools (read, search, fetch)
65
+ /auto --force-all auto-approve ALL tools including shell and writes ⚠️
66
+ /chat list list saved chat sessions for this repo
67
+ /chat load <name> load a saved chat session
68
+ /chat rename <name> rename the current session
69
+ /chat delete <name> delete a saved session
70
+ /memory list list stored memories for this repo
71
+ /memory add <text> add a memory
72
+ /memory delete <id> delete a memory by ID
73
+ /memory clear clear all memories for this repo
74
+ /clear history wipe session memory for this repo
75
+ ```
76
+
77
+ ## Supported Providers
78
+
79
+ - **Anthropic** — Claude models
80
+ - **OpenAI** — GPT models
81
+ - **Gemini** — Google Gemini models
82
+ - **Ollama** — local models
83
+ - **Custom** — any OpenAI-compatible API endpoint
84
+
85
+ ## Extending Lens
86
+
87
+ Custom tools can be built and registered using [`@ridit/lens-sdk`](https://www.npmjs.com/package/@ridit/lens-sdk).
88
+
89
+ ## License
90
+
91
+ MIT