@ridit/lens 0.2.2 → 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,25 +1,32 @@
1
1
  # Lens Analysis
2
- > Generated: 2026-03-11T17:49:46.564Z
2
+ > Generated: 2026-03-21T11:15:38.543Z
3
3
 
4
4
  ## Overview
5
- This project is a CLI tool called 'lens' that analyzes a repository and provides insights. It uses React, Ink, and various other libraries to create a text-based interface. The tool has several commands, including 'repo' for analyzing a remote repository, 'init' for initializing the tool, and 'review' for reviewing a local codebase. The project is designed for developers who want to quickly understand a repository's structure and content.
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
6
 
7
7
  ## Important Folders
8
- - src/components: contains various components, including FileReviewer, FileViewer, and ProviderPicker. Each component is used to display specific information about the repository.
9
- - src/commands: contains the implementation of the 'repo', 'init', and 'review' commands. Each command has its own file and exports a function that handles the command's logic.
10
- - src/utils: contains utility functions for tasks such as cloning a repository, reading files, and analyzing code. These functions are used throughout the project to perform specific tasks.
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.
11
12
 
12
13
  ## Missing Configs
13
- - None detected
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
14
17
 
15
18
  ## Security Issues
16
- - None detected
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
17
22
 
18
23
  ## Suggestions
19
- - In src/components/FileReviewer.tsx, consider adding a check to ensure that the 'files' prop is not empty before rendering the file list.
20
- - In src/commands/repo.tsx, consider adding error handling for cases where the repository URL is invalid or the repository cannot be cloned.
21
- - In src/utils/llm.ts, consider adding a timeout to the 'runPrompt' function to prevent it from running indefinitely if the model takes too long to respond.
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
22
29
 
23
30
  <!--lens-json
24
- {"overview":"This project is a CLI tool called 'lens' that analyzes a repository and provides insights. It uses React, Ink, and various other libraries to create a text-based interface. The tool has several commands, including 'repo' for analyzing a remote repository, 'init' for initializing the tool, and 'review' for reviewing a local codebase. The project is designed for developers who want to quickly understand a repository's structure and content.","importantFolders":["src/components: contains various components, including FileReviewer, FileViewer, and ProviderPicker. Each component is used to display specific information about the repository.","src/commands: contains the implementation of the 'repo', 'init', and 'review' commands. Each command has its own file and exports a function that handles the command's logic.","src/utils: contains utility functions for tasks such as cloning a repository, reading files, and analyzing code. These functions are used throughout the project to perform specific tasks."],"missingConfigs":[],"securityIssues":[],"suggestions":["In src/components/FileReviewer.tsx, consider adding a check to ensure that the 'files' prop is not empty before rendering the file list.","In src/commands/repo.tsx, consider adding error handling for cases where the repository URL is invalid or the repository cannot be cloned.","In src/utils/llm.ts, consider adding a timeout to the 'runPrompt' function to prevent it from running indefinitely if the model takes too long to respond."],"generatedAt":"2026-03-11T17:49:46.564Z"}
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"}
25
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