Skip to content

Commit 85e7d62

Browse files
authored
Merge pull request #1 from bbopen/codex/rename-module-contracts-prehex
Pre-Hex: rename gleam_contracts package/module to module_contracts
2 parents a9a2442 + eef9664 commit 85e7d62

9 files changed

Lines changed: 76 additions & 74 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
# gleam_contracts
1+
# module_contracts
22

3-
[![Package Version](https://img.shields.io/hexpm/v/gleam_contracts)](https://hex.pm/packages/gleam_contracts)
4-
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gleam_contracts/)
3+
[![Package Version](https://img.shields.io/hexpm/v/module_contracts)](https://hex.pm/packages/module_contracts)
4+
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/module_contracts/)
55

66
Build-time module contract verification for Gleam — enforce that paired modules stay in sync.
77

88
## Installation
99

1010
```sh
11-
gleam add gleam_contracts
11+
gleam add module_contracts
1212
```
1313

1414
## Usage
1515

1616
Create a contract check entrypoint in your package:
1717

1818
```gleam
19-
import gleam_contracts
20-
import gleam_contracts/rule
19+
import module_contracts
20+
import module_contracts/rule
2121
2222
pub fn main() {
23-
gleam_contracts.check(
23+
module_contracts.check(
2424
interface_path: "build/dev/docs/my_package/package-interface.json",
2525
rules: [
26-
gleam_contracts.mirror_rule(
26+
module_contracts.mirror_rule(
2727
source: "my_package/headless/button",
2828
target: "my_package/button",
2929
prefix_params: [rule.Labeled(label: "context")],
3030
)
31-
|> gleam_contracts.with_exceptions(exceptions: ["button"]),
32-
gleam_contracts.shared_types(
31+
|> module_contracts.with_exceptions(exceptions: ["button"]),
32+
module_contracts.shared_types(
3333
module_a: "my_package/headless/button",
3434
module_b: "my_package/button",
3535
type_names: ["ButtonConfig"],

SPEC.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# gleam_contracts Specification
1+
# module_contracts Specification
22

33
Build-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
243243
creates 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
250250
pub 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
277277
Or as a startest test:
278278

279279
```gleam
280-
import gleam_contracts
280+
import module_contracts
281281
import startest.{describe, it}
282282
import startest/expect
283283
284284
pub 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
])

gleam.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name = "gleam_contracts"
1+
name = "module_contracts"
22
version = "0.1.0"
33
description = "Build-time module contract verification for Gleam — enforce that paired modules stay in sync."
44
licences = ["Apache-2.0"]
5-
repository = { type = "github", user = "bbopen", repo = "gleam_contracts" }
5+
repository = { type = "github", user = "bbopen", repo = "module_contracts" }
66
gleam = ">= 1.14.0"
77

88
[dependencies]
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import gleam/io
44
import gleam/package_interface.{type Package}
55
import gleam/result
6-
import gleam_contracts/loader
7-
import gleam_contracts/rule
8-
import gleam_contracts/verify as contract_verify
9-
import gleam_contracts/violation
6+
import module_contracts/loader
7+
import module_contracts/rule
8+
import module_contracts/verify as contract_verify
9+
import module_contracts/violation
1010

1111
/// Decoded package-interface model exported by the compiler.
1212
pub type PackageInterface =
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import gleam/package_interface.{
1212
TypeDefinition, Variable,
1313
}
1414
import gleam/string
15-
import gleam_contracts/rule.{
15+
import module_contracts/rule.{
1616
type ExportSpec, type ParamSpec, type Rule, ExportSpec, Labeled, MirrorRule,
1717
RequireExports, SharedTypes, Unlabeled,
1818
}
19-
import gleam_contracts/violation.{
19+
import module_contracts/violation.{
2020
type Violation, MissingExport, MissingFunction, MissingType, ModuleNotFound,
2121
ParameterMismatch, TypeMismatch,
2222
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import gleam/int
44
import gleam/list
55
import gleam/string
6-
import gleam_contracts/loader.{type LoadError}
6+
import module_contracts/loader.{type LoadError}
77

88
/// A single contract violation.
99
pub type Violation {

0 commit comments

Comments
 (0)