@refrakt-md/cli 0.35.0 → 0.37.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/bin.js +420 -21
- package/dist/bin.js.map +1 -1
- package/dist/commands/config.d.ts +3 -2
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +110 -2
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/migrate-snippets.d.ts +65 -0
- package/dist/commands/migrate-snippets.d.ts.map +1 -0
- package/dist/commands/migrate-snippets.js +218 -0
- package/dist/commands/migrate-snippets.js.map +1 -0
- package/dist/commands/snippet-review.d.ts +66 -0
- package/dist/commands/snippet-review.d.ts.map +1 -0
- package/dist/commands/snippet-review.js +271 -0
- package/dist/commands/snippet-review.js.map +1 -0
- package/dist/commands/stale.d.ts +32 -0
- package/dist/commands/stale.d.ts.map +1 -0
- package/dist/commands/stale.js +130 -0
- package/dist/commands/stale.js.map +1 -0
- package/dist/commands/theme-validate.d.ts +23 -0
- package/dist/commands/theme-validate.d.ts.map +1 -0
- package/dist/commands/theme-validate.js +73 -0
- package/dist/commands/theme-validate.js.map +1 -0
- package/dist/commands/theme.d.ts +1 -2
- package/dist/commands/theme.d.ts.map +1 -1
- package/dist/commands/theme.js.map +1 -1
- package/dist/commands/validate-config.d.ts +35 -0
- package/dist/commands/validate-config.d.ts.map +1 -0
- package/dist/commands/validate-config.js +123 -0
- package/dist/commands/validate-config.js.map +1 -0
- package/dist/commands/validate-core.d.ts +51 -0
- package/dist/commands/validate-core.d.ts.map +1 -0
- package/dist/commands/validate-core.js +113 -0
- package/dist/commands/validate-core.js.map +1 -0
- package/dist/commands/validate.d.ts +12 -2
- package/dist/commands/validate.d.ts.map +1 -1
- package/dist/commands/validate.js +62 -60
- package/dist/commands/validate.js.map +1 -1
- package/package.json +11 -6
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The validation run itself — shared by `refrakt validate` and the
|
|
3
|
+
* `refrakt.validate` MCP tool (SPEC-135 D6 / WORK-581).
|
|
4
|
+
*
|
|
5
|
+
* Returns data. It never prints and never calls `process.exit`, so the CLI can
|
|
6
|
+
* format and gate while MCP returns structured findings from the same code.
|
|
7
|
+
* The alternative — an MCP tool that shells out to the CLI and parses its
|
|
8
|
+
* output — would be a worse CLI, and would put a second copy of the layering
|
|
9
|
+
* rules somewhere they could drift.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
12
|
+
import { dirname, resolve } from 'node:path';
|
|
13
|
+
import { normalizeRefraktConfig } from '@refrakt-md/transform/node';
|
|
14
|
+
import { validateSiteConfig } from './validate-config.js';
|
|
15
|
+
/** True when anything in the run is at error severity. The gate (D4). */
|
|
16
|
+
export function hasErrors(result) {
|
|
17
|
+
if (result.error)
|
|
18
|
+
return true;
|
|
19
|
+
return result.sites.some((r) => r.config.some((f) => f.severity === 'error') || r.content.some((f) => f.severity === 'error'));
|
|
20
|
+
}
|
|
21
|
+
export async function runValidation(opts = {}) {
|
|
22
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
23
|
+
const configPath = resolve(cwd, opts.configPath ?? 'refrakt.config.json');
|
|
24
|
+
// D2 — a validation command must never report success on nothing. Each of
|
|
25
|
+
// these returns an error rather than an empty pass, so a caller cannot read
|
|
26
|
+
// "validated nothing" as green.
|
|
27
|
+
if (!existsSync(configPath)) {
|
|
28
|
+
return {
|
|
29
|
+
error: `No refrakt.config.json found at ${configPath}. Nothing to validate.`,
|
|
30
|
+
sites: [],
|
|
31
|
+
configPath,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let raw;
|
|
35
|
+
try {
|
|
36
|
+
raw = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
return {
|
|
40
|
+
error: `Could not parse ${configPath}: ${err.message}`,
|
|
41
|
+
sites: [],
|
|
42
|
+
configPath,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const configDir = dirname(configPath);
|
|
46
|
+
let sites;
|
|
47
|
+
try {
|
|
48
|
+
sites = normalizeRefraktConfig(raw, { configDir }).sites;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
return {
|
|
52
|
+
error: `${configPath} is not a valid refrakt config: ${err.message}`,
|
|
53
|
+
sites: [],
|
|
54
|
+
configPath,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (opts.site && !sites[opts.site]) {
|
|
58
|
+
return {
|
|
59
|
+
error: `No site "${opts.site}" in ${configPath}. Declared: ${Object.keys(sites).join(', ') || 'none'}`,
|
|
60
|
+
sites: [],
|
|
61
|
+
configPath,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const names = opts.site ? [opts.site] : Object.keys(sites);
|
|
65
|
+
if (names.length === 0) {
|
|
66
|
+
return {
|
|
67
|
+
error: `${configPath} declares no sites. Nothing to validate.`,
|
|
68
|
+
sites: [],
|
|
69
|
+
configPath,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const results = [];
|
|
73
|
+
for (const name of names) {
|
|
74
|
+
const site = sites[name];
|
|
75
|
+
const result = { site: name, config: [], content: [] };
|
|
76
|
+
// D1 — config resolution runs FIRST, because its failures cause content
|
|
77
|
+
// findings. A plugin that fails to load takes its runes with it, and
|
|
78
|
+
// every use of them becomes `tag-undefined`.
|
|
79
|
+
if (opts.only !== 'content') {
|
|
80
|
+
result.config = validateSiteConfig(site, { configDir, siteName: name });
|
|
81
|
+
}
|
|
82
|
+
if (opts.only !== 'config') {
|
|
83
|
+
// Computed even under `--only content`, so the suppression rule can
|
|
84
|
+
// still explain itself. Just not reported.
|
|
85
|
+
const resolution = opts.only === 'content'
|
|
86
|
+
? validateSiteConfig(site, { configDir, siteName: name })
|
|
87
|
+
: result.config;
|
|
88
|
+
const breaking = resolution.filter((f) => f.causesMissingRunes);
|
|
89
|
+
if (breaking.length > 0) {
|
|
90
|
+
// Suppress rather than report both as peers (D1). Validating here
|
|
91
|
+
// produces dozens of `tag-undefined` errors against correct content
|
|
92
|
+
// whose real cause is one line of config — the symptom drowning the
|
|
93
|
+
// cause.
|
|
94
|
+
result.contentSuppressed =
|
|
95
|
+
`skipped: ${breaking.length} unresolved ${breaking.length === 1 ? 'dependency' : 'dependencies'} ` +
|
|
96
|
+
`would report every affected rune as an undefined tag. Fix the config findings above first.`;
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
const { createRefraktLoader } = await import('@refrakt-md/content');
|
|
100
|
+
const loader = createRefraktLoader({
|
|
101
|
+
configPath,
|
|
102
|
+
site: name,
|
|
103
|
+
// The build summary is not this command's output. Findings are.
|
|
104
|
+
reporter: () => { },
|
|
105
|
+
});
|
|
106
|
+
result.content = await loader.validateSite({ deep: opts.deep });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
results.push(result);
|
|
110
|
+
}
|
|
111
|
+
return { sites: results, configPath };
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=validate-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-core.js","sourceRoot":"","sources":["../../src/commands/validate-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAsB,MAAM,sBAAsB,CAAC;AA0C9E,yEAAyE;AACzE,MAAM,UAAU,SAAS,CAAC,MAAyB;IAClD,IAAI,MAAM,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAC9B,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CACvB,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,MAAM,CAAC,IAAI,CAA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
+
*
|
|
4
|
+
* Presentation only. The run itself lives in `validate-core.ts`, which returns
|
|
5
|
+
* data and never exits, so the `refrakt.validate` MCP tool can call the same
|
|
6
|
+
* code and return structured findings instead of parsing this output (D6).
|
|
7
|
+
*/
|
|
1
8
|
export interface ValidateOptions {
|
|
9
|
+
site?: string;
|
|
10
|
+
only?: 'content' | 'config';
|
|
11
|
+
deep?: boolean;
|
|
12
|
+
format?: 'text' | 'json';
|
|
2
13
|
configPath?: string;
|
|
3
|
-
manifestPath?: string;
|
|
4
14
|
}
|
|
5
|
-
export declare function validateCommand(opts: ValidateOptions): void
|
|
15
|
+
export declare function validateCommand(opts: ValidateOptions): Promise<void>;
|
|
6
16
|
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,eAAe;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA6D1E"}
|
|
@@ -1,70 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `refrakt validate` — the site author's command (SPEC-135 D1 / WORK-578).
|
|
3
|
+
*
|
|
4
|
+
* Presentation only. The run itself lives in `validate-core.ts`, which returns
|
|
5
|
+
* data and never exits, so the `refrakt.validate` MCP tool can call the same
|
|
6
|
+
* code and return structured findings instead of parsing this output (D6).
|
|
7
|
+
*/
|
|
8
|
+
import { hasErrors, runValidation } from './validate-core.js';
|
|
9
|
+
export async function validateCommand(opts) {
|
|
10
|
+
const result = await runValidation({
|
|
11
|
+
site: opts.site,
|
|
12
|
+
only: opts.only,
|
|
13
|
+
deep: opts.deep,
|
|
14
|
+
configPath: opts.configPath,
|
|
15
|
+
});
|
|
16
|
+
if (result.error) {
|
|
17
|
+
if (opts.format === 'json') {
|
|
18
|
+
process.stdout.write(`${JSON.stringify({ error: result.error, sites: [] }, null, 2)}\n`);
|
|
13
19
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const raw = JSON.parse(readFileSync(absPath, 'utf-8'));
|
|
17
|
-
console.log('Validating theme config...');
|
|
18
|
-
const result = validateThemeConfig(raw);
|
|
19
|
-
printResult('Theme config', result);
|
|
20
|
-
if (!result.valid)
|
|
21
|
-
hasErrors = true;
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
// Validate the base config as a sanity check
|
|
25
|
-
console.log('Validating base theme config...');
|
|
26
|
-
const result = validateThemeConfig(baseConfig);
|
|
27
|
-
printResult('Base theme config', result);
|
|
28
|
-
if (!result.valid)
|
|
29
|
-
hasErrors = true;
|
|
30
|
-
}
|
|
31
|
-
// Validate manifest
|
|
32
|
-
if (opts.manifestPath) {
|
|
33
|
-
const absPath = resolve(opts.manifestPath);
|
|
34
|
-
if (!existsSync(absPath)) {
|
|
35
|
-
console.error(`Error: Manifest file not found: ${absPath}`);
|
|
36
|
-
process.exit(1);
|
|
20
|
+
else {
|
|
21
|
+
process.stderr.write(`${result.error}\n`);
|
|
37
22
|
}
|
|
38
|
-
const raw = JSON.parse(readFileSync(absPath, 'utf-8'));
|
|
39
|
-
console.log('\nValidating manifest...');
|
|
40
|
-
const result = validateManifest(raw);
|
|
41
|
-
printResult('Manifest', result);
|
|
42
|
-
if (!result.valid)
|
|
43
|
-
hasErrors = true;
|
|
44
|
-
}
|
|
45
|
-
if (hasErrors) {
|
|
46
23
|
process.exit(1);
|
|
47
24
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
console.log(` ${label}: OK`);
|
|
52
|
-
return;
|
|
25
|
+
if (opts.format === 'json') {
|
|
26
|
+
process.stdout.write(`${JSON.stringify({ sites: result.sites }, null, 2)}\n`);
|
|
27
|
+
process.exit(hasErrors(result) ? 1 : 0);
|
|
53
28
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
let totalErrors = 0;
|
|
30
|
+
let totalWarnings = 0;
|
|
31
|
+
for (const r of result.sites) {
|
|
32
|
+
process.stdout.write(`\n${r.site}\n`);
|
|
33
|
+
if (opts.only !== 'content') {
|
|
34
|
+
if (r.config.length === 0) {
|
|
35
|
+
process.stdout.write(' config: OK\n');
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
for (const f of r.config) {
|
|
39
|
+
process.stdout.write(` ${icon(f.severity)} ${f.path}: ${f.message}\n`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
58
42
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
43
|
+
if (opts.only !== 'config') {
|
|
44
|
+
if (r.contentSuppressed) {
|
|
45
|
+
process.stdout.write(` content: ${r.contentSuppressed}\n`);
|
|
46
|
+
}
|
|
47
|
+
else if (r.content.length === 0) {
|
|
48
|
+
process.stdout.write(' content: OK\n');
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
for (const f of r.content) {
|
|
52
|
+
const at = f.line ? `:${f.line}` : '';
|
|
53
|
+
process.stdout.write(` ${icon(f.severity)} ${f.file}${at} ${f.message}\n`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
67
56
|
}
|
|
57
|
+
totalErrors += count(r, 'error');
|
|
58
|
+
totalWarnings += count(r, 'warning');
|
|
68
59
|
}
|
|
60
|
+
const status = totalErrors > 0 ? '✗' : '✓';
|
|
61
|
+
process.stdout.write(`\n ${status} ${totalErrors} error${totalErrors === 1 ? '' : 's'}, ` +
|
|
62
|
+
`${totalWarnings} warning${totalWarnings === 1 ? '' : 's'}\n\n`);
|
|
63
|
+
process.exit(totalErrors > 0 ? 1 : 0);
|
|
64
|
+
}
|
|
65
|
+
function count(r, severity) {
|
|
66
|
+
return (r.config.filter((f) => f.severity === severity).length +
|
|
67
|
+
r.content.filter((f) => f.severity === severity).length);
|
|
68
|
+
}
|
|
69
|
+
function icon(severity) {
|
|
70
|
+
return severity === 'error' ? '✗ error ' : severity === 'warning' ? '⚠ warn ' : 'ℹ info ';
|
|
69
71
|
}
|
|
70
72
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAmB,MAAM,oBAAoB,CAAC;AAU/E,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAqB;IAC1D,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC;QAClC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,UAAU,EAAE,IAAI,CAAC,UAAU;KAC3B,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC5B,OAAO,CAAC,MAAM,CAAC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AAG,IAAI;QACrE,GAAG,aAAa,WAAW,aAAa,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,CAChE,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,KAAK,CAAC,CAAa,EAAE,QAA6B;IAC1D,OAAO,CACN,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAAM;QACtD,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,MAAM,CACvD,CAAC;AACH,CAAC;AAED,SAAS,IAAI,CAAC,QAAsC;IACnD,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC;AAChG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refrakt-md/cli",
|
|
3
3
|
"description": "CLI tools for refrakt.md",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.37.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
"./lib/levenshtein.js": {
|
|
27
27
|
"types": "./dist/lib/levenshtein.d.ts",
|
|
28
28
|
"default": "./dist/lib/levenshtein.js"
|
|
29
|
+
},
|
|
30
|
+
"./validate.js": {
|
|
31
|
+
"types": "./dist/commands/validate-core.d.ts",
|
|
32
|
+
"default": "./dist/commands/validate-core.js"
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
"files": [
|
|
@@ -36,11 +40,12 @@
|
|
|
36
40
|
},
|
|
37
41
|
"dependencies": {
|
|
38
42
|
"@markdoc/markdoc": "0.4.0",
|
|
39
|
-
"@refrakt-md/ai": "0.
|
|
40
|
-
"@refrakt-md/
|
|
41
|
-
"@refrakt-md/
|
|
42
|
-
"@refrakt-md/
|
|
43
|
-
"@refrakt-md/
|
|
43
|
+
"@refrakt-md/ai": "0.37.0",
|
|
44
|
+
"@refrakt-md/content": "0.37.0",
|
|
45
|
+
"@refrakt-md/editor": "0.37.0",
|
|
46
|
+
"@refrakt-md/html": "0.37.0",
|
|
47
|
+
"@refrakt-md/runes": "0.37.0",
|
|
48
|
+
"@refrakt-md/transform": "0.37.0",
|
|
44
49
|
"esbuild": "^0.27.5",
|
|
45
50
|
"postcss": "^8.4.0"
|
|
46
51
|
}
|