structured-context 0.11.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.
Files changed (138) hide show
  1. package/README.md +52 -198
  2. package/dist/api.d.ts +17 -15
  3. package/dist/api.js +12 -9
  4. package/dist/commands/diagram.d.ts +1 -0
  5. package/dist/commands/diagram.js +7 -1
  6. package/dist/commands/docs.js +1 -0
  7. package/dist/commands/dump.d.ts +15 -2
  8. package/dist/commands/dump.js +18 -4
  9. package/dist/commands/providers.d.ts +4 -0
  10. package/dist/commands/providers.js +52 -0
  11. package/dist/commands/render.d.ts +4 -0
  12. package/dist/commands/render.js +64 -9
  13. package/dist/commands/schemas.d.ts +2 -2
  14. package/dist/commands/schemas.js +133 -22
  15. package/dist/commands/show.d.ts +1 -0
  16. package/dist/commands/show.js +7 -1
  17. package/dist/commands/spaces.d.ts +3 -1
  18. package/dist/commands/spaces.js +11 -2
  19. package/dist/commands/validate-file.d.ts +3 -0
  20. package/dist/commands/validate-file.js +24 -6
  21. package/dist/commands/validate.d.ts +4 -0
  22. package/dist/commands/validate.js +79 -23
  23. package/dist/config.d.ts +25 -1
  24. package/dist/config.js +106 -12
  25. package/dist/filter/augment-nodes.d.ts +3 -1
  26. package/dist/filter/augment-nodes.js +12 -7
  27. package/dist/filter/filter-nodes.js +1 -1
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +96 -31
  30. package/dist/judge/context.d.ts +20 -0
  31. package/dist/judge/context.js +105 -0
  32. package/dist/judge/factory.d.ts +44 -0
  33. package/dist/judge/factory.js +148 -0
  34. package/dist/judge/index.d.ts +13 -0
  35. package/dist/judge/index.js +8 -0
  36. package/dist/judge/judge-node.d.ts +27 -0
  37. package/dist/judge/judge-node.js +122 -0
  38. package/dist/judge/prompt.d.ts +10 -0
  39. package/dist/judge/prompt.js +92 -0
  40. package/dist/judge/provider/anthropic.d.ts +17 -0
  41. package/dist/judge/provider/anthropic.js +43 -0
  42. package/dist/judge/provider/fake.d.ts +26 -0
  43. package/dist/judge/provider/fake.js +56 -0
  44. package/dist/judge/provider/jev.d.ts +37 -0
  45. package/dist/judge/provider/jev.js +169 -0
  46. package/dist/judge/provider/openai-decisions.d.ts +21 -0
  47. package/dist/judge/provider/openai-decisions.js +84 -0
  48. package/dist/judge/provider/openai.d.ts +20 -0
  49. package/dist/judge/provider/openai.js +53 -0
  50. package/dist/judge/provider/per-rule.d.ts +10 -0
  51. package/dist/judge/provider/per-rule.js +18 -0
  52. package/dist/judge/trim.d.ts +27 -0
  53. package/dist/judge/trim.js +62 -0
  54. package/dist/judge/types.d.ts +92 -0
  55. package/dist/judge/types.js +9 -0
  56. package/dist/judge/verdicts.d.ts +24 -0
  57. package/dist/judge/verdicts.js +82 -0
  58. package/dist/load-space-graph.d.ts +7 -5
  59. package/dist/load-space-graph.js +19 -8
  60. package/dist/plugins/loader.js +3 -3
  61. package/dist/plugins/markdown/extract-content-links.js +8 -29
  62. package/dist/plugins/markdown/index.js +8 -2
  63. package/dist/plugins/markdown/parse-embedded.d.ts +8 -0
  64. package/dist/plugins/markdown/parse-embedded.js +195 -24
  65. package/dist/plugins/markdown/read-space.js +42 -14
  66. package/dist/plugins/markdown/render-directory.d.ts +11 -0
  67. package/dist/plugins/markdown/render-directory.js +130 -0
  68. package/dist/plugins/markdown/template-sync.js +3 -4
  69. package/dist/plugins/markdown/util.d.ts +26 -5
  70. package/dist/plugins/markdown/util.js +56 -15
  71. package/dist/plugins/mermaid/render-mermaid.js +2 -1
  72. package/dist/plugins/miro/sync.js +7 -6
  73. package/dist/plugins/util.d.ts +39 -1
  74. package/dist/plugins/util.js +139 -0
  75. package/dist/read/resolve-graph-edges.d.ts +1 -1
  76. package/dist/read/resolve-graph-edges.js +46 -27
  77. package/dist/read/wikilink-utils.d.ts +17 -0
  78. package/dist/read/wikilink-utils.js +40 -0
  79. package/dist/render/render.d.ts +3 -1
  80. package/dist/render/render.js +2 -2
  81. package/dist/schema/evaluate-rule.d.ts +33 -2
  82. package/dist/schema/evaluate-rule.js +58 -4
  83. package/dist/schema/gating.d.ts +69 -0
  84. package/dist/schema/gating.js +253 -0
  85. package/dist/schema/meta-schemas.d.ts +13 -0
  86. package/dist/schema/meta-schemas.js +50 -0
  87. package/dist/schema/metadata-contract.d.ts +952 -183
  88. package/dist/schema/metadata-contract.js +177 -33
  89. package/dist/schema/rule-filter.d.ts +12 -0
  90. package/dist/schema/rule-filter.js +46 -0
  91. package/dist/schema/rule-severity.d.ts +13 -0
  92. package/dist/schema/rule-severity.js +33 -0
  93. package/dist/schema/schema.d.ts +14 -8
  94. package/dist/schema/schema.js +308 -199
  95. package/dist/schema/validate-graph.d.ts +2 -1
  96. package/dist/schema/validate-graph.js +40 -23
  97. package/dist/schema/validate-rules.d.ts +16 -3
  98. package/dist/schema/validate-rules.js +91 -29
  99. package/dist/schemas/_knowledge_wiki.json +24 -24
  100. package/dist/schemas/_okf.json +172 -0
  101. package/dist/schemas/_ost_strict.json +17 -8
  102. package/dist/schemas/_sctx_base.json +3 -3
  103. package/dist/schemas/_strategy_general.json +38 -38
  104. package/dist/schemas/generated/0.12.0/_structured_context_schema_meta.json +229 -0
  105. package/dist/schemas/generated/0.13.0/_structured_context_schema_meta.json +400 -0
  106. package/dist/schemas/generated/latest/_structured_context_schema_meta.json +400 -0
  107. package/dist/schemas/knowledge_wiki.json +10 -9
  108. package/dist/schemas/okf.json +8 -0
  109. package/dist/schemas/strategy_general.json +15 -14
  110. package/dist/schemas/strict_ost.json +17 -16
  111. package/dist/space-context.d.ts +5 -2
  112. package/dist/space-context.js +9 -4
  113. package/dist/space-graph.d.ts +9 -7
  114. package/dist/space-graph.js +7 -5
  115. package/dist/testing.d.ts +33 -0
  116. package/dist/testing.js +72 -0
  117. package/dist/types.d.ts +64 -16
  118. package/dist/validate.d.ts +62 -9
  119. package/dist/validate.js +229 -114
  120. package/docs/concepts.md +65 -9
  121. package/docs/config.md +78 -1
  122. package/docs/rules.md +168 -50
  123. package/docs/schemas.md +152 -52
  124. package/package.json +17 -11
  125. package/schemas/_knowledge_wiki.json +24 -24
  126. package/schemas/_okf.json +172 -0
  127. package/schemas/_ost_strict.json +17 -8
  128. package/schemas/_sctx_base.json +3 -3
  129. package/schemas/_strategy_general.json +38 -38
  130. package/schemas/generated/0.12.0/_structured_context_schema_meta.json +229 -0
  131. package/schemas/generated/0.13.0/_structured_context_schema_meta.json +400 -0
  132. package/schemas/generated/latest/_structured_context_schema_meta.json +400 -0
  133. package/schemas/knowledge_wiki.json +10 -9
  134. package/schemas/okf.json +8 -0
  135. package/schemas/strategy_general.json +15 -14
  136. package/schemas/strict_ost.json +17 -16
  137. package/dist/schemas/generated/_structured_context_schema_meta.json +0 -191
  138. package/schemas/generated/_structured_context_schema_meta.json +0 -191
