@consiliency/contract 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +42 -4
  2. package/conformance/vectors/canonical-html-contract-loaded.json +15 -0
  3. package/conformance/vectors/interface-invalid-host-path.json +26 -0
  4. package/conformance/vectors/interface-valid-realized-and-promised.json +36 -0
  5. package/conformance/vectors/loop-gate-invalid-blocking-default.json +15 -0
  6. package/conformance/vectors/loop-gate-missing-doc-warns.json +16 -0
  7. package/conformance/vectors/manifest-invalid-absolute-path.json +20 -0
  8. package/conformance/vectors/manifest-invalid-certified-maturity.json +20 -0
  9. package/conformance/vectors/manifest-invalid-path-and-ref.json +20 -0
  10. package/conformance/vectors/manifest-invalid-unknown-archetype.json +18 -0
  11. package/conformance/vectors/manifest-valid-baseline-only.json +20 -0
  12. package/conformance/vectors/manifest-valid-product.json +21 -0
  13. package/conformance/vectors/version-skew-compatible.json +15 -0
  14. package/conformance/vectors/version-skew-incompatible-warns.json +15 -0
  15. package/core/canonical-html/contract-v1.json +459 -0
  16. package/core/canonical-html/provenance.json +22 -0
  17. package/core/contract.json +45 -0
  18. package/core/registries/archetypes.json +62 -0
  19. package/core/registries/document-classes.json +33 -0
  20. package/core/registries/maturity-labels.json +22 -0
  21. package/core/registries/required-documents.json +74 -0
  22. package/core/schemas/canonical-html-v1.schema.json +15 -0
  23. package/core/schemas/contract-version-status.schema.json +26 -0
  24. package/core/schemas/decision.schema.json +26 -0
  25. package/core/schemas/interface-declaration.schema.json +67 -0
  26. package/core/schemas/loop-gate-protocol.schema.json +25 -0
  27. package/core/schemas/loop-gate-scenario.schema.json +25 -0
  28. package/core/schemas/manifest.schema.json +97 -0
  29. package/core/schemas/version-skew-protocol.schema.json +32 -0
  30. package/core/schemas/version-skew-scenario.schema.json +13 -0
  31. package/package.json +8 -2
  32. package/src/index.d.ts +7 -1
  33. package/src/index.js +47 -7
