@kernlang/cli 3.5.9-canary.220.1.c398cd95 → 4.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/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/check.d.ts +60 -0
- package/dist/commands/check.js +296 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/shared.d.ts +1 -1
- package/package.json +17 -16
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { runApply } from './commands/apply.js';
|
|
3
|
+
import { runCheck } from './commands/check.js';
|
|
3
4
|
import { runCompile } from './commands/compile.js';
|
|
4
5
|
import { runConfidence } from './commands/confidence.js';
|
|
5
6
|
import { runContext } from './commands/context.js';
|
|
@@ -21,6 +22,7 @@ const cmd = args[0];
|
|
|
21
22
|
// ── Command registry ─────────────────────────────────────────────────────
|
|
22
23
|
const COMMANDS = {
|
|
23
24
|
dev: runDev,
|
|
25
|
+
check: runCheck,
|
|
24
26
|
compile: runCompile,
|
|
25
27
|
init: runInit,
|
|
26
28
|
test: runTest,
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBA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I,CAAC,EAAE,CAAC;gBACzB,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;gBAC/B,IAAI,KAAK,KAAK,CAAC,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC5C,CAAC,EAAE,CAAC;gBACN,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,YAAY,GAAG,IAAI,CAAC;gBACpB,MAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,SAAS,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,oCAAoC;QACpC,YAAY,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAE,GAAa,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,MAAM,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export type CheckSeverity = 'error' | 'warning';
|
|
2
|
+
export type CheckCategory = 'declaration' | 'call' | 'return' | 'parse' | 'semantic';
|
|
3
|
+
/** A single CLI-level diagnostic, normalized across every library checker. */
|
|
4
|
+
export interface CheckDiagnosticOut {
|
|
5
|
+
/** Path relative to the resolved scan root. */
|
|
6
|
+
file: string;
|
|
7
|
+
/** 1-based line, or null when the library diagnostic carries no location. */
|
|
8
|
+
line: number | null;
|
|
9
|
+
/** 1-based column, or null when unavailable. */
|
|
10
|
+
column: number | null;
|
|
11
|
+
severity: CheckSeverity;
|
|
12
|
+
category: CheckCategory;
|
|
13
|
+
/** Library rule id, verbatim. */
|
|
14
|
+
rule: string;
|
|
15
|
+
/** Human-readable reason, verbatim from the library diagnostic. */
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CheckSummary {
|
|
19
|
+
filesScanned: number;
|
|
20
|
+
filesWithParseErrors: number;
|
|
21
|
+
diagnosticCount: number;
|
|
22
|
+
errorCount: number;
|
|
23
|
+
warningCount: number;
|
|
24
|
+
returnChecksRun: number;
|
|
25
|
+
durationMs: number;
|
|
26
|
+
}
|
|
27
|
+
export interface CheckReport {
|
|
28
|
+
schemaVersion: '1.0';
|
|
29
|
+
tool: 'kern-check';
|
|
30
|
+
checkerVersion: string;
|
|
31
|
+
root: string;
|
|
32
|
+
diagnostics: CheckDiagnosticOut[];
|
|
33
|
+
summary: CheckSummary;
|
|
34
|
+
}
|
|
35
|
+
export interface RunCheckOptions {
|
|
36
|
+
withSemantics: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Pure exit-code decision. Unit-testable without IO.
|
|
40
|
+
*
|
|
41
|
+
* - ≥1 error-severity diagnostic → 1
|
|
42
|
+
* - ≥1 warning-severity diagnostic AND `strict` → 1
|
|
43
|
+
* - otherwise → 0
|
|
44
|
+
*/
|
|
45
|
+
export declare function exitCodeFor(summary: CheckSummary, strict: boolean): 0 | 1;
|
|
46
|
+
/**
|
|
47
|
+
* Read the version of `@kernlang/check` from its installed package.json by
|
|
48
|
+
* ascending from this module's directory to the nearest
|
|
49
|
+
* `node_modules/@kernlang/check/package.json`. The package's `exports` map does
|
|
50
|
+
* not expose `./package.json`, so we read the file directly rather than via
|
|
51
|
+
* module resolution. Falls back to `'unknown'` if it cannot be located.
|
|
52
|
+
*/
|
|
53
|
+
export declare function readCheckerVersion(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Run the type-checker (and, optionally, semantic validation) over a file or
|
|
56
|
+
* directory and produce the stable {@link CheckReport}. Pure with respect to
|
|
57
|
+
* process state apart from reading the filesystem.
|
|
58
|
+
*/
|
|
59
|
+
export declare function collectCheck(target: string, opts: RunCheckOptions): CheckReport;
|
|
60
|
+
export declare function runCheck(args: string[]): Promise<void>;
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { checkCalls, checkProgram, checkReturns } from '@kernlang/check';
|
|
2
|
+
import { parseDocumentWithDiagnostics, validateSemantics } from '@kernlang/core';
|
|
3
|
+
import { existsSync, readFileSync, statSync } from 'fs';
|
|
4
|
+
import { dirname, join, relative, resolve } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { findKernFiles, hasFlag } from '../shared.js';
|
|
7
|
+
// Mirror the discovery filter used by `commands/self-coverage.ts`.
|
|
8
|
+
const SKIP_DIRS = new Set(['build', '.kern-gaps', 'coverage', '.next', '.turbo', '.vercel', 'generated']);
|
|
9
|
+
/**
|
|
10
|
+
* Pure exit-code decision. Unit-testable without IO.
|
|
11
|
+
*
|
|
12
|
+
* - ≥1 error-severity diagnostic → 1
|
|
13
|
+
* - ≥1 warning-severity diagnostic AND `strict` → 1
|
|
14
|
+
* - otherwise → 0
|
|
15
|
+
*/
|
|
16
|
+
export function exitCodeFor(summary, strict) {
|
|
17
|
+
if (summary.errorCount > 0)
|
|
18
|
+
return 1;
|
|
19
|
+
if (strict && summary.warningCount > 0)
|
|
20
|
+
return 1;
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Read the version of `@kernlang/check` from its installed package.json by
|
|
25
|
+
* ascending from this module's directory to the nearest
|
|
26
|
+
* `node_modules/@kernlang/check/package.json`. The package's `exports` map does
|
|
27
|
+
* not expose `./package.json`, so we read the file directly rather than via
|
|
28
|
+
* module resolution. Falls back to `'unknown'` if it cannot be located.
|
|
29
|
+
*/
|
|
30
|
+
export function readCheckerVersion() {
|
|
31
|
+
let dir;
|
|
32
|
+
try {
|
|
33
|
+
dir = dirname(fileURLToPath(import.meta.url));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
dir = process.cwd();
|
|
37
|
+
}
|
|
38
|
+
while (true) {
|
|
39
|
+
const candidate = join(dir, 'node_modules', '@kernlang', 'check', 'package.json');
|
|
40
|
+
if (existsSync(candidate)) {
|
|
41
|
+
try {
|
|
42
|
+
const pkg = JSON.parse(readFileSync(candidate, 'utf-8'));
|
|
43
|
+
if (typeof pkg.version === 'string')
|
|
44
|
+
return pkg.version;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// fall through to keep ascending
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const parent = dirname(dir);
|
|
51
|
+
if (parent === dir)
|
|
52
|
+
break;
|
|
53
|
+
dir = parent;
|
|
54
|
+
}
|
|
55
|
+
return 'unknown';
|
|
56
|
+
}
|
|
57
|
+
function listKernFiles(root) {
|
|
58
|
+
return (findKernFiles(root)
|
|
59
|
+
.filter((file) => !relative(root, file)
|
|
60
|
+
.split(/[\\/]/)
|
|
61
|
+
.some((part) => SKIP_DIRS.has(part)))
|
|
62
|
+
// `findKernFiles` matches any entry whose name ends in `.kern`, including
|
|
63
|
+
// DIRECTORIES named `*.kern` (the repo has a `.kern/` config dir). Those are
|
|
64
|
+
// not source files — drop them so the per-file read never hits EISDIR.
|
|
65
|
+
.filter((file) => statSync(file).isFile())
|
|
66
|
+
.sort((a, b) => a.localeCompare(b)));
|
|
67
|
+
}
|
|
68
|
+
function mapDeclaration(rel, diagnostic) {
|
|
69
|
+
return {
|
|
70
|
+
file: rel,
|
|
71
|
+
line: null,
|
|
72
|
+
column: null,
|
|
73
|
+
severity: 'error',
|
|
74
|
+
category: 'declaration',
|
|
75
|
+
rule: diagnostic.rule,
|
|
76
|
+
message: diagnostic.reason,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function mapCall(rel, diagnostic) {
|
|
80
|
+
return {
|
|
81
|
+
file: rel,
|
|
82
|
+
line: null,
|
|
83
|
+
column: null,
|
|
84
|
+
severity: 'error',
|
|
85
|
+
category: 'call',
|
|
86
|
+
rule: diagnostic.rule,
|
|
87
|
+
message: diagnostic.reason,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function mapReturn(rel, diagnostic) {
|
|
91
|
+
return {
|
|
92
|
+
file: rel,
|
|
93
|
+
line: null,
|
|
94
|
+
column: null,
|
|
95
|
+
severity: 'error',
|
|
96
|
+
category: 'return',
|
|
97
|
+
rule: diagnostic.rule,
|
|
98
|
+
message: diagnostic.reason,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Stable ordering: file, then category, then rule, then message. */
|
|
102
|
+
function sortDiagnostics(diagnostics) {
|
|
103
|
+
return [...diagnostics].sort((a, b) => a.file.localeCompare(b.file) ||
|
|
104
|
+
a.category.localeCompare(b.category) ||
|
|
105
|
+
a.rule.localeCompare(b.rule) ||
|
|
106
|
+
a.message.localeCompare(b.message));
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Run the type-checker (and, optionally, semantic validation) over a file or
|
|
110
|
+
* directory and produce the stable {@link CheckReport}. Pure with respect to
|
|
111
|
+
* process state apart from reading the filesystem.
|
|
112
|
+
*/
|
|
113
|
+
export function collectCheck(target, opts) {
|
|
114
|
+
const start = Date.now();
|
|
115
|
+
const resolved = resolve(target);
|
|
116
|
+
const isDirectory = statSync(resolved).isDirectory();
|
|
117
|
+
const scanRoot = isDirectory ? resolved : dirname(resolved);
|
|
118
|
+
const files = isDirectory ? listKernFiles(resolved) : [resolved];
|
|
119
|
+
const diagnostics = [];
|
|
120
|
+
const filesWithParseErrors = new Set();
|
|
121
|
+
let returnChecksRun = 0;
|
|
122
|
+
for (const file of files) {
|
|
123
|
+
const rel = relative(scanRoot, file) || file;
|
|
124
|
+
let source;
|
|
125
|
+
try {
|
|
126
|
+
source = readFileSync(file, 'utf-8');
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
// Unreadable file is an operational failure — surface it to the caller.
|
|
130
|
+
throw new Error(`kern check: cannot read file '${file}': ${err.message}`);
|
|
131
|
+
}
|
|
132
|
+
const { root, diagnostics: parseDiagnostics } = parseDocumentWithDiagnostics(source);
|
|
133
|
+
let fileHasParseError = false;
|
|
134
|
+
for (const diagnostic of parseDiagnostics) {
|
|
135
|
+
if (diagnostic.severity !== 'error')
|
|
136
|
+
continue;
|
|
137
|
+
fileHasParseError = true;
|
|
138
|
+
diagnostics.push({
|
|
139
|
+
file: rel,
|
|
140
|
+
line: diagnostic.line,
|
|
141
|
+
column: diagnostic.col,
|
|
142
|
+
severity: 'error',
|
|
143
|
+
category: 'parse',
|
|
144
|
+
rule: 'parse-error',
|
|
145
|
+
message: diagnostic.message,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// Report-and-continue: a file with parse errors is excluded from
|
|
149
|
+
// type-checking but every other file still runs.
|
|
150
|
+
if (fileHasParseError) {
|
|
151
|
+
filesWithParseErrors.add(rel);
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
for (const diagnostic of checkProgram(root))
|
|
155
|
+
diagnostics.push(mapDeclaration(rel, diagnostic));
|
|
156
|
+
for (const diagnostic of checkCalls(root))
|
|
157
|
+
diagnostics.push(mapCall(rel, diagnostic));
|
|
158
|
+
const returnResult = checkReturns(root);
|
|
159
|
+
returnChecksRun += returnResult.returnChecksRun;
|
|
160
|
+
for (const diagnostic of returnResult.diagnostics)
|
|
161
|
+
diagnostics.push(mapReturn(rel, diagnostic));
|
|
162
|
+
if (opts.withSemantics) {
|
|
163
|
+
for (const violation of validateSemantics(root)) {
|
|
164
|
+
diagnostics.push({
|
|
165
|
+
file: rel,
|
|
166
|
+
line: violation.line ?? null,
|
|
167
|
+
column: violation.col ?? null,
|
|
168
|
+
// The semantic validator emits no severity field; every violation it
|
|
169
|
+
// reports is a hard rule violation, so it maps to `error`.
|
|
170
|
+
severity: 'error',
|
|
171
|
+
category: 'semantic',
|
|
172
|
+
rule: violation.rule,
|
|
173
|
+
message: violation.message,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const sorted = sortDiagnostics(diagnostics);
|
|
179
|
+
const errorCount = sorted.filter((d) => d.severity === 'error').length;
|
|
180
|
+
const warningCount = sorted.filter((d) => d.severity === 'warning').length;
|
|
181
|
+
return {
|
|
182
|
+
schemaVersion: '1.0',
|
|
183
|
+
tool: 'kern-check',
|
|
184
|
+
checkerVersion: readCheckerVersion(),
|
|
185
|
+
root: scanRoot,
|
|
186
|
+
diagnostics: sorted,
|
|
187
|
+
summary: {
|
|
188
|
+
filesScanned: files.length,
|
|
189
|
+
filesWithParseErrors: filesWithParseErrors.size,
|
|
190
|
+
diagnosticCount: sorted.length,
|
|
191
|
+
errorCount,
|
|
192
|
+
warningCount,
|
|
193
|
+
returnChecksRun,
|
|
194
|
+
durationMs: Date.now() - start,
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function printHumanReport(report, quiet) {
|
|
199
|
+
const { diagnostics, summary } = report;
|
|
200
|
+
if (!quiet && diagnostics.length > 0) {
|
|
201
|
+
const byFile = new Map();
|
|
202
|
+
for (const diagnostic of diagnostics) {
|
|
203
|
+
const bucket = byFile.get(diagnostic.file);
|
|
204
|
+
if (bucket)
|
|
205
|
+
bucket.push(diagnostic);
|
|
206
|
+
else
|
|
207
|
+
byFile.set(diagnostic.file, [diagnostic]);
|
|
208
|
+
}
|
|
209
|
+
const ruleWidth = Math.max(...diagnostics.map((d) => d.rule.length));
|
|
210
|
+
for (const [file, fileDiagnostics] of byFile) {
|
|
211
|
+
process.stdout.write(`${file}\n`);
|
|
212
|
+
for (const diagnostic of fileDiagnostics) {
|
|
213
|
+
const locator = diagnostic.line !== null ? `${diagnostic.category}, line ${diagnostic.line}` : diagnostic.category;
|
|
214
|
+
process.stdout.write(` ${diagnostic.severity.padEnd(7)}${diagnostic.rule.padEnd(ruleWidth + 2)}${diagnostic.message} (${locator})\n`);
|
|
215
|
+
}
|
|
216
|
+
process.stdout.write('\n');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (diagnostics.length === 0) {
|
|
220
|
+
process.stdout.write(`✓ ${summary.filesScanned} files checked, no issues (returnChecksRun: ${summary.returnChecksRun})\n`);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
const errorWord = summary.errorCount === 1 ? 'error' : 'errors';
|
|
224
|
+
const fileCount = new Set(diagnostics.map((d) => d.file)).size;
|
|
225
|
+
const fileWord = fileCount === 1 ? 'file' : 'files';
|
|
226
|
+
process.stdout.write(`✗ ${summary.errorCount} ${errorWord} in ${fileCount} ${fileWord} ` +
|
|
227
|
+
`(${summary.filesScanned} files scanned, ${summary.warningCount} warnings)\n`);
|
|
228
|
+
}
|
|
229
|
+
function printCheckHelp() {
|
|
230
|
+
process.stdout.write([
|
|
231
|
+
'Usage: kern check [path] [--json] [--quiet] [--strict] [--with-semantics]',
|
|
232
|
+
'',
|
|
233
|
+
'Run the KERN nominal type-checker over a file or directory (defaults to cwd).',
|
|
234
|
+
'',
|
|
235
|
+
' --json machine-readable output on stdout (schemaVersion 1.0)',
|
|
236
|
+
' --quiet human mode: print only the summary line (ignored under --json)',
|
|
237
|
+
' --strict warnings also cause a non-zero exit',
|
|
238
|
+
' --with-semantics also run semantic validation (category: "semantic")',
|
|
239
|
+
'',
|
|
240
|
+
].join('\n'));
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Operational failure: exit 2 directly (distinct from diagnostic-driven exit 1
|
|
244
|
+
* routed through the cli.ts catch handler).
|
|
245
|
+
*/
|
|
246
|
+
function operationalFailure(message) {
|
|
247
|
+
process.stderr.write(`${message}\n`);
|
|
248
|
+
process.exit(2);
|
|
249
|
+
}
|
|
250
|
+
export async function runCheck(args) {
|
|
251
|
+
if (hasFlag(args, '--help', '-h')) {
|
|
252
|
+
printCheckHelp();
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const rest = args[0] === 'check' ? args.slice(1) : args;
|
|
256
|
+
const known = new Set(['--json', '--quiet', '--strict', '--with-semantics']);
|
|
257
|
+
const positionals = [];
|
|
258
|
+
for (const arg of rest) {
|
|
259
|
+
if (arg.startsWith('-')) {
|
|
260
|
+
if (!known.has(arg))
|
|
261
|
+
operationalFailure(`kern check: unknown flag '${arg}'`);
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
positionals.push(arg);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (positionals.length > 1) {
|
|
268
|
+
operationalFailure(`kern check: expected at most one path, got ${positionals.length}`);
|
|
269
|
+
}
|
|
270
|
+
const json = hasFlag(rest, '--json');
|
|
271
|
+
const quiet = hasFlag(rest, '--quiet');
|
|
272
|
+
const strict = hasFlag(rest, '--strict');
|
|
273
|
+
const withSemantics = hasFlag(rest, '--with-semantics');
|
|
274
|
+
const targetArg = positionals[0] ?? process.cwd();
|
|
275
|
+
const resolved = resolve(targetArg);
|
|
276
|
+
if (!existsSync(resolved)) {
|
|
277
|
+
operationalFailure(`kern check: path does not exist: ${targetArg}`);
|
|
278
|
+
}
|
|
279
|
+
let report;
|
|
280
|
+
try {
|
|
281
|
+
report = collectCheck(resolved, { withSemantics });
|
|
282
|
+
}
|
|
283
|
+
catch (err) {
|
|
284
|
+
operationalFailure(err.message);
|
|
285
|
+
}
|
|
286
|
+
if (json) {
|
|
287
|
+
process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
printHumanReport(report, quiet);
|
|
291
|
+
}
|
|
292
|
+
const code = exitCodeFor(report.summary, strict);
|
|
293
|
+
if (code !== 0)
|
|
294
|
+
process.exit(code);
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,Q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,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC"}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IRNode, KernTarget, ParseDiagnostic, ResolvedKernConfig, SchemaViolation, ShadowAnalyzeOptions, ShadowDiagnostic } from '@kernlang/core';
|
|
2
|
-
export declare const GENERATED_HEADER = "// @generated by kern
|
|
2
|
+
export declare const GENERATED_HEADER = "// @generated by kern v4.0.0 \u2014 DO NOT EDIT. Source: ";
|
|
3
3
|
export declare function parseCompilerVersion(version: string): [number, number, number] | null;
|
|
4
4
|
/**
|
|
5
5
|
* Check the existing output file's @generated stamp against the current compiler version.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kernlang/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "KERN CLI — transpile, compile, minify, and analyze .kern files",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,21 +29,22 @@
|
|
|
29
29
|
"chokidar": "^5.0.0",
|
|
30
30
|
"jiti": "^2.7.0",
|
|
31
31
|
"typescript": "^6.0.3",
|
|
32
|
-
"@kernlang/
|
|
33
|
-
"@kernlang/
|
|
34
|
-
"@kernlang/
|
|
35
|
-
"@kernlang/
|
|
36
|
-
"@kernlang/
|
|
37
|
-
"@kernlang/
|
|
38
|
-
"@kernlang/
|
|
39
|
-
"@kernlang/
|
|
40
|
-
"@kernlang/
|
|
41
|
-
"@kernlang/review": "
|
|
42
|
-
"@kernlang/
|
|
43
|
-
"@kernlang/
|
|
44
|
-
"@kernlang/
|
|
45
|
-
"@kernlang/
|
|
46
|
-
"@kernlang/
|
|
32
|
+
"@kernlang/check": "4.0.0",
|
|
33
|
+
"@kernlang/codemod": "4.0.0",
|
|
34
|
+
"@kernlang/core": "4.0.0",
|
|
35
|
+
"@kernlang/evolve": "4.0.0",
|
|
36
|
+
"@kernlang/express": "4.0.0",
|
|
37
|
+
"@kernlang/python": "4.0.0",
|
|
38
|
+
"@kernlang/mcp": "4.0.0",
|
|
39
|
+
"@kernlang/metrics": "4.0.0",
|
|
40
|
+
"@kernlang/native": "4.0.0",
|
|
41
|
+
"@kernlang/review": "4.0.0",
|
|
42
|
+
"@kernlang/react": "4.0.0",
|
|
43
|
+
"@kernlang/review-mcp": "4.0.0",
|
|
44
|
+
"@kernlang/test": "4.0.0",
|
|
45
|
+
"@kernlang/go": "4.0.0",
|
|
46
|
+
"@kernlang/vue": "4.0.0",
|
|
47
|
+
"@kernlang/terminal": "4.0.0"
|
|
47
48
|
},
|
|
48
49
|
"scripts": {
|
|
49
50
|
"build": "tsc -b",
|