@ucdjs/cli 0.3.1-beta.5 → 0.3.1-beta.6

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.mjs CHANGED
@@ -3,7 +3,7 @@ import farver, { bgGreen, black, bold, dim, green } from "farver/fast";
3
3
  import yargs from "yargs-parser";
4
4
 
5
5
  //#region package.json
6
- var version = "0.3.1-beta.5";
6
+ var version = "0.3.1-beta.6";
7
7
 
8
8
  //#endregion
9
9
  //#region src/output.ts
@@ -353,7 +353,7 @@ async function runCommand(cmd, flags) {
353
353
  break;
354
354
  }
355
355
  case "pipelines": {
356
- const { runPipelinesRoot } = await import("./root-Cn7uU7-P.mjs");
356
+ const { runPipelinesRoot } = await import("./root-DdD9Nkoj.mjs");
357
357
  await runPipelinesRoot(flags._[1]?.toString() ?? "", { flags });
358
358
  break;
359
359
  }
@@ -28,7 +28,7 @@ async function runPipelinesRoot(subcommand, { flags }) {
28
28
  return;
29
29
  }
30
30
  if (subcommand === "run") {
31
- const { runPipelinesRun } = await import("./run-owMQvC61.mjs");
31
+ const { runPipelinesRun } = await import("./run-_ph_kOrE.mjs");
32
32
  await runPipelinesRun({ flags });
33
33
  return;
34
34
  }
