codeep 1.1.12 → 1.1.13

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 (45) hide show
  1. package/bin/codeep.js +1 -1
  2. package/dist/config/index.js +10 -10
  3. package/dist/renderer/App.d.ts +430 -0
  4. package/dist/renderer/App.js +2712 -0
  5. package/dist/renderer/ChatUI.d.ts +71 -0
  6. package/dist/renderer/ChatUI.js +286 -0
  7. package/dist/renderer/Input.d.ts +72 -0
  8. package/dist/renderer/Input.js +371 -0
  9. package/dist/renderer/Screen.d.ts +79 -0
  10. package/dist/renderer/Screen.js +278 -0
  11. package/dist/renderer/ansi.d.ts +99 -0
  12. package/dist/renderer/ansi.js +176 -0
  13. package/dist/renderer/components/Box.d.ts +64 -0
  14. package/dist/renderer/components/Box.js +90 -0
  15. package/dist/renderer/components/Help.d.ts +30 -0
  16. package/dist/renderer/components/Help.js +195 -0
  17. package/dist/renderer/components/Intro.d.ts +12 -0
  18. package/dist/renderer/components/Intro.js +128 -0
  19. package/dist/renderer/components/Login.d.ts +42 -0
  20. package/dist/renderer/components/Login.js +178 -0
  21. package/dist/renderer/components/Modal.d.ts +43 -0
  22. package/dist/renderer/components/Modal.js +207 -0
  23. package/dist/renderer/components/Permission.d.ts +20 -0
  24. package/dist/renderer/components/Permission.js +113 -0
  25. package/dist/renderer/components/SelectScreen.d.ts +26 -0
  26. package/dist/renderer/components/SelectScreen.js +101 -0
  27. package/dist/renderer/components/Settings.d.ts +37 -0
  28. package/dist/renderer/components/Settings.js +333 -0
  29. package/dist/renderer/components/Status.d.ts +18 -0
  30. package/dist/renderer/components/Status.js +78 -0
  31. package/dist/renderer/demo-app.d.ts +6 -0
  32. package/dist/renderer/demo-app.js +85 -0
  33. package/dist/renderer/demo.d.ts +6 -0
  34. package/dist/renderer/demo.js +52 -0
  35. package/dist/renderer/index.d.ts +16 -0
  36. package/dist/renderer/index.js +17 -0
  37. package/dist/renderer/main.d.ts +6 -0
  38. package/dist/renderer/main.js +1634 -0
  39. package/dist/utils/agent.d.ts +21 -0
  40. package/dist/utils/agent.js +29 -0
  41. package/dist/utils/clipboard.d.ts +15 -0
  42. package/dist/utils/clipboard.js +95 -0
  43. package/package.json +7 -11
  44. package/dist/utils/console.d.ts +0 -55
  45. package/dist/utils/console.js +0 -188
