OCaml client library for Claude Code
0
fork

Configure Feed

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

ocaml-claude: reformat MDX examples in lib/*.mli

dune fmt cleanup of code blocks now checked by mdx.

+11 -17
+4 -5
lib/client.mli
··· 24 24 let messages = Client.receive_all client in 25 25 List.iter 26 26 (function 27 - | Response.Text t -> 28 - Fmt.pr "Claude: %s@." (Response.Text.content t) 27 + | Response.Text t -> Fmt.pr "Claude: %s@." (Response.Text.content t) 29 28 | _ -> ()) 30 29 messages 31 30 ]} ··· 149 148 150 149 method! on_complete c = 151 150 Fmt.pr "Cost: $%.4f@." 152 - (Option.value ~default:0.0 153 - (Response.Complete.total_cost_usd c)) 151 + (Option.value ~default:0.0 (Response.Complete.total_cost_usd c)) 154 152 end 155 153 in 156 154 Client.query client "Hello"; ··· 229 227 (* Use powerful model for complex analysis. *) 230 228 let client = 231 229 Client.v ~sw ~process_mgr ~clock 232 - ~options:Options.(default |> with_model sonnet) () 230 + ~options:Options.(default |> with_model sonnet) 231 + () 233 232 in 234 233 Client.query client "Design a new architecture for this system"; 235 234 let design = Client.receive_all client in
+3 -6
lib/handler.mli
··· 44 44 Fmt.pr "tool_use: %s@." (Response.Tool_use.name t) 45 45 46 46 method on_tool_result t = 47 - Fmt.pr "tool_result: %s@." 48 - (Content_block.Tool_result.tool_use_id t) 47 + Fmt.pr "tool_result: %s@." (Content_block.Tool_result.tool_use_id t) 49 48 50 49 method on_thinking t = 51 50 Fmt.pr "thinking: %s@." (Response.Thinking.content t) 52 51 53 52 method on_init t = 54 53 Fmt.pr "init session: %s@." 55 - (Option.value ~default:"<no session>" 56 - (Response.Init.session_id t)) 54 + (Option.value ~default:"<no session>" (Response.Init.session_id t)) 57 55 58 - method on_error t = 59 - Fmt.pr "error: %s@." (Response.Error.message t) 56 + method on_error t = Fmt.pr "error: %s@." (Response.Error.message t) 60 57 61 58 method on_complete c = 62 59 Fmt.pr "complete: $%.4f@."
+3 -4
lib/hooks.mli
··· 17 17 let block_rm_rf (input : Hooks.Pre_tool_use.input) = 18 18 if input.tool_name = "Bash" then 19 19 match Tool_input.string input.tool_input "command" with 20 - | Some cmd 21 - when String.length cmd >= 5 && String.sub cmd 0 5 = "rm -rf" -> 20 + | Some cmd when String.length cmd >= 5 && String.sub cmd 0 5 = "rm -rf" 21 + -> 22 22 Hooks.Pre_tool_use.deny ~reason:"Dangerous command" () 23 23 | _ -> Hooks.Pre_tool_use.continue () 24 24 else Hooks.Pre_tool_use.continue () 25 25 26 - let hooks = 27 - Hooks.empty |> Hooks.on_pre_tool_use ~pattern:"Bash" block_rm_rf 26 + let hooks = Hooks.empty |> Hooks.on_pre_tool_use ~pattern:"Bash" block_rm_rf 28 27 ]} *) 29 28 30 29 val src : Logs.Src.t
+1 -2
lib/options.mli
··· 43 43 open Claude 44 44 45 45 let ci_config = 46 - Options.default 47 - |> Options.with_no_settings (* Ignore user config *) 46 + Options.default |> Options.with_no_settings (* Ignore user config *) 48 47 |> Options.with_max_budget_usd 0.50 (* 50 cent limit *) 49 48 |> Options.with_permission_mode Permissions.Mode.Bypass_permissions 50 49 |> Options.with_model `Haiku_4