@ridit/lens 0.3.3 → 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 ADDED
@@ -0,0 +1,48 @@
1
+ # Lens
2
+ > Generated: 2026-03-24T15:21:42.840Z
3
+
4
+ ## Overview
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
+
7
+ ## Architecture
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
+
10
+ ## Tooling & Conventions
11
+ - **packageManager**: bun
12
+ - **language**: TypeScript
13
+ - **runtime**: Node.js
14
+ - **bundler**: bun build
15
+ - **framework**: Ink + React
16
+ - **testRunner**: jest (configured but not actively used)
17
+ - **linter**: TypeScript compiler with strict settings
18
+
19
+ ## Important Folders
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
24
+
25
+ ## Key Files
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
31
+
32
+ ## Patterns & Idioms
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
38
+
39
+ ## Suggestions
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
45
+
46
+ <!--lens-json
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"}
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
  ```
@@ -84,7 +86,7 @@ Once inside a `lens chat / vibe` session, use slash commands:
84
86
 
85
87
  ## Extending Lens
86
88
 
87
- Custom tools can be built and registered using [`@ridit/lens-sdk`](https://www.npmjs.com/package/@ridit/lens-sdk).
89
+ Custom tools can be built and registered using `[@ridit/lens-sdk](https://www.npmjs.com/package/@ridit/lens-sdk)`.
88
90
 
89
91
  ## License
90
92