HomeKit Accessory Protocol (HAP) for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

json: replace ?format with ?indent + ?preserve, drop recode*, rework json.brr

Migrate every `to_string` / `to_writer` from the three-variant enum
`?format:format = Minify | Indent | Layout` to two orthogonal knobs:

?indent:int -- omit for compact; pass 2 for pretty (two-space indent).
Inside the function the value is `int option`.
?preserve:bool -- default false; honor per-node Loc.Meta whitespace when
true, with the ?indent path as fallback for new nodes.

This exposes the two underlying axes (pretty-vs-compact / preserve-vs-
regenerate) rather than collapsing them into a closed enum, and makes the
partial-rewrite use case (parse with ~layout:true, edit a subtree, encode
with ~preserve:true ~indent:2) the composition of the two knobs.

Drop `recode` / `recode_exn` / `recode_string` / `recode_string_exn`: they
were four extra verbs on top of the six the skill defines, and users can
compose `of_string |> to_string` in one line.

Rework json.brr to mirror the core six-verb shape exactly:

of_jstr / of_jstr_exn / to_jstr -- Jstr.t replaces string
of_jv / of_jv_exn / to_jv -- Jv.t (zero-copy JS value)

Dropping the jsont-era `decode`/`encode`/`'`/`recode*` verbs and the
dual Jv.Error.t / Json.Error.t return types -- everything returns
Loc.Error.t now.

Update all known downstream callers (claude, http, hap, requests, slack,
sigstore, rego, atp/xrpc-auth) and fix collateral Oauth issues flagged
by the migration (auth, gauth use Oauth.Client_auth.post now).

Also apply merlint docstyle hints to ocaml-json: drop the
`get_meta`/`get_meta` aliases, document `Json.Dict.{empty,mem,add,
remove,find}`, rewrite the int/int32/int64 cons docs so they don't trip
E410's `[x]` bracket heuristic, rename Bench.bench_file to Bench.run_file.

Drive-by: restore did/test/test_did.ml (sed-mangled `let\1\2X` names and
`Quick\1\2X` variants left behind by a prior rename pass) and fix stray
leftover lines in ocaml-tty's dune-project so `dune fmt` can run.

+1 -1
+1 -1
lib/hap.ml
··· 675 675 (* Save/load pairing to file *) 676 676 let save_pairing ~fs ~path (pairing : pairing) = 677 677 let stored = Pairing_json.of_pairing pairing in 678 - let json = Json.to_string ~format:Json.Indent Pairing_json.stored stored in 678 + let json = Json.to_string ~indent:2 Pairing_json.stored stored in 679 679 Eio.Path.save ~create:(`Or_truncate 0o600) Eio.Path.(fs / path) json 680 680 681 681 let load_pairing ~fs ~path =