@ritwikamit/cl8 0.1.0-alpha.14 → 0.1.0-alpha.16
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/README.md +547 -547
- package/dist/agents/Agent.js +12 -16
- package/dist/agents/Agent.js.map +1 -1
- package/dist/agents/Executor.js +5 -9
- package/dist/agents/Executor.js.map +1 -1
- package/dist/agents/Planner.js +7 -11
- package/dist/agents/Planner.js.map +1 -1
- package/dist/agents/Reflector.js +6 -10
- package/dist/agents/Reflector.js.map +1 -1
- package/dist/agents/index.js +4 -11
- package/dist/agents/index.js.map +1 -1
- package/dist/bin/cl8.js +2 -4
- package/dist/bin/cl8.js.map +1 -1
- package/dist/cli/commands/chat.js +9 -12
- package/dist/cli/commands/chat.js.map +1 -1
- package/dist/cli/commands/config.d.ts.map +1 -1
- package/dist/cli/commands/config.js +13 -19
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/init.js +17 -23
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/session.d.ts.map +1 -1
- package/dist/cli/commands/session.js +21 -27
- package/dist/cli/commands/session.js.map +1 -1
- package/dist/cli/hooks/useHistory.js +7 -14
- package/dist/cli/hooks/useHistory.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +33 -35
- package/dist/cli/index.js.map +1 -1
- package/dist/config/env.js +13 -24
- package/dist/config/env.js.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +22 -33
- package/dist/config/index.js.map +1 -1
- package/dist/core/Boot.d.ts.map +1 -1
- package/dist/core/Boot.js +34 -37
- package/dist/core/Boot.js.map +1 -1
- package/dist/core/Engine.js +20 -24
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Loop.d.ts.map +1 -1
- package/dist/core/Loop.js +46 -46
- package/dist/core/Loop.js.map +1 -1
- package/dist/core/index.js +2 -7
- package/dist/core/index.js.map +1 -1
- package/dist/index.js +9 -44
- package/dist/index.js.map +1 -1
- package/dist/memory/ConversationMemory.d.ts.map +1 -1
- package/dist/memory/ConversationMemory.js +13 -20
- package/dist/memory/ConversationMemory.js.map +1 -1
- package/dist/memory/SessionManager.js +13 -20
- package/dist/memory/SessionManager.js.map +1 -1
- package/dist/memory/VectorMemory.js +5 -9
- package/dist/memory/VectorMemory.js.map +1 -1
- package/dist/memory/index.js +3 -9
- package/dist/memory/index.js.map +1 -1
- package/dist/plugins/PluginLoader.js +12 -19
- package/dist/plugins/PluginLoader.js.map +1 -1
- package/dist/plugins/PluginManager.js +5 -9
- package/dist/plugins/PluginManager.js.map +1 -1
- package/dist/plugins/index.js +3 -8
- package/dist/plugins/index.js.map +1 -1
- package/dist/providers/BaseProvider.js +3 -7
- package/dist/providers/BaseProvider.js.map +1 -1
- package/dist/providers/GeminiProvider.js +4 -8
- package/dist/providers/GeminiProvider.js.map +1 -1
- package/dist/providers/OllamaProvider.js +2 -6
- package/dist/providers/OllamaProvider.js.map +1 -1
- package/dist/providers/OpenAIProvider.js +4 -11
- package/dist/providers/OpenAIProvider.js.map +1 -1
- package/dist/providers/index.js +10 -18
- package/dist/providers/index.js.map +1 -1
- package/dist/services/AuditService.js +8 -15
- package/dist/services/AuditService.js.map +1 -1
- package/dist/services/SecurityService.js +6 -13
- package/dist/services/SecurityService.js.map +1 -1
- package/dist/services/ToolService.d.ts.map +1 -1
- package/dist/services/ToolService.js +6 -10
- package/dist/services/ToolService.js.map +1 -1
- package/dist/services/index.js +3 -9
- package/dist/services/index.js.map +1 -1
- package/dist/tools/BaseTool.d.ts +2 -2
- package/dist/tools/BaseTool.d.ts.map +1 -1
- package/dist/tools/BaseTool.js +4 -8
- package/dist/tools/BaseTool.js.map +1 -1
- package/dist/tools/FileTool.js +16 -23
- package/dist/tools/FileTool.js.map +1 -1
- package/dist/tools/SearchTool.js +8 -15
- package/dist/tools/SearchTool.js.map +1 -1
- package/dist/tools/ShellTool.js +5 -9
- package/dist/tools/ShellTool.js.map +1 -1
- package/dist/tools/index.js +11 -20
- package/dist/tools/index.js.map +1 -1
- package/dist/types/agent.js +1 -2
- package/dist/types/config.js +1 -2
- package/dist/types/index.js +6 -22
- package/dist/types/index.js.map +1 -1
- package/dist/types/memory.js +1 -2
- package/dist/types/plugin.js +1 -2
- package/dist/types/provider.js +1 -2
- package/dist/types/tool.js +1 -2
- package/dist/ui/MarkdownRenderer.js +48 -55
- package/dist/ui/MarkdownRenderer.js.map +1 -1
- package/dist/ui/Spinner.js +11 -18
- package/dist/ui/Spinner.js.map +1 -1
- package/dist/ui/StreamingOutput.d.ts.map +1 -1
- package/dist/ui/StreamingOutput.js +3 -7
- package/dist/ui/StreamingOutput.js.map +1 -1
- package/dist/ui/context-monitor.js +6 -13
- package/dist/ui/context-monitor.js.map +1 -1
- package/dist/ui/index.js +12 -29
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/onboarding.js +9 -16
- package/dist/ui/onboarding.js.map +1 -1
- package/dist/ui/pixel-logo.d.ts.map +1 -1
- package/dist/ui/pixel-logo.js +3 -10
- package/dist/ui/pixel-logo.js.map +1 -1
- package/dist/ui/spinner-manager.js +11 -18
- package/dist/ui/spinner-manager.js.map +1 -1
- package/dist/ui/splash.d.ts.map +1 -1
- package/dist/ui/splash.js +12 -24
- package/dist/ui/splash.js.map +1 -1
- package/dist/ui/status-bar.js +8 -15
- package/dist/ui/status-bar.js.map +1 -1
- package/dist/ui/theme-manager.d.ts +7 -7
- package/dist/ui/theme-manager.d.ts.map +1 -1
- package/dist/ui/theme-manager.js +9 -17
- package/dist/ui/theme-manager.js.map +1 -1
- package/dist/ui/types.js +1 -2
- package/dist/ui/typing-animation.js +1 -5
- package/dist/ui/typing-animation.js.map +1 -1
- package/dist/ui/workspace-panel.d.ts.map +1 -1
- package/dist/ui/workspace-panel.js +3 -10
- package/dist/ui/workspace-panel.js.map +1 -1
- package/dist/utils/crypto.d.ts.map +1 -1
- package/dist/utils/crypto.js +12 -23
- package/dist/utils/crypto.js.map +1 -1
- package/dist/utils/file.js +9 -15
- package/dist/utils/file.js.map +1 -1
- package/dist/utils/index.js +3 -19
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/logger.js +17 -24
- package/dist/utils/logger.js.map +1 -1
- package/package.json +89 -88
package/README.md
CHANGED
|
@@ -1,547 +1,547 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# ⚡ CL8
|
|
4
|
-
|
|
5
|
-
### Terminal-First AI Coding & Automation Assistant
|
|
6
|
-
|
|
7
|
-
*Inspired by Claude Code · Gemini CLI · OpenAI Codex CLI · OpenHands · Aider · Cursor*
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
[](https://github.com/ritwikamit/cl8/actions/workflows/ci.yml)
|
|
12
|
-
[](https://www.npmjs.com/package/@ritwikamit/cl8)
|
|
13
|
-
[](https://www.npmjs.com/package/@ritwikamit/cl8)
|
|
14
|
-
[](LICENSE)
|
|
15
|
-
[](https://www.typescriptlang.org/)
|
|
16
|
-
[](https://nodejs.org/)
|
|
17
|
-
[](CONTRIBUTING.md)
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
**[Features](#features) · [Architecture](#architecture) · [Quick Start](#quick-start) · [Commands](#commands) · [Configuration](#configuration) · [Plugins](#plugin-system) · [Contributing](CONTRIBUTING.md)**
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
</div>
|
|
26
|
-
|
|
27
|
-
## 📋 Overview
|
|
28
|
-
|
|
29
|
-
**CL8** is a production-grade, terminal-native AI agent that lives in your command line. It understands natural language, writes and edits code, executes commands, searches your codebase, and automates complex multi-step workflows — all from the comfort of your terminal.
|
|
30
|
-
|
|
31
|
-
Unlike browser-based AI tools, CL8 operates **directly in your development environment**. It reads your files, understands your project structure, runs shell commands, and makes changes — with appropriate safety controls every step of the way.
|
|
32
|
-
|
|
33
|
-
### Why CL8?
|
|
34
|
-
|
|
35
|
-
- **Terminal-native** — No browser, no IDE plugin. Your terminal is your workspace.
|
|
36
|
-
- **Multi-provider** — Switch between OpenAI, Google Gemini, or local Ollama models.
|
|
37
|
-
- **Agentic workflow** — Plan, execute, reflect, and iterate autonomously.
|
|
38
|
-
- **Plugin architecture** — Extend with custom tools and MCP-compatible servers.
|
|
39
|
-
- **Security-first** — Sandboxed execution, command approval, and audit logging.
|
|
40
|
-
- **Persistent sessions** — Conversations survive process restarts with SQLite-backed memory.
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## ✨ Features
|
|
45
|
-
|
|
46
|
-
### 🤖 AI-Powered Chat
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
┌────────────────────────────────────────────────┐
|
|
50
|
-
│ cl8> explain the authentication flow │
|
|
51
|
-
│ │
|
|
52
|
-
│ 🔍 Analyzing your auth system... │
|
|
53
|
-
│ │
|
|
54
|
-
│ The authentication flow uses JWT tokens │
|
|
55
|
-
│ with refresh rotation... │
|
|
56
|
-
│ │
|
|
57
|
-
│ Files analyzed: │
|
|
58
|
-
│ • src/auth/middleware.ts │
|
|
59
|
-
│ • src/auth/service.ts │
|
|
60
|
-
│ • src/auth/types.ts │
|
|
61
|
-
└────────────────────────────────────────────────┘
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
- Natural language interaction
|
|
65
|
-
- Streaming responses with markdown rendering
|
|
66
|
-
- Syntax-highlighted code blocks
|
|
67
|
-
- Multi-line input support
|
|
68
|
-
- Command history and slash commands
|
|
69
|
-
|
|
70
|
-
### 💻 Code Generation & Editing
|
|
71
|
-
|
|
72
|
-
- Generate code from natural language descriptions
|
|
73
|
-
- Read, write, and edit files with surgical precision
|
|
74
|
-
- Multi-file refactoring and corrections
|
|
75
|
-
- Code explanation and documentation generation
|
|
76
|
-
- Pattern-based search and replace
|
|
77
|
-
|
|
78
|
-
### 🛠️ Terminal Execution
|
|
79
|
-
|
|
80
|
-
- Execute shell commands directly from chat
|
|
81
|
-
- Command approval prompts for dangerous operations
|
|
82
|
-
- Live streaming of command output
|
|
83
|
-
- Secure command sandboxing
|
|
84
|
-
- Blocked command detection
|
|
85
|
-
|
|
86
|
-
### 🔍 Codebase Search
|
|
87
|
-
|
|
88
|
-
- Regex pattern searching across files
|
|
89
|
-
- File glob pattern matching
|
|
90
|
-
- Respects `.gitignore` patterns
|
|
91
|
-
- Directory-aware search scope
|
|
92
|
-
|
|
93
|
-
### 🧠 Agent Loop
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
User Prompt
|
|
97
|
-
│
|
|
98
|
-
▼
|
|
99
|
-
┌─────────────┐
|
|
100
|
-
│ Planner │ ── Break down task into steps
|
|
101
|
-
└──────┬──────┘
|
|
102
|
-
│
|
|
103
|
-
▼
|
|
104
|
-
┌─────────────┐
|
|
105
|
-
│ Executor │ ── Execute each step with tools
|
|
106
|
-
└──────┬──────┘
|
|
107
|
-
│
|
|
108
|
-
▼
|
|
109
|
-
┌─────────────┐
|
|
110
|
-
│ Reflector │ ── Evaluate results, replan if needed
|
|
111
|
-
└──────┬──────┘
|
|
112
|
-
│
|
|
113
|
-
▼
|
|
114
|
-
Final Response
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### 📦 Plugin System
|
|
118
|
-
|
|
119
|
-
- Dynamic plugin loading from directories
|
|
120
|
-
- Plugin manifests for metadata
|
|
121
|
-
- Tool registration API
|
|
122
|
-
- Hooks for lifecycle events
|
|
123
|
-
- MCP compatibility layer (future)
|
|
124
|
-
|
|
125
|
-
### 💾 Memory & Persistence
|
|
126
|
-
|
|
127
|
-
- Conversation history with automatic compaction
|
|
128
|
-
- Session management with resume capability
|
|
129
|
-
- Token usage tracking
|
|
130
|
-
- Workspace-scoped memory
|
|
131
|
-
- Vector memory for semantic search (abstraction)
|
|
132
|
-
|
|
133
|
-
### 🔒 Security
|
|
134
|
-
|
|
135
|
-
- Workspace sandboxing — files outside workspace are protected
|
|
136
|
-
- Command approval prompts for dangerous operations
|
|
137
|
-
- Blocked command detection and prevention
|
|
138
|
-
- API key encryption at rest
|
|
139
|
-
- Full audit logging of all tool calls
|
|
140
|
-
- Configurable approval modes: `ask`, `auto`, `deny`
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
|
|
144
|
-
## 🏗️ Architecture
|
|
145
|
-
|
|
146
|
-
CL8 follows a **layered, service-oriented architecture** designed for modularity and extensibility.
|
|
147
|
-
|
|
148
|
-
```
|
|
149
|
-
┌─────────────────────────────────────────────────┐
|
|
150
|
-
│ CLI Layer │
|
|
151
|
-
│ Commander.js · Chalk · Ora · Inquirer │
|
|
152
|
-
├─────────────────────────────────────────────────┤
|
|
153
|
-
│ Agent Layer │
|
|
154
|
-
│ Planner → Executor → Reflector → Agent │
|
|
155
|
-
├─────────────────────────────────────────────────┤
|
|
156
|
-
│ Tool Layer │
|
|
157
|
-
│ FileTool · ShellTool · SearchTool · Plugin │
|
|
158
|
-
├─────────────────────────────────────────────────┤
|
|
159
|
-
│ Service Layer │
|
|
160
|
-
│ ToolService · SecurityService · AuditService │
|
|
161
|
-
├─────────────────────────────────────────────────┤
|
|
162
|
-
│ Provider Layer │
|
|
163
|
-
│ OpenAI · Gemini · Ollama (abstracted) │
|
|
164
|
-
├─────────────────────────────────────────────────┤
|
|
165
|
-
│ Memory Layer │
|
|
166
|
-
│ Conversation · Session · Vector │
|
|
167
|
-
├─────────────────────────────────────────────────┤
|
|
168
|
-
│ Plugin Layer │
|
|
169
|
-
│ PluginManager · PluginLoader · MCP (future) │
|
|
170
|
-
└─────────────────────────────────────────────────┘
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Core Loop
|
|
174
|
-
|
|
175
|
-
The agentic loop is the heart of CL8:
|
|
176
|
-
|
|
177
|
-
1. **Plan** — The Planner receives user input and available tools, then decomposes the task into sequential steps using the LLM.
|
|
178
|
-
|
|
179
|
-
2. **Execute** — The Executor runs each step through the appropriate tool (file, shell, search), collecting results.
|
|
180
|
-
|
|
181
|
-
3. **Reflect** — The Reflector evaluates execution results, detects failures, and decides whether to replan or generate a final response.
|
|
182
|
-
|
|
183
|
-
4. **Respond** — The agent synthesizes a final response summarizing what was done and the results.
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## 📁 Folder Structure
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
cl8/
|
|
191
|
-
│
|
|
192
|
-
├── src/
|
|
193
|
-
│ ├── agents/ # Agent orchestration
|
|
194
|
-
│ │ ├── Agent.ts # Main agent (loop coordinator)
|
|
195
|
-
│ │ ├── Planner.ts # Task decomposition
|
|
196
|
-
│ │ ├── Executor.ts # Step execution
|
|
197
|
-
│ │ └── Reflector.ts # Result evaluation
|
|
198
|
-
│ │
|
|
199
|
-
│ ├── cli/ # CLI framework
|
|
200
|
-
│ │ ├── index.ts # Commander.js setup
|
|
201
|
-
│ │ └── commands/ # Command implementations
|
|
202
|
-
│ │ ├── chat.ts # Interactive session
|
|
203
|
-
│ │ ├── init.ts # First-time setup
|
|
204
|
-
│ │ ├── session.ts # Session management
|
|
205
|
-
│ │ └── config.ts # Configuration management
|
|
206
|
-
│ │
|
|
207
|
-
│ ├── config/ # Configuration
|
|
208
|
-
│ │ ├── index.ts # Config loader (JSON store + .env)
|
|
209
|
-
│ │ └── env.ts # Environment variable helpers
|
|
210
|
-
│ │
|
|
211
|
-
│ ├── core/ # Core engine
|
|
212
|
-
│ │ ├── Engine.ts # Service orchestration
|
|
213
|
-
│ │ └── Loop.ts # Interactive REPL loop
|
|
214
|
-
│ │
|
|
215
|
-
│ ├── memory/ # Persistence
|
|
216
|
-
│ │ ├── ConversationMemory.ts # Message history
|
|
217
|
-
│ │ ├── SessionManager.ts # Session lifecycle
|
|
218
|
-
│ │ └── VectorMemory.ts # Semantic search (abstraction)
|
|
219
|
-
│ │
|
|
220
|
-
│ ├── plugins/ # Plugin system
|
|
221
|
-
│ │ ├── PluginManager.ts # Plugin lifecycle
|
|
222
|
-
│ │ └── PluginLoader.ts # Dynamic loading
|
|
223
|
-
│ │
|
|
224
|
-
│ ├── providers/ # AI provider abstraction
|
|
225
|
-
│ │ ├── BaseProvider.ts # Abstract interface
|
|
226
|
-
│ │ ├── OpenAIProvider.ts # OpenAI / GPT
|
|
227
|
-
│ │ ├── GeminiProvider.ts # Google Gemini
|
|
228
|
-
│ │ └── OllamaProvider.ts # Local models
|
|
229
|
-
│ │
|
|
230
|
-
│ ├── services/ # Business logic
|
|
231
|
-
│ │ ├── ToolService.ts # Tool dispatch
|
|
232
|
-
│ │ ├── SecurityService.ts # Security & approval
|
|
233
|
-
│ │ └── AuditService.ts # Logging & audit
|
|
234
|
-
│ │
|
|
235
|
-
│ ├── tools/ # Tool implementations
|
|
236
|
-
│ │ ├── BaseTool.ts # Abstract tool
|
|
237
|
-
│ │ ├── FileTool.ts # File read/write/edit
|
|
238
|
-
│ │ ├── ShellTool.ts # Command execution
|
|
239
|
-
│ │ └── SearchTool.ts # Code search
|
|
240
|
-
│ │
|
|
241
|
-
│ ├── types/ # TypeScript type definitions
|
|
242
|
-
│ │ ├── agent.ts # Agent types
|
|
243
|
-
│ │ ├── config.ts # Configuration types
|
|
244
|
-
│ │ ├── memory.ts # Memory types
|
|
245
|
-
│ │ ├── plugin.ts # Plugin types
|
|
246
|
-
│ │ ├── provider.ts # Provider types
|
|
247
|
-
│ │ └── tool.ts # Tool types
|
|
248
|
-
│ │
|
|
249
|
-
│ ├── ui/ # Terminal UI
|
|
250
|
-
│ │ ├── MarkdownRenderer.ts # Markdown → terminal
|
|
251
|
-
│ │ ├── Spinner.ts # Loading spinners
|
|
252
|
-
│ │ └── StreamingOutput.ts # Stream management
|
|
253
|
-
│ │
|
|
254
|
-
│ ├── utils/ # Utilities
|
|
255
|
-
│ │ ├── crypto.ts # Encryption, IDs, hashing
|
|
256
|
-
│ │ └── logger.ts # Winston logger
|
|
257
|
-
│ │
|
|
258
|
-
│ └── bin/ # Entry point
|
|
259
|
-
│ └── cl8.ts # CLI binary
|
|
260
|
-
│
|
|
261
|
-
├── plugins/ # User-installed plugins
|
|
262
|
-
├── examples/ # Plugin examples
|
|
263
|
-
├── scripts/ # Build/utility scripts
|
|
264
|
-
├── tests/ # Test suite
|
|
265
|
-
├── docs/ # Documentation
|
|
266
|
-
├── logs/ # Application logs
|
|
267
|
-
│
|
|
268
|
-
├── .env.example # Environment template
|
|
269
|
-
├── .github/workflows/ # CI/CD pipelines
|
|
270
|
-
├── CONTRIBUTING.md # Contribution guide
|
|
271
|
-
├── LICENSE # MIT license
|
|
272
|
-
└── README.md # You are here
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## 🚀 Quick Start
|
|
278
|
-
|
|
279
|
-
### Prerequisites
|
|
280
|
-
|
|
281
|
-
- **Node.js** v18.0.0 or higher
|
|
282
|
-
- **npm** v9.0.0 or higher
|
|
283
|
-
- An API key for your preferred AI provider (optional for Ollama)
|
|
284
|
-
|
|
285
|
-
### ⚡ One-Liner Install
|
|
286
|
-
|
|
287
|
-
**Windows (PowerShell)**:
|
|
288
|
-
```powershell
|
|
289
|
-
# Option A: Run instantly with npx (no install needed)
|
|
290
|
-
npx @ritwikamit/cl8
|
|
291
|
-
|
|
292
|
-
# Option B: Install globally
|
|
293
|
-
npm install -g @ritwikamit/cl8
|
|
294
|
-
cl8
|
|
295
|
-
|
|
296
|
-
# Option C: Automated installer
|
|
297
|
-
irm https://raw.githubusercontent.com/ritwikamit/cl8/main/scripts/install.ps1 | iex
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
**macOS / Linux**:
|
|
301
|
-
```bash
|
|
302
|
-
# Option A: Run instantly with npx (no install needed)
|
|
303
|
-
npx @ritwikamit/cl8
|
|
304
|
-
|
|
305
|
-
# Option B: Install globally
|
|
306
|
-
npm install -g @ritwikamit/cl8
|
|
307
|
-
cl8
|
|
308
|
-
|
|
309
|
-
# Option C: Automated installer
|
|
310
|
-
curl -fsSL https://raw.githubusercontent.com/ritwikamit/cl8/main/scripts/install.sh | bash
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
### 2. Configure Your AI Provider
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
# Run the setup wizard
|
|
317
|
-
cl8 init
|
|
318
|
-
|
|
319
|
-
# Or configure manually by creating .env:
|
|
320
|
-
cp .env.example .env
|
|
321
|
-
# Then edit .env with your API keys
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### 3. Start Using CL8
|
|
325
|
-
|
|
326
|
-
```text
|
|
327
|
-
cl8
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
### 4. Example Commands
|
|
331
|
-
|
|
332
|
-
Once CL8 is running, try these:
|
|
333
|
-
|
|
334
|
-
```text
|
|
335
|
-
cl8> Explain what this project does
|
|
336
|
-
|
|
337
|
-
cl8> Find all TODO comments in the codebase
|
|
338
|
-
|
|
339
|
-
cl8> Create a new React component for a login form
|
|
340
|
-
|
|
341
|
-
cl8> Debug the test failure in src/tests/auth.test.ts
|
|
342
|
-
|
|
343
|
-
cl8> Refactor the database service to use connection pooling
|
|
344
|
-
|
|
345
|
-
cl8> /help # Show all available commands
|
|
346
|
-
cl8> /clear # Clear the conversation
|
|
347
|
-
cl8> /status # Show session information
|
|
348
|
-
```
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
## 📟 Commands
|
|
353
|
-
|
|
354
|
-
### CLI Commands
|
|
355
|
-
|
|
356
|
-
| Command | Description |
|
|
357
|
-
|---------|-------------|
|
|
358
|
-
| `cl8` or `cl8 chat` | Start interactive chat session |
|
|
359
|
-
| `cl8 init` | Initialize configuration wizard |
|
|
360
|
-
| `cl8 session --list` | List recent sessions |
|
|
361
|
-
| `cl8 session --show <id>` | Show session details |
|
|
362
|
-
| `cl8 session --resume <id>` | Resume a session |
|
|
363
|
-
| `cl8 config --show` | Show current configuration |
|
|
364
|
-
| `cl8 config --set <key> --value <val>` | Set configuration value |
|
|
365
|
-
| `cl8 config --reset` | Reset to defaults |
|
|
366
|
-
| `cl8 doctor` | Check system health |
|
|
367
|
-
| `cl8 --version` | Show version |
|
|
368
|
-
| `cl8 --help` | Show help |
|
|
369
|
-
|
|
370
|
-
### Slash Commands (in chat)
|
|
371
|
-
|
|
372
|
-
| Command | Description |
|
|
373
|
-
|---------|-------------|
|
|
374
|
-
| `/help` | Show available slash commands |
|
|
375
|
-
| `/clear` | Clear the conversation |
|
|
376
|
-
| `/reset` | Reset the agent state |
|
|
377
|
-
| `/status` | Show current session info |
|
|
378
|
-
| `/session` | Show session details |
|
|
379
|
-
| `/tokens` | Show token usage |
|
|
380
|
-
| `/mode <ask\|auto\|deny>` | Set approval mode |
|
|
381
|
-
| `/exit` | Exit CL8 |
|
|
382
|
-
|
|
383
|
-
### CLI Options
|
|
384
|
-
|
|
385
|
-
```text
|
|
386
|
-
cl8 chat [options]
|
|
387
|
-
|
|
388
|
-
Options:
|
|
389
|
-
-p, --provider <provider> AI provider (openai, gemini, ollama)
|
|
390
|
-
-m, --model <model> Model name (e.g. gpt-4o, gemini-2.0-flash)
|
|
391
|
-
-w, --workspace <path> Workspace directory
|
|
392
|
-
-s, --session <id> Resume a previous session
|
|
393
|
-
-h, --help Display help
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
## ⚙️ Configuration
|
|
399
|
-
|
|
400
|
-
### Environment Variables (.env)
|
|
401
|
-
|
|
402
|
-
| Variable | Description | Default |
|
|
403
|
-
|----------|-------------|---------|
|
|
404
|
-
| `OPENAI_API_KEY` | OpenAI API key | — |
|
|
405
|
-
| `OPENAI_MODEL` | OpenAI model name | `gpt-4o` |
|
|
406
|
-
| `GEMINI_API_KEY` | Google Gemini API key | — |
|
|
407
|
-
| `GEMINI_MODEL` | Gemini model name | `gemini-2.0-flash` |
|
|
408
|
-
| `OLLAMA_BASE_URL` | Ollama server URL | `http://localhost:11434` |
|
|
409
|
-
| `OLLAMA_MODEL` | Ollama model name | `codellama` |
|
|
410
|
-
| `CL8_DEFAULT_PROVIDER` | Default AI provider | `openai` |
|
|
411
|
-
| `CL8_WORKSPACE` | Workspace directory | `./workspace` |
|
|
412
|
-
| `CL8_APPROVAL_MODE` | Command approval (`ask`, `auto`, `deny`) | `ask` |
|
|
413
|
-
| `CL8_LOG_LEVEL` | Logging level | `info` |
|
|
414
|
-
| `CL8_PLUGIN_DIRS` | Plugin directories | `./plugins` |
|
|
415
|
-
|
|
416
|
-
### Approval Modes
|
|
417
|
-
|
|
418
|
-
| Mode | Behavior |
|
|
419
|
-
|------|----------|
|
|
420
|
-
| `ask` | Prompt for approval on dangerous commands (default, safest) |
|
|
421
|
-
| `auto` | Auto-approve commands with guardrails |
|
|
422
|
-
| `deny` | Block all command execution (read-only mode) |
|
|
423
|
-
|
|
424
|
-
---
|
|
425
|
-
|
|
426
|
-
## 🔌 Plugin System
|
|
427
|
-
|
|
428
|
-
CL8 features a dynamic plugin system that allows you to extend its capabilities.
|
|
429
|
-
|
|
430
|
-
### Plugin Structure
|
|
431
|
-
|
|
432
|
-
```
|
|
433
|
-
plugins/
|
|
434
|
-
my-plugin/
|
|
435
|
-
manifest.json # Plugin metadata
|
|
436
|
-
index.js # Compiled entry point
|
|
437
|
-
```
|
|
438
|
-
|
|
439
|
-
### Manifest Format
|
|
440
|
-
|
|
441
|
-
```json
|
|
442
|
-
{
|
|
443
|
-
"name": "my-plugin",
|
|
444
|
-
"version": "1.0.0",
|
|
445
|
-
"description": "Description of your plugin",
|
|
446
|
-
"author": "Your Name",
|
|
447
|
-
"license": "MIT",
|
|
448
|
-
"entry": "index.js"
|
|
449
|
-
}
|
|
450
|
-
```
|
|
451
|
-
|
|
452
|
-
### Plugin API
|
|
453
|
-
|
|
454
|
-
Plugins receive a `PluginAPI` object with:
|
|
455
|
-
|
|
456
|
-
- `registerTool(tool)` — Register a custom tool
|
|
457
|
-
- `getTools()` — List registered tools
|
|
458
|
-
- `log(level, message)` — Log through CL8's logger
|
|
459
|
-
- `config` — Plugin configuration from manifest
|
|
460
|
-
|
|
461
|
-
---
|
|
462
|
-
|
|
463
|
-
## 🧪 Development
|
|
464
|
-
|
|
465
|
-
```bash
|
|
466
|
-
# Type check
|
|
467
|
-
npm run typecheck
|
|
468
|
-
|
|
469
|
-
# Lint
|
|
470
|
-
npm run lint
|
|
471
|
-
|
|
472
|
-
# Run tests
|
|
473
|
-
npm test
|
|
474
|
-
|
|
475
|
-
# Watch mode
|
|
476
|
-
npm run build:watch
|
|
477
|
-
|
|
478
|
-
# Development with hot reload
|
|
479
|
-
npm run dev
|
|
480
|
-
```
|
|
481
|
-
|
|
482
|
-
---
|
|
483
|
-
|
|
484
|
-
## 🛣️ Roadmap
|
|
485
|
-
|
|
486
|
-
- [x] Interactive chat with streaming responses
|
|
487
|
-
- [x] Multi-provider AI support (OpenAI, Gemini, Ollama)
|
|
488
|
-
- [x] File system tools (read, write, edit, search)
|
|
489
|
-
- [x] Shell command execution with security controls
|
|
490
|
-
- [x] Agent loop (Plan → Execute → Reflect)
|
|
491
|
-
- [x] Session persistence and management
|
|
492
|
-
- [x] Plugin architecture
|
|
493
|
-
- [x] Audit logging and security
|
|
494
|
-
- [ ] MCP (Model Context Protocol) support
|
|
495
|
-
- [ ] GitHub integration (PR review, issue management)
|
|
496
|
-
- [ ] Web search and browsing capabilities
|
|
497
|
-
- [ ] Docker sandbox for command execution
|
|
498
|
-
- [ ] Vector database for semantic memory
|
|
499
|
-
- [ ] Multi-agent orchestration
|
|
500
|
-
- [ ] VS Code extension integration
|
|
501
|
-
- [ ] Linux and macOS native packages
|
|
502
|
-
- [ ] Configuration UI (TUI)
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
## 🤝 Contributing
|
|
507
|
-
|
|
508
|
-
Please read our [Contributing Guide](CONTRIBUTING.md) for details on:
|
|
509
|
-
|
|
510
|
-
- Setting up a development environment
|
|
511
|
-
- Code style and conventions
|
|
512
|
-
- Testing requirements
|
|
513
|
-
- Pull request process
|
|
514
|
-
|
|
515
|
-
All contributions are welcome! 🎉
|
|
516
|
-
|
|
517
|
-
---
|
|
518
|
-
|
|
519
|
-
## 📄 License
|
|
520
|
-
|
|
521
|
-
This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
|
|
522
|
-
|
|
523
|
-
---
|
|
524
|
-
|
|
525
|
-
## 🙏 Acknowledgments
|
|
526
|
-
|
|
527
|
-
CL8 stands on the shoulders of giants. It draws inspiration from:
|
|
528
|
-
|
|
529
|
-
- **[Claude Code](https://docs.anthropic.com/en/docs/claude-code)** by Anthropic — Agentic coding in the terminal
|
|
530
|
-
- **[Gemini CLI](https://github.com/google-gemini/gemini-cli)** by Google — Open-source AI agent
|
|
531
|
-
- **[OpenAI Codex CLI](https://github.com/openai/codex)** by OpenAI — Coding agent runtime
|
|
532
|
-
- **[OpenHands](https://github.com/All-Hands-AI/OpenHands)** — Open platform for AI software developers
|
|
533
|
-
- **[Aider](https://github.com/Aider-AI/aider)** by Paul Gauthier — AI pair programming
|
|
534
|
-
- **[Cursor](https://cursor.sh)** — AI-first code editor
|
|
535
|
-
- **[Cline](https://github.com/cline/cline)** — Autonomous coding agent
|
|
536
|
-
|
|
537
|
-
Built with ❤️ for the open-source community.
|
|
538
|
-
|
|
539
|
-
---
|
|
540
|
-
|
|
541
|
-
<div align="center">
|
|
542
|
-
|
|
543
|
-
**⭐ Star us on GitHub — it helps!**
|
|
544
|
-
|
|
545
|
-
[Report Bug](https://github.com/ritwikamit/cl8/issues) · [Request Feature](https://github.com/ritwikamit/cl8/issues)
|
|
546
|
-
|
|
547
|
-
</div>
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ⚡ CL8
|
|
4
|
+
|
|
5
|
+
### Terminal-First AI Coding & Automation Assistant
|
|
6
|
+
|
|
7
|
+
*Inspired by Claude Code · Gemini CLI · OpenAI Codex CLI · OpenHands · Aider · Cursor*
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
[](https://github.com/ritwikamit/cl8/actions/workflows/ci.yml)
|
|
12
|
+
[](https://www.npmjs.com/package/@ritwikamit/cl8)
|
|
13
|
+
[](https://www.npmjs.com/package/@ritwikamit/cl8)
|
|
14
|
+
[](LICENSE)
|
|
15
|
+
[](https://www.typescriptlang.org/)
|
|
16
|
+
[](https://nodejs.org/)
|
|
17
|
+
[](CONTRIBUTING.md)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
**[Features](#features) · [Architecture](#architecture) · [Quick Start](#quick-start) · [Commands](#commands) · [Configuration](#configuration) · [Plugins](#plugin-system) · [Contributing](CONTRIBUTING.md)**
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
## 📋 Overview
|
|
28
|
+
|
|
29
|
+
**CL8** is a production-grade, terminal-native AI agent that lives in your command line. It understands natural language, writes and edits code, executes commands, searches your codebase, and automates complex multi-step workflows — all from the comfort of your terminal.
|
|
30
|
+
|
|
31
|
+
Unlike browser-based AI tools, CL8 operates **directly in your development environment**. It reads your files, understands your project structure, runs shell commands, and makes changes — with appropriate safety controls every step of the way.
|
|
32
|
+
|
|
33
|
+
### Why CL8?
|
|
34
|
+
|
|
35
|
+
- **Terminal-native** — No browser, no IDE plugin. Your terminal is your workspace.
|
|
36
|
+
- **Multi-provider** — Switch between OpenAI, Google Gemini, or local Ollama models.
|
|
37
|
+
- **Agentic workflow** — Plan, execute, reflect, and iterate autonomously.
|
|
38
|
+
- **Plugin architecture** — Extend with custom tools and MCP-compatible servers.
|
|
39
|
+
- **Security-first** — Sandboxed execution, command approval, and audit logging.
|
|
40
|
+
- **Persistent sessions** — Conversations survive process restarts with SQLite-backed memory.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## ✨ Features
|
|
45
|
+
|
|
46
|
+
### 🤖 AI-Powered Chat
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
┌────────────────────────────────────────────────┐
|
|
50
|
+
│ cl8> explain the authentication flow │
|
|
51
|
+
│ │
|
|
52
|
+
│ 🔍 Analyzing your auth system... │
|
|
53
|
+
│ │
|
|
54
|
+
│ The authentication flow uses JWT tokens │
|
|
55
|
+
│ with refresh rotation... │
|
|
56
|
+
│ │
|
|
57
|
+
│ Files analyzed: │
|
|
58
|
+
│ • src/auth/middleware.ts │
|
|
59
|
+
│ • src/auth/service.ts │
|
|
60
|
+
│ • src/auth/types.ts │
|
|
61
|
+
└────────────────────────────────────────────────┘
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- Natural language interaction
|
|
65
|
+
- Streaming responses with markdown rendering
|
|
66
|
+
- Syntax-highlighted code blocks
|
|
67
|
+
- Multi-line input support
|
|
68
|
+
- Command history and slash commands
|
|
69
|
+
|
|
70
|
+
### 💻 Code Generation & Editing
|
|
71
|
+
|
|
72
|
+
- Generate code from natural language descriptions
|
|
73
|
+
- Read, write, and edit files with surgical precision
|
|
74
|
+
- Multi-file refactoring and corrections
|
|
75
|
+
- Code explanation and documentation generation
|
|
76
|
+
- Pattern-based search and replace
|
|
77
|
+
|
|
78
|
+
### 🛠️ Terminal Execution
|
|
79
|
+
|
|
80
|
+
- Execute shell commands directly from chat
|
|
81
|
+
- Command approval prompts for dangerous operations
|
|
82
|
+
- Live streaming of command output
|
|
83
|
+
- Secure command sandboxing
|
|
84
|
+
- Blocked command detection
|
|
85
|
+
|
|
86
|
+
### 🔍 Codebase Search
|
|
87
|
+
|
|
88
|
+
- Regex pattern searching across files
|
|
89
|
+
- File glob pattern matching
|
|
90
|
+
- Respects `.gitignore` patterns
|
|
91
|
+
- Directory-aware search scope
|
|
92
|
+
|
|
93
|
+
### 🧠 Agent Loop
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
User Prompt
|
|
97
|
+
│
|
|
98
|
+
▼
|
|
99
|
+
┌─────────────┐
|
|
100
|
+
│ Planner │ ── Break down task into steps
|
|
101
|
+
└──────┬──────┘
|
|
102
|
+
│
|
|
103
|
+
▼
|
|
104
|
+
┌─────────────┐
|
|
105
|
+
│ Executor │ ── Execute each step with tools
|
|
106
|
+
└──────┬──────┘
|
|
107
|
+
│
|
|
108
|
+
▼
|
|
109
|
+
┌─────────────┐
|
|
110
|
+
│ Reflector │ ── Evaluate results, replan if needed
|
|
111
|
+
└──────┬──────┘
|
|
112
|
+
│
|
|
113
|
+
▼
|
|
114
|
+
Final Response
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 📦 Plugin System
|
|
118
|
+
|
|
119
|
+
- Dynamic plugin loading from directories
|
|
120
|
+
- Plugin manifests for metadata
|
|
121
|
+
- Tool registration API
|
|
122
|
+
- Hooks for lifecycle events
|
|
123
|
+
- MCP compatibility layer (future)
|
|
124
|
+
|
|
125
|
+
### 💾 Memory & Persistence
|
|
126
|
+
|
|
127
|
+
- Conversation history with automatic compaction
|
|
128
|
+
- Session management with resume capability
|
|
129
|
+
- Token usage tracking
|
|
130
|
+
- Workspace-scoped memory
|
|
131
|
+
- Vector memory for semantic search (abstraction)
|
|
132
|
+
|
|
133
|
+
### 🔒 Security
|
|
134
|
+
|
|
135
|
+
- Workspace sandboxing — files outside workspace are protected
|
|
136
|
+
- Command approval prompts for dangerous operations
|
|
137
|
+
- Blocked command detection and prevention
|
|
138
|
+
- API key encryption at rest
|
|
139
|
+
- Full audit logging of all tool calls
|
|
140
|
+
- Configurable approval modes: `ask`, `auto`, `deny`
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 🏗️ Architecture
|
|
145
|
+
|
|
146
|
+
CL8 follows a **layered, service-oriented architecture** designed for modularity and extensibility.
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
┌─────────────────────────────────────────────────┐
|
|
150
|
+
│ CLI Layer │
|
|
151
|
+
│ Commander.js · Chalk · Ora · Inquirer │
|
|
152
|
+
├─────────────────────────────────────────────────┤
|
|
153
|
+
│ Agent Layer │
|
|
154
|
+
│ Planner → Executor → Reflector → Agent │
|
|
155
|
+
├─────────────────────────────────────────────────┤
|
|
156
|
+
│ Tool Layer │
|
|
157
|
+
│ FileTool · ShellTool · SearchTool · Plugin │
|
|
158
|
+
├─────────────────────────────────────────────────┤
|
|
159
|
+
│ Service Layer │
|
|
160
|
+
│ ToolService · SecurityService · AuditService │
|
|
161
|
+
├─────────────────────────────────────────────────┤
|
|
162
|
+
│ Provider Layer │
|
|
163
|
+
│ OpenAI · Gemini · Ollama (abstracted) │
|
|
164
|
+
├─────────────────────────────────────────────────┤
|
|
165
|
+
│ Memory Layer │
|
|
166
|
+
│ Conversation · Session · Vector │
|
|
167
|
+
├─────────────────────────────────────────────────┤
|
|
168
|
+
│ Plugin Layer │
|
|
169
|
+
│ PluginManager · PluginLoader · MCP (future) │
|
|
170
|
+
└─────────────────────────────────────────────────┘
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Core Loop
|
|
174
|
+
|
|
175
|
+
The agentic loop is the heart of CL8:
|
|
176
|
+
|
|
177
|
+
1. **Plan** — The Planner receives user input and available tools, then decomposes the task into sequential steps using the LLM.
|
|
178
|
+
|
|
179
|
+
2. **Execute** — The Executor runs each step through the appropriate tool (file, shell, search), collecting results.
|
|
180
|
+
|
|
181
|
+
3. **Reflect** — The Reflector evaluates execution results, detects failures, and decides whether to replan or generate a final response.
|
|
182
|
+
|
|
183
|
+
4. **Respond** — The agent synthesizes a final response summarizing what was done and the results.
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## 📁 Folder Structure
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
cl8/
|
|
191
|
+
│
|
|
192
|
+
├── src/
|
|
193
|
+
│ ├── agents/ # Agent orchestration
|
|
194
|
+
│ │ ├── Agent.ts # Main agent (loop coordinator)
|
|
195
|
+
│ │ ├── Planner.ts # Task decomposition
|
|
196
|
+
│ │ ├── Executor.ts # Step execution
|
|
197
|
+
│ │ └── Reflector.ts # Result evaluation
|
|
198
|
+
│ │
|
|
199
|
+
│ ├── cli/ # CLI framework
|
|
200
|
+
│ │ ├── index.ts # Commander.js setup
|
|
201
|
+
│ │ └── commands/ # Command implementations
|
|
202
|
+
│ │ ├── chat.ts # Interactive session
|
|
203
|
+
│ │ ├── init.ts # First-time setup
|
|
204
|
+
│ │ ├── session.ts # Session management
|
|
205
|
+
│ │ └── config.ts # Configuration management
|
|
206
|
+
│ │
|
|
207
|
+
│ ├── config/ # Configuration
|
|
208
|
+
│ │ ├── index.ts # Config loader (JSON store + .env)
|
|
209
|
+
│ │ └── env.ts # Environment variable helpers
|
|
210
|
+
│ │
|
|
211
|
+
│ ├── core/ # Core engine
|
|
212
|
+
│ │ ├── Engine.ts # Service orchestration
|
|
213
|
+
│ │ └── Loop.ts # Interactive REPL loop
|
|
214
|
+
│ │
|
|
215
|
+
│ ├── memory/ # Persistence
|
|
216
|
+
│ │ ├── ConversationMemory.ts # Message history
|
|
217
|
+
│ │ ├── SessionManager.ts # Session lifecycle
|
|
218
|
+
│ │ └── VectorMemory.ts # Semantic search (abstraction)
|
|
219
|
+
│ │
|
|
220
|
+
│ ├── plugins/ # Plugin system
|
|
221
|
+
│ │ ├── PluginManager.ts # Plugin lifecycle
|
|
222
|
+
│ │ └── PluginLoader.ts # Dynamic loading
|
|
223
|
+
│ │
|
|
224
|
+
│ ├── providers/ # AI provider abstraction
|
|
225
|
+
│ │ ├── BaseProvider.ts # Abstract interface
|
|
226
|
+
│ │ ├── OpenAIProvider.ts # OpenAI / GPT
|
|
227
|
+
│ │ ├── GeminiProvider.ts # Google Gemini
|
|
228
|
+
│ │ └── OllamaProvider.ts # Local models
|
|
229
|
+
│ │
|
|
230
|
+
│ ├── services/ # Business logic
|
|
231
|
+
│ │ ├── ToolService.ts # Tool dispatch
|
|
232
|
+
│ │ ├── SecurityService.ts # Security & approval
|
|
233
|
+
│ │ └── AuditService.ts # Logging & audit
|
|
234
|
+
│ │
|
|
235
|
+
│ ├── tools/ # Tool implementations
|
|
236
|
+
│ │ ├── BaseTool.ts # Abstract tool
|
|
237
|
+
│ │ ├── FileTool.ts # File read/write/edit
|
|
238
|
+
│ │ ├── ShellTool.ts # Command execution
|
|
239
|
+
│ │ └── SearchTool.ts # Code search
|
|
240
|
+
│ │
|
|
241
|
+
│ ├── types/ # TypeScript type definitions
|
|
242
|
+
│ │ ├── agent.ts # Agent types
|
|
243
|
+
│ │ ├── config.ts # Configuration types
|
|
244
|
+
│ │ ├── memory.ts # Memory types
|
|
245
|
+
│ │ ├── plugin.ts # Plugin types
|
|
246
|
+
│ │ ├── provider.ts # Provider types
|
|
247
|
+
│ │ └── tool.ts # Tool types
|
|
248
|
+
│ │
|
|
249
|
+
│ ├── ui/ # Terminal UI
|
|
250
|
+
│ │ ├── MarkdownRenderer.ts # Markdown → terminal
|
|
251
|
+
│ │ ├── Spinner.ts # Loading spinners
|
|
252
|
+
│ │ └── StreamingOutput.ts # Stream management
|
|
253
|
+
│ │
|
|
254
|
+
│ ├── utils/ # Utilities
|
|
255
|
+
│ │ ├── crypto.ts # Encryption, IDs, hashing
|
|
256
|
+
│ │ └── logger.ts # Winston logger
|
|
257
|
+
│ │
|
|
258
|
+
│ └── bin/ # Entry point
|
|
259
|
+
│ └── cl8.ts # CLI binary
|
|
260
|
+
│
|
|
261
|
+
├── plugins/ # User-installed plugins
|
|
262
|
+
├── examples/ # Plugin examples
|
|
263
|
+
├── scripts/ # Build/utility scripts
|
|
264
|
+
├── tests/ # Test suite
|
|
265
|
+
├── docs/ # Documentation
|
|
266
|
+
├── logs/ # Application logs
|
|
267
|
+
│
|
|
268
|
+
├── .env.example # Environment template
|
|
269
|
+
├── .github/workflows/ # CI/CD pipelines
|
|
270
|
+
├── CONTRIBUTING.md # Contribution guide
|
|
271
|
+
├── LICENSE # MIT license
|
|
272
|
+
└── README.md # You are here
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 🚀 Quick Start
|
|
278
|
+
|
|
279
|
+
### Prerequisites
|
|
280
|
+
|
|
281
|
+
- **Node.js** v18.0.0 or higher
|
|
282
|
+
- **npm** v9.0.0 or higher
|
|
283
|
+
- An API key for your preferred AI provider (optional for Ollama)
|
|
284
|
+
|
|
285
|
+
### ⚡ One-Liner Install
|
|
286
|
+
|
|
287
|
+
**Windows (PowerShell)**:
|
|
288
|
+
```powershell
|
|
289
|
+
# Option A: Run instantly with npx (no install needed)
|
|
290
|
+
npx @ritwikamit/cl8
|
|
291
|
+
|
|
292
|
+
# Option B: Install globally
|
|
293
|
+
npm install -g @ritwikamit/cl8
|
|
294
|
+
cl8
|
|
295
|
+
|
|
296
|
+
# Option C: Automated installer
|
|
297
|
+
irm https://raw.githubusercontent.com/ritwikamit/cl8/main/scripts/install.ps1 | iex
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**macOS / Linux**:
|
|
301
|
+
```bash
|
|
302
|
+
# Option A: Run instantly with npx (no install needed)
|
|
303
|
+
npx @ritwikamit/cl8
|
|
304
|
+
|
|
305
|
+
# Option B: Install globally
|
|
306
|
+
npm install -g @ritwikamit/cl8
|
|
307
|
+
cl8
|
|
308
|
+
|
|
309
|
+
# Option C: Automated installer
|
|
310
|
+
curl -fsSL https://raw.githubusercontent.com/ritwikamit/cl8/main/scripts/install.sh | bash
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### 2. Configure Your AI Provider
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
# Run the setup wizard
|
|
317
|
+
cl8 init
|
|
318
|
+
|
|
319
|
+
# Or configure manually by creating .env:
|
|
320
|
+
cp .env.example .env
|
|
321
|
+
# Then edit .env with your API keys
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### 3. Start Using CL8
|
|
325
|
+
|
|
326
|
+
```text
|
|
327
|
+
cl8
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### 4. Example Commands
|
|
331
|
+
|
|
332
|
+
Once CL8 is running, try these:
|
|
333
|
+
|
|
334
|
+
```text
|
|
335
|
+
cl8> Explain what this project does
|
|
336
|
+
|
|
337
|
+
cl8> Find all TODO comments in the codebase
|
|
338
|
+
|
|
339
|
+
cl8> Create a new React component for a login form
|
|
340
|
+
|
|
341
|
+
cl8> Debug the test failure in src/tests/auth.test.ts
|
|
342
|
+
|
|
343
|
+
cl8> Refactor the database service to use connection pooling
|
|
344
|
+
|
|
345
|
+
cl8> /help # Show all available commands
|
|
346
|
+
cl8> /clear # Clear the conversation
|
|
347
|
+
cl8> /status # Show session information
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
## 📟 Commands
|
|
353
|
+
|
|
354
|
+
### CLI Commands
|
|
355
|
+
|
|
356
|
+
| Command | Description |
|
|
357
|
+
|---------|-------------|
|
|
358
|
+
| `cl8` or `cl8 chat` | Start interactive chat session |
|
|
359
|
+
| `cl8 init` | Initialize configuration wizard |
|
|
360
|
+
| `cl8 session --list` | List recent sessions |
|
|
361
|
+
| `cl8 session --show <id>` | Show session details |
|
|
362
|
+
| `cl8 session --resume <id>` | Resume a session |
|
|
363
|
+
| `cl8 config --show` | Show current configuration |
|
|
364
|
+
| `cl8 config --set <key> --value <val>` | Set configuration value |
|
|
365
|
+
| `cl8 config --reset` | Reset to defaults |
|
|
366
|
+
| `cl8 doctor` | Check system health |
|
|
367
|
+
| `cl8 --version` | Show version |
|
|
368
|
+
| `cl8 --help` | Show help |
|
|
369
|
+
|
|
370
|
+
### Slash Commands (in chat)
|
|
371
|
+
|
|
372
|
+
| Command | Description |
|
|
373
|
+
|---------|-------------|
|
|
374
|
+
| `/help` | Show available slash commands |
|
|
375
|
+
| `/clear` | Clear the conversation |
|
|
376
|
+
| `/reset` | Reset the agent state |
|
|
377
|
+
| `/status` | Show current session info |
|
|
378
|
+
| `/session` | Show session details |
|
|
379
|
+
| `/tokens` | Show token usage |
|
|
380
|
+
| `/mode <ask\|auto\|deny>` | Set approval mode |
|
|
381
|
+
| `/exit` | Exit CL8 |
|
|
382
|
+
|
|
383
|
+
### CLI Options
|
|
384
|
+
|
|
385
|
+
```text
|
|
386
|
+
cl8 chat [options]
|
|
387
|
+
|
|
388
|
+
Options:
|
|
389
|
+
-p, --provider <provider> AI provider (openai, gemini, ollama)
|
|
390
|
+
-m, --model <model> Model name (e.g. gpt-4o, gemini-2.0-flash)
|
|
391
|
+
-w, --workspace <path> Workspace directory
|
|
392
|
+
-s, --session <id> Resume a previous session
|
|
393
|
+
-h, --help Display help
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## ⚙️ Configuration
|
|
399
|
+
|
|
400
|
+
### Environment Variables (.env)
|
|
401
|
+
|
|
402
|
+
| Variable | Description | Default |
|
|
403
|
+
|----------|-------------|---------|
|
|
404
|
+
| `OPENAI_API_KEY` | OpenAI API key | — |
|
|
405
|
+
| `OPENAI_MODEL` | OpenAI model name | `gpt-4o` |
|
|
406
|
+
| `GEMINI_API_KEY` | Google Gemini API key | — |
|
|
407
|
+
| `GEMINI_MODEL` | Gemini model name | `gemini-2.0-flash` |
|
|
408
|
+
| `OLLAMA_BASE_URL` | Ollama server URL | `http://localhost:11434` |
|
|
409
|
+
| `OLLAMA_MODEL` | Ollama model name | `codellama` |
|
|
410
|
+
| `CL8_DEFAULT_PROVIDER` | Default AI provider | `openai` |
|
|
411
|
+
| `CL8_WORKSPACE` | Workspace directory | `./workspace` |
|
|
412
|
+
| `CL8_APPROVAL_MODE` | Command approval (`ask`, `auto`, `deny`) | `ask` |
|
|
413
|
+
| `CL8_LOG_LEVEL` | Logging level | `info` |
|
|
414
|
+
| `CL8_PLUGIN_DIRS` | Plugin directories | `./plugins` |
|
|
415
|
+
|
|
416
|
+
### Approval Modes
|
|
417
|
+
|
|
418
|
+
| Mode | Behavior |
|
|
419
|
+
|------|----------|
|
|
420
|
+
| `ask` | Prompt for approval on dangerous commands (default, safest) |
|
|
421
|
+
| `auto` | Auto-approve commands with guardrails |
|
|
422
|
+
| `deny` | Block all command execution (read-only mode) |
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
## 🔌 Plugin System
|
|
427
|
+
|
|
428
|
+
CL8 features a dynamic plugin system that allows you to extend its capabilities.
|
|
429
|
+
|
|
430
|
+
### Plugin Structure
|
|
431
|
+
|
|
432
|
+
```
|
|
433
|
+
plugins/
|
|
434
|
+
my-plugin/
|
|
435
|
+
manifest.json # Plugin metadata
|
|
436
|
+
index.js # Compiled entry point
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Manifest Format
|
|
440
|
+
|
|
441
|
+
```json
|
|
442
|
+
{
|
|
443
|
+
"name": "my-plugin",
|
|
444
|
+
"version": "1.0.0",
|
|
445
|
+
"description": "Description of your plugin",
|
|
446
|
+
"author": "Your Name",
|
|
447
|
+
"license": "MIT",
|
|
448
|
+
"entry": "index.js"
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Plugin API
|
|
453
|
+
|
|
454
|
+
Plugins receive a `PluginAPI` object with:
|
|
455
|
+
|
|
456
|
+
- `registerTool(tool)` — Register a custom tool
|
|
457
|
+
- `getTools()` — List registered tools
|
|
458
|
+
- `log(level, message)` — Log through CL8's logger
|
|
459
|
+
- `config` — Plugin configuration from manifest
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
## 🧪 Development
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
# Type check
|
|
467
|
+
npm run typecheck
|
|
468
|
+
|
|
469
|
+
# Lint
|
|
470
|
+
npm run lint
|
|
471
|
+
|
|
472
|
+
# Run tests
|
|
473
|
+
npm test
|
|
474
|
+
|
|
475
|
+
# Watch mode
|
|
476
|
+
npm run build:watch
|
|
477
|
+
|
|
478
|
+
# Development with hot reload
|
|
479
|
+
npm run dev
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
## 🛣️ Roadmap
|
|
485
|
+
|
|
486
|
+
- [x] Interactive chat with streaming responses
|
|
487
|
+
- [x] Multi-provider AI support (OpenAI, Gemini, Ollama)
|
|
488
|
+
- [x] File system tools (read, write, edit, search)
|
|
489
|
+
- [x] Shell command execution with security controls
|
|
490
|
+
- [x] Agent loop (Plan → Execute → Reflect)
|
|
491
|
+
- [x] Session persistence and management
|
|
492
|
+
- [x] Plugin architecture
|
|
493
|
+
- [x] Audit logging and security
|
|
494
|
+
- [ ] MCP (Model Context Protocol) support
|
|
495
|
+
- [ ] GitHub integration (PR review, issue management)
|
|
496
|
+
- [ ] Web search and browsing capabilities
|
|
497
|
+
- [ ] Docker sandbox for command execution
|
|
498
|
+
- [ ] Vector database for semantic memory
|
|
499
|
+
- [ ] Multi-agent orchestration
|
|
500
|
+
- [ ] VS Code extension integration
|
|
501
|
+
- [ ] Linux and macOS native packages
|
|
502
|
+
- [ ] Configuration UI (TUI)
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
## 🤝 Contributing
|
|
507
|
+
|
|
508
|
+
Please read our [Contributing Guide](CONTRIBUTING.md) for details on:
|
|
509
|
+
|
|
510
|
+
- Setting up a development environment
|
|
511
|
+
- Code style and conventions
|
|
512
|
+
- Testing requirements
|
|
513
|
+
- Pull request process
|
|
514
|
+
|
|
515
|
+
All contributions are welcome! 🎉
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## 📄 License
|
|
520
|
+
|
|
521
|
+
This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
## 🙏 Acknowledgments
|
|
526
|
+
|
|
527
|
+
CL8 stands on the shoulders of giants. It draws inspiration from:
|
|
528
|
+
|
|
529
|
+
- **[Claude Code](https://docs.anthropic.com/en/docs/claude-code)** by Anthropic — Agentic coding in the terminal
|
|
530
|
+
- **[Gemini CLI](https://github.com/google-gemini/gemini-cli)** by Google — Open-source AI agent
|
|
531
|
+
- **[OpenAI Codex CLI](https://github.com/openai/codex)** by OpenAI — Coding agent runtime
|
|
532
|
+
- **[OpenHands](https://github.com/All-Hands-AI/OpenHands)** — Open platform for AI software developers
|
|
533
|
+
- **[Aider](https://github.com/Aider-AI/aider)** by Paul Gauthier — AI pair programming
|
|
534
|
+
- **[Cursor](https://cursor.sh)** — AI-first code editor
|
|
535
|
+
- **[Cline](https://github.com/cline/cline)** — Autonomous coding agent
|
|
536
|
+
|
|
537
|
+
Built with ❤️ for the open-source community.
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
<div align="center">
|
|
542
|
+
|
|
543
|
+
**⭐ Star us on GitHub — it helps!**
|
|
544
|
+
|
|
545
|
+
[Report Bug](https://github.com/ritwikamit/cl8/issues) · [Request Feature](https://github.com/ritwikamit/cl8/issues)
|
|
546
|
+
|
|
547
|
+
</div>
|