codeep 1.1.36 → 1.2.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.
Files changed (36) hide show
  1. package/README.md +90 -4
  2. package/dist/api/index.js +64 -2
  3. package/dist/renderer/App.d.ts +5 -0
  4. package/dist/renderer/App.js +164 -227
  5. package/dist/renderer/components/Export.d.ts +22 -0
  6. package/dist/renderer/components/Export.js +64 -0
  7. package/dist/renderer/components/Help.js +5 -1
  8. package/dist/renderer/components/Logout.d.ts +29 -0
  9. package/dist/renderer/components/Logout.js +91 -0
  10. package/dist/renderer/components/Search.d.ts +30 -0
  11. package/dist/renderer/components/Search.js +83 -0
  12. package/dist/renderer/components/Settings.js +20 -0
  13. package/dist/renderer/components/Status.d.ts +6 -0
  14. package/dist/renderer/components/Status.js +20 -1
  15. package/dist/renderer/main.js +316 -141
  16. package/dist/utils/agent.d.ts +5 -0
  17. package/dist/utils/agent.js +238 -3
  18. package/dist/utils/agent.test.d.ts +1 -0
  19. package/dist/utils/agent.test.js +250 -0
  20. package/dist/utils/diffPreview.js +104 -35
  21. package/dist/utils/gitignore.d.ts +24 -0
  22. package/dist/utils/gitignore.js +161 -0
  23. package/dist/utils/gitignore.test.d.ts +1 -0
  24. package/dist/utils/gitignore.test.js +167 -0
  25. package/dist/utils/skills.d.ts +21 -0
  26. package/dist/utils/skills.js +51 -0
  27. package/dist/utils/smartContext.js +8 -0
  28. package/dist/utils/smartContext.test.d.ts +1 -0
  29. package/dist/utils/smartContext.test.js +382 -0
  30. package/dist/utils/tokenTracker.d.ts +52 -0
  31. package/dist/utils/tokenTracker.js +86 -0
  32. package/dist/utils/tools.d.ts +16 -0
  33. package/dist/utils/tools.js +146 -19
  34. package/dist/utils/tools.test.d.ts +1 -0
  35. package/dist/utils/tools.test.js +664 -0
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -60,6 +60,44 @@ When started in a project directory, Codeep automatically:
60
60
  - Press Enter to send, Escape to cancel
61
61
  - Works reliably in all terminals (no Ctrl+V issues)
62
62
 
63
+ ### File Context (`/add`, `/drop`)
64
+ Explicitly add files to the conversation context:
65
+
66
+ - **`/add <path>`** - Add one or more files to context
67
+ - **`/add`** (no args) - Show currently added files
68
+ - **`/drop <path>`** - Remove a specific file from context
69
+ - **`/drop`** (no args) - Remove all files from context
70
+
71
+ Added files are automatically attached to every message (both chat and agent mode) until dropped. Useful for giving the AI specific files to work with.
72
+
73
+ ```
74
+ > /add src/utils/api.ts src/types/index.ts
75
+ Added 2 file(s) to context (2 total)
76
+
77
+ > refactor the API client to use async/await
78
+ # AI sees both files attached to your message
79
+
80
+ > /drop
81
+ Dropped all 2 file(s) from context
82
+ ```
83
+
84
+ ### Multi-line Input
85
+ Write multi-line messages using backslash continuation or `/multiline` mode:
86
+
87
+ - **Backslash continuation** — end a line with `\` and press Enter to continue on the next line
88
+ - **`/multiline`** — toggle multi-line mode where Enter adds a new line and Esc sends the message
89
+
90
+ ```
91
+ > Write a function that\
92
+ takes two arguments and\
93
+ returns their sum
94
+ # Sent as a single 3-line message
95
+
96
+ > /multiline
97
+ Multi-line mode ON — Enter adds line, Esc sends
98
+ M> (type freely, Enter = newline, Esc = send)
99
+ ```
100
+
63
101
  ### Autonomous Agent Mode
64
102
 
65
103
  Codeep works as a **full AI coding agent** that autonomously:
@@ -68,6 +106,7 @@ Codeep works as a **full AI coding agent** that autonomously:
68
106
  - Reads and analyzes your codebase
69
107
  - Loops until the task is complete
70
108
  - Reports all actions taken
109
+ - **Live code display** - Shows syntax-highlighted code in chat as it writes/edits files
71
110
 
72
111
  **Auto mode (default)**: Just describe what you want - no special commands needed:
73
112
  ```
