feat(architecture): route output through berhtjan instead of direct sys calls #90

Closed
opened 2026-05-27 08:11:10 +02:00 by michael · 8 comments
Owner

Problem

fragjan currently outputs directly via daw.common.sys instead of routing
through berhtjan. This bypasses the UI adapter layer and binds fragjan
to CLI output.

The correct output chain is:

fragjan core -> fragjan_result/v1 -> berhtjan-cli -> Terminal
-> berhtjan-api -> HTTP
-> berhtjan-web -> Browser

Current violation

core/commands.lua:
return require("daw.common.sys").new()

reporter.lua writes directly to a sys instance instead of handing
fragjan_result/v1 tables to a berhtjan renderer.

Goal

  • fragjan core produces fragjan_result/v1 tables only
  • Output is handled by a berhtjan renderer module
  • fragjan has no knowledge of the output target
  • Switching from CLI to API requires zero core changes

Dependencies

  • berhtjan-cli must implement a fragjan_result/v1 renderer
  • Depends on DAW/fragjan#88 (file_exclude glob) and DAW/fragjan#89
    (adapter bypass detection) for validation

Notes

This is a larger architectural change. Current sys-based output is a
known temporary shortcut -- tracked here for intentional resolution.

## Problem fragjan currently outputs directly via daw.common.sys instead of routing through berhtjan. This bypasses the UI adapter layer and binds fragjan to CLI output. The correct output chain is: fragjan core -> fragjan_result/v1 -> berhtjan-cli -> Terminal -> berhtjan-api -> HTTP -> berhtjan-web -> Browser ## Current violation core/commands.lua: return require("daw.common.sys").new() reporter.lua writes directly to a sys instance instead of handing fragjan_result/v1 tables to a berhtjan renderer. ## Goal - fragjan core produces fragjan_result/v1 tables only - Output is handled by a berhtjan renderer module - fragjan has no knowledge of the output target - Switching from CLI to API requires zero core changes ## Dependencies - berhtjan-cli must implement a fragjan_result/v1 renderer - Depends on DAW/fragjan#88 (file_exclude glob) and DAW/fragjan#89 (adapter bypass detection) for validation ## Notes This is a larger architectural change. Current sys-based output is a known temporary shortcut -- tracked here for intentional resolution.
Author
Owner

Correction: output must route through adapters/ui (the existing UI adapter), not directly to berhtjan. adapters/ui decides which berhtjan module handles output. core/ never touches modules directly.

Correct chain:
fragjan core -> adapters/ui -> berhtjan-cli -> Terminal
-> berhtjan-api -> HTTP
-> berhtjan-web -> Browser

adapters/ui needs to be extended with output operations in addition to the existing dispatch.

Correction: output must route through adapters/ui (the existing UI adapter), not directly to berhtjan. adapters/ui decides which berhtjan module handles output. core/ never touches modules directly. Correct chain: fragjan core -> adapters/ui -> berhtjan-cli -> Terminal -> berhtjan-api -> HTTP -> berhtjan-web -> Browser adapters/ui needs to be extended with output operations in addition to the existing dispatch.
michael added this to the Basic Version milestone 2026-05-30 16:08:42 +02:00
Author
Owner

Concept clarification

What fragjan_result/v1 looks like

Defined in fragjan-konzept.md:

schema: fragjan_result/v1
rule_id:    string
primitive:  string
target:
  type: file
  file: string
status:     pass|warn|error|skip
metrics:    {}        -- primitive-specific
message:
  text: string
timestamps:
  checked_at: string

reporter.lua already uses r.status and r.message.text -- the fields
are there, only the output path is wrong.

Correct chain (confirmed)

reporter.lua  -- produces fragjan_result/v1 tables (logic stays here)
adapters/ui   -- receives tables, routes to berhtjan module
berhtjan-cli  -- renders fields, no logic

berhtjan receives fields to display. Business logic stays in reporter.lua.

Concrete changes required

reporter.lua

  • Remove out parameter from M.report()
  • Return result table instead of writing directly
  • Signature: report(...) -> { results, summary, exit_code }, nil

