fix(tui): fix rendering overlap and terminal crash on quit (#18)

- Remove deprecated @types/minimatch dependency (minimatch 10.x has bundled types)
- Fix TUI text rendering overlap by using single text elements instead of multiple
  text elements in box rows (Browse, Installed, Marketplace, SkillList screens)
- Fix terminal crash on 'q' press by properly unmounting React tree and restoring
  terminal state with escape sequences
- Add signal handlers (SIGINT, SIGTERM) for clean exit
- Bump version to 1.7.6
This commit is contained in:
Rohit Ghumare
2026-01-28 08:27:46 +00:00
committed by GitHub
parent da5a17960d
commit 235130c6ae
10 changed files with 56 additions and 68 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "skillkit",
"version": "1.7.5",
"version": "1.7.6",
"description": "Supercharge AI coding agents with portable skills. Install, translate, and share skills across Claude Code, Cursor, Codex, Copilot & 13 more",
"type": "module",
"bin": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@skillkit/agents",
"version": "1.7.5",
"version": "1.7.6",
"description": "Agent adapters for SkillKit - supports 17+ AI coding agents",
"type": "module",
"main": "./dist/index.js",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@skillkit/cli",
"version": "1.7.5",
"version": "1.7.6",
"description": "CLI commands for SkillKit",
"type": "module",
"main": "./dist/index.js",
+1 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@skillkit/core",
"version": "1.7.5",
"version": "1.7.6",
"description": "Core functionality for SkillKit - skill discovery, parsing, and translation",
"type": "module",
"main": "./dist/index.js",
@@ -45,7 +45,6 @@
"test": "vitest run"
},
"dependencies": {
"@types/minimatch": "^6.0.0",
"minimatch": "^10.1.1",
"yaml": "^2.6.1",
"zod": "^3.24.1"
+8 -17
View File
@@ -45,25 +45,16 @@ export function SkillList({
const pointer = isSelected ? symbols.pointer : symbols.pointerInactive;
const fg = isSelected ? terminalColors.accent : terminalColors.text;
const statusIcon = skill.enabled ? symbols.active : symbols.pending;
const statusColor = skill.enabled
? terminalColors.success
: terminalColors.textMuted;
const descPart = skill.description
? ` - ${skill.description.slice(0, 40)}${skill.description.length > 40 ? '...' : ''}`
: '';
// Use single text element to avoid rendering overlap
const line = `${pointer} ${skill.name} ${statusIcon}${descPart}`;
return (
<box key={skill.name} flexDirection="row">
<text fg={fg}>
{isSelected ? <b>{pointer} {skill.name}</b> : <>{pointer} {skill.name}</>}
</text>
<text fg={terminalColors.textMuted}>
{' '}{statusIcon}
</text>
{skill.description && (
<text fg={terminalColors.textMuted}>
{' '}- {skill.description.slice(0, 40)}
{skill.description.length > 40 ? '...' : ''}
</text>
)}
</box>
<text key={skill.name} fg={fg}>
{isSelected ? <b>{line}</b> : line}
</text>
);
})}
+25 -5
View File
@@ -2,19 +2,39 @@ import { createCliRenderer } from '@opentui/core';
import { createRoot } from '@opentui/react';
import { App } from './App.js';
let rootInstance: ReturnType<typeof createRoot> | null = null;
export function exitTUI(code = 0): void {
try {
process.stdout.write('\x1b[?1049l\x1b[?25h\x1b[0m');
// Unmount React tree first
if (rootInstance) {
try {
rootInstance.unmount();
} catch {
// Ignore unmount errors
}
rootInstance = null;
}
// Restore terminal state: exit alt screen, show cursor, reset attributes, clear
process.stdout.write('\x1b[?1049l\x1b[?25h\x1b[0m\x1b[H\x1b[2J');
} catch {
// Ignore write errors
}
process.exit(code);
// Use setImmediate to allow any pending operations to complete
setImmediate(() => process.exit(code));
}
export async function startTUI(): Promise<never> {
const renderer = await createCliRenderer({ exitOnCtrlC: true });
const root = createRoot(renderer);
root.render(<App onExit={exitTUI} />);
// Setup signal handlers for clean exit
const handleSignal = () => exitTUI(0);
process.on('SIGINT', handleSignal);
process.on('SIGTERM', handleSignal);
const renderer = await createCliRenderer({ exitOnCtrlC: false });
rootInstance = createRoot(renderer);
rootInstance.render(<App onExit={exitTUI} />);
return new Promise(() => {});
}
+8 -11
View File
@@ -142,19 +142,16 @@ export function Browse({ onNavigate, cols = 80, rows = 24 }: BrowseProps) {
const selected = actualIdx === selectedIndex;
const indicator = selected ? '▸' : ' ';
// Truncate source if needed - clamp to avoid negative slicing
const available = Math.max(0, contentWidth - repo.name.length - 6);
const safeSlice = Math.max(0, available - 3);
const displaySource = available > 0 && repo.source.length > available
? repo.source.slice(0, safeSlice) + '...'
const maxSourceLen = Math.max(0, contentWidth - repo.name.length - 6);
const displaySource = maxSourceLen > 3 && repo.source.length > maxSourceLen
? repo.source.slice(0, maxSourceLen - 3) + '...'
: repo.source;
// Use single text element to avoid rendering overlap issues
const line = `${indicator}${repo.name} · ${displaySource}`;
return (
<box key={repo.source} flexDirection="row">
<text fg={terminalColors.text}>{indicator}</text>
<text fg={selected ? terminalColors.accent : terminalColors.text}>
{repo.name}
</text>
<text fg={terminalColors.textMuted}> · {displaySource}</text>
</box>
<text key={repo.source} fg={selected ? terminalColors.accent : terminalColors.text}>
{line}
</text>
);
})}
</box>
+5 -8
View File
@@ -188,15 +188,12 @@ export function Installed({ onNavigate, cols = 80, rows = 24 }: InstalledProps)
const selected = actualIdx === selectedIndex;
const indicator = selected ? '▸' : ' ';
const statusIcon = skill.enabled !== false ? '●' : '○';
const statusColor = skill.enabled !== false ? terminalColors.success : terminalColors.textMuted;
// Use single text element to avoid rendering overlap
const line = `${indicator}${statusIcon} ${skill.name}`;
return (
<box key={skill.name} flexDirection="row">
<text fg={terminalColors.text}>{indicator}</text>
<text fg={statusColor}>{statusIcon} </text>
<text fg={selected ? terminalColors.accent : terminalColors.text}>
{skill.name}
</text>
</box>
<text key={skill.name} fg={selected ? terminalColors.accent : terminalColors.text}>
{line}
</text>
);
})}
+6 -11
View File
@@ -109,23 +109,18 @@ export function Marketplace({ onNavigate, cols = 80, rows = 24 }: MarketplacePro
{/* Featured section */}
{animPhase >= 3 && (
<box flexDirection="column">
<box flexDirection="row">
<text fg={terminalColors.text}>Featured</text>
<text fg={terminalColors.textMuted}> · trending</text>
</box>
<text fg={terminalColors.text}>Featured · <text fg={terminalColors.textMuted}>trending</text></text>
<text> </text>
{visibleFeatured.map((item, idx) => {
const selected = idx === selectedIndex;
const indicator = selected ? '▸' : ' ';
// Use single text element to avoid rendering overlap
const line = `${indicator}${item.name} ★${item.stars}`;
return (
<box key={item.source} flexDirection="row">
<text fg={terminalColors.text}>{indicator}</text>
<text fg={selected ? terminalColors.accent : terminalColors.text}>
{item.name}
</text>
<text fg={terminalColors.recommend}> ★{item.stars}</text>
</box>
<text key={item.source} fg={selected ? terminalColors.accent : terminalColors.text}>
{line}
</text>
);
})}
-11
View File
@@ -131,9 +131,6 @@ importers:
packages/core:
dependencies:
'@types/minimatch':
specifier: ^6.0.0
version: 6.0.0
minimatch:
specifier: ^10.1.1
version: 10.1.1
@@ -815,10 +812,6 @@ packages:
'@types/http-cache-semantics@4.0.4':
resolution: {integrity: sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA==}
'@types/minimatch@6.0.0':
resolution: {integrity: sha512-zmPitbQ8+6zNutpwgcQuLcsEpn/Cj54Kbn7L5pX0Os5kdWplB7xPgEh/g+SWOB/qmows2gpuCaPyduq8ZZRnxA==}
deprecated: This is a stub types definition. minimatch provides its own type definitions, so you do not need this installed.
'@types/node@16.9.1':
resolution: {integrity: sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==}
@@ -2348,10 +2341,6 @@ snapshots:
'@types/http-cache-semantics@4.0.4': {}
'@types/minimatch@6.0.0':
dependencies:
minimatch: 10.1.1
'@types/node@16.9.1': {}
'@types/node@22.19.7':