forked from
anil.recoil.org/monopam
Monorepo management for opam overlays
1(*---------------------------------------------------------------------------
2 Copyright (c) 2026 Anil Madhavapeddy <anil@recoil.org>. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** High-level query interface for changes.
7
8 This module provides convenient functions for querying changes since a
9 specific timestamp and formatting them for broadcast. *)
10
11(** {1 Querying Changes} *)
12
13val changes_since :
14 fs:_ Eio.Path.t ->
15 changes_dir:Fpath.t ->
16 since:Ptime.t ->
17 now:Ptime.t ->
18 (Changes_aggregated.entry list, string) result
19(** [changes_since ~fs ~changes_dir ~since ~now] returns all change entries from
20 aggregated files created after [since]. Returns entries from all days after
21 the timestamp.
22 @param now Current time for determining the date range end. *)
23
24val has_new_changes :
25 fs:_ Eio.Path.t -> changes_dir:Fpath.t -> since:Ptime.t -> now:Ptime.t -> bool
26(** Check if there are any new changes since the given timestamp.
27 @param now Current time for determining the date range end. *)
28
29(** {1 Formatting} *)
30
31val format_for_zulip :
32 entries:Changes_aggregated.entry list ->
33 include_date:bool ->
34 date:string option ->
35 string
36(** [format_for_zulip ~entries ~include_date ~date] formats entries as markdown
37 suitable for Zulip. If [include_date] is true, includes a date header.
38 [date] is used for the header if provided. *)
39
40val format_summary : entries:Changes_aggregated.entry list -> string
41(** Format a brief summary of the changes. *)
42
43(** {1 Daily Changes (Real-time)} *)
44
45val daily_changes_since :
46 fs:_ Eio.Path.t ->
47 changes_dir:Fpath.t ->
48 since:Ptime.t ->
49 Changes_daily.entry list
50(** [daily_changes_since ~fs ~changes_dir ~since] returns all daily change
51 entries created after [since] timestamp. Uses the per-day-per-repo files for
52 real-time access. *)
53
54val has_new_daily_changes :
55 fs:_ Eio.Path.t -> changes_dir:Fpath.t -> since:Ptime.t -> bool
56(** Check if there are any new daily changes since the given timestamp. *)
57
58val format_daily_for_zulip :
59 entries:Changes_daily.entry list ->
60 include_date:bool ->
61 date:string option ->
62 string
63(** Format daily entries as markdown suitable for Zulip. Groups entries by
64 repository. *)
65
66val format_daily_summary : entries:Changes_daily.entry list -> string
67(** Format a brief summary of daily changes. *)