adapters/ui (DAW/fragjan)

  • Add render operation to _contracts and required_ops()
  • Contract: render(fragjan_result_set) -> true, nil | nil, err
  • fragjan_result_set = { results, summary, exit_code, suppressions }

berhtjan-cli

  • Add fragjan_result/v1 renderer
  • Formats: [WARN]/[ERROR]/[INFO]/[SUMMARY] lines to stdout/stderr
  • ANSI color rendering moves here (currently in reporter.lua get_label())

core/commands/init.lua

  • Remove newout() -- direct sys call no longer needed
  • Output goes through adapters/ui.render()

Dependencies

  • DAW/fragjan#97 / adapters/log contract must be defined in parallel
    (log output also routes through adapters/ui, not sys directly)
  • DAW/fragjan#95 (daw.common.log) depends on adapters/log contract

Open question

render() operation name vs. report() -- to be decided when
adapters/ui output operations are defined.

## Concept clarification ### What fragjan_result/v1 looks like Defined in fragjan-konzept.md: ``` schema: fragjan_result/v1 rule_id: string primitive: string target: type: file file: string status: pass|warn|error|skip metrics: {} -- primitive-specific message: text: string timestamps: checked_at: string ``` reporter.lua already uses r.status and r.message.text -- the fields are there, only the output path is wrong. ### Correct chain (confirmed) ``` reporter.lua -- produces fragjan_result/v1 tables (logic stays here) adapters/ui -- receives tables, routes to berhtjan module berhtjan-cli -- renders fields, no logic ``` berhtjan receives fields to display. Business logic stays in reporter.lua. ### Concrete changes required **reporter.lua** - Remove `out` parameter from M.report() - Return result table instead of writing directly - Signature: report(...) -> { results, summary, exit_code }, nil **adapters/ui (DAW/fragjan)** - Add `render` operation to _contracts and required_ops() - Contract: render(fragjan_result_set) -> true, nil | nil, err - fragjan_result_set = { results, summary, exit_code, suppressions } **berhtjan-cli** - Add fragjan_result/v1 renderer - Formats: [WARN]/[ERROR]/[INFO]/[SUMMARY] lines to stdout/stderr - ANSI color rendering moves here (currently in reporter.lua get_label()) **core/commands/init.lua** - Remove newout() -- direct sys call no longer needed - Output goes through adapters/ui.render() ### Dependencies - DAW/fragjan#97 / adapters/log contract must be defined in parallel (log output also routes through adapters/ui, not sys directly) - DAW/fragjan#95 (daw.common.log) depends on adapters/log contract ### Open question render() operation name vs. report() -- to be decided when adapters/ui output operations are defined.
Author
Owner

Concept clarification (revised)

What fragjan_result/v1 looks like

Defined in fragjan-konzept.md:

schema: fragjan_result/v1
rule_id:    string
primitive:  string
target:
  type: file
  file: string
status:     pass|warn|error|skip
metrics:    {}        -- primitive-specific
message:
  text: string
timestamps:
  checked_at: string

Correct chain (confirmed)

reporter.lua  -- produces list of fragjan_result/v1 tables (no output, no berhtjan knowledge)
adapters/ui   -- translates fragjan_result/v1 -> berhtjan field types (text, number, ...)
berhtjan-cli  -- renders fields only, zero fragjan knowledge

reporter.lua knows nothing about berhtjan. adapters/ui is the
translation layer -- it knows what fragjan delivers and what
berhtjan expects. berhtjan-cli renders generic fields.

Concrete changes required

reporter.lua

  • Remove out parameter from M.report()
  • Return result list instead of writing directly
  • Signature: report(...) -> { results, summary, exit_code, suppressions }, nil

adapters/ui (DAW/fragjan)

  • Add render operation to _contracts and required_ops()
  • Translates fragjan_result/v1 list -> berhtjan field records
  • ANSI color logic moves here (currently in reporter.lua get_label())
  • Contract: render(fragjan_result_set) -> true, nil | nil, err

berhtjan-cli

  • No fragjan-specific code
  • Renders generic field records via existing render_record()

core/commands/init.lua

  • Remove newout() -- direct sys call no longer needed
  • Pass reporter output to adapters/ui.render()

Dependencies

  • DAW/fragjan#97 / adapters/log contract must be defined in parallel
    (log output also routes through adapters/ui, not sys directly)
  • DAW/fragjan#95 (daw.common.log) depends on adapters/log contract
## Concept clarification (revised) ### What fragjan_result/v1 looks like Defined in fragjan-konzept.md: ``` schema: fragjan_result/v1 rule_id: string primitive: string target: type: file file: string status: pass|warn|error|skip metrics: {} -- primitive-specific message: text: string timestamps: checked_at: string ``` ### Correct chain (confirmed) ``` reporter.lua -- produces list of fragjan_result/v1 tables (no output, no berhtjan knowledge) adapters/ui -- translates fragjan_result/v1 -> berhtjan field types (text, number, ...) berhtjan-cli -- renders fields only, zero fragjan knowledge ``` reporter.lua knows nothing about berhtjan. adapters/ui is the translation layer -- it knows what fragjan delivers and what berhtjan expects. berhtjan-cli renders generic fields. ### Concrete changes required **reporter.lua** - Remove `out` parameter from M.report() - Return result list instead of writing directly - Signature: report(...) -> { results, summary, exit_code, suppressions }, nil **adapters/ui (DAW/fragjan)** - Add `render` operation to _contracts and required_ops() - Translates fragjan_result/v1 list -> berhtjan field records - ANSI color logic moves here (currently in reporter.lua get_label()) - Contract: render(fragjan_result_set) -> true, nil | nil, err **berhtjan-cli** - No fragjan-specific code - Renders generic field records via existing render_record() **core/commands/init.lua** - Remove newout() -- direct sys call no longer needed - Pass reporter output to adapters/ui.render() ### Dependencies - DAW/fragjan#97 / adapters/log contract must be defined in parallel (log output also routes through adapters/ui, not sys directly) - DAW/fragjan#95 (daw.common.log) depends on adapters/log contract
Author
Owner

Concept clarification (revised)

What fragjan_result/v1 looks like

Defined in fragjan-konzept.md:

schema: fragjan_result/v1
rule_id:    string
primitive:  string
target:
  type: file
  file: string
status:     pass|warn|error|skip
metrics:    {}        -- primitive-specific
message:
  text: string
timestamps:
  checked_at: string

Correct chain (confirmed)

reporter.lua  -- produces list of fragjan_result/v1 tables (no output, no berhtjan knowledge)
adapters/ui   -- translates fragjan_result/v1 -> berhtjan field types (text, number, ...)
berhtjan-cli  -- renders fields only, zero fragjan knowledge

reporter.lua knows nothing about berhtjan. adapters/ui is the
translation layer -- it knows what fragjan delivers and what
berhtjan expects. berhtjan-cli renders generic fields.

Concrete changes required

reporter.lua

  • Remove out parameter from M.report()
  • Return result list instead of writing directly
  • Signature: report(...) -> { results, summary, exit_code, suppressions }, nil

adapters/ui (DAW/fragjan)

  • Add render operation to _contracts and required_ops()
  • Translates fragjan_result/v1 list -> berhtjan field records
  • ANSI color logic moves here (currently in reporter.lua get_label())
  • Contract: render(fragjan_result_set) -> true, nil | nil, err

berhtjan-cli

  • No fragjan-specific code
  • Renders generic field records via existing render_record()

core/commands/init.lua

  • Remove newout() -- direct sys call no longer needed
  • Pass reporter output to adapters/ui.render()

Dependencies

  • DAW/fragjan#97 / adapters/log contract must be defined in parallel
    (log output also routes through adapters/ui, not sys directly)
  • DAW/fragjan#95 (daw.common.log) depends on adapters/log contract
## Concept clarification (revised) ### What fragjan_result/v1 looks like Defined in fragjan-konzept.md: ``` schema: fragjan_result/v1 rule_id: string primitive: string target: type: file file: string status: pass|warn|error|skip metrics: {} -- primitive-specific message: text: string timestamps: checked_at: string ``` ### Correct chain (confirmed) ``` reporter.lua -- produces list of fragjan_result/v1 tables (no output, no berhtjan knowledge) adapters/ui -- translates fragjan_result/v1 -> berhtjan field types (text, number, ...) berhtjan-cli -- renders fields only, zero fragjan knowledge ``` reporter.lua knows nothing about berhtjan. adapters/ui is the translation layer -- it knows what fragjan delivers and what berhtjan expects. berhtjan-cli renders generic fields. ### Concrete changes required **reporter.lua** - Remove `out` parameter from M.report() - Return result list instead of writing directly - Signature: report(...) -> { results, summary, exit_code, suppressions }, nil **adapters/ui (DAW/fragjan)** - Add `render` operation to _contracts and required_ops() - Translates fragjan_result/v1 list -> berhtjan field records - ANSI color logic moves here (currently in reporter.lua get_label()) - Contract: render(fragjan_result_set) -> true, nil | nil, err **berhtjan-cli** - No fragjan-specific code - Renders generic field records via existing render_record() **core/commands/init.lua** - Remove newout() -- direct sys call no longer needed - Pass reporter output to adapters/ui.render() ### Dependencies - DAW/fragjan#97 / adapters/log contract must be defined in parallel (log output also routes through adapters/ui, not sys directly) - DAW/fragjan#95 (daw.common.log) depends on adapters/log contract
Author
Owner

Next step: extend adapters/ui with render()

adapters/ui/init.lua changes

Add _contracts table:

M._contracts = {
  dispatch = "result_or_err",
  render   = "bool_or_err",
}

Add render() function:

-- Render a fragjan_result_set via berhtjan-cli.
-- result_set = { results, summary, exit_code, suppressions }
-- Translates fragjan_result/v1 -> berhtjan field records.
-- Returns true, nil | nil, err
function M.render(result_set, cfg)
  local ok, cli = pcall(require, "modules.berhtjan-cli.render")
  if not ok then
    return nil, "[ERROR] adapters.ui: berhtjan-cli not available: "
                .. tostring(cli)
  end

  for _, r in ipairs(result_set.results or {}) do
    local label = r.status:upper()
    cli.render_record({ text = "[" .. label .. "] " .. r.message.text },
      { { id = "text" } })
  end

  for _, s in ipairs(result_set.suppressions or {}) do
    cli.render_record(
      { text = "[INFO] suppressed: " .. s.rule_id .. " " .. s.file .. ":" .. s.line .. " -- " .. s.reason },
      { { id = "text" } })
  end

  cli.render_record({ text = "[SUMMARY] " .. result_set.summary },
    { { id = "text" } })

  return true, nil
end

Notes

  • ANSI color logic moves here from reporter.lua get_label() in a follow-up
  • reporter.lua refactor (remove out parameter) follows after this is in place
  • core/commands/init.lua newout() removal follows last
## Next step: extend adapters/ui with render() ### adapters/ui/init.lua changes Add _contracts table: ```lua M._contracts = { dispatch = "result_or_err", render = "bool_or_err", } ``` Add render() function: ```lua -- Render a fragjan_result_set via berhtjan-cli. -- result_set = { results, summary, exit_code, suppressions } -- Translates fragjan_result/v1 -> berhtjan field records. -- Returns true, nil | nil, err function M.render(result_set, cfg) local ok, cli = pcall(require, "modules.berhtjan-cli.render") if not ok then return nil, "[ERROR] adapters.ui: berhtjan-cli not available: " .. tostring(cli) end for _, r in ipairs(result_set.results or {}) do local label = r.status:upper() cli.render_record({ text = "[" .. label .. "] " .. r.message.text }, { { id = "text" } }) end for _, s in ipairs(result_set.suppressions or {}) do cli.render_record( { text = "[INFO] suppressed: " .. s.rule_id .. " " .. s.file .. ":" .. s.line .. " -- " .. s.reason }, { { id = "text" } }) end cli.render_record({ text = "[SUMMARY] " .. result_set.summary }, { { id = "text" } }) return true, nil end ``` ### Notes - ANSI color logic moves here from reporter.lua get_label() in a follow-up - reporter.lua refactor (remove out parameter) follows after this is in place - core/commands/init.lua newout() removal follows last
Author
Owner

