codeep 1.0.116 → 1.0.117

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.
@@ -1,12 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Box, Text, useInput, useStdout } from 'ink';
2
+ import { useState } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
4
  export const Export = ({ onExport, onCancel }) => {
5
- const { stdout } = useStdout();
6
5
  const [selectedIndex, setSelectedIndex] = useState(0);
7
- useEffect(() => {
8
- stdout?.write('\x1b[2J\x1b[H');
9
- }, [stdout]);
10
6
  const formats = [
11
7
  { id: 'md', name: 'Markdown', description: 'Formatted with headers and separators' },
12
8
  { id: 'json', name: 'JSON', description: 'Structured data format' },
@@ -1,11 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { Text, Box, useStdout } from 'ink';
2
+ import { Text, Box } from 'ink';
4
3
  export const Help = () => {
5
- const { stdout } = useStdout();
6
- // Clear screen on mount to show fullscreen view
7
- useEffect(() => {
8
- stdout?.write('\x1b[2J\x1b[H');
9
- }, [stdout]);
10
4
  return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "#f02a30", bold: true, children: "Available Commands" }), _jsx(Text, { children: " " }), _jsxs(Box, { flexDirection: "row", gap: 2, children: [_jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/help" }), " - Show this help"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/status" }), " - Current status"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/settings" }), " - Adjust settings"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/sessions" }), " - Manage sessions"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/grant" }), " - Grant permissions"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/agent" }), " ", '<task>', " - Run agent"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/clear" }), " - Clear chat"] })] }), _jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/model" }), " - Switch model"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/provider" }), " - Switch provider"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/diff" }), " - Review git changes"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/commit" }), " - Generate commit msg"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/export" }), " - Export chat"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/copy" }), " [n] - Copy code block"] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "/exit" }), " - Quit"] })] })] }), _jsx(Text, { children: " " }), _jsx(Text, { color: "cyan", children: "Type / to see autocomplete. Docs: github.com/VladoIvankovic/Codeep" })] }));
11
5
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Text, Box, useInput, useStdout } from 'ink';
2
+ import { useState } from 'react';
3
+ import { Text, Box, useInput } from 'ink';
4
4
  import TextInput from 'ink-text-input';
5
5
  import open from 'open';
6
6
  import { setApiKey, setProvider } from '../config/index.js';
@@ -12,15 +12,11 @@ const PROVIDER_URLS = {
12
12
  'minimax': 'https://platform.minimax.io/subscribe/coding-plan?code=2lWvoWUhrp&source=link',
13
13
  };
14
14
  export const Login = ({ onLogin, onCancel }) => {
15
- const { stdout } = useStdout();
16
15
  const [step, setStep] = useState('provider');
17
16
  const [selectedProvider, setSelectedProvider] = useState(0);
18
17
  const [apiKey, setApiKeyState] = useState('');
19
18
  const [error, setError] = useState('');
20
19
  const [validating, setValidating] = useState(false);
21
- useEffect(() => {
22
- stdout?.write('\x1b[2J\x1b[H');
23
- }, [stdout]);
24
20
  const providers = getProviderList();
25
21
  const currentProvider = providers[selectedProvider];
26
22
  // Handle keyboard input
@@ -1,15 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Text, Box, useInput, useStdout } from 'ink';
2
+ import { useState } from 'react';
3
+ import { Text, Box, useInput } from 'ink';
4
4
  import { getConfiguredProviders, clearApiKey, getCurrentProvider } from '../config/index.js';