@@ -146,6 +185,39 @@ Agent learns your coding preferences:
146
185
  - Preferred libraries
147
186
  - Custom rules you define
148
187
 
188
+ ### Project Rules
189
+ Define project-specific instructions that the AI always follows. Create a rules file in your project root:
190
+
191
+ - **`.codeep/rules.md`** - Primary location (inside `.codeep/` folder)
192
+ - **`CODEEP.md`** - Alternative location (project root, similar to `CLAUDE.md` or `.cursorrules`)
193
+
194
+ The rules file content is automatically included in every system prompt — both chat and agent mode. Use it to define:
195
+
196
+ - Coding standards and conventions
197
+ - Preferred libraries and frameworks
198
+ - Architecture guidelines
199
+ - Language-specific instructions
200
+ - Any custom rules for AI behavior in your project
201
+
202
+ **Example `.codeep/rules.md`:**
203
+ ```markdown
204
+ ## Code Style
205
+ - Use 2 spaces for indentation
206
+ - Prefer arrow functions
207
+ - Always use TypeScript strict mode
208
+
209
+ ## Architecture
210
+ - Follow MVC pattern
211
+ - Keep controllers thin, logic in services
212
+ - All API responses use the ApiResponse wrapper
213
+
214
+ ## Libraries
215
+ - Use Zod for validation
216
+ - Use date-fns instead of moment.js
217
+ ```
218
+
219
+ Rules are loaded automatically when Codeep starts — no commands needed.
220
+
149
221
  ### Skills System
150
222
  Predefined workflows for common development tasks. Execute with a single command:
151
223
 
@@ -389,7 +461,7 @@ After installation, `codeep` is available globally in your terminal. Simply run
389
461
  | `/version` | Show version and current provider/model |
390
462
  | `/update` | Check for updates |
391
463
  | `/clear` | Clear chat history and start new session |
392
- | `/exit` | Quit application |
464
+ | `/exit` or `/quit` | Quit application |
393
465
 
394
466
  ### AI Configuration
395
467
 
@@ -417,6 +489,10 @@ After installation, `codeep` is available globally in your terminal. Simply run
417
489
  |---------|-------------|
418
490
  | `/apply` | Apply file changes from AI response |
419
491
  | `/copy [n]` | Copy code block to clipboard (n = block number, -1 = last) |
492
+ | `/paste` | Paste content from clipboard into chat |
493
+ | `/add <path>` | Add file(s) to conversation context |
494
+ | `/drop [path]` | Remove file (or all) from context |
495
+ | `/multiline` | Toggle multi-line input mode |
420
496
 
421
497
  ### Agent Mode
422
498
 
@@ -439,6 +515,8 @@ After installation, `codeep` is available globally in your terminal. Simply run
439
515
  | `/diff --staged` | Review staged git changes |
440
516
  | `/commit` | Generate commit message for staged changes |
441
517
  | `/git-commit [msg]` | Commit current changes with message |
518
+ | `/push` | Push to remote repository |
519
+ | `/pull` | Pull from remote repository |
442
520
 
443
521
  ### Context Persistence
444
522
 
@@ -493,9 +571,17 @@ After installation, `codeep` is available globally in your terminal. Simply run
493
571
  | Key | Action |
494
572
  |-----|--------|
495
573
  | `Enter` | Submit message |
496
- | `↑` / `↓` | Navigate input history |
574
+ | `↑` / `↓` | Navigate input history (or scroll chat when input is empty) |
497
575
  | `Ctrl+L` | Clear chat (same as `/clear`) |