@@ -0,0 +1,33 @@
1
+ import type { BaseNode, Hierarchy, HierarchyLevel, Relationship, ResolvedParentRef, SpaceNode } from './types.js';
2
+ /**
3
+ * Creates a ResolvedParentRef with sensible defaults for use in tests.
4
+ * Override any field to represent specific edge contexts.
5
+ */
6
+ export declare const makeParentRef: (title: string, overrides?: Partial<ResolvedParentRef>) => ResolvedParentRef;
7
+ /**
8
+ * Creates a HierarchyLevel with defaults matching schema metadata normalization.
9
+ */
10
+ export declare const makeLevel: (type: string, overrides?: Partial<HierarchyLevel>) => HierarchyLevel;
11
+ /**
12
+ * Creates a named Hierarchy (default name 'main') from normalized levels.
13
+ */
14
+ export declare const makeHierarchy: (levels: HierarchyLevel[], overrides?: Partial<Hierarchy>) => Hierarchy;
15
+ /**
16
+ * SchemaMetadata fields for a schema whose only hierarchy is its main hierarchy.
17
+ */
18
+ export declare const withHierarchy: (levels: HierarchyLevel[], overrides?: Partial<Hierarchy>) => {
19
+ hierarchy: Hierarchy;
20
+ hierarchies: Hierarchy[];
21
+ };
22
+ /**
23
+ * Creates a Relationship with defaults matching schema metadata normalization.
24
+ */
25
+ export declare const makeRelationship: (parent: string, type: string, overrides?: Partial<Relationship>) => Relationship;
26
+ /**
27
+ * Creates a BaseNode with sensible defaults for use in tests.
28
+ */
29
+ export declare const makeNode: (title: string, type: string, extra?: Record<string, unknown>, linkTargets?: string[]) => BaseNode;
30
+ /**
31
+ * Creates a SpaceNode with sensible defaults for use in tests.
32
+ */
33
+ export declare const makeSpaceNode: (title: string, type: string, extra?: Record<string, unknown>, linkTargets?: string[], resolvedParents?: ResolvedParentRef[], resolvedLinks?: SpaceNode["resolvedLinks"]) => SpaceNode;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Creates a ResolvedParentRef with sensible defaults for use in tests.
3
+ * Override any field to represent specific edge contexts.
4
+ */
5
+ export const makeParentRef = (title, overrides = {}) => {
6
+ const source = overrides.source ?? 'hierarchy';
7
+ return {
8
+ title,
9
+ field: 'parent',
10
+ source,
11
+ ...(source === 'hierarchy' ? { hierarchy: 'main' } : {}),
12
+ selfRef: false,
13
+ fieldOn: 'child',
14
+ ...overrides,
15
+ };
16
+ };
17
+ /**
18
+ * Creates a HierarchyLevel with defaults matching schema metadata normalization.
19
+ */
20
+ export const makeLevel = (type, overrides = {}) => ({
21
+ type,
22
+ field: 'parent',
23
+ fieldOn: 'child',
24
+ multiple: false,
25
+ selfRef: false,
26
+ ...overrides,
27
+ });
28
+ /**
29
+ * Creates a named Hierarchy (default name 'main') from normalized levels.
30
+ */
31
+ export const makeHierarchy = (levels, overrides = {}) => ({
32
+ name: 'main',
33
+ levels,
34
+ ...overrides,
35
+ });
36
+ /**
37
+ * SchemaMetadata fields for a schema whose only hierarchy is its main hierarchy.
38
+ */
39
+ export const withHierarchy = (levels, overrides = {}) => {
40
+ const hierarchy = makeHierarchy(levels, overrides);
41
+ return { hierarchy, hierarchies: [hierarchy] };
42
+ };
43
+ /**
44
+ * Creates a Relationship with defaults matching schema metadata normalization.
45
+ */
46
+ export const makeRelationship = (parent, type, overrides = {}) => ({
47
+ parent,
48
+ type,
49
+ field: 'parent',
50
+ fieldOn: 'child',
51
+ multiple: false,
52
+ ...overrides,
53
+ });
54
+ /**
55
+ * Creates a BaseNode with sensible defaults for use in tests.
56
+ */
57
+ export const makeNode = (title, type, extra = {}, linkTargets) => ({
58
+ label: `${title}.md`,
59
+ title,
60
+ schemaData: { title, type, ...extra },
61
+ linkTargets: linkTargets ?? [title],
62
+ type,
63
+ });
64
+ /**
65
+ * Creates a SpaceNode with sensible defaults for use in tests.
66
+ */
67
+ export const makeSpaceNode = (title, type, extra = {}, linkTargets, resolvedParents = [], resolvedLinks = []) => ({
68
+ ...makeNode(title, type, extra, linkTargets),
69
+ resolvedType: type,
70
+ resolvedParents,
71
+ resolvedLinks,
72
+ });
package/dist/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { AnySchemaObject, SchemaObject, ValidateFunction } from 'ajv';
2
- import type { Config, SpaceConfig } from './config';
3
- import type { MetadataContractHierarchyLevel, MetadataContractRelationship, Rule, SharedEdgeFields } from './schema/metadata-contract';
2
+ import type { Config, SpaceConfig } from './config.js';
3
+ import type { MetadataContractHierarchyLevel, MetadataContractRelationship, Rule, SharedEdgeFields } from './schema/metadata-contract.js';
4
4
  /**
5
5
  * Minimal normalized edge for graph resolution.
6
6
  * Derives routing fields from SharedEdgeFields to stay in sync with the schema.
@@ -40,11 +40,21 @@ export type ResolvedParentRef = {
40
40
  field: string;
41
41
  /** Whether this edge originates from a hierarchy level or a relationship definition. */
