Skip to content

feat: Support recursive glob patterns in task inputs #62

@drlucaa

Description

@drlucaa

The same build tool currently relies on the standard library's filepath.Glob for resolving task inputs. This implementation does not support the recursive double-star syntax (e.g., src/**/*.go), which forces users to explicitly list subdirectories or limits task definitions to flat directory structures.

This limitation contradicts the documentation examples and common user expectations for modern build tools. This issue proposes replacing the standard globbing mechanism with a library that supports recursive pattern matching (such as github.com/bmatcuk/doublestar) to allow flexible file selection across nested directory trees.

Goals

  • Recursive Matching: Enable users to define inputs using ** to match files in arbitrary subdirectories.
  • Determinism: Ensure that the order of resolved files remains strictly deterministic (lexicographically sorted) to preserve the stability of input hashes and caching.
  • Safety: Prevent infinite loops caused by symbolic links during recursive directory walking.

Acceptance Criteria

  • Core Syntax Support: The ResolveInputs method in internal/adapters/fs/resolver.go correctly expands patterns containing ** segments.
    • Example: src/**/*.go matches .go files in src/, src/foo/, and src/foo/bar/.
  • Deterministic Output: The list of resolved file paths is strictly sorted lexicographically before being returned, ensuring consistent hashes across different environments.
  • Symlink Safety: The walker either ignores symbolic links or implements cycle detection to prevent infinite recursion loop errors.
  • Test Coverage: New test cases in internal/adapters/fs/resolver_test.go verify:
    • Matching of deeply nested files.
    • Correct sorting of results.
    • Behavior when no files match the recursive pattern.
  • Dependency Management: A robust globbing library (e.g., doublestar) is added to go.mod if the standard library is insufficient.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions