wormclaude 1.0.27 → 1.0.29
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/ansi.js +7 -7
- package/dist/theme.js +1 -1
- package/dist/tui.js +25 -16
- package/package.json +1 -1
package/dist/ansi.js
CHANGED
|
@@ -72,9 +72,11 @@ const CLAUDE_ROWS = [
|
|
|
72
72
|
];
|
|
73
73
|
/** Banner'ı ANSI olarak üretir (dar ekranda tek kelime, geniş ekranda yan yana). */
|
|
74
74
|
export function bannerAnsi(cols) {
|
|
75
|
-
|
|
75
|
+
// Responsive: çok dar → tek kelime; orta → WORM üstte CLAUDE altta; geniş → yan yana.
|
|
76
|
+
// (TUI resize'da yeniden bastığı için bozulmaz.)
|
|
77
|
+
if (cols < 50)
|
|
76
78
|
return paint('WORMCLAUDE', theme.red, true) + '\n' + paint(' ' + t('banner.subtitle'), theme.greyDim);
|
|
77
|
-
const rows = cols >=
|
|
79
|
+
const rows = cols >= 90 ? WORM_ROWS.map((w, i) => w + CLAUDE_ROWS[i]) : [...WORM_ROWS, ...CLAUDE_ROWS];
|
|
78
80
|
return rows.map((r) => paint(r, theme.red, true)).join('\n') + '\n' + paint(' ' + t('banner.subtitle'), theme.greyDim);
|
|
79
81
|
}
|
|
80
82
|
// ── Markdown bloğu → ANSI (kod blokları sözdizimi-vurgulu) ──
|
|
@@ -142,11 +144,9 @@ export function itemAnsi(it, cols) {
|
|
|
142
144
|
if (it.kind === 'banner')
|
|
143
145
|
return '\n' + bannerAnsi(cols);
|
|
144
146
|
if (it.kind === 'user') {
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
const body = wrap('› ' + (it.text || ''), inner).map((ln) => paint('│ ', theme.greyDim) + paint(ln.padEnd(inner), theme.white) + paint(' │', theme.greyDim));
|
|
149
|
-
return '\n' + [top, ...body, bot].join('\n');
|
|
147
|
+
// Kenarlıksız (kutu, küçültünce bozuluyordu) — sadece "› metin", resize'da temiz sarılır.
|
|
148
|
+
const body = wrap(it.text || '', W - 2).map((ln, i) => (i === 0 ? paint('› ', theme.greyDim, true) : ' ') + paint(ln, theme.white));
|
|
149
|
+
return '\n' + body.join('\n');
|
|
150
150
|
}
|
|
151
151
|
if (it.kind === 'assistant') {
|
|
152
152
|
const md = markdownAnsi(it.text || '', cols).split('\n');
|
package/dist/theme.js
CHANGED
package/dist/tui.js
CHANGED
|
@@ -6,7 +6,7 @@ import readline from 'node:readline';
|
|
|
6
6
|
import logUpdate from 'log-update';
|
|
7
7
|
import stringWidth from 'string-width';
|
|
8
8
|
import { loadConfig, streamChat } from './api.js';
|
|
9
|
-
import { itemAnsi
|
|
9
|
+
import { itemAnsi } from './ansi.js';
|
|
10
10
|
import { theme, VERSION } from './theme.js';
|
|
11
11
|
import { cleanModelText } from './textclean.js';
|
|
12
12
|
const RESET = '\x1b[0m';
|
|
@@ -46,8 +46,20 @@ export async function runTui() {
|
|
|
46
46
|
let streamPreview = ''; // akış sırasında footer'da gösterilen ham metin
|
|
47
47
|
let spin = 0;
|
|
48
48
|
const SPIN = ['·', '✢', '✳', '✶', '✻', '✽', '✶', '✳', '✢'];
|
|
49
|
-
//
|
|
50
|
-
const
|
|
49
|
+
// Tüm görsel öğeler bellekte (resize'da yeni genişlikte yeniden basmak için).
|
|
50
|
+
const displayItems = [
|
|
51
|
+
{ kind: 'banner' },
|
|
52
|
+
{ kind: 'note', text: `v${VERSION} · özel renderer (deneysel) · /help komutlar · /kopyala panoya` },
|
|
53
|
+
];
|
|
54
|
+
// ── Geçmişe kalıcı yaz (scrollback) + belleğe ekle ──
|
|
55
|
+
const printItem = (it) => { displayItems.push(it); logUpdate.clear(); process.stdout.write(itemAnsi(it, cols()) + '\n'); renderFooter(); };
|
|
56
|
+
// ── Resize: ekranı temizle, HER ŞEYİ o anki genişlikte yeniden bas (banner + kod responsive) ──
|
|
57
|
+
function redrawAll() {
|
|
58
|
+
process.stdout.write('\x1b[2J\x1b[3J\x1b[H');
|
|
59
|
+
for (const it of displayItems)
|
|
60
|
+
process.stdout.write(itemAnsi(it, cols()) + '\n');
|
|
61
|
+
renderFooter();
|
|
62
|
+
}
|
|
51
63
|
// ── Canlı footer (log-update yönetir) ──
|
|
52
64
|
function renderFooter() {
|
|
53
65
|
const W = Math.max(8, cols());
|
|
@@ -116,9 +128,9 @@ export async function runTui() {
|
|
|
116
128
|
process.stdout.write('\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?1015l\x1b[?1007l');
|
|
117
129
|
}
|
|
118
130
|
catch { }
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
// Temiz başlangıç + banner'ı o anki genişlikte bas (responsive: geniş→büyük ASCII, dar→tek kelime).
|
|
132
|
+
redrawAll();
|
|
133
|
+
const quit = () => { logUpdate.clear(); process.stdout.write('\x1b[2J\x1b[3J\x1b[H'); process.exit(0); };
|
|
122
134
|
let ctrlcAt = 0;
|
|
123
135
|
process.stdin.on('keypress', (str, key) => {
|
|
124
136
|
// Ctrl+C tek başına ÇIKMAZ (Windows'ta seçimi Ctrl+C ile kopyalarken uygulama kapanmasın).
|
|
@@ -131,18 +143,14 @@ export async function runTui() {
|
|
|
131
143
|
}
|
|
132
144
|
const now = Date.now();
|
|
133
145
|
if (now - ctrlcAt < 2000) {
|
|
134
|
-
|
|
135
|
-
process.stdout.write('\n');
|
|
136
|
-
process.exit(0);
|
|
146
|
+
quit();
|
|
137
147
|
}
|
|
138
148
|
ctrlcAt = now;
|
|
139
149
|
printItem({ kind: 'note', text: 'Çıkmak için tekrar Ctrl+C (veya /cikis). Kopyalama Ctrl+C\'yi etkilemez.' });
|
|
140
150
|
return;
|
|
141
151
|
}
|
|
142
152
|
if (key && key.ctrl && key.name === 'd') {
|
|
143
|
-
|
|
144
|
-
process.stdout.write('\n');
|
|
145
|
-
process.exit(0);
|
|
153
|
+
quit();
|
|
146
154
|
}
|
|
147
155
|
if (busy)
|
|
148
156
|
return; // tur sırasında giriş kilitli (M1)
|
|
@@ -154,8 +162,7 @@ export async function runTui() {
|
|
|
154
162
|
return;
|
|
155
163
|
}
|
|
156
164
|
if (v === '/cikis' || v === '/exit' || v === '/quit') {
|
|
157
|
-
|
|
158
|
-
process.exit(0);
|
|
165
|
+
quit();
|
|
159
166
|
}
|
|
160
167
|
// /kopyala — son yanıtı OSC52 ile panoya
|
|
161
168
|
if (v === '/kopyala' || v === '/copy') {
|
|
@@ -190,6 +197,8 @@ export async function runTui() {
|
|
|
190
197
|
renderFooter();
|
|
191
198
|
}
|
|
192
199
|
});
|
|
193
|
-
// resize →
|
|
194
|
-
|
|
200
|
+
// resize → debounce sonra HER ŞEYİ yeni genişlikte yeniden bas (banner/kod responsive, bozulmaz).
|
|
201
|
+
let rzTimer = null;
|
|
202
|
+
process.stdout.on('resize', () => { if (rzTimer)
|
|
203
|
+
clearTimeout(rzTimer); rzTimer = setTimeout(redrawAll, 120); });
|
|
195
204
|
}
|