5
5
  export const LogoutPicker = ({ onLogout, onLogoutAll, onCancel }) => {
6
- const { stdout } = useStdout();
7
6
  const providers = getConfiguredProviders();
8
7
  const currentProvider = getCurrentProvider();
9
8
  const [selectedIndex, setSelectedIndex] = useState(0);
10
- useEffect(() => {
11
- stdout?.write('\x1b[2J\x1b[H');
12
- }, [stdout]);
13
9
  // Options: individual providers + "All" + "Cancel"
14
10
  const options = [
15
11
  ...providers.map(p => ({
@@ -1,15 +1,11 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Box, Text, useInput, useStdout } from 'ink';
2
+ import { useState } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
4
  import { setProjectPermission } from '../config/index.js';
5
5
  import { getProjectSummary } from '../utils/project.js';
6
6
  export const ProjectPermission = ({ projectPath, onComplete }) => {
7
- const { stdout } = useStdout();
8
7
  const [step, setStep] = useState('read');
9
8
  const [readGranted, setReadGranted] = useState(false);
10
- useEffect(() => {
11
- stdout?.write('\x1b[2J\x1b[H');
12
- }, [stdout]);
13
9
  const summary = getProjectSummary(projectPath);
14
10
  const projectName = summary?.name || projectPath.split('/').pop() || 'Unknown';
15
11
  useInput((input, key) => {
@@ -1,12 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Box, Text, useInput, useStdout } from 'ink';
2
+ import { useState } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
4
  export const Search = ({ results, searchTerm, onClose, onSelectMessage }) => {
5
- const { stdout } = useStdout();
6
5
  const [selectedIndex, setSelectedIndex] = useState(0);
7
- useEffect(() => {
8
- stdout?.write('\x1b[2J\x1b[H');
9
- }, [stdout]);
10
6
  useInput((input, key) => {
11
7
  if (key.escape) {
12
8
  onClose();
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useMemo, useEffect } from 'react';
3
- import { Text, Box, useInput, useStdout } from 'ink';
2
+ import { useState, useMemo } from 'react';
3
+ import { Text, Box, useInput } from 'ink';
4
4
  import { listSessionsWithInfo, loadSession, startNewSession } from '../config/index.js';
5
5
  /**
6
6
  * Format relative time (e.g., "today", "yesterday", "3 days ago")
@@ -39,12 +39,8 @@ function truncateName(name, maxLength = 25) {
39
39
  return name.substring(0, maxLength - 3) + '...';
40
40
  }
41
41
  export const SessionPicker = ({ onSelect, onNewSession, projectPath }) => {
42
- const { stdout } = useStdout();
43
42
  const sessions = useMemo(() => listSessionsWithInfo(projectPath), [projectPath]);
44
43
  const [selectedIndex, setSelectedIndex] = useState(0);
45
- useEffect(() => {
46
- stdout?.write('\x1b[2J\x1b[H');
47
- }, [stdout]);
48
44
  useInput((input, key) => {
49
45
  // N = New session
50
46
  if (input === 'n' || input === 'N') {
@@ -1,18 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Text, Box, useInput, useStdout } from 'ink';
2
+ import { useState } from 'react';
3
+ import { Text, Box, useInput } from 'ink';
4
4
  import TextInput from 'ink-text-input';
5
5
  import { listSessions, saveSession, loadSession, deleteSession } from '../config/index.js';
6
6
  export const Sessions = ({ history, onLoad, onClose, onDelete, deleteMode = false, projectPath }) => {
7
- const { stdout } = useStdout();
8
7
  const [name, setName] = useState('');
9
8
  const [message, setMessage] = useState(deleteMode ? 'Select a session to delete (D or Enter)' : '');
10
9
  const [sessions, setSessions] = useState(listSessions(projectPath));
11
10
  const [selectedIndex, setSelectedIndex] = useState(0);
12
11
  const [confirmDelete, setConfirmDelete] = useState(null);
13
- useEffect(() => {
14
- stdout?.write('\x1b[2J\x1b[H');
15
- }, [stdout]);
16
12
  useInput((input, key) => {
17
13
  // Handle delete confirmation
18
14
  if (confirmDelete) {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect } from 'react';
3
- import { Box, Text, useInput, useStdout } from 'ink';
2
+ import { useState } from 'react';
3
+ import { Box, Text, useInput } from 'ink';
4
4
  import { config } from '../config/index.js';
5
5
  import { updateRateLimits } from '../utils/ratelimit.js';
6
6
  const SETTINGS = [
@@ -98,14 +98,9 @@ const SETTINGS = [
98
98
  },
99
99
  ];
100
100
  export const Settings = ({ onClose, notify, hasWriteAccess = false, hasProjectContext = false }) => {
101
- const { stdout } = useStdout();
102
101
  const [selected, setSelected] = useState(0);
103
102
  const [editing, setEditing] = useState(false);
104
103
  const [editValue, setEditValue] = useState('');
105
- // Clear screen on mount to show fullscreen view
106
- useEffect(() => {
107
- stdout?.write('\x1b[2J\x1b[H');
108
- }, [stdout]);
109
104
  useInput((input, key) => {
110
105
  if (key.escape) {
111
106
  if (editing) {
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { Text, Box, useStdout } from 'ink';
2
+ import { Text, Box } from 'ink';
4
3
  import { config, getMaskedApiKey, getModelsForCurrentProvider, getCurrentProvider, PROTOCOLS, LANGUAGES } from '../config/index.js';
5
4
  export const Status = () => {
6
- const { stdout } = useStdout();
7
5
  const model = config.get('model');
8
6
  const protocol = config.get('protocol');
9
7
  const plan = config.get('plan');
@@ -11,9 +9,5 @@ export const Status = () => {
11
9
  const agentMode = config.get('agentMode');
12
10
  const provider = getCurrentProvider();
13
11
  const models = getModelsForCurrentProvider();
14
- // Clear screen on mount to show fullscreen view
15
- useEffect(() => {
16
- stdout?.write('\x1b[2J\x1b[H');
17
- }, [stdout]);
18
12
  return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: "#f02a30", bold: true, children: "Status" }), _jsx(Text, { children: " " }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "Provider:" }), " ", provider.name] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "Model:" }), " ", models[model] || model] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "Protocol:" }), " ", PROTOCOLS[protocol] || protocol] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "Language:" }), " ", LANGUAGES[language] || language] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "Plan:" }), " ", plan.toUpperCase()] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "Agent Mode:" }), " ", agentMode === 'on' ? 'ON' : 'Manual'] }), _jsxs(Text, { children: [_jsx(Text, { color: "#f02a30", children: "API Key:" }), " ", getMaskedApiKey()] })] }));
19
13
  };
package/dist/index.js CHANGED
@@ -32,7 +32,34 @@ Contact: info@codeep.dev
32
32
  `);
33
33
  process.exit(0);
34
34
  }
35
- // Clear screen
36
- console.clear();
35
+ // Enter alternate screen buffer (like vim, less, htop)
36
+ // This isolates the app from terminal scroll history
37
+ // Eliminates ghost content and jumping issues
38
+ process.stdout.write('\x1b[?1049h'); // Enter alternate buffer
39
+ process.stdout.write('\x1b[H'); // Move cursor to top-left
40
+ // Exit alternate buffer on app exit
41
+ const exitAlternateBuffer = () => {
42
+ process.stdout.write('\x1b[?1049l'); // Exit alternate buffer
43
+ };
44
+ // Handle various exit scenarios
45
+ process.on('exit', exitAlternateBuffer);
46
+ process.on('SIGINT', () => {
47
+ exitAlternateBuffer();
48
+ process.exit(0);
49
+ });
50
+ process.on('SIGTERM', () => {
51
+ exitAlternateBuffer();
52
+ process.exit(0);
53
+ });
54
+ // Also handle uncaught exceptions to ensure clean exit
55
+ process.on('uncaughtException', (err) => {
56
+ exitAlternateBuffer();
57
+ console.error('Uncaught Exception:', err);
58
+ process.exit(1);
59
+ });
37
60
  // Render app
38
- render(_jsx(App, {}));
61
+ const { unmount, waitUntilExit } = render(_jsx(App, {}));
62
+ // Ensure alternate buffer is exited when Ink unmounts
63
+ waitUntilExit().then(() => {
64
+ exitAlternateBuffer();
65
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeep",
3
- "version": "1.0.116",
3
+ "version": "1.0.117",
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",