@@ -39,3 +39,24 @@ export declare function runAgent(prompt: string, projectContext: ProjectContext,
39
39
  */
40
40
  export declare function formatAgentResult(result: AgentResult): string;
41
41
  export { undoLastAction, undoAllActions, getCurrentSession, getRecentSessions, formatSession, type ActionSession };
42
+ /**
43
+ * Get agent history for display
44
+ */
45
+ export declare function getAgentHistory(): Array<{
46
+ timestamp: number;
47
+ task: string;
48
+ actions: Array<{
49
+ type: string;
50
+ target: string;
51
+ result: string;
52
+ }>;
53
+ success: boolean;
54
+ }>;
55
+ /**
56
+ * Get current session actions
57
+ */
58
+ export declare function getCurrentSessionActions(): Array<{
59
+ type: string;
60
+ target: string;
61
+ result: string;
62
+ }>;
@@ -848,3 +848,32 @@ export function formatAgentResult(result) {
848
848
  }
849
849
  // Re-export history functions for undo support
850
850
  export { undoLastAction, undoAllActions, getCurrentSession, getRecentSessions, formatSession };
851
+ /**
852
+ * Get agent history for display
853
+ */
854
+ export function getAgentHistory() {
855
+ const sessions = getRecentSessions(10);
856
+ return sessions.map(s => ({
857
+ timestamp: s.startTime,
858
+ task: s.prompt || 'Unknown task',
859
+ actions: s.actions.map(a => ({
860
+ type: a.type,
861
+ target: a.path || '',
862
+ result: 'success',
863
+ })),
864
+ success: s.endTime !== undefined,
865
+ }));
866
+ }
867
+ /**
868
+ * Get current session actions
869
+ */
870
+ export function getCurrentSessionActions() {
871
+ const session = getCurrentSession();
872
+ if (!session)
873
+ return [];
874
+ return session.actions.map(a => ({
875
+ type: a.type,
876
+ target: a.path || '',
877
+ result: 'success',
878
+ }));
879
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Clipboard utilities
3
+ */
4
+ /**
5
+ * Copy text to clipboard
6
+ */
7
+ export declare function copyToClipboard(text: string): boolean;
8
+ /**
9
+ * Read text from clipboard
10
+ */
11
+ export declare function readFromClipboard(): string | null;
12
+ /**
13
+ * Check if clipboard is available
14
+ */
15
+ export declare function isClipboardAvailable(): boolean;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Clipboard utilities
3
+ */
4
+ import { execSync } from 'child_process';
5
+ /**
6
+ * Copy text to clipboard
7
+ */
8
+ export function copyToClipboard(text) {
9
+ try {
10
+ if (process.platform === 'darwin') {
11
+ // macOS
12
+ execSync('pbcopy', { input: text, encoding: 'utf-8' });
13
+ }
14
+ else if (process.platform === 'linux') {
15
+ // Linux - try xclip first, then xsel
16
+ try {
17
+ execSync('xclip -selection clipboard', { input: text, encoding: 'utf-8' });
18
+ }
19
+ catch {
20
+ execSync('xsel --clipboard --input', { input: text, encoding: 'utf-8' });
21
+ }
22
+ }
23
+ else if (process.platform === 'win32') {
24
+ // Windows
25
+ execSync('clip', { input: text, encoding: 'utf-8' });
26
+ }
27
+ else {
28
+ return false;
29
+ }
30
+ return true;
31
+ }
32
+ catch {
33
+ return false;
34
+ }
35
+ }
36
+ /**
37
+ * Read text from clipboard
38
+ */
39
+ export function readFromClipboard() {
40
+ try {
41
+ let result;
42
+ if (process.platform === 'darwin') {
43
+ // macOS
44
+ result = execSync('pbpaste', { encoding: 'utf-8' });
45
+ }
46
+ else if (process.platform === 'linux') {
47
+ // Linux - try xclip first, then xsel
48
+ try {
49
+ result = execSync('xclip -selection clipboard -o', { encoding: 'utf-8' });
50
+ }
51
+ catch {
52
+ result = execSync('xsel --clipboard --output', { encoding: 'utf-8' });
53
+ }
54
+ }
55
+ else if (process.platform === 'win32') {
56
+ // Windows - use PowerShell
57
+ result = execSync('powershell -command "Get-Clipboard"', { encoding: 'utf-8' });
58
+ }
59
+ else {
60
+ return null;
61
+ }
62
+ return result || null;
63
+ }
64
+ catch {
65
+ return null;
66
+ }
67
+ }
68
+ /**
69
+ * Check if clipboard is available
70
+ */
71
+ export function isClipboardAvailable() {
72
+ try {
73
+ if (process.platform === 'darwin') {
74
+ execSync('which pbcopy', { encoding: 'utf-8' });
75
+ return true;
76
+ }
77
+ else if (process.platform === 'linux') {
78
+ try {
79
+ execSync('which xclip', { encoding: 'utf-8' });
80
+ return true;
81
+ }
82
+ catch {
83
+ execSync('which xsel', { encoding: 'utf-8' });
84
+ return true;
85
+ }
86
+ }
87
+ else if (process.platform === 'win32') {
88
+ return true; // clip is always available on Windows
89
+ }
90
+ return false;
91
+ }
92
+ catch {
93
+ return false;
94
+ }
95
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.1.12",
3
+ "version": "1.1.13",
4
4
  "description": "AI-powered coding assistant built for the terminal. Multiple LLM providers, project-aware context, and a seamless development workflow.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,10 +8,12 @@
8
8
  "codeep": "bin/codeep.js"
9
9
  },
10
10
  "scripts": {
11
- "dev": "node --import tsx src/index.tsx",
11
+ "dev": "node --import tsx src/renderer/main.ts",
12
12
  "build": "tsc && node scripts/fix-imports.js",
13
- "start": "node dist/index.js",
14
- "build:binary": "npm run build && pkg dist/index.js --targets node18-macos-arm64,node18-macos-x64,node18-linux-x64 --output bin/codeep",
13
+ "start": "node dist/renderer/main.js",
14
+ "demo:renderer": "node --import tsx src/renderer/demo.ts",
15
+ "demo:app": "node --import tsx src/renderer/demo-app.ts",
16
+ "build:binary": "npm run build && pkg dist/renderer/main.js --targets node18-macos-arm64,node18-macos-x64,node18-linux-x64 --output bin/codeep",
15
17
  "test": "vitest run",
16
18
  "test:watch": "vitest",
17
19
  "test:coverage": "vitest run --coverage"
@@ -38,17 +40,11 @@
38
40
  "dependencies": {
39
41
  "clipboardy": "^4.0.0",
40
42
  "conf": "^12.0.0",
41
- "ink": "^4.4.1",
42
- "ink-spinner": "^5.0.0",
43
- "ink-text-input": "^5.0.1",
44
43
  "keytar": "^7.9.0",
45
- "open": "^10.0.0",
46
- "react": "^18.2.0",
47
- "readline": "^1.3.0"
44
+ "open": "^10.0.0"
48
45
  },
49
46
  "devDependencies": {
50
47
  "@types/node": "^20.10.0",
51
- "@types/react": "^18.2.0",
52
48
  "@vitest/coverage-v8": "^4.0.18",
53
49
  "pkg": "^5.8.1",
54
50
  "tsx": "^4.7.0",
@@ -1,55 +0,0 @@
1
- /**
2
- * Console output utilities using chalk and ora
3
- * Used for agent streaming to avoid Ink re-rendering issues
4
- */
5
- /**
6
- * Start agent spinner
7
- */
8
- export declare function startAgentSpinner(text?: string, dryRun?: boolean): void;
9
- /**
10
- * Update spinner text
11
- */
12
- export declare function updateSpinner(text: string, dryRun?: boolean): void;
13
- /**
14
- * Stop spinner with success
15
- */
16
- export declare function spinnerSuccess(text?: string): void;
17
- /**
18
- * Stop spinner with failure
19
- */
20
- export declare function spinnerFail(text?: string): void;
21
- /**
22
- * Stop spinner without status
23
- */
24
- export declare function stopSpinner(): void;
25
- /**
26
- * Set agent running state
27
- */
28
- export declare function setAgentRunning(running: boolean, dryRun?: boolean): void;
29
- /**
30
- * Log agent action
31
- */
32
- export declare function logAction(type: string, target: string, result: 'success' | 'error' | 'pending', details?: string): void;
33
- /**
34
- * Log agent step change
35
- */
36
- export declare function logStep(step: number, actionsCount: number, dryRun?: boolean): void;
37
- /**
38
- * Log agent completion
39
- */
40
- export declare function logAgentComplete(stats: {
41
- iterations: number;
42
- created: number;
43
- edited: number;
44
- deleted: number;
45
- commands: number;
46
- errors: number;
47
- }, success?: boolean): void;
48
- /**
49
- * Log separator line
50
- */
51
- export declare function logSeparator(): void;
52
- /**
53
- * Log with brand color
54
- */
55
- export declare function logBrand(text: string): void;
@@ -1,188 +0,0 @@
1
- /**
2
- * Console output utilities using chalk and ora
3
- * Used for agent streaming to avoid Ink re-rendering issues
4
- */
5
- import chalk from 'chalk';
6
- import ora from 'ora';
7
- // Brand color
8
- const brandRed = chalk.hex('#f02a30');
9
- // Current spinner instance
10
- let currentSpinner = null;
11
- /**
12
- * Start agent spinner
13
- */
14
- export function startAgentSpinner(text = 'Agent working...', dryRun = false) {
15
- stopSpinner();
16
- const prefix = dryRun ? chalk.yellow('[DRY RUN]') : brandRed('[AGENT]');
17
- currentSpinner = ora({
18
- text: `${prefix} ${text}`,
19
- color: dryRun ? 'yellow' : 'red',
20
- }).start();
21
- }
22
- /**
23
- * Update spinner text
24
- */
25
- export function updateSpinner(text, dryRun = false) {
26
- if (currentSpinner) {
27
- const prefix = dryRun ? chalk.yellow('[DRY RUN]') : brandRed('[AGENT]');
28
- currentSpinner.text = `${prefix} ${text}`;
29
- }
30
- }
31
- /**
32
- * Stop spinner with success
33
- */
34
- export function spinnerSuccess(text) {
35
- if (currentSpinner) {
36
- currentSpinner.succeed(text);
37
- currentSpinner = null;
38
- }
39
- }
40
- /**
41
- * Stop spinner with failure
42
- */
43
- export function spinnerFail(text) {
44
- if (currentSpinner) {
45
- currentSpinner.fail(text);
46
- currentSpinner = null;
47
- }
48
- }
49
- /**
50
- * Stop spinner without status
51
- */
52
- export function stopSpinner() {
53
- if (currentSpinner) {
54
- // Use stopAndPersist with empty symbol to leave a clean line
55
- currentSpinner.stopAndPersist({ symbol: '' });
56
- currentSpinner = null;
57
- }
58
- }
59
- // Track if agent is running for auto-restart spinner
60
- let agentRunning = false;
61
- let lastDryRun = false;
62
- /**
63
- * Set agent running state
64
- */
65
- export function setAgentRunning(running, dryRun = false) {
66
- agentRunning = running;
67
- lastDryRun = dryRun;
68
- }
69
- /**
70
- * Log agent action
71
- */
72
- export function logAction(type, target, result, details) {
73
- stopSpinner(); // Stop spinner before logging
74
- const filename = target.split('/').pop() || target;
75
- const lineCount = details ? details.split('\n').length : 0;
76
- let icon;
77
- let color;
78
- let verb;
79
- switch (type) {
80
- case 'write':
81
- icon = result === 'success' ? '✓' : '✗';
82
- color = result === 'success' ? chalk.green : chalk.red;
83
- verb = 'Created';
84
- break;
85
- case 'edit':
86
- icon = result === 'success' ? '✓' : '✗';
87
- color = result === 'success' ? chalk.yellow : chalk.red;
88
- verb = 'Edited';
89
- break;
90
- case 'delete':
91
- icon = result === 'success' ? '✓' : '✗';
92
- color = result === 'success' ? chalk.red : chalk.red;
93
- verb = 'Deleted';
94
- break;
95
- case 'read':
96
- icon = '→';
97
- color = chalk.blue;
98
- verb = 'Reading';
99
- break;
100
- case 'search':
101
- icon = '→';
102
- color = chalk.cyan;
103
- verb = 'Searching';
104
- break;
105
- case 'command':
106
- icon = result === 'success' ? '✓' : '✗';
107
- color = result === 'success' ? chalk.magenta : chalk.red;
108
- verb = 'Ran';
109
- break;
110
- case 'mkdir':
111
- icon = result === 'success' ? '✓' : '✗';
112
- color = result === 'success' ? chalk.blue : chalk.red;
113
- verb = 'Created dir';
114
- break;
115
- case 'fetch':
116
- icon = '→';
117
- color = chalk.cyan;
118
- verb = 'Fetching';
119
- break;
120
- case 'list':
121
- icon = '→';
122
- color = chalk.gray;
123
- verb = 'Listing';
124
- break;
125
- default:
126
- icon = '◦';
127
- color = chalk.white;
128
- verb = type;
129
- }
130
- // Format line count for write/edit
131
- const lineInfo = (type === 'write' || type === 'edit') && lineCount > 0
132
- ? chalk.gray(` (${lineCount} lines)`)
133
- : '';
134
- // Format command differently
135
- const displayTarget = type === 'command'
136
- ? chalk.gray(`\`${filename.length > 40 ? filename.slice(0, 40) + '...' : filename}\``)
137
- : chalk.bold(filename);
138
- console.log(`${color(icon)} ${verb} ${displayTarget}${lineInfo}`);
139
- // Restart spinner if agent is still running
140
- if (agentRunning) {
141
- startAgentSpinner('Working...', lastDryRun);
142
- }
143
- }
144
- /**
145
- * Log agent step change
146
- */
147
- export function logStep(step, actionsCount, dryRun = false) {
148
- const prefix = dryRun ? chalk.yellow('[DRY RUN]') : brandRed('[AGENT]');
149
- console.log(`${prefix} Step ${chalk.cyan(step)} | ${actionsCount} actions`);
150
- }
151
- /**
152
- * Log agent completion
153
- */
154
- export function logAgentComplete(stats, success = true) {
155
- stopSpinner();
156
- console.log(''); // Empty line
157
- const statParts = [];
158
- if (stats.created > 0)
159
- statParts.push(chalk.green(`+${stats.created} created`));
160
- if (stats.edited > 0)
161
- statParts.push(chalk.yellow(`~${stats.edited} edited`));
162
- if (stats.deleted > 0)
163
- statParts.push(chalk.red(`-${stats.deleted} deleted`));
164
- if (stats.commands > 0)
165
- statParts.push(chalk.magenta(`${stats.commands} commands`));
166
- if (stats.errors > 0)
167
- statParts.push(chalk.red(`${stats.errors} errors`));
168
- const statsLine = statParts.length > 0 ? statParts.join(chalk.gray(' | ')) : chalk.gray('no changes');
169
- if (success) {
170
- console.log(`${chalk.green('✓')} Agent completed: ${chalk.bold(stats.iterations)} steps | ${statsLine}`);
171
- }
172
- else {
173
- console.log(`${chalk.red('✗')} Agent failed: ${chalk.bold(stats.iterations)} steps | ${statsLine}`);
174
- }
175
- console.log(''); // Empty line
176
- }
177
- /**
178
- * Log separator line
179
- */
180
- export function logSeparator() {
181
- console.log(brandRed('─'.repeat(60)));
182
- }
183
- /**
184
- * Log with brand color
185
- */
186
- export function logBrand(text) {
187
- console.log(brandRed(text));
188
- }