make-folder-txt 2.1.1 → 2.1.3

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
@@ -11,7 +11,7 @@
11
11
 
12
12
  Perfect for sharing your codebase with **AI tools**, **teammates**, or **code reviewers** — without zipping files or giving repo access.
13
13
 
14
- [Installation](#-installation) · [Usage](#-usage) · [Help](#-get-help) · [Copy to Clipboard](#-copy-to-clipboard) · [Force Include Everything](#-force-include-everything) · [Shell Autocompletion](#-shell-autocompletion) · [File Size Control](#-file-size-control) · [Output Splitting](#-output-splitting) · [Output Format](#-output-format) · [What Gets Skipped](#-what-gets-skipped) · [Contributing](#-contributing)
14
+ [Installation](#-installation) · [Usage](#-usage) · [Help](#-get-help) · [Copy to Clipboard](#-copy-to-clipboard) · [Force Include Everything](#-force-include-everything) · [File Size Control](#-file-size-control) · [Output Splitting](#-output-splitting) · [Output Format](#-output-format) · [What Gets Skipped](#-what-gets-skipped) · [Contributing](#-contributing)
15
15
 
16
16
  </div>
17
17
 
@@ -23,7 +23,6 @@ Ever needed to share your entire project with ChatGPT, Claude, or a teammate —
23
23
 
24
24
  - ✅ Run it from any project directory — no arguments needed
25
25
  - ✅ Built-in help system with `--help` flag
26
- - ✅ **Built-in shell autocompletion** (installs automatically)
27
26
  - ✅ File size control with `--skip-large` and `--no-skip`
28
27
  - ✅ Output splitting by folders, files, or size
29
28
  - ✅ Copy to clipboard with `--copy` flag
@@ -91,50 +90,6 @@ The `--force` flag overrides all ignore patterns and includes:
91
90
 
92
91
  Use this when you need a complete, unfiltered dump of your entire project.
93
92
 
94
- ### ⚡ Shell Autocompletion (Built-in)
95
-
96
- ```bash
97
- make-folder-txt # Autocompletion installs automatically on first run
98
- ```
99
-
100
- **🎉 No installation required!** The tool automatically installs shell autocompletion the first time you run it.
101
-
102
- **What gets installed automatically:**
103
- - **Flag completion**: `make-folder-txt --<TAB>` shows all available flags
104
- - **Folder completion**: `make-folder-txt --ignore-folder <TAB>` shows folders
105
- - **File completion**: `make-folder-txt --ignore-file <TAB>` shows files
106
-
107
- **Supported Shells:**
108
- - **Bash** - Linux/macOS/Windows (WSL)
109
- - **Zsh** - macOS/Linux
110
- - **PowerShell** - Windows (7+)
111
-
112
- **Example usage:**
113
- ```bash
114
- $ make-folder-txt --ignore-folder b<TAB>
115
- # → completes to "bin/" if bin folder exists
116
-
117
- $ make-folder-txt --ignore-file p<TAB>
118
- # → completes to "package.json" if package.json exists
119
- ```
120
-
121
- **Manual Installation (if needed):**
122
- ```bash
123
- make-folder-txt --install-completion # Force reinstall completion
124
- ```
125
-
126
- **PowerShell Manual Setup:**
127
- ```powershell
128
- # If auto-installation doesn't work, load manually:
129
- . .\completion\make-folder-txt-completion.ps1
130
-
131
- # Or add to your PowerShell profile for persistence:
132
- notepad $PROFILE
133
- # Add: . "C:\path\to\make-folder-txt\completion\make-folder-txt-completion.ps1"
134
- ```
135
-
136
- The completion works out of the box - just run the tool once and restart your terminal!
137
-
138
93
  ### 📏 File Size Control
139
94
 
140
95
  ```bash
@@ -453,220 +453,6 @@ 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 (silent on subsequent runs)
457
- function checkAndInstallCompletion() {
458
- const { execSync } = require('child_process');
459
- const path = require('path');
460
- const os = require('os');
461
- const fs = require('fs');
462
-
463
- try {
464
- const homeDir = os.homedir();
465
- const shell = process.env.SHELL || '';
466
- const platform = process.platform;
467
- let completionInstalled = false;
468
-
469
- if (platform === 'win32') {
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
-
476
- if (fs.existsSync(profilePath)) {
477
- const profileContent = fs.readFileSync(profilePath, 'utf8');
478
- if (profileContent.includes('make-folder-txt') || profileContent.includes('Register-ArgumentCompleter')) {
479
- completionInstalled = true;
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
- }
497
- }
498
- }
499
- }
500
- } else if (shell.includes('zsh')) {
501
- // Check zsh completion
502
- const zshrc = path.join(homeDir, '.zshrc');
503
- if (fs.existsSync(zshrc)) {
504
- const zshrcContent = fs.readFileSync(zshrc, 'utf8');
505
- if (zshrcContent.includes('make-folder-txt')) {
506
- completionInstalled = true;
507
- }
508
- }
509
- } else {
510
- // Check bash completion
511
- const bashrc = path.join(homeDir, '.bashrc');
512
- if (fs.existsSync(bashrc)) {
513
- const bashrcContent = fs.readFileSync(bashrc, 'utf8');
514
- if (bashrcContent.includes('make-folder-txt-completion')) {
515
- completionInstalled = true;
516
- }
517
- }
518
- }
519
-
520
- // If completion is not installed, install it automatically (show message only first time)
521
- if (!completionInstalled) {
522
- console.log('🔧 Installing shell autocompletion for make-folder-txt...');
523
-
524
- if (platform === 'win32') {
525
- // Windows PowerShell
526
- try {
527
- execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
528
- const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
529
- execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
530
- console.log('✅ PowerShell completion installed! Restart your terminal to enable autocompletion');
531
- } catch (err) {
532
- // Silent fail for PowerShell
533
- }
534
- } else if (shell.includes('zsh')) {
535
- // zsh
536
- try {
537
- const zshrc = path.join(homeDir, '.zshrc');
538
- const completionDir = path.join(homeDir, '.zsh', 'completions');
539
- execSync(`mkdir -p "${completionDir}"`, { stdio: 'ignore' });
540
- const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.zsh');
541
- execSync(`cp "${completionPath}" "${completionDir}/_make-folder-txt"`, { stdio: 'ignore' });
542
-
543
- try {
544
- const zshrcContent = fs.readFileSync(zshrc, 'utf8');
545
- if (!zshrcContent.includes('fpath+=~/.zsh/completions')) {
546
- fs.appendFileSync(zshrc, '\n# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
547
- }
548
- } catch (e) {
549
- fs.writeFileSync(zshrc, '# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
550
- }
551
- console.log('✅ Zsh completion installed! Restart your terminal or run: source ~/.zshrc');
552
- } catch (err) {
553
- // Silent fail for zsh
554
- }
555
- } else {
556
- // bash
557
- try {
558
- const bashrc = path.join(homeDir, '.bashrc');
559
- const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.bash');
560
- try {
561
- const bashrcContent = fs.readFileSync(bashrc, 'utf8');
562
- if (!bashrcContent.includes('make-folder-txt-completion.bash')) {
563
- fs.appendFileSync(bashrc, `\n# make-folder-txt completion\nsource "${completionPath}"\n`);
564
- }
565
- } catch (e) {
566
- fs.writeFileSync(bashrc, `# make-folder-txt completion\nsource "${completionPath}"\n`);
567
- }
568
- console.log('✅ Bash completion installed! Restart your terminal or run: source ~/.bashrc');
569
- } catch (err) {
570
- // Silent fail for bash
571
- }
572
- }
573
-
574
- console.log('💡 Restart your terminal to enable autocompletion');
575
- console.log('');
576
- }
577
- } catch (err) {
578
- // Silent fail - don't interrupt the main functionality
579
- }
580
- }
581
-
582
- // Run completion check on first run (but not for help/version/install-completion commands)
583
- if (!args.includes("--help") && !args.includes("-h") &&
584
- !args.includes("--version") && !args.includes("-v") &&
585
- !args.includes("--install-completion")) {
586
- checkAndInstallCompletion();
587
- }
588
-
589
- if (args.includes("--install-completion")) {
590
- const { execSync } = require('child_process');
591
- const path = require('path');
592
- const os = require('os');
593
-
594
- try {
595
- const homeDir = os.homedir();
596
- const shell = process.env.SHELL || '';
597
- const platform = process.platform;
598
-
599
- if (platform === 'win32') {
600
- // Windows - Check if PowerShell is available
601
- try {
602
- execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
603
-
604
- // Install PowerShell completion
605
- const completionScript = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.ps1');
606
- const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
607
-
608
- // Run the PowerShell installation script
609
- execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
610
- console.log('✅ PowerShell completion installed! Restart your terminal to enable autocompletion');
611
-
612
- } catch (err) {
613
- console.error('❌ Failed to install PowerShell completion:', err.message);
614
- process.exit(1);
615
- }
616
-
617
- } else if (shell.includes('zsh')) {
618
- // Install for zsh
619
- const zshrc = path.join(homeDir, '.zshrc');
620
- const completionDir = path.join(homeDir, '.zsh', 'completions');
621
-
622
- // Create completions directory if it doesn't exist
623
- try {
624
- execSync(`mkdir -p "${completionDir}"`, { stdio: 'ignore' });
625
- } catch (e) {}
626
-
627
- // Copy completion file
628
- const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.zsh');
629
- execSync(`cp "${completionPath}" "${completionDir}/_make-folder-txt"`, { stdio: 'ignore' });
630
-
631
- // Add to .zshrc if not already there
632
- try {
633
- const zshrcContent = fs.readFileSync(zshrc, 'utf8');
634
- if (!zshrcContent.includes('fpath+=~/.zsh/completions')) {
635
- fs.appendFileSync(zshrc, '\n# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
636
- }
637
- } catch (e) {
638
- // .zshrc doesn't exist, create it
639
- fs.writeFileSync(zshrc, '# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
640
- }
641
-
642
- console.log('✅ Zsh completion installed! Restart your terminal or run: source ~/.zshrc');
643
-
644
- } else {
645
- // Install for bash
646
- const bashrc = path.join(homeDir, '.bashrc');
647
- const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.bash');
648
-
649
- // Add to .bashrc if not already there
650
- try {
651
- const bashrcContent = fs.readFileSync(bashrc, 'utf8');
652
- if (!bashrcContent.includes('make-folder-txt-completion.bash')) {
653
- fs.appendFileSync(bashrc, `\n# make-folder-txt completion\nsource "${completionPath}"\n`);
654
- }
655
- } catch (e) {
656
- // .bashrc doesn't exist, create it
657
- fs.writeFileSync(bashrc, `# make-folder-txt completion\nsource "${completionPath}"\n`);
658
- }
659
-
660
- console.log('✅ Bash completion installed! Restart your terminal or run: source ~/.bashrc');
661
- }
662
- } catch (err) {
663
- console.error('❌ Failed to install completion:', err.message);
664
- process.exit(1);
665
- }
666
-
667
- process.exit(0);
668
- }
669
-
670
456
  if (args.includes("-v") || args.includes("--version")) {
671
457
  console.log(`v${version}`);
672
458
  console.log("Built by Muhammad Saad Amin");
@@ -692,7 +478,6 @@ Dump an entire project folder into a single readable .txt file.
692
478
  --split-size <size> Split output when size exceeds limit (requires --split-method size)
693
479
  --copy Copy output to clipboard
694
480
  --force Include everything (overrides all ignore patterns)
695
- --install-completion Install shell autocompletion (bash/zsh/PowerShell) - usually automatic
696
481
  --help, -h Show this help message
697
482
  --version, -v Show version information
698
483
 
@@ -706,7 +491,6 @@ Dump an entire project folder into a single readable .txt file.
706
491
  make-folder-txt --split-method folder
707
492
  make-folder-txt --split-method file
708
493
  make-folder-txt --split-method size --split-size 5MB
709
- make-folder-txt --install-completion
710
494
  make-folder-txt --ignore-folder node_modules dist
711
495
  make-folder-txt -ifo node_modules dist
712
496
  make-folder-txt --ignore-file .env .env.local
@@ -21,7 +21,7 @@ FILE: /package.json
21
21
  --------------------------------------------------------------------------------
22
22
  {
23
23
  "name": "make-folder-txt",
24
- "version": "2.1.0",
24
+ "version": "2.1.2",
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.1",
3
+ "version": "2.1.3",
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": {