Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ flowchart LR
| Nodes → Output | Validated node set; output commands interpret as needed |
| Config → Output | `fieldMap` (reverse) applied by template-sync for file field names |

Validation runs as one pipeline over the whole space. `validateSpace` returns its full result, and `validateFile` returns the part that belongs to one file, so a file's results match its part of a full run.

---

## Field Remapping
Expand Down
23 changes: 15 additions & 8 deletions src/commands/validate-file.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { loadConfig } from '../config';
import { judgeForRun } from '../judge/factory';
import { parseRuleFilter } from '../schema/rule-filter';
import type { FileValidationIssue, FileValidationResult } from '../types';
import { resolveFileSpace, validateFile } from '../validate';
import { createSpaceContext } from '../space-context';
import type { FileValidationIssue, FileValidationResult, ValidateFileOutput } from '../types';
import { fileNotInSpace, resolveFileSpace, validateResolvedFile } from '../validate';

export { validateFile } from '../validate';

Expand All @@ -16,12 +17,18 @@ export async function validateFileCommand(
options: { json?: boolean; includeGated?: boolean; semantic?: boolean; judge?: string; ruleFilter?: string[] } = {},
): Promise<number> {
const config = loadConfig();
const space = resolveFileSpace(filePath, config)?.space;
const result = await validateFile(filePath, config, {
includeGated: options.includeGated,
judge: space && judgeForRun(config, space, options),
ruleFilter: options.ruleFilter && parseRuleFilter(options.ruleFilter),
});
const resolved = resolveFileSpace(filePath, config);
let result: ValidateFileOutput;
if (resolved) {
const judge = judgeForRun(config, resolved.space, options);
result = await validateResolvedFile(filePath, resolved.label, createSpaceContext(resolved.space.name, config), {
includeGated: options.includeGated,
judge,
ruleFilter: options.ruleFilter && parseRuleFilter(options.ruleFilter),
});
} else {
result = fileNotInSpace(filePath);
}

if (!result.inSpace) {
if (options.json) {
Expand Down
Loading
Loading