@ridit/lens 0.3.3 → 0.3.4
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 +41 -0
- package/README.md +2 -2
- package/dist/index.mjs +3919 -3587
- package/package.json +1 -2
- package/src/components/repo/LensFileMenu.tsx +2 -9
- package/src/components/repo/RepoAnalysis.tsx +241 -50
- package/src/types/repo.ts +15 -3
- package/src/utils/ai.ts +108 -20
- package/src/utils/lensfile.ts +83 -18
package/LENS.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Lens
|
|
2
|
+
> Generated: 2026-03-24T12:54:30.944Z
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
Lens is an AI-powered CLI tool built with React and Ink that lets users explore, understand, and modify codebases through natural language. It provides chat functionality, code reviews, commit message generation, and timeline exploration of repositories. The tool connects to multiple LLM providers and gives AI direct access to the filesystem, shell, and web.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
The system uses a command-based architecture where each major feature (chat, review, commit, timeline) is implemented as a separate command component. These components use React with Ink for terminal rendering and manage complex multi-step interactions through state machines. The AI provider system in src/utils/ai.ts provides a unified interface to multiple LLM APIs, while the tool system allows the AI to interact with the filesystem and execute commands.
|
|
9
|
+
|
|
10
|
+
## Tooling & Conventions
|
|
11
|
+
- **packageManager**: bun
|
|
12
|
+
- **language**: TypeScript
|
|
13
|
+
- **runtime**: Node.js
|
|
14
|
+
- **bundler**: tsup
|
|
15
|
+
- **framework**: React + Ink
|
|
16
|
+
|
|
17
|
+
## Important Folders
|
|
18
|
+
- src/commands: Contains chat.tsx, commit.tsx, review.tsx, timeline.tsx - each exports an Ink component that is the top-level renderer for that CLI command
|
|
19
|
+
- src/utils: Contains ai.ts with callModel abstraction supporting Anthropic/Gemini/Ollama/OpenAI providers via a unified Provider type
|
|
20
|
+
- src/components: Contains React components for terminal UI rendering using Ink
|
|
21
|
+
|
|
22
|
+
## Key Files
|
|
23
|
+
- src/utils/ai.ts: callModel abstraction supporting anthropic/gemini/ollama/openai providers via a unified Provider type
|
|
24
|
+
- src/commands/chat.tsx: Main chat interface component with session management
|
|
25
|
+
- src/commands/commit.tsx: Commit message generation from staged changes
|
|
26
|
+
- src/commands/review.tsx: Code review functionality for repositories
|
|
27
|
+
- src/commands/timeline.tsx: Commit history exploration interface
|
|
28
|
+
|
|
29
|
+
## Patterns & Idioms
|
|
30
|
+
- Discriminated union state machines (type + stage fields) for multi-step UI flows in every command component
|
|
31
|
+
- Provider abstraction pattern in ai.ts that handles multiple AI APIs through a unified interface
|
|
32
|
+
- React hooks combined with Ink components for terminal rendering management
|
|
33
|
+
|
|
34
|
+
## Suggestions
|
|
35
|
+
- In src/utils/ai.ts, callModel has no retry logic - adding exponential backoff would improve reliability for Ollama which can be slow to start
|
|
36
|
+
- The provider configuration system could benefit from validation and error handling for malformed API keys or endpoints
|
|
37
|
+
- Consider adding tests for the AI provider abstraction to ensure consistent behavior across different providers
|
|
38
|
+
|
|
39
|
+
<!--lens-json
|
|
40
|
+
{"overview":"Lens is an AI-powered CLI tool built with React and Ink that lets users explore, understand, and modify codebases through natural language. It provides chat functionality, code reviews, commit message generation, and timeline exploration of repositories. The tool connects to multiple LLM providers and gives AI direct access to the filesystem, shell, and web.","importantFolders":["src/commands: Contains chat.tsx, commit.tsx, review.tsx, timeline.tsx - each exports an Ink component that is the top-level renderer for that CLI command","src/utils: Contains ai.ts with callModel abstraction supporting Anthropic/Gemini/Ollama/OpenAI providers via a unified Provider type","src/components: Contains React components for terminal UI rendering using Ink"],"tooling":{"packageManager":"bun","language":"TypeScript","runtime":"Node.js","bundler":"tsup","framework":"React + Ink"},"keyFiles":["src/utils/ai.ts: callModel abstraction supporting anthropic/gemini/ollama/openai providers via a unified Provider type","src/commands/chat.tsx: Main chat interface component with session management","src/commands/commit.tsx: Commit message generation from staged changes","src/commands/review.tsx: Code review functionality for repositories","src/commands/timeline.tsx: Commit history exploration interface"],"patterns":["Discriminated union state machines (type + stage fields) for multi-step UI flows in every command component","Provider abstraction pattern in ai.ts that handles multiple AI APIs through a unified interface","React hooks combined with Ink components for terminal rendering management"],"architecture":"The system uses a command-based architecture where each major feature (chat, review, commit, timeline) is implemented as a separate command component. These components use React with Ink for terminal rendering and manage complex multi-step interactions through state machines. The AI provider system in src/utils/ai.ts provides a unified interface to multiple LLM APIs, while the tool system allows the AI to interact with the filesystem and execute commands.","suggestions":["In src/utils/ai.ts, callModel has no retry logic - adding exponential backoff would improve reliability for Ollama which can be slow to start","The provider configuration system could benefit from validation and error handling for malformed API keys or endpoints","Consider adding tests for the AI provider abstraction to ensure consistent behavior across different providers"],"generatedAt":"2026-03-24T12:54:30.944Z","lastUpdated":"2026-03-24T12:54:30.944Z"}
|
|
41
|
+
lens-json-->
|
package/README.md
CHANGED
|
@@ -84,8 +84,8 @@ Once inside a `lens chat / vibe` session, use slash commands:
|
|
|
84
84
|
|
|
85
85
|
## Extending Lens
|
|
86
86
|
|
|
87
|
-
Custom tools can be built and registered using [
|
|
87
|
+
Custom tools can be built and registered using `[@ridit/lens-sdk](https://www.npmjs.com/package/@ridit/lens-sdk)`.
|
|
88
88
|
|
|
89
89
|
## License
|
|
90
90
|
|
|
91
|
-
MIT
|
|
91
|
+
MIT
|