Skip to content

1.15.0

Choose a tag to compare

@butschster butschster released this 22 Mar 08:20
· 540 commits to main since this release
4978671

Add YAML configuration support

This PR introduces YAML configuration support.

Changes

  • Created a dedicated ConfigLoader namespace to replace the existing Loader structure
  • Implemented a reader abstraction with support for:
    • JSON files
    • YAML files
    • PHP files
  • Created a factory to simplify the creation of appropriate loaders

New Features

  • Context Generator now supports .yaml and .yml configuration files
  • The system will automatically detect and use the appropriate file format

Dependencies

  • Added dependency on symfony/yaml for YAML parsing

Example

settings:
  modifiers:
    api-docs:
      name: php-content-filter
      options:
        keep_doc_comments: false
documents:
  - description: 'Config loaders'
    outputPath: api/config.md
    sources:
      - type: file
        sourcePaths:
          - src/ConfigLoader

  - description: 'Generator loaders'
    outputPath: api/loaders.md
    sources:
      - type: composer
        packages:
          - symfony/finder
        contains:
          - NumberComparator

  - description: 'Composer source'
    outputPath: api/source.md
    sources:
      - type: tree
        showCharCount: true
        maxDepth: 4
        dirContext:
          "src/ConfigLoader": "Contains all application controllers"
        sourcePaths:
          - src/Lib
          - src/ConfigLoader
      - type: file
        sourcePaths:
          - src/Source/File
          - src/Source/BaseSource.php
          - src/Lib/TreeBuilder

  - description: 'Console logger'
    outputPath: api/console.md
    sources:
      - type: file
        sourcePaths:
          - src/Console
        filePattern: '*.php'

Tree Source for Directory Structure Visualization

This PR adds a new TreeSource type, providing enhanced visualization of directory structures.

Features

  • 🌳 Visualize directory structures in formats:

    • ASCII art (terminal-like tree visualization)
  • 📊 Enhanced metadata display:

    • File and directory sizes
    • Last modified dates
    • Characters count
    • Custom directory descriptions/context
  • 🔍 Full filtering capabilities:

    • File pattern matching
    • Path inclusion/exclusion
    • Content-based filtering
    • Maximum depth limits
  • 🔄 Integration with existing modifier system

Example Configuration

{
  "type": "tree",
  "description": "Project Structure",
  "sourcePaths": "src",
  "filePattern": "*.php",
  "notPath": ["tests", "vendor"],
  "renderFormat": "markdown",
  "maxDepth": 3,
  "showSize": true,
  "showLastModified": true,
  "showCharCount": true,
  "dirContext": {
    "src/Controller": "Contains all application controllers",
    "src/Model": "Contains domain model definitions"
  }
}

or

    sources:
      - type: tree
        showCharCount: true
        maxDepth: 4
        dirContext:
          "src/ConfigLoader": "Contains all application controllers"
        sourcePaths:
          - src/Lib
          - src/ConfigLoader
      - type: file
        sourcePaths:
          - src/Source/File
          - src/Source/BaseSource.php
          - src/Lib/TreeBuilder

Example output


