@company-semantics/contracts 0.12.0 → 0.13.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 +1 -1
- package/src/guards/config.ts +42 -0
- package/src/guards/index.ts +1 -0
- package/src/index.ts +1 -0
package/package.json
CHANGED
package/src/guards/config.ts
CHANGED
|
@@ -136,6 +136,37 @@ export type GuardCheckFactory = (
|
|
|
136
136
|
*/
|
|
137
137
|
export type BoundGuardCheck = () => Promise<CheckResult> | CheckResult;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Evolution guard baselines.
|
|
141
|
+
* Product repos provide DATA only; CI orchestrator owns guard implementations.
|
|
142
|
+
*
|
|
143
|
+
* Design invariant: Product repos must NEVER import CI guard code.
|
|
144
|
+
* They export baselines; CI injects guards at runtime.
|
|
145
|
+
*/
|
|
146
|
+
export interface EvolutionBaselines {
|
|
147
|
+
/** Source directory (explicit, no assumptions). Defaults to 'src' if omitted. */
|
|
148
|
+
srcDir?: string;
|
|
149
|
+
|
|
150
|
+
/** Export count baseline per file. Key is file path relative to srcDir. */
|
|
151
|
+
exports?: Record<string, number>;
|
|
152
|
+
|
|
153
|
+
/** Import count baseline per file. Key is file path relative to srcDir. */
|
|
154
|
+
imports?: Record<string, number>;
|
|
155
|
+
|
|
156
|
+
/** File count baseline per domain. Key is domain path. */
|
|
157
|
+
domains?: Record<string, number>;
|
|
158
|
+
|
|
159
|
+
/** Drift thresholds (optional, guards have sensible defaults) */
|
|
160
|
+
thresholds?: {
|
|
161
|
+
/** Max allowed export drift before warning */
|
|
162
|
+
exportDrift?: number;
|
|
163
|
+
/** Max allowed import drift before warning */
|
|
164
|
+
importDrift?: number;
|
|
165
|
+
/** Max allowed domain file count drift before warning */
|
|
166
|
+
domainDrift?: number;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
|
|
139
170
|
/**
|
|
140
171
|
* Registry of checks grouped by tier.
|
|
141
172
|
* Each repo exports this from guard-entries.ts for universal orchestration.
|
|
@@ -152,10 +183,21 @@ export interface GuardCheckRegistry {
|
|
|
152
183
|
structural?: BoundGuardCheck[];
|
|
153
184
|
behavioral?: BoundGuardCheck[];
|
|
154
185
|
invariants?: BoundGuardCheck[];
|
|
186
|
+
/**
|
|
187
|
+
* @deprecated Evolution guards are CI-owned. Use evolutionBaselines instead.
|
|
188
|
+
* Product repos should not provide evolution check implementations.
|
|
189
|
+
*/
|
|
155
190
|
evolution?: BoundGuardCheck[];
|
|
156
191
|
/** Meta-guards: protect the guard system itself (coverage correctness) */
|
|
157
192
|
meta?: BoundGuardCheck[];
|
|
158
193
|
};
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Evolution guard baselines.
|
|
197
|
+
* CI orchestrator injects evolution guards based on these baselines.
|
|
198
|
+
* Product repos provide data only, never guard implementations.
|
|
199
|
+
*/
|
|
200
|
+
evolutionBaselines?: EvolutionBaselines;
|
|
159
201
|
}
|
|
160
202
|
|
|
161
203
|
// =============================================================================
|
package/src/guards/index.ts
CHANGED