Skip to content

feat(report): emit markdown - #39

Merged
PeGa merged 1 commit into
mainfrom
feature/markdown-report
Sep 5, 2026
Merged

feat(report): emit markdown#39
PeGa merged 1 commit into
mainfrom
feature/markdown-report

Conversation

@PeGa

@PeGa PeGa commented Sep 5, 2026

Copy link
Copy Markdown
Owner

focus report now emits markdown on stdout. Same two queries, new renderer.

focus report custom 14 > report.md

Why

Notes are hand-written markdown — bullets, **bold**, > blockquotes. The old layout indented every note line behind a seven-space 📝 prefix, which turned all of it into code blocks, so producing a shareable report meant reassembling the output by hand.

Shape

# Focus report
## Last 14 days

Period: 2026-08-20 → 2026-09-03 Total: 67h 39m across 25 sessions

---

## Projects

| Project | Time | Sessions |
|---|---:|---:|
| `fyc/bloque-de-trabajo` | 12h 20m | 1 |

---

## Sessions

### [29] `fyc/deploy-wells-planning-develop-migrations`
**2026-09-02 18:45–01:45 · 7h 0m**

<note, verbatim>

Rules separate sessions from each other, so the last session isn't left with one dangling. An empty period stops after the period line rather than trailing a rule off a blank document.

Verified against real data

Rendering a 15-day window from a copy of the live DB and diffing the project table against an existing hand-assembled report: byte-identical rows, and all 25 of its sessions in identical order. The only differences were a session logged after that report was written, and the issue #36 duplicate row still present in the DB (fyc/sesion-de-trabajo id 13, same start timestamp to the second as id 12) — data, not rendering.

Notes

  • _report is the only thing rewritten. The today|week|month|custom dispatch, wants_help, db_ensure and usage_error are untouched; --help still exits 0 and bad arguments still exit 2.
  • Aggregation stays in SQL — no declare -A, so bash 3.2 still works (PORT-BASH32).
  • core/text.sh notes_block stays; off and past list still use it.
  • Table cells need no pipe escaping: the sessions table CHECKs that project names contain no |.
  • s/e now fall back to the stored string when a timestamp won't parse, matching past list — previously one unreadable timestamp aborted the whole report under set -e.

13 new assertions covering the skeleton, both time-line forms, unindented note bullets, no dangling rule, and the empty-period case. audit clean, state-matrix 154/154, time-portability 20/20.

Notes are hand-written markdown, and indenting every line behind a 📝 prefix
turned bullets and bold into code blocks, so a shareable report had to be
reassembled by hand. Same two queries, rendered as a period line, a project
table and one section per session, with notes printed verbatim.
@PeGa
PeGa merged commit 2359dc0 into main Sep 5, 2026
PeGa added a commit that referenced this pull request Sep 13, 2026
A-items settled:
- A11: CONV-DEADKNOB added (every config key has a live reader). Stale
  REPORT_LIMIT references deleted, CHECKIN_INTERVAL added to exports.
- A12: time-portability.sh added to acceptance oracle (MAIN.md test list,
  ARCH, BUILD-VERIFY, ACCEPT item 3). AGENTS.md updated: oracle references,
  build order (step 26), per-task format.
- A13: test-authoring norms added to AGENTS.md §3b (capture-then-match,
  fixtures through app's gears, determinism by config-coarsening).

Deferred #47 scope completed:
- DM-CYCLE, CMD-CYCLE, CMD-PERIOD clauses added (cycle breaks are
  informational delimiters, not periods; period resolution uses id ranges).
- PORT reads updated: list_cycles, list_sessions_by_id_range,
  get_project_totals_by_id_range, get_last_cycle_end, list_session_ids_by_project.
- CORE-TEXT surface updated: notes_merge_trail, is_session_id, cycle_prefix,
  cycle_label, is_cycle_label, cycle_note_placeholder.
- CMD-* sections updated: OFF (#36 fold), PAST (#51 validation, #36 fold,
  cycles subcommands, cycle-row truth), REPORT (markdown #39, cycle mode,
  exclusions), STATUS (#46 marker exclusion), CHECKIN (#35 desktop guard,
  five exits).
- CONV-PORTABLE clarified: architectural discipline (all time operations
  through core/time.sh), not just GNU/BSD divergence.
- [CRON] step-size guard documented (4c609f8).
- START_HERE sync: three oracles, two-tier CONV-YES, CONV-DEADKNOB,
  BUILD-VERIFY, Done check.
- Vocabulary fix: "id-window period views" → "the period listings".
- App-debt markers added: #40 (CMD-CONFIG), #41 (CRON-STRIP), #42 (CONV-YES),
  #43 (CMD-ON), #44 (CONV-IDEMPOTENT-ENABLE), #28 (BUILD-VERIFY).
- AGENTS.md: DM-DEAD grep comment-skip (^[^#]*).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant