converting loops

This commit is contained in:
ari committed 2026-11-17 14:22:28 -05:00
1 parent 956158729e
commit a1ebcfb6aa
5 files changed
+15 -15

No files matched your search

@@ -1,6 +1,6 @@
# .agents/workflows
# .agents/looprails
nbot-wf workflow files for this repo.
Looprail files for this repo.
## journal-triage
@@ -15,4 +15,4 @@ against this repo, and writes a report ranked by urgency to `.tmp/journal-report
- Inputs: `since` (default `24 hours ago`), `priority` (`err`, `warning`, `notice`),
`host` (default `fwbook`), `repo` (default `/home/ari/nixos-setup`).
Run: `nbot-wf run .agents/workflows/journal-triage.toml`, or ask the agent to run it.
Run: `looprail run .agents/looprails/journal-triage.toml`, or ask the agent to run it.
@@ -11,7 +11,7 @@ repo = { type = "string", description = "Path of the NixOS config repo.", min_le
kind = "shell"
description = "Collects journal warnings and failed units into a digest."
cwd = "{{ inputs.repo }}"
run = ["/usr/bin/env", "sh", ".agents/workflows/journal-triage/collect.sh {{ inputs.since }} {{ inputs.priority }}"]
run = ["sh .agents/looprails/journal-triage/collect.sh {{ inputs.since }} {{ inputs.priority }}"]
[step.collect.outputs]
raw_log = { type = "string", description = "Path of the full raw journal log." }
@@ -38,7 +38,7 @@ description = "Writes the report to .tmp/journal-reports."
needs = ["triage"]
run = [
"R={{ inputs.repo }}; mkdir -p \"$R/.tmp/journal-reports\"",
"S={{ steps.triage.outputs.summary }}; H={{ inputs.host }}; R={{ inputs.repo }}; f=\"$R/.tmp/journal-reports/$H-$(date +%Y-%m-%d-%H%M).md\"; printf '%s\\n' \"$S\" > \"$f\"; echo \"report=$f\" >> \"$NBOT_WF_OUTPUTS\"; echo \"Report written to $f\"",
"S={{ steps.triage.outputs.summary }}; H={{ inputs.host }}; R={{ inputs.repo }}; f=\"$R/.tmp/journal-reports/$H-$(date +%Y-%m-%d-%H%M).md\"; printf '%s\\n' \"$S\" > \"$f\"; echo \"report=$f\" >> \"$NBOT_LR_OUTPUTS\"; echo \"Report written to $f\"",
]
[step.report.outputs]
@@ -2,7 +2,7 @@
# Collect journald warnings+ and failed units into the run folder, plus a deduplicated digest.
set -eu
since="$1"; priority="$2"
dir="$NBOT_WF_RUN_DIR"
dir="$NBOT_LR_RUN_DIR"
raw="$dir/journal-raw.log"; digest="$dir/journal-digest.txt"
journalctl -p "$priority" --since "$since" --no-pager -q -o short-iso > "$raw" || true
@@ -23,4 +23,4 @@ journalctl -p "$priority" --since "$since" --no-pager -q -o short-iso > "$raw" |
lines=$(wc -l < "$raw")
uniq=$(grep -c '^ *[0-9]' "$digest" || true)
printf 'raw_log=%s\ndigest=%s\nlines=%s\nunique=%s\n' "$raw" "$digest" "$lines" "$uniq" >> "$NBOT_WF_OUTPUTS"
printf 'raw_log=%s\ndigest=%s\nlines=%s\nunique=%s\n' "$raw" "$digest" "$lines" "$uniq" >> "$NBOT_LR_OUTPUTS"