42
42
  source: 'hierarchy' | 'relationship';
43
+ /** Name of the hierarchy the edge belongs to. Set only when source is 'hierarchy'. */
44
+ hierarchy?: string;
43
45
  /** Whether the parent and child are the same node type (self-referential edge). */
44
46
  selfRef: boolean;
45
47
  /** Whether the edge field is on the child node (default) or on the parent node (fieldOn:'parent' edges). */
46
48
  fieldOn: 'child' | 'parent';
47
49
  };
50
+ export type SourceLocation = {
51
+ /** File path relative to the space root. */
52
+ file: string;
53
+ /** 1-indexed starting line number in the source file, if available. */
54
+ line?: number;
55
+ /** 1-indexed starting column number in the source file, if available. */
56
+ column?: number;
57
+ };
48
58
  export type UnresolvedRef = {
49
59
  /** Source identifier of the node containing the broken link. */
50
60
  label: string;
@@ -55,6 +65,8 @@ export type UnresolvedRef = {
55
65
  reason: 'not_found' | 'ambiguous' | 'invalid_shape';
56
66
  /** Human-readable message matching validate-graph output format. */
57
67
  message: string;
68
+ /** Source location of the node containing the broken link, if available. */
69
+ source?: SourceLocation;
58
70
  };
59
71
  /**
60
72
  * Shared fields for all content link variants.
@@ -107,11 +119,15 @@ export type BaseNode = {
107
119
  linkTargets: string[];
108
120
  /** Raw type string from content, as written by the user. */
109
121
  type: string;
122
+ /** Markdown source of the node's body, if any. First-class accessor mirroring schemaData.content. */
123
+ content?: string;
110
124
  /**
111
125
  * Links extracted from content body and non-edge string fields at parse time.
112
126
  * Populated by plugins that support content link extraction; absent if not populated.
113
127
  */
114
128
  contentLinks?: ContentLink[];
129
+ /** Source location of the node definition in the filesystem. */
130
+ source?: SourceLocation;
115
131
  };