498
- | `Escape` | Cancel current request |
576
+ | `Ctrl+V` | Paste from clipboard with preview |
577
+ | `Ctrl+A` | Move cursor to beginning of line |
578
+ | `Ctrl+E` | Move cursor to end of line |
579
+ | `Ctrl+U` | Clear input line |
580
+ | `Ctrl+W` | Delete word backward |
581
+ | `Ctrl+K` | Delete to end of line |
582
+ | `PageUp` / `PageDown` | Scroll chat history (10 lines) |
583
+ | `Mouse Scroll` | Scroll chat history |
584
+ | `Escape` | Cancel current request / Stop agent |
499
585
 
500
586
  ## Supported Languages
501
587
 
@@ -649,7 +735,7 @@ Session renamed to: feature-auth-implementation
649
735
 
650
736
  Codeep is built with:
651
737
 
652
- - **React + Ink** - Terminal UI framework
738
+ - **Custom ANSI Renderer** - Hand-built terminal UI with virtual screen buffer, diff-based rendering, and syntax highlighting (no React/Ink dependency)
653
739
  - **TypeScript** - Type-safe codebase
654
740
  - **Conf** - Configuration management
655
741
  - **Node.js Keychain** - Secure credential storage
package/dist/api/index.js CHANGED
@@ -3,6 +3,8 @@ import { withRetry, isNetworkError, isTimeoutError } from '../utils/retry.js';
3
3
  import { getProvider, getProviderBaseUrl, getProviderAuthHeader } from '../config/providers.js';
4
4
  import { logApiRequest, logApiResponse } from '../utils/logger.js';
5
5
  import { loadProjectIntelligence, generateContextFromIntelligence } from '../utils/projectIntelligence.js';
6
+ import { loadProjectRules } from '../utils/agent.js';
7
+ import { recordTokenUsage, extractOpenAIUsage, extractAnthropicUsage } from '../utils/tokenTracker.js';
6
8
  // Error messages by language