@@ -0,0 +1,109 @@
1
+ import { n as printHelp, r as CLIError, t as parseRepoString, v as output } from "./cli.mjs";
2
+ import process from "node:process";
3
+ import { findPipelineFiles, findRemotePipelineFiles, loadPipelinesFromPaths, loadRemotePipelines } from "@ucdjs/pipelines-loader";
4
+ import { createPipelineExecutor } from "@ucdjs/pipelines-executor";
5
+
6
+ //#region src/cmd/pipelines/run.ts
7
+ async function runPipelinesRun({ flags }) {
8
+ if (flags?.help || flags?.h) {
9
+ printHelp({
10
+ headline: "Run Pipelines",
11
+ commandName: "ucd pipelines run",
12
+ usage: "[...pipelines] [...flags]",
13
+ tables: { Flags: [
14
+ ["--ui", "Run the pipeline with a UI."],
15
+ ["--port <number>", "Port for the UI server (default: 3030)."],
16
+ ["--cwd <path>", "Search for pipeline files from this directory."],
17
+ ["--github <owner/repo>", "Load pipelines from a GitHub repository."],
18
+ ["--gitlab <owner/repo>", "Load pipelines from a GitLab repository."],
19
+ ["--ref <ref>", "Git reference (branch/tag) for remote repositories."],
20
+ ["--path <path>", "Subdirectory path within the repository."],
21
+ ["--help (-h)", "See all available flags."]
22
+ ] }
23
+ });
24
+ return;
25
+ }
26
+ const sources = [];
27
+ if (flags?.cwd) sources.push({
28
+ type: "local",
29
+ id: "local",
30
+ cwd: flags.cwd
31
+ });
32
+ if (flags?.github) {
33
+ const { owner, repo } = parseRepoString(flags.github);
34
+ sources.push({
35
+ type: "github",
36
+ id: `github-${owner}-${repo}`,
37
+ owner,
38
+ repo,
39
+ ref: flags.ref,
40
+ path: flags.path
41
+ });
42
+ }
43
+ if (flags?.gitlab) {
44
+ const { owner, repo } = parseRepoString(flags.gitlab);
45
+ sources.push({
46
+ type: "gitlab",
47
+ id: `gitlab-${owner}-${repo}`,
48
+ owner,
49
+ repo,
50
+ ref: flags.ref,
51
+ path: flags.path
52
+ });
53
+ }
54
+ if (sources.length === 0) sources.push({
55
+ type: "local",
56
+ id: "local",
57
+ cwd: process.cwd()
58
+ });
59
+ if (flags?.ui) {
60
+ const { startServer } = await import("@ucdjs/pipelines-server");
61
+ const port = flags?.port ?? 3030;
62
+ output.info(`Starting Pipeline UI on port ${port}...`);
63
+ for (const source of sources) if (source.type === "local") output.info(` [local] ${source.cwd}`);
64
+ else if (source.type === "github") output.info(` [github] ${source.owner}/${source.repo}${source.ref ? `@${source.ref}` : ""}`);
65
+ else if (source.type === "gitlab") output.info(` [gitlab] ${source.owner}/${source.repo}${source.ref ? `@${source.ref}` : ""}`);
66
+ await startServer({
67
+ port,
68
+ sources
69
+ });
70
+ return;
71
+ }
72
+ const selectors = (flags._ ?? []).slice(2).map(String).filter(Boolean);
73
+ output.info("Running pipelines...");
74
+ for (const source of sources) if (source.type === "local") output.info(` [local] ${source.cwd}`);
75
+ else if (source.type === "github") output.info(` [github] ${source.owner}/${source.repo}${source.ref ? `@${source.ref}` : ""}`);
76
+ else if (source.type === "gitlab") output.info(` [gitlab] ${source.owner}/${source.repo}${source.ref ? `@${source.ref}` : ""}`);
77
+ const allPipelines = [];
78
+ const loadErrors = [];
79
+ for (const source of sources) try {
80
+ const result = source.type === "local" ? await loadPipelinesFromPaths(await findPipelineFiles({ cwd: source.cwd })) : await loadRemotePipelines(source, (await findRemotePipelineFiles(source)).files);
81
+ allPipelines.push(...result.pipelines);
82
+ for (const err of result.errors) loadErrors.push(`${source.id}: ${err.filePath} - ${err.error.message}`);
83
+ } catch (error) {
84
+ loadErrors.push(`${source.id}: ${error instanceof Error ? error.message : String(error)}`);
85
+ }
86
+ if (allPipelines.length === 0) throw new CLIError("No pipelines found to run.", { details: loadErrors.length > 0 ? loadErrors : void 0 });
87
+ const selectedPipelines = selectors.length > 0 ? allPipelines.filter((pipeline) => selectors.includes(pipeline.id) || !!pipeline.name && selectors.includes(pipeline.name)) : allPipelines;
88
+ if (selectors.length > 0) {
89
+ const matched = new Set(selectedPipelines.flatMap((p) => [p.id, p.name].filter(Boolean)));
90
+ const missing = selectors.filter((selector) => !matched.has(selector));
91
+ if (missing.length > 0) output.warning(`Unknown pipeline selector(s): ${missing.join(", ")}`);
92
+ }
93
+ if (selectedPipelines.length === 0) throw new CLIError("No pipelines matched the provided selectors.");
94
+ output.info(`Executing ${selectedPipelines.length} pipeline(s)...`);
95
+ const results = await createPipelineExecutor({}).run(selectedPipelines);
96
+ let failed = 0;
97
+ for (const result of results) {
98
+ if (result.status === "failed" || result.errors.length > 0) {
99
+ failed += 1;
100
+ output.error(`✗ ${result.id} failed (${result.errors.length} error(s))`);
101
+ continue;
102
+ }
103
+ output.success(`✓ ${result.id} completed in ${result.summary.durationMs}ms (${result.summary.totalOutputs} output(s))`);
104
+ }
105
+ if (failed > 0) throw new CLIError(`${failed} pipeline(s) failed.`);
106
+ }
107
+
108
+ //#endregion
109
+ export { runPipelinesRun };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucdjs/cli",
3
- "version": "0.3.1-beta.5",
3
+ "version": "0.3.1-beta.6",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Lucas Nørgård",
@@ -30,24 +30,25 @@
30
30
  "dist"
31
31
  ],
32
32
  "engines": {
33
- "node": ">=22.18"
33
+ "node": ">=24.13"
34
34
  },
