sharkcode 0.3.3 → 0.3.4

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +16 -3
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -511,6 +511,18 @@ async function showSetupFlow(multiConfig) {
511
511
  return { multiConfig, config: resolveConfig(multiConfig) };
512
512
  }
513
513
  }
514
+ function charDisplayWidth(ch) {
515
+ const cp = ch.codePointAt(0);
516
+ if (cp >= 4352 && cp <= 4447 || // Hangul Jamo
517
+ cp >= 11904 && cp <= 12350 || // CJK Radicals Supplement, Kangxi, etc.
518
+ cp >= 12353 && cp <= 13311 || // Hiragana, Katakana, CJK Symbols
519
+ cp >= 13312 && cp <= 40959 || // CJK Unified Ideographs (+ Ext A)
520
+ cp >= 44032 && cp <= 55215 || // Hangul Syllables
521
+ cp >= 63744 && cp <= 64255 || // CJK Compatibility Ideographs
522
+ cp >= 65281 && cp <= 65376 || // Fullwidth Latin / Punctuation
523
+ cp >= 65504 && cp <= 65510) return 2;
524
+ return 1;
525
+ }
514
526
  async function readLineRaw(promptStr) {
515
527
  process.stdout.write(promptStr);
516
528
  return new Promise((resolve4) => {
@@ -540,9 +552,10 @@ async function readLineRaw(promptStr) {
540
552
  if (code === 127 || code === 8) {
541
553
  if (buffer.length > 0) {
542
554
  const chars = [...buffer];
543
- chars.pop();
555
+ const removed = chars.pop();
544
556
  buffer = chars.join("");
545
- process.stdout.write("\b \b");
557
+ const w = charDisplayWidth(removed);
558
+ process.stdout.write("\b".repeat(w) + " ".repeat(w) + "\b".repeat(w));
546
559
  }
547
560
  continue;
548
561
  }
@@ -574,7 +587,7 @@ async function main() {
574
587
  return;
575
588
  }
576
589
  if (args[0] === "--version" || args[0] === "-v") {
577
- console.log("sharkcode v0.3.3");
590
+ console.log("sharkcode v0.3.4");
578
591
  return;
579
592
  }
580
593
  if (args.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sharkcode",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Local First, open-source AI Coding Agent",
5
5
  "type": "module",
6
6
  "bin": {