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(** Get all change entries from aggregated files created after [since]. Returns
20 entries from all days after the timestamp.
21 @param now Current time for determining the date range end. *)
22
23val has_new_changes :
24 fs:_ Eio.Path.t -> changes_dir:Fpath.t -> since:Ptime.t -> now:Ptime.t -> bool
25(** Check if there are any new changes since the given timestamp.
26 @param now Current time for determining the date range end. *)
27
28(** {1 Formatting} *)
29
30val format_for_zulip :
31 entries:Changes_aggregated.entry list ->
32 include_date:bool ->
33 date:string option ->
34 string
35(** Format entries as markdown suitable for Zulip. If [include_date] is true,
36 includes a date header. [date] is used for the header if provided. *)
37
38val format_summary : entries:Changes_aggregated.entry list -> string
39(** Format a brief summary of the changes. *)
40
41(** {1 Daily Changes (Real-time)} *)
42
43val daily_changes_since :
44 fs:_ Eio.Path.t ->
45 changes_dir:Fpath.t ->
46 since:Ptime.t ->
47 Changes_daily.entry list
48(** Get all daily change entries created after [since] timestamp. Uses the
49 per-day-per-repo files for real-time access. *)
50
51val has_new_daily_changes :
52 fs:_ Eio.Path.t -> changes_dir:Fpath.t -> since:Ptime.t -> bool
53(** Check if there are any new daily changes since the given timestamp. *)
54
55val format_daily_for_zulip :
56 entries:Changes_daily.entry list ->
57 include_date:bool ->
58 date:string option ->
59 string
60(** Format daily entries as markdown suitable for Zulip. Groups entries by
61 repository. *)
62
63val format_daily_summary : entries:Changes_daily.entry list -> string
64(** Format a brief summary of daily changes. *)