roguelike-cli 1.2.4 → 1.2.6

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 CHANGED
@@ -9,7 +9,7 @@
9
9
  .>' (_--.
10
10
  _=/d ,^\
11
11
  ~~ \)-' '
12
- / |
12
+ / | rlc
13
13
  ' '
14
14
 
15
15
  ╔═════════════════════════╗
@@ -330,16 +330,26 @@ async function processCommand(input, currentPath, config, signal, rl) {
330
330
  }
331
331
  return wrapResult({ output: treeLines.join('\n') });
332
332
  }
333
- // Handle navigation without 'cd' command (.., ...)
334
- if (command === '..' || command === '...') {
335
- let levels = command === '...' ? 2 : 1;
333
+ // Handle navigation without 'cd' command (.., ..., ...., etc)
334
+ if (/^\.{2,}$/.test(command)) {
335
+ // Count dots: .. = 1 level, ... = 2 levels, .... = 3 levels, etc
336
+ const levels = command.length - 1;
336
337
  let targetPath = currentPath;
338
+ // Already at root?
339
+ if (targetPath === config.storagePath) {
340
+ return { output: 'Already at root.' };
341
+ }
337
342
  for (let i = 0; i < levels; i++) {
338
343
  const parentPath = path.dirname(targetPath);
339
- if (parentPath === config.storagePath || parentPath.length < config.storagePath.length) {
340
- return { output: 'Already at root.' };
344
+ // Stop at storage root
345
+ if (targetPath === config.storagePath || parentPath.length < config.storagePath.length) {
346
+ break;
341
347
  }
342
348
  targetPath = parentPath;
349
+ // If we reached root, stop
350
+ if (targetPath === config.storagePath) {
351
+ break;
352
+ }
343
353
  }
344
354
  return { newPath: targetPath, output: '' };
345
355
  }
@@ -468,18 +478,25 @@ async function processCommand(input, currentPath, config, signal, rl) {
468
478
  return { output: 'Usage: cd <node> or cd .. or cd <path>' };
469
479
  }
470
480
  const target = parts.slice(1).join(' ');
471
- if (target === '..') {
472
- const parentPath = path.dirname(currentPath);
473
- if (parentPath === config.storagePath || parentPath.length < config.storagePath.length) {
481
+ // Handle cd .., cd ..., cd ...., etc
482
+ if (/^\.{2,}$/.test(target)) {
483
+ const levels = target.length - 1;
484
+ let targetPath = currentPath;
485
+ // Already at root?
486
+ if (targetPath === config.storagePath) {
474
487
  return { output: 'Already at root.' };
475
488
  }
476
- return { newPath: parentPath, output: '' };
477
- }
478
- if (target === '...') {
479
- let targetPath = path.dirname(currentPath);
480
- targetPath = path.dirname(targetPath);
481
- if (targetPath.length < config.storagePath.length) {
482
- return { output: 'Already at root.' };
489
+ for (let i = 0; i < levels; i++) {
490
+ const parentPath = path.dirname(targetPath);
491
+ // Stop at storage root
492
+ if (targetPath === config.storagePath || parentPath.length < config.storagePath.length) {
493
+ break;
494
+ }
495
+ targetPath = parentPath;
496
+ // If we reached root, stop
497
+ if (targetPath === config.storagePath) {
498
+ break;
499
+ }
483
500
  }
484
501
  return { newPath: targetPath, output: '' };
485
502
  }
@@ -488,13 +505,22 @@ async function processCommand(input, currentPath, config, signal, rl) {
488
505
  let targetPath = currentPath;
489
506
  const pathParts = target.split('/');
490
507
  for (const part of pathParts) {
491
- if (part === '..') {
492
- targetPath = path.dirname(targetPath);
508
+ if (/^\.{2,}$/.test(part)) {
509
+ // Handle .., ..., ...., etc in path
510
+ const levels = part.length - 1;
511
+ for (let i = 0; i < levels; i++) {
512
+ if (targetPath === config.storagePath)
513
+ break;
514
+ const parentPath = path.dirname(targetPath);
515
+ if (parentPath.length < config.storagePath.length)
516
+ break;
517
+ targetPath = parentPath;
518
+ }
493
519
  }
494
520
  else if (part === '.') {
495
521
  continue;
496
522
  }
497
- else {
523
+ else if (part) {
498
524
  const newPath = (0, storage_1.navigateToNode)(targetPath, part);
499
525
  if (!newPath) {
500
526
  return { output: `Path "${target}" not found.` };
@@ -12,7 +12,7 @@ const ASCII_ART = [
12
12
  ' .>\' (_--.',
13
13
  ' _=/d ,^\\',
14
14
  '~~ \\)-\' \'',
15
- ' / |',
15
+ ' / | rlc',
16
16
  ' \' \'',
17
17
  '',
18
18
  '╔═════════════════════════╗',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roguelike-cli",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "AI-powered interactive terminal for creating schemas and todo lists",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -367,17 +367,31 @@ export async function processCommand(
367
367
  return wrapResult({ output: treeLines.join('\n') });
368
368
  }
369
369
 
370
- // Handle navigation without 'cd' command (.., ...)
371
- if (command === '..' || command === '...') {
372
- let levels = command === '...' ? 2 : 1;
370
+ // Handle navigation without 'cd' command (.., ..., ...., etc)
371
+ if (/^\.{2,}$/.test(command)) {
372
+ // Count dots: .. = 1 level, ... = 2 levels, .... = 3 levels, etc
373
+ const levels = command.length - 1;
373
374
  let targetPath = currentPath;
374
375
 
376
+ // Already at root?
377
+ if (targetPath === config.storagePath) {
378
+ return { output: 'Already at root.' };
379
+ }
380
+
375
381
  for (let i = 0; i < levels; i++) {
376
382
  const parentPath = path.dirname(targetPath);
377
- if (parentPath === config.storagePath || parentPath.length < config.storagePath.length) {
378
- return { output: 'Already at root.' };
383
+
384
+ // Stop at storage root
385
+ if (targetPath === config.storagePath || parentPath.length < config.storagePath.length) {
386
+ break;
379
387
  }
388
+
380
389
  targetPath = parentPath;
390
+
391
+ // If we reached root, stop
392
+ if (targetPath === config.storagePath) {
393
+ break;
394
+ }
381
395
  }
382
396
 
383
397
  return { newPath: targetPath, output: '' };
@@ -531,20 +545,32 @@ export async function processCommand(
531
545
 
532
546
  const target = parts.slice(1).join(' ');
533
547
 
534
- if (target === '..') {
535
- const parentPath = path.dirname(currentPath);
536
- if (parentPath === config.storagePath || parentPath.length < config.storagePath.length) {
548
+ // Handle cd .., cd ..., cd ...., etc
549
+ if (/^\.{2,}$/.test(target)) {
550
+ const levels = target.length - 1;
551
+ let targetPath = currentPath;
552
+
553
+ // Already at root?
554
+ if (targetPath === config.storagePath) {
537
555
  return { output: 'Already at root.' };
538
556
  }
539
- return { newPath: parentPath, output: '' };
540
- }
541
-
542
- if (target === '...') {
543
- let targetPath = path.dirname(currentPath);
544
- targetPath = path.dirname(targetPath);
545
- if (targetPath.length < config.storagePath.length) {
546
- return { output: 'Already at root.' };
557
+
558
+ for (let i = 0; i < levels; i++) {
559
+ const parentPath = path.dirname(targetPath);
560
+
561
+ // Stop at storage root
562
+ if (targetPath === config.storagePath || parentPath.length < config.storagePath.length) {
563
+ break;
564
+ }
565
+
566
+ targetPath = parentPath;
567
+
568
+ // If we reached root, stop
569
+ if (targetPath === config.storagePath) {
570
+ break;
571
+ }
547
572
  }
573
+
548
574
  return { newPath: targetPath, output: '' };
549
575
  }
550
576
 
@@ -554,11 +580,18 @@ export async function processCommand(
554
580
  const pathParts = target.split('/');
555
581
 
556
582
  for (const part of pathParts) {
557
- if (part === '..') {
558
- targetPath = path.dirname(targetPath);
583
+ if (/^\.{2,}$/.test(part)) {
584
+ // Handle .., ..., ...., etc in path
585
+ const levels = part.length - 1;
586
+ for (let i = 0; i < levels; i++) {
587
+ if (targetPath === config.storagePath) break;
588
+ const parentPath = path.dirname(targetPath);
589
+ if (parentPath.length < config.storagePath.length) break;
590
+ targetPath = parentPath;
591
+ }
559
592
  } else if (part === '.') {
560
593
  continue;
561
- } else {
594
+ } else if (part) {
562
595
  const newPath = navigateToNode(targetPath, part);
563
596
  if (!newPath) {
564
597
  return { output: `Path "${target}" not found.` };
@@ -10,7 +10,7 @@ const ASCII_ART = [
10
10
  ' .>\' (_--.',
11
11
  ' _=/d ,^\\',
12
12
  '~~ \\)-\' \'',
13
- ' / |',
13
+ ' / | rlc',
14
14
  ' \' \'',
15
15
  '',
16
16
  '╔═════════════════════════╗',