@company-semantics/contracts 0.13.0 → 0.14.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.
- package/package.json +5 -1
- package/src/compatibility.ts +35 -0
- package/src/guards/config.ts +34 -0
- package/src/guards/index.ts +1 -0
- package/src/index.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@company-semantics/contracts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"types": "./src/guards/index.ts",
|
|
17
17
|
"default": "./src/guards/index.ts"
|
|
18
18
|
},
|
|
19
|
+
"./compatibility": {
|
|
20
|
+
"types": "./src/compatibility.ts",
|
|
21
|
+
"default": "./src/compatibility.ts"
|
|
22
|
+
},
|
|
19
23
|
"./schemas/guard-result.schema.json": "./schemas/guard-result.schema.json"
|
|
20
24
|
},
|
|
21
25
|
"types": "./src/index.ts",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contracts Compatibility Manifest
|
|
3
|
+
*
|
|
4
|
+
* Machine-readable version policy for CI guards.
|
|
5
|
+
* Enables consumer repos to programmatically validate their installed version.
|
|
6
|
+
*
|
|
7
|
+
* @see ADR-2025-12-011 in DECISIONS.md
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Deprecation entry for a semver range.
|
|
12
|
+
* Consumers matching this range will receive advisory warnings.
|
|
13
|
+
*/
|
|
14
|
+
export interface Deprecation {
|
|
15
|
+
/** Semver range (e.g., "0.12.x") */
|
|
16
|
+
range: string
|
|
17
|
+
/** Human-readable reason for deprecation */
|
|
18
|
+
reason: string
|
|
19
|
+
/** Version in which support will be removed */
|
|
20
|
+
removeIn: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Compatibility manifest exported as data.
|
|
25
|
+
* CI guards read this to determine freshness warnings/errors.
|
|
26
|
+
*/
|
|
27
|
+
export const COMPATIBILITY = {
|
|
28
|
+
/** Minimum version that all consumers should use */
|
|
29
|
+
minSupported: '0.14.0',
|
|
30
|
+
|
|
31
|
+
/** Versions that still work but should upgrade (with reasons) */
|
|
32
|
+
deprecations: [] as Deprecation[],
|
|
33
|
+
} as const
|
|
34
|
+
|
|
35
|
+
export type Compatibility = typeof COMPATIBILITY
|
package/src/guards/config.ts
CHANGED
|
@@ -136,6 +136,32 @@ export type GuardCheckFactory = (
|
|
|
136
136
|
*/
|
|
137
137
|
export type BoundGuardCheck = () => Promise<CheckResult> | CheckResult;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Contracts freshness baseline configuration.
|
|
141
|
+
* Consumer repos import COMPATIBILITY from contracts and pass it here.
|
|
142
|
+
*
|
|
143
|
+
* @see ADR-2025-12-014 for design rationale
|
|
144
|
+
*/
|
|
145
|
+
export interface ContractsFreshnessBaseline {
|
|
146
|
+
/** Path to lockfile relative to repo root (e.g., 'pnpm-lock.yaml') */
|
|
147
|
+
lockfilePath: string;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Compatibility manifest from @company-semantics/contracts.
|
|
151
|
+
* Import and pass directly: `import { COMPATIBILITY } from '@company-semantics/contracts'`
|
|
152
|
+
*/
|
|
153
|
+
compatibility: {
|
|
154
|
+
minSupported: string;
|
|
155
|
+
deprecations: readonly { range: string; reason: string; removeIn: string }[];
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Skip this guard. Use for repos with workspace:* dependency (always current).
|
|
160
|
+
* @default false
|
|
161
|
+
*/
|
|
162
|
+
skip?: boolean;
|
|
163
|
+
}
|
|
164
|
+
|
|
139
165
|
/**
|
|
140
166
|
* Evolution guard baselines.
|
|
141
167
|
* Product repos provide DATA only; CI orchestrator owns guard implementations.
|
|
@@ -165,6 +191,14 @@ export interface EvolutionBaselines {
|
|
|
165
191
|
/** Max allowed domain file count drift before warning */
|
|
166
192
|
domainDrift?: number;
|
|
167
193
|
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Contracts freshness check configuration.
|
|
197
|
+
* CI injects checkContractsFreshness based on this config.
|
|
198
|
+
*
|
|
199
|
+
* @see ADR-2025-12-014
|
|
200
|
+
*/
|
|
201
|
+
contractsFreshness?: ContractsFreshnessBaseline;
|
|
168
202
|
}
|
|
169
203
|
|
|
170
204
|
/**
|
package/src/guards/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ export type {
|
|
|
56
56
|
BoundGuardCheck,
|
|
57
57
|
GuardCheckRegistry,
|
|
58
58
|
EvolutionBaselines,
|
|
59
|
+
ContractsFreshnessBaseline,
|
|
59
60
|
} from './guards/index.js'
|
|
60
61
|
|
|
61
62
|
export {
|
|
@@ -65,3 +66,8 @@ export {
|
|
|
65
66
|
DEFAULT_DOMAIN_SECTIONS,
|
|
66
67
|
DEFAULT_INFRA_SECTIONS,
|
|
67
68
|
} from './guards/index.js'
|
|
69
|
+
|
|
70
|
+
// Compatibility manifest (CI guard vocabulary)
|
|
71
|
+
// @see ADR-2025-12-011 for design rationale
|
|
72
|
+
export { COMPATIBILITY } from './compatibility.js'
|
|
73
|
+
export type { Compatibility, Deprecation } from './compatibility.js'
|