@objectstack/lint 12.6.0 → 13.0.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/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Manifest } from '@objectstack/sdui-parser';
2
+ import { AccessMatrix } from '@objectstack/spec/security';
2
3
 
3
4
  /**
4
5
  * Build-time dashboard widget binding diagnostics (issues #1719, #1721).
@@ -69,7 +70,7 @@ interface WidgetBindingFinding {
69
70
  /** How to fix (or deliberately suppress) it. */
70
71
  hint: string;
71
72
  }
72
- type AnyRec$a = Record<string, unknown>;
73
+ type AnyRec$d = Record<string, unknown>;
73
74
  /**
74
75
  * Validate every dashboard widget's dataset binding. Returns the list of
75
76
  * findings (empty = clean). Caller decides how to surface them: `error`
@@ -77,7 +78,7 @@ type AnyRec$a = Record<string, unknown>;
77
78
  * should fail validate/build; `warning` findings are advisory and must
78
79
  * never fail the build on their own.
79
80
  */
80
- declare function validateWidgetBindings(stack: AnyRec$a): WidgetBindingFinding[];
81
+ declare function validateWidgetBindings(stack: AnyRec$d): WidgetBindingFinding[];
81
82
 
82
83
  interface ExprIssue {
83
84
  where: string;
@@ -90,12 +91,12 @@ interface ExprIssue {
90
91
  */
91
92
  severity?: 'error' | 'warning';
92
93
  }
93
- type AnyRec$9 = Record<string, unknown>;
94
+ type AnyRec$c = Record<string, unknown>;
94
95
  /**
95
96
  * Validate every predicate in the stack. Returns the list of issues (empty =
96
97
  * clean). Caller decides how to surface / whether to fail the build.
97
98
  */
98
- declare function validateStackExpressions(stack: AnyRec$9): ExprIssue[];
99
+ declare function validateStackExpressions(stack: AnyRec$c): ExprIssue[];
99
100
 
100
101
  type ListViewModeSeverity = 'error' | 'warning';
101
102
  interface ListViewModeFinding {
@@ -109,7 +110,7 @@ interface ListViewModeFinding {
109
110
  hint: string;
110
111
  }
111
112
  declare const LIST_VIEW_FILTERS_IN_VIEWS_MODE = "list-view-filters-in-views-mode";
112
- type AnyRec$8 = Record<string, unknown>;
113
+ type AnyRec$b = Record<string, unknown>;
113
114
  /**
114
115
  * Flag ADR-0047 "views" mode violations on an object's built-in named views or a
115
116
  * `defineView` default `list` / named `listViews`: `quickFilters`, or a `tabs`
@@ -119,7 +120,7 @@ type AnyRec$8 = Record<string, unknown>;
119
120
  *
120
121
  * Feed the PRE-parse stack (normalizeStackInput output) — see file header.
121
122
  */
122
- declare function validateListViewMode(stack: AnyRec$8): ListViewModeFinding[];
123
+ declare function validateListViewMode(stack: AnyRec$b): ListViewModeFinding[];
123
124
 
124
125
  type StyleSeverity = 'error' | 'warning';
125
126
  interface StyleFinding {
@@ -137,14 +138,14 @@ declare const STYLE_CLASSNAME_TAILWIND = "style-classname-tailwind";
137
138
  declare const STYLE_RESPONSIVE_NO_BASE = "style-responsive-no-base";
138
139
  declare const STYLE_UNKNOWN_CSS_PROPERTY = "style-unknown-css-property";
139
140
  declare const STYLE_UNKNOWN_TOKEN = "style-unknown-token";
140
- type AnyRec$7 = Record<string, unknown>;
141
+ type AnyRec$a = Record<string, unknown>;
141
142
  /**
142
143
  * Validate every page's component tree for SDUI styling correctness (ADR-0065).
143
144
  * Returns findings (empty = clean). `error` findings describe styles that are
144
145
  * silently dropped and should fail validate/build; `warning` findings are
145
146
  * advisory (typos, drift, footguns).
146
147
  */
147
- declare function validateResponsiveStyles(stack: AnyRec$7): StyleFinding[];
148
+ declare function validateResponsiveStyles(stack: AnyRec$a): StyleFinding[];
148
149
 
149
150
  type JsxPageSeverity = 'error' | 'warning';
150
151
  interface JsxPageFinding {
@@ -157,8 +158,8 @@ interface JsxPageFinding {
157
158
  message: string;
158
159
  hint: string;
159
160
  }
160
- type AnyRec$6 = Record<string, unknown>;
161
- declare function validateJsxPages(stack: AnyRec$6, opts?: {
161
+ type AnyRec$9 = Record<string, unknown>;
162
+ declare function validateJsxPages(stack: AnyRec$9, opts?: {
162
163
  manifest?: Manifest;
163
164
  }): JsxPageFinding[];
164
165
 
@@ -171,8 +172,8 @@ interface ReactPageFinding {
171
172
  message: string;
172
173
  hint: string;
173
174
  }
174
- type AnyRec$5 = Record<string, unknown>;
175
- declare function validateReactPages(stack: AnyRec$5): ReactPageFinding[];
175
+ type AnyRec$8 = Record<string, unknown>;
176
+ declare function validateReactPages(stack: AnyRec$8): ReactPageFinding[];
176
177
 
177
178
  type ReactPropSeverity = 'error' | 'warning';
178
179
  interface ReactPropFinding {
@@ -183,8 +184,8 @@ interface ReactPropFinding {
183
184
  message: string;
184
185
  hint: string;
185
186
  }
186
- type AnyRec$4 = Record<string, unknown>;
187
- declare function validateReactPageProps(stack: AnyRec$4): ReactPropFinding[];
187
+ type AnyRec$7 = Record<string, unknown>;
188
+ declare function validateReactPageProps(stack: AnyRec$7): ReactPropFinding[];
188
189
 
189
190
  type SourceStyleSeverity = 'error' | 'warning';
190
191
  interface SourceStyleFinding {
@@ -196,8 +197,8 @@ interface SourceStyleFinding {
196
197
  hint: string;
197
198
  }
198
199
  declare const PAGE_SOURCE_CLASSNAME = "page-source-className-tailwind";
199
- type AnyRec$3 = Record<string, unknown>;
200
- declare function validatePageSourceStyling(stack: AnyRec$3): SourceStyleFinding[];
200
+ type AnyRec$6 = Record<string, unknown>;
201
+ declare function validatePageSourceStyling(stack: AnyRec$6): SourceStyleFinding[];
201
202
 
202
203
  /**
203
204
  * Build-time record-title diagnostics (ADR-0079).
@@ -241,14 +242,14 @@ interface RecordTitleFinding {
241
242
  /** How to fix it. */
242
243
  hint: string;
243
244
  }
244
- type AnyRec$2 = Record<string, unknown>;
245
+ type AnyRec$5 = Record<string, unknown>;
245
246
  /**
246
247
  * Validate every object's record-title declaration. Returns the list of
247
248
  * findings (empty = clean). Both rules are advisory (`warning`): the caller
248
249
  * must never fail the build on them alone — auto-provision + the `Record #<id>`
249
250
  * floor guarantee a resolvable title at runtime.
250
251
  */
251
- declare function validateRecordTitle(stack: AnyRec$2): RecordTitleFinding[];
252
+ declare function validateRecordTitle(stack: AnyRec$5): RecordTitleFinding[];
252
253
 
253
254
  /**
254
255
  * Build-time semantic-role diagnostics (ADR-0085).
@@ -285,13 +286,13 @@ interface SemanticRoleFinding {
285
286
  /** How to fix it. */
286
287
  hint: string;
287
288
  }
288
- type AnyRec$1 = Record<string, unknown>;
289
+ type AnyRec$4 = Record<string, unknown>;
289
290
  /**
290
291
  * Validate every object's semantic-role pointers. Returns the list of
291
292
  * findings (empty = clean). Advisory only — the caller must never fail the
292
293
  * build on these alone.
293
294
  */
294
- declare function validateSemanticRoles(stack: AnyRec$1): SemanticRoleFinding[];
295
+ declare function validateSemanticRoles(stack: AnyRec$4): SemanticRoleFinding[];
295
296
 
296
297
  /**
297
298
  * Build-time form-layout diagnostics (#2578).
@@ -334,11 +335,86 @@ interface FormLayoutFinding {
334
335
  /** How to fix it. */
335
336
  hint: string;
336
337
  }
337
- type AnyRec = Record<string, unknown>;
338
+ type AnyRec$3 = Record<string, unknown>;
338
339
  /**
339
340
  * Validate authored form-view layout. Returns findings (empty = clean).
340
341
  * Advisory only — the caller must never fail the build on these alone.
341
342
  */
342
- declare function validateFormLayout(stack: AnyRec): FormLayoutFinding[];
343
+ declare function validateFormLayout(stack: AnyRec$3): FormLayoutFinding[];
344
+
345
+ declare const CAPABILITY_REFERENCE_UNKNOWN = "capability-reference-unknown";
346
+ type CapabilityRefSeverity = 'error' | 'warning';
347
+ interface CapabilityRefFinding {
348
+ /** Always `warning` — the reference fails closed at runtime (see module note). */
349
+ severity: CapabilityRefSeverity;
350
+ /** Diagnostic rule id. */
351
+ rule: string;
352
+ /** Human-readable location, e.g. `object "sys_license"`. */
353
+ where: string;
354
+ /** Config path, e.g. `objects[3].requiredPermissions`. */
355
+ path: string;
356
+ /** What is wrong. */
357
+ message: string;
358
+ /** How to fix it. */
359
+ hint: string;
360
+ }
361
+ type AnyRec$2 = Record<string, unknown>;
362
+ /**
363
+ * Validate every capability reference in a stack. Returns findings (empty =
364
+ * clean). Advisory only — callers must not fail the build on these alone.
365
+ */
366
+ declare function validateCapabilityReferences(stack: AnyRec$2): CapabilityRefFinding[];
367
+
368
+ declare const SECURITY_OWD_UNSET = "security-owd-unset";
369
+ declare const SECURITY_OWD_ALIAS = "security-owd-alias";
370
+ declare const SECURITY_EXTERNAL_WIDER = "security-external-wider-than-internal";
371
+ declare const SECURITY_WILDCARD_VAMA = "security-wildcard-vama";
372
+ declare const SECURITY_ANCHOR_HIGH_PRIVILEGE = "security-anchor-high-privilege";
373
+ declare const SECURITY_ROLE_WORD = "security-role-word";
374
+ declare const SECURITY_PRIVATE_NO_READSCOPE = "security-private-no-readscope";
375
+ type SecuritySeverity = 'error' | 'warning' | 'info';
376
+ interface SecurityFinding {
377
+ severity: SecuritySeverity;
378
+ /** Diagnostic rule id (`security-*`). */
379
+ rule: string;
380
+ /** Human-readable location, e.g. `object "leave_request"`. */
381
+ where: string;
382
+ /** Config path, e.g. `objects[3].sharingModel`. */
383
+ path: string;
384
+ /** What is wrong. */
385
+ message: string;
386
+ /** How to fix it. */
387
+ hint: string;
388
+ }
389
+ type AnyRec$1 = Record<string, unknown>;
390
+ /**
391
+ * Validate the security posture of a stack. Returns findings (empty = clean).
392
+ * `error` findings gate the build in `os compile`; `info` is advisory.
393
+ */
394
+ declare function validateSecurityPosture(stack: AnyRec$1): SecurityFinding[];
395
+
396
+ /**
397
+ * [ADR-0090 D6] Access-matrix snapshot — authoring-time companion to the
398
+ * runtime explain engine.
399
+ *
400
+ * `buildAccessMatrix(stack)` derives, PURELY from metadata, one row per
401
+ * (permission set × object) the stack declares: the CRUD/VAMA bits, the
402
+ * depth axes, and the object's OWD for context. The matrix is snapshotted to
403
+ * `access-matrix.json` and diffed on every compile: an unchanged matrix
404
+ * auto-passes; a changed one fails the build until the snapshot is updated —
405
+ * so every capability change becomes a REVIEWABLE, semantic diff
406
+ * ("`crm_admin` gains delete on `crm_lead`") instead of a buried JSON hunk.
407
+ * This is the publish-gate substrate the AI-authoring safety story needs:
408
+ * AI may draft grants freely; it cannot silently change who can do what.
409
+ */
410
+
411
+ type AnyRec = Record<string, unknown>;
412
+ /** Build the sorted access matrix for a normalized stack. */
413
+ declare function buildAccessMatrix(stack: AnyRec): AccessMatrix;
414
+ /**
415
+ * Semantic diff between two matrices — human-review lines, empty = identical.
416
+ * Ordered: removals, additions, then per-entry bit/scope changes.
417
+ */
418
+ declare function diffAccessMatrix(before: AccessMatrix, after: AccessMatrix): string[];
343
419
 
344
- export { CHART_CONFIG_MISSING, CHART_FIELD_UNKNOWN, type ExprIssue, FIELD_GROUP_EMPTY, FIELD_GROUP_UNDECLARED, FORM_COLSPAN_ABSOLUTE, FORM_FIELD_UNKNOWN, type FormLayoutFinding, type FormLayoutSeverity, type JsxPageFinding, type JsxPageSeverity, LIST_VIEW_FILTERS_IN_VIEWS_MODE, type ListViewModeFinding, type ListViewModeSeverity, MEASURE_AGGREGATE_INCOHERENT, PAGE_SOURCE_CLASSNAME, type ReactPageFinding, type ReactPageSeverity, type ReactPropFinding, type ReactPropSeverity, type RecordTitleFinding, type RecordTitleSeverity, SEMANTIC_ROLE_FIELD_UNKNOWN, STYLE_CLASSNAME_TAILWIND, STYLE_NODE_MISSING_ID, STYLE_RESPONSIVE_NO_BASE, STYLE_UNKNOWN_CSS_PROPERTY, STYLE_UNKNOWN_TOKEN, type SemanticRoleFinding, type SemanticRoleSeverity, type SourceStyleFinding, type SourceStyleSeverity, type StyleFinding, type StyleSeverity, TABLE_COUNT_ONLY, TITLE_FORMAT_RETIRED, TITLE_UNRESOLVABLE, WIDGET_DATASET_UNKNOWN, WIDGET_DIMENSION_UNKNOWN, WIDGET_MEASURE_UNKNOWN, type WidgetBindingFinding, type WidgetBindingSeverity, validateFormLayout, validateJsxPages, validateListViewMode, validatePageSourceStyling, validateReactPageProps, validateReactPages, validateRecordTitle, validateResponsiveStyles, validateSemanticRoles, validateStackExpressions, validateWidgetBindings };
420
+ export { CAPABILITY_REFERENCE_UNKNOWN, CHART_CONFIG_MISSING, CHART_FIELD_UNKNOWN, type CapabilityRefFinding, type CapabilityRefSeverity, type ExprIssue, FIELD_GROUP_EMPTY, FIELD_GROUP_UNDECLARED, FORM_COLSPAN_ABSOLUTE, FORM_FIELD_UNKNOWN, type FormLayoutFinding, type FormLayoutSeverity, type JsxPageFinding, type JsxPageSeverity, LIST_VIEW_FILTERS_IN_VIEWS_MODE, type ListViewModeFinding, type ListViewModeSeverity, MEASURE_AGGREGATE_INCOHERENT, PAGE_SOURCE_CLASSNAME, type ReactPageFinding, type ReactPageSeverity, type ReactPropFinding, type ReactPropSeverity, type RecordTitleFinding, type RecordTitleSeverity, SECURITY_ANCHOR_HIGH_PRIVILEGE, SECURITY_EXTERNAL_WIDER, SECURITY_OWD_ALIAS, SECURITY_OWD_UNSET, SECURITY_PRIVATE_NO_READSCOPE, SECURITY_ROLE_WORD, SECURITY_WILDCARD_VAMA, SEMANTIC_ROLE_FIELD_UNKNOWN, STYLE_CLASSNAME_TAILWIND, STYLE_NODE_MISSING_ID, STYLE_RESPONSIVE_NO_BASE, STYLE_UNKNOWN_CSS_PROPERTY, STYLE_UNKNOWN_TOKEN, type SecurityFinding, type SecuritySeverity, type SemanticRoleFinding, type SemanticRoleSeverity, type SourceStyleFinding, type SourceStyleSeverity, type StyleFinding, type StyleSeverity, TABLE_COUNT_ONLY, TITLE_FORMAT_RETIRED, TITLE_UNRESOLVABLE, WIDGET_DATASET_UNKNOWN, WIDGET_DIMENSION_UNKNOWN, WIDGET_MEASURE_UNKNOWN, type WidgetBindingFinding, type WidgetBindingSeverity, buildAccessMatrix, diffAccessMatrix, validateCapabilityReferences, validateFormLayout, validateJsxPages, validateListViewMode, validatePageSourceStyling, validateReactPageProps, validateReactPages, validateRecordTitle, validateResponsiveStyles, validateSecurityPosture, validateSemanticRoles, validateStackExpressions, validateWidgetBindings };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Manifest } from '@objectstack/sdui-parser';
2
+ import { AccessMatrix } from '@objectstack/spec/security';
2
3
 
3
4
  /**
4
5
  * Build-time dashboard widget binding diagnostics (issues #1719, #1721).
@@ -69,7 +70,7 @@ interface WidgetBindingFinding {
69
70
  /** How to fix (or deliberately suppress) it. */
70
71
  hint: string;
71
72
  }
72
- type AnyRec$a = Record<string, unknown>;
73
+ type AnyRec$d = Record<string, unknown>;
73
74
  /**
74
75
  * Validate every dashboard widget's dataset binding. Returns the list of
75
76
  * findings (empty = clean). Caller decides how to surface them: `error`
@@ -77,7 +78,7 @@ type AnyRec$a = Record<string, unknown>;
77
78
  * should fail validate/build; `warning` findings are advisory and must
78
79
  * never fail the build on their own.
79
80
  */
80
- declare function validateWidgetBindings(stack: AnyRec$a): WidgetBindingFinding[];
81
+ declare function validateWidgetBindings(stack: AnyRec$d): WidgetBindingFinding[];
81
82
 
82
83
  interface ExprIssue {
83
84
  where: string;
@@ -90,12 +91,12 @@ interface ExprIssue {
90
91
  */
91
92
  severity?: 'error' | 'warning';
92
93
  }
93
- type AnyRec$9 = Record<string, unknown>;
94
+ type AnyRec$c = Record<string, unknown>;
94
95
  /**
95
96
  * Validate every predicate in the stack. Returns the list of issues (empty =
96
97
  * clean). Caller decides how to surface / whether to fail the build.
97
98
  */
98
- declare function validateStackExpressions(stack: AnyRec$9): ExprIssue[];
99
+ declare function validateStackExpressions(stack: AnyRec$c): ExprIssue[];
99
100
 
100
101
  type ListViewModeSeverity = 'error' | 'warning';
101
102
  interface ListViewModeFinding {
@@ -109,7 +110,7 @@ interface ListViewModeFinding {
109
110
  hint: string;
110
111
  }
111
112
  declare const LIST_VIEW_FILTERS_IN_VIEWS_MODE = "list-view-filters-in-views-mode";
112
- type AnyRec$8 = Record<string, unknown>;
113
+ type AnyRec$b = Record<string, unknown>;
113
114
  /**
114
115
  * Flag ADR-0047 "views" mode violations on an object's built-in named views or a
115
116
  * `defineView` default `list` / named `listViews`: `quickFilters`, or a `tabs`
@@ -119,7 +120,7 @@ type AnyRec$8 = Record<string, unknown>;
119
120
  *
120
121
  * Feed the PRE-parse stack (normalizeStackInput output) — see file header.
121
122
  */
122
- declare function validateListViewMode(stack: AnyRec$8): ListViewModeFinding[];
123
+ declare function validateListViewMode(stack: AnyRec$b): ListViewModeFinding[];
123
124
 
124
125
  type StyleSeverity = 'error' | 'warning';
125
126
  interface StyleFinding {
@@ -137,14 +138,14 @@ declare const STYLE_CLASSNAME_TAILWIND = "style-classname-tailwind";
137
138
  declare const STYLE_RESPONSIVE_NO_BASE = "style-responsive-no-base";
138
139
  declare const STYLE_UNKNOWN_CSS_PROPERTY = "style-unknown-css-property";
139
140
  declare const STYLE_UNKNOWN_TOKEN = "style-unknown-token";
140
- type AnyRec$7 = Record<string, unknown>;
141
+ type AnyRec$a = Record<string, unknown>;
141
142
  /**
142
143
  * Validate every page's component tree for SDUI styling correctness (ADR-0065).
143
144
  * Returns findings (empty = clean). `error` findings describe styles that are
144
145
  * silently dropped and should fail validate/build; `warning` findings are
145
146
  * advisory (typos, drift, footguns).
146
147
  */
147
- declare function validateResponsiveStyles(stack: AnyRec$7): StyleFinding[];
148
+ declare function validateResponsiveStyles(stack: AnyRec$a): StyleFinding[];
148
149
 
149
150
  type JsxPageSeverity = 'error' | 'warning';
150
151
  interface JsxPageFinding {
@@ -157,8 +158,8 @@ interface JsxPageFinding {
157
158
  message: string;
158
159
  hint: string;
159
160
  }
160
- type AnyRec$6 = Record<string, unknown>;
161
- declare function validateJsxPages(stack: AnyRec$6, opts?: {
161
+ type AnyRec$9 = Record<string, unknown>;
162
+ declare function validateJsxPages(stack: AnyRec$9, opts?: {
162
163
  manifest?: Manifest;
163
164
  }): JsxPageFinding[];
164
165
 
@@ -171,8 +172,8 @@ interface ReactPageFinding {
171
172
  message: string;
172
173
  hint: string;
173
174
  }
174
- type AnyRec$5 = Record<string, unknown>;
175
- declare function validateReactPages(stack: AnyRec$5): ReactPageFinding[];
175
+ type AnyRec$8 = Record<string, unknown>;
176
+ declare function validateReactPages(stack: AnyRec$8): ReactPageFinding[];
176
177
 
177
178
  type ReactPropSeverity = 'error' | 'warning';
178
179
  interface ReactPropFinding {
@@ -183,8 +184,8 @@ interface ReactPropFinding {
183
184
  message: string;
184
185
  hint: string;
185
186
  }
186
- type AnyRec$4 = Record<string, unknown>;
187
- declare function validateReactPageProps(stack: AnyRec$4): ReactPropFinding[];
187
+ type AnyRec$7 = Record<string, unknown>;
188
+ declare function validateReactPageProps(stack: AnyRec$7): ReactPropFinding[];
188
189
 
189
190
  type SourceStyleSeverity = 'error' | 'warning';
190
191
  interface SourceStyleFinding {
@@ -196,8 +197,8 @@ interface SourceStyleFinding {
196
197
  hint: string;
197
198
  }
198
199
  declare const PAGE_SOURCE_CLASSNAME = "page-source-className-tailwind";
199
- type AnyRec$3 = Record<string, unknown>;
200
- declare function validatePageSourceStyling(stack: AnyRec$3): SourceStyleFinding[];
200
+ type AnyRec$6 = Record<string, unknown>;
201
+ declare function validatePageSourceStyling(stack: AnyRec$6): SourceStyleFinding[];
201
202
 
202
203
  /**
203
204
  * Build-time record-title diagnostics (ADR-0079).
@@ -241,14 +242,14 @@ interface RecordTitleFinding {
241
242
  /** How to fix it. */
242
243
  hint: string;
243
244
  }
244
- type AnyRec$2 = Record<string, unknown>;
245
+ type AnyRec$5 = Record<string, unknown>;
245
246
  /**
246
247
  * Validate every object's record-title declaration. Returns the list of
247
248
  * findings (empty = clean). Both rules are advisory (`warning`): the caller
248
249
  * must never fail the build on them alone — auto-provision + the `Record #<id>`
249
250
  * floor guarantee a resolvable title at runtime.
250
251
  */
251
- declare function validateRecordTitle(stack: AnyRec$2): RecordTitleFinding[];
252
+ declare function validateRecordTitle(stack: AnyRec$5): RecordTitleFinding[];
252
253
 
253
254
  /**
254
255
  * Build-time semantic-role diagnostics (ADR-0085).
@@ -285,13 +286,13 @@ interface SemanticRoleFinding {
285
286
  /** How to fix it. */
286
287
  hint: string;
287
288
  }
288
- type AnyRec$1 = Record<string, unknown>;
289
+ type AnyRec$4 = Record<string, unknown>;
289
290
  /**
290
291
  * Validate every object's semantic-role pointers. Returns the list of
291
292
  * findings (empty = clean). Advisory only — the caller must never fail the
292
293
  * build on these alone.
293
294
  */
294
- declare function validateSemanticRoles(stack: AnyRec$1): SemanticRoleFinding[];
295
+ declare function validateSemanticRoles(stack: AnyRec$4): SemanticRoleFinding[];
295
296
 
296
297
  /**
297
298
  * Build-time form-layout diagnostics (#2578).
@@ -334,11 +335,86 @@ interface FormLayoutFinding {
334
335
  /** How to fix it. */
335
336
  hint: string;
336
337
  }
337
- type AnyRec = Record<string, unknown>;
338
+ type AnyRec$3 = Record<string, unknown>;
338
339
  /**
339
340
  * Validate authored form-view layout. Returns findings (empty = clean).
340
341
  * Advisory only — the caller must never fail the build on these alone.
341
342
  */
342
- declare function validateFormLayout(stack: AnyRec): FormLayoutFinding[];
343
+ declare function validateFormLayout(stack: AnyRec$3): FormLayoutFinding[];
344
+
345
+ declare const CAPABILITY_REFERENCE_UNKNOWN = "capability-reference-unknown";
346
+ type CapabilityRefSeverity = 'error' | 'warning';
347
+ interface CapabilityRefFinding {
348
+ /** Always `warning` — the reference fails closed at runtime (see module note). */
349
+ severity: CapabilityRefSeverity;
350
+ /** Diagnostic rule id. */
351
+ rule: string;
352
+ /** Human-readable location, e.g. `object "sys_license"`. */
353
+ where: string;
354
+ /** Config path, e.g. `objects[3].requiredPermissions`. */
355
+ path: string;
356
+ /** What is wrong. */
357
+ message: string;
358
+ /** How to fix it. */
359
+ hint: string;
360
+ }
361
+ type AnyRec$2 = Record<string, unknown>;
362
+ /**
363
+ * Validate every capability reference in a stack. Returns findings (empty =
364
+ * clean). Advisory only — callers must not fail the build on these alone.
365
+ */
366
+ declare function validateCapabilityReferences(stack: AnyRec$2): CapabilityRefFinding[];
367
+
368
+ declare const SECURITY_OWD_UNSET = "security-owd-unset";
369
+ declare const SECURITY_OWD_ALIAS = "security-owd-alias";
370
+ declare const SECURITY_EXTERNAL_WIDER = "security-external-wider-than-internal";
371
+ declare const SECURITY_WILDCARD_VAMA = "security-wildcard-vama";
372
+ declare const SECURITY_ANCHOR_HIGH_PRIVILEGE = "security-anchor-high-privilege";
373
+ declare const SECURITY_ROLE_WORD = "security-role-word";
374
+ declare const SECURITY_PRIVATE_NO_READSCOPE = "security-private-no-readscope";
375
+ type SecuritySeverity = 'error' | 'warning' | 'info';
376
+ interface SecurityFinding {
377
+ severity: SecuritySeverity;
378
+ /** Diagnostic rule id (`security-*`). */
379
+ rule: string;
380
+ /** Human-readable location, e.g. `object "leave_request"`. */
381
+ where: string;
382
+ /** Config path, e.g. `objects[3].sharingModel`. */
383
+ path: string;
384
+ /** What is wrong. */
385
+ message: string;
386
+ /** How to fix it. */
387
+ hint: string;
388
+ }
389
+ type AnyRec$1 = Record<string, unknown>;
390
+ /**
391
+ * Validate the security posture of a stack. Returns findings (empty = clean).
392
+ * `error` findings gate the build in `os compile`; `info` is advisory.
393
+ */
394
+ declare function validateSecurityPosture(stack: AnyRec$1): SecurityFinding[];
395
+
396
+ /**
397
+ * [ADR-0090 D6] Access-matrix snapshot — authoring-time companion to the
398
+ * runtime explain engine.
399
+ *
400
+ * `buildAccessMatrix(stack)` derives, PURELY from metadata, one row per
401
+ * (permission set × object) the stack declares: the CRUD/VAMA bits, the
402
+ * depth axes, and the object's OWD for context. The matrix is snapshotted to
403
+ * `access-matrix.json` and diffed on every compile: an unchanged matrix
404
+ * auto-passes; a changed one fails the build until the snapshot is updated —
405
+ * so every capability change becomes a REVIEWABLE, semantic diff
406
+ * ("`crm_admin` gains delete on `crm_lead`") instead of a buried JSON hunk.
407
+ * This is the publish-gate substrate the AI-authoring safety story needs:
408
+ * AI may draft grants freely; it cannot silently change who can do what.
409
+ */
410
+
411
+ type AnyRec = Record<string, unknown>;
412
+ /** Build the sorted access matrix for a normalized stack. */
413
+ declare function buildAccessMatrix(stack: AnyRec): AccessMatrix;
414
+ /**
415
+ * Semantic diff between two matrices — human-review lines, empty = identical.
416
+ * Ordered: removals, additions, then per-entry bit/scope changes.
417
+ */
418
+ declare function diffAccessMatrix(before: AccessMatrix, after: AccessMatrix): string[];
343
419
 
344
- export { CHART_CONFIG_MISSING, CHART_FIELD_UNKNOWN, type ExprIssue, FIELD_GROUP_EMPTY, FIELD_GROUP_UNDECLARED, FORM_COLSPAN_ABSOLUTE, FORM_FIELD_UNKNOWN, type FormLayoutFinding, type FormLayoutSeverity, type JsxPageFinding, type JsxPageSeverity, LIST_VIEW_FILTERS_IN_VIEWS_MODE, type ListViewModeFinding, type ListViewModeSeverity, MEASURE_AGGREGATE_INCOHERENT, PAGE_SOURCE_CLASSNAME, type ReactPageFinding, type ReactPageSeverity, type ReactPropFinding, type ReactPropSeverity, type RecordTitleFinding, type RecordTitleSeverity, SEMANTIC_ROLE_FIELD_UNKNOWN, STYLE_CLASSNAME_TAILWIND, STYLE_NODE_MISSING_ID, STYLE_RESPONSIVE_NO_BASE, STYLE_UNKNOWN_CSS_PROPERTY, STYLE_UNKNOWN_TOKEN, type SemanticRoleFinding, type SemanticRoleSeverity, type SourceStyleFinding, type SourceStyleSeverity, type StyleFinding, type StyleSeverity, TABLE_COUNT_ONLY, TITLE_FORMAT_RETIRED, TITLE_UNRESOLVABLE, WIDGET_DATASET_UNKNOWN, WIDGET_DIMENSION_UNKNOWN, WIDGET_MEASURE_UNKNOWN, type WidgetBindingFinding, type WidgetBindingSeverity, validateFormLayout, validateJsxPages, validateListViewMode, validatePageSourceStyling, validateReactPageProps, validateReactPages, validateRecordTitle, validateResponsiveStyles, validateSemanticRoles, validateStackExpressions, validateWidgetBindings };
420
+ export { CAPABILITY_REFERENCE_UNKNOWN, CHART_CONFIG_MISSING, CHART_FIELD_UNKNOWN, type CapabilityRefFinding, type CapabilityRefSeverity, type ExprIssue, FIELD_GROUP_EMPTY, FIELD_GROUP_UNDECLARED, FORM_COLSPAN_ABSOLUTE, FORM_FIELD_UNKNOWN, type FormLayoutFinding, type FormLayoutSeverity, type JsxPageFinding, type JsxPageSeverity, LIST_VIEW_FILTERS_IN_VIEWS_MODE, type ListViewModeFinding, type ListViewModeSeverity, MEASURE_AGGREGATE_INCOHERENT, PAGE_SOURCE_CLASSNAME, type ReactPageFinding, type ReactPageSeverity, type ReactPropFinding, type ReactPropSeverity, type RecordTitleFinding, type RecordTitleSeverity, SECURITY_ANCHOR_HIGH_PRIVILEGE, SECURITY_EXTERNAL_WIDER, SECURITY_OWD_ALIAS, SECURITY_OWD_UNSET, SECURITY_PRIVATE_NO_READSCOPE, SECURITY_ROLE_WORD, SECURITY_WILDCARD_VAMA, SEMANTIC_ROLE_FIELD_UNKNOWN, STYLE_CLASSNAME_TAILWIND, STYLE_NODE_MISSING_ID, STYLE_RESPONSIVE_NO_BASE, STYLE_UNKNOWN_CSS_PROPERTY, STYLE_UNKNOWN_TOKEN, type SecurityFinding, type SecuritySeverity, type SemanticRoleFinding, type SemanticRoleSeverity, type SourceStyleFinding, type SourceStyleSeverity, type StyleFinding, type StyleSeverity, TABLE_COUNT_ONLY, TITLE_FORMAT_RETIRED, TITLE_UNRESOLVABLE, WIDGET_DATASET_UNKNOWN, WIDGET_DIMENSION_UNKNOWN, WIDGET_MEASURE_UNKNOWN, type WidgetBindingFinding, type WidgetBindingSeverity, buildAccessMatrix, diffAccessMatrix, validateCapabilityReferences, validateFormLayout, validateJsxPages, validateListViewMode, validatePageSourceStyling, validateReactPageProps, validateReactPages, validateRecordTitle, validateResponsiveStyles, validateSecurityPosture, validateSemanticRoles, validateStackExpressions, validateWidgetBindings };