@@ -0,0 +1,74 @@
1
+ {
2
+ "schema": "consiliency.required_documents.v1",
3
+ "document_id_conflict_policy": "conflict",
4
+ "baseline": [
5
+ {"id": "readme", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
6
+ {"id": "doc-contract-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
7
+ {"id": "service-catalog-ownership", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
8
+ {"id": "contract-version-status", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
9
+ {"id": "contributing", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
10
+ {"id": "license", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
11
+ {"id": "changelog", "class": "intent-plan", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
12
+ {"id": "glossary", "class": "proj-S", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true, "l0_note": "Presence stub with authored zone only; not a fake projection."},
13
+ {"id": "adr-index", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
14
+ {"id": "sbom", "class": "proj-code", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
15
+ {"id": "dev-setup", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
16
+ {"id": "codeowners", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
17
+ {"id": "interface-declaration", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false}
18
+ ],
19
+ "archetypes": {
20
+ "product": [
21
+ {"id": "prd", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
22
+ {"id": "product-roadmap", "class": "intent-plan", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
23
+ {"id": "end-user-docs", "class": "proj-S", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
24
+ ],
25
+ "service": [
26
+ {"id": "slo-policy", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
27
+ {"id": "runbook", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
28
+ {"id": "dr-bcp", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
29
+ {"id": "incident-response", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
30
+ {"id": "deployment", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
31
+ {"id": "env-secrets-inventory", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
32
+ {"id": "release-policy", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
33
+ ],
34
+ "library": [
35
+ {"id": "api-spec", "class": "proj-code", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
36
+ {"id": "release-policy", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
37
+ ],
38
+ "infra": [
39
+ {"id": "deployment", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
40
+ {"id": "dr-bcp", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
41
+ ],
42
+ "tooling-meta": [
43
+ {"id": "configured-surfaces", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
44
+ {"id": "compatibility-policy", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
45
+ ],
46
+ "experiment": [
47
+ {"id": "hypothesis", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
48
+ {"id": "method", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
49
+ {"id": "findings", "class": "intent-plan", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
50
+ ],
51
+ "document": [
52
+ {"id": "document-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": false},
53
+ {"id": "provenance-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
54
+ {"id": "version-structure", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
55
+ ]
56
+ },
57
+ "modifiers": {
58
+ "data-bearing": [
59
+ {"id": "data-privacy-retention", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
60
+ {"id": "data-inventory", "class": "ops-fact", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
61
+ ],
62
+ "public": [
63
+ {"id": "code-of-conduct", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
64
+ {"id": "support", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true},
65
+ {"id": "security", "class": "static", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
66
+ ],
67
+ "regulated": [
68
+ {"id": "compliance-audit-index", "class": "index", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
69
+ ],
70
+ "user-facing": [
71
+ {"id": "threat-model", "class": "intent-ground", "required": true, "maturity_floor": "presence-only", "l0_stub_allowed": true}
72
+ ]
73
+ }
74
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/canonical-html-v1.schema.json",
4
+ "title": "canonical_html.v1 package pointer",
5
+ "type": "object",
6
+ "required": ["contract_id", "schemas", "dialect", "document_identity", "document_type_catalog"],
7
+ "additionalProperties": true,
8
+ "properties": {
9
+ "contract_id": {"const": "canonicalHtmlContract.v1"},
10
+ "schemas": {"type": "object"},
11
+ "dialect": {"type": "object"},
12
+ "document_identity": {"type": "object"},
13
+ "document_type_catalog": {"type": "object"}
14
+ }
15
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/contract-version-status.schema.json",
4
+ "title": "Consiliency contract version status",
5
+ "type": "object",
6
+ "required": ["schema", "package", "repo_contract_version", "compatibility", "maturity", "checked_at", "evidence"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.contract_version_status.v1"},
10
+ "package": {
11
+ "type": "object",
12
+ "required": ["name", "version"],
13
+ "additionalProperties": false,
14
+ "properties": {
15
+ "name": {"type": "string"},
16
+ "version": {"type": "string", "pattern": "^0\\.1\\.0$"}
17
+ }
18
+ },
19
+ "repo_contract_version": {"type": "string", "pattern": "^0\\.1\\.0$"},
20
+ "consumer": {"type": "object"},
21
+ "compatibility": {"enum": ["compatible", "negotiated", "incompatible", "unknown"]},
22
+ "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
23
+ "checked_at": {"type": "string"},
24
+ "evidence": {"type": "array"}
25
+ }
26
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/decision.schema.json",
4
+ "title": "Consiliency conformance decision",
5
+ "type": "object",
6
+ "required": ["schema", "status", "maturity", "findings"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.conformance_decision.v1"},
10
+ "status": {"enum": ["accepted", "rejected", "warn"]},
11
+ "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
12
+ "findings": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "object",
16
+ "required": ["code", "severity", "message"],
17
+ "additionalProperties": false,
18
+ "properties": {
19
+ "code": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
20
+ "severity": {"enum": ["info", "warn", "block"]},
21
+ "message": {"type": "string", "minLength": 1}
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/interface-declaration.schema.json",
4
+ "title": "Consiliency interface declaration",
5
+ "type": "object",
6
+ "required": ["schema", "repo_id", "realized_edges", "promised_edges"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.interface_declaration.v1"},
10
+ "repo_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
11
+ "realized_edges": {"type": "array", "items": {"$ref": "#/$defs/edge"}},
12
+ "promised_edges": {"type": "array", "items": {"$ref": "#/$defs/edge"}}
13
+ },
14
+ "$defs": {
15
+ "repoRelativePath": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "not": {"anyOf": [{"pattern": "^/"}, {"pattern": "(^|/)\\.\\.(/|$)"}, {"pattern": "^[A-Za-z]:[\\\\/]"}]}
19
+ },
20
+ "ref": {
21
+ "type": "object",
22
+ "required": ["kind", "value"],
23
+ "additionalProperties": false,
24
+ "allOf": [
25
+ {
26
+ "if": {
27
+ "properties": {"kind": {"const": "repo-relative-path"}},
28
+ "required": ["kind"]
29
+ },
30
+ "then": {
31
+ "properties": {"value": {"$ref": "#/$defs/repoRelativePath"}}
32
+ }
33
+ }
34
+ ],
35
+ "properties": {
36
+ "kind": {"enum": ["git-ref", "package-coordinate", "repo-relative-path", "copied-literal", "opaque-external-ref"]},
37
+ "value": {"type": "string", "minLength": 1},
38
+ "path": {"$ref": "#/$defs/repoRelativePath"},
39
+ "digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}
40
+ }
41
+ },
42
+ "evidence": {
43
+ "type": "object",
44
+ "required": ["ref", "digest"],
45
+ "additionalProperties": false,
46
+ "properties": {
47
+ "ref": {"$ref": "#/$defs/repoRelativePath"},
48
+ "digest": {"type": "string", "pattern": "^sha256:[0-9a-f]{64}$"}
49
+ }
50
+ },
51
+ "edge": {
52
+ "type": "object",
53
+ "required": ["id", "provider_repo", "consumer_repo", "interface_id", "ref", "maturity", "evidence"],
54
+ "additionalProperties": false,
55
+ "properties": {
56
+ "id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
57
+ "provider_repo": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
58
+ "consumer_repo": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
59
+ "interface_id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
60
+ "ref": {"$ref": "#/$defs/ref"},
61
+ "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
62
+ "evidence": {"type": "array", "items": {"$ref": "#/$defs/evidence"}},
63
+ "upstream_pin": {"type": "string"}
64
+ }
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/loop-gate-protocol.schema.json",
4
+ "title": "Consiliency loop gate protocol",
5
+ "type": "object",
6
+ "required": ["schema", "gate_families", "default_policy"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.loop_gate_protocol.v1"},
10
+ "gate_families": {
11
+ "type": "array",
12
+ "items": {"enum": ["presence", "freshness", "local-integrity", "cross-repo-integrity", "version-skew"]},
13
+ "uniqueItems": true
14
+ },
15
+ "default_policy": {
16
+ "type": "object",
17
+ "required": ["severity_default", "blocking_opt_in"],
18
+ "additionalProperties": false,
19
+ "properties": {
20
+ "severity_default": {"const": "warn"},
21
+ "blocking_opt_in": {"type": "boolean"}
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/loop-gate-scenario.schema.json",
4
+ "title": "Consiliency loop gate conformance scenario",
5
+ "type": "object",
6
+ "required": ["schema", "gate"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.loop_gate_scenario.v1"},
10
+ "gate": {"enum": ["presence", "freshness", "local-integrity", "cross-repo-integrity", "version-skew"]},
11
+ "missing": {
12
+ "type": "array",
13
+ "items": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"}
14
+ },
15
+ "severity_default": {"type": "string"},
16
+ "consumer_policy": {
17
+ "type": "object",
18
+ "required": ["blocking_opt_in"],
19
+ "additionalProperties": false,
20
+ "properties": {
21
+ "blocking_opt_in": {"type": "boolean"}
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,97 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/manifest.schema.json",
4
+ "title": ".consiliency manifest",
5
+ "type": "object",
6
+ "required": ["schema", "contract_version", "repo", "declaration", "documents", "interfaces"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.manifest.v1"},
10
+ "contract_version": {"type": "string", "pattern": "^0\\.1\\.0$"},
11
+ "repo": {
12
+ "type": "object",
13
+ "required": ["id", "display_name", "default_branch"],
14
+ "additionalProperties": false,
15
+ "properties": {
16
+ "id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
17
+ "display_name": {"type": "string", "minLength": 1},
18
+ "default_branch": {"type": "string", "minLength": 1},
19
+ "homepage": {"type": "string"}
20
+ }
21
+ },
22
+ "declaration": {
23
+ "oneOf": [
24
+ {
25
+ "type": "object",
26
+ "required": ["mode"],
27
+ "additionalProperties": false,
28
+ "properties": {"mode": {"const": "baseline-only"}}
29
+ },
30
+ {
31
+ "type": "object",
32
+ "required": ["mode", "archetypes"],
33
+ "additionalProperties": false,
34
+ "properties": {
35
+ "mode": {"const": "archetyped"},
36
+ "archetypes": {
37
+ "type": "array",
38
+ "minItems": 1,
39
+ "uniqueItems": true,
40
+ "items": {"enum": ["product", "service", "library", "infra", "tooling-meta", "experiment", "document"]}
41
+ },
42
+ "modifiers": {
43
+ "type": "array",
44
+ "uniqueItems": true,
45
+ "items": {"enum": ["data-bearing", "public", "regulated", "user-facing"]}
46
+ }
47
+ }
48
+ }
49
+ ]
50
+ },
51
+ "documents": {
52
+ "type": "array",
53
+ "items": {"$ref": "#/$defs/document"},
54
+ "uniqueItems": true
55
+ },
56
+ "interfaces": {"$ref": "#/$defs/repoRelativePath"},
57
+ "legacy_layouts": {
58
+ "type": "array",
59
+ "items": {"$ref": "#/$defs/repoRelativePath"}
60
+ }
61
+ },
62
+ "$defs": {
63
+ "repoRelativePath": {
64
+ "type": "string",
65
+ "minLength": 1,
66
+ "not": {"anyOf": [{"pattern": "^/"}, {"pattern": "(^|/)\\.\\.(/|$)"}, {"pattern": "^[A-Za-z]:[\\\\/]"}]}
67
+ },
68
+ "externalRef": {
69
+ "type": "object",
70
+ "required": ["kind", "value"],
71
+ "additionalProperties": false,
72
+ "properties": {
73
+ "kind": {"enum": ["org-ref", "url", "opaque-external-ref"]},
74
+ "value": {"type": "string", "minLength": 1}
75
+ }
76
+ },
77
+ "document": {
78
+ "type": "object",
79
+ "required": ["id", "class", "maturity", "target_level", "required"],
80
+ "oneOf": [
81
+ {"required": ["path"], "not": {"required": ["ref"]}},
82
+ {"required": ["ref"], "not": {"required": ["path"]}}
83
+ ],
84
+ "additionalProperties": false,
85
+ "properties": {
86
+ "id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9_.-]*$"},
87
+ "class": {"enum": ["intent-ground", "intent-plan", "proj-S", "proj-code", "ops-fact", "static", "index"]},
88
+ "path": {"$ref": "#/$defs/repoRelativePath"},
89
+ "ref": {"$ref": "#/$defs/externalRef"},
90
+ "maturity": {"enum": ["presence-only", "hash-checked", "realized-edge-observed"]},
91
+ "target_level": {"enum": ["L0", "L1"]},
92
+ "required": {"type": "boolean"},
93
+ "last_attested_at": {"type": "string"}
94
+ }
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/version-skew-protocol.schema.json",
4
+ "title": "Consiliency version skew protocol",
5
+ "type": "object",
6
+ "required": ["schema", "contract_version", "compatible_ranges", "default_behavior"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.version_skew_protocol.v1"},
10
+ "contract_version": {"const": "0.1.0"},
11
+ "compatible_ranges": {
12
+ "type": "object",
13
+ "required": ["contract", "package"],
14
+ "additionalProperties": false,
15
+ "properties": {
16
+ "contract": {"const": ">=0.1.0 <0.2.0"},
17
+ "package": {"const": ">=0.1.0 <0.2.0"}
18
+ }
19
+ },
20
+ "prerelease_policy": {"enum": ["reject-by-default"]},
21
+ "build_metadata_policy": {"enum": ["ignored-for-compatibility"]},
22
+ "default_behavior": {
23
+ "type": "object",
24
+ "required": ["phase0_severity", "auto_mutation_allowed"],
25
+ "additionalProperties": false,
26
+ "properties": {
27
+ "phase0_severity": {"const": "warn"},
28
+ "auto_mutation_allowed": {"const": false}
29
+ }
30
+ }
31
+ }
32
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://consiliency.io/contracts/version-skew-scenario.schema.json",
4
+ "title": "Consiliency version skew conformance scenario",
5
+ "type": "object",
6
+ "required": ["schema", "contract_version", "package_version"],
7
+ "additionalProperties": false,
8
+ "properties": {
9
+ "schema": {"const": "consiliency.version_skew_scenario.v1"},
10
+ "contract_version": {"type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$"},
11
+ "package_version": {"type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+$"}
12
+ }
13
+ }
package/package.json CHANGED
@@ -1,16 +1,22 @@
1
1
  {
2
2
  "name": "@consiliency/contract",
3
- "version": "0.0.1",
4
- "description": "Consiliency cross-repo contract package: the .consiliency layout, archetype registry, required-doc sets, interface-declaration schema, loop-gate protocol, canonical_html.v1, and the version-skew protocol. Vendored by agent-harness and governed-pipeline; owned by neither. v0.0.x is a provisioning placeholder — contract content lands in 0.1.0.",
3
+ "version": "0.1.0",
4
+ "description": "Consiliency cross-repo contract package: shared JSON contract data, conformance vectors, thin npm/PyPI readers, and the canonical_html.v1 public contract surface.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "main": "src/index.js",
8
8
  "types": "src/index.d.ts",
9
9
  "files": [
10
+ "core",
11
+ "conformance",
10
12
  "src",
11
13
  "README.md",
12
14
  "LICENSE"
13
15
  ],
16
+ "scripts": {
17
+ "test": "node --test tests/*.test.mjs",
18
+ "pack:check": "node tests/package-content.test.mjs"
19
+ },
14
20
  "publishConfig": {
15
21
  "access": "public"
16
22
  },
package/src/index.d.ts CHANGED
@@ -1,2 +1,8 @@
1
1
  export declare const CONTRACT_PACKAGE: "@consiliency/contract";
2
- export declare const STATUS: "placeholder";
2
+ export declare const CONTRACT_VERSION: "0.1.0";
3
+ export declare const CONTRACT: Record<string, unknown>;
4
+ export declare function loadContract(): Record<string, unknown>;
5
+ export declare function loadSchema(name: string): Record<string, unknown>;
6
+ export declare function loadRegistry(name: string): Record<string, unknown>;
7
+ export declare function listVectors(): string[];
8
+ export declare function loadVector(name: string): Record<string, unknown>;
package/src/index.js CHANGED
@@ -1,8 +1,48 @@
1
- // @consiliency/contract — provisioning placeholder (v0.0.x).
2
- //
3
- // The normative contract (the `.consiliency/` layout + manifest schema, the archetype
4
- // registry, required-doc sets, the interface-declaration schema, the loop-gate
5
- // protocol, `canonical_html.v1`, and the version-skew protocol) lands in 0.1.0 as
6
- // shared JSON data + conformance vectors, in byte-parity with the PyPI reader.
1
+ import { readdirSync, readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+
7
5
  export const CONTRACT_PACKAGE = "@consiliency/contract";
8
- export const STATUS = "placeholder";
6
+ export const CONTRACT_VERSION = "0.1.0";
7
+
8
+ const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
9
+
10
+ function readJson(relativePath) {
11
+ return JSON.parse(readFileSync(join(packageRoot, relativePath), "utf8"));
12
+ }
13
+
14
+ function assertKnown(mapping, name, type) {
15
+ const relativePath = mapping[name];
16
+ if (!relativePath) {
17
+ throw new Error(`Unknown ${type}: ${name}`);
18
+ }
19
+ return relativePath;
20
+ }
21
+
22
+ export const CONTRACT = readJson("core/contract.json");
23
+
24
+ export function loadContract() {
25
+ return readJson("core/contract.json");
26
+ }
27
+
28
+ export function loadSchema(name) {
29
+ return readJson(assertKnown(CONTRACT.schemas, name, "schema"));
30
+ }
31
+
32
+ export function loadRegistry(name) {
33
+ return readJson(assertKnown(CONTRACT.registries, name, "registry"));
34
+ }
35
+
36
+ export function listVectors() {
37
+ return readdirSync(join(packageRoot, CONTRACT.conformance.vector_root))
38
+ .filter((name) => name.endsWith(".json"))
39
+ .sort();
40
+ }
41
+
42
+ export function loadVector(name) {
43
+ const filename = name.endsWith(".json") ? name : `${name}.json`;
44
+ if (!listVectors().includes(filename)) {
45
+ throw new Error(`Unknown vector: ${name}`);
46
+ }
47
+ return readJson(join(CONTRACT.conformance.vector_root, filename));
48
+ }