llm-docs-builder 0.9.3 → 0.9.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75429a83cfd019e7059f76a5fe7df200bff3bc14066c5f83e0739c85a5a68b63
4
- data.tar.gz: 850d0568023dd1602cad0b48af5e6437b61f34f760c77b99adb565056313d241
3
+ metadata.gz: 66983a07a7271c966999350d03fbde1b1080ef0ac05a7209452cbb8720074e1b
4
+ data.tar.gz: 5d7cb81a700db6a43c17145af56ffcd2f6cea4a9a5182d4a2b14fd7772c8ee07
5
5
  SHA512:
6
- metadata.gz: f0384e50c10837ec00e4d195115882d4fdaade5e522bba02929b028ac315d686324baf189bfc16803120b77718b28c10f2026e10f2f2bd3dd1ea7aab09f36549
7
- data.tar.gz: 184e427780364d704067b1f84962fa7c658782ff2e048c991b34c06ca2643029d107872df1a0beac92cfb07076ae72cf9289527d534cad6274a99fdeaef22ac0
6
+ metadata.gz: 416b6f94c7e7dbac3bf3e6ae8793adcf9893d685aec29cc83665c2f9a6ab312bd422542e0074bbeec961f23740698aac6e517ebb7c87f3cb0fef3c8c6067c662
7
+ data.tar.gz: 2fba65092d82dbbeea60ce05317a781ed82f20367313d4eab9a69425e6e51f70ec106ca5f56218bbe255d1485752732de2a876359fde7018e706b948d51053fb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.4 (2025-10-27)
4
+ - [Feature] **Auto-Exclude Hidden Directories** - Hidden directories (starting with `.`) are now automatically excluded by default to prevent noise from `.git`, `.lint`, `.github`, etc.
5
+ - Adds `include_hidden: false` as default behavior
6
+ - Set `include_hidden: true` in config to include hidden directories if needed
7
+ - Uses `Find.prune` for efficient directory tree traversal
8
+ - Prevents scanning of common directories like `.lint`, `.gh`, `.git`, `node_modules` (if hidden)
9
+ - Fixed bug where root directory `.` was being pruned when used as docs_path
10
+ - [Fix] **Excludes Pattern Matching** - Fixed fnmatch pattern handling for better glob pattern support.
11
+ - Fixed `**/.dir/**` patterns now correctly match root-level directories
12
+ - Normalized patterns ending with `/**` to `/**/*` for proper fnmatch behavior
13
+ - Handles `**/` prefix matching for zero-directory cases
14
+ - Fixed relative path calculation to avoid "different prefix" errors
15
+ - [Test] Added unit tests for hidden directory exclusion feature (5 tests)
16
+ - [Test] Added integration tests for hidden directory behavior (3 tests)
17
+
3
18
  ## 0.9.3 (2025-10-27)
4
19
  - [Fix] **Generate Command Excludes Support** - The `generate` command now properly respects the `excludes` configuration option to filter out files from llms.txt generation.
5
20
  - Added `should_exclude?` method to Generator class that matches files against glob patterns
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- llm-docs-builder (0.9.3)
4
+ llm-docs-builder (0.9.4)
5
5
  zeitwerk (~> 2.6)
6
6
 
7
7
  GEM
@@ -100,6 +100,7 @@ module LlmDocsBuilder
100
100
  suffix: options[:suffix] || self['suffix'] || '.llm',
101
101
  excludes: options[:excludes] || self['excludes'] || [],
102
102
  bulk: options.key?(:bulk) ? options[:bulk] : (self['bulk'] || false),
103
+ include_hidden: options.key?(:include_hidden) ? options[:include_hidden] : (self['include_hidden'] || false),
103
104
  # New compression options
104
105
  remove_code_examples: if options.key?(:remove_code_examples)
105
106
  options[:remove_code_examples]
@@ -76,6 +76,13 @@ module LlmDocsBuilder
76
76
  files = []
77
77
 
78
78
  Find.find(docs_path) do |path|
79
+ # Skip hidden directories unless explicitly enabled
80
+ # Don't prune the root docs_path itself (even if it's ".")
81
+ if File.directory?(path) && path != docs_path && File.basename(path).start_with?('.') && !options[:include_hidden]
82
+ Find.prune
83
+ next
84
+ end
85
+
79
86
  next unless File.file?(path)
80
87
  next unless path.match?(/\.md$/i)
81
88
  next if File.basename(path).start_with?('.')
@@ -308,16 +315,38 @@ module LlmDocsBuilder
308
315
  return false if excludes.empty?
309
316
 
310
317
  # Get relative path from docs_path for matching
311
- relative_path = if File.directory?(docs_path)
312
- Pathname.new(file_path).relative_path_from(Pathname.new(docs_path)).to_s
313
- else
314
- File.basename(file_path)
315
- end
318
+ relative_path = begin
319
+ if File.directory?(docs_path)
320
+ # Convert both to absolute paths first to avoid "different prefix" error
321
+ abs_file = File.expand_path(file_path)
322
+ abs_docs = File.expand_path(docs_path)
323
+ Pathname.new(abs_file).relative_path_from(Pathname.new(abs_docs)).to_s
324
+ else
325
+ File.basename(file_path)
326
+ end
327
+ rescue ArgumentError
328
+ # If paths can't be made relative (different roots), use basename
329
+ File.basename(file_path)
330
+ end
316
331
 
317
332
  excludes.any? do |pattern|
333
+ # Normalize pattern: ensure /** is followed by something
334
+ # fnmatch requires /** to be followed by at least one component
335
+ normalized_pattern = pattern.end_with?('/**') ? "#{pattern}/*" : pattern
336
+
318
337
  # Check both absolute and relative paths
319
- File.fnmatch(pattern, file_path, File::FNM_PATHNAME | File::FNM_DOTMATCH) ||
320
- File.fnmatch(pattern, relative_path, File::FNM_PATHNAME | File::FNM_DOTMATCH)
338
+ matches = File.fnmatch(normalized_pattern, file_path, File::FNM_PATHNAME | File::FNM_DOTMATCH) ||
339
+ File.fnmatch(normalized_pattern, relative_path, File::FNM_PATHNAME | File::FNM_DOTMATCH)
340
+
341
+ # If pattern starts with **/, also try without it (for root-level matches)
342
+ # Since **/ in fnmatch doesn't match zero directories
343
+ if !matches && normalized_pattern.start_with?('**/')
344
+ pattern_without_prefix = normalized_pattern.sub(%r{^\*\*/}, '')
345
+ matches = File.fnmatch(pattern_without_prefix, file_path, File::FNM_PATHNAME | File::FNM_DOTMATCH) ||
346
+ File.fnmatch(pattern_without_prefix, relative_path, File::FNM_PATHNAME | File::FNM_DOTMATCH)
347
+ end
348
+
349
+ matches
321
350
  end
322
351
  end
323
352
 
@@ -2,5 +2,5 @@
2
2
 
3
3
  module LlmDocsBuilder
4
4
  # Current version of the LlmDocsBuilder gem
5
- VERSION = '0.9.3'
5
+ VERSION = '0.9.4'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llm-docs-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld