[OCaml] Mobile-friendly clone of cgit.
Apply dune fmt formatting
AGENTS.org
@@ -15,8 +15,8 @@
15
15
16
16
** Scope
17
17
18
Removed:
- The project SHALL implement a lightweight alternative to the cgit
19
Removed:
software.
18
Added:
- The project SHALL implement a lightweight, mobile-friendly
19
Added:
alternative to the cgit software.
20
20
21
21
* Architecture
22
22
@@ -54,8 +54,12 @@
54
54
** Version control system
55
55
56
56
- The project SHALL use Git as its version control system.
57
Removed:
- Commits created by an AI agent SHALL indicate so in the =user.name=
58
Removed:
and =user.email= fields.
57
Added:
- Commits created by an AI agent SHALL indicate so in the commit
58
Added:
fields:
59
Added:
- =user.name= :: concatenate agent model name, and intelligence or
60
Added:
reasoning level.
61
Added:
- =user.email= :: fictitious e-mail address identifying the agent's
62
Added:
parent company.
59
63
60
64
* Documentation
61
65
lib/config.ml
@@ -88,7 +88,15 @@
88
88
let* commits_max_displayed = find_int "commits_max_displayed" in
89
89
let* host = find_string_opt "host" ~default:default.host in
90
90
let* port = find_int_opt "port" ~default:default.port in
91
Removed:
Ok { git_project_root; user; default_branch; commits_max_displayed; host; port }
91
Added:
Ok
92
Added:
{
93
Added:
git_project_root;
94
Added:
user;
95
Added:
default_branch;
96
Added:
commits_max_displayed;
97
Added:
host;
98
Added:
port;
99
Added:
}
92
100
with _ ->
93
101
prerr_endline "[config.ml] Falling back to default config.";
94
102
Ok default
lib/main.ml
@@ -3,4 +3,5 @@
3
3
let run () =
4
4
let port = Config.config.port in
5
5
let interface = Config.config.host in
6
Removed:
Dream.run ~port ~interface @@ Dream.logger @@ Dream.router Handlers.all_handlers
6
Added:
Dream.run ~port ~interface @@ Dream.logger
7
Added:
@@ Dream.router Handlers.all_handlers
lib/resolvers.ml
@@ -242,7 +242,6 @@
242
242
243
243
module Entry = struct
244
244
type perm = Dir | File | Exec | Link | Submodule
245
Removed:
246
245
type t = { hash : string; name : string; perm : perm }
247
246
248
247
let perm_of_git : Git.Tree.perm -> perm = function
@@ -304,7 +303,7 @@
304
303
let entries = Store.Value.Tree.to_list tree in
305
304
let rec try_entries = function
306
305
| [] -> Lwt_result.return None
307
Removed:
| (entry : Store.Value.Tree.entry) :: rest ->
306
Added:
| (entry : Store.Value.Tree.entry) :: rest -> (
308
307
let entry_hash = Store.Hash.to_hex entry.node in
309
308
let step = (entry.name, entry_hash) in
310
309
if entry_hash = target_hash then
@@ -316,7 +315,7 @@
316
315
match found with
317
316
| Some _ as result -> Lwt_result.return result
318
317
| None -> try_entries rest)
319
Removed:
| _ -> try_entries rest
318
Added:
| _ -> try_entries rest)
320
319
in
321
320
try_entries entries
322
321
| _ -> Lwt_result.return None
lib/routes.ml
@@ -30,7 +30,8 @@
30
30
| Root -> path_attr href root_path
31
31
| Repo repo -> path_attr href repo_path repo
32
32
| Commits repo -> path_attr href commits_path repo
33
Removed:
| Commits_branch (repo, branch) -> path_attr href commits_branch_path repo branch
33
Added:
| Commits_branch (repo, branch) ->
34
Added:
path_attr href commits_branch_path repo branch
34
35
| Commit (repo, commit) -> path_attr href commit_path repo commit
35
36
| Files repo -> path_attr href files_path repo
36
37
| File (repo, hash) -> path_attr href file_path repo hash
test/test_ogit.ml
@@ -20,7 +20,10 @@
20
20
let file = Filename.temp_file "ogit" ".toml" in
21
21
let oc = open_out file in
22
22
Printf.fprintf oc
23
Removed:
"user = \"bob\"\ndefault_branch = \"main\"\ngit_project_root = \"/srv/git\"\ncommits_max_displayed = 10\n";
23
Added:
"user = \"bob\"\n\
24
Added:
default_branch = \"main\"\n\
25
Added:
git_project_root = \"/srv/git\"\n\
26
Added:
commits_max_displayed = 10\n";
24
27
close_out oc;
25
28
match Ogit.Config.read_file ~file () with
26
29
| Ok config ->