Next step: extend adapters/ui with render()

Design decision: generic render() with schema-versioned types

render() dispatches by schema string -- same pattern as fragjan_result/v1.
Unknown type returns nil, err. New types add a dispatcher entry, no contract change.

Known types (Phase 1):
fragjan_result/v1 -- fragjan check results, summary, suppressions
daw_log/v1 -- log message (level, module, text)

daw_log/v1 is the shared format for adapters/ui (display) and
adapters/log (persistence) -- same type, two possible sinks.

adapters/ui/init.lua changes

M._contracts = {
  dispatch = "result_or_err",
  render   = "bool_or_err",
}

local renderers = {}

local function render_fragjan_result(data, cli)
  for _, r in ipairs(data.results or {}) do
    local label = "[" .. r.status:upper() .. "]"
    cli.render_record({ text = label .. " " .. r.message.text }, {{ id = "text" }})
  end
  for _, s in ipairs(data.suppressions or {}) do
    cli.render_record(
      { text = "[INFO] suppressed: " .. s.rule_id .. " "
               .. s.file .. ":" .. s.line .. " -- " .. s.reason },
      {{ id = "text" }})
  end
  cli.render_record({ text = "[SUMMARY] " .. data.summary }, {{ id = "text" }})
  return true, nil
end

local function render_daw_log(data, cli)
  cli.render_record(
    { text = "[" .. (data.level or "INFO") .. "] "
             .. (data.module or "") .. ": " .. (data.text or "") },
    {{ id = "text" }})
  return true, nil
end

renderers["fragjan_result/v1"] = render_fragjan_result
renderers["daw_log/v1"]        = render_daw_log

function M.render(schema, data)
  local ok, cli = pcall(require, "modules.berhtjan-cli.render")
  if not ok then
    return nil, "[ERROR] adapters.ui: berhtjan-cli not available: " .. tostring(cli)
  end
  local fn = renderers[schema]
  if not fn then
    return nil, "[ERROR] adapters.ui: unknown render schema: " .. tostring(schema)
  end
  return fn(data, cli)
end

