zammy 1.2.0 → 1.2.1
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/README.md +37 -6
- package/SECURITY.md +57 -0
- package/dist/index.js +708 -119
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as readline from "readline";
|
|
|
5
5
|
|
|
6
6
|
// src/ui/banner.ts
|
|
7
7
|
import figlet from "figlet";
|
|
8
|
+
import chalk3 from "chalk";
|
|
8
9
|
|
|
9
10
|
// src/ui/colors.ts
|
|
10
11
|
import chalk from "chalk";
|
|
@@ -227,32 +228,388 @@ var categoryIcons = {
|
|
|
227
228
|
};
|
|
228
229
|
var spinnerFrames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
229
230
|
|
|
231
|
+
// src/ui/slime-animated.ts
|
|
232
|
+
import chalk2 from "chalk";
|
|
233
|
+
var C = {
|
|
234
|
+
P1: "#4A235A",
|
|
235
|
+
// Darkest edge
|
|
236
|
+
P2: "#7D3C98",
|
|
237
|
+
// Dark purple
|
|
238
|
+
P3: "#9B59B6",
|
|
239
|
+
// Main purple
|
|
240
|
+
P4: "#BB8FCE",
|
|
241
|
+
// Light purple
|
|
242
|
+
P5: "#D7BDE2",
|
|
243
|
+
// Lightest highlight
|
|
244
|
+
WH: "#FFFFFF",
|
|
245
|
+
// White (sparkles, eye shine)
|
|
246
|
+
BK: "#1A1A2E",
|
|
247
|
+
// Black (eyes, mouth)
|
|
248
|
+
PK: "#E91E63",
|
|
249
|
+
// Pink (tongue)
|
|
250
|
+
YL: "#F1C40F",
|
|
251
|
+
// Yellow (stars)
|
|
252
|
+
BL: "#3498DB",
|
|
253
|
+
// Blue (tears)
|
|
254
|
+
CY: "#00CED1",
|
|
255
|
+
// Cyan (zzz)
|
|
256
|
+
RD: "#E74C3C"
|
|
257
|
+
// Red (angry)
|
|
258
|
+
};
|
|
259
|
+
var b = (hex) => chalk2.bgHex(hex)(" ");
|
|
260
|
+
var dot = chalk2.hex(C.WH)("\xB7");
|
|
261
|
+
var star = chalk2.hex(C.WH)("\u2726");
|
|
262
|
+
var heart = chalk2.hex(C.PK)("\u2665");
|
|
263
|
+
var z = chalk2.hex(C.CY)("z");
|
|
264
|
+
var Z = chalk2.hex(C.CY)("Z");
|
|
265
|
+
var eye = chalk2.bgHex(C.BK).hex(C.WH)(" \xB7");
|
|
266
|
+
var shine = chalk2.bgHex(C.P3).hex(C.WH)(" \xB7");
|
|
267
|
+
var shine2 = chalk2.bgHex(C.P4).hex(C.WH)("\xB7 ");
|
|
268
|
+
var slimeFrames = {
|
|
269
|
+
happy: () => {
|
|
270
|
+
const { P1, P2, P3, P4, P5, BK, PK } = C;
|
|
271
|
+
return [
|
|
272
|
+
` ${dot} ${dot}`,
|
|
273
|
+
` ${b(P5)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P5)}`,
|
|
274
|
+
` ${b(P5)}${b(P4)}${b(P3)}${shine2}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}${b(P5)}`,
|
|
275
|
+
` ${b(P4)}${b(P3)}${eye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${eye}${b(P3)}${b(P4)}`,
|
|
276
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
277
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(PK)}${b(BK)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
278
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P2)}`,
|
|
279
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
280
|
+
];
|
|
281
|
+
},
|
|
282
|
+
excited: () => {
|
|
283
|
+
const { P1, P2, P3, P4, P5, BK, PK, YL } = C;
|
|
284
|
+
const starEye = chalk2.bgHex(YL).hex(C.WH)("\u2605 ");
|
|
285
|
+
return [
|
|
286
|
+
` ${star} ${dot} ${star} ${dot} ${star}`,
|
|
287
|
+
` ${b(P5)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P5)}`,
|
|
288
|
+
` ${b(P5)}${b(P4)}${b(P3)}${shine2}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}${b(P5)}`,
|
|
289
|
+
` ${b(P4)}${b(P3)}${starEye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${starEye}${b(P3)}${b(P4)}`,
|
|
290
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
291
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(PK)}${b(BK)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
292
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P2)}`,
|
|
293
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
294
|
+
];
|
|
295
|
+
},
|
|
296
|
+
love: () => {
|
|
297
|
+
const { P1, P2, P3, P4, P5, BK, PK } = C;
|
|
298
|
+
const heartEye = chalk2.bgHex(PK).hex(C.WH)("\u2665 ");
|
|
299
|
+
return [
|
|
300
|
+
` ${heart} ${heart}`,
|
|
301
|
+
` ${b(P5)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P5)}`,
|
|
302
|
+
` ${b(P5)}${b(P4)}${b(P3)}${shine2}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}${b(P5)}`,
|
|
303
|
+
` ${b(P4)}${b(P3)}${heartEye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${heartEye}${b(P3)}${b(P4)}`,
|
|
304
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
305
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(PK)}${b(BK)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
306
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P2)}`,
|
|
307
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
308
|
+
];
|
|
309
|
+
},
|
|
310
|
+
sleepy: () => {
|
|
311
|
+
const { P1, P2, P3, P4, P5, BK } = C;
|
|
312
|
+
const closedEye = chalk2.bgHex(P3).hex(BK)("\u2500\u2500");
|
|
313
|
+
return [
|
|
314
|
+
` ${z} ${z} ${Z}`,
|
|
315
|
+
` ${b(P5)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P5)}`,
|
|
316
|
+
` ${b(P5)}${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}${b(P5)}`,
|
|
317
|
+
` ${b(P4)}${b(P3)}${closedEye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${closedEye}${b(P3)}${b(P4)}`,
|
|
318
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
319
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
320
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P2)}`,
|
|
321
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
322
|
+
];
|
|
323
|
+
},
|
|
324
|
+
thinking: () => {
|
|
325
|
+
const { P1, P2, P3, P4, P5, BK, YL } = C;
|
|
326
|
+
const thinkEye = chalk2.bgHex(C.BK).hex(C.WH)(" \xB7");
|
|
327
|
+
const lookUpEye = chalk2.bgHex(C.BK).hex(C.WH)("\xB7 ");
|
|
328
|
+
return [
|
|
329
|
+
` ${chalk2.hex(YL)("?")}`,
|
|
330
|
+
` ${b(P5)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P5)}`,
|
|
331
|
+
` ${b(P5)}${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}${b(P5)}`,
|
|
332
|
+
` ${b(P4)}${b(P3)}${thinkEye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${lookUpEye}${b(P3)}${b(P4)}`,
|
|
333
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
334
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
335
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P2)}`,
|
|
336
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
337
|
+
];
|
|
338
|
+
},
|
|
339
|
+
surprised: () => {
|
|
340
|
+
const { P1, P2, P3, P4, P5, BK, YL } = C;
|
|
341
|
+
const bigEye = chalk2.bgHex(BK).hex(C.WH)("\u25C9 ");
|
|
342
|
+
return [
|
|
343
|
+
` ${chalk2.hex(YL)("!!")}`,
|
|
344
|
+
` ${b(P5)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P5)}`,
|
|
345
|
+
` ${b(P5)}${b(P4)}${b(P3)}${shine2}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}${b(P5)}`,
|
|
346
|
+
` ${b(P4)}${b(P3)}${bigEye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${bigEye}${b(P3)}${b(P4)}`,
|
|
347
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
348
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(BK)}${b(BK)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
349
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P2)}`,
|
|
350
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
351
|
+
];
|
|
352
|
+
},
|
|
353
|
+
sad: () => {
|
|
354
|
+
const { P1, P2, P3, P4, P5, BK, BL } = C;
|
|
355
|
+
const sadEye = chalk2.bgHex(BK).hex(C.WH)(" \xB7");
|
|
356
|
+
const tear = chalk2.bgHex(BL)(" ");
|
|
357
|
+
return [
|
|
358
|
+
` ${dot} ${dot} ${dot}`,
|
|
359
|
+
` ${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}`,
|
|
360
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
361
|
+
` ${b(P4)}${b(P3)}${sadEye}${tear}${b(P3)}${b(P3)}${tear}${sadEye}${b(P3)}${b(P4)}`,
|
|
362
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
363
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(BK)}${b(BK)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
364
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P2)}`,
|
|
365
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
366
|
+
];
|
|
367
|
+
},
|
|
368
|
+
wink: () => {
|
|
369
|
+
const { P1, P2, P3, P4, P5, BK, PK } = C;
|
|
370
|
+
const winkEye = chalk2.bgHex(P3).hex(BK)("> ");
|
|
371
|
+
return [
|
|
372
|
+
` ${star} ${dot}`,
|
|
373
|
+
` ${b(P5)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P5)}`,
|
|
374
|
+
` ${b(P5)}${b(P4)}${b(P3)}${shine2}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}${b(P5)}`,
|
|
375
|
+
` ${b(P4)}${b(P3)}${eye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${winkEye}${b(P3)}${b(P4)}`,
|
|
376
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
377
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(PK)}${b(BK)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
378
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${shine}${b(P3)}${b(P3)}${b(P2)}`,
|
|
379
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
380
|
+
];
|
|
381
|
+
},
|
|
382
|
+
angry: () => {
|
|
383
|
+
const { P1, P2, P3, P4, BK, RD } = C;
|
|
384
|
+
const angryEye = chalk2.bgHex(BK).hex(RD)("> ");
|
|
385
|
+
const angryEye2 = chalk2.bgHex(BK).hex(RD)(" <");
|
|
386
|
+
return [
|
|
387
|
+
` ${chalk2.hex(RD)("# @!")}`,
|
|
388
|
+
` ${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}${b(P4)}`,
|
|
389
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
390
|
+
` ${b(P4)}${b(P3)}${angryEye}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${angryEye2}${b(P3)}${b(P4)}`,
|
|
391
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
392
|
+
` ${b(P4)}${b(P3)}${b(P3)}${b(P3)}${b(BK)}${b(BK)}${b(BK)}${b(P3)}${b(P3)}${b(P4)}`,
|
|
393
|
+
` ${b(P2)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P3)}${b(P2)}`,
|
|
394
|
+
` ${b(P1)}${b(P2)}${b(P2)}${b(P2)}${b(P2)}${b(P1)}`
|
|
395
|
+
];
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
var greetings = [
|
|
399
|
+
"Hiii~! I'm Zammy!",
|
|
400
|
+
"Ready to get stuff done?",
|
|
401
|
+
"*bounces* What's the plan?",
|
|
402
|
+
"Type / to see commands!",
|
|
403
|
+
"*jiggles excitedly* Let's go!",
|
|
404
|
+
"*sparkles* Hi friend!"
|
|
405
|
+
];
|
|
406
|
+
var lateNightGreetings = [
|
|
407
|
+
"*yawns* Burning the midnight oil?",
|
|
408
|
+
"zzZ... oh! You're still up?",
|
|
409
|
+
"*sleepy bounce* Late night coding?",
|
|
410
|
+
"The best code happens at 3am~"
|
|
411
|
+
];
|
|
412
|
+
var morningGreetings = [
|
|
413
|
+
"*stretches* Good morning~!",
|
|
414
|
+
"Rise and shine!",
|
|
415
|
+
"*bounces awake* New day!",
|
|
416
|
+
"Morning! Coffee first?"
|
|
417
|
+
];
|
|
418
|
+
function getGreeting() {
|
|
419
|
+
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
420
|
+
if (hour >= 0 && hour < 5) {
|
|
421
|
+
return lateNightGreetings[Math.floor(Math.random() * lateNightGreetings.length)];
|
|
422
|
+
} else if (hour >= 5 && hour < 12) {
|
|
423
|
+
return morningGreetings[Math.floor(Math.random() * morningGreetings.length)];
|
|
424
|
+
}
|
|
425
|
+
return greetings[Math.floor(Math.random() * greetings.length)];
|
|
426
|
+
}
|
|
427
|
+
function getStartupMood() {
|
|
428
|
+
const hour = (/* @__PURE__ */ new Date()).getHours();
|
|
429
|
+
if (hour >= 0 && hour < 5) return "sleepy";
|
|
430
|
+
return "happy";
|
|
431
|
+
}
|
|
432
|
+
var miniSlime = {
|
|
433
|
+
happy: chalk2.hex(C.P3)("(") + chalk2.hex(C.BK)("\u25D5") + chalk2.hex(C.P3)("\u1D17") + chalk2.hex(C.BK)("\u25D5") + chalk2.hex(C.P3)(")"),
|
|
434
|
+
excited: chalk2.hex(C.P3)("(") + chalk2.hex(C.YL)("\u2605") + chalk2.hex(C.P3)("\u1D17") + chalk2.hex(C.YL)("\u2605") + chalk2.hex(C.P3)(")"),
|
|
435
|
+
love: chalk2.hex(C.P3)("(") + chalk2.hex(C.PK)("\u2665") + chalk2.hex(C.P3)("\u1D17") + chalk2.hex(C.PK)("\u2665") + chalk2.hex(C.P3)(")"),
|
|
436
|
+
sleepy: chalk2.hex(C.P3)("(") + chalk2.hex(C.BK)("\u2013") + chalk2.hex(C.P3)("\u03C9") + chalk2.hex(C.BK)("\u2013") + chalk2.hex(C.P3)(") zZ"),
|
|
437
|
+
sad: chalk2.hex(C.P3)("(") + chalk2.hex(C.BK)("\u25D5") + chalk2.hex(C.P3)("\uFE35") + chalk2.hex(C.BK)("\u25D5") + chalk2.hex(C.P3)(")"),
|
|
438
|
+
surprised: chalk2.hex(C.P3)("(") + chalk2.hex(C.BK)("\u25CE") + chalk2.hex(C.P3)("\u25CB") + chalk2.hex(C.BK)("\u25CE") + chalk2.hex(C.P3)(")!"),
|
|
439
|
+
wink: chalk2.hex(C.P3)("(") + chalk2.hex(C.BK)("\u25D5") + chalk2.hex(C.P3)("\u1D17") + chalk2.hex(C.BK)(">") + chalk2.hex(C.P3)(")"),
|
|
440
|
+
thinking: chalk2.hex(C.P3)("(") + chalk2.hex(C.BK)("\u25D5") + chalk2.hex(C.P3)("\uFF5E") + chalk2.hex(C.BK)("\u25D4") + chalk2.hex(C.P3)(")"),
|
|
441
|
+
angry: chalk2.hex(C.P3)("(") + chalk2.hex(C.RD)(">") + chalk2.hex(C.P3)("_") + chalk2.hex(C.RD)("<") + chalk2.hex(C.P3)(")")
|
|
442
|
+
};
|
|
443
|
+
var validMoods = Object.keys(slimeFrames);
|
|
444
|
+
function react(mood, message) {
|
|
445
|
+
const slime = miniSlime[mood] || miniSlime.happy;
|
|
446
|
+
if (message) {
|
|
447
|
+
console.log(` ${slime} ${message}`);
|
|
448
|
+
} else {
|
|
449
|
+
console.log(` ${slime}`);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
var MIN_WIDTH_FOR_MASCOT = 50;
|
|
453
|
+
function showMascot(mood) {
|
|
454
|
+
const termWidth = process.stdout.columns || 80;
|
|
455
|
+
if (termWidth < MIN_WIDTH_FOR_MASCOT) {
|
|
456
|
+
react(mood);
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const frameFunc = slimeFrames[mood];
|
|
460
|
+
if (frameFunc) {
|
|
461
|
+
const art = frameFunc();
|
|
462
|
+
console.log("");
|
|
463
|
+
art.forEach((line) => console.log(" " + line));
|
|
464
|
+
console.log("");
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
function getMoodFromText(text) {
|
|
468
|
+
const lower = text.toLowerCase();
|
|
469
|
+
if (/\b(thanks|thank you|love|love you|thx|ty|<3|heart)\b/.test(lower)) {
|
|
470
|
+
return "love";
|
|
471
|
+
}
|
|
472
|
+
if (/\b(awesome|amazing|wow|cool|nice|great|perfect|yay|woohoo|!\s*$)\b/.test(lower)) {
|
|
473
|
+
return "excited";
|
|
474
|
+
}
|
|
475
|
+
if (/\b(tired|sleepy|zzz|night|late|exhausted)\b/.test(lower)) {
|
|
476
|
+
return "sleepy";
|
|
477
|
+
}
|
|
478
|
+
if (/\b(angry|mad|hate|stupid|wtf|damn|crap|sucks|ugh|argh|grr)\b|:\(/.test(lower)) {
|
|
479
|
+
return "angry";
|
|
480
|
+
}
|
|
481
|
+
if (/\b(sad|sorry|fail|broke|wrong)\b/.test(lower)) {
|
|
482
|
+
return "sad";
|
|
483
|
+
}
|
|
484
|
+
if (/\b(hmm|think|wonder|maybe|idk|not sure|confused|\?$)\b/.test(lower)) {
|
|
485
|
+
return "thinking";
|
|
486
|
+
}
|
|
487
|
+
return null;
|
|
488
|
+
}
|
|
489
|
+
|
|
230
490
|
// src/ui/banner.ts
|
|
231
|
-
|
|
491
|
+
var C2 = {
|
|
492
|
+
// Purple gradient (light to dark)
|
|
493
|
+
P1: "#4A235A",
|
|
494
|
+
// Darkest edge
|
|
495
|
+
P2: "#7D3C98",
|
|
496
|
+
// Dark purple
|
|
497
|
+
P3: "#9B59B6",
|
|
498
|
+
// Main purple
|
|
499
|
+
P4: "#BB8FCE",
|
|
500
|
+
// Light purple
|
|
501
|
+
P5: "#D7BDE2",
|
|
502
|
+
// Lightest
|
|
503
|
+
// Accents
|
|
504
|
+
WH: "#FFFFFF",
|
|
505
|
+
// White (sparkles, eye highlight)
|
|
506
|
+
BK: "#1A1A2E",
|
|
507
|
+
// Black (eyes, mouth)
|
|
508
|
+
PK: "#E91E63"
|
|
509
|
+
// Pink (tongue)
|
|
510
|
+
};
|
|
511
|
+
var b2 = (hex) => chalk3.bgHex(hex)(" ");
|
|
512
|
+
var dot2 = chalk3.hex(C2.WH)("\xB7");
|
|
513
|
+
function getSlimeLines(isBlinking, _mood) {
|
|
514
|
+
const { P1, P2, P3, P4, P5, WH, BK, PK } = C2;
|
|
515
|
+
const openEye = chalk3.bgHex(BK).hex(WH)(" \xB7");
|
|
516
|
+
const closedEye = chalk3.bgHex(P3).hex(BK)("\u2500\u2500");
|
|
517
|
+
const eyeL = isBlinking ? closedEye : openEye;
|
|
518
|
+
const eyeR = isBlinking ? closedEye : openEye;
|
|
519
|
+
const shine3 = chalk3.bgHex(P3).hex(WH)(" \xB7");
|
|
520
|
+
const shine22 = chalk3.bgHex(P4).hex(WH)("\xB7 ");
|
|
521
|
+
const miniBlob = `${b2(P3)}`;
|
|
522
|
+
return [
|
|
523
|
+
` ${dot2} ${dot2}`,
|
|
524
|
+
` ${b2(P5)}${b2(P4)}${b2(P4)}${b2(P4)}${b2(P4)}${b2(P4)}${b2(P4)}${b2(P5)}`,
|
|
525
|
+
` ${b2(P5)}${b2(P4)}${b2(P3)}${shine22}${b2(P3)}${b2(P3)}${b2(P3)}${b2(P3)}${b2(P4)}${b2(P5)}`,
|
|
526
|
+
` ${b2(P4)}${b2(P3)}${eyeL}${b2(P3)}${b2(P3)}${b2(P3)}${b2(P3)}${eyeR}${b2(P3)}${b2(P4)}`,
|
|
527
|
+
` ${b2(P4)}${b2(P3)}${b2(P3)}${b2(P3)}${shine3}${b2(P3)}${b2(P3)}${b2(P3)}${b2(P3)}${b2(P4)}`,
|
|
528
|
+
` ${b2(P4)}${b2(P3)}${b2(P3)}${b2(P3)}${b2(BK)}${b2(PK)}${b2(BK)}${b2(P3)}${b2(P3)}${b2(P4)}`,
|
|
529
|
+
` ${b2(P2)}${b2(P3)}${b2(P3)}${b2(P3)}${shine3}${b2(P3)}${b2(P3)}${b2(P2)}`,
|
|
530
|
+
` ${b2(P1)}${b2(P2)}${b2(P2)}${b2(P2)}${b2(P2)}${b2(P1)} ${miniBlob}`
|
|
531
|
+
];
|
|
532
|
+
}
|
|
533
|
+
var MIN_WIDTH_FOR_MASCOT2 = 90;
|
|
534
|
+
var MIN_WIDTH_FOR_FULL_LOGO = 55;
|
|
535
|
+
var MIN_WIDTH_FOR_COMPACT = 30;
|
|
536
|
+
async function displayBanner(simple = false) {
|
|
232
537
|
return new Promise((resolve3) => {
|
|
538
|
+
const termWidth = process.stdout.columns || 80;
|
|
233
539
|
figlet("ZAMMY", {
|
|
234
540
|
font: "ANSI Shadow",
|
|
235
541
|
horizontalLayout: "default"
|
|
236
|
-
}, (err, data) => {
|
|
542
|
+
}, async (err, data) => {
|
|
237
543
|
console.log("");
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
console.log(theme.gradient("
|
|
242
|
-
console.log(theme.
|
|
243
|
-
console.log(theme.
|
|
244
|
-
console.log(
|
|
544
|
+
const greeting = getGreeting();
|
|
545
|
+
const mood = getStartupMood();
|
|
546
|
+
if (termWidth < MIN_WIDTH_FOR_COMPACT) {
|
|
547
|
+
console.log(theme.gradient(" ZAMMY"));
|
|
548
|
+
console.log(theme.secondary(` "${greeting}"`));
|
|
549
|
+
console.log(theme.dim(" Type /help for commands"));
|
|
550
|
+
console.log("");
|
|
551
|
+
resolve3();
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
let figletLines = [];
|
|
555
|
+
if (err || !data || termWidth < MIN_WIDTH_FOR_FULL_LOGO) {
|
|
556
|
+
if (termWidth < MIN_WIDTH_FOR_FULL_LOGO) {
|
|
557
|
+
figletLines = [
|
|
558
|
+
"\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557",
|
|
559
|
+
"\u2551 Z A M M Y \u2551",
|
|
560
|
+
"\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D"
|
|
561
|
+
];
|
|
562
|
+
} else {
|
|
563
|
+
figletLines = [
|
|
564
|
+
"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557",
|
|
565
|
+
"\u255A\u2550\u2550\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D",
|
|
566
|
+
" \u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2554\u255D ",
|
|
567
|
+
" \u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551 \u255A\u2588\u2588\u2554\u255D ",
|
|
568
|
+
"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551 \u2588\u2588\u2551 ",
|
|
569
|
+
"\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D "
|
|
570
|
+
];
|
|
571
|
+
}
|
|
245
572
|
} else {
|
|
246
|
-
data.split("\n").
|
|
247
|
-
console.log(theme.gradient(line));
|
|
248
|
-
});
|
|
573
|
+
figletLines = data.split("\n").filter((line) => line.trim());
|
|
249
574
|
}
|
|
575
|
+
const showMascot2 = !simple && termWidth >= MIN_WIDTH_FOR_MASCOT2;
|
|
576
|
+
if (!showMascot2) {
|
|
577
|
+
figletLines.forEach((line) => console.log(" " + theme.gradient(line)));
|
|
578
|
+
console.log("");
|
|
579
|
+
console.log(theme.secondary(` "${greeting}"`));
|
|
580
|
+
console.log("");
|
|
581
|
+
console.log(theme.dim(` ${symbols.arrow} Type ${theme.primary("/")} to browse commands or ${theme.primary("/help")} for full list`));
|
|
582
|
+
console.log(theme.dim(` ${symbols.arrow} Shell commands start with ${theme.primary("!")} (e.g., ${theme.primary("!ls")}, ${theme.primary("!git")})`));
|
|
583
|
+
console.log("");
|
|
584
|
+
resolve3();
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const figletWidth = 50;
|
|
588
|
+
const paddedFiglet = figletLines.map((line) => line.padEnd(figletWidth));
|
|
589
|
+
const blinkSequence = [false, false, false, true, false, false];
|
|
590
|
+
const frameTime = 180;
|
|
591
|
+
process.stdout.write("\x1B[?25l");
|
|
592
|
+
for (let frame = 0; frame < blinkSequence.length; frame++) {
|
|
593
|
+
const isBlinking = blinkSequence[frame];
|
|
594
|
+
const slimeLines = getSlimeLines(isBlinking, mood);
|
|
595
|
+
if (frame > 0) {
|
|
596
|
+
const totalLines = Math.max(paddedFiglet.length, slimeLines.length) + 1;
|
|
597
|
+
process.stdout.write(`\x1B[${totalLines}A`);
|
|
598
|
+
}
|
|
599
|
+
const maxLines = Math.max(paddedFiglet.length, slimeLines.length);
|
|
600
|
+
for (let i = 0; i < maxLines; i++) {
|
|
601
|
+
const figLine = paddedFiglet[i] || "".padEnd(figletWidth);
|
|
602
|
+
const slimeLine = slimeLines[i] || "";
|
|
603
|
+
console.log(" " + theme.gradient(figLine) + " " + slimeLine);
|
|
604
|
+
}
|
|
605
|
+
console.log("");
|
|
606
|
+
await new Promise((r) => setTimeout(r, frameTime));
|
|
607
|
+
}
|
|
608
|
+
process.stdout.write("\x1B[?25h");
|
|
609
|
+
console.log(theme.secondary(` "${greeting}"`));
|
|
250
610
|
console.log("");
|
|
251
|
-
console.log(` ${symbols.
|
|
252
|
-
console.log("");
|
|
253
|
-
console.log(theme.dim(` ${symbols.arrow} Type ${theme.primary("/")} to browse commands (use ${theme.primary("\u2191\u2193")} to navigate, ${theme.primary("Tab")} to select)`));
|
|
254
|
-
console.log(theme.dim(` ${symbols.arrow} Type ${theme.primary("/help")} for full command list`));
|
|
255
|
-
console.log(theme.dim(` ${symbols.arrow} Shell commands start with ${theme.primary("!")} (e.g., ${theme.primary("!ls")}, ${theme.primary("!cd")})`));
|
|
611
|
+
console.log(theme.dim(` ${symbols.arrow} Type ${theme.primary("/")} to browse commands or ${theme.primary("/help")} for full list`));
|
|
612
|
+
console.log(theme.dim(` ${symbols.arrow} Shell commands start with ${theme.primary("!")} (e.g., ${theme.primary("!ls")}, ${theme.primary("!git")})`));
|
|
256
613
|
console.log("");
|
|
257
614
|
resolve3();
|
|
258
615
|
});
|
|
@@ -279,7 +636,7 @@ function getAllCommands() {
|
|
|
279
636
|
// src/commands/utilities/help.ts
|
|
280
637
|
var categories = {
|
|
281
638
|
"Utilities": ["help", "exit", "calc", "password", "stats", "time", "countdown", "timer", "todo", "history"],
|
|
282
|
-
"Fun": ["joke", "quote", "fortune", "dice", "flip", "pomodoro"],
|
|
639
|
+
"Fun": ["joke", "quote", "fortune", "dice", "flip", "pomodoro", "zammy"],
|
|
283
640
|
"Creative": ["asciiart", "figlet", "lorem", "color"],
|
|
284
641
|
"Dev": ["hash", "uuid", "encode"],
|
|
285
642
|
"Info": ["weather"]
|
|
@@ -1405,7 +1762,7 @@ function rollDice(count = 1, sides = 6) {
|
|
|
1405
1762
|
count: safeCount,
|
|
1406
1763
|
sides: safeSides,
|
|
1407
1764
|
rolls,
|
|
1408
|
-
total: rolls.reduce((a,
|
|
1765
|
+
total: rolls.reduce((a, b3) => a + b3, 0),
|
|
1409
1766
|
isStandardD6: safeSides === 6 && safeCount <= 3
|
|
1410
1767
|
};
|
|
1411
1768
|
}
|
|
@@ -1655,6 +2012,98 @@ registerCommand({
|
|
|
1655
2012
|
}
|
|
1656
2013
|
});
|
|
1657
2014
|
|
|
2015
|
+
// src/commands/fun/zammy.ts
|
|
2016
|
+
var MIN_WIDTH_FOR_MASCOT3 = 50;
|
|
2017
|
+
var MIN_WIDTH_FOR_ASCII = 70;
|
|
2018
|
+
var asciiMascot = `
|
|
2019
|
+
**/***********,
|
|
2020
|
+
****** **//////////****
|
|
2021
|
+
***/**///////////////////////**
|
|
2022
|
+
****///////////**////////////////(**
|
|
2023
|
+
***////& &////////////% &////* ,////(**
|
|
2024
|
+
*//////&&&/////////////&&&//(/////((((((*
|
|
2025
|
+
**/////////&&&&&&&&&&&&////(//((/(((((((((/*
|
|
2026
|
+
**/////////&&&&&&/****&&//((* /(((((((((((((*
|
|
2027
|
+
,*////* *///&&&*******&*/(((((((((((((((((((**
|
|
2028
|
+
**////////////*//(**(/(/((((((((((((((((/(((*
|
|
2029
|
+
**//////////////(((/(((((((((/ .*((((((((((**
|
|
2030
|
+
**////////(/((((/((((((((((((((((((((((((/*
|
|
2031
|
+
**(((///(((((//((((((((((((((((((((((#**
|
|
2032
|
+
**/((((((((((((((((/*(((((((((((((*
|
|
2033
|
+
***((((((((((((((((((#(((((** */*///
|
|
2034
|
+
***************** *(((( .*/
|
|
2035
|
+
`;
|
|
2036
|
+
registerCommand({
|
|
2037
|
+
name: "zammy",
|
|
2038
|
+
description: "Say hi to Zammy the slime!",
|
|
2039
|
+
usage: "/zammy [mood|ascii|moods]",
|
|
2040
|
+
async execute(args2) {
|
|
2041
|
+
const mood = args2[0] || "happy";
|
|
2042
|
+
const termWidth = process.stdout.columns || 80;
|
|
2043
|
+
if (mood === "ascii" || mood === "mascot") {
|
|
2044
|
+
console.log("");
|
|
2045
|
+
if (termWidth < MIN_WIDTH_FOR_ASCII) {
|
|
2046
|
+
console.log(` ${miniSlime.happy} Hi! I'm Zammy!`);
|
|
2047
|
+
console.log(` ${theme.dim("(widen your terminal to see my full form!)")}`);
|
|
2048
|
+
} else {
|
|
2049
|
+
console.log(theme.primary(asciiMascot));
|
|
2050
|
+
}
|
|
2051
|
+
console.log(` ${theme.secondary(`"${getGreeting()}"`)}`);
|
|
2052
|
+
console.log("");
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
if (mood === "moods" || mood === "all") {
|
|
2056
|
+
console.log("");
|
|
2057
|
+
console.log(` ${symbols.sparkle} ${theme.primary("Zammy's moods:")} ${symbols.sparkle}`);
|
|
2058
|
+
console.log("");
|
|
2059
|
+
if (termWidth < MIN_WIDTH_FOR_MASCOT3) {
|
|
2060
|
+
for (const m of validMoods) {
|
|
2061
|
+
const mini = miniSlime[m];
|
|
2062
|
+
if (mini) {
|
|
2063
|
+
console.log(` ${mini} ${theme.dim(m)}`);
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
console.log("");
|
|
2067
|
+
console.log(` ${theme.dim("(widen your terminal to see full mood sprites!)")}`);
|
|
2068
|
+
} else {
|
|
2069
|
+
for (const m of validMoods) {
|
|
2070
|
+
const frameFunc2 = slimeFrames[m];
|
|
2071
|
+
if (frameFunc2) {
|
|
2072
|
+
console.log(theme.secondary(` \u2500\u2500\u2500 ${m.toUpperCase()} \u2500\u2500\u2500`));
|
|
2073
|
+
const art = frameFunc2();
|
|
2074
|
+
art.forEach((line) => console.log(" " + line));
|
|
2075
|
+
console.log("");
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
if (!validMoods.includes(mood)) {
|
|
2082
|
+
console.log("");
|
|
2083
|
+
console.log(` ${miniSlime.surprised} ${theme.warning("I don't know that mood!")}`);
|
|
2084
|
+
console.log(` ${theme.dim(`Try: ${validMoods.join(", ")}, ascii`)}`);
|
|
2085
|
+
console.log(` ${theme.dim(`Or: /zammy moods`)}`);
|
|
2086
|
+
console.log("");
|
|
2087
|
+
return;
|
|
2088
|
+
}
|
|
2089
|
+
const frameFunc = slimeFrames[mood];
|
|
2090
|
+
const greeting = getGreeting();
|
|
2091
|
+
console.log("");
|
|
2092
|
+
if (termWidth < MIN_WIDTH_FOR_MASCOT3) {
|
|
2093
|
+
const mini = miniSlime[mood] || miniSlime.happy;
|
|
2094
|
+
console.log(` ${mini}`);
|
|
2095
|
+
} else if (frameFunc) {
|
|
2096
|
+
const art = frameFunc();
|
|
2097
|
+
art.forEach((line) => console.log(" " + line));
|
|
2098
|
+
}
|
|
2099
|
+
console.log("");
|
|
2100
|
+
console.log(` ${theme.secondary(`"${greeting}"`)}`);
|
|
2101
|
+
console.log("");
|
|
2102
|
+
console.log(` ${theme.dim("I'm Zammy, your CLI buddy! Type /help to see what I can do~")}`);
|
|
2103
|
+
console.log("");
|
|
2104
|
+
}
|
|
2105
|
+
});
|
|
2106
|
+
|
|
1658
2107
|
// src/commands/creative/asciiart.ts
|
|
1659
2108
|
import Jimp from "jimp";
|
|
1660
2109
|
import { existsSync as existsSync3 } from "fs";
|
|
@@ -1682,8 +2131,8 @@ var SOBEL_Y = [
|
|
|
1682
2131
|
[1, 2, 1]
|
|
1683
2132
|
];
|
|
1684
2133
|
function getAsciiChar(brightness, ramp, inverted) {
|
|
1685
|
-
const
|
|
1686
|
-
const index = Math.floor(
|
|
2134
|
+
const b3 = Math.max(0, Math.min(255, brightness));
|
|
2135
|
+
const index = Math.floor(b3 / 255 * (ramp.length - 1));
|
|
1687
2136
|
return inverted ? ramp[ramp.length - 1 - index] : ramp[index];
|
|
1688
2137
|
}
|
|
1689
2138
|
async function applyEdgeEnhancement(image, strength) {
|
|
@@ -2045,7 +2494,7 @@ registerCommand({
|
|
|
2045
2494
|
});
|
|
2046
2495
|
|
|
2047
2496
|
// src/commands/creative/color.ts
|
|
2048
|
-
import
|
|
2497
|
+
import chalk4 from "chalk";
|
|
2049
2498
|
|
|
2050
2499
|
// src/handlers/creative/color.ts
|
|
2051
2500
|
function hexToRgb(hex) {
|
|
@@ -2056,14 +2505,14 @@ function hexToRgb(hex) {
|
|
|
2056
2505
|
b: parseInt(result[3], 16)
|
|
2057
2506
|
} : null;
|
|
2058
2507
|
}
|
|
2059
|
-
function rgbToHex(r, g,
|
|
2060
|
-
return "#" + [r, g,
|
|
2508
|
+
function rgbToHex(r, g, b3) {
|
|
2509
|
+
return "#" + [r, g, b3].map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
2061
2510
|
}
|
|
2062
|
-
function rgbToHsl(r, g,
|
|
2511
|
+
function rgbToHsl(r, g, b3) {
|
|
2063
2512
|
r /= 255;
|
|
2064
2513
|
g /= 255;
|
|
2065
|
-
|
|
2066
|
-
const max = Math.max(r, g,
|
|
2514
|
+
b3 /= 255;
|
|
2515
|
+
const max = Math.max(r, g, b3), min = Math.min(r, g, b3);
|
|
2067
2516
|
let h = 0, s = 0;
|
|
2068
2517
|
const l = (max + min) / 2;
|
|
2069
2518
|
if (max !== min) {
|
|
@@ -2071,20 +2520,20 @@ function rgbToHsl(r, g, b) {
|
|
|
2071
2520
|
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
2072
2521
|
switch (max) {
|
|
2073
2522
|
case r:
|
|
2074
|
-
h = ((g -
|
|
2523
|
+
h = ((g - b3) / d + (g < b3 ? 6 : 0)) / 6;
|
|
2075
2524
|
break;
|
|
2076
2525
|
case g:
|
|
2077
|
-
h = ((
|
|
2526
|
+
h = ((b3 - r) / d + 2) / 6;
|
|
2078
2527
|
break;
|
|
2079
|
-
case
|
|
2528
|
+
case b3:
|
|
2080
2529
|
h = ((r - g) / d + 4) / 6;
|
|
2081
2530
|
break;
|
|
2082
2531
|
}
|
|
2083
2532
|
}
|
|
2084
2533
|
return { h: Math.round(h * 360), s: Math.round(s * 100), l: Math.round(l * 100) };
|
|
2085
2534
|
}
|
|
2086
|
-
function getLuminance(r, g,
|
|
2087
|
-
return (0.299 * r + 0.587 * g + 0.114 *
|
|
2535
|
+
function getLuminance(r, g, b3) {
|
|
2536
|
+
return (0.299 * r + 0.587 * g + 0.114 * b3) / 255;
|
|
2088
2537
|
}
|
|
2089
2538
|
function randomColor() {
|
|
2090
2539
|
return {
|
|
@@ -2094,12 +2543,12 @@ function randomColor() {
|
|
|
2094
2543
|
};
|
|
2095
2544
|
}
|
|
2096
2545
|
function parseColor(input) {
|
|
2097
|
-
let r, g,
|
|
2546
|
+
let r, g, b3;
|
|
2098
2547
|
if (!input || input === "random") {
|
|
2099
2548
|
const rgb = randomColor();
|
|
2100
2549
|
r = rgb.r;
|
|
2101
2550
|
g = rgb.g;
|
|
2102
|
-
|
|
2551
|
+
b3 = rgb.b;
|
|
2103
2552
|
} else {
|
|
2104
2553
|
const hexMatch = input.match(/^#?([a-f\d]{6}|[a-f\d]{3})$/i);
|
|
2105
2554
|
if (hexMatch) {
|
|
@@ -2111,7 +2560,7 @@ function parseColor(input) {
|
|
|
2111
2560
|
if (rgb) {
|
|
2112
2561
|
r = rgb.r;
|
|
2113
2562
|
g = rgb.g;
|
|
2114
|
-
|
|
2563
|
+
b3 = rgb.b;
|
|
2115
2564
|
} else {
|
|
2116
2565
|
return { error: "Invalid hex color" };
|
|
2117
2566
|
}
|
|
@@ -2120,24 +2569,24 @@ function parseColor(input) {
|
|
|
2120
2569
|
if (rgbMatch) {
|
|
2121
2570
|
r = Math.min(255, parseInt(rgbMatch[1]));
|
|
2122
2571
|
g = Math.min(255, parseInt(rgbMatch[2]));
|
|
2123
|
-
|
|
2572
|
+
b3 = Math.min(255, parseInt(rgbMatch[3]));
|
|
2124
2573
|
} else {
|
|
2125
2574
|
const nums = input.split(/[\s,]+/).map((n) => parseInt(n)).filter((n) => !isNaN(n));
|
|
2126
2575
|
if (nums.length === 3) {
|
|
2127
2576
|
r = Math.min(255, nums[0]);
|
|
2128
2577
|
g = Math.min(255, nums[1]);
|
|
2129
|
-
|
|
2578
|
+
b3 = Math.min(255, nums[2]);
|
|
2130
2579
|
} else {
|
|
2131
2580
|
return { error: "Could not parse color" };
|
|
2132
2581
|
}
|
|
2133
2582
|
}
|
|
2134
2583
|
}
|
|
2135
2584
|
}
|
|
2136
|
-
const hex = rgbToHex(r, g,
|
|
2137
|
-
const hsl = rgbToHsl(r, g,
|
|
2138
|
-
const luminance = getLuminance(r, g,
|
|
2585
|
+
const hex = rgbToHex(r, g, b3);
|
|
2586
|
+
const hsl = rgbToHsl(r, g, b3);
|
|
2587
|
+
const luminance = getLuminance(r, g, b3);
|
|
2139
2588
|
return {
|
|
2140
|
-
rgb: { r, g, b },
|
|
2589
|
+
rgb: { r, g, b: b3 },
|
|
2141
2590
|
hex,
|
|
2142
2591
|
hsl,
|
|
2143
2592
|
luminance,
|
|
@@ -2194,7 +2643,7 @@ registerCommand({
|
|
|
2194
2643
|
console.log("");
|
|
2195
2644
|
console.log(` ${symbols.palette} ${theme.gradient("COLOR CONVERTER")} ${symbols.palette}`);
|
|
2196
2645
|
console.log("");
|
|
2197
|
-
const colorBlock =
|
|
2646
|
+
const colorBlock = chalk4.bgHex(hex).hex(textColor);
|
|
2198
2647
|
console.log(` ${colorBlock(" ")}`);
|
|
2199
2648
|
console.log(` ${colorBlock(" ")}`);
|
|
2200
2649
|
console.log(` ${colorBlock(` ${hex.toUpperCase()} `.slice(0, 40))}`);
|
|
@@ -2209,14 +2658,14 @@ registerCommand({
|
|
|
2209
2658
|
let shadesLine = " ";
|
|
2210
2659
|
const shades = generateShades(rgb);
|
|
2211
2660
|
for (const shade of shades) {
|
|
2212
|
-
shadesLine +=
|
|
2661
|
+
shadesLine += chalk4.bgRgb(shade.r, shade.g, shade.b)(" ");
|
|
2213
2662
|
}
|
|
2214
2663
|
console.log(shadesLine);
|
|
2215
2664
|
console.log(` ${theme.dim("Tints:")}`);
|
|
2216
2665
|
let tintsLine = " ";
|
|
2217
2666
|
const tints = generateTints(rgb);
|
|
2218
2667
|
for (const tint of tints) {
|
|
2219
|
-
tintsLine +=
|
|
2668
|
+
tintsLine += chalk4.bgRgb(tint.r, tint.g, tint.b)(" ");
|
|
2220
2669
|
}
|
|
2221
2670
|
console.log(tintsLine);
|
|
2222
2671
|
console.log("");
|
|
@@ -2459,7 +2908,7 @@ import { exec, execSync, spawn } from "child_process";
|
|
|
2459
2908
|
import { existsSync as existsSync4, statSync, readFileSync as readFileSync3, readdirSync, writeFileSync as writeFileSync3, watchFile, unwatchFile } from "fs";
|
|
2460
2909
|
import { resolve as resolve2, extname, basename, join as join3 } from "path";
|
|
2461
2910
|
import { homedir as homedir3, platform as platform2, networkInterfaces } from "os";
|
|
2462
|
-
import
|
|
2911
|
+
import chalk5 from "chalk";
|
|
2463
2912
|
var isWindows = platform2() === "win32";
|
|
2464
2913
|
function translateCommand(cmd) {
|
|
2465
2914
|
if (!isWindows) return cmd;
|
|
@@ -2524,19 +2973,19 @@ function handleCd(args2) {
|
|
|
2524
2973
|
targetPath = resolve2(process.cwd(), targetPath);
|
|
2525
2974
|
}
|
|
2526
2975
|
if (!existsSync4(targetPath)) {
|
|
2527
|
-
console.log(theme.error(`Directory not found: ${targetPath}`));
|
|
2976
|
+
console.log(`${miniSlime.sad} ${theme.error(`Directory not found: ${targetPath}`)}`);
|
|
2528
2977
|
return;
|
|
2529
2978
|
}
|
|
2530
2979
|
try {
|
|
2531
2980
|
const stats = statSync(targetPath);
|
|
2532
2981
|
if (!stats.isDirectory()) {
|
|
2533
|
-
console.log(theme.error(`Not a directory: ${targetPath}`));
|
|
2982
|
+
console.log(`${miniSlime.sad} ${theme.error(`Not a directory: ${targetPath}`)}`);
|
|
2534
2983
|
return;
|
|
2535
2984
|
}
|
|
2536
2985
|
process.chdir(targetPath);
|
|
2537
2986
|
console.log(theme.dim(process.cwd()));
|
|
2538
2987
|
} catch (error) {
|
|
2539
|
-
console.log(theme.error(`Cannot access: ${targetPath}`));
|
|
2988
|
+
console.log(`${miniSlime.sad} ${theme.error(`Cannot access: ${targetPath}`)}`);
|
|
2540
2989
|
}
|
|
2541
2990
|
}
|
|
2542
2991
|
function handlePwd() {
|
|
@@ -2545,7 +2994,7 @@ function handlePwd() {
|
|
|
2545
2994
|
function handleCat(args2) {
|
|
2546
2995
|
const filePath = resolve2(process.cwd(), args2.trim());
|
|
2547
2996
|
if (!existsSync4(filePath)) {
|
|
2548
|
-
console.log(theme.error(`File not found: ${args2}`));
|
|
2997
|
+
console.log(`${miniSlime.sad} ${theme.error(`File not found: ${args2}`)}`);
|
|
2549
2998
|
return;
|
|
2550
2999
|
}
|
|
2551
3000
|
try {
|
|
@@ -2557,7 +3006,7 @@ function handleCat(args2) {
|
|
|
2557
3006
|
console.log(content);
|
|
2558
3007
|
}
|
|
2559
3008
|
} catch (error) {
|
|
2560
|
-
console.log(theme.error(`Cannot read file: ${args2}`));
|
|
3009
|
+
console.log(`${miniSlime.sad} ${theme.error(`Cannot read file: ${args2}`)}`);
|
|
2561
3010
|
}
|
|
2562
3011
|
}
|
|
2563
3012
|
function highlightSyntax(content, ext) {
|
|
@@ -2567,12 +3016,12 @@ function highlightSyntax(content, ext) {
|
|
|
2567
3016
|
};
|
|
2568
3017
|
const kw = ext === ".py" ? keywords.py : keywords.js;
|
|
2569
3018
|
return content.split("\n").map((line) => {
|
|
2570
|
-
line = line.replace(/(["'`])(?:(?!\1)[^\\]|\\.)*?\1/g, (match) =>
|
|
2571
|
-
line = line.replace(/(\/\/.*$|#.*$)/g, (match) =>
|
|
2572
|
-
line = line.replace(/\b(\d+\.?\d*)\b/g, (match) =>
|
|
3019
|
+
line = line.replace(/(["'`])(?:(?!\1)[^\\]|\\.)*?\1/g, (match) => chalk5.hex("#98C379")(match));
|
|
3020
|
+
line = line.replace(/(\/\/.*$|#.*$)/g, (match) => chalk5.hex("#5C6370")(match));
|
|
3021
|
+
line = line.replace(/\b(\d+\.?\d*)\b/g, (match) => chalk5.hex("#D19A66")(match));
|
|
2573
3022
|
kw.forEach((keyword) => {
|
|
2574
3023
|
const regex = new RegExp(`\\b(${keyword})\\b`, "g");
|
|
2575
|
-
line = line.replace(regex,
|
|
3024
|
+
line = line.replace(regex, chalk5.hex("#C678DD")(keyword));
|
|
2576
3025
|
});
|
|
2577
3026
|
return line;
|
|
2578
3027
|
}).join("\n");
|
|
@@ -2637,11 +3086,11 @@ var fileIcons = {
|
|
|
2637
3086
|
"default": { icon: "\u{1F4C4}", color: "#6C7A89" }
|
|
2638
3087
|
};
|
|
2639
3088
|
function formatSize(bytes) {
|
|
2640
|
-
if (bytes === 0) return
|
|
3089
|
+
if (bytes === 0) return chalk5.dim(" 0 B");
|
|
2641
3090
|
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
2642
3091
|
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
2643
3092
|
const size = (bytes / Math.pow(1024, i)).toFixed(i > 0 ? 1 : 0);
|
|
2644
|
-
return
|
|
3093
|
+
return chalk5.hex("#98C379")(size.padStart(5) + " " + units[i].padEnd(2));
|
|
2645
3094
|
}
|
|
2646
3095
|
function handleLs(args2) {
|
|
2647
3096
|
const parts = args2.trim().split(/\s+/).filter(Boolean);
|
|
@@ -2664,10 +3113,10 @@ function handleLs(args2) {
|
|
|
2664
3113
|
console.log("");
|
|
2665
3114
|
return;
|
|
2666
3115
|
}
|
|
2667
|
-
const sorted = filtered.sort((a,
|
|
2668
|
-
if (a.isDirectory() && !
|
|
2669
|
-
if (!a.isDirectory() &&
|
|
2670
|
-
return a.name.localeCompare(
|
|
3116
|
+
const sorted = filtered.sort((a, b3) => {
|
|
3117
|
+
if (a.isDirectory() && !b3.isDirectory()) return -1;
|
|
3118
|
+
if (!a.isDirectory() && b3.isDirectory()) return 1;
|
|
3119
|
+
return a.name.localeCompare(b3.name);
|
|
2671
3120
|
});
|
|
2672
3121
|
for (const entry of sorted) {
|
|
2673
3122
|
const fullPath = resolve2(targetPath, entry.name);
|
|
@@ -2678,14 +3127,14 @@ function handleLs(args2) {
|
|
|
2678
3127
|
if (showLong) {
|
|
2679
3128
|
try {
|
|
2680
3129
|
const stats = statSync(fullPath);
|
|
2681
|
-
const size = isDir ?
|
|
3130
|
+
const size = isDir ? chalk5.dim(" <DIR>") : formatSize(stats.size);
|
|
2682
3131
|
const date = stats.mtime.toLocaleDateString("en-US", { month: "short", day: "2-digit", year: "numeric" });
|
|
2683
|
-
line +=
|
|
3132
|
+
line += chalk5.dim(date.padEnd(13)) + size + " ";
|
|
2684
3133
|
} catch {
|
|
2685
|
-
line +=
|
|
3134
|
+
line += chalk5.dim(" ") + " ";
|
|
2686
3135
|
}
|
|
2687
3136
|
}
|
|
2688
|
-
const name = isDir ?
|
|
3137
|
+
const name = isDir ? chalk5.hex(iconInfo.color).bold(entry.name + "/") : chalk5.hex(iconInfo.color)(entry.name);
|
|
2689
3138
|
line += name;
|
|
2690
3139
|
console.log(line);
|
|
2691
3140
|
}
|
|
@@ -2711,10 +3160,10 @@ function handleTree(args2, maxDepth = 3) {
|
|
|
2711
3160
|
function printTree(dir, prefix, depth) {
|
|
2712
3161
|
if (depth > maxDepth) return;
|
|
2713
3162
|
try {
|
|
2714
|
-
const entries = readdirSync(dir, { withFileTypes: true }).filter((e) => !e.name.startsWith(".") && !["node_modules", ".git", "dist", "build"].includes(e.name)).sort((a,
|
|
2715
|
-
if (a.isDirectory() && !
|
|
2716
|
-
if (!a.isDirectory() &&
|
|
2717
|
-
return a.name.localeCompare(
|
|
3163
|
+
const entries = readdirSync(dir, { withFileTypes: true }).filter((e) => !e.name.startsWith(".") && !["node_modules", ".git", "dist", "build"].includes(e.name)).sort((a, b3) => {
|
|
3164
|
+
if (a.isDirectory() && !b3.isDirectory()) return -1;
|
|
3165
|
+
if (!a.isDirectory() && b3.isDirectory()) return 1;
|
|
3166
|
+
return a.name.localeCompare(b3.name);
|
|
2718
3167
|
});
|
|
2719
3168
|
entries.forEach((entry, index) => {
|
|
2720
3169
|
const isLast = index === entries.length - 1;
|
|
@@ -2723,11 +3172,11 @@ function handleTree(args2, maxDepth = 3) {
|
|
|
2723
3172
|
const iconInfo = fileIcons[ext] || fileIcons["default"];
|
|
2724
3173
|
if (entry.isDirectory()) {
|
|
2725
3174
|
dirCount++;
|
|
2726
|
-
console.log(theme.dim(prefix + connector) + iconInfo.icon + " " +
|
|
3175
|
+
console.log(theme.dim(prefix + connector) + iconInfo.icon + " " + chalk5.hex(iconInfo.color).bold(entry.name + "/"));
|
|
2727
3176
|
printTree(resolve2(dir, entry.name), prefix + (isLast ? " " : "\u2502 "), depth + 1);
|
|
2728
3177
|
} else {
|
|
2729
3178
|
fileCount++;
|
|
2730
|
-
console.log(theme.dim(prefix + connector) + iconInfo.icon + " " +
|
|
3179
|
+
console.log(theme.dim(prefix + connector) + iconInfo.icon + " " + chalk5.hex(iconInfo.color)(entry.name));
|
|
2731
3180
|
}
|
|
2732
3181
|
});
|
|
2733
3182
|
} catch {
|
|
@@ -2761,38 +3210,38 @@ function handleBookmark(args2) {
|
|
|
2761
3210
|
case "save":
|
|
2762
3211
|
case "add":
|
|
2763
3212
|
if (!name) {
|
|
2764
|
-
console.log(theme.error("
|
|
3213
|
+
console.log(` ${miniSlime.thinking} ${theme.error("Usage: bookmark save <name>")}`);
|
|
2765
3214
|
break;
|
|
2766
3215
|
}
|
|
2767
3216
|
bookmarks[name] = process.cwd();
|
|
2768
3217
|
saveBookmarks(bookmarks);
|
|
2769
|
-
console.log(` ${
|
|
3218
|
+
console.log(` ${miniSlime.happy} ${theme.success("Saved bookmark:")} ${theme.primary(name)} ${theme.dim("\u2192")} ${process.cwd()}`);
|
|
2770
3219
|
break;
|
|
2771
3220
|
case "go":
|
|
2772
3221
|
case "cd":
|
|
2773
3222
|
if (!name || !bookmarks[name]) {
|
|
2774
|
-
console.log(theme.error(`
|
|
3223
|
+
console.log(` ${miniSlime.sad} ${theme.error(`Bookmark not found: ${name}`)}`);
|
|
2775
3224
|
console.log(theme.dim(' Use "bookmark list" to see all bookmarks'));
|
|
2776
3225
|
break;
|
|
2777
3226
|
}
|
|
2778
3227
|
try {
|
|
2779
3228
|
process.chdir(bookmarks[name]);
|
|
2780
|
-
console.log(` ${
|
|
3229
|
+
console.log(` ${miniSlime.excited} ${theme.dim("Jumped to")} ${theme.primary(name)}`);
|
|
2781
3230
|
console.log(` ${theme.dim(process.cwd())}`);
|
|
2782
3231
|
} catch {
|
|
2783
|
-
console.log(theme.error(`
|
|
3232
|
+
console.log(` ${miniSlime.sad} ${theme.error(`Cannot access: ${bookmarks[name]}`)}`);
|
|
2784
3233
|
}
|
|
2785
3234
|
break;
|
|
2786
3235
|
case "del":
|
|
2787
3236
|
case "delete":
|
|
2788
3237
|
case "rm":
|
|
2789
3238
|
if (!name || !bookmarks[name]) {
|
|
2790
|
-
console.log(theme.error(`
|
|
3239
|
+
console.log(` ${miniSlime.sad} ${theme.error(`Bookmark not found: ${name}`)}`);
|
|
2791
3240
|
break;
|
|
2792
3241
|
}
|
|
2793
3242
|
delete bookmarks[name];
|
|
2794
3243
|
saveBookmarks(bookmarks);
|
|
2795
|
-
console.log(` ${
|
|
3244
|
+
console.log(` ${miniSlime.happy} ${theme.success("Deleted bookmark:")} ${theme.primary(name)}`);
|
|
2796
3245
|
break;
|
|
2797
3246
|
case "list":
|
|
2798
3247
|
case "ls":
|
|
@@ -2851,7 +3300,7 @@ function handleFind(args2) {
|
|
|
2851
3300
|
const iconInfo = fileIcons[ext] || fileIcons["default"];
|
|
2852
3301
|
const fileName = basename(result.path);
|
|
2853
3302
|
const dirPath = relativePath.slice(0, -fileName.length);
|
|
2854
|
-
console.log(` ${iconInfo.icon} ${theme.dim(dirPath)}${
|
|
3303
|
+
console.log(` ${iconInfo.icon} ${theme.dim(dirPath)}${chalk5.hex(iconInfo.color)(fileName)}${result.isDir ? "/" : ""}`);
|
|
2855
3304
|
}
|
|
2856
3305
|
if (results.length >= maxResults) {
|
|
2857
3306
|
console.log("");
|
|
@@ -2896,7 +3345,7 @@ function handleDu(args2) {
|
|
|
2896
3345
|
return;
|
|
2897
3346
|
}
|
|
2898
3347
|
process.stdout.write("\x1B[1A\x1B[2K");
|
|
2899
|
-
items.sort((a,
|
|
3348
|
+
items.sort((a, b3) => b3.size - a.size);
|
|
2900
3349
|
const totalSize = items.reduce((sum, item) => sum + item.size, 0);
|
|
2901
3350
|
console.log("");
|
|
2902
3351
|
console.log(theme.primary(` \u{1F4CA} Disk Usage: ${basename(targetPath)}`));
|
|
@@ -2913,10 +3362,10 @@ function handleDu(args2) {
|
|
|
2913
3362
|
const percent = totalSize > 0 ? item.size / totalSize * 100 : 0;
|
|
2914
3363
|
const barWidth = 20;
|
|
2915
3364
|
const filled = Math.round(percent / 100 * barWidth);
|
|
2916
|
-
const bar =
|
|
3365
|
+
const bar = chalk5.hex("#4ECDC4")("\u2588".repeat(filled)) + chalk5.dim("\u2591".repeat(barWidth - filled));
|
|
2917
3366
|
const icon = item.isDir ? "\u{1F4C1}" : "\u{1F4C4}";
|
|
2918
3367
|
const name = item.name.length > 25 ? item.name.slice(0, 22) + "..." : item.name.padEnd(25);
|
|
2919
|
-
console.log(` ${icon} ${name} ${bar} ${formatSizeSimple(item.size).padStart(8)} ${
|
|
3368
|
+
console.log(` ${icon} ${name} ${bar} ${formatSizeSimple(item.size).padStart(8)} ${chalk5.dim(`${percent.toFixed(1)}%`)}`);
|
|
2920
3369
|
}
|
|
2921
3370
|
if (items.length > maxItems) {
|
|
2922
3371
|
console.log(theme.dim(` ... and ${items.length - maxItems} more items`));
|
|
@@ -2970,7 +3419,7 @@ function handleGit(args2) {
|
|
|
2970
3419
|
case "status":
|
|
2971
3420
|
case "s": {
|
|
2972
3421
|
const branch = execSync("git branch --show-current", { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
2973
|
-
console.log(` ${symbols.rocket} ${theme.primary("Branch:")} ${
|
|
3422
|
+
console.log(` ${symbols.rocket} ${theme.primary("Branch:")} ${chalk5.hex("#98C379")(branch)}`);
|
|
2974
3423
|
console.log("");
|
|
2975
3424
|
const status = execSync("git status --porcelain", { encoding: "utf-8", timeout: 5e3 });
|
|
2976
3425
|
if (!status.trim()) {
|
|
@@ -2995,12 +3444,12 @@ function handleGit(args2) {
|
|
|
2995
3444
|
}
|
|
2996
3445
|
if (staged.length > 0) {
|
|
2997
3446
|
console.log(theme.success(" Staged changes:"));
|
|
2998
|
-
staged.forEach((f) => console.log(` ${symbols.check} ${
|
|
3447
|
+
staged.forEach((f) => console.log(` ${symbols.check} ${chalk5.hex("#98C379")(f)}`));
|
|
2999
3448
|
console.log("");
|
|
3000
3449
|
}
|
|
3001
3450
|
if (modified.length > 0) {
|
|
3002
3451
|
console.log(theme.warning(" Modified:"));
|
|
3003
|
-
modified.forEach((f) => console.log(` ${symbols.bullet} ${
|
|
3452
|
+
modified.forEach((f) => console.log(` ${symbols.bullet} ${chalk5.hex("#E5C07B")(f)}`));
|
|
3004
3453
|
console.log("");
|
|
3005
3454
|
}
|
|
3006
3455
|
if (untracked.length > 0) {
|
|
@@ -3014,7 +3463,7 @@ function handleGit(args2) {
|
|
|
3014
3463
|
console.log(theme.dim(" Recent commits:"));
|
|
3015
3464
|
log.split("\n").forEach((line) => {
|
|
3016
3465
|
const [hash, ...msg] = line.split(" ");
|
|
3017
|
-
console.log(` ${
|
|
3466
|
+
console.log(` ${chalk5.hex("#61AFEF")(hash)} ${theme.dim(msg.join(" "))}`);
|
|
3018
3467
|
});
|
|
3019
3468
|
}
|
|
3020
3469
|
break;
|
|
@@ -3026,7 +3475,7 @@ function handleGit(args2) {
|
|
|
3026
3475
|
console.log("");
|
|
3027
3476
|
log.split("\n").forEach((line) => {
|
|
3028
3477
|
const [hash, ...msg] = line.split(" ");
|
|
3029
|
-
console.log(` ${
|
|
3478
|
+
console.log(` ${chalk5.hex("#61AFEF")(hash)} ${msg.join(" ")}`);
|
|
3030
3479
|
});
|
|
3031
3480
|
break;
|
|
3032
3481
|
}
|
|
@@ -3037,7 +3486,7 @@ function handleGit(args2) {
|
|
|
3037
3486
|
console.log("");
|
|
3038
3487
|
branches.split("\n").forEach((line) => {
|
|
3039
3488
|
if (line.startsWith("*")) {
|
|
3040
|
-
console.log(` ${
|
|
3489
|
+
console.log(` ${chalk5.hex("#98C379")(line)}`);
|
|
3041
3490
|
} else {
|
|
3042
3491
|
console.log(` ${theme.dim(line)}`);
|
|
3043
3492
|
}
|
|
@@ -3166,7 +3615,7 @@ function handlePretty(args2) {
|
|
|
3166
3615
|
console.log("");
|
|
3167
3616
|
}
|
|
3168
3617
|
function highlightJson(json) {
|
|
3169
|
-
return json.replace(/"([^"]+)":/g, (_, key) =>
|
|
3618
|
+
return json.replace(/"([^"]+)":/g, (_, key) => chalk5.hex("#E06C75")(`"${key}"`) + ":").replace(/: "([^"]*)"/g, (_, val) => ": " + chalk5.hex("#98C379")(`"${val}"`)).replace(/: (\d+)/g, (_, num) => ": " + chalk5.hex("#D19A66")(num)).replace(/: (true|false)/g, (_, bool) => ": " + chalk5.hex("#56B6C2")(bool)).replace(/: (null)/g, (_, n) => ": " + chalk5.hex("#C678DD")(n));
|
|
3170
3619
|
}
|
|
3171
3620
|
var activeWatcher = null;
|
|
3172
3621
|
function handleWatch(args2) {
|
|
@@ -3239,7 +3688,7 @@ function handleWatch(args2) {
|
|
|
3239
3688
|
const oldLines = Math.floor(prev.size / 50);
|
|
3240
3689
|
const newLines = allLines.slice(-Math.max(1, allLines.length - oldLines));
|
|
3241
3690
|
newLines.forEach((line) => {
|
|
3242
|
-
if (line.trim()) console.log(
|
|
3691
|
+
if (line.trim()) console.log(chalk5.hex("#98C379")(line));
|
|
3243
3692
|
});
|
|
3244
3693
|
} catch {
|
|
3245
3694
|
}
|
|
@@ -3252,7 +3701,7 @@ function handleServe(args2) {
|
|
|
3252
3701
|
console.log("");
|
|
3253
3702
|
console.log(` ${symbols.rocket} ${theme.primary("Starting HTTP server...")}`);
|
|
3254
3703
|
console.log(` ${theme.dim("Serving:")} ${process.cwd()}`);
|
|
3255
|
-
console.log(` ${theme.dim("URL:")} ${
|
|
3704
|
+
console.log(` ${theme.dim("URL:")} ${chalk5.hex("#61AFEF")(`http://localhost:${port}`)}`);
|
|
3256
3705
|
console.log("");
|
|
3257
3706
|
console.log(theme.dim(" Press Ctrl+C to stop"));
|
|
3258
3707
|
console.log("");
|
|
@@ -3283,7 +3732,7 @@ function handlePs() {
|
|
|
3283
3732
|
const name = parts[0].slice(0, 28).padEnd(30);
|
|
3284
3733
|
const pid = parts[1].padStart(8);
|
|
3285
3734
|
const mem = parts[4];
|
|
3286
|
-
console.log(` ${name}${pid} ${
|
|
3735
|
+
console.log(` ${name}${pid} ${chalk5.hex("#98C379")(mem)}`);
|
|
3287
3736
|
}
|
|
3288
3737
|
});
|
|
3289
3738
|
} else {
|
|
@@ -3310,7 +3759,7 @@ function handleEnv(args2) {
|
|
|
3310
3759
|
filtered.slice(0, maxShow).forEach((key) => {
|
|
3311
3760
|
const value = env[key] || "";
|
|
3312
3761
|
const displayValue = value.length > 50 ? value.slice(0, 47) + "..." : value;
|
|
3313
|
-
console.log(` ${
|
|
3762
|
+
console.log(` ${chalk5.hex("#E06C75")(key.padEnd(25))} ${theme.dim("=")} ${displayValue}`);
|
|
3314
3763
|
});
|
|
3315
3764
|
if (filtered.length > maxShow) {
|
|
3316
3765
|
console.log(theme.dim(` ... and ${filtered.length - maxShow} more`));
|
|
@@ -3339,7 +3788,7 @@ function handleIp() {
|
|
|
3339
3788
|
if (localIps.length === 0) {
|
|
3340
3789
|
console.log(` ${theme.dim("(No network interfaces found)")}`);
|
|
3341
3790
|
} else {
|
|
3342
|
-
localIps.forEach((ip) => console.log(` ${
|
|
3791
|
+
localIps.forEach((ip) => console.log(` ${chalk5.hex("#98C379")(ip)}`));
|
|
3343
3792
|
}
|
|
3344
3793
|
console.log("");
|
|
3345
3794
|
console.log(theme.dim(" Public IP:"));
|
|
@@ -3354,7 +3803,7 @@ function handleIp() {
|
|
|
3354
3803
|
throw new Error("curl not available");
|
|
3355
3804
|
}
|
|
3356
3805
|
}
|
|
3357
|
-
console.log(` ${
|
|
3806
|
+
console.log(` ${chalk5.hex("#61AFEF")(result)}`);
|
|
3358
3807
|
} catch {
|
|
3359
3808
|
console.log(` ${theme.dim("(Could not fetch - requires curl or internet)")}`);
|
|
3360
3809
|
}
|
|
@@ -3371,21 +3820,21 @@ function handleEpoch(args2) {
|
|
|
3371
3820
|
if (!input || input === "now") {
|
|
3372
3821
|
const now = /* @__PURE__ */ new Date();
|
|
3373
3822
|
console.log(` ${theme.dim("Current Time:")}`);
|
|
3374
|
-
console.log(` ${
|
|
3375
|
-
console.log(` ${
|
|
3376
|
-
console.log(` ${
|
|
3823
|
+
console.log(` ${chalk5.hex("#98C379")(now.toISOString())}`);
|
|
3824
|
+
console.log(` ${chalk5.hex("#61AFEF")(Math.floor(now.getTime() / 1e3).toString())} ${theme.dim("(Unix seconds)")}`);
|
|
3825
|
+
console.log(` ${chalk5.hex("#E5C07B")(now.getTime().toString())} ${theme.dim("(Unix milliseconds)")}`);
|
|
3377
3826
|
} else if (/^\d{10,13}$/.test(input)) {
|
|
3378
3827
|
const ms = input.length === 10 ? parseInt(input) * 1e3 : parseInt(input);
|
|
3379
3828
|
const date = new Date(ms);
|
|
3380
|
-
console.log(` ${theme.dim("Epoch:")} ${
|
|
3381
|
-
console.log(` ${theme.dim("Date:")} ${
|
|
3382
|
-
console.log(` ${
|
|
3829
|
+
console.log(` ${theme.dim("Epoch:")} ${chalk5.hex("#E5C07B")(input)}`);
|
|
3830
|
+
console.log(` ${theme.dim("Date:")} ${chalk5.hex("#98C379")(date.toISOString())}`);
|
|
3831
|
+
console.log(` ${chalk5.hex("#98C379")(date.toLocaleString())}`);
|
|
3383
3832
|
} else {
|
|
3384
3833
|
const date = new Date(input);
|
|
3385
3834
|
if (!isNaN(date.getTime())) {
|
|
3386
|
-
console.log(` ${theme.dim("Date:")} ${
|
|
3387
|
-
console.log(` ${theme.dim("Unix:")} ${
|
|
3388
|
-
console.log(` ${
|
|
3835
|
+
console.log(` ${theme.dim("Date:")} ${chalk5.hex("#98C379")(input)}`);
|
|
3836
|
+
console.log(` ${theme.dim("Unix:")} ${chalk5.hex("#61AFEF")(Math.floor(date.getTime() / 1e3).toString())} ${theme.dim("(seconds)")}`);
|
|
3837
|
+
console.log(` ${chalk5.hex("#E5C07B")(date.getTime().toString())} ${theme.dim("(milliseconds)")}`);
|
|
3389
3838
|
} else {
|
|
3390
3839
|
console.log(theme.error(` Cannot parse: ${input}`));
|
|
3391
3840
|
console.log(theme.dim(' Examples: epoch now, epoch 1703788800, epoch "2024-01-01"'));
|
|
@@ -3409,7 +3858,7 @@ async function handleHttp(args2) {
|
|
|
3409
3858
|
return;
|
|
3410
3859
|
}
|
|
3411
3860
|
const fullUrl = url.startsWith("http") ? url : `https://${url}`;
|
|
3412
|
-
console.log(` ${symbols.rocket} ${theme.dim(method)} ${
|
|
3861
|
+
console.log(` ${symbols.rocket} ${theme.dim(method)} ${chalk5.hex("#61AFEF")(fullUrl)}`);
|
|
3413
3862
|
console.log("");
|
|
3414
3863
|
try {
|
|
3415
3864
|
let result;
|
|
@@ -3483,8 +3932,8 @@ function handleDiff(args2) {
|
|
|
3483
3932
|
const line2 = content2[i] || "";
|
|
3484
3933
|
if (line1 !== line2) {
|
|
3485
3934
|
differences++;
|
|
3486
|
-
console.log(
|
|
3487
|
-
console.log(
|
|
3935
|
+
console.log(chalk5.hex("#E06C75")(` - ${(i + 1).toString().padStart(4)}: ${line1.slice(0, 70)}`));
|
|
3936
|
+
console.log(chalk5.hex("#98C379")(` + ${(i + 1).toString().padStart(4)}: ${line2.slice(0, 70)}`));
|
|
3488
3937
|
console.log("");
|
|
3489
3938
|
}
|
|
3490
3939
|
}
|
|
@@ -3661,9 +4110,9 @@ function handleGrep(args2) {
|
|
|
3661
4110
|
for (const result of results) {
|
|
3662
4111
|
const highlightedContent = result.content.replace(
|
|
3663
4112
|
regex,
|
|
3664
|
-
(match) =>
|
|
4113
|
+
(match) => chalk5.hex("#FF6B6B").bold(match)
|
|
3665
4114
|
);
|
|
3666
|
-
console.log(` ${theme.dim(result.file)}:${
|
|
4115
|
+
console.log(` ${theme.dim(result.file)}:${chalk5.hex("#61AFEF")(result.line)}`);
|
|
3667
4116
|
console.log(` ${highlightedContent}`);
|
|
3668
4117
|
console.log("");
|
|
3669
4118
|
}
|
|
@@ -3694,10 +4143,10 @@ function handleWc(args2) {
|
|
|
3694
4143
|
const bytes = Buffer.byteLength(content, "utf-8");
|
|
3695
4144
|
console.log(theme.primary(` \u{1F4CA} ${basename(args2)}`));
|
|
3696
4145
|
console.log("");
|
|
3697
|
-
console.log(` ${
|
|
3698
|
-
console.log(` ${
|
|
3699
|
-
console.log(` ${
|
|
3700
|
-
console.log(` ${
|
|
4146
|
+
console.log(` ${chalk5.hex("#61AFEF")(lines.toLocaleString().padStart(8))} ${theme.dim("lines")}`);
|
|
4147
|
+
console.log(` ${chalk5.hex("#98C379")(words.toLocaleString().padStart(8))} ${theme.dim("words")}`);
|
|
4148
|
+
console.log(` ${chalk5.hex("#E5C07B")(chars.toLocaleString().padStart(8))} ${theme.dim("characters")}`);
|
|
4149
|
+
console.log(` ${chalk5.hex("#C678DD")(bytes.toLocaleString().padStart(8))} ${theme.dim("bytes")}`);
|
|
3701
4150
|
} catch {
|
|
3702
4151
|
console.log(theme.error(" Failed to read file"));
|
|
3703
4152
|
}
|
|
@@ -3729,7 +4178,7 @@ function handleHead(args2) {
|
|
|
3729
4178
|
console.log(theme.dim(` First ${lines} lines of ${basename(filePath)}:`));
|
|
3730
4179
|
console.log("");
|
|
3731
4180
|
fileLines.forEach((line, i) => {
|
|
3732
|
-
console.log(` ${
|
|
4181
|
+
console.log(` ${chalk5.dim((i + 1).toString().padStart(4))} ${line}`);
|
|
3733
4182
|
});
|
|
3734
4183
|
} catch {
|
|
3735
4184
|
console.log(theme.error(" Failed to read file"));
|
|
@@ -3761,8 +4210,9 @@ async function executeShellCommand(command) {
|
|
|
3761
4210
|
return;
|
|
3762
4211
|
}
|
|
3763
4212
|
if (cmd === "clear" || cmd === "cls") {
|
|
3764
|
-
|
|
3765
|
-
|
|
4213
|
+
process.stdout.write("\x1B[2J\x1B[3J\x1B[H");
|
|
4214
|
+
const isSimple = process.argv.includes("--simple") || !process.stdout.isTTY;
|
|
4215
|
+
await displayBanner(isSimple);
|
|
3766
4216
|
return;
|
|
3767
4217
|
}
|
|
3768
4218
|
if (cmd === "bookmark" || cmd === "bm") {
|
|
@@ -3875,6 +4325,29 @@ async function parseAndExecute(input) {
|
|
|
3875
4325
|
return;
|
|
3876
4326
|
}
|
|
3877
4327
|
if (!trimmed.startsWith("/")) {
|
|
4328
|
+
const detectedMood = getMoodFromText(trimmed);
|
|
4329
|
+
if (detectedMood) {
|
|
4330
|
+
console.log("");
|
|
4331
|
+
const responses = {
|
|
4332
|
+
love: ["Aww, you're sweet!", "Right back at ya!", "*happy wobble*"],
|
|
4333
|
+
excited: ["Yay! Let's gooo!", "Woohoo!", "*bounces excitedly*"],
|
|
4334
|
+
sleepy: ["*yawns* Same...", "Maybe take a break?", "zzZ..."],
|
|
4335
|
+
sad: ["Aww, it's okay!", "I'm here for you!", "*comforting wobble*"],
|
|
4336
|
+
angry: ["*hides nervously*", "Let's fix that!", "Deep breaths..."],
|
|
4337
|
+
thinking: ["Hmm indeed...", "Let me think too...", "*ponders*"]
|
|
4338
|
+
};
|
|
4339
|
+
const moodResponses = responses[detectedMood] || ["*wobbles*"];
|
|
4340
|
+
const response = moodResponses[Math.floor(Math.random() * moodResponses.length)];
|
|
4341
|
+
const isSimpleInput = trimmed.length < 20 && !/[{}\[\]();=<>]/.test(trimmed);
|
|
4342
|
+
if ((detectedMood === "love" || detectedMood === "excited") && isSimpleInput && Math.random() < 0.5) {
|
|
4343
|
+
showMascot(detectedMood);
|
|
4344
|
+
console.log(` ${theme.secondary(response)}`);
|
|
4345
|
+
} else {
|
|
4346
|
+
react(detectedMood, theme.secondary(response));
|
|
4347
|
+
}
|
|
4348
|
+
console.log("");
|
|
4349
|
+
return;
|
|
4350
|
+
}
|
|
3878
4351
|
console.log("");
|
|
3879
4352
|
console.log(` ${symbols.info} ${theme.dim("Commands start with")} ${theme.primary("/")} ${theme.dim("\u2022 Shell commands start with")} ${theme.primary("!")}`);
|
|
3880
4353
|
console.log(` ${theme.dim(" Type")} ${theme.primary("/help")} ${theme.dim("for available commands")}`);
|
|
@@ -3894,9 +4367,14 @@ async function parseAndExecute(input) {
|
|
|
3894
4367
|
}
|
|
3895
4368
|
try {
|
|
3896
4369
|
await command.execute(args2);
|
|
4370
|
+
if (Math.random() < 0.15) {
|
|
4371
|
+
const successMoods = ["happy", "excited", "wink"];
|
|
4372
|
+
const mood = successMoods[Math.floor(Math.random() * successMoods.length)];
|
|
4373
|
+
react(mood);
|
|
4374
|
+
}
|
|
3897
4375
|
} catch (error) {
|
|
3898
4376
|
console.log("");
|
|
3899
|
-
|
|
4377
|
+
react("sad", theme.error(`Error: ${String(error)}`));
|
|
3900
4378
|
console.log("");
|
|
3901
4379
|
}
|
|
3902
4380
|
}
|
|
@@ -3905,6 +4383,87 @@ async function parseAndExecute(input) {
|
|
|
3905
4383
|
import { readdirSync as readdirSync2, readFileSync as readFileSync4 } from "fs";
|
|
3906
4384
|
import { fileURLToPath } from "url";
|
|
3907
4385
|
import { dirname, join as join4 } from "path";
|
|
4386
|
+
import chalk6 from "chalk";
|
|
4387
|
+
var SLIME_COLOR = "#9B59B6";
|
|
4388
|
+
var EYE_COLOR = "#1A1A2E";
|
|
4389
|
+
var MIN_WIDTH_FOR_IDLE = 40;
|
|
4390
|
+
var MIN_WIDTH_FOR_MENU = 50;
|
|
4391
|
+
var miniSlimeFrames = [
|
|
4392
|
+
// Open eyes
|
|
4393
|
+
chalk6.hex(SLIME_COLOR)("(") + chalk6.hex(EYE_COLOR)("\u25CF") + chalk6.hex(SLIME_COLOR)("\u1D17") + chalk6.hex(EYE_COLOR)("\u25CF") + chalk6.hex(SLIME_COLOR)(")"),
|
|
4394
|
+
// Blink (closed eyes)
|
|
4395
|
+
chalk6.hex(SLIME_COLOR)("(") + chalk6.hex(EYE_COLOR)("\u2500") + chalk6.hex(SLIME_COLOR)("\u1D17") + chalk6.hex(EYE_COLOR)("\u2500") + chalk6.hex(SLIME_COLOR)(")")
|
|
4396
|
+
];
|
|
4397
|
+
var idleAnimationInterval = null;
|
|
4398
|
+
var isUserTyping = false;
|
|
4399
|
+
var lastActivityTime = Date.now();
|
|
4400
|
+
var lastRenderedFrame = -1;
|
|
4401
|
+
var slimeVisible = false;
|
|
4402
|
+
var lastTermWidth = process.stdout.columns || 80;
|
|
4403
|
+
var IDLE_DELAY = 3e3;
|
|
4404
|
+
var FRAME_INTERVAL = 2e3;
|
|
4405
|
+
var animationSequence = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0];
|
|
4406
|
+
var sequenceIndex = 0;
|
|
4407
|
+
function getAnimatedSlime() {
|
|
4408
|
+
const frameIndex = animationSequence[sequenceIndex % animationSequence.length];
|
|
4409
|
+
return { frame: miniSlimeFrames[frameIndex], index: frameIndex };
|
|
4410
|
+
}
|
|
4411
|
+
function updateIdleAnimation(rl) {
|
|
4412
|
+
const termWidth = process.stdout.columns || 80;
|
|
4413
|
+
if (isUserTyping || menu.visible || termWidth < MIN_WIDTH_FOR_IDLE) {
|
|
4414
|
+
if (slimeVisible) {
|
|
4415
|
+
clearIdleSlime(rl);
|
|
4416
|
+
}
|
|
4417
|
+
return;
|
|
4418
|
+
}
|
|
4419
|
+
const now = Date.now();
|
|
4420
|
+
if (now - lastActivityTime < IDLE_DELAY) return;
|
|
4421
|
+
const currentLine = rl.line || "";
|
|
4422
|
+
if (currentLine.length !== 0) return;
|
|
4423
|
+
sequenceIndex++;
|
|
4424
|
+
const { frame: slime, index: frameIndex } = getAnimatedSlime();
|
|
4425
|
+
if (frameIndex === lastRenderedFrame && slimeVisible) return;
|
|
4426
|
+
lastRenderedFrame = frameIndex;
|
|
4427
|
+
slimeVisible = true;
|
|
4428
|
+
const promptLen = getPromptLength();
|
|
4429
|
+
const slimePos = Math.max(promptLen + 3, termWidth - 12);
|
|
4430
|
+
process.stdout.write(
|
|
4431
|
+
`\x1B[?25l\x1B[${slimePos}G\x1B[K` + // Clear to end of line
|
|
4432
|
+
slime + // Draw slime
|
|
4433
|
+
`\x1B[${promptLen + 1}G\x1B[?25h`
|
|
4434
|
+
// Show cursor
|
|
4435
|
+
);
|
|
4436
|
+
}
|
|
4437
|
+
function startIdleAnimation(rl) {
|
|
4438
|
+
if (idleAnimationInterval) return;
|
|
4439
|
+
idleAnimationInterval = setInterval(() => {
|
|
4440
|
+
updateIdleAnimation(rl);
|
|
4441
|
+
}, FRAME_INTERVAL);
|
|
4442
|
+
}
|
|
4443
|
+
function stopIdleAnimation() {
|
|
4444
|
+
if (idleAnimationInterval) {
|
|
4445
|
+
clearInterval(idleAnimationInterval);
|
|
4446
|
+
idleAnimationInterval = null;
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
function clearIdleSlime(rl) {
|
|
4450
|
+
if (!slimeVisible) return;
|
|
4451
|
+
slimeVisible = false;
|
|
4452
|
+
lastRenderedFrame = -1;
|
|
4453
|
+
const termWidth = process.stdout.columns || 80;
|
|
4454
|
+
const slimePos = termWidth - 12;
|
|
4455
|
+
const promptLen = getPromptLength();
|
|
4456
|
+
const currentLine = rl ? rl.line || "" : "";
|
|
4457
|
+
const cursorPos = promptLen + currentLine.length + 1;
|
|
4458
|
+
process.stdout.write(
|
|
4459
|
+
`\x1B[?25l\x1B[${slimePos}G\x1B[K\x1B[${cursorPos}G\x1B[?25h`
|
|
4460
|
+
// Show cursor
|
|
4461
|
+
);
|
|
4462
|
+
}
|
|
4463
|
+
function setIdle() {
|
|
4464
|
+
isUserTyping = false;
|
|
4465
|
+
lastActivityTime = Date.now();
|
|
4466
|
+
}
|
|
3908
4467
|
var args = process.argv.slice(2);
|
|
3909
4468
|
if (args.includes("--version") || args.includes("-v")) {
|
|
3910
4469
|
try {
|
|
@@ -3920,14 +4479,15 @@ if (args.includes("--version") || args.includes("-v")) {
|
|
|
3920
4479
|
}
|
|
3921
4480
|
if (args.includes("--help") || args.includes("-h")) {
|
|
3922
4481
|
console.log(`
|
|
3923
|
-
zammy -
|
|
4482
|
+
zammy - A feature-packed CLI with utilities, dev tools, and a bit of fun
|
|
3924
4483
|
|
|
3925
4484
|
Usage: zammy [options]
|
|
3926
4485
|
|
|
3927
4486
|
Options:
|
|
3928
4487
|
-v, --version Show version number
|
|
3929
4488
|
-h, --help Show this help message
|
|
3930
|
-
--simple Force simple mode (no
|
|
4489
|
+
--simple Force simple mode (no animations)
|
|
4490
|
+
--no-menu Disable interactive command menu
|
|
3931
4491
|
|
|
3932
4492
|
Commands:
|
|
3933
4493
|
Start zammy and type / to see all available commands
|
|
@@ -3942,6 +4502,7 @@ Examples:
|
|
|
3942
4502
|
}
|
|
3943
4503
|
var isTTY = process.stdin.isTTY && process.stdout.isTTY;
|
|
3944
4504
|
var isSimpleMode = process.argv.includes("--simple") || !isTTY;
|
|
4505
|
+
var noMenu = process.argv.includes("--no-menu");
|
|
3945
4506
|
var IMAGE_EXTENSIONS = [".png", ".jpg", ".jpeg", ".gif", ".bmp", ".webp"];
|
|
3946
4507
|
var menu = {
|
|
3947
4508
|
visible: false,
|
|
@@ -4060,6 +4621,11 @@ function hideMenu(currentLine = "") {
|
|
|
4060
4621
|
menu.renderedLines = 0;
|
|
4061
4622
|
}
|
|
4062
4623
|
function showMenu(filter, prefix, currentLine) {
|
|
4624
|
+
const termWidth = process.stdout.columns || 80;
|
|
4625
|
+
if (termWidth < MIN_WIDTH_FOR_MENU) {
|
|
4626
|
+
if (menu.visible) hideMenu(currentLine);
|
|
4627
|
+
return;
|
|
4628
|
+
}
|
|
4063
4629
|
const allItems = prefix === "/" ? getFilteredCommands(filter) : getFilteredShellCommands(filter);
|
|
4064
4630
|
if (allItems.length === 0) {
|
|
4065
4631
|
if (menu.visible) hideMenu(currentLine);
|
|
@@ -4154,7 +4720,7 @@ async function main() {
|
|
|
4154
4720
|
console.log(theme.dim("Note: Running in simple mode (no TTY detected). Use Tab for autocomplete."));
|
|
4155
4721
|
console.log(theme.dim("For full features, run in a proper terminal or use: zammy --simple\n"));
|
|
4156
4722
|
}
|
|
4157
|
-
await displayBanner();
|
|
4723
|
+
await displayBanner(isSimpleMode);
|
|
4158
4724
|
const rl = readline.createInterface({
|
|
4159
4725
|
input: process.stdin,
|
|
4160
4726
|
output: process.stdout,
|
|
@@ -4163,8 +4729,29 @@ async function main() {
|
|
|
4163
4729
|
});
|
|
4164
4730
|
let prevLine = "";
|
|
4165
4731
|
if (isTTY && !isSimpleMode) {
|
|
4732
|
+
startIdleAnimation(rl);
|
|
4733
|
+
}
|
|
4734
|
+
if (isTTY) {
|
|
4735
|
+
process.stdout.on("resize", () => {
|
|
4736
|
+
const currentLine = rl.line || "";
|
|
4737
|
+
const newWidth = process.stdout.columns || 80;
|
|
4738
|
+
if (menu.visible) {
|
|
4739
|
+
hideMenu(currentLine);
|
|
4740
|
+
}
|
|
4741
|
+
if (slimeVisible) {
|
|
4742
|
+
clearIdleSlime(rl);
|
|
4743
|
+
}
|
|
4744
|
+
process.stdout.write("\r" + getPrompt() + currentLine);
|
|
4745
|
+
lastTermWidth = newWidth;
|
|
4746
|
+
});
|
|
4747
|
+
}
|
|
4748
|
+
if (isTTY && !noMenu) {
|
|
4166
4749
|
process.stdin.on("keypress", (_char, key) => {
|
|
4167
4750
|
if (!key) return;
|
|
4751
|
+
if (!isSimpleMode) {
|
|
4752
|
+
isUserTyping = true;
|
|
4753
|
+
lastActivityTime = Date.now();
|
|
4754
|
+
}
|
|
4168
4755
|
const currentLine = rl.line || "";
|
|
4169
4756
|
if (menu.visible) {
|
|
4170
4757
|
if (key.name === "up" || key.name === "down") {
|
|
@@ -4202,6 +4789,7 @@ async function main() {
|
|
|
4202
4789
|
const line = rl.line || "";
|
|
4203
4790
|
if (now - lastCtrlC < 500) {
|
|
4204
4791
|
hideMenu(line);
|
|
4792
|
+
stopIdleAnimation();
|
|
4205
4793
|
console.log("\n" + theme.secondary("Goodbye! See you next time.") + "\n");
|
|
4206
4794
|
process.exit(0);
|
|
4207
4795
|
} else {
|
|
@@ -4216,6 +4804,7 @@ async function main() {
|
|
|
4216
4804
|
hideMenu(input);
|
|
4217
4805
|
prevLine = "";
|
|
4218
4806
|
await parseAndExecute(input);
|
|
4807
|
+
if (!isSimpleMode) setIdle();
|
|
4219
4808
|
rl.prompt();
|
|
4220
4809
|
});
|
|
4221
4810
|
rl.prompt();
|