fix(runner): single file input causes confusing internal fs error #49

Closed
opened 2026-05-25 14:23:59 +02:00 by michael · 0 comments
Owner

Problem

runner.lua passes the input path directly to fs.find_recursive() which
requires a directory. If a single file is given (e.g. fragjan code main.lua),
the user gets a confusing internal error:

[ERROR] fs: find_recursive 'main.lua': not a directory

Single-file input is a valid use case (e.g. fragjan article check article.md
already works via fs.read_file directly).

Fix

In runner.run, check fs.is_dir(dir) before calling collect_files:

  • directory: existing recursive scan path
  • file: treat as single-file target, skip collect_files

Also add an explicit check in core/commands/code.lua to give a clear
error or handle single-file input intentionally.

Acceptance criteria

  • Single file input does not produce internal fs error
  • Either: single file is accepted and checked
  • Or: clear user-facing error "expected a directory"
## Problem `runner.lua` passes the input path directly to `fs.find_recursive()` which requires a directory. If a single file is given (e.g. `fragjan code main.lua`), the user gets a confusing internal error: ``` [ERROR] fs: find_recursive 'main.lua': not a directory ``` Single-file input is a valid use case (e.g. `fragjan article check article.md` already works via `fs.read_file` directly). ## Fix In `runner.run`, check `fs.is_dir(dir)` before calling `collect_files`: - directory: existing recursive scan path - file: treat as single-file target, skip collect_files Also add an explicit check in `core/commands/code.lua` to give a clear error or handle single-file input intentionally. ## Acceptance criteria - [ ] Single file input does not produce internal fs error - [ ] Either: single file is accepted and checked - [ ] Or: clear user-facing error "expected a directory"
michael added this to the Basic Version milestone 2026-05-30 16:05:00 +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#49
No description provided.