└── src/ [87.6 KB, 89,744 chars]
    └── ConfigLoader/ [22.8 KB, 23,306 chars] # Contains all application controllers
        ├── CompositeConfigLoader.php [2.1 KB, 2,156 chars]
        ├── ConfigLoader.php [2.3 KB, 2,405 chars]
        ├── ConfigLoaderFactory.php [3.1 KB, 3,133 chars]
        ├── ConfigLoaderInterface.php [739.0 B, 739 chars]
        ├── Exception/ [452.0 B, 452 chars]
        │   ├── ConfigLoaderException.php [229.0 B, 229 chars]
        │   ├── ReaderException.php [223.0 B, 223 chars]
        ├── Parser/ [4.3 KB, 4,385 chars]
        │   ├── CompositeConfigParser.php [1.2 KB, 1,231 chars]
        │   ├── ConfigParser.php [1.8 KB, 1,820 chars]
        │   ├── ConfigParserInterface.php [455.0 B, 455 chars]
        │   ├── ConfigParserPluginInterface.php [879.0 B, 879 chars]
        ├── Reader/ [6.8 KB, 7,010 chars]
        │   ├── AbstractReader.php [2.6 KB, 2,642 chars]
        │   ├── JsonReader.php [842.0 B, 842 chars]
        │   ├── PhpReader.php [1.6 KB, 1,613 chars]
        │   ├── ReaderInterface.php [774.0 B, 774 chars]
        │   ├── YamlReader.php [1.1 KB, 1,139 chars]
        ├── Registry/ [3.0 KB, 3,026 chars]
        │   └── ConfigRegistry.php [1.7 KB, 1,716 chars]
        │   └── DocumentRegistry.php [859.0 B, 859 chars]
        │   └── RegistryInterface.php [451.0 B, 451 chars]
    └── Lib/ [64.9 KB, 66,438 chars]
        └── Content/ [5.8 KB, 5,910 chars]
            ├── ContentBlock.php [1.1 KB, 1,141 chars]
            ├── ContentBuilder.php [4.1 KB, 4,224 chars]
            ├── ContentBuilderFactory.php [545.0 B, 545 chars]
        └── Files.php [1.6 KB, 1,678 chars]
        └── Finder/ [1.3 KB, 1,363 chars]
            ├── FinderInterface.php [828.0 B, 828 chars]
            ├── FinderResult.php [535.0 B, 535 chars]
        └── GithubClient/ [4.2 KB, 4,324 chars]
            ├── GithubClient.php [3.2 KB, 3,245 chars]
            ├── GithubClientInterface.php [1.1 KB, 1,079 chars]
        └── Html/ [2.9 KB, 2,993 chars]
            ├── HtmlCleaner.php [676.0 B, 676 chars]
            ├── HtmlCleanerInterface.php [283.0 B, 283 chars]
            ├── SelectorContentExtractor.php [1.7 KB, 1,691 chars]
            ├── SelectorContentExtractorInterface.php [343.0 B, 343 chars]
        └── HttpClient/ [8.5 KB, 8,688 chars]
            ├── HttpClientFactory.php [799.0 B, 799 chars]
            ├── HttpClientInterface.php [987.0 B, 987 chars]
            ├── HttpResponse.php [3.9 KB, 3,960 chars]
            ├── NullHttpClient.php [831.0 B, 831 chars]
            ├── Psr18Client.php [2.1 KB, 2,111 chars]
        └── Logger/ [10.6 KB, 10,825 chars]
            ├── ConsoleLogger.php [2.9 KB, 2,986 chars]
            ├── FormatterInterface.php [612.0 B, 612 chars]
            ├── HasPrefixLoggerInterface.php [511.0 B, 511 chars]
            ├── LogLevel.php [2.0 KB, 2,040 chars]
            ├── LoggerFactory.php [850.0 B, 850 chars]
            ├── NullLogger.php [667.0 B, 667 chars]
            ├── SimpleFormatter.php [3.1 KB, 3,159 chars]
        └── PathFilter/ [10.7 KB, 10,983 chars]
            ├── AbstractFilter.php [1.2 KB, 1,192 chars]
            ├── ContentsFilter.php [2.3 KB, 2,328 chars]
            ├── ExcludePathFilter.php [1.8 KB, 1,805 chars]
            ├── FileHelper.php [3.4 KB, 3,530 chars]
            ├── FilePatternFilter.php [912.0 B, 912 chars]
            ├── FilterInterface.php [433.0 B, 433 chars]
            ├── PathFilter.php [783.0 B, 783 chars]
        └── Sanitizer/ [13.4 KB, 13,720 chars]
            ├── CommentInsertionRule.php [3.6 KB, 3,665 chars]
            ├── ContextSanitizer.php [924.0 B, 924 chars]
            ├── KeywordRemovalRule.php [2.4 KB, 2,452 chars]
            ├── RegexReplacementRule.php [798.0 B, 798 chars]
            ├── RuleFactory.php [5.4 KB, 5,520 chars]
            ├── RuleInterface.php [361.0 B, 361 chars]
        └── TreeBuilder/ [3.2 KB, 3,239 chars]
            ├── FileTreeBuilder.php [2.6 KB, 2,713 chars]
            ├── TreeRendererInterface.php [526.0 B, 526 chars]
        └── Variable/ [2.7 KB, 2,715 chars]
            └── VariableReplacementProcessor.php [2.0 KB, 2,016 chars]
            └── VariableResolver.php [699.0 B, 699 chars]

What's Changed

  • Add logging for source creation in DocumentsParserPlugin by @butschster in #66
  • feat: Add YAML configuration support and reorganize config loader architecture by @butschster in #67
  • Tree Source for Directory Structure Visualization by @butschster in #68

Full Changelog: 1.14.1...1.15.0