7
9
  const ERROR_MESSAGES = {
8
10
  en: {
@@ -11,6 +13,60 @@ const ERROR_MESSAGES = {
11
13
  retrying: 'Connection failed, retrying...',
12
14
  apiError: 'API error',
13
15
  },
16
+ zh: {
17
+ noInternet: '没有网络连接。请检查您的网络。',
18
+ timeout: '请求超时。请重试。',
19
+ retrying: '连接失败,正在重试...',
20
+ apiError: 'API 错误',
21
+ },
22
+ es: {
23
+ noInternet: 'Sin conexión a internet. Verifique su red.',
24
+ timeout: 'La solicitud ha expirado. Inténtelo de nuevo.',
25
+ retrying: 'Conexión fallida, reintentando...',
26
+ apiError: 'Error de API',
27
+ },
28
+ hi: {
29
+ noInternet: 'इंटरनेट कनेक्शन नहीं है। कृपया अपना नेटवर्क जाँचें।',
30
+ timeout: 'अनुरोध का समय समाप्त हो गया। कृपया पुनः प्रयास करें।',
31
+ retrying: 'कनेक्शन विफल, पुनः प्रयास हो रहा है...',
32
+ apiError: 'API त्रुटि',
33
+ },
34
+ ar: {
35
+ noInternet: 'لا يوجد اتصال بالإنترنت. يرجى التحقق من شبكتك.',
36
+ timeout: 'انتهت مهلة الطلب. يرجى المحاولة مرة أخرى.',
37
+ retrying: 'فشل الاتصال، جارٍ إعادة المحاولة...',
38
+ apiError: 'خطأ في API',
39
+ },
40
+ pt: {
41
+ noInternet: 'Sem conexão com a internet. Verifique sua rede.',
42
+ timeout: 'A solicitação expirou. Tente novamente.',
43
+ retrying: 'Conexão falhou, tentando novamente...',
44
+ apiError: 'Erro de API',
45
+ },
46
+ fr: {
47
+ noInternet: 'Pas de connexion internet. Vérifiez votre réseau.',
48
+ timeout: 'La requête a expiré. Veuillez réessayer.',
49
+ retrying: 'Connexion échouée, nouvelle tentative...',
50
+ apiError: 'Erreur API',
51
+ },
52
+ de: {
53
+ noInternet: 'Keine Internetverbindung. Überprüfen Sie Ihr Netzwerk.',
54
+ timeout: 'Zeitüberschreitung der Anfrage. Bitte versuchen Sie es erneut.',
55
+ retrying: 'Verbindung fehlgeschlagen, erneuter Versuch...',
56
+ apiError: 'API-Fehler',
57
+ },
58
+ ja: {
59
+ noInternet: 'インターネット接続がありません。ネットワークを確認してください。',
60
+ timeout: 'リクエストがタイムアウトしました。もう一度お試しください。',
61
+ retrying: '接続に失敗しました。再試行中...',
62
+ apiError: 'APIエラー',
63
+ },
64
+ ru: {
65
+ noInternet: 'Нет подключения к интернету. Проверьте сеть.',
66
+ timeout: 'Время запроса истекло. Попробуйте снова.',
67
+ retrying: 'Сбой подключения, повторная попытка...',
68
+ apiError: 'Ошибка API',
69
+ },
14
70
  hr: {
15
71
  noInternet: 'Nema internet konekcije. Provjerite mrežu.',
16
72
  timeout: 'Zahtjev je istekao. Pokušajte ponovo.',
@@ -153,7 +209,7 @@ ${writeInfo}
153
209
 
154
210
  When the user mentions a file path, the file content will be automatically attached to their message.
155
211
  You can analyze, explain, or suggest improvements to the code.`;
156
- return basePrompt + projectInfo;
212
+ return basePrompt + projectInfo + loadProjectRules(currentProjectContext.root);
157
213
  }
158
214
  // Fallback to basic project context
159
215
  const projectInfo = `
@@ -170,7 +226,7 @@ ${currentProjectContext.structure}
170
226
 
171
227
  When the user mentions a file path, the file content will be automatically attached to their message.
172
228
  You can analyze, explain, or suggest improvements to the code.`;
173
- return basePrompt + projectInfo;
229
+ return basePrompt + projectInfo + loadProjectRules(currentProjectContext.root);
174
230
  }
175
231
  return basePrompt;
176
232
  }
@@ -232,6 +288,9 @@ async function chatOpenAI(message, history, model, apiKey, onChunk, abortSignal)
232
288
  }
233
289
  else {
234
290
  const data = await response.json();
291
+ const usage = extractOpenAIUsage(data);
292
+ if (usage)
293
+ recordTokenUsage(usage, model, config.get('provider'));
235
294
  const content = data.choices[0]?.message?.content || '';
236
295
  return stripThinkTags(content);
237
296
  }
@@ -335,6 +394,9 @@ async function chatAnthropic(message, history, model, apiKey, onChunk, abortSign
335
394
  }
336
395
  else {
337
396
  const data = await response.json();
397
+ const usage = extractAnthropicUsage(data);
398
+ if (usage)
399
+ recordTokenUsage(usage, model, config.get('provider'));
338
400
  const content = data.content[0]?.text || '';
339
401
  return stripThinkTags(content);
340
402
  }
@@ -90,6 +90,7 @@ export declare class App {
90
90
  private introProgress;
91
91
  private introInterval;
92
92
  private introCallback;
93
+ private isMultilineMode;
93
94
  private loginOpen;
94
95
  private loginStep;
95
96
  private loginProviders;
@@ -320,6 +321,10 @@ export declare class App {
320
321
  private handleInlinePermissionKey;
321
322
  private handleInlineSessionPickerKey;
322
323
  private handleInlineConfirmKey;
324
+ /**
325
+ * Submit the current input buffer (used by Enter and Escape-in-multiline)
326
+ */
327
+ private submitInput;
323
328
  /**
324
329
  * Handle command
325
330
  */