@renxqoo/renx-code 0.0.1
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/LICENSE +21 -0
- package/README.md +278 -0
- package/dist/App.d.ts +2 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +170 -0
- package/dist/App.js.map +1 -0
- package/dist/agent/prompts/system.d.ts +24 -0
- package/dist/agent/prompts/system.d.ts.map +1 -0
- package/dist/agent/prompts/system.js +222 -0
- package/dist/agent/prompts/system.js.map +1 -0
- package/dist/agent/runtime/event-format.d.ts +17 -0
- package/dist/agent/runtime/event-format.d.ts.map +1 -0
- package/dist/agent/runtime/event-format.js +194 -0
- package/dist/agent/runtime/event-format.js.map +1 -0
- package/dist/agent/runtime/model-types.d.ts +13 -0
- package/dist/agent/runtime/model-types.d.ts.map +1 -0
- package/dist/agent/runtime/model-types.js +1 -0
- package/dist/agent/runtime/model-types.js.map +1 -0
- package/dist/agent/runtime/runtime.d.ts +16 -0
- package/dist/agent/runtime/runtime.d.ts.map +1 -0
- package/dist/agent/runtime/runtime.js +691 -0
- package/dist/agent/runtime/runtime.js.map +1 -0
- package/dist/agent/runtime/source-modules.d.ts +176 -0
- package/dist/agent/runtime/source-modules.d.ts.map +1 -0
- package/dist/agent/runtime/source-modules.js +110 -0
- package/dist/agent/runtime/source-modules.js.map +1 -0
- package/dist/agent/runtime/tool-call-buffer.d.ts +12 -0
- package/dist/agent/runtime/tool-call-buffer.d.ts.map +1 -0
- package/dist/agent/runtime/tool-call-buffer.js +48 -0
- package/dist/agent/runtime/tool-call-buffer.js.map +1 -0
- package/dist/agent/runtime/tool-confirmation.d.ts +3 -0
- package/dist/agent/runtime/tool-confirmation.d.ts.map +1 -0
- package/dist/agent/runtime/tool-confirmation.js +9 -0
- package/dist/agent/runtime/tool-confirmation.js.map +1 -0
- package/dist/agent/runtime/types.d.ts +86 -0
- package/dist/agent/runtime/types.d.ts.map +1 -0
- package/dist/agent/runtime/types.js +1 -0
- package/dist/agent/runtime/types.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +43 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/slash-commands.d.ts +11 -0
- package/dist/commands/slash-commands.d.ts.map +1 -0
- package/dist/commands/slash-commands.js +48 -0
- package/dist/commands/slash-commands.js.map +1 -0
- package/dist/components/chat/assistant-reply.d.ts +13 -0
- package/dist/components/chat/assistant-reply.d.ts.map +1 -0
- package/dist/components/chat/assistant-reply.js +78 -0
- package/dist/components/chat/assistant-reply.js.map +1 -0
- package/dist/components/chat/assistant-segment.d.ts +8 -0
- package/dist/components/chat/assistant-segment.d.ts.map +1 -0
- package/dist/components/chat/assistant-segment.js +54 -0
- package/dist/components/chat/assistant-segment.js.map +1 -0
- package/dist/components/chat/assistant-tool-group.d.ts +7 -0
- package/dist/components/chat/assistant-tool-group.d.ts.map +1 -0
- package/dist/components/chat/assistant-tool-group.js +695 -0
- package/dist/components/chat/assistant-tool-group.js.map +1 -0
- package/dist/components/chat/code-block.d.ts +16 -0
- package/dist/components/chat/code-block.d.ts.map +1 -0
- package/dist/components/chat/code-block.js +194 -0
- package/dist/components/chat/code-block.js.map +1 -0
- package/dist/components/chat/prompt-card.d.ts +9 -0
- package/dist/components/chat/prompt-card.d.ts.map +1 -0
- package/dist/components/chat/prompt-card.js +18 -0
- package/dist/components/chat/prompt-card.js.map +1 -0
- package/dist/components/chat/segment-groups.d.ts +24 -0
- package/dist/components/chat/segment-groups.d.ts.map +1 -0
- package/dist/components/chat/segment-groups.js +69 -0
- package/dist/components/chat/segment-groups.js.map +1 -0
- package/dist/components/chat/turn-item.d.ts +9 -0
- package/dist/components/chat/turn-item.d.ts.map +1 -0
- package/dist/components/chat/turn-item.js +11 -0
- package/dist/components/chat/turn-item.js.map +1 -0
- package/dist/components/conversation-panel.d.ts +8 -0
- package/dist/components/conversation-panel.d.ts.map +1 -0
- package/dist/components/conversation-panel.js +8 -0
- package/dist/components/conversation-panel.js.map +1 -0
- package/dist/components/file-mention-menu.d.ts +11 -0
- package/dist/components/file-mention-menu.d.ts.map +1 -0
- package/dist/components/file-mention-menu.js +15 -0
- package/dist/components/file-mention-menu.js.map +1 -0
- package/dist/components/file-picker-dialog.d.ts +21 -0
- package/dist/components/file-picker-dialog.d.ts.map +1 -0
- package/dist/components/file-picker-dialog.js +48 -0
- package/dist/components/file-picker-dialog.js.map +1 -0
- package/dist/components/footer-hints.d.ts +7 -0
- package/dist/components/footer-hints.d.ts.map +1 -0
- package/dist/components/footer-hints.js +29 -0
- package/dist/components/footer-hints.js.map +1 -0
- package/dist/components/model-picker-dialog.d.ts +20 -0
- package/dist/components/model-picker-dialog.d.ts.map +1 -0
- package/dist/components/model-picker-dialog.js +72 -0
- package/dist/components/model-picker-dialog.js.map +1 -0
- package/dist/components/prompt.d.ts +18 -0
- package/dist/components/prompt.d.ts.map +1 -0
- package/dist/components/prompt.js +96 -0
- package/dist/components/prompt.js.map +1 -0
- package/dist/components/slash-command-menu.d.ts +9 -0
- package/dist/components/slash-command-menu.d.ts.map +1 -0
- package/dist/components/slash-command-menu.js +20 -0
- package/dist/components/slash-command-menu.js.map +1 -0
- package/dist/components/tool-confirm-dialog-content.d.ts +15 -0
- package/dist/components/tool-confirm-dialog-content.d.ts.map +1 -0
- package/dist/components/tool-confirm-dialog-content.js +143 -0
- package/dist/components/tool-confirm-dialog-content.js.map +1 -0
- package/dist/components/tool-confirm-dialog.d.ts +12 -0
- package/dist/components/tool-confirm-dialog.d.ts.map +1 -0
- package/dist/components/tool-confirm-dialog.js +21 -0
- package/dist/components/tool-confirm-dialog.js.map +1 -0
- package/dist/components/tool-display-config.d.ts +11 -0
- package/dist/components/tool-display-config.d.ts.map +1 -0
- package/dist/components/tool-display-config.js +94 -0
- package/dist/components/tool-display-config.js.map +1 -0
- package/dist/config/paths.d.ts +7 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +24 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/files/attachment-capabilities.d.ts +19 -0
- package/dist/files/attachment-capabilities.d.ts.map +1 -0
- package/dist/files/attachment-capabilities.js +26 -0
- package/dist/files/attachment-capabilities.js.map +1 -0
- package/dist/files/attachment-content.d.ts +5 -0
- package/dist/files/attachment-content.d.ts.map +1 -0
- package/dist/files/attachment-content.js +117 -0
- package/dist/files/attachment-content.js.map +1 -0
- package/dist/files/file-mention-query.d.ts +9 -0
- package/dist/files/file-mention-query.d.ts.map +1 -0
- package/dist/files/file-mention-query.js +23 -0
- package/dist/files/file-mention-query.js.map +1 -0
- package/dist/files/prompt-display.d.ts +3 -0
- package/dist/files/prompt-display.d.ts.map +1 -0
- package/dist/files/prompt-display.js +11 -0
- package/dist/files/prompt-display.js.map +1 -0
- package/dist/files/types.d.ts +6 -0
- package/dist/files/types.d.ts.map +1 -0
- package/dist/files/types.js +1 -0
- package/dist/files/types.js.map +1 -0
- package/dist/files/workspace-files.d.ts +3 -0
- package/dist/files/workspace-files.d.ts.map +1 -0
- package/dist/files/workspace-files.js +50 -0
- package/dist/files/workspace-files.js.map +1 -0
- package/dist/hooks/agent-event-handlers.d.ts +11 -0
- package/dist/hooks/agent-event-handlers.d.ts.map +1 -0
- package/dist/hooks/agent-event-handlers.js +137 -0
- package/dist/hooks/agent-event-handlers.js.map +1 -0
- package/dist/hooks/chat-local-replies.d.ts +9 -0
- package/dist/hooks/chat-local-replies.d.ts.map +1 -0
- package/dist/hooks/chat-local-replies.js +54 -0
- package/dist/hooks/chat-local-replies.js.map +1 -0
- package/dist/hooks/turn-updater.d.ts +9 -0
- package/dist/hooks/turn-updater.d.ts.map +1 -0
- package/dist/hooks/turn-updater.js +103 -0
- package/dist/hooks/turn-updater.js.map +1 -0
- package/dist/hooks/use-agent-chat.d.ts +29 -0
- package/dist/hooks/use-agent-chat.d.ts.map +1 -0
- package/dist/hooks/use-agent-chat.js +455 -0
- package/dist/hooks/use-agent-chat.js.map +1 -0
- package/dist/hooks/use-file-mention-menu.d.ts +22 -0
- package/dist/hooks/use-file-mention-menu.d.ts.map +1 -0
- package/dist/hooks/use-file-mention-menu.js +137 -0
- package/dist/hooks/use-file-mention-menu.js.map +1 -0
- package/dist/hooks/use-file-picker.d.ts +21 -0
- package/dist/hooks/use-file-picker.d.ts.map +1 -0
- package/dist/hooks/use-file-picker.js +145 -0
- package/dist/hooks/use-file-picker.js.map +1 -0
- package/dist/hooks/use-model-picker.d.ts +23 -0
- package/dist/hooks/use-model-picker.d.ts.map +1 -0
- package/dist/hooks/use-model-picker.js +151 -0
- package/dist/hooks/use-model-picker.js.map +1 -0
- package/dist/hooks/use-slash-command-menu.d.ts +19 -0
- package/dist/hooks/use-slash-command-menu.d.ts.map +1 -0
- package/dist/hooks/use-slash-command-menu.js +101 -0
- package/dist/hooks/use-slash-command-menu.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/clipboard.d.ts +10 -0
- package/dist/runtime/clipboard.d.ts.map +1 -0
- package/dist/runtime/clipboard.js +64 -0
- package/dist/runtime/clipboard.js.map +1 -0
- package/dist/runtime/exit.d.ts +7 -0
- package/dist/runtime/exit.d.ts.map +1 -0
- package/dist/runtime/exit.js +85 -0
- package/dist/runtime/exit.js.map +1 -0
- package/dist/runtime/terminal-theme.d.ts +25 -0
- package/dist/runtime/terminal-theme.d.ts.map +1 -0
- package/dist/runtime/terminal-theme.js +148 -0
- package/dist/runtime/terminal-theme.js.map +1 -0
- package/dist/types/chat.d.ts +29 -0
- package/dist/types/chat.d.ts.map +1 -0
- package/dist/types/chat.js +1 -0
- package/dist/types/chat.js.map +1 -0
- package/dist/types/message-content.d.ts +38 -0
- package/dist/types/message-content.d.ts.map +1 -0
- package/dist/types/message-content.js +1 -0
- package/dist/types/message-content.js.map +1 -0
- package/dist/ui/open-code-theme.d.ts +58 -0
- package/dist/ui/open-code-theme.d.ts.map +1 -0
- package/dist/ui/open-code-theme.js +113 -0
- package/dist/ui/open-code-theme.js.map +1 -0
- package/dist/ui/opencode-markdown.d.ts +7 -0
- package/dist/ui/opencode-markdown.d.ts.map +1 -0
- package/dist/ui/opencode-markdown.js +169 -0
- package/dist/ui/opencode-markdown.js.map +1 -0
- package/dist/ui/theme.d.ts +68 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +80 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/utils/time.d.ts +2 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +7 -0
- package/dist/utils/time.js.map +1 -0
- package/package.json +128 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 coding-agent-v2 contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Renx Code
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@renxqoo/renx-code)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://nodejs.org/)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://react.dev/)
|
|
8
|
+
[](https://github.com/opentui/opentui)
|
|
9
|
+
|
|
10
|
+
Enterprise-grade AI coding assistant CLI tool with interactive terminal UI, built with React and OpenTUI.
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
- **Interactive Terminal UI**: Beautiful, responsive terminal interface built with React and OpenTUI
|
|
15
|
+
- **AI-Powered Assistance**: Intelligent code suggestions and completions
|
|
16
|
+
- **Slash Commands**: Built-in commands for common operations (`/help`, `/clear`, `/exit`, `/models`, `/files`)
|
|
17
|
+
- **Keyboard Shortcuts**: Efficient navigation and control
|
|
18
|
+
- **Configurable**: Extensive configuration options via environment variables and config files
|
|
19
|
+
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
20
|
+
- **TypeScript**: Full type safety and excellent developer experience
|
|
21
|
+
- **Real-time Updates**: Live terminal updates with smooth animations
|
|
22
|
+
- **Theme Support**: Customizable UI themes and markdown rendering
|
|
23
|
+
|
|
24
|
+
## 🚀 Quick Start
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Install globally
|
|
30
|
+
npm install -g @renxqoo/renx-code
|
|
31
|
+
|
|
32
|
+
# Or use npx
|
|
33
|
+
npx @renxqoo/renx-code
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Basic Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Start the interactive CLI
|
|
40
|
+
renx
|
|
41
|
+
|
|
42
|
+
# Or run directly with npx
|
|
43
|
+
npx @renxqoo/renx-code
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 📦 Installation
|
|
47
|
+
|
|
48
|
+
### Prerequisites
|
|
49
|
+
|
|
50
|
+
- Node.js 20.0.0 or higher
|
|
51
|
+
- npm, yarn, or pnpm
|
|
52
|
+
|
|
53
|
+
### Global Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g @renxqoo/renx-code
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Local Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Create a new project
|
|
63
|
+
mkdir my-project && cd my-project
|
|
64
|
+
npm init -y
|
|
65
|
+
|
|
66
|
+
# Install @renxqoo/renx-code
|
|
67
|
+
npm install @renxqoo/renx-code
|
|
68
|
+
|
|
69
|
+
# Add to package.json scripts
|
|
70
|
+
{
|
|
71
|
+
"scripts": {
|
|
72
|
+
"agent": "renx"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 🎯 Usage
|
|
78
|
+
|
|
79
|
+
### Interactive Mode
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
renx
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This launches the interactive terminal UI where you can:
|
|
86
|
+
- Type natural language queries
|
|
87
|
+
- Use slash commands (`/help`, `/clear`, `/exit`)
|
|
88
|
+
- Navigate with keyboard shortcuts
|
|
89
|
+
- View real-time AI responses
|
|
90
|
+
|
|
91
|
+
### Keyboard Shortcuts
|
|
92
|
+
|
|
93
|
+
| Shortcut | Action |
|
|
94
|
+
|----------|--------|
|
|
95
|
+
| `Esc` | Stop current response or clear input |
|
|
96
|
+
| `Ctrl+L` | Clear conversation |
|
|
97
|
+
| `Ctrl+C` | Exit application |
|
|
98
|
+
| `↑/↓` | Navigate command history |
|
|
99
|
+
| `Tab` | Auto-complete commands |
|
|
100
|
+
| `Enter` | Submit input |
|
|
101
|
+
|
|
102
|
+
### Slash Commands
|
|
103
|
+
|
|
104
|
+
| Command | Description |
|
|
105
|
+
|---------|-------------|
|
|
106
|
+
| `/help` | Show available commands and shortcuts |
|
|
107
|
+
| `/clear` | Clear the conversation history |
|
|
108
|
+
| `/exit` | Exit the application |
|
|
109
|
+
| `/models` | List available AI models |
|
|
110
|
+
| `/files` | Show file browser |
|
|
111
|
+
| `/config` | Show current configuration |
|
|
112
|
+
| `/status` | Show system status |
|
|
113
|
+
|
|
114
|
+
## ⚙️ Configuration
|
|
115
|
+
|
|
116
|
+
### Environment Variables
|
|
117
|
+
|
|
118
|
+
Configure the agent using environment variables:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Set the AI model
|
|
122
|
+
export AGENT_MODEL="gpt-4"
|
|
123
|
+
|
|
124
|
+
# Set maximum steps per run
|
|
125
|
+
export AGENT_MAX_STEPS=1000
|
|
126
|
+
|
|
127
|
+
# Set confirmation mode
|
|
128
|
+
export AGENT_TOOL_CONFIRMATION_MODE="manual"
|
|
129
|
+
|
|
130
|
+
# Set logging level
|
|
131
|
+
export AGENT_LOG_LEVEL="INFO"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Configuration Files
|
|
135
|
+
|
|
136
|
+
Create a configuration file at `~/.renx/config.json`:
|
|
137
|
+
|
|
138
|
+
```json
|
|
139
|
+
{
|
|
140
|
+
"agent": {
|
|
141
|
+
"defaultModel": "gpt-4",
|
|
142
|
+
"maxSteps": 1000,
|
|
143
|
+
"confirmationMode": "manual"
|
|
144
|
+
},
|
|
145
|
+
"log": {
|
|
146
|
+
"level": "INFO",
|
|
147
|
+
"format": "pretty",
|
|
148
|
+
"console": true,
|
|
149
|
+
"file": false
|
|
150
|
+
},
|
|
151
|
+
"storage": {
|
|
152
|
+
"fileHistory": {
|
|
153
|
+
"enabled": true,
|
|
154
|
+
"maxPerFile": 20,
|
|
155
|
+
"maxAgeDays": 14,
|
|
156
|
+
"maxTotalMb": 500
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Project Configuration
|
|
163
|
+
|
|
164
|
+
Create a project-specific config at `.renx/config.json` in your project root.
|
|
165
|
+
|
|
166
|
+
## 🔧 Development
|
|
167
|
+
|
|
168
|
+
### Setup
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Clone the repository
|
|
172
|
+
git clone https://github.com/renxqoo/renx-code.git
|
|
173
|
+
cd renx-code
|
|
174
|
+
|
|
175
|
+
# Install dependencies
|
|
176
|
+
npm install
|
|
177
|
+
|
|
178
|
+
# Start development server
|
|
179
|
+
npm run dev
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Build
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Build for production
|
|
186
|
+
npm run build
|
|
187
|
+
|
|
188
|
+
# Build CLI executable
|
|
189
|
+
npm run build:cli
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Testing
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Run tests
|
|
196
|
+
npm test
|
|
197
|
+
|
|
198
|
+
# Run tests with coverage
|
|
199
|
+
npm run test:coverage
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Linting and Formatting
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Fix linting issues
|
|
206
|
+
npm run lint:fix
|
|
207
|
+
|
|
208
|
+
# Format code
|
|
209
|
+
npm run format
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## 📁 Project Structure
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
@renxqoo/renx-code/
|
|
216
|
+
├── src/
|
|
217
|
+
│ ├── agent/ # AI agent logic
|
|
218
|
+
│ ├── commands/ # Slash commands
|
|
219
|
+
│ ├── components/ # React components
|
|
220
|
+
│ ├── runtime/ # Runtime utilities
|
|
221
|
+
│ ├── ui/ # UI themes and styling
|
|
222
|
+
│ ├── utils/ # Utility functions
|
|
223
|
+
│ ├── App.tsx # Main application component
|
|
224
|
+
│ ├── cli.tsx # CLI entry point
|
|
225
|
+
│ └── index.tsx # Library entry point
|
|
226
|
+
├── dist/ # Compiled output
|
|
227
|
+
├── package.json # Package configuration
|
|
228
|
+
├── tsconfig.json # TypeScript configuration
|
|
229
|
+
├── tsconfig.build.json # Build TypeScript configuration
|
|
230
|
+
└── README.md # This file
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## 🤝 Contributing
|
|
234
|
+
|
|
235
|
+
1. Fork the repository
|
|
236
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
237
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
238
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
239
|
+
5. Open a Pull Request
|
|
240
|
+
|
|
241
|
+
### Development Guidelines
|
|
242
|
+
|
|
243
|
+
- Follow TypeScript best practices
|
|
244
|
+
- Write tests for new features
|
|
245
|
+
- Update documentation as needed
|
|
246
|
+
- Follow the existing code style
|
|
247
|
+
|
|
248
|
+
## 📄 License
|
|
249
|
+
|
|
250
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
251
|
+
|
|
252
|
+
## 🙏 Acknowledgments
|
|
253
|
+
|
|
254
|
+
- [OpenTUI](https://github.com/opentui/opentui) - Terminal UI framework
|
|
255
|
+
- [React](https://react.dev/) - UI library
|
|
256
|
+
- [TypeScript](https://www.typescriptlang.org/) - Type safety
|
|
257
|
+
- [Vitest](https://vitest.dev/) - Testing framework
|
|
258
|
+
|
|
259
|
+
## 📞 Support
|
|
260
|
+
|
|
261
|
+
- **Issues**: [GitHub Issues](https://github.com/renxqoo/renx-code/issues)
|
|
262
|
+
- **Discussions**: [GitHub Discussions](https://github.com/renxqoo/renx-code/discussions)
|
|
263
|
+
- **Documentation**: [Wiki](https://github.com/renxqoo/renx-code/wiki)
|
|
264
|
+
|
|
265
|
+
## 🚀 Roadmap
|
|
266
|
+
|
|
267
|
+
- [ ] Plugin system for custom commands
|
|
268
|
+
- [ ] Multi-model support
|
|
269
|
+
- [ ] Codebase analysis features
|
|
270
|
+
- [ ] Integration with popular IDEs
|
|
271
|
+
- [ ] Cloud sync for configurations
|
|
272
|
+
- [ ] Team collaboration features
|
|
273
|
+
- [ ] Performance optimizations
|
|
274
|
+
- [ ] Enhanced error handling and recovery
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
**Note**: This is an enterprise-grade tool designed for professional developers. Please ensure you have appropriate API keys and permissions for the AI models you intend to use.
|
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAuCA,eAAO,MAAM,GAAG,iCAiQf,CAAC"}
|
package/dist/App.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
+
import { TextAttributes } from '@opentui/core';
|
|
3
|
+
import { useKeyboard, useRenderer, useTerminalDimensions } from '@opentui/react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { resolveSlashCommand } from './commands/slash-commands';
|
|
6
|
+
import { ConversationPanel } from './components/conversation-panel';
|
|
7
|
+
import { FilePickerDialog } from './components/file-picker-dialog';
|
|
8
|
+
import { ModelPickerDialog } from './components/model-picker-dialog';
|
|
9
|
+
import { Prompt } from './components/prompt';
|
|
10
|
+
import { ToolConfirmDialog } from './components/tool-confirm-dialog';
|
|
11
|
+
import { isMediaSelection } from './files/attachment-capabilities';
|
|
12
|
+
import { useAgentChat } from './hooks/use-agent-chat';
|
|
13
|
+
import { useFilePicker } from './hooks/use-file-picker';
|
|
14
|
+
import { useModelPicker } from './hooks/use-model-picker';
|
|
15
|
+
import { requestExit } from './runtime/exit';
|
|
16
|
+
import { copyTextToClipboard } from './runtime/clipboard';
|
|
17
|
+
import { uiTheme } from './ui/theme';
|
|
18
|
+
const appendFileTokens = (currentValue, files) => {
|
|
19
|
+
if (files.length === 0) {
|
|
20
|
+
return currentValue;
|
|
21
|
+
}
|
|
22
|
+
const existingTokens = new Set(currentValue.match(/@\/\S+/g) ?? []);
|
|
23
|
+
const newTokens = files
|
|
24
|
+
.filter(file => !isMediaSelection(file))
|
|
25
|
+
.map(file => `@/${file.relativePath}`)
|
|
26
|
+
.filter(token => !existingTokens.has(token));
|
|
27
|
+
if (newTokens.length === 0) {
|
|
28
|
+
return currentValue;
|
|
29
|
+
}
|
|
30
|
+
const trimmed = currentValue.trimEnd();
|
|
31
|
+
const separator = trimmed.length > 0 ? ' ' : '';
|
|
32
|
+
return `${trimmed}${separator}${newTokens.join(' ')} `;
|
|
33
|
+
};
|
|
34
|
+
export const App = () => {
|
|
35
|
+
const { turns, inputValue, isThinking, modelLabel, contextUsagePercent, pendingToolConfirm, setInputValue, selectedFiles, setSelectedFiles, appendSelectedFiles, submitInput, stopActiveReply, clearInput, resetConversation, setModelLabelDisplay, setToolConfirmSelection, submitToolConfirmSelection, rejectPendingToolConfirm, } = useAgentChat();
|
|
36
|
+
const [slashMenuVisible, setSlashMenuVisible] = useState(false);
|
|
37
|
+
const modelPicker = useModelPicker({
|
|
38
|
+
onModelChanged: setModelLabelDisplay,
|
|
39
|
+
});
|
|
40
|
+
const filePicker = useFilePicker();
|
|
41
|
+
const dimensions = useTerminalDimensions();
|
|
42
|
+
const renderer = useRenderer();
|
|
43
|
+
const [copyToastVisible, setCopyToastVisible] = useState(false);
|
|
44
|
+
const selectionCopyTimeoutRef = useRef(null);
|
|
45
|
+
const copyToastTimeoutRef = useRef(null);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const handleSelection = (selection) => {
|
|
48
|
+
const selectedText = selection.getSelectedText();
|
|
49
|
+
if (!selectedText) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (selectionCopyTimeoutRef.current) {
|
|
53
|
+
clearTimeout(selectionCopyTimeoutRef.current);
|
|
54
|
+
}
|
|
55
|
+
selectionCopyTimeoutRef.current = setTimeout(() => {
|
|
56
|
+
void copyTextToClipboard(selectedText, renderer).then(success => {
|
|
57
|
+
if (!success) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
setCopyToastVisible(true);
|
|
61
|
+
if (copyToastTimeoutRef.current) {
|
|
62
|
+
clearTimeout(copyToastTimeoutRef.current);
|
|
63
|
+
}
|
|
64
|
+
copyToastTimeoutRef.current = setTimeout(() => {
|
|
65
|
+
setCopyToastVisible(false);
|
|
66
|
+
copyToastTimeoutRef.current = null;
|
|
67
|
+
}, 1500);
|
|
68
|
+
});
|
|
69
|
+
selectionCopyTimeoutRef.current = null;
|
|
70
|
+
}, 80);
|
|
71
|
+
};
|
|
72
|
+
renderer.on('selection', handleSelection);
|
|
73
|
+
return () => {
|
|
74
|
+
renderer.off('selection', handleSelection);
|
|
75
|
+
if (selectionCopyTimeoutRef.current) {
|
|
76
|
+
clearTimeout(selectionCopyTimeoutRef.current);
|
|
77
|
+
selectionCopyTimeoutRef.current = null;
|
|
78
|
+
}
|
|
79
|
+
if (copyToastTimeoutRef.current) {
|
|
80
|
+
clearTimeout(copyToastTimeoutRef.current);
|
|
81
|
+
copyToastTimeoutRef.current = null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}, [renderer]);
|
|
85
|
+
const submitWithCommands = () => {
|
|
86
|
+
const command = resolveSlashCommand(inputValue);
|
|
87
|
+
if (command?.action === 'models') {
|
|
88
|
+
setInputValue('');
|
|
89
|
+
modelPicker.open();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (command?.action === 'files') {
|
|
93
|
+
setInputValue('');
|
|
94
|
+
filePicker.open(selectedFiles);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
submitInput();
|
|
98
|
+
};
|
|
99
|
+
const handleSlashCommandSelect = (command) => {
|
|
100
|
+
if (command.action === 'models') {
|
|
101
|
+
setInputValue('');
|
|
102
|
+
modelPicker.open();
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (command.action === 'files') {
|
|
106
|
+
setInputValue('');
|
|
107
|
+
filePicker.open(selectedFiles);
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
};
|
|
112
|
+
useKeyboard(key => {
|
|
113
|
+
if (key.ctrl && key.name === 'c') {
|
|
114
|
+
requestExit(0);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (modelPicker.visible) {
|
|
118
|
+
if (key.name === 'escape') {
|
|
119
|
+
modelPicker.close();
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (filePicker.visible) {
|
|
124
|
+
if (key.name === 'escape') {
|
|
125
|
+
filePicker.close();
|
|
126
|
+
}
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (pendingToolConfirm) {
|
|
130
|
+
if (key.name === 'left' || key.name === 'h') {
|
|
131
|
+
setToolConfirmSelection('approve');
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (key.name === 'right' || key.name === 'l') {
|
|
135
|
+
setToolConfirmSelection('deny');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (key.name === 'return' || key.name === 'enter') {
|
|
139
|
+
submitToolConfirmSelection();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (key.name === 'escape') {
|
|
143
|
+
rejectPendingToolConfirm();
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (key.ctrl && key.name === 'l') {
|
|
148
|
+
resetConversation();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (key.name === 'escape') {
|
|
152
|
+
if (slashMenuVisible) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (isThinking) {
|
|
156
|
+
stopActiveReply();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
clearInput();
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return (_jsxs("box", { width: dimensions.width, height: dimensions.height, flexDirection: "column", backgroundColor: uiTheme.bg, paddingTop: uiTheme.layout.appPaddingTop, paddingBottom: uiTheme.layout.appPaddingBottom, paddingLeft: uiTheme.layout.appPaddingX, paddingRight: uiTheme.layout.appPaddingX, children: [_jsx(ConversationPanel, { turns: turns, isThinking: isThinking }), _jsx(Prompt, { isThinking: isThinking, disabled: modelPicker.visible || filePicker.visible || Boolean(pendingToolConfirm), modelLabel: modelLabel, contextUsagePercent: contextUsagePercent, value: inputValue, selectedFiles: selectedFiles, onAddSelectedFiles: appendSelectedFiles, onValueChange: setInputValue, onSlashCommandSelect: handleSlashCommandSelect, onSlashMenuVisibilityChange: setSlashMenuVisible, onSubmit: submitWithCommands }), _jsx(ToolConfirmDialog, { visible: Boolean(pendingToolConfirm), viewportWidth: dimensions.width, viewportHeight: dimensions.height, request: pendingToolConfirm }), _jsx(FilePickerDialog, { visible: filePicker.visible, viewportWidth: dimensions.width, viewportHeight: dimensions.height, loading: filePicker.loading, error: filePicker.error, search: filePicker.search, options: filePicker.options, selectedIndex: filePicker.selectedIndex, selectedPaths: filePicker.selectedPaths, onSearchChange: filePicker.setSearch, onSelectIndex: filePicker.setSelectedIndex, onToggleSelected: filePicker.toggleSelectedIndex, onConfirm: () => {
|
|
163
|
+
const confirmedFiles = filePicker.confirmSelected();
|
|
164
|
+
setSelectedFiles(confirmedFiles);
|
|
165
|
+
setInputValue(appendFileTokens(inputValue, confirmedFiles));
|
|
166
|
+
}, onListKeyDown: filePicker.handleListKeyDown }), _jsx(ModelPickerDialog, { visible: modelPicker.visible, viewportWidth: dimensions.width, viewportHeight: dimensions.height, loading: modelPicker.loading, switching: modelPicker.switching, error: modelPicker.error, search: modelPicker.search, options: modelPicker.options, selectedIndex: modelPicker.selectedIndex, onSearchChange: modelPicker.setSearch, onSelectIndex: modelPicker.setSelectedIndex, onConfirm: () => {
|
|
167
|
+
void modelPicker.confirmSelected();
|
|
168
|
+
}, onListKeyDown: modelPicker.handleListKeyDown }), copyToastVisible ? (_jsxs("box", { position: "absolute", right: 2, top: 1, zIndex: 20, flexDirection: "row", gap: 1, borderColor: uiTheme.divider, borderStyle: "rounded", paddingX: 1, paddingY: 0, children: [_jsx("text", { fg: uiTheme.accent, attributes: TextAttributes.BOLD, children: "\u2713" }), _jsx("text", { fg: uiTheme.text, attributes: TextAttributes.BOLD, children: "Copied" })] })) : null] }));
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=App.js.map
|
package/dist/App.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAA+B,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,0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
|
4
|
+
*/
|
|
5
|
+
type SystemPromptOptions = {
|
|
6
|
+
/** Working directory */
|
|
7
|
+
directory: string;
|
|
8
|
+
/** Response language */
|
|
9
|
+
language?: string;
|
|
10
|
+
/** Current datetime */
|
|
11
|
+
currentDateTime?: string;
|
|
12
|
+
/** Sandbox mode */
|
|
13
|
+
sandboxMode?: string;
|
|
14
|
+
/** Network policy */
|
|
15
|
+
networkPolicy?: string;
|
|
16
|
+
/** Runtime tool names */
|
|
17
|
+
runtimeToolNames?: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Build the complete system prompt.
|
|
21
|
+
*/
|
|
22
|
+
export declare function buildSystemPrompt({ directory, currentDateTime, sandboxMode, networkPolicy, runtimeToolNames, }: SystemPromptOptions): string;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/agent/prompts/system.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAkMH,KAAK,mBAAmB,GAAG;IACzB,wBAAwB;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yBAAyB;IACzB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAyB,EAEzB,eAAe,EACf,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,EAAE,mBAAmB,GAAG,MAAM,CAuB9B"}
|