@styx-api/cli 0.1.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.cjs +109 -0
- package/dist/bin.d.cts +1 -0
- package/dist/bin.d.mts +1 -0
- package/dist/bin.mjs +111 -0
- package/dist/bin.mjs.map +1 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.cts +91 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +91 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/write-BtRGJfHV.cjs +483 -0
- package/dist/write-DSW1zlom.mjs +415 -0
- package/dist/write-DSW1zlom.mjs.map +1 -0
- package/package.json +58 -0
- package/src/__snapshots__/greet.py +131 -0
- package/src/__snapshots__/greet.ts +123 -0
- package/src/backends.ts +40 -0
- package/src/bin.ts +35 -0
- package/src/build.ts +297 -0
- package/src/catalog.ts +268 -0
- package/src/command.ts +89 -0
- package/src/index.ts +6 -0
- package/src/write.ts +11 -0
package/dist/bin.cjs
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_write = require('./write-BtRGJfHV.cjs');
|
|
3
|
+
let cac = require("cac");
|
|
4
|
+
|
|
5
|
+
//#region src/command.ts
|
|
6
|
+
/**
|
|
7
|
+
* Run the `build` command without side effects (no process.exit, no I/O).
|
|
8
|
+
* Returns the exit code, buffered output lines, and file map; the bin glue
|
|
9
|
+
* is responsible for actually writing files and forwarding output.
|
|
10
|
+
*
|
|
11
|
+
* Exit code split: 2 for CLI-shape errors (bad flag, unknown backend),
|
|
12
|
+
* 1 for build errors (parse failure, conflicting input/catalog), 0 for
|
|
13
|
+
* success.
|
|
14
|
+
*/
|
|
15
|
+
function runBuildCommand(input, flags) {
|
|
16
|
+
const stdout = [];
|
|
17
|
+
const stderr = [];
|
|
18
|
+
const out = flags.out;
|
|
19
|
+
if (!out) {
|
|
20
|
+
stderr.push("error: -o/--out is required");
|
|
21
|
+
return {
|
|
22
|
+
exitCode: 2,
|
|
23
|
+
stdout,
|
|
24
|
+
stderr,
|
|
25
|
+
files: []
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const { backends, unknown } = require_write.resolveBackends(collectList(flags.backend));
|
|
29
|
+
if (unknown.length > 0) {
|
|
30
|
+
stderr.push(`error: unknown backend(s): ${unknown.join(", ")}`);
|
|
31
|
+
stderr.push(`known: ${require_write.knownBackends.join(", ")}`);
|
|
32
|
+
return {
|
|
33
|
+
exitCode: 2,
|
|
34
|
+
stdout,
|
|
35
|
+
stderr,
|
|
36
|
+
files: []
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (backends.length === 0) {
|
|
40
|
+
stderr.push("error: no backends selected");
|
|
41
|
+
return {
|
|
42
|
+
exitCode: 2,
|
|
43
|
+
stdout,
|
|
44
|
+
stderr,
|
|
45
|
+
files: []
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const mode = parseMode(flags.mode);
|
|
49
|
+
if (!mode) {
|
|
50
|
+
stderr.push(`error: --mode must be one of scripts | single | multi (got "${flags.mode}")`);
|
|
51
|
+
return {
|
|
52
|
+
exitCode: 2,
|
|
53
|
+
stdout,
|
|
54
|
+
stderr,
|
|
55
|
+
files: []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const result = require_write.build({
|
|
59
|
+
input,
|
|
60
|
+
catalog: flags.catalog,
|
|
61
|
+
out,
|
|
62
|
+
backends,
|
|
63
|
+
mode
|
|
64
|
+
});
|
|
65
|
+
for (const w of result.warnings) stderr.push(`warn: ${w}`);
|
|
66
|
+
for (const e of result.errors) stderr.push(`error: ${e}`);
|
|
67
|
+
if (result.stats) {
|
|
68
|
+
const { appsCompiled, appsFailed, appsSkipped } = result.stats;
|
|
69
|
+
stderr.push(`summary: ${appsCompiled} compiled, ${appsFailed} failed, ${appsSkipped} skipped`);
|
|
70
|
+
}
|
|
71
|
+
if (result.errors.length > 0) return {
|
|
72
|
+
exitCode: 1,
|
|
73
|
+
stdout,
|
|
74
|
+
stderr,
|
|
75
|
+
files: []
|
|
76
|
+
};
|
|
77
|
+
stdout.push(`wrote ${result.files.length} file${result.files.length === 1 ? "" : "s"} to ${out}`);
|
|
78
|
+
return {
|
|
79
|
+
exitCode: 0,
|
|
80
|
+
stdout,
|
|
81
|
+
stderr,
|
|
82
|
+
files: result.files
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function collectList(value) {
|
|
86
|
+
if (value === void 0) return [];
|
|
87
|
+
return (Array.isArray(value) ? value : [value]).flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
|
|
88
|
+
}
|
|
89
|
+
function parseMode(value) {
|
|
90
|
+
if (!value) return "scripts";
|
|
91
|
+
if (value === "scripts" || value === "single" || value === "multi") return value;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/bin.ts
|
|
97
|
+
const cli = (0, cac.cac)("styx");
|
|
98
|
+
cli.command("build [input]", "Compile a descriptor or catalog into target-language wrappers").option("-o, --out <dir>", "Output directory").option("--catalog <dir>", "Walk a niwrap-style catalog (project/package/version/app layers)").option("-b, --backend <name>", `Backend to emit (repeatable, or comma-separated). Known: ${require_write.knownBackends.join(", ")}`, { default: "python" }).option("-m, --mode <mode>", "Which emit tiers run: scripts (app only) | single (+ package) | multi (+ project)", { default: "scripts" }).action((input, flags) => {
|
|
99
|
+
const result = runBuildCommand(input, flags);
|
|
100
|
+
for (const line of result.stderr) console.error(line);
|
|
101
|
+
if (result.exitCode === 0) require_write.writeFiles(result.files);
|
|
102
|
+
for (const line of result.stdout) console.log(line);
|
|
103
|
+
if (result.exitCode !== 0) process.exit(result.exitCode);
|
|
104
|
+
});
|
|
105
|
+
cli.help();
|
|
106
|
+
cli.version("0.0.1");
|
|
107
|
+
cli.parse();
|
|
108
|
+
|
|
109
|
+
//#endregion
|
package/dist/bin.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/bin.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { i as build, n as knownBackends, r as resolveBackends, t as writeFiles } from "./write-DSW1zlom.mjs";
|
|
3
|
+
import { cac } from "cac";
|
|
4
|
+
|
|
5
|
+
//#region src/command.ts
|
|
6
|
+
/**
|
|
7
|
+
* Run the `build` command without side effects (no process.exit, no I/O).
|
|
8
|
+
* Returns the exit code, buffered output lines, and file map; the bin glue
|
|
9
|
+
* is responsible for actually writing files and forwarding output.
|
|
10
|
+
*
|
|
11
|
+
* Exit code split: 2 for CLI-shape errors (bad flag, unknown backend),
|
|
12
|
+
* 1 for build errors (parse failure, conflicting input/catalog), 0 for
|
|
13
|
+
* success.
|
|
14
|
+
*/
|
|
15
|
+
function runBuildCommand(input, flags) {
|
|
16
|
+
const stdout = [];
|
|
17
|
+
const stderr = [];
|
|
18
|
+
const out = flags.out;
|
|
19
|
+
if (!out) {
|
|
20
|
+
stderr.push("error: -o/--out is required");
|
|
21
|
+
return {
|
|
22
|
+
exitCode: 2,
|
|
23
|
+
stdout,
|
|
24
|
+
stderr,
|
|
25
|
+
files: []
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const { backends, unknown } = resolveBackends(collectList(flags.backend));
|
|
29
|
+
if (unknown.length > 0) {
|
|
30
|
+
stderr.push(`error: unknown backend(s): ${unknown.join(", ")}`);
|
|
31
|
+
stderr.push(`known: ${knownBackends.join(", ")}`);
|
|
32
|
+
return {
|
|
33
|
+
exitCode: 2,
|
|
34
|
+
stdout,
|
|
35
|
+
stderr,
|
|
36
|
+
files: []
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (backends.length === 0) {
|
|
40
|
+
stderr.push("error: no backends selected");
|
|
41
|
+
return {
|
|
42
|
+
exitCode: 2,
|
|
43
|
+
stdout,
|
|
44
|
+
stderr,
|
|
45
|
+
files: []
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const mode = parseMode(flags.mode);
|
|
49
|
+
if (!mode) {
|
|
50
|
+
stderr.push(`error: --mode must be one of scripts | single | multi (got "${flags.mode}")`);
|
|
51
|
+
return {
|
|
52
|
+
exitCode: 2,
|
|
53
|
+
stdout,
|
|
54
|
+
stderr,
|
|
55
|
+
files: []
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const result = build({
|
|
59
|
+
input,
|
|
60
|
+
catalog: flags.catalog,
|
|
61
|
+
out,
|
|
62
|
+
backends,
|
|
63
|
+
mode
|
|
64
|
+
});
|
|
65
|
+
for (const w of result.warnings) stderr.push(`warn: ${w}`);
|
|
66
|
+
for (const e of result.errors) stderr.push(`error: ${e}`);
|
|
67
|
+
if (result.stats) {
|
|
68
|
+
const { appsCompiled, appsFailed, appsSkipped } = result.stats;
|
|
69
|
+
stderr.push(`summary: ${appsCompiled} compiled, ${appsFailed} failed, ${appsSkipped} skipped`);
|
|
70
|
+
}
|
|
71
|
+
if (result.errors.length > 0) return {
|
|
72
|
+
exitCode: 1,
|
|
73
|
+
stdout,
|
|
74
|
+
stderr,
|
|
75
|
+
files: []
|
|
76
|
+
};
|
|
77
|
+
stdout.push(`wrote ${result.files.length} file${result.files.length === 1 ? "" : "s"} to ${out}`);
|
|
78
|
+
return {
|
|
79
|
+
exitCode: 0,
|
|
80
|
+
stdout,
|
|
81
|
+
stderr,
|
|
82
|
+
files: result.files
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
function collectList(value) {
|
|
86
|
+
if (value === void 0) return [];
|
|
87
|
+
return (Array.isArray(value) ? value : [value]).flatMap((v) => v.split(",")).map((v) => v.trim()).filter(Boolean);
|
|
88
|
+
}
|
|
89
|
+
function parseMode(value) {
|
|
90
|
+
if (!value) return "scripts";
|
|
91
|
+
if (value === "scripts" || value === "single" || value === "multi") return value;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region src/bin.ts
|
|
97
|
+
const cli = cac("styx");
|
|
98
|
+
cli.command("build [input]", "Compile a descriptor or catalog into target-language wrappers").option("-o, --out <dir>", "Output directory").option("--catalog <dir>", "Walk a niwrap-style catalog (project/package/version/app layers)").option("-b, --backend <name>", `Backend to emit (repeatable, or comma-separated). Known: ${knownBackends.join(", ")}`, { default: "python" }).option("-m, --mode <mode>", "Which emit tiers run: scripts (app only) | single (+ package) | multi (+ project)", { default: "scripts" }).action((input, flags) => {
|
|
99
|
+
const result = runBuildCommand(input, flags);
|
|
100
|
+
for (const line of result.stderr) console.error(line);
|
|
101
|
+
if (result.exitCode === 0) writeFiles(result.files);
|
|
102
|
+
for (const line of result.stdout) console.log(line);
|
|
103
|
+
if (result.exitCode !== 0) process.exit(result.exitCode);
|
|
104
|
+
});
|
|
105
|
+
cli.help();
|
|
106
|
+
cli.version("0.0.1");
|
|
107
|
+
cli.parse();
|
|
108
|
+
|
|
109
|
+
//#endregion
|
|
110
|
+
export { };
|
|
111
|
+
//# sourceMappingURL=bin.mjs.map
|
package/dist/bin.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.mjs","names":[],"sources":["../src/command.ts","../src/bin.ts"],"sourcesContent":["import { knownBackends, resolveBackends } from \"./backends.js\";\nimport { build, type BuildMode } from \"./build.js\";\nimport type { BuiltFile } from \"./build.js\";\n\nexport interface BuildFlags {\n out?: string;\n catalog?: string;\n backend?: string | string[];\n mode?: string;\n}\n\nexport interface RunResult {\n exitCode: number;\n stdout: string[];\n stderr: string[];\n files: BuiltFile[];\n}\n\n/**\n * Run the `build` command without side effects (no process.exit, no I/O).\n * Returns the exit code, buffered output lines, and file map; the bin glue\n * is responsible for actually writing files and forwarding output.\n *\n * Exit code split: 2 for CLI-shape errors (bad flag, unknown backend),\n * 1 for build errors (parse failure, conflicting input/catalog), 0 for\n * success.\n */\nexport function runBuildCommand(input: string | undefined, flags: BuildFlags): RunResult {\n const stdout: string[] = [];\n const stderr: string[] = [];\n\n const out = flags.out;\n if (!out) {\n stderr.push(\"error: -o/--out is required\");\n return { exitCode: 2, stdout, stderr, files: [] };\n }\n\n const backendNames = collectList(flags.backend);\n const { backends, unknown } = resolveBackends(backendNames);\n if (unknown.length > 0) {\n stderr.push(`error: unknown backend(s): ${unknown.join(\", \")}`);\n stderr.push(`known: ${knownBackends.join(\", \")}`);\n return { exitCode: 2, stdout, stderr, files: [] };\n }\n if (backends.length === 0) {\n stderr.push(\"error: no backends selected\");\n return { exitCode: 2, stdout, stderr, files: [] };\n }\n\n const mode = parseMode(flags.mode);\n if (!mode) {\n stderr.push(`error: --mode must be one of scripts | single | multi (got \"${flags.mode}\")`);\n return { exitCode: 2, stdout, stderr, files: [] };\n }\n\n const result = build({ input, catalog: flags.catalog, out, backends, mode });\n\n for (const w of result.warnings) stderr.push(`warn: ${w}`);\n for (const e of result.errors) stderr.push(`error: ${e}`);\n\n // Catalog builds report a tool tally so a few broken tools in a large catalog\n // are visible at a glance rather than buried in per-tool error lines.\n if (result.stats) {\n const { appsCompiled, appsFailed, appsSkipped } = result.stats;\n stderr.push(`summary: ${appsCompiled} compiled, ${appsFailed} failed, ${appsSkipped} skipped`);\n }\n\n if (result.errors.length > 0) {\n return { exitCode: 1, stdout, stderr, files: [] };\n }\n\n stdout.push(`wrote ${result.files.length} file${result.files.length === 1 ? \"\" : \"s\"} to ${out}`);\n return { exitCode: 0, stdout, stderr, files: result.files };\n}\n\nfunction collectList(value: string | string[] | undefined): string[] {\n if (value === undefined) return [];\n const arr = Array.isArray(value) ? value : [value];\n return arr\n .flatMap((v) => v.split(\",\"))\n .map((v) => v.trim())\n .filter(Boolean);\n}\n\nfunction parseMode(value: string | undefined): BuildMode | null {\n if (!value) return \"scripts\";\n if (value === \"scripts\" || value === \"single\" || value === \"multi\") return value;\n return null;\n}\n","#!/usr/bin/env node\nimport { cac } from \"cac\";\n\nimport { knownBackends } from \"./backends.js\";\nimport { runBuildCommand, type BuildFlags } from \"./command.js\";\nimport { writeFiles } from \"./write.js\";\n\nconst cli = cac(\"styx\");\n\ncli\n .command(\"build [input]\", \"Compile a descriptor or catalog into target-language wrappers\")\n .option(\"-o, --out <dir>\", \"Output directory\")\n .option(\"--catalog <dir>\", \"Walk a niwrap-style catalog (project/package/version/app layers)\")\n .option(\n \"-b, --backend <name>\",\n `Backend to emit (repeatable, or comma-separated). Known: ${knownBackends.join(\", \")}`,\n { default: \"python\" },\n )\n .option(\n \"-m, --mode <mode>\",\n \"Which emit tiers run: scripts (app only) | single (+ package) | multi (+ project)\",\n { default: \"scripts\" },\n )\n .action((input: string | undefined, flags: BuildFlags) => {\n const result = runBuildCommand(input, flags);\n for (const line of result.stderr) console.error(line);\n if (result.exitCode === 0) writeFiles(result.files);\n for (const line of result.stdout) console.log(line);\n if (result.exitCode !== 0) process.exit(result.exitCode);\n });\n\ncli.help();\ncli.version(\"0.0.1\");\n\ncli.parse();\n"],"mappings":";;;;;;;;;;;;;;AA2BA,SAAgB,gBAAgB,OAA2B,OAA8B;CACvF,MAAM,SAAmB,EAAE;CAC3B,MAAM,SAAmB,EAAE;CAE3B,MAAM,MAAM,MAAM;AAClB,KAAI,CAAC,KAAK;AACR,SAAO,KAAK,8BAA8B;AAC1C,SAAO;GAAE,UAAU;GAAG;GAAQ;GAAQ,OAAO,EAAE;GAAE;;CAInD,MAAM,EAAE,UAAU,YAAY,gBADT,YAAY,MAAM,QAAQ,CACY;AAC3D,KAAI,QAAQ,SAAS,GAAG;AACtB,SAAO,KAAK,8BAA8B,QAAQ,KAAK,KAAK,GAAG;AAC/D,SAAO,KAAK,UAAU,cAAc,KAAK,KAAK,GAAG;AACjD,SAAO;GAAE,UAAU;GAAG;GAAQ;GAAQ,OAAO,EAAE;GAAE;;AAEnD,KAAI,SAAS,WAAW,GAAG;AACzB,SAAO,KAAK,8BAA8B;AAC1C,SAAO;GAAE,UAAU;GAAG;GAAQ;GAAQ,OAAO,EAAE;GAAE;;CAGnD,MAAM,OAAO,UAAU,MAAM,KAAK;AAClC,KAAI,CAAC,MAAM;AACT,SAAO,KAAK,+DAA+D,MAAM,KAAK,IAAI;AAC1F,SAAO;GAAE,UAAU;GAAG;GAAQ;GAAQ,OAAO,EAAE;GAAE;;CAGnD,MAAM,SAAS,MAAM;EAAE;EAAO,SAAS,MAAM;EAAS;EAAK;EAAU;EAAM,CAAC;AAE5E,MAAK,MAAM,KAAK,OAAO,SAAU,QAAO,KAAK,SAAS,IAAI;AAC1D,MAAK,MAAM,KAAK,OAAO,OAAQ,QAAO,KAAK,UAAU,IAAI;AAIzD,KAAI,OAAO,OAAO;EAChB,MAAM,EAAE,cAAc,YAAY,gBAAgB,OAAO;AACzD,SAAO,KAAK,YAAY,aAAa,aAAa,WAAW,WAAW,YAAY,UAAU;;AAGhG,KAAI,OAAO,OAAO,SAAS,EACzB,QAAO;EAAE,UAAU;EAAG;EAAQ;EAAQ,OAAO,EAAE;EAAE;AAGnD,QAAO,KAAK,SAAS,OAAO,MAAM,OAAO,OAAO,OAAO,MAAM,WAAW,IAAI,KAAK,IAAI,MAAM,MAAM;AACjG,QAAO;EAAE,UAAU;EAAG;EAAQ;EAAQ,OAAO,OAAO;EAAO;;AAG7D,SAAS,YAAY,OAAgD;AACnE,KAAI,UAAU,OAAW,QAAO,EAAE;AAElC,SADY,MAAM,QAAQ,MAAM,GAAG,QAAQ,CAAC,MAAM,EAE/C,SAAS,MAAM,EAAE,MAAM,IAAI,CAAC,CAC5B,KAAK,MAAM,EAAE,MAAM,CAAC,CACpB,OAAO,QAAQ;;AAGpB,SAAS,UAAU,OAA6C;AAC9D,KAAI,CAAC,MAAO,QAAO;AACnB,KAAI,UAAU,aAAa,UAAU,YAAY,UAAU,QAAS,QAAO;AAC3E,QAAO;;;;;AChFT,MAAM,MAAM,IAAI,OAAO;AAEvB,IACG,QAAQ,iBAAiB,gEAAgE,CACzF,OAAO,mBAAmB,mBAAmB,CAC7C,OAAO,mBAAmB,mEAAmE,CAC7F,OACC,wBACA,4DAA4D,cAAc,KAAK,KAAK,IACpF,EAAE,SAAS,UAAU,CACtB,CACA,OACC,qBACA,qFACA,EAAE,SAAS,WAAW,CACvB,CACA,QAAQ,OAA2B,UAAsB;CACxD,MAAM,SAAS,gBAAgB,OAAO,MAAM;AAC5C,MAAK,MAAM,QAAQ,OAAO,OAAQ,SAAQ,MAAM,KAAK;AACrD,KAAI,OAAO,aAAa,EAAG,YAAW,OAAO,MAAM;AACnD,MAAK,MAAM,QAAQ,OAAO,OAAQ,SAAQ,IAAI,KAAK;AACnD,KAAI,OAAO,aAAa,EAAG,SAAQ,KAAK,OAAO,SAAS;EACxD;AAEJ,IAAI,MAAM;AACV,IAAI,QAAQ,QAAQ;AAEpB,IAAI,OAAO"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const require_write = require('./write-BtRGJfHV.cjs');
|
|
2
|
+
|
|
3
|
+
exports.build = require_write.build;
|
|
4
|
+
exports.detectLevel = require_write.detectLevel;
|
|
5
|
+
exports.knownBackends = require_write.knownBackends;
|
|
6
|
+
exports.loadCatalog = require_write.loadCatalog;
|
|
7
|
+
exports.resolveBackends = require_write.resolveBackends;
|
|
8
|
+
exports.writeFiles = require_write.writeFiles;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Backend, PackageMeta, ProjectMeta } from "@styx-api/core";
|
|
2
|
+
|
|
3
|
+
//#region src/build.d.ts
|
|
4
|
+
type BuildMode = "scripts" | "single" | "multi";
|
|
5
|
+
interface BuildOptions {
|
|
6
|
+
/** Single-descriptor input file (mutually exclusive with `catalog`). */
|
|
7
|
+
input?: string;
|
|
8
|
+
/** Catalog directory (mutually exclusive with `input`). */
|
|
9
|
+
catalog?: string;
|
|
10
|
+
/** Output directory; per-backend files end up under `<out>/<backend.target>/...`. */
|
|
11
|
+
out: string;
|
|
12
|
+
/** Backends to run (instances pre-resolved by the caller). */
|
|
13
|
+
backends: Backend[];
|
|
14
|
+
/** Which emit tiers to run. */
|
|
15
|
+
mode: BuildMode;
|
|
16
|
+
}
|
|
17
|
+
/** A single file from a backend run, keyed by destination path. */
|
|
18
|
+
interface BuiltFile {
|
|
19
|
+
/** Absolute destination path. */
|
|
20
|
+
path: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}
|
|
23
|
+
/** Per-tool tallies for a catalog build (undefined for single-descriptor builds). */
|
|
24
|
+
interface BuildStats {
|
|
25
|
+
appsCompiled: number;
|
|
26
|
+
appsFailed: number;
|
|
27
|
+
appsSkipped: number;
|
|
28
|
+
}
|
|
29
|
+
interface BuildResult {
|
|
30
|
+
files: BuiltFile[];
|
|
31
|
+
errors: string[];
|
|
32
|
+
warnings: string[];
|
|
33
|
+
/** Catalog-build tallies; set only by `--catalog` builds. */
|
|
34
|
+
stats?: BuildStats;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Run the build. Returns the assembled file map and diagnostics; the caller
|
|
38
|
+
* is responsible for actually writing to disk (so tests can introspect the
|
|
39
|
+
* map directly).
|
|
40
|
+
*/
|
|
41
|
+
declare function build(options: BuildOptions): BuildResult;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/catalog.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Loaded catalog: a project containing packages, each holding one or more
|
|
46
|
+
* apps. We always normalize to project > package > app even when the catalog
|
|
47
|
+
* root only describes a subset of the hierarchy (e.g. a single version dir).
|
|
48
|
+
*/
|
|
49
|
+
interface CatalogProject {
|
|
50
|
+
meta: ProjectMeta;
|
|
51
|
+
packages: CatalogPackage[];
|
|
52
|
+
/** Non-fatal issues found while walking the catalog (e.g. skipped stub apps). */
|
|
53
|
+
warnings: string[];
|
|
54
|
+
}
|
|
55
|
+
interface CatalogPackage {
|
|
56
|
+
meta: PackageMeta;
|
|
57
|
+
apps: CatalogApp[];
|
|
58
|
+
}
|
|
59
|
+
interface CatalogApp {
|
|
60
|
+
/** Stable identifier from `app.json#name`, used for the emitted module slug. */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Absolute path to the descriptor file referenced by `app.json#source`. */
|
|
63
|
+
sourcePath: string;
|
|
64
|
+
sourceFormat?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Detect what level of the niwrap catalog a directory describes.
|
|
68
|
+
* Project dirs contain `project.json`, package dirs contain `package.json`,
|
|
69
|
+
* version dirs contain `version.json`, app dirs contain `app.json`.
|
|
70
|
+
*/
|
|
71
|
+
type CatalogLevel = "project" | "package" | "version" | "app";
|
|
72
|
+
declare function detectLevel(dir: string): CatalogLevel | null;
|
|
73
|
+
/**
|
|
74
|
+
* Load a catalog from any niwrap layout level. The level is auto-detected from
|
|
75
|
+
* which `*.json` index file is present in `root`. Always returns a normalized
|
|
76
|
+
* `project > package > app` shape, synthesizing missing layers as needed.
|
|
77
|
+
*/
|
|
78
|
+
declare function loadCatalog(root: string): CatalogProject;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/backends.d.ts
|
|
81
|
+
declare const knownBackends: string[];
|
|
82
|
+
declare function resolveBackends(names: string[]): {
|
|
83
|
+
backends: Backend[];
|
|
84
|
+
unknown: string[];
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/write.d.ts
|
|
88
|
+
declare function writeFiles(files: BuiltFile[]): void;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { type BuildMode, type BuildOptions, type BuildResult, type BuiltFile, type CatalogApp, type CatalogLevel, type CatalogPackage, type CatalogProject, build, detectLevel, knownBackends, loadCatalog, resolveBackends, writeFiles };
|
|
91
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/build.ts","../src/catalog.ts","../src/backends.ts","../src/write.ts"],"mappings":";;;KAoBY,SAAA;AAAA,UASK,YAAA;EATL;EAWV,KAAA;;EAEA,OAAA;EAbmB;EAenB,GAAA;EAN2B;EAQ3B,QAAA,EAAU,OAAA;EAEK;EAAf,IAAA,EAAM,SAAA;AAAA;;UAIS,SAAA;EANL;EAQV,IAAA;EACA,OAAA;AAAA;;UAIe,UAAA;EACf,YAAA;EACA,UAAA;EACA,WAAA;AAAA;AAAA,UAGe,WAAA;EACf,KAAA,EAAO,SAAA;EACP,MAAA;EACA,QAAA;EARA;EAUA,KAAA,GAAQ,UAAA;AAAA;;;AALV;;;iBAkBgB,KAAA,CAAM,OAAA,EAAS,YAAA,GAAe,WAAA;;;;;AAtD9C;;;UCViB,cAAA;EACf,IAAA,EAAM,WAAA;EACN,QAAA,EAAU,cAAA;EDiBiB;ECf3B,QAAA;AAAA;AAAA,UAGe,cAAA;EACf,IAAA,EAAM,WAAA;EACN,IAAA,EAAM,UAAA;AAAA;AAAA,UAGS,UAAA;EDiBf;ECfA,IAAA;EDee;ECbf,UAAA;EACA,YAAA;AAAA;;;;ADuBF;;KC4CY,YAAA;AAAA,iBAEI,WAAA,CAAY,GAAA,WAAc,YAAA;;;;;;iBAmH1B,WAAA,CAAY,IAAA,WAAe,cAAA;;;cC9L9B,aAAA;AAAA,iBAEG,eAAA,CAAgB,KAAA;EAAoB,QAAA,EAAU,OAAA;EAAW,OAAA;AAAA;;;iBClBzD,UAAA,CAAW,KAAA,EAAO,SAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Backend, PackageMeta, ProjectMeta } from "@styx-api/core";
|
|
2
|
+
|
|
3
|
+
//#region src/build.d.ts
|
|
4
|
+
type BuildMode = "scripts" | "single" | "multi";
|
|
5
|
+
interface BuildOptions {
|
|
6
|
+
/** Single-descriptor input file (mutually exclusive with `catalog`). */
|
|
7
|
+
input?: string;
|
|
8
|
+
/** Catalog directory (mutually exclusive with `input`). */
|
|
9
|
+
catalog?: string;
|
|
10
|
+
/** Output directory; per-backend files end up under `<out>/<backend.target>/...`. */
|
|
11
|
+
out: string;
|
|
12
|
+
/** Backends to run (instances pre-resolved by the caller). */
|
|
13
|
+
backends: Backend[];
|
|
14
|
+
/** Which emit tiers to run. */
|
|
15
|
+
mode: BuildMode;
|
|
16
|
+
}
|
|
17
|
+
/** A single file from a backend run, keyed by destination path. */
|
|
18
|
+
interface BuiltFile {
|
|
19
|
+
/** Absolute destination path. */
|
|
20
|
+
path: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}
|
|
23
|
+
/** Per-tool tallies for a catalog build (undefined for single-descriptor builds). */
|
|
24
|
+
interface BuildStats {
|
|
25
|
+
appsCompiled: number;
|
|
26
|
+
appsFailed: number;
|
|
27
|
+
appsSkipped: number;
|
|
28
|
+
}
|
|
29
|
+
interface BuildResult {
|
|
30
|
+
files: BuiltFile[];
|
|
31
|
+
errors: string[];
|
|
32
|
+
warnings: string[];
|
|
33
|
+
/** Catalog-build tallies; set only by `--catalog` builds. */
|
|
34
|
+
stats?: BuildStats;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Run the build. Returns the assembled file map and diagnostics; the caller
|
|
38
|
+
* is responsible for actually writing to disk (so tests can introspect the
|
|
39
|
+
* map directly).
|
|
40
|
+
*/
|
|
41
|
+
declare function build(options: BuildOptions): BuildResult;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/catalog.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Loaded catalog: a project containing packages, each holding one or more
|
|
46
|
+
* apps. We always normalize to project > package > app even when the catalog
|
|
47
|
+
* root only describes a subset of the hierarchy (e.g. a single version dir).
|
|
48
|
+
*/
|
|
49
|
+
interface CatalogProject {
|
|
50
|
+
meta: ProjectMeta;
|
|
51
|
+
packages: CatalogPackage[];
|
|
52
|
+
/** Non-fatal issues found while walking the catalog (e.g. skipped stub apps). */
|
|
53
|
+
warnings: string[];
|
|
54
|
+
}
|
|
55
|
+
interface CatalogPackage {
|
|
56
|
+
meta: PackageMeta;
|
|
57
|
+
apps: CatalogApp[];
|
|
58
|
+
}
|
|
59
|
+
interface CatalogApp {
|
|
60
|
+
/** Stable identifier from `app.json#name`, used for the emitted module slug. */
|
|
61
|
+
name: string;
|
|
62
|
+
/** Absolute path to the descriptor file referenced by `app.json#source`. */
|
|
63
|
+
sourcePath: string;
|
|
64
|
+
sourceFormat?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Detect what level of the niwrap catalog a directory describes.
|
|
68
|
+
* Project dirs contain `project.json`, package dirs contain `package.json`,
|
|
69
|
+
* version dirs contain `version.json`, app dirs contain `app.json`.
|
|
70
|
+
*/
|
|
71
|
+
type CatalogLevel = "project" | "package" | "version" | "app";
|
|
72
|
+
declare function detectLevel(dir: string): CatalogLevel | null;
|
|
73
|
+
/**
|
|
74
|
+
* Load a catalog from any niwrap layout level. The level is auto-detected from
|
|
75
|
+
* which `*.json` index file is present in `root`. Always returns a normalized
|
|
76
|
+
* `project > package > app` shape, synthesizing missing layers as needed.
|
|
77
|
+
*/
|
|
78
|
+
declare function loadCatalog(root: string): CatalogProject;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/backends.d.ts
|
|
81
|
+
declare const knownBackends: string[];
|
|
82
|
+
declare function resolveBackends(names: string[]): {
|
|
83
|
+
backends: Backend[];
|
|
84
|
+
unknown: string[];
|
|
85
|
+
};
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region src/write.d.ts
|
|
88
|
+
declare function writeFiles(files: BuiltFile[]): void;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { type BuildMode, type BuildOptions, type BuildResult, type BuiltFile, type CatalogApp, type CatalogLevel, type CatalogPackage, type CatalogProject, build, detectLevel, knownBackends, loadCatalog, resolveBackends, writeFiles };
|
|
91
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/build.ts","../src/catalog.ts","../src/backends.ts","../src/write.ts"],"mappings":";;;KAoBY,SAAA;AAAA,UASK,YAAA;EATL;EAWV,KAAA;;EAEA,OAAA;EAbmB;EAenB,GAAA;EAN2B;EAQ3B,QAAA,EAAU,OAAA;EAEK;EAAf,IAAA,EAAM,SAAA;AAAA;;UAIS,SAAA;EANL;EAQV,IAAA;EACA,OAAA;AAAA;;UAIe,UAAA;EACf,YAAA;EACA,UAAA;EACA,WAAA;AAAA;AAAA,UAGe,WAAA;EACf,KAAA,EAAO,SAAA;EACP,MAAA;EACA,QAAA;EARA;EAUA,KAAA,GAAQ,UAAA;AAAA;;;AALV;;;iBAkBgB,KAAA,CAAM,OAAA,EAAS,YAAA,GAAe,WAAA;;;;;AAtD9C;;;UCViB,cAAA;EACf,IAAA,EAAM,WAAA;EACN,QAAA,EAAU,cAAA;EDiBiB;ECf3B,QAAA;AAAA;AAAA,UAGe,cAAA;EACf,IAAA,EAAM,WAAA;EACN,IAAA,EAAM,UAAA;AAAA;AAAA,UAGS,UAAA;EDiBf;ECfA,IAAA;EDee;ECbf,UAAA;EACA,YAAA;AAAA;;;;ADuBF;;KC4CY,YAAA;AAAA,iBAEI,WAAA,CAAY,GAAA,WAAc,YAAA;;;;;;iBAmH1B,WAAA,CAAY,IAAA,WAAe,cAAA;;;cC9L9B,aAAA;AAAA,iBAEG,eAAA,CAAgB,KAAA;EAAoB,QAAA,EAAU,OAAA;EAAW,OAAA;AAAA;;;iBClBzD,UAAA,CAAW,KAAA,EAAO,SAAA"}
|
package/dist/index.mjs
ADDED