fix(detect): detect_version reads VERSION directly instead of using lib/merkwerk.lua #52

Open
opened 2026-05-25 14:35:57 +02:00 by michael · 0 comments
Owner

Problem

core/detect.lua reads the VERSION file directly:

local content, _ = fs.read_file(dir .. "/VERSION")

The correct approach is to use lib/merkwerk.lua which is copied by
merkwerk init and handles all version tasks. It returns ?.?.? when
missing -- which is the defined behavior for standalone use without merkwerk.

Reading VERSION directly is fragile and bypasses the established contract.

Fix

Replace detect_version implementation with require("merkwerk").version()
or equivalent call via lib/merkwerk.lua.

Acceptance criteria

  • detect_version uses lib/merkwerk.lua
  • Missing lib/merkwerk.lua returns ?.?.? (standalone mode)
  • VERSION file no longer read directly in detect.lua
## Problem `core/detect.lua` reads the `VERSION` file directly: ```lua local content, _ = fs.read_file(dir .. "/VERSION") ``` The correct approach is to use `lib/merkwerk.lua` which is copied by `merkwerk init` and handles all version tasks. It returns `?.?.?` when missing -- which is the defined behavior for standalone use without merkwerk. Reading `VERSION` directly is fragile and bypasses the established contract. ## Fix Replace `detect_version` implementation with `require("merkwerk").version()` or equivalent call via `lib/merkwerk.lua`. ## Acceptance criteria - [ ] `detect_version` uses `lib/merkwerk.lua` - [ ] Missing `lib/merkwerk.lua` returns `?.?.?` (standalone mode) - [ ] `VERSION` file no longer read directly in detect.lua
michael added this to the Basic Version milestone 2026-05-30 16:08:41 +02:00
Sign in to join this conversation.
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#52
No description provided.