Notes

  • ANSI color logic moves here from reporter.lua get_label() in a follow-up
  • reporter.lua refactor (remove out parameter) follows after this is in place
  • core/commands/init.lua newout() removal follows last
  • adapters/log will consume daw_log/v1 as well (DAW/fragjan#97)
## Next step: extend adapters/ui with render() ### Design decision: generic render() with schema-versioned types render() dispatches by schema string -- same pattern as fragjan_result/v1. Unknown type returns nil, err. New types add a dispatcher entry, no contract change. Known types (Phase 1): fragjan_result/v1 -- fragjan check results, summary, suppressions daw_log/v1 -- log message (level, module, text) daw_log/v1 is the shared format for adapters/ui (display) and adapters/log (persistence) -- same type, two possible sinks. ### adapters/ui/init.lua changes ```lua M._contracts = { dispatch = "result_or_err", render = "bool_or_err", } local renderers = {} local function render_fragjan_result(data, cli) for _, r in ipairs(data.results or {}) do local label = "[" .. r.status:upper() .. "]" cli.render_record({ text = label .. " " .. r.message.text }, {{ id = "text" }}) end for _, s in ipairs(data.suppressions or {}) do cli.render_record( { text = "[INFO] suppressed: " .. s.rule_id .. " " .. s.file .. ":" .. s.line .. " -- " .. s.reason }, {{ id = "text" }}) end cli.render_record({ text = "[SUMMARY] " .. data.summary }, {{ id = "text" }}) return true, nil end local function render_daw_log(data, cli) cli.render_record( { text = "[" .. (data.level or "INFO") .. "] " .. (data.module or "") .. ": " .. (data.text or "") }, {{ id = "text" }}) return true, nil end renderers["fragjan_result/v1"] = render_fragjan_result renderers["daw_log/v1"] = render_daw_log function M.render(schema, data) local ok, cli = pcall(require, "modules.berhtjan-cli.render") if not ok then return nil, "[ERROR] adapters.ui: berhtjan-cli not available: " .. tostring(cli) end local fn = renderers[schema] if not fn then return nil, "[ERROR] adapters.ui: unknown render schema: " .. tostring(schema) end return fn(data, cli) end ``` ### Notes - ANSI color logic moves here from reporter.lua get_label() in a follow-up - reporter.lua refactor (remove out parameter) follows after this is in place - core/commands/init.lua newout() removal follows last - adapters/log will consume daw_log/v1 as well (DAW/fragjan#97)
Author
Owner

Next step: extend adapters/ui with render() [current decision]

Translation chain

fragjan_result/v1  ->  adapters/ui  ->  ui_types/v1  ->  berhtjan-cli/web/api/desktop
daw_log/v1         ->  adapters/ui  ->  ui_types/v1  ->  berhtjan-cli/web/api/desktop

adapters/ui is the translation layer. It knows fragjan schemas and
converts them to ui_types/v1 (berhtjan-core primitives: text, textarea,
number, boolean, select, date). berhtjan never sees fragjan-specific
structures.

adapters/ui/init.lua changes

Add _contracts:

M._contracts = {
  dispatch = "result_or_err",
  render   = "bool_or_err",
}

Add schema dispatcher and render():

local renderers = {}

local function render_fragjan_result(data)
  local fields = { { id = "text" } }
  local records = {}
  for _, r in ipairs(data.results or {}) do
    table.insert(records, { text = "[" .. r.status:upper() .. "] " .. r.message.text })
  end
  for _, s in ipairs(data.suppressions or {}) do
    table.insert(records, { text = "[INFO] suppressed: " .. s.rule_id
      .. " " .. s.file .. ":" .. s.line .. " -- " .. s.reason })
  end
  table.insert(records, { text = "[SUMMARY] " .. (data.summary or "") })
  return records, fields
end

local function render_daw_log(data)
  local fields = { { id = "text" } }
  local records = {
    { text = "[" .. (data.level or "INFO") .. "] "
             .. (data.module or "") .. ": " .. (data.text or "") }
  }
  return records, fields
end

renderers["fragjan_result/v1"] = render_fragjan_result
renderers["daw_log/v1"]        = render_daw_log

function M.render(data, cfg)
  local schema = data and data.schema
  if not schema then
    return nil, "[ERROR] adapters.ui: missing schema in render data"
  end
  local fn = renderers[schema]
  if not fn then
    return nil, "[ERROR] adapters.ui: unknown schema: " .. tostring(schema)
  end

  local resolved, err = mod_modules.resolve(cfg.modules_dir, "ui", cfg)
  if not resolved then return nil, err end

  local records, fields = fn(data)
  for _, mod in ipairs(resolved.providers) do
    for _, record in ipairs(records) do
      mod.render_record(record, fields)
    end
  end
  return true, nil
end

required_ops extension

render() must be added to required_ops() so check() validates
all UI providers implement it:

function M.required_ops()
  return { "dispatch", "build_usage", "render" }
end

Notes

  • ANSI color logic moves here from reporter.lua get_label() in follow-up
  • reporter.lua refactor (remove out parameter) follows after this is in place
  • core/commands/init.lua newout() removal follows last
  • adapters/log consumes daw_log/v1 as well (DAW/fragjan#97)
## Next step: extend adapters/ui with render() [current decision] ### Translation chain ``` fragjan_result/v1 -> adapters/ui -> ui_types/v1 -> berhtjan-cli/web/api/desktop daw_log/v1 -> adapters/ui -> ui_types/v1 -> berhtjan-cli/web/api/desktop ``` adapters/ui is the translation layer. It knows fragjan schemas and converts them to ui_types/v1 (berhtjan-core primitives: text, textarea, number, boolean, select, date). berhtjan never sees fragjan-specific structures. ### adapters/ui/init.lua changes Add _contracts: ```lua M._contracts = { dispatch = "result_or_err", render = "bool_or_err", } ``` Add schema dispatcher and render(): ```lua local renderers = {} local function render_fragjan_result(data) local fields = { { id = "text" } } local records = {} for _, r in ipairs(data.results or {}) do table.insert(records, { text = "[" .. r.status:upper() .. "] " .. r.message.text }) end for _, s in ipairs(data.suppressions or {}) do table.insert(records, { text = "[INFO] suppressed: " .. s.rule_id .. " " .. s.file .. ":" .. s.line .. " -- " .. s.reason }) end table.insert(records, { text = "[SUMMARY] " .. (data.summary or "") }) return records, fields end local function render_daw_log(data) local fields = { { id = "text" } } local records = { { text = "[" .. (data.level or "INFO") .. "] " .. (data.module or "") .. ": " .. (data.text or "") } } return records, fields end renderers["fragjan_result/v1"] = render_fragjan_result renderers["daw_log/v1"] = render_daw_log function M.render(data, cfg) local schema = data and data.schema if not schema then return nil, "[ERROR] adapters.ui: missing schema in render data" end local fn = renderers[schema] if not fn then return nil, "[ERROR] adapters.ui: unknown schema: " .. tostring(schema) end local resolved, err = mod_modules.resolve(cfg.modules_dir, "ui", cfg) if not resolved then return nil, err end local records, fields = fn(data) for _, mod in ipairs(resolved.providers) do for _, record in ipairs(records) do mod.render_record(record, fields) end end return true, nil end ``` ### required_ops extension render() must be added to required_ops() so check() validates all UI providers implement it: ```lua function M.required_ops() return { "dispatch", "build_usage", "render" } end ``` ### Notes - ANSI color logic moves here from reporter.lua get_label() in follow-up - reporter.lua refactor (remove out parameter) follows after this is in place - core/commands/init.lua newout() removal follows last - adapters/log consumes daw_log/v1 as well (DAW/fragjan#97)
Author
Owner

Completed in v0.3.0

Full output chain implemented and deployed.

Final chain

reporter.lua -> fragjan_result/v1 -> adapters/ui -> ui_types/v1 -> berhtjan-cli

What changed

  • adapters/ui: render() with schema dispatcher (fragjan_result/v1, daw_log/v1)
  • core/reporter: no direct output, returns result_set table
  • core/commands/code, article, init: output via adapters/ui.render(), newout() removed
  • core/runner/file, project: debug output via adapters/ui, ctx added to signature
  • verbose output correctly separated as daw_log/v1
  • berhtjan-cli: render() for ui_types/v1 (DAW/daw-modul-berhtjan-cli#8)
  • berhtjan-core: render() in required_ops() and _contracts (DAW/daw-modul-berhtjan-core#9)

Follow-up

  • DAW/fragjan#113 -- ui_layout/v1 (replaces interim single-text-field approach)
  • DAW/fragjan#114 -- tech-debt: interim render approach
  • adapters/ui/init.lua needs split (252 lines)
## Completed in v0.3.0 Full output chain implemented and deployed. ### Final chain reporter.lua -> fragjan_result/v1 -> adapters/ui -> ui_types/v1 -> berhtjan-cli ### What changed - adapters/ui: render() with schema dispatcher (fragjan_result/v1, daw_log/v1) - core/reporter: no direct output, returns result_set table - core/commands/code, article, init: output via adapters/ui.render(), newout() removed - core/runner/file, project: debug output via adapters/ui, ctx added to signature - verbose output correctly separated as daw_log/v1 - berhtjan-cli: render() for ui_types/v1 (DAW/daw-modul-berhtjan-cli#8) - berhtjan-core: render() in required_ops() and _contracts (DAW/daw-modul-berhtjan-core#9) ### Follow-up - DAW/fragjan#113 -- ui_layout/v1 (replaces interim single-text-field approach) - DAW/fragjan#114 -- tech-debt: interim render approach - adapters/ui/init.lua needs split (252 lines)
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#90
No description provided.