@ridit/lens 0.3.4 → 0.3.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,41 +1,48 @@
1
1
  # Lens
2
- > Generated: 2026-03-24T12:54:30.944Z
2
+ > Generated: 2026-03-24T15:21:42.840Z
3
3
 
4
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.
5
+ Lens is an AI-powered CLI tool built with React and Ink that enables natural language interaction with codebases. It provides chat-based exploration, code modification, repository analysis, timeline viewing, and smart commit generation. The tool connects to multiple LLM providers (Anthropic, OpenAI, Gemini, Ollama) and gives AI access to filesystem operations, shell commands, and web tools through a plugin system.
6
6
 
7
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.
8
+ The architecture follows a command-based structure with Ink components for terminal UI rendering. Each CLI command (chat, commit, review, task, timeline) has a corresponding React component in src/commands/ that handles the specific workflow. The system uses discriminated union types for state management across multi-step processes. Tool execution is managed through a centralized registry system that supports plugins via @ridit/lens-sdk.
9
9
 
10
10
  ## Tooling & Conventions
11
11
  - **packageManager**: bun
12
12
  - **language**: TypeScript
13
13
  - **runtime**: Node.js
14
- - **bundler**: tsup
15
- - **framework**: React + Ink
14
+ - **bundler**: bun build
15
+ - **framework**: Ink + React
16
+ - **testRunner**: jest (configured but not actively used)
17
+ - **linter**: TypeScript compiler with strict settings
16
18
 
17
19
  ## 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
20
+ - src/commands: Contains CLI command entry points (chat.tsx, commit.tsx, review.tsx, task.tsx, timeline.tsx) that render Ink components
21
+ - src/components: Houses reusable UI components organized by feature (chat/, repo/, timeline/, task/) with associated hooks
22
+ - src/utils: Core utilities including AI integration (ai.ts), configuration management (config.ts), git operations (git.ts), and tool registry (tools/)
23
+ - src/tools: Filesystem, shell, web, and PDF tools that the AI can call through the tool registry system
21
24
 
22
25
  ## 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
26
+ - src/index.tsx: Main CLI entry point that sets up Commander.js with all command handlers and loads built-in tools
27
+ - src/utils/tools/registry.ts: Central tool registry implementing the @ridit/lens-sdk interface for tool management and system prompt generation
28
+ - src/utils/ai.ts: Provider-agnostic AI integration with support for Anthropic, OpenAI, Ollama, and custom providers through unified interfaces
29
+ - src/types/chat.ts: Core type definitions for chat messages, tool calls, and state management using discriminated unions
30
+ - src/components/chat/ChatRunner.tsx: Main chat interface component handling tool execution, permission prompts, and clone operations
28
31
 
29
32
  ## 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
+ - Discriminated union state machines (type + stage fields) for multi-step UI flows in every command component (ChatStage, AnalysisStage, etc)
34
+ - Centralized tool registry pattern with plugin system support through @ridit/lens-sdk interface
35
+ - Provider abstraction layer that supports multiple LLM backends with consistent interfaces
36
+ - File-based memory system that persists chat history and context across sessions per repository
37
+ - Ink component composition with hooks for input handling and state management
33
38
 
34
39
  ## 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
40
+ - In src/utils/ai.ts, callModel has no retry logic adding exponential backoff would improve reliability for ollama which can be slow to start
41
+ - The tool registry in src/utils/tools/registry.ts lacks validation for tool name conflicts during registration
42
+ - src/utils/git.ts uses simple execSync for git operations which could benefit from proper error handling and timeout management
43
+ - The discriminated union types in src/types/chat.ts could use branded types for better type safety
44
+ - The build process in package.json uses a postbuild script to add node shebang which could be replaced with bun's native --target=binary option
38
45
 
39
46
  <!--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"}