35
35
  "dependencies": {
36
- "@clack/prompts": "1.0.0",
36
+ "@clack/prompts": "1.0.1",
37
37
  "@luxass/utils": "2.7.3",
38
38
  "@unicode-utils/core": "0.12.0-beta.19",
39
39
  "farver": "0.4.2",
40
40
  "yargs-parser": "22.0.0",
41
- "@ucdjs-internal/shared": "0.1.1-beta.5",
42
- "@ucdjs/client": "0.1.1-beta.5",
43
- "@ucdjs/fs-bridge": "0.1.1-beta.5",
44
- "@ucdjs/lockfile": "0.1.1-beta.5",
45
- "@ucdjs/pipelines-server": "0.0.1-beta.5",
46
- "@ucdjs/env": "0.1.1-beta.6",
47
- "@ucdjs/schema-gen": "0.2.3-beta.5",
48
- "@ucdjs/schemas": "0.1.1-beta.5",
49
- "@ucdjs/ucd-store": "1.0.1-beta.5",
50
- "@ucdjs/pipelines-loader": "0.0.1-beta.5"
41
+ "@ucdjs-internal/shared": "0.1.1-beta.6",
42
+ "@ucdjs/env": "0.1.1-beta.7",
43
+ "@ucdjs/fs-bridge": "0.1.1-beta.6",
44
+ "@ucdjs/pipelines-executor": "0.0.1-beta.6",
45
+ "@ucdjs/lockfile": "0.1.1-beta.6",
46
+ "@ucdjs/pipelines-loader": "0.0.1-beta.6",
47
+ "@ucdjs/pipelines-server": "0.0.1-beta.6",
48
+ "@ucdjs/schema-gen": "0.2.3-beta.6",
49
+ "@ucdjs/schemas": "0.1.1-beta.6",
50
+ "@ucdjs/ucd-store": "1.0.1-beta.6",
51
+ "@ucdjs/client": "0.1.1-beta.6"
51
52
  },
52
53
  "devDependencies": {
53
54
  "@luxass/eslint-config": "7.2.0",
@@ -1,74 +0,0 @@
1
- import { n as printHelp, t as parseRepoString, v as output } from "./cli.mjs";
2
- import process from "node:process";
3
-
4
- //#region src/cmd/pipelines/run.ts
5
- async function runPipelinesRun({ flags }) {
6
- if (flags?.help || flags?.h) {
7
- printHelp({
8
- headline: "Run Pipelines",
9
- commandName: "ucd pipelines run",
10
- usage: "[...pipelines] [...flags]",
11
- tables: { Flags: [
12
- ["--ui", "Run the pipeline with a UI."],
13
- ["--port <number>", "Port for the UI server (default: 3030)."],
14
- ["--cwd <path>", "Search for pipeline files from this directory."],
15
- ["--github <owner/repo>", "Load pipelines from a GitHub repository."],
16
- ["--gitlab <owner/repo>", "Load pipelines from a GitLab repository."],
17
- ["--ref <ref>", "Git reference (branch/tag) for remote repositories."],
18
- ["--path <path>", "Subdirectory path within the repository."],
19
- ["--help (-h)", "See all available flags."]
20
- ] }
21
- });
22
- return;
23
- }
24
- const sources = [];
25
- if (flags?.cwd) sources.push({
26
- type: "local",
27
- id: "local",
28
- cwd: flags.cwd
29
- });
30
- if (flags?.github) {
31
- const { owner, repo } = parseRepoString(flags.github);
32
- sources.push({
33
- type: "github",
34
- id: `github-${owner}-${repo}`,
35
- owner,
36
- repo,
37
- ref: flags.ref,
38
- path: flags.path
39
- });
40
- }
41
- if (flags?.gitlab) {
42
- const { owner, repo } = parseRepoString(flags.gitlab);
43
- sources.push({
44
- type: "gitlab",
45
- id: `gitlab-${owner}-${repo}`,
46
- owner,
47
- repo,
48
- ref: flags.ref,
49
- path: flags.path
50
- });
51
- }
52
- if (sources.length === 0) sources.push({
53
- type: "local",
54
- id: "local",
55
- cwd: process.cwd()
56
- });
57
- if (flags?.ui) {
58
- const { startServer } = await import("@ucdjs/pipelines-server");
59
- const port = flags?.port ?? 3030;
60
- output.info(`Starting Pipeline UI on port ${port}...`);
61
- for (const source of sources) if (source.type === "local") output.info(` [local] ${source.cwd}`);
62
- else if (source.type === "github") output.info(` [github] ${source.owner}/${source.repo}${source.ref ? `@${source.ref}` : ""}`);
63
- else if (source.type === "gitlab") output.info(` [gitlab] ${source.owner}/${source.repo}${source.ref ? `@${source.ref}` : ""}`);
64
- await startServer({
65
- port,
66
- sources
67
- });
68
- return;
69
- }
70
- output.info("Running pipelines...");
71
- }
72
-
73
- //#endregion
74
- export { runPipelinesRun };