ikie-cli 0.1.35 → 0.1.36
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/dist/repl.js +7 -5
- package/dist/theme.d.ts +6 -0
- package/dist/theme.js +12 -3
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as readline from 'node:readline';
|
|
2
2
|
import { execSync, exec } from 'child_process';
|
|
3
3
|
import { restoreStdinListeners, extractUpstreamError } from './agent.js';
|
|
4
|
-
import { c, PROMPT, CONTINUE_PROMPT, PROMPT_ARROW, printPromptHeader, promptHeaderText, modeTag, drawBanner, infoLine, successLine, errorLine, THEMES, setTheme, stripAnsi, contextRing, renderSlashMenu, } from './theme.js';
|
|
4
|
+
import { c, PROMPT, CONTINUE_PROMPT, PROMPT_ARROW, printPromptHeader, promptHeaderText, modeTag, drawBanner, infoLine, successLine, errorLine, THEMES, setTheme, stripAnsi, contextRing, renderSlashMenu, supportsVT, CH, } from './theme.js';
|
|
5
5
|
import { renderMarkdown } from './renderer.js';
|
|
6
6
|
import { loadAllMemory } from './memory.js';
|
|
7
7
|
import { HOME_DIR, saveConfig, DEFAULT_MODEL, IKIE_HOST, IKIE_API_BASE, isLoggedIn, getApiKey } from './config.js';
|
|
@@ -1478,7 +1478,7 @@ export async function startREPL(agent, config, projectContext, oneShot) {
|
|
|
1478
1478
|
const pct = tokens / contextWindow;
|
|
1479
1479
|
const ring = tokens > 0 ? contextRing(Math.min(pct, 1)) : '';
|
|
1480
1480
|
const prompt = ring
|
|
1481
|
-
? `${c.primary(
|
|
1481
|
+
? `${c.primary(CH.prompt)} ${ring} ${c.primary(PROMPT_ARROW + ' ')}`
|
|
1482
1482
|
: PROMPT;
|
|
1483
1483
|
if (imageState.pending.length) {
|
|
1484
1484
|
const labels = imageState.pending.map(image => `[Image #${image.id}]`).join(' ');
|
|
@@ -1487,9 +1487,11 @@ export async function startREPL(agent, config, projectContext, oneShot) {
|
|
|
1487
1487
|
currentPrompt = prompt;
|
|
1488
1488
|
rl.setPrompt(prompt);
|
|
1489
1489
|
rl.prompt();
|
|
1490
|
-
// Rotating tip below the prompt
|
|
1491
|
-
|
|
1492
|
-
|
|
1490
|
+
// Rotating tip below the prompt (only on VT-capable terminals)
|
|
1491
|
+
if (supportsVT) {
|
|
1492
|
+
const tip = TIPS[tipIndex++ % TIPS.length];
|
|
1493
|
+
process.stdout.write(`\x1b[s\n${c.dim(' ' + tip)}\x1b[u`);
|
|
1494
|
+
}
|
|
1493
1495
|
}
|
|
1494
1496
|
};
|
|
1495
1497
|
rl.on('close', () => {
|
package/dist/theme.d.ts
CHANGED
|
@@ -41,6 +41,12 @@ export declare function drawBanner(model: string): void;
|
|
|
41
41
|
export declare function modeTag(mode: 'agent' | 'plan'): string;
|
|
42
42
|
/** Circular fill indicator for context usage. */
|
|
43
43
|
export declare function contextRing(pct: number): string;
|
|
44
|
+
/**
|
|
45
|
+
* True when the terminal supports VT100 escape sequences (cursor save/restore,
|
|
46
|
+
* ANSI colors). cmd.exe on Windows does NOT unless VirtualTerminalLevel is
|
|
47
|
+
* enabled — PowerShell and Windows Terminal do.
|
|
48
|
+
*/
|
|
49
|
+
export declare const supportsVT: boolean;
|
|
44
50
|
declare const CH: {
|
|
45
51
|
tl: string;
|
|
46
52
|
prompt: string;
|
package/dist/theme.js
CHANGED
|
@@ -275,13 +275,21 @@ export function modeTag(mode) {
|
|
|
275
275
|
}
|
|
276
276
|
/** Circular fill indicator for context usage. */
|
|
277
277
|
export function contextRing(pct) {
|
|
278
|
-
const char =
|
|
278
|
+
const char = IS_WIN
|
|
279
|
+
? pct < 0.2 ? 'o' : pct < 0.4 ? 'O' : pct < 0.6 ? 'O' : pct < 0.8 ? 'O' : '@'
|
|
280
|
+
: pct < 0.2 ? '○' : pct < 0.4 ? '◔' : pct < 0.6 ? '◑' : pct < 0.8 ? '◕' : '●';
|
|
279
281
|
const color = pct < 0.7 ? c.success : pct < 0.85 ? c.warning : c.error;
|
|
280
282
|
return `${color(char)} ${color(`${Math.round(pct * 100)}%`)}`;
|
|
281
283
|
}
|
|
282
284
|
const IS_WIN = process.platform === 'win32';
|
|
285
|
+
/**
|
|
286
|
+
* True when the terminal supports VT100 escape sequences (cursor save/restore,
|
|
287
|
+
* ANSI colors). cmd.exe on Windows does NOT unless VirtualTerminalLevel is
|
|
288
|
+
* enabled — PowerShell and Windows Terminal do.
|
|
289
|
+
*/
|
|
290
|
+
export const supportsVT = !IS_WIN || (process.env.TERM_PROGRAM !== undefined) || (process.env.VSCODE_INSPECTOR_OPTIONS !== undefined);
|
|
283
291
|
const CH = IS_WIN
|
|
284
|
-
? { tl: '+-', prompt: '
|
|
292
|
+
? { tl: '+-', prompt: '-> ', cont: '| ', arrow: '>', dot: 'o' }
|
|
285
293
|
: { tl: '╭─', prompt: '╰─❯', cont: '│ ', arrow: '❯', dot: '●' };
|
|
286
294
|
export { CH };
|
|
287
295
|
/**
|
|
@@ -292,9 +300,10 @@ export { CH };
|
|
|
292
300
|
export function promptHeaderText(mode = 'agent') {
|
|
293
301
|
const cwdName = basename(process.cwd()) || '/';
|
|
294
302
|
const branch = getGitBranchFast();
|
|
303
|
+
const sep = c.muted(IS_WIN ? '-' : '·');
|
|
295
304
|
const gitSegment = branch ? ` ${c.muted('on')} ${c.secondary(branch)}` : '';
|
|
296
305
|
const themeSegment = ` ${c.muted('theme')} ${c.secondary(activeTheme.name)}`;
|
|
297
|
-
return `${c.primary(CH.tl)} ${c.primary.bold('ikie')} ${
|
|
306
|
+
return `${c.primary(CH.tl)} ${c.primary.bold('ikie')} ${sep} ${modeTag(mode)}${gitSegment}${themeSegment} ${c.muted('in')} ${c.accent(cwdName)}`;
|
|
298
307
|
}
|
|
299
308
|
export function printPromptHeader(mode = 'agent') {
|
|
300
309
|
process.stdout.write(`\n${promptHeaderText(mode)}\n`);
|