@graph-ir/core 0.2.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/LICENSE +21 -0
- package/README.md +26 -0
- package/dist/generation/id-generator.d.ts +81 -0
- package/dist/generation/id-generator.d.ts.map +1 -0
- package/dist/generation/id-generator.js +193 -0
- package/dist/generation/id-generator.js.map +1 -0
- package/dist/generation/index.d.ts +7 -0
- package/dist/generation/index.d.ts.map +1 -0
- package/dist/generation/index.js +7 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/output/ci.d.ts +36 -0
- package/dist/output/ci.d.ts.map +1 -0
- package/dist/output/ci.js +145 -0
- package/dist/output/ci.js.map +1 -0
- package/dist/output/index.d.ts +20 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +40 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/json.d.ts +24 -0
- package/dist/output/json.d.ts.map +1 -0
- package/dist/output/json.js +49 -0
- package/dist/output/json.js.map +1 -0
- package/dist/output/pretty.d.ts +44 -0
- package/dist/output/pretty.d.ts.map +1 -0
- package/dist/output/pretty.js +227 -0
- package/dist/output/pretty.js.map +1 -0
- package/dist/output/types.d.ts +63 -0
- package/dist/output/types.d.ts.map +1 -0
- package/dist/output/types.js +5 -0
- package/dist/output/types.js.map +1 -0
- package/dist/schemas/graph-ir.schema.json +360 -0
- package/dist/skills/diff.d.ts +73 -0
- package/dist/skills/diff.d.ts.map +1 -0
- package/dist/skills/diff.js +315 -0
- package/dist/skills/diff.js.map +1 -0
- package/dist/skills/migrate.d.ts +40 -0
- package/dist/skills/migrate.d.ts.map +1 -0
- package/dist/skills/migrate.js +288 -0
- package/dist/skills/migrate.js.map +1 -0
- package/dist/skills/visualize.d.ts +30 -0
- package/dist/skills/visualize.d.ts.map +1 -0
- package/dist/skills/visualize.js +254 -0
- package/dist/skills/visualize.js.map +1 -0
- package/dist/symbols/index.d.ts +12 -0
- package/dist/symbols/index.d.ts.map +1 -0
- package/dist/symbols/index.js +12 -0
- package/dist/symbols/index.js.map +1 -0
- package/dist/symbols/notation-registry.d.ts +61 -0
- package/dist/symbols/notation-registry.d.ts.map +1 -0
- package/dist/symbols/notation-registry.js +114 -0
- package/dist/symbols/notation-registry.js.map +1 -0
- package/dist/symbols/symbol-registry.d.ts +58 -0
- package/dist/symbols/symbol-registry.d.ts.map +1 -0
- package/dist/symbols/symbol-registry.js +88 -0
- package/dist/symbols/symbol-registry.js.map +1 -0
- package/dist/symbols/types.d.ts +166 -0
- package/dist/symbols/types.d.ts.map +1 -0
- package/dist/symbols/types.js +13 -0
- package/dist/symbols/types.js.map +1 -0
- package/dist/testing/diff.d.ts +46 -0
- package/dist/testing/diff.d.ts.map +1 -0
- package/dist/testing/diff.js +400 -0
- package/dist/testing/diff.js.map +1 -0
- package/dist/testing/index.d.ts +10 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +10 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/snapshot.d.ts +95 -0
- package/dist/testing/snapshot.d.ts.map +1 -0
- package/dist/testing/snapshot.js +172 -0
- package/dist/testing/snapshot.js.map +1 -0
- package/dist/types.d.ts +240 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +8 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/ir-validator.d.ts +51 -0
- package/dist/validation/ir-validator.d.ts.map +1 -0
- package/dist/validation/ir-validator.js +349 -0
- package/dist/validation/ir-validator.js.map +1 -0
- package/dist/validation/validator.d.ts +13 -0
- package/dist/validation/validator.d.ts.map +1 -0
- package/dist/validation/validator.js +19 -0
- package/dist/validation/validator.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output module for Graph-IR
|
|
3
|
+
*
|
|
4
|
+
* Formatters for validation results in various output formats.
|
|
5
|
+
*/
|
|
6
|
+
// Pretty formatter
|
|
7
|
+
export { PrettyFormatter, formatError, formatWarning, formatSummary, box, table, } from './pretty.js';
|
|
8
|
+
// JSON formatter
|
|
9
|
+
export { JsonFormatter, formatCompactJson, formatPrettyJson, } from './json.js';
|
|
10
|
+
// CI/GitHub formatter
|
|
11
|
+
export { errorToAnnotation, validationToAnnotations, formatGitHubAnnotation, formatGitHubAnnotations, formatGitHubGroup, formatGitHubOutput, formatGitHubSummary, } from './ci.js';
|
|
12
|
+
import { PrettyFormatter } from './pretty.js';
|
|
13
|
+
import { JsonFormatter } from './json.js';
|
|
14
|
+
import { formatGitHubAnnotations } from './ci.js';
|
|
15
|
+
/**
|
|
16
|
+
* Create a formatter for the specified output format
|
|
17
|
+
*/
|
|
18
|
+
export function createFormatter(format, options) {
|
|
19
|
+
switch (format) {
|
|
20
|
+
case 'pretty':
|
|
21
|
+
return new PrettyFormatter(options);
|
|
22
|
+
case 'json':
|
|
23
|
+
return new JsonFormatter(options);
|
|
24
|
+
case 'github':
|
|
25
|
+
// GitHub format uses a simple wrapper
|
|
26
|
+
return {
|
|
27
|
+
format: (result) => formatGitHubAnnotations(result, options),
|
|
28
|
+
};
|
|
29
|
+
default:
|
|
30
|
+
throw new Error(`Unknown format: ${format}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Format validation result using the specified format
|
|
35
|
+
*/
|
|
36
|
+
export function formatResult(result, format = 'pretty', options) {
|
|
37
|
+
const formatter = createFormatter(format, options);
|
|
38
|
+
return formatter.format(result);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":"AAAA;;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1
|
+
/**
|
|
2
|
+
* JSON Formatter for Structured Output
|
|
3
|
+
*
|
|
4
|
+
* Formats validation results as JSON for programmatic consumption.
|
|
5
|
+
*/
|
|
6
|
+
import type { ValidationResult } from '../types.js';
|
|
7
|
+
import type { Formatter, JsonFormatOptions } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* JSON formatter for structured output
|
|
10
|
+
*/
|
|
11
|
+
export declare class JsonFormatter implements Formatter {
|
|
12
|
+
private options;
|
|
13
|
+
constructor(options?: JsonFormatOptions);
|
|
14
|
+
format(result: ValidationResult): string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Format result as compact JSON (single line)
|
|
18
|
+
*/
|
|
19
|
+
export declare function formatCompactJson(result: ValidationResult): string;
|
|
20
|
+
/**
|
|
21
|
+
* Format result as pretty JSON (indented)
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatPrettyJson(result: ValidationResult, indent?: number): string;
|
|
24
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/output/json.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAQ/D;;GAEG;AACH,qBAAa,aAAc,YAAW,SAAS;IAC7C,OAAO,CAAC,OAAO,CAA8B;gBAEjC,OAAO,GAAE,iBAAsB;IAI3C,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;CAqBzC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAElE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,gBAAgB,EACxB,MAAM,GAAE,MAAU,GACjB,MAAM,CAER"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Formatter for Structured Output
|
|
3
|
+
*
|
|
4
|
+
* Formats validation results as JSON for programmatic consumption.
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_OPTIONS = {
|
|
7
|
+
pretty: true,
|
|
8
|
+
indent: 2,
|
|
9
|
+
includeTimestamp: false,
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* JSON formatter for structured output
|
|
13
|
+
*/
|
|
14
|
+
export class JsonFormatter {
|
|
15
|
+
options;
|
|
16
|
+
constructor(options = {}) {
|
|
17
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
18
|
+
}
|
|
19
|
+
format(result) {
|
|
20
|
+
const output = {
|
|
21
|
+
valid: result.valid,
|
|
22
|
+
errors: result.errors,
|
|
23
|
+
warnings: result.warnings,
|
|
24
|
+
};
|
|
25
|
+
if (result.stats) {
|
|
26
|
+
output.stats = result.stats;
|
|
27
|
+
}
|
|
28
|
+
if (this.options.includeTimestamp) {
|
|
29
|
+
output.timestamp = new Date().toISOString();
|
|
30
|
+
}
|
|
31
|
+
if (this.options.pretty) {
|
|
32
|
+
return JSON.stringify(output, null, this.options.indent);
|
|
33
|
+
}
|
|
34
|
+
return JSON.stringify(output);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Format result as compact JSON (single line)
|
|
39
|
+
*/
|
|
40
|
+
export function formatCompactJson(result) {
|
|
41
|
+
return new JsonFormatter({ pretty: false }).format(result);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Format result as pretty JSON (indented)
|
|
45
|
+
*/
|
|
46
|
+
export function formatPrettyJson(result, indent = 2) {
|
|
47
|
+
return new JsonFormatter({ pretty: true, indent }).format(result);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=json.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/output/json.ts"],"names":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CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pretty Formatter for Terminal Output
|
|
3
|
+
*
|
|
4
|
+
* Formats validation results for human-readable terminal display.
|
|
5
|
+
*/
|
|
6
|
+
import type { ValidationResult, ValidationError } from '../types.js';
|
|
7
|
+
import type { Formatter, PrettyFormatOptions } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Pretty formatter for terminal output
|
|
10
|
+
*/
|
|
11
|
+
export declare class PrettyFormatter implements Formatter {
|
|
12
|
+
private options;
|
|
13
|
+
constructor(options?: PrettyFormatOptions);
|
|
14
|
+
format(result: ValidationResult): string;
|
|
15
|
+
private section;
|
|
16
|
+
private color;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Format a single error
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatError(error: ValidationError, options?: Pick<PrettyFormatOptions, 'colors' | 'showSuggestions'>): string;
|
|
22
|
+
/**
|
|
23
|
+
* Format a single warning
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatWarning(warning: ValidationError, options?: Pick<PrettyFormatOptions, 'colors' | 'showSuggestions'>): string;
|
|
26
|
+
/**
|
|
27
|
+
* Format summary line
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatSummary(result: ValidationResult, options?: Pick<PrettyFormatOptions, 'colors' | 'showStats'>): string;
|
|
30
|
+
/**
|
|
31
|
+
* Draw a box around text
|
|
32
|
+
*/
|
|
33
|
+
export declare function box(content: string, options?: {
|
|
34
|
+
width?: number;
|
|
35
|
+
padding?: number;
|
|
36
|
+
}): string;
|
|
37
|
+
/**
|
|
38
|
+
* Create a simple table
|
|
39
|
+
*/
|
|
40
|
+
export declare function table(rows: string[][], options?: {
|
|
41
|
+
headers?: string[];
|
|
42
|
+
padding?: number;
|
|
43
|
+
}): string;
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E,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GACrD,MAAM,CA4BR"}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pretty Formatter for Terminal Output
|
|
3
|
+
*
|
|
4
|
+
* Formats validation results for human-readable terminal display.
|
|
5
|
+
*/
|
|
6
|
+
// ANSI color codes
|
|
7
|
+
const colors = {
|
|
8
|
+
reset: '\x1b[0m',
|
|
9
|
+
bold: '\x1b[1m',
|
|
10
|
+
dim: '\x1b[2m',
|
|
11
|
+
red: '\x1b[31m',
|
|
12
|
+
green: '\x1b[32m',
|
|
13
|
+
yellow: '\x1b[33m',
|
|
14
|
+
blue: '\x1b[34m',
|
|
15
|
+
cyan: '\x1b[36m',
|
|
16
|
+
white: '\x1b[37m',
|
|
17
|
+
};
|
|
18
|
+
const DEFAULT_OPTIONS = {
|
|
19
|
+
colors: true,
|
|
20
|
+
showStats: true,
|
|
21
|
+
showSuggestions: true,
|
|
22
|
+
maxErrors: 10,
|
|
23
|
+
maxWarnings: 5,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Pretty formatter for terminal output
|
|
27
|
+
*/
|
|
28
|
+
export class PrettyFormatter {
|
|
29
|
+
options;
|
|
30
|
+
constructor(options = {}) {
|
|
31
|
+
this.options = { ...DEFAULT_OPTIONS, ...options };
|
|
32
|
+
}
|
|
33
|
+
format(result) {
|
|
34
|
+
const lines = [];
|
|
35
|
+
// Header
|
|
36
|
+
lines.push('');
|
|
37
|
+
lines.push(formatSummary(result, this.options));
|
|
38
|
+
lines.push('');
|
|
39
|
+
// Errors
|
|
40
|
+
if (result.errors.length > 0) {
|
|
41
|
+
lines.push(this.section('Errors', result.errors.length));
|
|
42
|
+
const errorsToShow = this.options.maxErrors > 0
|
|
43
|
+
? result.errors.slice(0, this.options.maxErrors)
|
|
44
|
+
: result.errors;
|
|
45
|
+
for (const error of errorsToShow) {
|
|
46
|
+
lines.push(formatError(error, this.options));
|
|
47
|
+
}
|
|
48
|
+
const remaining = result.errors.length - errorsToShow.length;
|
|
49
|
+
if (remaining > 0) {
|
|
50
|
+
lines.push(this.color(` ... and ${remaining} more errors`, 'dim'));
|
|
51
|
+
}
|
|
52
|
+
lines.push('');
|
|
53
|
+
}
|
|
54
|
+
// Warnings
|
|
55
|
+
if (result.warnings.length > 0) {
|
|
56
|
+
lines.push(this.section('Warnings', result.warnings.length));
|
|
57
|
+
const warningsToShow = this.options.maxWarnings > 0
|
|
58
|
+
? result.warnings.slice(0, this.options.maxWarnings)
|
|
59
|
+
: result.warnings;
|
|
60
|
+
for (const warning of warningsToShow) {
|
|
61
|
+
lines.push(formatWarning(warning, this.options));
|
|
62
|
+
}
|
|
63
|
+
const remaining = result.warnings.length - warningsToShow.length;
|
|
64
|
+
if (remaining > 0) {
|
|
65
|
+
lines.push(this.color(` ... and ${remaining} more warnings`, 'dim'));
|
|
66
|
+
}
|
|
67
|
+
lines.push('');
|
|
68
|
+
}
|
|
69
|
+
// Stats
|
|
70
|
+
if (this.options.showStats && result.stats) {
|
|
71
|
+
lines.push(this.section('Stats'));
|
|
72
|
+
lines.push(` ${result.stats.nodes} nodes, ${result.stats.edges} edges`);
|
|
73
|
+
lines.push('');
|
|
74
|
+
}
|
|
75
|
+
return lines.join('\n');
|
|
76
|
+
}
|
|
77
|
+
section(title, count) {
|
|
78
|
+
const countStr = count !== undefined ? ` (${count})` : '';
|
|
79
|
+
return this.color(`${title}${countStr}:`, 'bold');
|
|
80
|
+
}
|
|
81
|
+
color(text, colorName) {
|
|
82
|
+
if (!this.options.colors)
|
|
83
|
+
return text;
|
|
84
|
+
return `${colors[colorName]}${text}${colors.reset}`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Format a single error
|
|
89
|
+
*/
|
|
90
|
+
export function formatError(error, options = {}) {
|
|
91
|
+
const useColors = options.colors ?? true;
|
|
92
|
+
const showSuggestions = options.showSuggestions ?? true;
|
|
93
|
+
const lines = [];
|
|
94
|
+
// Error code and path
|
|
95
|
+
const codeStr = useColors
|
|
96
|
+
? `${colors.red}${colors.bold}${error.code}${colors.reset}`
|
|
97
|
+
: error.code;
|
|
98
|
+
const pathStr = useColors
|
|
99
|
+
? `${colors.dim}${error.path}${colors.reset}`
|
|
100
|
+
: error.path;
|
|
101
|
+
lines.push(` ${codeStr} at ${pathStr}`);
|
|
102
|
+
lines.push(` ${error.message}`);
|
|
103
|
+
// Suggestion
|
|
104
|
+
if (showSuggestions && error.suggestion) {
|
|
105
|
+
const suggestionStr = useColors
|
|
106
|
+
? `${colors.cyan}${error.suggestion}${colors.reset}`
|
|
107
|
+
: error.suggestion;
|
|
108
|
+
lines.push(` ${suggestionStr}`);
|
|
109
|
+
}
|
|
110
|
+
return lines.join('\n');
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Format a single warning
|
|
114
|
+
*/
|
|
115
|
+
export function formatWarning(warning, options = {}) {
|
|
116
|
+
const useColors = options.colors ?? true;
|
|
117
|
+
const showSuggestions = options.showSuggestions ?? true;
|
|
118
|
+
const lines = [];
|
|
119
|
+
// Warning code and path
|
|
120
|
+
const codeStr = useColors
|
|
121
|
+
? `${colors.yellow}${warning.code}${colors.reset}`
|
|
122
|
+
: warning.code;
|
|
123
|
+
const pathStr = useColors
|
|
124
|
+
? `${colors.dim}${warning.path}${colors.reset}`
|
|
125
|
+
: warning.path;
|
|
126
|
+
lines.push(` ${codeStr} at ${pathStr}`);
|
|
127
|
+
lines.push(` ${warning.message}`);
|
|
128
|
+
// Suggestion
|
|
129
|
+
if (showSuggestions && warning.suggestion) {
|
|
130
|
+
const suggestionStr = useColors
|
|
131
|
+
? `${colors.cyan}${warning.suggestion}${colors.reset}`
|
|
132
|
+
: warning.suggestion;
|
|
133
|
+
lines.push(` ${suggestionStr}`);
|
|
134
|
+
}
|
|
135
|
+
return lines.join('\n');
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Format summary line
|
|
139
|
+
*/
|
|
140
|
+
export function formatSummary(result, options = {}) {
|
|
141
|
+
const useColors = options.colors ?? true;
|
|
142
|
+
const showStats = options.showStats ?? true;
|
|
143
|
+
const parts = [];
|
|
144
|
+
// Status
|
|
145
|
+
if (result.valid) {
|
|
146
|
+
const statusStr = useColors
|
|
147
|
+
? `${colors.green}${colors.bold}✓ Valid${colors.reset}`
|
|
148
|
+
: '✓ Valid';
|
|
149
|
+
parts.push(statusStr);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const statusStr = useColors
|
|
153
|
+
? `${colors.red}${colors.bold}✗ Invalid${colors.reset}`
|
|
154
|
+
: '✗ Invalid';
|
|
155
|
+
parts.push(statusStr);
|
|
156
|
+
}
|
|
157
|
+
// Error/warning counts
|
|
158
|
+
const counts = [];
|
|
159
|
+
if (result.errors.length > 0) {
|
|
160
|
+
const errStr = `${result.errors.length} error${result.errors.length === 1 ? '' : 's'}`;
|
|
161
|
+
counts.push(useColors ? `${colors.red}${errStr}${colors.reset}` : errStr);
|
|
162
|
+
}
|
|
163
|
+
if (result.warnings.length > 0) {
|
|
164
|
+
const warnStr = `${result.warnings.length} warning${result.warnings.length === 1 ? '' : 's'}`;
|
|
165
|
+
counts.push(useColors ? `${colors.yellow}${warnStr}${colors.reset}` : warnStr);
|
|
166
|
+
}
|
|
167
|
+
if (counts.length > 0) {
|
|
168
|
+
parts.push(`(${counts.join(', ')})`);
|
|
169
|
+
}
|
|
170
|
+
// Stats
|
|
171
|
+
if (showStats && result.stats) {
|
|
172
|
+
const statsStr = `${result.stats.nodes} nodes, ${result.stats.edges} edges`;
|
|
173
|
+
parts.push(useColors ? `${colors.dim}[${statsStr}]${colors.reset}` : `[${statsStr}]`);
|
|
174
|
+
}
|
|
175
|
+
return parts.join(' ');
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Draw a box around text
|
|
179
|
+
*/
|
|
180
|
+
export function box(content, options = {}) {
|
|
181
|
+
const width = options.width ?? content.length + 4;
|
|
182
|
+
const padding = options.padding ?? 1;
|
|
183
|
+
const innerWidth = width - 2;
|
|
184
|
+
const paddedContent = content.padStart(Math.floor((innerWidth + content.length) / 2)).padEnd(innerWidth);
|
|
185
|
+
const lines = [];
|
|
186
|
+
// Top border
|
|
187
|
+
lines.push('┌' + '─'.repeat(innerWidth) + '┐');
|
|
188
|
+
// Padding lines
|
|
189
|
+
for (let i = 0; i < padding; i++) {
|
|
190
|
+
lines.push('│' + ' '.repeat(innerWidth) + '│');
|
|
191
|
+
}
|
|
192
|
+
// Content
|
|
193
|
+
lines.push('│' + paddedContent + '│');
|
|
194
|
+
// Padding lines
|
|
195
|
+
for (let i = 0; i < padding; i++) {
|
|
196
|
+
lines.push('│' + ' '.repeat(innerWidth) + '│');
|
|
197
|
+
}
|
|
198
|
+
// Bottom border
|
|
199
|
+
lines.push('└' + '─'.repeat(innerWidth) + '┘');
|
|
200
|
+
return lines.join('\n');
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Create a simple table
|
|
204
|
+
*/
|
|
205
|
+
export function table(rows, options = {}) {
|
|
206
|
+
const padding = options.padding ?? 1;
|
|
207
|
+
const allRows = options.headers ? [options.headers, ...rows] : rows;
|
|
208
|
+
// Calculate column widths
|
|
209
|
+
const colWidths = [];
|
|
210
|
+
for (const row of allRows) {
|
|
211
|
+
row.forEach((cell, i) => {
|
|
212
|
+
colWidths[i] = Math.max(colWidths[i] ?? 0, cell.length);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const lines = [];
|
|
216
|
+
for (let i = 0; i < allRows.length; i++) {
|
|
217
|
+
const row = allRows[i];
|
|
218
|
+
const cells = row.map((cell, j) => cell.padEnd(colWidths[j] + padding));
|
|
219
|
+
lines.push(cells.join(''));
|
|
220
|
+
// Separator after headers
|
|
221
|
+
if (options.headers && i === 0) {
|
|
222
|
+
lines.push(colWidths.map(w => '─'.repeat(w + padding)).join(''));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return lines.join('\n');
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=pretty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty.js","sourceRoot":"","sources":["../../src/output/pretty.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,mBAAmB;AACnB,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF,MAAM,eAAe,GAAkC;IACrD,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;IACf,eAAe,EAAE,IAAI;IACrB,SAAS,EAAE,EAAE;IACb,WAAW,EAAE,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,eAAe;IAClB,OAAO,CAAgC;IAE/C,YAAY,UAA+B,EAAE;QAC3C,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,OAAO,EAAE,CAAC;IACpD,CAAC;IAED,MAAM,CAAC,MAAwB;QAC7B,MAAM,KAAK,GAAa,EAAE,CAAC;QAE3B,SAAS;QACT,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEf,SAAS;QACT,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC7B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,C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IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACvB,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAChC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CACpC,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QAE3B,0BAA0B;QAC1B,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output types for Graph-IR formatters
|
|
3
|
+
*/
|
|
4
|
+
import type { ValidationResult } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Output format options
|
|
7
|
+
*/
|
|
8
|
+
export type OutputFormat = 'pretty' | 'json' | 'github';
|
|
9
|
+
/**
|
|
10
|
+
* Formatter interface
|
|
11
|
+
*/
|
|
12
|
+
export interface Formatter {
|
|
13
|
+
format(result: ValidationResult): string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* GitHub annotation for CI integration
|
|
17
|
+
*/
|
|
18
|
+
export interface GitHubAnnotation {
|
|
19
|
+
file?: string;
|
|
20
|
+
line?: number;
|
|
21
|
+
endLine?: number;
|
|
22
|
+
col?: number;
|
|
23
|
+
endColumn?: number;
|
|
24
|
+
title: string;
|
|
25
|
+
message: string;
|
|
26
|
+
level: 'error' | 'warning' | 'notice';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options for pretty formatting
|
|
30
|
+
*/
|
|
31
|
+
export interface PrettyFormatOptions {
|
|
32
|
+
/** Include colors in output (default: true) */
|
|
33
|
+
colors?: boolean;
|
|
34
|
+
/** Show stats summary (default: true) */
|
|
35
|
+
showStats?: boolean;
|
|
36
|
+
/** Show suggestions (default: true) */
|
|
37
|
+
showSuggestions?: boolean;
|
|
38
|
+
/** Maximum errors to show (default: 10, 0 = unlimited) */
|
|
39
|
+
maxErrors?: number;
|
|
40
|
+
/** Maximum warnings to show (default: 5, 0 = unlimited) */
|
|
41
|
+
maxWarnings?: number;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Options for JSON formatting
|
|
45
|
+
*/
|
|
46
|
+
export interface JsonFormatOptions {
|
|
47
|
+
/** Pretty print with indentation (default: true) */
|
|
48
|
+
pretty?: boolean;
|
|
49
|
+
/** Indentation size (default: 2) */
|
|
50
|
+
indent?: number;
|
|
51
|
+
/** Include timestamp (default: false) */
|
|
52
|
+
includeTimestamp?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Options for CI/GitHub formatting
|
|
56
|
+
*/
|
|
57
|
+
export interface CIFormatOptions {
|
|
58
|
+
/** File path for annotations */
|
|
59
|
+
filePath?: string;
|
|
60
|
+
/** Base directory for relative paths */
|
|
61
|
+
baseDir?: string;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["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