wormclaude 1.0.3 → 1.0.5

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/auth.js CHANGED
@@ -95,17 +95,78 @@ export function runUpdate() {
95
95
  });
96
96
  }
97
97
  // Giriş yapılmamışken `wormclaude` çalışınca gösterilen menü.
98
- // 1 giriş yap, diğer her şey çıkış.
98
+ // ↑/↓ ok tuşlarıyla gezin, Enter ile seç. (1/2 tuşları da çalışır.)
99
99
  export function promptLoginMenu() {
100
+ const items = [
101
+ { label: 'Giriş yap', value: 'login' },
102
+ { label: 'Çıkış', value: 'exit' },
103
+ ];
100
104
  return new Promise((resolve) => {
101
- process.stdout.write('\n \x1b[1mWormClaude\x1b[0m\n\n');
102
- process.stdout.write(' 1) Giriş yap\n');
103
- process.stdout.write(' 2) Çıkış\n\n');
104
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
105
- rl.question(' Seçim (1/2): ', (ans) => {
106
- rl.close();
107
- resolve((ans || '').trim() === '1' ? 'login' : 'exit');
108
- });
105
+ const stdin = process.stdin;
106
+ // TTY yoksa (pipe/otomasyon): tek satır oku — '2' → çıkış, aksi → giriş.
107
+ if (!stdin.isTTY) {
108
+ const rl = readline.createInterface({ input: process.stdin });
109
+ rl.once('line', (line) => { rl.close(); resolve(line.trim() === '2' ? 'exit' : 'login'); });
110
+ return;
111
+ }
112
+ let idx = 0;
113
+ process.stdout.write('\n \x1b[1mWormClaude\x1b[0m\n');
114
+ process.stdout.write(' \x1b[2m↑/↓ ile seç · Enter ile onayla\x1b[0m\n\n');
115
+ const draw = (first) => {
116
+ if (!first)
117
+ process.stdout.write(`\x1b[${items.length}A`); // imleci listenin başına al
118
+ items.forEach((it, i) => {
119
+ const line = i === idx
120
+ ? ` \x1b[36m❯ ${it.label}\x1b[0m`
121
+ : ` \x1b[2m${it.label}\x1b[0m`;
122
+ process.stdout.write('\x1b[2K' + line + '\n'); // satırı temizle + yaz
123
+ });
124
+ };
125
+ draw(true);
126
+ readline.emitKeypressEvents(process.stdin);
127
+ try {
128
+ stdin.setRawMode(true);
129
+ }
130
+ catch { }
131
+ stdin.resume();
132
+ const cleanup = () => {
133
+ process.stdin.off('keypress', onKey);
134
+ try {
135
+ stdin.setRawMode(false);
136
+ }
137
+ catch { }
138
+ stdin.pause();
139
+ process.stdout.write('\x1b[2K\n');
140
+ };
141
+ const onKey = (str, key) => {
142
+ if (!key)
143
+ return;
144
+ if (key.name === 'up' || key.name === 'k') {
145
+ idx = (idx - 1 + items.length) % items.length;
146
+ draw(false);
147
+ }
148
+ else if (key.name === 'down' || key.name === 'j' || key.name === 'tab') {
149
+ idx = (idx + 1) % items.length;
150
+ draw(false);
151
+ }
152
+ else if (str === '1') {
153
+ idx = 0;
154
+ draw(false);
155
+ }
156
+ else if (str === '2') {
157
+ idx = 1;
158
+ draw(false);
159
+ }
160
+ else if (key.name === 'return' || key.name === 'enter') {
161
+ cleanup();
162
+ resolve(items[idx].value);
163
+ }
164
+ else if (key.name === 'escape' || (key.ctrl && key.name === 'c')) {
165
+ cleanup();
166
+ resolve('exit');
167
+ }
168
+ };
169
+ process.stdin.on('keypress', onKey);
109
170
  });
110
171
  }
111
172
  export async function deviceLogin() {
@@ -123,16 +184,13 @@ export async function deviceLogin() {
123
184
  process.exit(1);
124
185
  }
125
186
  const url = start.verification_uri_complete || start.verification_uri;
126
- const userCode = start.user_code;
127
187
  const deviceCode = start.device_code;
128
- process.stdout.write('\n');
129
- process.stdout.write(' Tarayıcıda açın ve giriş yapın:\n');
130
- process.stdout.write(' \x1b[36m' + url + '\x1b[0m\n\n');
131
- process.stdout.write(' Doğrulama kodu: \x1b[1m' + userCode + '\x1b[0m\n\n');
132
188
  openBrowser(url);
189
+ process.stdout.write('\n Tarayıcıda Google ile giriş yapın...\n');
190
+ process.stdout.write(' \x1b[2m(tarayıcı açılmadıysa: ' + url + ')\x1b[0m\n\n');
133
191
  const pollMs = Math.max(2, Number(start.interval) || 3) * 1000;
134
192
  const deadline = Date.now() + (Number(start.expires_in) || 600) * 1000;
135
- process.stdout.write(' Onay bekleniyor');
193
+ process.stdout.write(' Bekleniyor');
136
194
  while (Date.now() < deadline) {
137
195
  await sleep(pollMs);
138
196
  process.stdout.write('.');
package/dist/theme.js CHANGED
@@ -8,4 +8,4 @@ export const theme = {
8
8
  green: '#4ade80',
9
9
  errorRed: '#ff6b6b',
10
10
  };
11
- export const VERSION = '1.0.3';
11
+ export const VERSION = '1.0.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wormclaude",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "WormClaude CLI - uncensored security+code assistant (ink TUI, Claude-style)",
5
5
  "type": "module",
6
6
  "bin": {