47
+ {"overview":"Lens is an AI-powered CLI tool built with React and Ink that enables natural language interaction with codebases. It provides chat-based exploration, code modification, repository analysis, timeline viewing, and smart commit generation. The tool connects to multiple LLM providers (Anthropic, OpenAI, Gemini, Ollama) and gives AI access to filesystem operations, shell commands, and web tools through a plugin system.","importantFolders":["src/commands: Contains CLI command entry points (chat.tsx, commit.tsx, review.tsx, task.tsx, timeline.tsx) that render Ink components","src/components: Houses reusable UI components organized by feature (chat/, repo/, timeline/, task/) with associated hooks","src/utils: Core utilities including AI integration (ai.ts), configuration management (config.ts), git operations (git.ts), and tool registry (tools/)","src/tools: Filesystem, shell, web, and PDF tools that the AI can call through the tool registry system"],"tooling":{"packageManager":"bun","language":"TypeScript","runtime":"Node.js","bundler":"bun build","framework":"Ink + React","testRunner":"jest (configured but not actively used)","linter":"TypeScript compiler with strict settings"},"keyFiles":["src/index.tsx: Main CLI entry point that sets up Commander.js with all command handlers and loads built-in tools","src/utils/tools/registry.ts: Central tool registry implementing the @ridit/lens-sdk interface for tool management and system prompt generation","src/utils/ai.ts: Provider-agnostic AI integration with support for Anthropic, OpenAI, Ollama, and custom providers through unified interfaces","src/types/chat.ts: Core type definitions for chat messages, tool calls, and state management using discriminated unions","src/components/chat/ChatRunner.tsx: Main chat interface component handling tool execution, permission prompts, and clone operations"],"patterns":["Discriminated union state machines (type + stage fields) for multi-step UI flows in every command component (ChatStage, AnalysisStage, etc)","Centralized tool registry pattern with plugin system support through @ridit/lens-sdk interface","Provider abstraction layer that supports multiple LLM backends with consistent interfaces","File-based memory system that persists chat history and context across sessions per repository","Ink component composition with hooks for input handling and state management"],"architecture":"The architecture follows a command-based structure with Ink components for terminal UI rendering. Each CLI command (chat, commit, review, task, timeline) has a corresponding React component in src/commands/ that handles the specific workflow. The system uses discriminated union types for state management across multi-step processes. Tool execution is managed through a centralized registry system that supports plugins via @ridit/lens-sdk.","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 tool registry in src/utils/tools/registry.ts lacks validation for tool name conflicts during registration","src/utils/git.ts uses simple execSync for git operations which could benefit from proper error handling and timeout management","The discriminated union types in src/types/chat.ts could use branded types for better type safety","The build process in package.json uses a postbuild script to add node shebang which could be replaced with bun's native --target=binary option"],"generatedAt":"2026-03-24T15:21:42.840Z","lastUpdated":"2026-03-24T15:21:42.840Z"}
41
48
  lens-json-->
package/README.md CHANGED
@@ -30,26 +30,28 @@ npm install -g @ridit/lens
30
30
  ## CLI Commands
31
31
 
32
32
  ```
33
- lens chat / vibe chat with your codebase
33
+ lens chat chat with your codebase
34
34
  lens chat -p /path/to/repo chat in a specific repo
35
35
 
36
- lens review / judge AI review of the current directory
36
+ lens review AI review of the current directory
37
37
  lens review /path/to/repo AI review of a specific repo
38
38
 
39
- lens repo / stalk <url> analyze a remote GitHub repository
39
+ lens repo <url> analyze a remote GitHub repository
40
40
 
41
- lens task / cook <text> apply a natural language change to the codebase
42
- lens task / cook <text> -p /path apply change to a specific repo
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
43
 
44
- lens commit / crimes generate a smart commit message from staged changes
45
- lens commit / crimes [files...] stage specific files and generate a commit message
46
- lens commit / crimes --auto stage all changes and commit without confirmation
47
- lens commit / crimes --confirm show preview before committing when using --auto
48
- lens commit / crimes --preview show the generated message without committing
49
- lens commit / crimes --push push to remote after committing
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
50
 
51
- lens timeline / history explore commit history
52
- lens timeline / history -p /path explore history of a specific repo
51
+ lens timeline explore commit history
52
+ lens timeline -p /path explore history of a specific repo
53
+
54
+ lens run Run your dev server. Lens detects and fixes errors automatically
53
55
 
54
56
  lens provider configure AI providers
55
57
  ```
@@ -88,4 +90,4 @@ Custom tools can be built and registered using `[@ridit/lens-sdk](https://www.np
88
90
 
89
91
  ## License
90
92
 
91
- MIT
93
+ MIT