make-folder-txt 2.1.0 → 2.1.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 CHANGED
@@ -24,8 +24,8 @@ Ever needed to share your entire project with ChatGPT, Claude, or a teammate —
24
24
  - ✅ Run it from any project directory — no arguments needed
25
25
  - ✅ Built-in help system with `--help` flag
26
26
  - ✅ **Built-in shell autocompletion** (installs automatically)
27
- - ✅ **File size control** with `--skip-large` and `--no-skip`
28
- - ✅ **Output splitting** by folders, files, or size
27
+ - ✅ File size control with `--skip-large` and `--no-skip`
28
+ - ✅ Output splitting by folders, files, or size
29
29
  - ✅ Copy to clipboard with `--copy` flag
30
30
  - ✅ Force include everything with `--force` flag
31
31
  - ✅ Generates a clean folder tree + every file's content
@@ -453,7 +453,7 @@ function splitBySize(treeLines, filePaths, rootName, splitSize, effectiveMaxSize
453
453
 
454
454
  const args = process.argv.slice(2);
455
455
 
456
- // Check if completion is already installed, install if not
456
+ // Check if completion is already installed, install if not (silent on subsequent runs)
457
457
  function checkAndInstallCompletion() {
458
458
  const { execSync } = require('child_process');
459
459
  const path = require('path');
@@ -467,19 +467,33 @@ function checkAndInstallCompletion() {
467
467
  let completionInstalled = false;
468
468
 
469
469
  if (platform === 'win32') {
470
- // Check PowerShell completion - try multiple profile locations
471
- const profilePaths = [
472
- path.join(homeDir, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1'),
473
- path.join(homeDir, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1'),
474
- path.join(homeDir, '.config', 'powershell', 'Microsoft.PowerShell_profile.ps1')
475
- ];
476
-
477
- for (const profilePath of profilePaths) {
470
+ // Check PowerShell completion - use the same path as the installation script
471
+ try {
472
+ // Get the PowerShell profile path like the installation script does
473
+ const profilePathResult = execSync('powershell -Command "echo $PROFILE.CurrentUserCurrentHost"', { encoding: 'utf8' }).trim();
474
+ const profilePath = profilePathResult.replace(/['"]/g, '').replace(/\.CurrentUserCurrentHost$/, ''); // Remove quotes and suffix
475
+
478
476
  if (fs.existsSync(profilePath)) {
479
477
  const profileContent = fs.readFileSync(profilePath, 'utf8');
480
- if (profileContent.includes('make-folder-txt-completion')) {
478
+ if (profileContent.includes('make-folder-txt') || profileContent.includes('Register-ArgumentCompleter')) {
481
479
  completionInstalled = true;
482
- break;
480
+ }
481
+ }
482
+ } catch (err) {
483
+ // If PowerShell detection fails, try fallback paths
484
+ const profilePaths = [
485
+ path.join(homeDir, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1'),
486
+ path.join(homeDir, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1'),
487
+ path.join(homeDir, '.config', 'powershell', 'Microsoft.PowerShell_profile.ps1')
488
+ ];
489
+
490
+ for (const profilePath of profilePaths) {
491
+ if (fs.existsSync(profilePath)) {
492
+ const profileContent = fs.readFileSync(profilePath, 'utf8');
493
+ if (profileContent.includes('make-folder-txt') || profileContent.includes('Register-ArgumentCompleter')) {
494
+ completionInstalled = true;
495
+ break;
496
+ }
483
497
  }
484
498
  }
485
499
  }
@@ -503,7 +517,7 @@ function checkAndInstallCompletion() {
503
517
  }
504
518
  }
505
519
 
506
- // If completion is not installed, install it automatically
520
+ // If completion is not installed, install it automatically (show message only first time)
507
521
  if (!completionInstalled) {
508
522
  console.log('🔧 Installing shell autocompletion for make-folder-txt...');
509
523
 
@@ -513,7 +527,7 @@ function checkAndInstallCompletion() {
513
527
  execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
514
528
  const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
515
529
  execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
516
- console.log('✅ PowerShell completion installed!');
530
+ console.log('✅ PowerShell completion installed! Restart your terminal to enable autocompletion');
517
531
  } catch (err) {
518
532
  // Silent fail for PowerShell
519
533
  }
@@ -534,7 +548,7 @@ function checkAndInstallCompletion() {
534
548
  } catch (e) {
535
549
  fs.writeFileSync(zshrc, '# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
536
550
  }
537
- console.log('✅ Zsh completion installed!');
551
+ console.log('✅ Zsh completion installed! Restart your terminal or run: source ~/.zshrc');
538
552
  } catch (err) {
539
553
  // Silent fail for zsh
540
554
  }
@@ -551,7 +565,7 @@ function checkAndInstallCompletion() {
551
565
  } catch (e) {
552
566
  fs.writeFileSync(bashrc, `# make-folder-txt completion\nsource "${completionPath}"\n`);
553
567
  }
554
- console.log('✅ Bash completion installed!');
568
+ console.log('✅ Bash completion installed! Restart your terminal or run: source ~/.bashrc');
555
569
  } catch (err) {
556
570
  // Silent fail for bash
557
571
  }
@@ -565,7 +579,7 @@ function checkAndInstallCompletion() {
565
579
  }
566
580
  }
567
581
 
568
- // Run completion check on first run (but not for help/version commands)
582
+ // Run completion check on first run (but not for help/version/install-completion commands)
569
583
  if (!args.includes("--help") && !args.includes("-h") &&
570
584
  !args.includes("--version") && !args.includes("-v") &&
571
585
  !args.includes("--install-completion")) {
@@ -592,7 +606,8 @@ if (args.includes("--install-completion")) {
592
606
  const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
593
607
 
594
608
  // Run the PowerShell installation script
595
- execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'inherit' });
609
+ execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
610
+ console.log('✅ PowerShell completion installed! Restart your terminal to enable autocompletion');
596
611
 
597
612
  } catch (err) {
598
613
  console.error('❌ Failed to install PowerShell completion:', err.message);
@@ -21,7 +21,7 @@ FILE: /package.json
21
21
  --------------------------------------------------------------------------------
22
22
  {
23
23
  "name": "make-folder-txt",
24
- "version": "2.0.1",
24
+ "version": "2.1.0",
25
25
  "description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
26
26
  "main": "bin/make-folder-txt.js",
27
27
  "bin": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "make-folder-txt",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
5
5
  "main": "bin/make-folder-txt.js",
6
6
  "bin": {