@galaxy-tool-util/cli 0.2.0 → 0.4.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/gxwf.js +43 -19
- package/dist/bin/gxwf.js.map +1 -1
- package/dist/commands/add.js +2 -2
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/clean-tree.d.ts +3 -17
- package/dist/commands/clean-tree.d.ts.map +1 -1
- package/dist/commands/clean-tree.js +30 -29
- package/dist/commands/clean-tree.js.map +1 -1
- package/dist/commands/clean.d.ts +3 -0
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +12 -2
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/clear.js +4 -4
- package/dist/commands/clear.js.map +1 -1
- package/dist/commands/convert-tree.d.ts +2 -1
- package/dist/commands/convert-tree.d.ts.map +1 -1
- package/dist/commands/convert-tree.js +23 -7
- package/dist/commands/convert-tree.js.map +1 -1
- package/dist/commands/convert.d.ts +2 -1
- package/dist/commands/convert.d.ts.map +1 -1
- package/dist/commands/convert.js +36 -4
- package/dist/commands/convert.js.map +1 -1
- package/dist/commands/info.d.ts.map +1 -1
- package/dist/commands/info.js +5 -4
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/lint-tree.d.ts +3 -19
- package/dist/commands/lint-tree.d.ts.map +1 -1
- package/dist/commands/lint-tree.js +46 -58
- package/dist/commands/lint-tree.js.map +1 -1
- package/dist/commands/lint.d.ts +8 -4
- package/dist/commands/lint.d.ts.map +1 -1
- package/dist/commands/lint.js +61 -13
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/list.js +3 -3
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/populate-workflow.js +2 -2
- package/dist/commands/populate-workflow.js.map +1 -1
- package/dist/commands/render-results.d.ts +3 -3
- package/dist/commands/render-results.d.ts.map +1 -1
- package/dist/commands/render-results.js +8 -4
- package/dist/commands/render-results.js.map +1 -1
- package/dist/commands/report-output.d.ts +34 -0
- package/dist/commands/report-output.d.ts.map +1 -0
- package/dist/commands/report-output.js +70 -0
- package/dist/commands/report-output.js.map +1 -0
- package/dist/commands/resolve-tool.js +1 -1
- package/dist/commands/resolve-tool.js.map +1 -1
- package/dist/commands/roundtrip-tree.d.ts +3 -1
- package/dist/commands/roundtrip-tree.d.ts.map +1 -1
- package/dist/commands/roundtrip-tree.js +67 -5
- package/dist/commands/roundtrip-tree.js.map +1 -1
- package/dist/commands/roundtrip.d.ts +2 -1
- package/dist/commands/roundtrip.d.ts.map +1 -1
- package/dist/commands/roundtrip.js +30 -8
- package/dist/commands/roundtrip.js.map +1 -1
- package/dist/commands/schema.js +2 -2
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/strict-options.d.ts +22 -0
- package/dist/commands/strict-options.d.ts.map +1 -0
- package/dist/commands/strict-options.js +18 -0
- package/dist/commands/strict-options.js.map +1 -0
- package/dist/commands/validate-tests-tree.d.ts +36 -0
- package/dist/commands/validate-tests-tree.d.ts.map +1 -0
- package/dist/commands/validate-tests-tree.js +191 -0
- package/dist/commands/validate-tests-tree.js.map +1 -0
- package/dist/commands/validate-tests.d.ts +21 -0
- package/dist/commands/validate-tests.d.ts.map +1 -0
- package/dist/commands/validate-tests.js +83 -0
- package/dist/commands/validate-tests.js.map +1 -0
- package/dist/commands/validate-tree.d.ts +3 -20
- package/dist/commands/validate-tree.d.ts.map +1 -1
- package/dist/commands/validate-tree.js +53 -47
- package/dist/commands/validate-tree.js.map +1 -1
- package/dist/commands/validate-workflow-json-schema.d.ts +8 -2
- package/dist/commands/validate-workflow-json-schema.d.ts.map +1 -1
- package/dist/commands/validate-workflow-json-schema.js +104 -58
- package/dist/commands/validate-workflow-json-schema.js.map +1 -1
- package/dist/commands/validate-workflow.d.ts +17 -10
- package/dist/commands/validate-workflow.d.ts.map +1 -1
- package/dist/commands/validate-workflow.js +185 -59
- package/dist/commands/validate-workflow.js.map +1 -1
- package/dist/commands/workflow-io.d.ts +2 -11
- package/dist/commands/workflow-io.d.ts.map +1 -1
- package/dist/commands/workflow-io.js +7 -16
- package/dist/commands/workflow-io.js.map +1 -1
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/workflow/_templates-bundled.d.ts +2 -0
- package/dist/workflow/_templates-bundled.d.ts.map +1 -0
- package/dist/workflow/_templates-bundled.js +324 -0
- package/dist/workflow/_templates-bundled.js.map +1 -0
- package/dist/workflow/report-templates.d.ts +13 -0
- package/dist/workflow/report-templates.d.ts.map +1 -0
- package/dist/workflow/report-templates.js +91 -0
- package/dist/workflow/report-templates.js.map +1 -0
- package/package.json +7 -5
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ``gxwf validate-tests-tree`` — batch-validate every workflow-test file
|
|
3
|
+
* (``*-tests.yml``, ``*-tests.yaml``, ``*.gxwf-tests.yml``, ``*.gxwf-tests.yaml``)
|
|
4
|
+
* under a directory against the ``galaxy.tool_util_models.Tests`` JSON Schema.
|
|
5
|
+
*
|
|
6
|
+
* Unlike ``validate-tree`` this uses its own discovery pass because test
|
|
7
|
+
* documents don't carry a ``class: GalaxyWorkflow`` / ``a_galaxy_workflow``
|
|
8
|
+
* marker — classification is filename-based.
|
|
9
|
+
*
|
|
10
|
+
* With ``--auto-workflow``, each test file is paired with a sibling workflow
|
|
11
|
+
* by suffix convention and cross-checked. Silent no-op when no sibling is
|
|
12
|
+
* found.
|
|
13
|
+
*/
|
|
14
|
+
import { readdir, readFile, stat } from "node:fs/promises";
|
|
15
|
+
import { dirname, join, relative } from "node:path";
|
|
16
|
+
import { parse as parseYaml } from "yaml";
|
|
17
|
+
import { checkTestsAgainstWorkflow, extractWorkflowInputs, extractWorkflowOutputs, resolveFormat, validateTestsFile, } from "@galaxy-tool-util/schema";
|
|
18
|
+
const EXCLUDE_DIRS = new Set([".git", ".hg", ".venv", "node_modules", "__pycache__", ".snakemake"]);
|
|
19
|
+
const TEST_SUFFIXES = [".gxwf-tests.yml", ".gxwf-tests.yaml", "-tests.yml", "-tests.yaml"];
|
|
20
|
+
const WORKFLOW_EXTS = [".gxwf.yml", ".gxwf.yaml", ".yml", ".yaml", ".ga"];
|
|
21
|
+
function isTestFile(name) {
|
|
22
|
+
return TEST_SUFFIXES.some((s) => name.endsWith(s));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Derive the workflow basename a given tests file pairs with.
|
|
26
|
+
* `foo.gxwf-tests.yml` → `foo`; `bar-tests.yml` → `bar`.
|
|
27
|
+
*/
|
|
28
|
+
function stripTestsSuffix(name) {
|
|
29
|
+
for (const suffix of TEST_SUFFIXES) {
|
|
30
|
+
if (name.endsWith(suffix))
|
|
31
|
+
return name.slice(0, -suffix.length);
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
async function fileExists(path) {
|
|
36
|
+
try {
|
|
37
|
+
const s = await stat(path);
|
|
38
|
+
return s.isFile();
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Locate a sibling workflow for a tests file. Returns the first existing
|
|
46
|
+
* candidate in suffix-priority order, or undefined if none found.
|
|
47
|
+
*/
|
|
48
|
+
async function findSiblingWorkflow(testsPath) {
|
|
49
|
+
const base = stripTestsSuffix(testsPath.split("/").pop() ?? "");
|
|
50
|
+
if (!base)
|
|
51
|
+
return undefined;
|
|
52
|
+
const dir = dirname(testsPath);
|
|
53
|
+
for (const ext of WORKFLOW_EXTS) {
|
|
54
|
+
const candidate = join(dir, `${base}${ext}`);
|
|
55
|
+
if (await fileExists(candidate))
|
|
56
|
+
return candidate;
|
|
57
|
+
}
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
async function loadWorkflowShape(path) {
|
|
61
|
+
const raw = await readFile(path, "utf-8");
|
|
62
|
+
const parsed = path.endsWith(".ga") || path.endsWith(".json") ? JSON.parse(raw) : parseYaml(raw);
|
|
63
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
64
|
+
throw new Error(`Workflow ${path} did not parse to an object.`);
|
|
65
|
+
}
|
|
66
|
+
const dict = parsed;
|
|
67
|
+
const format = resolveFormat(dict);
|
|
68
|
+
return {
|
|
69
|
+
inputs: extractWorkflowInputs(dict, format),
|
|
70
|
+
outputs: extractWorkflowOutputs(dict, format),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
async function discoverTestFiles(root) {
|
|
74
|
+
const out = [];
|
|
75
|
+
await walk(root, out);
|
|
76
|
+
out.sort();
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
async function walk(dir, out) {
|
|
80
|
+
let entries;
|
|
81
|
+
try {
|
|
82
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
if (entry.isDirectory()) {
|
|
89
|
+
if (!EXCLUDE_DIRS.has(entry.name)) {
|
|
90
|
+
await walk(join(dir, entry.name), out);
|
|
91
|
+
}
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (entry.isFile() && isTestFile(entry.name)) {
|
|
95
|
+
out.push(join(dir, entry.name));
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function validateOne(path, root, autoWorkflow) {
|
|
100
|
+
const rel = relative(root, path);
|
|
101
|
+
let parsed;
|
|
102
|
+
try {
|
|
103
|
+
const raw = await readFile(path, "utf-8");
|
|
104
|
+
parsed = parseYaml(raw);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
108
|
+
return {
|
|
109
|
+
path: rel,
|
|
110
|
+
valid: false,
|
|
111
|
+
loadError: true,
|
|
112
|
+
errors: [
|
|
113
|
+
{ path: "(root)", message: `YAML parse error: ${msg}`, keyword: "yaml", params: {} },
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const { valid: schemaValid, errors } = validateTestsFile(parsed);
|
|
118
|
+
const allErrors = [...errors];
|
|
119
|
+
let pairedWorkflow;
|
|
120
|
+
if (autoWorkflow) {
|
|
121
|
+
const sibling = await findSiblingWorkflow(path);
|
|
122
|
+
if (sibling) {
|
|
123
|
+
pairedWorkflow = relative(root, sibling);
|
|
124
|
+
try {
|
|
125
|
+
const shape = await loadWorkflowShape(sibling);
|
|
126
|
+
allErrors.push(...checkTestsAgainstWorkflow(parsed, shape));
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
130
|
+
allErrors.push({
|
|
131
|
+
path: "(root)",
|
|
132
|
+
message: `Failed to load workflow ${pairedWorkflow}: ${msg}`,
|
|
133
|
+
keyword: "workflow_load_error",
|
|
134
|
+
params: { workflow: pairedWorkflow },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const valid = schemaValid && allErrors.length === 0;
|
|
140
|
+
const report = { path: rel, valid, errors: allErrors };
|
|
141
|
+
if (pairedWorkflow)
|
|
142
|
+
report.workflow = pairedWorkflow;
|
|
143
|
+
return report;
|
|
144
|
+
}
|
|
145
|
+
export async function runValidateTestsTree(dir, opts = {}) {
|
|
146
|
+
const paths = await discoverTestFiles(dir);
|
|
147
|
+
const files = [];
|
|
148
|
+
for (const p of paths) {
|
|
149
|
+
files.push(await validateOne(p, dir, opts.autoWorkflow === true));
|
|
150
|
+
}
|
|
151
|
+
const summary = {
|
|
152
|
+
total: files.length,
|
|
153
|
+
ok: files.filter((f) => f.valid).length,
|
|
154
|
+
fail: files.filter((f) => !f.valid && !f.loadError).length,
|
|
155
|
+
error: files.filter((f) => f.loadError).length,
|
|
156
|
+
};
|
|
157
|
+
const report = {
|
|
158
|
+
root: dir,
|
|
159
|
+
files: files.map(({ path, valid, errors, workflow }) => {
|
|
160
|
+
const entry = { path, valid, errors };
|
|
161
|
+
if (workflow)
|
|
162
|
+
entry.workflow = workflow;
|
|
163
|
+
return entry;
|
|
164
|
+
}),
|
|
165
|
+
summary,
|
|
166
|
+
};
|
|
167
|
+
if (opts.json) {
|
|
168
|
+
console.log(JSON.stringify(report, null, 2));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
for (const f of files) {
|
|
172
|
+
const wfNote = f.workflow ? ` [workflow: ${f.workflow}]` : "";
|
|
173
|
+
if (f.loadError) {
|
|
174
|
+
console.error(` ${f.path}: ERROR (${f.errors[0]?.message ?? "load failed"})`);
|
|
175
|
+
}
|
|
176
|
+
else if (f.valid) {
|
|
177
|
+
console.log(` ${f.path}: OK${wfNote}`);
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
console.error(` ${f.path}: ${f.errors.length} validation error(s)${wfNote}`);
|
|
181
|
+
for (const e of f.errors) {
|
|
182
|
+
console.error(` ${e.path}: ${e.message} [${e.keyword}]`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const s = summary;
|
|
187
|
+
console.log(`\nSummary: ${s.total} files | ${s.ok} OK, ${s.fail} FAIL, ${s.error} ERROR`);
|
|
188
|
+
}
|
|
189
|
+
process.exitCode = summary.fail > 0 || summary.error > 0 ? 1 : 0;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=validate-tests-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-tests-tree.js","sourceRoot":"","sources":["../../src/commands/validate-tests-tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,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AO,KAAK,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;gBAC9D,CAAC;YACH,CAAC;QACH,CAAC;QACD,MAAM,CAAC,GAAG,OAAO,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC;IAC5F,CAAC;IAED,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,GAAG,CAAC,IAAI,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ``gxwf validate-tests`` — validate a workflow-test file (``*-tests.yml`` /
|
|
3
|
+
* ``*.gxwf-tests.yml``) against the JSON Schema synced from Galaxy's
|
|
4
|
+
* ``galaxy.tool_util_models.Tests`` Pydantic model.
|
|
5
|
+
*
|
|
6
|
+
* With ``--workflow <path>`` also cross-checks inputs/outputs against the
|
|
7
|
+
* referenced workflow: unknown job keys, missing required inputs, type
|
|
8
|
+
* mismatches, unknown output assertions.
|
|
9
|
+
*/
|
|
10
|
+
import { type TestFormatDiagnostic } from "@galaxy-tool-util/schema";
|
|
11
|
+
export interface ValidateTestsOptions {
|
|
12
|
+
json?: boolean;
|
|
13
|
+
workflow?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ValidateTestsReport {
|
|
16
|
+
file: string;
|
|
17
|
+
valid: boolean;
|
|
18
|
+
errors: TestFormatDiagnostic[];
|
|
19
|
+
}
|
|
20
|
+
export declare function runValidateTests(filePath: string, opts?: ValidateTestsOptions): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=validate-tests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-tests.d.ts","sourceRoot":"","sources":["../../src/commands/validate-tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAML,KAAK,oBAAoB,EAE1B,MAAM,0BAA0B,CAAC;AAElC,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAChC;AAiBD,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,oBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAwDf"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ``gxwf validate-tests`` — validate a workflow-test file (``*-tests.yml`` /
|
|
3
|
+
* ``*.gxwf-tests.yml``) against the JSON Schema synced from Galaxy's
|
|
4
|
+
* ``galaxy.tool_util_models.Tests`` Pydantic model.
|
|
5
|
+
*
|
|
6
|
+
* With ``--workflow <path>`` also cross-checks inputs/outputs against the
|
|
7
|
+
* referenced workflow: unknown job keys, missing required inputs, type
|
|
8
|
+
* mismatches, unknown output assertions.
|
|
9
|
+
*/
|
|
10
|
+
import { readFile } from "node:fs/promises";
|
|
11
|
+
import { parse as parseYaml } from "yaml";
|
|
12
|
+
import { checkTestsAgainstWorkflow, extractWorkflowInputs, extractWorkflowOutputs, resolveFormat, validateTestsFile, } from "@galaxy-tool-util/schema";
|
|
13
|
+
async function loadWorkflowShape(path) {
|
|
14
|
+
const raw = await readFile(path, "utf-8");
|
|
15
|
+
const parsed = path.endsWith(".ga") || path.endsWith(".json") ? JSON.parse(raw) : parseYaml(raw);
|
|
16
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
17
|
+
throw new Error(`Workflow ${path} did not parse to an object.`);
|
|
18
|
+
}
|
|
19
|
+
const dict = parsed;
|
|
20
|
+
const format = resolveFormat(dict);
|
|
21
|
+
return {
|
|
22
|
+
inputs: extractWorkflowInputs(dict, format),
|
|
23
|
+
outputs: extractWorkflowOutputs(dict, format),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export async function runValidateTests(filePath, opts = {}) {
|
|
27
|
+
const raw = await readFile(filePath, "utf-8");
|
|
28
|
+
let parsed;
|
|
29
|
+
try {
|
|
30
|
+
parsed = parseYaml(raw);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
34
|
+
if (opts.json) {
|
|
35
|
+
const report = {
|
|
36
|
+
file: filePath,
|
|
37
|
+
valid: false,
|
|
38
|
+
errors: [
|
|
39
|
+
{ path: "(root)", message: `YAML parse error: ${msg}`, keyword: "yaml", params: {} },
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
console.log(JSON.stringify(report, null, 2));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.error(`${filePath}: YAML parse error: ${msg}`);
|
|
46
|
+
}
|
|
47
|
+
process.exitCode = 2;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const { valid: schemaValid, errors } = validateTestsFile(parsed);
|
|
51
|
+
const allErrors = [...errors];
|
|
52
|
+
if (opts.workflow) {
|
|
53
|
+
try {
|
|
54
|
+
const shape = await loadWorkflowShape(opts.workflow);
|
|
55
|
+
allErrors.push(...checkTestsAgainstWorkflow(parsed, shape));
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
59
|
+
allErrors.push({
|
|
60
|
+
path: "(root)",
|
|
61
|
+
message: `Failed to load workflow ${opts.workflow}: ${msg}`,
|
|
62
|
+
keyword: "workflow_load_error",
|
|
63
|
+
params: { workflow: opts.workflow },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const valid = schemaValid && allErrors.length === 0;
|
|
68
|
+
if (opts.json) {
|
|
69
|
+
const report = { file: filePath, valid, errors: allErrors };
|
|
70
|
+
console.log(JSON.stringify(report, null, 2));
|
|
71
|
+
}
|
|
72
|
+
else if (valid) {
|
|
73
|
+
console.log(`${filePath}: OK`);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.error(`${filePath}: ${allErrors.length} validation error(s)`);
|
|
77
|
+
for (const e of allErrors) {
|
|
78
|
+
console.error(` ${e.path}: ${e.message} [${e.keyword}]`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
process.exitCode = valid ? 0 : 1;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=validate-tests.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-tests.js","sourceRoot":"","sources":["../../src/commands/validate-tests.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,aAAa,EACb,iBAAiB,GAGlB,MAAM,0BAA0B,CAAC;AAalC,KAAK,UAAU,iBAAiB,CAAC,IAAY;IAC3C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,MAAM,GACV,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACpF,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,MAAM,IAAI,K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AAC;IACjC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,GAAG,QAAQ,KAAK,SAAS,CAAC,MAAM,sBAAsB,CAAC,CAAC;QACtE,KAAK,MAAM,CAAC,IAAI,SAAS,EAAE,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,OAAO,CAAC,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type
|
|
3
|
-
export interface ValidateTreeOptions {
|
|
1
|
+
import { type StrictOptions } from "./strict-options.js";
|
|
2
|
+
import { type ReportOutputOptions } from "./report-output.js";
|
|
3
|
+
export interface ValidateTreeOptions extends StrictOptions, ReportOutputOptions {
|
|
4
4
|
format?: string;
|
|
5
5
|
toolState?: boolean;
|
|
6
6
|
cacheDir?: string;
|
|
@@ -8,22 +8,5 @@ export interface ValidateTreeOptions {
|
|
|
8
8
|
toolSchemaDir?: string;
|
|
9
9
|
json?: boolean;
|
|
10
10
|
}
|
|
11
|
-
export interface WorkflowValidateResult {
|
|
12
|
-
relativePath: string;
|
|
13
|
-
format: string;
|
|
14
|
-
steps: StepValidationResult[];
|
|
15
|
-
}
|
|
16
|
-
export interface ValidateTreeReport {
|
|
17
|
-
root: string;
|
|
18
|
-
results: (WorkflowValidateResult | {
|
|
19
|
-
relativePath: string;
|
|
20
|
-
error: string;
|
|
21
|
-
})[];
|
|
22
|
-
summary: TreeSummary & {
|
|
23
|
-
stepOk: number;
|
|
24
|
-
stepFail: number;
|
|
25
|
-
stepSkip: number;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
11
|
export declare function runValidateTree(dir: string, opts: ValidateTreeOptions): Promise<void>;
|
|
29
12
|
//# sourceMappingURL=validate-tree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tree.d.ts","sourceRoot":"","sources":["../../src/commands/validate-tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-tree.d.ts","sourceRoot":"","sources":["../../src/commands/validate-tree.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAQ/E,OAAO,EAAsC,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAElG,MAAM,WAAW,mBAAoB,SAAQ,aAAa,EAAE,mBAAmB;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyG3F"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
import { ToolCache } from "@galaxy-tool-util/core";
|
|
1
|
+
import { makeNodeToolCache } from "@galaxy-tool-util/core/node";
|
|
2
|
+
import { checkStrictEncoding, checkStrictStructure, buildWorkflowValidationResult, buildTreeValidationReport, } from "@galaxy-tool-util/schema";
|
|
5
3
|
import { dirname } from "node:path";
|
|
6
4
|
import { createDefaultResolver } from "./url-resolver.js";
|
|
5
|
+
import { resolveStrictOptions } from "./strict-options.js";
|
|
7
6
|
import { resolveFormat } from "./workflow-io.js";
|
|
8
7
|
import { validateNativeSteps, validateFormat2Steps, } from "./validate-workflow.js";
|
|
9
|
-
import { collectTree
|
|
8
|
+
import { collectTree } from "./tree.js";
|
|
9
|
+
import { writeReportOutput, writeReportHtml } from "./report-output.js";
|
|
10
10
|
export async function runValidateTree(dir, opts) {
|
|
11
11
|
const mode = opts.mode === "json-schema" ? "json-schema" : "effect";
|
|
12
12
|
// Load tool cache once for all files
|
|
13
13
|
let cache;
|
|
14
14
|
if (opts.toolState !== false) {
|
|
15
15
|
try {
|
|
16
|
-
cache =
|
|
16
|
+
cache = makeNodeToolCache({ cacheDir: opts.cacheDir });
|
|
17
17
|
await cache.index.load();
|
|
18
18
|
}
|
|
19
19
|
catch (e) {
|
|
@@ -29,89 +29,95 @@ export async function runValidateTree(dir, opts) {
|
|
|
29
29
|
validateNativeStepsJsonSchema = (data, cache, prefix, expansionOpts) => mod.validateNativeStepsJsonSchema(data, cache, opts.toolSchemaDir, prefix, expansionOpts);
|
|
30
30
|
validateFormat2StepsJsonSchema = (data, cache, prefix, expansionOpts) => mod.validateFormat2StepsJsonSchema(data, cache, opts.toolSchemaDir, prefix, expansionOpts);
|
|
31
31
|
}
|
|
32
|
+
const strict = resolveStrictOptions(opts);
|
|
32
33
|
const treeResult = await collectTree(dir, async (info, data) => {
|
|
33
34
|
const format = resolveFormat(data, opts.format);
|
|
35
|
+
// Per-file strict checks
|
|
36
|
+
if (strict.strictEncoding) {
|
|
37
|
+
const encErrors = checkStrictEncoding(data, format);
|
|
38
|
+
if (encErrors.length > 0) {
|
|
39
|
+
throw new Error(`Encoding: ${encErrors.join("; ")}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (strict.strictStructure) {
|
|
43
|
+
const structErrors = checkStrictStructure(data, format);
|
|
44
|
+
if (structErrors.length > 0) {
|
|
45
|
+
throw new Error(`Structure: ${structErrors.join("; ")}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
34
48
|
const expansionOpts = {
|
|
35
49
|
resolver: createDefaultResolver({ workflowDirectory: dirname(info.path) }),
|
|
36
50
|
};
|
|
37
|
-
let
|
|
51
|
+
let stepResults = [];
|
|
38
52
|
if (cache && opts.toolState !== false) {
|
|
39
53
|
const validateNative = validateNativeStepsJsonSchema ?? validateNativeSteps;
|
|
40
54
|
const validateF2 = validateFormat2StepsJsonSchema ?? validateFormat2Steps;
|
|
41
|
-
|
|
55
|
+
stepResults =
|
|
42
56
|
format === "native"
|
|
43
57
|
? await validateNative(data, cache, "", expansionOpts)
|
|
44
58
|
: await validateF2(data, cache, "", expansionOpts);
|
|
45
59
|
}
|
|
46
|
-
|
|
60
|
+
// --strict-state: promote skips to failures
|
|
61
|
+
if (strict.strictState && stepResults.some((s) => s.status !== "ok" && s.status !== "fail")) {
|
|
62
|
+
throw new Error("Strict state: skipped steps not allowed");
|
|
63
|
+
}
|
|
64
|
+
return buildWorkflowValidationResult(info.relativePath, stepResults);
|
|
47
65
|
});
|
|
48
|
-
const report =
|
|
66
|
+
const report = buildReport(treeResult);
|
|
67
|
+
await writeReportOutput("validate_tree.md.j2", report, { reportMarkdown: opts.reportMarkdown });
|
|
68
|
+
await writeReportHtml("validate-tree", report, opts.reportHtml);
|
|
49
69
|
if (opts.json) {
|
|
50
70
|
console.log(JSON.stringify(report, null, 2));
|
|
51
71
|
process.exitCode = computeValidateExitCode(report);
|
|
52
72
|
return;
|
|
53
73
|
}
|
|
54
74
|
// Text output
|
|
55
|
-
for (const
|
|
56
|
-
if (
|
|
57
|
-
console.error(` ${
|
|
75
|
+
for (const wf of report.workflows) {
|
|
76
|
+
if (wf.error) {
|
|
77
|
+
console.error(` ${wf.path}: ERROR (${wf.error})`);
|
|
58
78
|
continue;
|
|
59
79
|
}
|
|
60
|
-
if (
|
|
61
|
-
console.warn(` ${
|
|
80
|
+
if (wf.skipped_reason) {
|
|
81
|
+
console.warn(` ${wf.path}: SKIPPED (${wf.skipped_reason})`);
|
|
62
82
|
continue;
|
|
63
83
|
}
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
console.error(` ${r.relativePath}: ${total} steps (${ok} OK, ${fail} FAIL, ${skip} SKIP)`);
|
|
71
|
-
for (const s of r.steps.filter((s) => s.status === "fail")) {
|
|
72
|
-
for (const err of s.errors) {
|
|
73
|
-
console.error(` Step ${s.stepLabel} (${s.toolId}): ${err}`);
|
|
74
|
-
}
|
|
84
|
+
const s = wf.summary;
|
|
85
|
+
const total = s.ok + s.fail + s.skip;
|
|
86
|
+
if (s.fail > 0) {
|
|
87
|
+
console.error(` ${wf.path}: ${total} steps (${s.ok} OK, ${s.fail} FAIL, ${s.skip} SKIP)`);
|
|
88
|
+
for (const f of wf.failures ?? []) {
|
|
89
|
+
console.error(` Step ${f.step} (${f.tool_id}): ${f.message}`);
|
|
75
90
|
}
|
|
76
91
|
}
|
|
77
92
|
else {
|
|
78
|
-
console.log(` ${
|
|
93
|
+
console.log(` ${wf.path}: ${total} steps (${s.ok} OK, ${s.skip} SKIP)`);
|
|
79
94
|
}
|
|
80
95
|
}
|
|
81
96
|
const s = report.summary;
|
|
82
|
-
|
|
97
|
+
const total = report.workflows.length;
|
|
98
|
+
console.log(`\nSummary: ${total} workflows | ${s.ok} OK, ${s.fail} FAIL, ${s.skip} SKIP`);
|
|
83
99
|
process.exitCode = computeValidateExitCode(report);
|
|
84
100
|
}
|
|
85
|
-
function
|
|
86
|
-
const
|
|
87
|
-
let stepOk = 0;
|
|
88
|
-
let stepFail = 0;
|
|
89
|
-
let stepSkip = 0;
|
|
101
|
+
function buildReport(treeResult) {
|
|
102
|
+
const workflows = [];
|
|
90
103
|
for (const o of treeResult.outcomes) {
|
|
91
104
|
if (o.error) {
|
|
92
|
-
|
|
105
|
+
workflows.push(buildWorkflowValidationResult(o.info.relativePath, [], { error: o.error }));
|
|
93
106
|
continue;
|
|
94
107
|
}
|
|
95
108
|
if (o.skipped) {
|
|
96
|
-
|
|
109
|
+
workflows.push(buildWorkflowValidationResult(o.info.relativePath, [], {
|
|
110
|
+
skipped_reason: o.skipReason ?? null,
|
|
111
|
+
}));
|
|
97
112
|
continue;
|
|
98
113
|
}
|
|
99
|
-
|
|
100
|
-
results.push(r);
|
|
101
|
-
stepOk += r.steps.filter((s) => s.status === "ok").length;
|
|
102
|
-
stepFail += r.steps.filter((s) => s.status === "fail").length;
|
|
103
|
-
stepSkip += r.steps.filter((s) => s.status === "skip").length;
|
|
114
|
+
workflows.push(o.result);
|
|
104
115
|
}
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
root: treeResult.root,
|
|
108
|
-
results,
|
|
109
|
-
summary: { ...wfSummary, stepOk, stepFail, stepSkip },
|
|
110
|
-
};
|
|
116
|
+
return buildTreeValidationReport(treeResult.root, workflows);
|
|
111
117
|
}
|
|
112
118
|
function computeValidateExitCode(report) {
|
|
113
119
|
const s = report.summary;
|
|
114
|
-
if (s.
|
|
120
|
+
if (s.fail > 0 || s.error > 0)
|
|
115
121
|
return 1;
|
|
116
122
|
return 0;
|
|
117
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-tree.js","sourceRoot":"","sources":["../../src/commands/validate-tree.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-tree.js","sourceRoot":"","sources":["../../src/commands/validate-tree.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,6BAA6B,EAC7B,yBAAyB,GAK1B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAsB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAmB,MAAM,WAAW,CAAC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C,QAAQ,GAAG,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,WAAW,CAAC,UAAgD;IACnE,MAAM,SAAS,GAA+B,EAAE,CAAC;IAEjD,KAAK,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,EAAE,CAAC;QACpC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;YACZ,SAAS,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YAC3F,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACd,SAAS,CAAC,IAAI,CACZ,6BAA6B,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,EAAE;gBACrD,cAAc,EAAG,CAAC,CAAC,UAAgC,IAAI,IAAI;aAC5D,CAAC,CACH,CAAC;YACF,SAAS;QACX,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,MAAO,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,yBAAyB,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,uBAAuB,CAAC,MAA4B;IAC3D,MAAM,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC;IACzB,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -7,10 +7,16 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Mirrors Galaxy's validation_json_schema.py.
|
|
9
9
|
*/
|
|
10
|
-
import { ToolCache } from "@galaxy-tool-util/core";
|
|
10
|
+
import type { ToolCache } from "@galaxy-tool-util/core";
|
|
11
11
|
import { type ExpansionOptions } from "@galaxy-tool-util/schema";
|
|
12
12
|
import type { ValidateWorkflowOptions, WorkflowFormat, StepValidationResult } from "./validate-workflow.js";
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Validate workflow structure using the AJV-compiled JSON Schema (Draft 2020-12).
|
|
15
|
+
* Returns an array of error strings; empty if valid.
|
|
16
|
+
* Mirrors `decodeStructureErrors` but uses the AJV path instead of Effect decode.
|
|
17
|
+
*/
|
|
18
|
+
export declare function decodeStructureErrorsJsonSchema(data: Record<string, unknown>, format: WorkflowFormat): string[];
|
|
19
|
+
export declare function runValidateWorkflowJsonSchema(filePath: string, data: Record<string, unknown>, format: WorkflowFormat, opts: ValidateWorkflowOptions, expansionOpts?: ExpansionOptions): Promise<void>;
|
|
14
20
|
export declare function validateNativeStepsJsonSchema(data: Record<string, unknown>, cache: ToolCache, toolSchemaDir?: string, prefix?: string, expansionOpts?: ExpansionOptions): Promise<StepValidationResult[]>;
|
|
15
21
|
export declare function validateFormat2StepsJsonSchema(data: Record<string, unknown>, cache: ToolCache, toolSchemaDir?: string, prefix?: string, expansionOpts?: ExpansionOptions): Promise<StepValidationResult[]>;
|
|
16
22
|
//# sourceMappingURL=validate-workflow-json-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-workflow-json-schema.d.ts","sourceRoot":"","sources":["../../src/commands/validate-workflow-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-workflow-json-schema.d.ts","sourceRoot":"","sources":["../../src/commands/validate-workflow-json-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAeL,KAAK,gBAAgB,EACtB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACrB,MAAM,wBAAwB,CAAC;AA0HhC;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,cAAc,GACrB,MAAM,EAAE,CAOV;AAID,wBAAsB,6BAA6B,CACjD,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,uBAAuB,EAC7B,aAAa,CAAC,EAAE,gBAAgB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAsGf;AAID,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,SAAS,EAChB,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,SAAK,EACX,aAAa,CAAC,EAAE,gBAAgB,GAC/B,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAGjC;AAwHD,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,SAAS,EAChB,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,SAAK,EACX,aAAa,CAAC,EAAE,gBAAgB,GAC/B,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAGjC"}
|