lat.md 0.8.0 → 0.8.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.
@@ -454,9 +454,11 @@ export async function initCmd(targetDir) {
454
454
  const root = resolve(targetDir ?? process.cwd());
455
455
  const latDir = join(root, 'lat.md');
456
456
  const interactive = process.stdin.isTTY ?? false;
457
- const rl = interactive
458
- ? createInterface({ input: process.stdin, output: process.stdout })
459
- : null;
457
+ // Readline is created AFTER the selectMenu loop below.
458
+ // selectMenu puts stdin into raw mode with its own 'data' listener;
459
+ // if readline is already attached it receives those raw keypresses,
460
+ // corrupting its internal state and causing rl.question() to hang/exit.
461
+ let rl = null;
460
462
  const ask = async (message) => {
461
463
  if (!rl)
462
464
  return true;
@@ -468,9 +470,21 @@ export async function initCmd(targetDir) {
468
470
  console.log(chalk.green('lat.md/') + ' already exists');
469
471
  }
470
472
  else {
471
- if (!(await ask('Create lat.md/ directory?'))) {
472
- console.log('Aborted.');
473
- return;
473
+ // No rl yet — selectMenu hasn't run, so use a one-off confirm
474
+ if (interactive) {
475
+ const tmpRl = createInterface({
476
+ input: process.stdin,
477
+ output: process.stdout,
478
+ });
479
+ try {
480
+ if (!(await confirm(tmpRl, 'Create lat.md/ directory?'))) {
481
+ console.log('Aborted.');
482
+ return;
483
+ }
484
+ }
485
+ finally {
486
+ tmpRl.close();
487
+ }
474
488
  }
475
489
  const templateDir = join(findTemplatesDir(), 'init');
476
490
  mkdirSync(latDir, { recursive: true });
@@ -514,6 +528,14 @@ export async function initCmd(targetDir) {
514
528
  const useCopilot = selectedAgents.includes('copilot');
515
529
  const useCodex = selectedAgents.includes('codex');
516
530
  const anySelected = selectedAgents.length > 0;
531
+ // Now that selectMenu is done, it's safe to create the readline interface.
532
+ // selectMenu has restored stdin to its original state (paused, non-raw).
533
+ if (interactive) {
534
+ rl = createInterface({
535
+ input: process.stdin,
536
+ output: process.stdout,
537
+ });
538
+ }
517
539
  if (!anySelected) {
518
540
  console.log('');
519
541
  console.log(chalk.dim('No agents selected. You can re-run') +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lat.md",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "A knowledge graph for your codebase, written in markdown",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.30.2",