make-folder-txt 2.0.0 → 2.0.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
|
@@ -23,7 +23,7 @@ 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
|
-
- ✅
|
|
26
|
+
- ✅ **Built-in shell autocompletion** (installs automatically)
|
|
27
27
|
- ✅ Copy to clipboard with `--copy` flag
|
|
28
28
|
- ✅ Force include everything with `--force` flag
|
|
29
29
|
- ✅ Generates a clean folder tree + every file's content
|
|
@@ -89,17 +89,24 @@ The `--force` flag overrides all ignore patterns and includes:
|
|
|
89
89
|
|
|
90
90
|
Use this when you need a complete, unfiltered dump of your entire project.
|
|
91
91
|
|
|
92
|
-
### ⚡ Shell Autocompletion
|
|
92
|
+
### ⚡ Shell Autocompletion (Built-in)
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
|
-
make-folder-txt
|
|
95
|
+
make-folder-txt # Autocompletion installs automatically on first run
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
**🎉 No installation required!** The tool automatically installs shell autocompletion the first time you run it.
|
|
99
|
+
|
|
100
|
+
**What gets installed automatically:**
|
|
99
101
|
- **Flag completion**: `make-folder-txt --<TAB>` shows all available flags
|
|
100
102
|
- **Folder completion**: `make-folder-txt --ignore-folder <TAB>` shows folders
|
|
101
103
|
- **File completion**: `make-folder-txt --ignore-file <TAB>` shows files
|
|
102
104
|
|
|
105
|
+
**Supported Shells:**
|
|
106
|
+
- **Bash** - Linux/macOS/Windows (WSL)
|
|
107
|
+
- **Zsh** - macOS/Linux
|
|
108
|
+
- **PowerShell** - Windows (7+)
|
|
109
|
+
|
|
103
110
|
**Example usage:**
|
|
104
111
|
```bash
|
|
105
112
|
$ make-folder-txt --ignore-folder b<TAB>
|
|
@@ -109,7 +116,22 @@ $ make-folder-txt --ignore-file p<TAB>
|
|
|
109
116
|
# → completes to "package.json" if package.json exists
|
|
110
117
|
```
|
|
111
118
|
|
|
112
|
-
|
|
119
|
+
**Manual Installation (if needed):**
|
|
120
|
+
```bash
|
|
121
|
+
make-folder-txt --install-completion # Force reinstall completion
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**PowerShell Manual Setup:**
|
|
125
|
+
```powershell
|
|
126
|
+
# If auto-installation doesn't work, load manually:
|
|
127
|
+
. .\completion\make-folder-txt-completion.ps1
|
|
128
|
+
|
|
129
|
+
# Or add to your PowerShell profile for persistence:
|
|
130
|
+
notepad $PROFILE
|
|
131
|
+
# Add: . "C:\path\to\make-folder-txt\completion\make-folder-txt-completion.ps1"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The completion works out of the box - just run the tool once and restart your terminal!
|
|
113
135
|
|
|
114
136
|
Ignore specific folders/files by name:
|
|
115
137
|
|
package/bin/make-folder-txt.js
CHANGED
|
@@ -197,6 +197,125 @@ function readContent(absPath, force = false) {
|
|
|
197
197
|
|
|
198
198
|
const args = process.argv.slice(2);
|
|
199
199
|
|
|
200
|
+
// Check if completion is already installed, install if not
|
|
201
|
+
function checkAndInstallCompletion() {
|
|
202
|
+
const { execSync } = require('child_process');
|
|
203
|
+
const path = require('path');
|
|
204
|
+
const os = require('os');
|
|
205
|
+
const fs = require('fs');
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
const homeDir = os.homedir();
|
|
209
|
+
const shell = process.env.SHELL || '';
|
|
210
|
+
const platform = process.platform;
|
|
211
|
+
let completionInstalled = false;
|
|
212
|
+
|
|
213
|
+
if (platform === 'win32') {
|
|
214
|
+
// Check PowerShell completion - try multiple profile locations
|
|
215
|
+
const profilePaths = [
|
|
216
|
+
path.join(homeDir, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1'),
|
|
217
|
+
path.join(homeDir, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1'),
|
|
218
|
+
path.join(homeDir, '.config', 'powershell', 'Microsoft.PowerShell_profile.ps1')
|
|
219
|
+
];
|
|
220
|
+
|
|
221
|
+
for (const profilePath of profilePaths) {
|
|
222
|
+
if (fs.existsSync(profilePath)) {
|
|
223
|
+
const profileContent = fs.readFileSync(profilePath, 'utf8');
|
|
224
|
+
if (profileContent.includes('make-folder-txt-completion')) {
|
|
225
|
+
completionInstalled = true;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
} else if (shell.includes('zsh')) {
|
|
231
|
+
// Check zsh completion
|
|
232
|
+
const zshrc = path.join(homeDir, '.zshrc');
|
|
233
|
+
if (fs.existsSync(zshrc)) {
|
|
234
|
+
const zshrcContent = fs.readFileSync(zshrc, 'utf8');
|
|
235
|
+
if (zshrcContent.includes('make-folder-txt')) {
|
|
236
|
+
completionInstalled = true;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
} else {
|
|
240
|
+
// Check bash completion
|
|
241
|
+
const bashrc = path.join(homeDir, '.bashrc');
|
|
242
|
+
if (fs.existsSync(bashrc)) {
|
|
243
|
+
const bashrcContent = fs.readFileSync(bashrc, 'utf8');
|
|
244
|
+
if (bashrcContent.includes('make-folder-txt-completion')) {
|
|
245
|
+
completionInstalled = true;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// If completion is not installed, install it automatically
|
|
251
|
+
if (!completionInstalled) {
|
|
252
|
+
console.log('🔧 Installing shell autocompletion for make-folder-txt...');
|
|
253
|
+
|
|
254
|
+
if (platform === 'win32') {
|
|
255
|
+
// Windows PowerShell
|
|
256
|
+
try {
|
|
257
|
+
execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
|
|
258
|
+
const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
|
|
259
|
+
execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
|
|
260
|
+
console.log('✅ PowerShell completion installed!');
|
|
261
|
+
} catch (err) {
|
|
262
|
+
// Silent fail for PowerShell
|
|
263
|
+
}
|
|
264
|
+
} else if (shell.includes('zsh')) {
|
|
265
|
+
// zsh
|
|
266
|
+
try {
|
|
267
|
+
const zshrc = path.join(homeDir, '.zshrc');
|
|
268
|
+
const completionDir = path.join(homeDir, '.zsh', 'completions');
|
|
269
|
+
execSync(`mkdir -p "${completionDir}"`, { stdio: 'ignore' });
|
|
270
|
+
const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.zsh');
|
|
271
|
+
execSync(`cp "${completionPath}" "${completionDir}/_make-folder-txt"`, { stdio: 'ignore' });
|
|
272
|
+
|
|
273
|
+
try {
|
|
274
|
+
const zshrcContent = fs.readFileSync(zshrc, 'utf8');
|
|
275
|
+
if (!zshrcContent.includes('fpath+=~/.zsh/completions')) {
|
|
276
|
+
fs.appendFileSync(zshrc, '\n# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
|
|
277
|
+
}
|
|
278
|
+
} catch (e) {
|
|
279
|
+
fs.writeFileSync(zshrc, '# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
|
|
280
|
+
}
|
|
281
|
+
console.log('✅ Zsh completion installed!');
|
|
282
|
+
} catch (err) {
|
|
283
|
+
// Silent fail for zsh
|
|
284
|
+
}
|
|
285
|
+
} else {
|
|
286
|
+
// bash
|
|
287
|
+
try {
|
|
288
|
+
const bashrc = path.join(homeDir, '.bashrc');
|
|
289
|
+
const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.bash');
|
|
290
|
+
try {
|
|
291
|
+
const bashrcContent = fs.readFileSync(bashrc, 'utf8');
|
|
292
|
+
if (!bashrcContent.includes('make-folder-txt-completion.bash')) {
|
|
293
|
+
fs.appendFileSync(bashrc, `\n# make-folder-txt completion\nsource "${completionPath}"\n`);
|
|
294
|
+
}
|
|
295
|
+
} catch (e) {
|
|
296
|
+
fs.writeFileSync(bashrc, `# make-folder-txt completion\nsource "${completionPath}"\n`);
|
|
297
|
+
}
|
|
298
|
+
console.log('✅ Bash completion installed!');
|
|
299
|
+
} catch (err) {
|
|
300
|
+
// Silent fail for bash
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
console.log('💡 Restart your terminal to enable autocompletion');
|
|
305
|
+
console.log('');
|
|
306
|
+
}
|
|
307
|
+
} catch (err) {
|
|
308
|
+
// Silent fail - don't interrupt the main functionality
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Run completion check on first run (but not for help/version commands)
|
|
313
|
+
if (!args.includes("--help") && !args.includes("-h") &&
|
|
314
|
+
!args.includes("--version") && !args.includes("-v") &&
|
|
315
|
+
!args.includes("--install-completion")) {
|
|
316
|
+
checkAndInstallCompletion();
|
|
317
|
+
}
|
|
318
|
+
|
|
200
319
|
if (args.includes("--install-completion")) {
|
|
201
320
|
const { execSync } = require('child_process');
|
|
202
321
|
const path = require('path');
|
|
@@ -205,8 +324,26 @@ if (args.includes("--install-completion")) {
|
|
|
205
324
|
try {
|
|
206
325
|
const homeDir = os.homedir();
|
|
207
326
|
const shell = process.env.SHELL || '';
|
|
327
|
+
const platform = process.platform;
|
|
208
328
|
|
|
209
|
-
if (
|
|
329
|
+
if (platform === 'win32') {
|
|
330
|
+
// Windows - Check if PowerShell is available
|
|
331
|
+
try {
|
|
332
|
+
execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
|
|
333
|
+
|
|
334
|
+
// Install PowerShell completion
|
|
335
|
+
const completionScript = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.ps1');
|
|
336
|
+
const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
|
|
337
|
+
|
|
338
|
+
// Run the PowerShell installation script
|
|
339
|
+
execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'inherit' });
|
|
340
|
+
|
|
341
|
+
} catch (err) {
|
|
342
|
+
console.error('❌ Failed to install PowerShell completion:', err.message);
|
|
343
|
+
process.exit(1);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
} else if (shell.includes('zsh')) {
|
|
210
347
|
// Install for zsh
|
|
211
348
|
const zshrc = path.join(homeDir, '.zshrc');
|
|
212
349
|
const completionDir = path.join(homeDir, '.zsh', 'completions');
|
|
@@ -280,7 +417,7 @@ Dump an entire project folder into a single readable .txt file.
|
|
|
280
417
|
--only-file, -ofi <names...> Include only specific files
|
|
281
418
|
--copy Copy output to clipboard
|
|
282
419
|
--force Include everything (overrides all ignore patterns)
|
|
283
|
-
--install-completion
|
|
420
|
+
--install-completion Install shell autocompletion (bash/zsh/PowerShell) - usually automatic
|
|
284
421
|
--help, -h Show this help message
|
|
285
422
|
--version, -v Show version information
|
|
286
423
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# PowerShell completion installation script for make-folder-txt
|
|
2
|
+
|
|
3
|
+
function Install-MakeFolderTxtCompletion {
|
|
4
|
+
param(
|
|
5
|
+
[switch]$Force,
|
|
6
|
+
[switch]$CurrentUser
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
$ErrorActionPreference = 'Stop'
|
|
10
|
+
|
|
11
|
+
# Determine PowerShell profile path
|
|
12
|
+
if ($CurrentUser) {
|
|
13
|
+
$profilePath = $PROFILE.CurrentUserCurrentHost
|
|
14
|
+
} else {
|
|
15
|
+
$profilePath = $PROFILE.AllUsersCurrentHost
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# Create profile directory if it doesn't exist
|
|
19
|
+
$profileDir = Split-Path $profilePath -Parent
|
|
20
|
+
if (-not (Test-Path $profileDir)) {
|
|
21
|
+
try {
|
|
22
|
+
New-Item -ItemType Directory -Path $profileDir -Force | Out-Null
|
|
23
|
+
Write-Host "Created profile directory: $profileDir" -ForegroundColor Green
|
|
24
|
+
} catch {
|
|
25
|
+
Write-Error "Failed to create profile directory: $profileDir"
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# Get the completion script content
|
|
31
|
+
$completionScriptPath = Join-Path $PSScriptRoot 'make-folder-txt-completion.ps1'
|
|
32
|
+
if (-not (Test-Path $completionScriptPath)) {
|
|
33
|
+
Write-Error "Completion script not found: $completionScriptPath"
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
$completionContent = Get-Content $completionScriptPath -Raw
|
|
38
|
+
|
|
39
|
+
# Check if completion is already installed
|
|
40
|
+
if (Test-Path $profilePath) {
|
|
41
|
+
$profileContent = Get-Content $profilePath -Raw
|
|
42
|
+
if ($profileContent -match 'make-folder-txt.*completion') {
|
|
43
|
+
if (-not $Force) {
|
|
44
|
+
Write-Host "make-folder-txt completion is already installed in $profilePath" -ForegroundColor Yellow
|
|
45
|
+
Write-Host "Use -Force to reinstall" -ForegroundColor Yellow
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
Write-Host "Removing existing completion..." -ForegroundColor Yellow
|
|
49
|
+
# Remove existing completion
|
|
50
|
+
$profileContent = $profileContent -replace '(?s)# make-folder-txt completion.*?Register-ArgumentComplester.*?Export-ModuleMember.*?\n', ''
|
|
51
|
+
Set-Content $profilePath $profileContent -Force
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Add completion to profile
|
|
56
|
+
$completionBlock = @"
|
|
57
|
+
|
|
58
|
+
# make-folder-txt completion
|
|
59
|
+
$completionContent
|
|
60
|
+
"@
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
Add-Content $profilePath $completionBlock -Force
|
|
64
|
+
Write-Host "✅ PowerShell completion installed successfully!" -ForegroundColor Green
|
|
65
|
+
Write-Host "Added to: $profilePath" -ForegroundColor Cyan
|
|
66
|
+
Write-Host "Restart PowerShell or run: . `$profile" -ForegroundColor Cyan
|
|
67
|
+
} catch {
|
|
68
|
+
Write-Error "Failed to install completion: $_"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# Auto-install if script is run directly
|
|
73
|
+
if ($MyInvocation.InvocationName -eq $MyInvocation.MyCommand.Name) {
|
|
74
|
+
Install-MakeFolderTxtCompletion -CurrentUser
|
|
75
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# make-folder-txt PowerShell completion script
|
|
2
|
+
|
|
3
|
+
Register-ArgumentCompleter -Native -CommandName 'make-folder-txt' -ScriptBlock {
|
|
4
|
+
param($commandName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
|
5
|
+
|
|
6
|
+
# Get the current argument being completed
|
|
7
|
+
$currentArgument = $wordToComplete
|
|
8
|
+
|
|
9
|
+
# Define available options
|
|
10
|
+
$options = @(
|
|
11
|
+
'--ignore-folder', '-ifo',
|
|
12
|
+
'--ignore-file', '-ifi',
|
|
13
|
+
'--only-folder', '-ofo',
|
|
14
|
+
'--only-file', '-ofi',
|
|
15
|
+
'--copy',
|
|
16
|
+
'--force',
|
|
17
|
+
'--install-completion',
|
|
18
|
+
'--help', '-h',
|
|
19
|
+
'--version', '-v'
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# Get the previous parameter to determine context
|
|
23
|
+
$previousParameter = if ($commandAst.CommandElements.Count -gt 1) {
|
|
24
|
+
$commandAst.CommandElements[-2].Extent.Text
|
|
25
|
+
} else {
|
|
26
|
+
''
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
switch ($previousParameter) {
|
|
30
|
+
{ $_ -in '--ignore-folder', '-ifo', '--only-folder', '-ofo' } {
|
|
31
|
+
# Complete with folder names
|
|
32
|
+
try {
|
|
33
|
+
$folders = Get-ChildItem -Directory -Name | Where-Object { $_ -like "*$currentArgument*" }
|
|
34
|
+
return $folders | ForEach-Object {
|
|
35
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Folder: $_")
|
|
36
|
+
}
|
|
37
|
+
} catch {
|
|
38
|
+
return @()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
{ $_ -in '--ignore-file', '-ifi', '--only-file', '-ofi' } {
|
|
42
|
+
# Complete with file names
|
|
43
|
+
try {
|
|
44
|
+
$files = Get-ChildItem -File -Name | Where-Object { $_ -like "*$currentArgument*" }
|
|
45
|
+
return $files | ForEach-Object {
|
|
46
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "File: $_")
|
|
47
|
+
}
|
|
48
|
+
} catch {
|
|
49
|
+
return @()
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
default {
|
|
53
|
+
# Complete with options
|
|
54
|
+
if ($currentArgument -like '-*') {
|
|
55
|
+
$matchingOptions = $options | Where-Object { $_ -like "*$currentArgument*" }
|
|
56
|
+
return $matchingOptions | ForEach-Object {
|
|
57
|
+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', "Option: $_")
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return @()
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# Export the completion function
|
|
67
|
+
Export-ModuleMember -Function *
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "make-folder-txt",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.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": {
|