1- # gleam_contracts Specification
1+ # module_contracts Specification
22
33Build-time module contract verification for Gleam. Reads the compiler's
44` package-interface ` JSON and checks that paired modules (e.g. headless/styled
@@ -230,38 +230,38 @@ pub fn check(
230230## Module Layout
231231
232232```
233- src/gleam_contracts .gleam — public API, re-exports
234- src/gleam_contracts /rule.gleam — Rule type + constructors
235- src/gleam_contracts /verify.gleam — verification engine
236- src/gleam_contracts /violation.gleam — Violation type + formatter
237- src/gleam_contracts /loader.gleam — package interface JSON loading
233+ src/module_contracts .gleam — public API, re-exports
234+ src/module_contracts /rule.gleam — Rule type + constructors
235+ src/module_contracts /verify.gleam — verification engine
236+ src/module_contracts /violation.gleam — Violation type + formatter
237+ src/module_contracts /loader.gleam — package interface JSON loading
238238```
239239
240240## Usage Pattern
241241
242- A consuming project adds ` gleam_contracts ` as a dev dependency, then
242+ A consuming project adds ` module_contracts ` as a dev dependency, then
243243creates a verification entry point:
244244
245245``` gleam
246246// test/contract_test.gleam (or a standalone script)
247- import gleam_contracts
248- import gleam_contracts /rule
247+ import module_contracts
248+ import module_contracts /rule
249249
250250pub fn main() {
251- gleam_contracts .check(
251+ module_contracts .check(
252252 interface_path: "build/dev/docs/my_package/package-interface.json",
253253 rules: [
254- gleam_contracts .mirror_rule(
254+ module_contracts .mirror_rule(
255255 source: "my_package/headless/badge",
256256 target: "my_package/badge",
257257 prefix_params: [rule.Labeled(label: "context")],
258258 ),
259- gleam_contracts .mirror_rule(
259+ module_contracts .mirror_rule(
260260 source: "my_package/headless/button",
261261 target: "my_package/button",
262262 prefix_params: [rule.Labeled(label: "context")],
263263 )
264- |> gleam_contracts .with_exceptions(exceptions: ["button"]),
264+ |> module_contracts .with_exceptions(exceptions: ["button"]),
265265 ],
266266 )
267267}
@@ -277,18 +277,18 @@ gleam run -m contract_test
277277Or as a startest test:
278278
279279``` gleam
280- import gleam_contracts
280+ import module_contracts
281281import startest.{describe, it}
282282import startest/expect
283283
284284pub fn contract_tests() {
285285 describe("module contracts", [
286286 it("headless/styled modules stay in sync", fn() {
287- let assert Ok(interface) = gleam_contracts .load_package_interface(
287+ let assert Ok(interface) = module_contracts .load_package_interface(
288288 path: "build/dev/docs/my_package/package-interface.json",
289289 )
290290
291- gleam_contracts .verify(interface: interface, rules: my_rules())
291+ module_contracts .verify(interface: interface, rules: my_rules())
292292 |> expect.to_be_ok
293293 }),
294294 ])
0 commit comments