116
132
  /**
117
133
  * A fully resolved node — enriched by core after plugin parsing.
@@ -143,15 +159,33 @@ export type ParseIssue = {
143
159
  type: 'no-type' | 'parse' | string;
144
160
  /** Human-readable detail. */
145
161
  message?: string;
162
+ /** 1-indexed line number in source file, if available. */
163
+ line?: number;
164
+ /** 1-indexed column number in source file, if available. */
165
+ column?: number;
146
166
  };
147
167
  /** Rule categories for organizing executable validation rules */
148
168
  export type RuleCategory = 'validation' | 'coherence' | 'workflow' | 'best-practice';
149
- export type { Rule } from './schema/metadata-contract';
169
+ /**
170
+ * Rule violation severity. Only `error` fails validation; `warning` and `info` are reported only.
171
+ * A rule's severity defaults from its category and may be overridden per rule.
172
+ */
173
+ export type RuleSeverity = 'error' | 'warning' | 'info';
174
+ export type { CoverageGate, GatingSeed } from './schema/gating.js';
175
+ export type { Rule } from './schema/metadata-contract.js';
150
176
  export type RuleViolation = {
177
+ /** Node label, or empty string for global-scope rules. */
151
178
  file: string;
152
179
  ruleId: string;
153
180
  category: RuleCategory;
181
+ severity: RuleSeverity;
154
182
  description: string;
183
+ /** Cited evidence or reasoning from evaluation (for semantic judge rules). */
184
+ evidence?: string;
185
+ /** The verdict that failed the rule (semantic rules). */
186
+ verdict?: string;
187
+ /** User-facing guidance declared for that verdict (semantic rules). */
188
+ guidance?: string;
155
189
  };
156
190
  export type GraphViolation = {
157
191
  file: string;
@@ -161,11 +195,18 @@ export type GraphViolation = {
161
195
  parentTitle: string;
162
196
  description: string;
163
197
  };
198
+ /** A named hierarchy, normalized from a schema's `$metadata.hierarchy`. */
199
+ export type Hierarchy = {
200
+ /** Declared short name, defaulting to the declaring schema's file stem. */
201
+ name: string;
202
+ levels: HierarchyLevel[];
203
+ allowSkipLevels?: boolean;
204
+ };
164
205
  export type SchemaMetadata = {
165
- hierarchy?: {
166
- levels: HierarchyLevel[];
167
- allowSkipLevels?: boolean;
168
- };
206
+ /** Main hierarchy: used for space_on_a_page parsing, embedding, template-sync and default rendering. */
207
+ hierarchy?: Hierarchy;
208
+ /** Every hierarchy in the composed schema (main included), in composition order. Each type belongs to at most one. */
209
+ hierarchies?: Hierarchy[];
169
210
  typeAliases?: Record<string, string>;
170
211
  rules?: Rule[];
171
212
  relationships?: Relationship[];
@@ -201,21 +242,28 @@ export type SpaceContext = {
201
242
  /** Directory of the config file that defines this space. Used for resolving relative paths in plugin configs. */
202
243
  configDir: string;
203
244
  };
245
+ export interface FileValidationIssue {
246
+ kind: string;
247
+ message: string;
248
+ /** Present for rule violations (`kind: 'rule'`). */
249
+ severity?: RuleSeverity;
250
+ /** 1-indexed line number in source file, if available. */
251
+ line?: number;
252
+ /** 1-indexed column number in source file, if available. */
253
+ column?: number;
254
+ }
204
255
  export interface FileValidationResult {
205
256
  file: string;
206
257
  label: string;
207
258
  space: string;
208
259
  /** Errors keyed by composite id (e.g. `schema:/status:enum:active`, `rule:my-rule-id`). */
209
- errors: Record<string, {
210
- kind: string;
211
- message: string;
212
- }>;
260
+ errors: Record<string, FileValidationIssue>;
213
261
  errorCount: number;
214
- /** Warnings keyed by composite id. Do not affect exit code or errorCount. */
215
- warnings: Record<string, {
216
- kind: string;
217
- message: string;
218
- }>;
262
+ /**
263
+ * Warnings keyed by composite id, including `warning` and `info` severity rule violations.
264
+ * Do not affect exit code or errorCount.
265
+ */
266
+ warnings: Record<string, FileValidationIssue>;
219
267
  warningCount: number;
220
268
  inSpace: true;
221
269
  }
@@ -1,7 +1,9 @@
1
1
  import type { ErrorObject } from 'ajv';
2
- import type { Config } from './config';
3
- import { extractEntityInfo } from './schema/schema';
4
- import type { GraphViolation, ParseIssue, ReadSpaceResult, RuleViolation, SchemaWithMetadata, SpaceContext, SpaceNode, ValidateFileOutput } from './types';
2
+ import type { Config, SpaceConfig } from './config.js';
3
+ import type { SemanticJudgeProvider } from './judge/types.js';
4
+ import { type RuleFilter } from './schema/rule-filter.js';
5
+ import { extractEntityInfo } from './schema/schema.js';
6
+ import type { CoverageGate, FileNotInSpaceResult, FileValidationResult, GraphViolation, ParseIssue, ReadSpaceResult, RuleViolation, SchemaWithMetadata, SpaceContext, SpaceNode, ValidateFileOutput } from './types.js';
5
7
  export interface FormattedError {
6
8
  message: string;
7
9
  dedupeKey: string;
@@ -11,11 +13,13 @@ export interface ValidationResult {
11
13
  nodeErrorCount: number;
12
14
  nodeErrors: Array<{
13
15
  file: string;
16
+ line?: number;
14
17
  errors: ErrorObject[];
15
18
  nodeData: Record<string, unknown>;
16
19
  }>;
17
20
  refErrors: Array<{
18
21
  file: string;
22
+ line?: number;
19
23
  parent: string;
20
24
  error: string;
21
25
  }>;
@@ -23,6 +27,7 @@ export interface ValidationResult {
23
27
  title: string;
24
28
  files: string[];
25
29
  }>;
30
+ /** All rule violations with their effective severity. Only `error` severity fails validation. */
26
31
  ruleViolations: RuleViolation[];
27
32
  hierarchyViolations: GraphViolation[];
28
33
  orphans: SpaceNode[];
@@ -32,19 +37,69 @@ export interface ValidationResult {
32
37
  file: string;
33
38
  target: string;
34
39
  }>;
40
+ /**
41
+ * Cascade gates: nodes whose schema/hierarchy failure or blocking rule violation
42
+ * suppressed rule evaluation for themselves and/or their hierarchy subtree.
43
+ * See docs/rules.md for gating semantics.
44
+ */
45
+ coverageGates: CoverageGate[];
46
+ /** Semantic rule input that had content trimmed to fit the per-node input cap: the node count and the rule ids. */
47
+ contextTrimmed: {
48
+ nodeCount: number;
49
+ ruleIds: string[];
50
+ };
51
+ /** Nodes excluded from validation entirely by a `depth` limit (breadth-first from hierarchy roots). */
52
+ skippedByDepth: Array<{
53
+ file: string;
54
+ title: string;
55
+ }>;
56
+ /** The depth limit applied, if any (undefined means the full space was validated). */
57
+ depthLimit?: number;
35
58
  }
36
59
  /**
37
60
  * Format AJV errors for better readability.
38
61
  * Groups related errors and extracts helpful context like allowed values.
39
62
  */
40
63
  export declare function formatErrors(errors: ErrorObject[], schema: SchemaWithMetadata, schemaRefRegistry: Parameters<typeof extractEntityInfo>[1], nodeData: Record<string, unknown>): FormattedError[];
64
+ export interface ValidateSpaceOptions {
65
+ readResult?: ReadSpaceResult;
66
+ /** Limit validation to hierarchy nodes within N breadth-first levels from the top. */
67
+ depth?: number;
68
+ /** Evaluate rules on gated nodes anyway (gates are still reported). */
69
+ includeGated?: boolean;
70
+ /** Evaluate only rules matching this filter (see `parseRuleFilter`). */
71
+ ruleFilter?: RuleFilter;
72
+ /** Evaluates `semantic` rules. Without one, a rule runs only its `expression`, and a semantic-only rule is skipped. */
73
+ judge?: SemanticJudgeProvider;
74
+ }
75
+ /** One-line text for a rule violation: rule, description, and any evidence and verdict guidance. */
76
+ export declare function ruleViolationMessage(v: RuleViolation): string;
41
77
  /**
42
78
  * Run full validation on a space and return a structured result.
43
79
  * Does not output to console or call process.exit.
44
80
  */
45
- export declare function validateSpace(context: SpaceContext, options?: {
46
- readResult?: ReadSpaceResult;
47
- }): Promise<ValidationResult>;
81
+ export declare function validateSpace(context: SpaceContext, options?: ValidateSpaceOptions): Promise<ValidationResult>;
82
+ /** Find which space a file belongs to by checking directory containment. */
83
+ export declare function resolveFileSpace(filePath: string, config: Config): {
84
+ space: SpaceConfig;
85
+ label: string;
86
+ } | null;
87
+ export interface ValidateFileOptions {
88
+ configDir?: string;
89
+ /** Evaluate rules on gated nodes anyway (gates are still reported). */
90
+ includeGated?: boolean;
91
+ /** Evaluate only rules matching this filter (see `parseRuleFilter`). */
92
+ ruleFilter?: RuleFilter;
93
+ /** Evaluates `semantic` rules. Without one, a rule runs only its `expression`, and a semantic-only rule is skipped. */
94
+ judge?: SemanticJudgeProvider;
95
+ }
96
+ /** The result for a file that belongs to no configured space. */
97
+ export declare function fileNotInSpace(filePath: string): FileNotInSpaceResult;
98
+ /**
99
+ * Validate a file in an already-resolved space. Checks the whole space (required for graph
100
+ * correctness), judging only the file, then selects the file's issues from the result.
101
+ */
102
+ export declare function validateResolvedFile(filePath: string, label: string, context: SpaceContext, options?: Omit<ValidateFileOptions, 'configDir'>): Promise<FileValidationResult>;
48
103
  /**
49
104
  * Validate a single file within its space.
50
105
  *
@@ -54,6 +109,4 @@ export declare function validateSpace(context: SpaceContext, options?: {
54
109
  * Returns a result object — does not output to console or call process.exit.
55
110
  * If the file is not in any configured space, returns a result with `inSpace: false`.
56
111
  */
57
- export declare function validateFile(filePath: string, config: Config, options?: {
58
- configDir?: string;
59
- }): Promise<ValidateFileOutput>;
112
+ export declare function validateFile(filePath: string, config: Config, options?: ValidateFileOptions): Promise<ValidateFileOutput>;