feat(runner): flexible scan targets -- file_include, glob patterns, single file, auto-root detection #102

Closed
opened 2026-05-30 21:14:36 +02:00 by michael · 1 comment
Owner

Goal

Extend the runner with flexible scan target support:
file_include, glob patterns, single file scanning, and automatic
project root detection.

Background

Several open issues are blocked by runner limitations:

Additionally, scanning a subdirectory or single file currently loses
the project root -- .fragjan is not found and fragjan aborts.

Requirements

1. Glob patterns in file_exclude and file_include

  • * -- single path segment wildcard (current flat prefix already works)
  • ** -- recursive directory wildcard
  • Single filename without path (e.g. main.lua)

Examples:

file_exclude: "lib/**,test/**,main.lua"
file_include: "adapters/**,test/*.lua"

2. file_include

Whitelist for paths/files to scan. When present, only files matching
at least one include pattern are scanned. Supports the same glob syntax
as file_exclude.

3. Single file as scan target

fragjan code core/commands.lua
fragjan code core/

Runner accepts a file or subdirectory as scan target instead of
project root.

4. Automatic project root detection

When the scan target is not the project root, fragjan searches upward
for .fragjan (same approach as git for .git).

Override: --dotfragjan=../../.fragjan

Affected files

  • core/runner/init.lua (is_excluded, collect_files, file_include)
  • core/detect.lua (find_project_root upward search)
  • core/commands/code.lua (pass root separately from scan target)

Acceptance Criteria

  • ** glob supported in file_exclude
  • file_include supported with glob patterns
  • Single file and subdirectory as scan target
  • Project root detected automatically by walking upward
  • --dotfragjan override supported
  • Existing flat excludes continue to work unchanged
  • DAW/fragjan#33, DAW/fragjan#81, DAW/fragjan#88, DAW/fragjan#89 unblocked
## Goal Extend the runner with flexible scan target support: file_include, glob patterns, single file scanning, and automatic project root detection. ## Background Several open issues are blocked by runner limitations: - DAW/fragjan#88 -- ** glob in file_exclude - DAW/fragjan#33 -- adapter-has-contracts needs file_include - DAW/fragjan#81 -- test/*.lua as file_pattern - DAW/fragjan#89 -- no-direct-sys-new needs single-file exclude Additionally, scanning a subdirectory or single file currently loses the project root -- .fragjan is not found and fragjan aborts. ## Requirements ### 1. Glob patterns in file_exclude and file_include - `*` -- single path segment wildcard (current flat prefix already works) - `**` -- recursive directory wildcard - Single filename without path (e.g. `main.lua`) Examples: ```yaml file_exclude: "lib/**,test/**,main.lua" file_include: "adapters/**,test/*.lua" ``` ### 2. file_include Whitelist for paths/files to scan. When present, only files matching at least one include pattern are scanned. Supports the same glob syntax as file_exclude. ### 3. Single file as scan target ``` fragjan code core/commands.lua fragjan code core/ ``` Runner accepts a file or subdirectory as scan target instead of project root. ### 4. Automatic project root detection When the scan target is not the project root, fragjan searches upward for .fragjan (same approach as git for .git). Override: `--dotfragjan=../../.fragjan` ## Affected files - core/runner/init.lua (is_excluded, collect_files, file_include) - core/detect.lua (find_project_root upward search) - core/commands/code.lua (pass root separately from scan target) ## Acceptance Criteria - [ ] ** glob supported in file_exclude - [ ] file_include supported with glob patterns - [ ] Single file and subdirectory as scan target - [ ] Project root detected automatically by walking upward - [ ] --dotfragjan override supported - [ ] Existing flat excludes continue to work unchanged - [ ] DAW/fragjan#33, DAW/fragjan#81, DAW/fragjan#88, DAW/fragjan#89 unblocked ## Related - DAW/fragjan#33 (adapter-has-contracts) - DAW/fragjan#81 (expected param for pattern) - DAW/fragjan#88 (** glob in file_exclude) - DAW/fragjan#89 (direct I/O adapter bypass)
michael added this to the Basic Version milestone 2026-05-30 21:17:54 +02:00
Author
Owner

Completed in v0.2.10

  • find_project_root() added to core/detect.lua -- walks upward until .fragjan found
  • scan_target and project_root separated in core/commands/code.lua
  • --dotfragjan flag added to override project root detection
  • glob_match() added to core/runner/init.lua -- supports * and ** patterns
  • file_include support added (when.file_include in rule YAML)
  • Single file and subdirectory accepted as scan target
  • project-type rules skipped silently for single-file targets
  • rel paths in results always relative to project_root
  • fs.abspath() added to daw.common.fs via DAW/daw-lua-common#31

Unblocks DAW/fragjan#33, DAW/fragjan#81, DAW/fragjan#88, DAW/fragjan#89

## Completed in v0.2.10 - find_project_root() added to core/detect.lua -- walks upward until .fragjan found - scan_target and project_root separated in core/commands/code.lua - --dotfragjan flag added to override project root detection - glob_match() added to core/runner/init.lua -- supports * and ** patterns - file_include support added (when.file_include in rule YAML) - Single file and subdirectory accepted as scan target - project-type rules skipped silently for single-file targets - rel paths in results always relative to project_root - fs.abspath() added to daw.common.fs via DAW/daw-lua-common#31 Unblocks DAW/fragjan#33, DAW/fragjan#81, DAW/fragjan#88, DAW/fragjan#89
michael 2026-05-31 08:36:08 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#102
No description provided.