@renxqoo/renx-code 0.0.2 → 0.0.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.
Files changed (298) hide show
  1. package/README.md +59 -223
  2. package/bin/renx.cjs +34 -0
  3. package/package.json +27 -83
  4. package/src/App.tsx +297 -0
  5. package/src/agent/runtime/event-format.ts +258 -0
  6. package/src/agent/runtime/model-types.ts +13 -0
  7. package/src/agent/runtime/runtime.context-usage.test.ts +193 -0
  8. package/src/agent/runtime/runtime.error-handling.test.ts +236 -0
  9. package/src/agent/runtime/runtime.simple.test.ts +16 -0
  10. package/src/agent/runtime/runtime.test.ts +293 -0
  11. package/src/agent/runtime/runtime.ts +881 -0
  12. package/src/agent/runtime/runtime.usage-forwarding.test.ts +229 -0
  13. package/src/agent/runtime/source-modules.test.ts +57 -0
  14. package/src/agent/runtime/source-modules.ts +353 -0
  15. package/src/agent/runtime/tool-call-buffer.test.ts +65 -0
  16. package/src/agent/runtime/tool-call-buffer.ts +60 -0
  17. package/src/agent/runtime/tool-confirmation.test.ts +56 -0
  18. package/src/agent/runtime/tool-confirmation.ts +15 -0
  19. package/src/agent/runtime/types.ts +99 -0
  20. package/src/commands/slash-commands.test.ts +216 -0
  21. package/src/commands/slash-commands.ts +64 -0
  22. package/src/components/chat/assistant-reply.test.tsx +47 -0
  23. package/src/components/chat/assistant-reply.tsx +136 -0
  24. package/src/components/chat/assistant-segment.test.ts +99 -0
  25. package/src/components/chat/assistant-segment.tsx +125 -0
  26. package/src/components/chat/assistant-tool-group.tsx +900 -0
  27. package/src/components/chat/code-block.test.tsx +206 -0
  28. package/src/components/chat/code-block.tsx +313 -0
  29. package/src/components/chat/prompt-card.tsx +81 -0
  30. package/src/components/chat/segment-groups.test.ts +52 -0
  31. package/src/components/chat/segment-groups.ts +106 -0
  32. package/src/components/chat/turn-item.tsx +39 -0
  33. package/src/components/conversation-panel.tsx +43 -0
  34. package/src/components/file-mention-menu.tsx +77 -0
  35. package/src/components/file-picker-dialog.tsx +206 -0
  36. package/src/components/footer-hints.tsx +75 -0
  37. package/src/components/model-picker-dialog.tsx +248 -0
  38. package/src/components/prompt.tsx +233 -0
  39. package/src/components/slash-command-menu.tsx +65 -0
  40. package/src/components/tool-confirm-dialog-content.test.ts +103 -0
  41. package/src/components/tool-confirm-dialog-content.ts +186 -0
  42. package/src/components/tool-confirm-dialog.tsx +187 -0
  43. package/src/components/tool-display-config.ts +119 -0
  44. package/src/context-usage-regressions.test.ts +26 -0
  45. package/src/files/attachment-capabilities.test.ts +30 -0
  46. package/src/files/attachment-capabilities.ts +50 -0
  47. package/src/files/attachment-content.ts +153 -0
  48. package/src/files/file-mention-query.test.ts +34 -0
  49. package/src/files/file-mention-query.ts +32 -0
  50. package/src/files/prompt-display.ts +13 -0
  51. package/src/files/types.ts +5 -0
  52. package/src/files/workspace-files.ts +63 -0
  53. package/src/hooks/agent-event-handlers.test.ts +207 -0
  54. package/src/hooks/agent-event-handlers.ts +196 -0
  55. package/src/hooks/chat-local-replies.fixed.test.ts +119 -0
  56. package/src/hooks/chat-local-replies.test.ts +153 -0
  57. package/src/hooks/chat-local-replies.ts +63 -0
  58. package/src/hooks/turn-updater.test.ts +70 -0
  59. package/src/hooks/turn-updater.ts +166 -0
  60. package/src/hooks/use-agent-chat.context.test.ts +10 -0
  61. package/src/hooks/use-agent-chat.status.test.ts +14 -0
  62. package/src/hooks/use-agent-chat.test.ts +80 -0
  63. package/src/hooks/use-agent-chat.ts +621 -0
  64. package/src/hooks/use-file-mention-menu.ts +196 -0
  65. package/src/hooks/use-file-picker.ts +185 -0
  66. package/src/hooks/use-model-picker.ts +196 -0
  67. package/src/hooks/use-slash-command-menu.ts +154 -0
  68. package/src/index.tsx +55 -0
  69. package/src/runtime/clipboard.test.ts +43 -0
  70. package/src/runtime/clipboard.ts +89 -0
  71. package/src/runtime/exit.test.ts +177 -0
  72. package/src/runtime/exit.ts +98 -0
  73. package/src/runtime/runtime-support.test.ts +31 -0
  74. package/src/runtime/terminal-theme.test.ts +55 -0
  75. package/src/runtime/terminal-theme.ts +196 -0
  76. package/src/types/chat.ts +32 -0
  77. package/src/types/message-content.ts +48 -0
  78. package/src/ui/open-code-theme.ts +176 -0
  79. package/src/ui/opencode-markdown.ts +211 -0
  80. package/src/ui/theme.simple.test.ts +52 -0
  81. package/src/ui/theme.test.ts +151 -0
  82. package/src/ui/theme.ts +152 -0
  83. package/src/utils/time.test.ts +144 -0
  84. package/src/utils/time.ts +7 -0
  85. package/tsconfig.json +30 -0
  86. package/LICENSE +0 -21
  87. package/dist/App.d.ts +0 -2
  88. package/dist/App.d.ts.map +0 -1
  89. package/dist/App.js +0 -170
  90. package/dist/App.js.map +0 -1
  91. package/dist/agent/prompts/system.d.ts +0 -24
  92. package/dist/agent/prompts/system.d.ts.map +0 -1
  93. package/dist/agent/prompts/system.js +0 -222
  94. package/dist/agent/prompts/system.js.map +0 -1
  95. package/dist/agent/runtime/event-format.d.ts +0 -17
  96. package/dist/agent/runtime/event-format.d.ts.map +0 -1
  97. package/dist/agent/runtime/event-format.js +0 -194
  98. package/dist/agent/runtime/event-format.js.map +0 -1
  99. package/dist/agent/runtime/model-types.d.ts +0 -13
  100. package/dist/agent/runtime/model-types.d.ts.map +0 -1
  101. package/dist/agent/runtime/model-types.js +0 -1
  102. package/dist/agent/runtime/model-types.js.map +0 -1
  103. package/dist/agent/runtime/runtime.d.ts +0 -16
  104. package/dist/agent/runtime/runtime.d.ts.map +0 -1
  105. package/dist/agent/runtime/runtime.js +0 -691
  106. package/dist/agent/runtime/runtime.js.map +0 -1
  107. package/dist/agent/runtime/source-modules.d.ts +0 -176
  108. package/dist/agent/runtime/source-modules.d.ts.map +0 -1
  109. package/dist/agent/runtime/source-modules.js +0 -110
  110. package/dist/agent/runtime/source-modules.js.map +0 -1
  111. package/dist/agent/runtime/tool-call-buffer.d.ts +0 -12
  112. package/dist/agent/runtime/tool-call-buffer.d.ts.map +0 -1
  113. package/dist/agent/runtime/tool-call-buffer.js +0 -48
  114. package/dist/agent/runtime/tool-call-buffer.js.map +0 -1
  115. package/dist/agent/runtime/tool-confirmation.d.ts +0 -3
  116. package/dist/agent/runtime/tool-confirmation.d.ts.map +0 -1
  117. package/dist/agent/runtime/tool-confirmation.js +0 -9
  118. package/dist/agent/runtime/tool-confirmation.js.map +0 -1
  119. package/dist/agent/runtime/types.d.ts +0 -86
  120. package/dist/agent/runtime/types.d.ts.map +0 -1
  121. package/dist/agent/runtime/types.js +0 -1
  122. package/dist/agent/runtime/types.js.map +0 -1
  123. package/dist/cli.d.ts +0 -3
  124. package/dist/cli.d.ts.map +0 -1
  125. package/dist/cli.js +0 -43
  126. package/dist/cli.js.map +0 -1
  127. package/dist/commands/slash-commands.d.ts +0 -11
  128. package/dist/commands/slash-commands.d.ts.map +0 -1
  129. package/dist/commands/slash-commands.js +0 -48
  130. package/dist/commands/slash-commands.js.map +0 -1
  131. package/dist/components/chat/assistant-reply.d.ts +0 -13
  132. package/dist/components/chat/assistant-reply.d.ts.map +0 -1
  133. package/dist/components/chat/assistant-reply.js +0 -78
  134. package/dist/components/chat/assistant-reply.js.map +0 -1
  135. package/dist/components/chat/assistant-segment.d.ts +0 -8
  136. package/dist/components/chat/assistant-segment.d.ts.map +0 -1
  137. package/dist/components/chat/assistant-segment.js +0 -54
  138. package/dist/components/chat/assistant-segment.js.map +0 -1
  139. package/dist/components/chat/assistant-tool-group.d.ts +0 -7
  140. package/dist/components/chat/assistant-tool-group.d.ts.map +0 -1
  141. package/dist/components/chat/assistant-tool-group.js +0 -695
  142. package/dist/components/chat/assistant-tool-group.js.map +0 -1
  143. package/dist/components/chat/code-block.d.ts +0 -16
  144. package/dist/components/chat/code-block.d.ts.map +0 -1
  145. package/dist/components/chat/code-block.js +0 -194
  146. package/dist/components/chat/code-block.js.map +0 -1
  147. package/dist/components/chat/prompt-card.d.ts +0 -9
  148. package/dist/components/chat/prompt-card.d.ts.map +0 -1
  149. package/dist/components/chat/prompt-card.js +0 -18
  150. package/dist/components/chat/prompt-card.js.map +0 -1
  151. package/dist/components/chat/segment-groups.d.ts +0 -24
  152. package/dist/components/chat/segment-groups.d.ts.map +0 -1
  153. package/dist/components/chat/segment-groups.js +0 -69
  154. package/dist/components/chat/segment-groups.js.map +0 -1
  155. package/dist/components/chat/turn-item.d.ts +0 -9
  156. package/dist/components/chat/turn-item.d.ts.map +0 -1
  157. package/dist/components/chat/turn-item.js +0 -11
  158. package/dist/components/chat/turn-item.js.map +0 -1
  159. package/dist/components/conversation-panel.d.ts +0 -8
  160. package/dist/components/conversation-panel.d.ts.map +0 -1
  161. package/dist/components/conversation-panel.js +0 -8
  162. package/dist/components/conversation-panel.js.map +0 -1
  163. package/dist/components/file-mention-menu.d.ts +0 -11
  164. package/dist/components/file-mention-menu.d.ts.map +0 -1
  165. package/dist/components/file-mention-menu.js +0 -15
  166. package/dist/components/file-mention-menu.js.map +0 -1
  167. package/dist/components/file-picker-dialog.d.ts +0 -21
  168. package/dist/components/file-picker-dialog.d.ts.map +0 -1
  169. package/dist/components/file-picker-dialog.js +0 -48
  170. package/dist/components/file-picker-dialog.js.map +0 -1
  171. package/dist/components/footer-hints.d.ts +0 -7
  172. package/dist/components/footer-hints.d.ts.map +0 -1
  173. package/dist/components/footer-hints.js +0 -29
  174. package/dist/components/footer-hints.js.map +0 -1
  175. package/dist/components/model-picker-dialog.d.ts +0 -20
  176. package/dist/components/model-picker-dialog.d.ts.map +0 -1
  177. package/dist/components/model-picker-dialog.js +0 -72
  178. package/dist/components/model-picker-dialog.js.map +0 -1
  179. package/dist/components/prompt.d.ts +0 -18
  180. package/dist/components/prompt.d.ts.map +0 -1
  181. package/dist/components/prompt.js +0 -96
  182. package/dist/components/prompt.js.map +0 -1
  183. package/dist/components/slash-command-menu.d.ts +0 -9
  184. package/dist/components/slash-command-menu.d.ts.map +0 -1
  185. package/dist/components/slash-command-menu.js +0 -20
  186. package/dist/components/slash-command-menu.js.map +0 -1
  187. package/dist/components/tool-confirm-dialog-content.d.ts +0 -15
  188. package/dist/components/tool-confirm-dialog-content.d.ts.map +0 -1
  189. package/dist/components/tool-confirm-dialog-content.js +0 -143
  190. package/dist/components/tool-confirm-dialog-content.js.map +0 -1
  191. package/dist/components/tool-confirm-dialog.d.ts +0 -12
  192. package/dist/components/tool-confirm-dialog.d.ts.map +0 -1
  193. package/dist/components/tool-confirm-dialog.js +0 -21
  194. package/dist/components/tool-confirm-dialog.js.map +0 -1
  195. package/dist/components/tool-display-config.d.ts +0 -11
  196. package/dist/components/tool-display-config.d.ts.map +0 -1
  197. package/dist/components/tool-display-config.js +0 -94
  198. package/dist/components/tool-display-config.js.map +0 -1
  199. package/dist/config/paths.d.ts +0 -7
  200. package/dist/config/paths.d.ts.map +0 -1
  201. package/dist/config/paths.js +0 -24
  202. package/dist/config/paths.js.map +0 -1
  203. package/dist/files/attachment-capabilities.d.ts +0 -19
  204. package/dist/files/attachment-capabilities.d.ts.map +0 -1
  205. package/dist/files/attachment-capabilities.js +0 -26
  206. package/dist/files/attachment-capabilities.js.map +0 -1
  207. package/dist/files/attachment-content.d.ts +0 -5
  208. package/dist/files/attachment-content.d.ts.map +0 -1
  209. package/dist/files/attachment-content.js +0 -117
  210. package/dist/files/attachment-content.js.map +0 -1
  211. package/dist/files/file-mention-query.d.ts +0 -9
  212. package/dist/files/file-mention-query.d.ts.map +0 -1
  213. package/dist/files/file-mention-query.js +0 -23
  214. package/dist/files/file-mention-query.js.map +0 -1
  215. package/dist/files/prompt-display.d.ts +0 -3
  216. package/dist/files/prompt-display.d.ts.map +0 -1
  217. package/dist/files/prompt-display.js +0 -11
  218. package/dist/files/prompt-display.js.map +0 -1
  219. package/dist/files/types.d.ts +0 -6
  220. package/dist/files/types.d.ts.map +0 -1
  221. package/dist/files/types.js +0 -1
  222. package/dist/files/types.js.map +0 -1
  223. package/dist/files/workspace-files.d.ts +0 -3
  224. package/dist/files/workspace-files.d.ts.map +0 -1
  225. package/dist/files/workspace-files.js +0 -50
  226. package/dist/files/workspace-files.js.map +0 -1
  227. package/dist/hooks/agent-event-handlers.d.ts +0 -11
  228. package/dist/hooks/agent-event-handlers.d.ts.map +0 -1
  229. package/dist/hooks/agent-event-handlers.js +0 -137
  230. package/dist/hooks/agent-event-handlers.js.map +0 -1
  231. package/dist/hooks/chat-local-replies.d.ts +0 -9
  232. package/dist/hooks/chat-local-replies.d.ts.map +0 -1
  233. package/dist/hooks/chat-local-replies.js +0 -54
  234. package/dist/hooks/chat-local-replies.js.map +0 -1
  235. package/dist/hooks/turn-updater.d.ts +0 -9
  236. package/dist/hooks/turn-updater.d.ts.map +0 -1
  237. package/dist/hooks/turn-updater.js +0 -103
  238. package/dist/hooks/turn-updater.js.map +0 -1
  239. package/dist/hooks/use-agent-chat.d.ts +0 -29
  240. package/dist/hooks/use-agent-chat.d.ts.map +0 -1
  241. package/dist/hooks/use-agent-chat.js +0 -455
  242. package/dist/hooks/use-agent-chat.js.map +0 -1
  243. package/dist/hooks/use-file-mention-menu.d.ts +0 -22
  244. package/dist/hooks/use-file-mention-menu.d.ts.map +0 -1
  245. package/dist/hooks/use-file-mention-menu.js +0 -137
  246. package/dist/hooks/use-file-mention-menu.js.map +0 -1
  247. package/dist/hooks/use-file-picker.d.ts +0 -21
  248. package/dist/hooks/use-file-picker.d.ts.map +0 -1
  249. package/dist/hooks/use-file-picker.js +0 -145
  250. package/dist/hooks/use-file-picker.js.map +0 -1
  251. package/dist/hooks/use-model-picker.d.ts +0 -23
  252. package/dist/hooks/use-model-picker.d.ts.map +0 -1
  253. package/dist/hooks/use-model-picker.js +0 -151
  254. package/dist/hooks/use-model-picker.js.map +0 -1
  255. package/dist/hooks/use-slash-command-menu.d.ts +0 -19
  256. package/dist/hooks/use-slash-command-menu.d.ts.map +0 -1
  257. package/dist/hooks/use-slash-command-menu.js +0 -101
  258. package/dist/hooks/use-slash-command-menu.js.map +0 -1
  259. package/dist/index.d.ts +0 -2
  260. package/dist/index.d.ts.map +0 -1
  261. package/dist/index.js +0 -39
  262. package/dist/index.js.map +0 -1
  263. package/dist/runtime/clipboard.d.ts +0 -10
  264. package/dist/runtime/clipboard.d.ts.map +0 -1
  265. package/dist/runtime/clipboard.js +0 -64
  266. package/dist/runtime/clipboard.js.map +0 -1
  267. package/dist/runtime/exit.d.ts +0 -7
  268. package/dist/runtime/exit.d.ts.map +0 -1
  269. package/dist/runtime/exit.js +0 -85
  270. package/dist/runtime/exit.js.map +0 -1
  271. package/dist/runtime/terminal-theme.d.ts +0 -25
  272. package/dist/runtime/terminal-theme.d.ts.map +0 -1
  273. package/dist/runtime/terminal-theme.js +0 -148
  274. package/dist/runtime/terminal-theme.js.map +0 -1
  275. package/dist/types/chat.d.ts +0 -29
  276. package/dist/types/chat.d.ts.map +0 -1
  277. package/dist/types/chat.js +0 -1
  278. package/dist/types/chat.js.map +0 -1
  279. package/dist/types/message-content.d.ts +0 -38
  280. package/dist/types/message-content.d.ts.map +0 -1
  281. package/dist/types/message-content.js +0 -1
  282. package/dist/types/message-content.js.map +0 -1
  283. package/dist/ui/open-code-theme.d.ts +0 -58
  284. package/dist/ui/open-code-theme.d.ts.map +0 -1
  285. package/dist/ui/open-code-theme.js +0 -113
  286. package/dist/ui/open-code-theme.js.map +0 -1
  287. package/dist/ui/opencode-markdown.d.ts +0 -7
  288. package/dist/ui/opencode-markdown.d.ts.map +0 -1
  289. package/dist/ui/opencode-markdown.js +0 -169
  290. package/dist/ui/opencode-markdown.js.map +0 -1
  291. package/dist/ui/theme.d.ts +0 -68
  292. package/dist/ui/theme.d.ts.map +0 -1
  293. package/dist/ui/theme.js +0 -80
  294. package/dist/ui/theme.js.map +0 -1
  295. package/dist/utils/time.d.ts +0 -2
  296. package/dist/utils/time.d.ts.map +0 -1
  297. package/dist/utils/time.js +0 -7
  298. package/dist/utils/time.js.map +0 -1
package/README.md CHANGED
@@ -1,145 +1,97 @@
1
- # Renx Code
1
+ # OpenTUI Agent CLI (React + Bun)
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@renxqoo/renx-code.svg)](https://www.npmjs.com/package/@renxqoo/renx-code)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
- [![Node.js Version](https://img.shields.io/node/v/@renxqoo/renx-code.svg)](https://nodejs.org/)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue.svg)](https://www.typescriptlang.org/)
7
- [![React](https://img.shields.io/badge/React-19.2-blue.svg)](https://react.dev/)
8
- [![OpenTUI](https://img.shields.io/badge/OpenTUI-0.1.84-green.svg)](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
3
+ Initialized from the latest OpenTUI React template:
37
4
 
38
5
  ```bash
39
- # Start the interactive CLI
40
- renx
41
-
42
- # Or run directly with npx
43
- npx @renxqoo/renx-code
6
+ bun create tui --template react opentui-agent-cli
44
7
  ```
45
8
 
46
- ## 📦 Installation
47
-
48
- ### Prerequisites
9
+ Current package versions:
49
10
 
50
- - Node.js 20.0.0 or higher
51
- - npm, yarn, or pnpm
11
+ - `@opentui/core`: `0.1.84`
12
+ - `@opentui/react`: `0.1.84`
13
+ - `react`: `19.2.4`
52
14
 
53
- ### Global Installation
15
+ ## Run
54
16
 
55
17
  ```bash
56
- npm install -g @renxqoo/renx-code
18
+ bun dev
57
19
  ```
58
20
 
59
- ### Local Installation
21
+ Optional hot reload (less stable for interactive TUI signal handling):
60
22
 
61
23
  ```bash
62
- # Create a new project
63
- mkdir my-project && cd my-project
64
- npm init -y
24
+ bun run dev:watch
25
+ ```
65
26
 
66
- # Install @renxqoo/renx-code
67
- npm install @renxqoo/renx-code
27
+ ## What is implemented
68
28
 
69
- # Add to package.json scripts
70
- {
71
- "scripts": {
72
- "agent": "renx"
73
- }
74
- }
75
- ```
29
+ - Agent-style CLI chat layout (header, conversation panel, prompt input)
30
+ - Built-in commands: `/help`, `/clear`, `/exit`
31
+ - Keyboard shortcuts: `Esc` (stop current response when thinking, otherwise clear input), `Ctrl+L` (clear conversation)
32
+ - Simulated async agent reply flow
76
33
 
77
- ## 🎯 Usage
34
+ ## Main file
78
35
 
79
- ### Interactive Mode
36
+ - `src/index.tsx`
80
37
 
81
- ```bash
82
- renx
83
- ```
38
+ ## Configuration
84
39
 
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
40
+ OpenTUI Agent CLI uses the shared Renx config system.
90
41
 
91
- ### Keyboard Shortcuts
42
+ Effective precedence is:
92
43
 
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 |
44
+ 1. Existing process environment variables plus values loaded from `.env` / `.env.development`
45
+ 2. Project config: `<workspace>/.renx/config.json`
46
+ 3. Global config: `RENX_HOME/config.json`
47
+ 4. Built-in defaults
101
48
 
102
- ### Slash Commands
49
+ Directory-related state is managed from a single root:
103
50
 
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 |
51
+ - `RENX_HOME` defaults to `~/.renx`
52
+ - `RENX_HOME/config.json` for global config
53
+ - `RENX_HOME/logs/` for log files
54
+ - `RENX_HOME/storage/` for file-history storage
55
+ - `RENX_HOME/task/` for task data
56
+ - `RENX_HOME/data.db` for the shared SQLite database
113
57
 
114
- ## ⚙️ Configuration
58
+ ## Supported Environment Variables
115
59
 
116
- ### Environment Variables
60
+ Application/runtime variables:
117
61
 
118
- Configure the agent using environment variables:
62
+ - `RENX_HOME`: overrides the user-level Renx home directory
63
+ - `AGENT_MODEL`: default model id
64
+ - `AGENT_MAX_STEPS`: max steps per run
65
+ - `AGENT_MAX_RETRY_COUNT`: agent retry count
66
+ - `AGENT_TOOL_CONFIRMATION_MODE`: `manual`, `auto-approve`, or `auto-deny`
67
+ - `AGENT_CONVERSATION_ID`: fixed conversation id for the CLI runtime
68
+ - `AGENT_SESSION_ID`: fallback session id when `AGENT_CONVERSATION_ID` is unset
119
69
 
120
- ```bash
121
- # Set the AI model
122
- export AGENT_MODEL="gpt-4"
70
+ Logging variables:
123
71
 
124
- # Set maximum steps per run
125
- export AGENT_MAX_STEPS=1000
72
+ - `AGENT_LOG_LEVEL`: `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`, or `FATAL`
73
+ - `AGENT_LOG_FORMAT`: `pretty` or `json`
74
+ - `AGENT_LOG_CONSOLE`: enable/disable console logging
75
+ - `AGENT_LOG_FILE_ENABLED`: enable/disable file logging
126
76
 
127
- # Set confirmation mode
128
- export AGENT_TOOL_CONFIRMATION_MODE="manual"
77
+ File history variables:
129
78
 
130
- # Set logging level
131
- export AGENT_LOG_LEVEL="INFO"
132
- ```
79
+ - `AGENT_FILE_HISTORY_ENABLED`
80
+ - `AGENT_FILE_HISTORY_MAX_PER_FILE`
81
+ - `AGENT_FILE_HISTORY_MAX_AGE_DAYS`
82
+ - `AGENT_FILE_HISTORY_MAX_TOTAL_MB`
83
+
84
+ Model provider API keys are still provided through their own env vars such as `GLM_API_KEY`.
133
85
 
134
- ### Configuration Files
86
+ ## Config File Shape
135
87
 
136
- Create a configuration file at `~/.renx/config.json`:
88
+ Global and project config files use the same JSON structure:
137
89
 
138
90
  ```json
139
91
  {
140
92
  "agent": {
141
- "defaultModel": "gpt-4",
142
- "maxSteps": 1000,
93
+ "defaultModel": "qwen3.5-plus",
94
+ "maxSteps": 10000,
143
95
  "confirmationMode": "manual"
144
96
  },
145
97
  "log": {
@@ -159,120 +111,4 @@ Create a configuration file at `~/.renx/config.json`:
159
111
  }
160
112
  ```
161
113
 
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.
114
+ There are no per-directory config fields anymore. All user-level paths are derived from `RENX_HOME`.
package/bin/renx.cjs ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ const childProcess = require("node:child_process");
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+
7
+ const packageRoot = path.resolve(__dirname, "..");
8
+ const entryPath = path.join(packageRoot, "src", "index.tsx");
9
+ const bunExecutable = process.env.RENX_BUN_PATH || "bun";
10
+
11
+ if (!fs.existsSync(entryPath)) {
12
+ console.error(`Could not find CLI entrypoint: ${entryPath}`);
13
+ process.exit(1);
14
+ }
15
+
16
+ const result = childProcess.spawnSync(bunExecutable, [entryPath, ...process.argv.slice(2)], {
17
+ cwd: process.cwd(),
18
+ stdio: "inherit",
19
+ env: {
20
+ ...process.env,
21
+ AGENT_WORKDIR: process.env.AGENT_WORKDIR || process.cwd(),
22
+ },
23
+ });
24
+
25
+ if (result.error) {
26
+ if (result.error.code === "ENOENT") {
27
+ console.error("Bun is required to run renx. Install Bun first: https://bun.sh");
28
+ } else {
29
+ console.error(result.error.message);
30
+ }
31
+ process.exit(1);
32
+ }
33
+
34
+ process.exit(typeof result.status === "number" ? result.status : 0);
package/package.json CHANGED
@@ -1,71 +1,47 @@
1
1
  {
2
2
  "name": "@renxqoo/renx-code",
3
- "version": "0.0.2",
4
- "description": "Enterprise-grade AI coding assistant CLI tool with interactive terminal UI",
3
+ "version": "0.0.4",
4
+ "module": "src/index.tsx",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "private": false,
8
7
  "bin": {
9
- "renx": "./dist/cli.js"
10
- },
11
- "exports": {
12
- ".": {
13
- "import": "./dist/index.js",
14
- "types": "./dist/index.d.ts"
15
- },
16
- "./cli": {
17
- "import": "./dist/cli.js"
18
- }
8
+ "renx": "./bin/renx.cjs"
19
9
  },
20
10
  "files": [
21
- "dist",
11
+ "bin",
12
+ "src",
22
13
  "README.md",
23
- "LICENSE"
14
+ "tsconfig.json"
24
15
  ],
25
16
  "scripts": {
26
17
  "dev": "bun run src/index.tsx",
27
18
  "dev:watch": "bun run --watch src/index.tsx",
28
- "build": "tsc -p tsconfig.build.json && node ./scripts/fix-esm-imports.mjs",
29
- "build:cli": "npm run build && node -e \"require('fs').chmodSync('dist/cli.js', 0o755)\"",
30
- "start": "node dist/index.js",
31
- "test": "vitest",
32
- "test:coverage": "vitest run --coverage",
33
19
  "lint": "eslint . --ext .ts,.tsx",
34
20
  "lint:fix": "eslint . --ext .ts,.tsx --fix",
35
21
  "format": "prettier --write .",
36
22
  "format:check": "prettier --check .",
23
+ "test:run": "bun test src/context-usage-regressions.test.ts src/ui/theme.simple.test.ts src/ui/theme.test.ts src/runtime/exit.test.ts src/runtime/clipboard.test.ts src/runtime/terminal-theme.test.ts src/utils/time.test.ts src/components/tool-confirm-dialog-content.test.ts src/hooks/chat-local-replies.fixed.test.ts src/hooks/chat-local-replies.test.ts src/hooks/turn-updater.test.ts src/hooks/agent-event-handlers.test.ts src/hooks/use-agent-chat.status.test.ts src/files/attachment-capabilities.test.ts src/files/file-mention-query.test.ts src/commands/slash-commands.test.ts src/agent/runtime/runtime.simple.test.ts src/agent/runtime/tool-call-buffer.test.ts src/components/chat/assistant-reply.test.tsx src/components/chat/assistant-segment.test.ts src/components/chat/code-block.test.tsx src/components/chat/segment-groups.test.ts",
37
24
  "type-check": "tsc --noEmit",
38
25
  "check": "bun run type-check && bun run lint && bun run format:check",
39
- "prepare": "echo 'Skipping husky install'",
40
- "prepublishOnly": "npm run build:cli",
41
- "prepack": "npm run build:cli",
42
- "publish:patch": "npm version patch && npm run build:cli && npm publish",
43
- "publish:minor": "npm version minor && npm run build:cli && npm publish",
44
- "publish:major": "npm version major && npm run build:cli && npm publish"
45
- },
46
- "keywords": [
47
- "ai",
48
- "coding",
49
- "agent",
50
- "cli",
51
- "terminal",
52
- "tui",
53
- "react",
54
- "assistant",
55
- "developer-tools",
56
- "productivity",
57
- "opentui"
58
- ],
59
- "author": "",
60
- "license": "MIT",
61
- "repository": {
62
- "type": "git",
63
- "url": "https://github.com/renxqoo/renx-code.git"
26
+ "pack:dry": "npm pack --dry-run",
27
+ "pack:tgz": "npm pack",
28
+ "version:fix": "npm version patch",
29
+ "version:feature": "npm version minor",
30
+ "version:breaking": "npm version major",
31
+ "publish:fix": "npm run version:fix && npm publish",
32
+ "publish:feature": "npm run version:feature && npm publish",
33
+ "publish:breaking": "npm run version:breaking && npm publish",
34
+ "publish:patch": "npm run publish:fix",
35
+ "publish:minor": "npm run publish:feature",
36
+ "publish:major": "npm run publish:breaking",
37
+ "proxy": "w2 start",
38
+ "proxy:stop": "w2 stop",
39
+ "proxy:restart": "w2 restart"
64
40
  },
65
- "bugs": {
66
- "url": "https://github.com/renxqoo/renx-code/issues"
41
+ "engines": {
42
+ "node": ">=20.0.0",
43
+ "bun": ">=1.1.0"
67
44
  },
68
- "homepage": "https://github.com/renxqoo/renx-code#readme",
69
45
  "devDependencies": {
70
46
  "@eslint/js": "^10.0.1",
71
47
  "@testing-library/react": "^16.3.2",
@@ -83,11 +59,7 @@
83
59
  "eslint-plugin-react-hooks": "^7.0.1",
84
60
  "globals": "^17.4.0",
85
61
  "prettier": "^3.8.1",
86
- "whistle": "^2.10.1",
87
- "husky": "^8.0.3",
88
- "lint-staged": "^16.3.2",
89
- "typescript": "^5.9.3",
90
- "vitest": "^1.1.0"
62
+ "whistle": "^2.10.1"
91
63
  },
92
64
  "peerDependencies": {
93
65
  "typescript": "^5.9.3"
@@ -95,34 +67,6 @@
95
67
  "dependencies": {
96
68
  "@opentui/core": "^0.1.84",
97
69
  "@opentui/react": "^0.1.84",
98
- "react": "^19.2.4",
99
- "@vscode/ripgrep": "^1.17.0",
100
- "diff": "^8.0.3",
101
- "dotenv": "^17.3.1",
102
- "js-tiktoken": "^1.0.21",
103
- "log-update": "^6.1.0",
104
- "marked": "^15.0.12",
105
- "marked-terminal": "^7.3.0",
106
- "minimatch": "^10.2.4",
107
- "shell-quote": "^1.8.3",
108
- "strip-ansi": "^7.2.0",
109
- "uuid": "^13.0.0",
110
- "zod": "^4.3.6"
111
- },
112
- "engines": {
113
- "node": ">=20.0.0"
114
- },
115
- "lint-staged": {
116
- "*.ts": [
117
- "prettier --write",
118
- "eslint --fix"
119
- ],
120
- "*.tsx": [
121
- "prettier --write",
122
- "eslint --fix"
123
- ],
124
- "*.{json,md}": [
125
- "prettier --write"
126
- ]
70
+ "react": "^19.2.4"
127
71
  }
128
72
  }