@omni-oss/create-jobs 0.1.2 → 0.1.3
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/CHANGELOG.md +7 -0
- package/dist/create-jobs.cjs +1 -1
- package/dist/create-jobs.d.ts +8 -1
- package/dist/create-jobs.d.ts.map +1 -1
- package/dist/create-jobs.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{schemas-BKjl6CL-.mjs → schemas-Bs89CfAz.mjs} +54 -37
- package/dist/schemas-BxqeixM7.js +1 -0
- package/package.json +1 -1
- package/src/create-jobs.spec.ts +39 -2
- package/src/create-jobs.ts +46 -3
- package/dist/schemas-B3fc8OPo.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
|
3
3
|
|
|
4
4
|
- - -
|
|
5
|
+
## @omni-oss/create-jobs-v0.1.3 - 2026-02-08
|
|
6
|
+
#### Bug Fixes
|
|
7
|
+
- (**@omni-oss/create-jobs**) create artifacts data - (d1e292c) - Clarence Manuel
|
|
8
|
+
- (**@omni-oss/create-jobs**) resolve output files to project dir - (8f18f0d) - Clarence Manuel
|
|
9
|
+
|
|
10
|
+
- - -
|
|
11
|
+
|
|
5
12
|
## @omni-oss/create-jobs-v0.1.2 - 2026-02-08
|
|
6
13
|
#### Bug Fixes
|
|
7
14
|
- (**@omni-oss/create-jobs**) remove unused properties - (c5f5d01) - Clarence Manuel
|
package/dist/create-jobs.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
"use strict";const o=require("node:fs/promises"),i=require("@commander-js/extra-typings"),r=require("./schemas-
|
|
2
|
+
"use strict";const o=require("node:fs/promises"),i=require("@commander-js/extra-typings"),r=require("./schemas-BxqeixM7.js"),l=new i.Command;l.argument("<input>","The input file to read from.").option("-o, --output <output>","The output file to write to.").action(async(n,t)=>{const u=await o.readFile(n,"utf-8"),a=JSON.parse(u),e=r.TaskResultArraySchema.safeParse(a);if(e.success){const c=e.data,s=r.createJobs(c);t.output?await o.writeFile(t.output,JSON.stringify(s,null,2)):console.log(s)}else console.error(e.error),process.exit(1)}).parseAsync();
|
package/dist/create-jobs.d.ts
CHANGED
|
@@ -2,8 +2,15 @@ import { Meta, TaskResultArray } from './schemas';
|
|
|
2
2
|
export type Job = {
|
|
3
3
|
task_name: string;
|
|
4
4
|
project_name: string;
|
|
5
|
-
output_files: string[];
|
|
6
5
|
project_dir: string;
|
|
6
|
+
artifacts: {
|
|
7
|
+
workspace: {
|
|
8
|
+
files: string[];
|
|
9
|
+
};
|
|
10
|
+
project: {
|
|
11
|
+
files: string[];
|
|
12
|
+
};
|
|
13
|
+
};
|
|
7
14
|
meta: Meta;
|
|
8
15
|
};
|
|
9
16
|
export type Jobs = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-jobs.d.ts","sourceRoot":"","sources":["../src/create-jobs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-jobs.d.ts","sourceRoot":"","sources":["../src/create-jobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAc,eAAe,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,MAAM,GAAG,GAAG;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACP,SAAS,EAAE;YACP,KAAK,EAAE,MAAM,EAAE,CAAC;SACnB,CAAC;QACF,OAAO,EAAE;YACL,KAAK,EAAE,MAAM,EAAE,CAAC;SACnB,CAAC;KACL,CAAC;IACF,IAAI,EAAE,IAAI,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACf,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,GAAG,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,UAAU,EAAE,GAAG,EAAE,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,GAAG,EAAE,GAAG,EAAE,CAAC;IACX,WAAW,EAAE,GAAG,EAAE,CAAC;CACtB,CAAC;AAEF,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAuDzD"}
|
package/dist/create-jobs.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import s from "node:fs/promises";
|
|
3
3
|
import { Command as u } from "@commander-js/extra-typings";
|
|
4
|
-
import { T as c, c as l } from "./schemas-
|
|
4
|
+
import { T as c, c as l } from "./schemas-Bs89CfAz.mjs";
|
|
5
5
|
const p = new u();
|
|
6
6
|
p.argument("<input>", "The input file to read from.").option("-o, --output <output>", "The output file to write to.").action(async (r, e) => {
|
|
7
7
|
const a = await s.readFile(r, "utf-8"), n = JSON.parse(a), t = c.safeParse(n);
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./schemas-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./schemas-BxqeixM7.js");exports.TaskResultArraySchema=e.TaskResultArraySchema;exports.TaskResultSchema=e.TaskResultSchema;exports.createJobs=e.createJobs;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import n from "node:path";
|
|
2
2
|
import { z as e } from "zod";
|
|
3
|
-
function T(
|
|
4
|
-
const
|
|
3
|
+
function T(s) {
|
|
4
|
+
const a = {
|
|
5
5
|
test: {
|
|
6
6
|
rust: [],
|
|
7
7
|
typescript: []
|
|
@@ -15,40 +15,57 @@ function T(a) {
|
|
|
15
15
|
rust_github: []
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
for (const t of
|
|
18
|
+
for (const t of s) {
|
|
19
19
|
if (t.status === "skipped")
|
|
20
20
|
continue;
|
|
21
21
|
const r = t.task;
|
|
22
|
-
r.task_name === "test" && (t.details.meta?.language === "rust" &&
|
|
22
|
+
r.task_name === "test" && (t.details.meta?.language === "rust" && a.test.rust.push(i(t)), t.details.meta?.language === "typescript" && a.test.typescript.push(i(t))), r.task_name === "build" && (t.details.meta?.language === "rust" && a.build.rust.push(i(t)), t.details.meta?.language === "typescript" && a.build.typescript.push(i(t))), r.task_name === "publish" && t.details.meta?.release?.npm && a.publish.npm.push(i(t)), t.details.meta?.release?.github && t.details.meta?.language === "rust" && a.publish.rust_github.push(i(t));
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return a;
|
|
25
25
|
}
|
|
26
|
-
function i(
|
|
26
|
+
function i(s) {
|
|
27
|
+
const a = [], t = [];
|
|
28
|
+
if (s.details.output_files && s.details.output_files.length > 0)
|
|
29
|
+
for (const r of s.details.output_files) {
|
|
30
|
+
const o = n.resolve(s.task.project_dir, r);
|
|
31
|
+
p(s.task.project_dir, o) ? t.push(o) : a.push(o);
|
|
32
|
+
}
|
|
27
33
|
return {
|
|
28
|
-
task_name:
|
|
29
|
-
project_name:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
task_name: s.task.task_name,
|
|
35
|
+
project_name: s.task.project_name,
|
|
36
|
+
artifacts: {
|
|
37
|
+
project: {
|
|
38
|
+
files: t
|
|
39
|
+
},
|
|
40
|
+
workspace: {
|
|
41
|
+
files: a
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
project_dir: s.task.project_dir,
|
|
45
|
+
meta: s.details.meta ?? {}
|
|
33
46
|
};
|
|
34
47
|
}
|
|
35
|
-
|
|
48
|
+
function p(s, a) {
|
|
49
|
+
const t = n.relative(s, a);
|
|
50
|
+
return t && !t.startsWith("..") && !n.isAbsolute(t);
|
|
51
|
+
}
|
|
52
|
+
const d = e.object({
|
|
36
53
|
secs: e.number().int().nonnegative().describe("The number of whole seconds elapsed."),
|
|
37
54
|
nanos: e.number().int().nonnegative().describe("The number of nanoseconds elapsed.")
|
|
38
|
-
}),
|
|
55
|
+
}), h = e.object({
|
|
39
56
|
runner: e.string().describe("The runner to use for the target.")
|
|
40
|
-
}),
|
|
57
|
+
}), u = e.object({
|
|
41
58
|
npm: e.boolean().optional().describe("Whether to publish to npm."),
|
|
42
59
|
github: e.boolean().optional().describe("Whether to publish to github.")
|
|
43
|
-
}),
|
|
60
|
+
}), b = e.object({
|
|
44
61
|
type: e.string().optional().describe("The type of project (e.g., library, service, application)."),
|
|
45
62
|
language: e.string().optional().describe("The primary language of the project."),
|
|
46
|
-
targets: e.record(e.string(),
|
|
47
|
-
release:
|
|
48
|
-
}),
|
|
49
|
-
meta:
|
|
63
|
+
targets: e.record(e.string(), h).optional().describe("The targets to build."),
|
|
64
|
+
release: u.optional()
|
|
65
|
+
}), c = e.object({
|
|
66
|
+
meta: b.optional(),
|
|
50
67
|
output_files: e.array(e.string()).optional().describe("The output files generated.")
|
|
51
|
-
}),
|
|
68
|
+
}), l = e.object({
|
|
52
69
|
task_name: e.string().describe("The short name of the task (e.g., 'test', 'build')."),
|
|
53
70
|
task_command: e.string().describe("The command executed for the task."),
|
|
54
71
|
project_name: e.string().describe("The name of the project."),
|
|
@@ -60,37 +77,37 @@ const l = e.object({
|
|
|
60
77
|
),
|
|
61
78
|
interactive: e.boolean().describe("Whether the task is interactive."),
|
|
62
79
|
persistent: e.boolean().describe("Whether the task is persistent.")
|
|
63
|
-
}),
|
|
80
|
+
}), m = e.object({
|
|
64
81
|
status: e.literal("completed"),
|
|
65
82
|
hash: e.string().describe(
|
|
66
83
|
"The task's content hash (Base64 encoded string). Used for caching."
|
|
67
84
|
),
|
|
68
|
-
task:
|
|
85
|
+
task: l,
|
|
69
86
|
exit_code: e.number().int().describe(
|
|
70
87
|
"The exit code of the executed command (typically 0 for success)."
|
|
71
88
|
),
|
|
72
|
-
elapsed:
|
|
89
|
+
elapsed: d.describe("The duration the task took to execute."),
|
|
73
90
|
cache_hit: e.boolean().describe("Indicates if the result was pulled from cache."),
|
|
74
|
-
details:
|
|
75
|
-
}),
|
|
91
|
+
details: c
|
|
92
|
+
}), f = e.object({
|
|
76
93
|
status: e.literal("errored"),
|
|
77
|
-
task:
|
|
94
|
+
task: l,
|
|
78
95
|
error: e.string().describe("The error message."),
|
|
79
|
-
details:
|
|
80
|
-
}),
|
|
96
|
+
details: c
|
|
97
|
+
}), g = e.object({
|
|
81
98
|
status: e.literal("skipped"),
|
|
82
|
-
task:
|
|
99
|
+
task: l,
|
|
83
100
|
skip_reason: e.string().describe("The reason the task was skipped (e.g., 'disabled')."),
|
|
84
|
-
details:
|
|
85
|
-
}),
|
|
86
|
-
u,
|
|
101
|
+
details: c
|
|
102
|
+
}), k = e.discriminatedUnion("status", [
|
|
87
103
|
m,
|
|
88
|
-
|
|
104
|
+
g,
|
|
105
|
+
f
|
|
89
106
|
]).describe(
|
|
90
107
|
"Schema for a single task execution result (completed or skipped)."
|
|
91
|
-
),
|
|
108
|
+
), y = e.array(k).describe("An array of task execution results.");
|
|
92
109
|
export {
|
|
93
|
-
|
|
94
|
-
|
|
110
|
+
y as T,
|
|
111
|
+
k as a,
|
|
95
112
|
T as c
|
|
96
113
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("node:path"),e=require("zod");function p(s){const a={test:{rust:[],typescript:[]},build:{rust:[],typescript:[]},publish:{npm:[],rust_github:[]}};for(const t of s){if(t.status==="skipped")continue;const r=t.task;r.task_name==="test"&&(t.details.meta?.language==="rust"&&a.test.rust.push(i(t)),t.details.meta?.language==="typescript"&&a.test.typescript.push(i(t))),r.task_name==="build"&&(t.details.meta?.language==="rust"&&a.build.rust.push(i(t)),t.details.meta?.language==="typescript"&&a.build.typescript.push(i(t))),r.task_name==="publish"&&t.details.meta?.release?.npm&&a.publish.npm.push(i(t)),t.details.meta?.release?.github&&t.details.meta?.language==="rust"&&a.publish.rust_github.push(i(t))}return a}function i(s){const a=[],t=[];if(s.details.output_files&&s.details.output_files.length>0)for(const r of s.details.output_files){const o=n.resolve(s.task.project_dir,r);u(s.task.project_dir,o)?t.push(o):a.push(o)}return{task_name:s.task.task_name,project_name:s.task.project_name,artifacts:{project:{files:t},workspace:{files:a}},project_dir:s.task.project_dir,meta:s.details.meta??{}}}function u(s,a){const t=n.relative(s,a);return t&&!t.startsWith("..")&&!n.isAbsolute(t)}const h=e.z.object({secs:e.z.number().int().nonnegative().describe("The number of whole seconds elapsed."),nanos:e.z.number().int().nonnegative().describe("The number of nanoseconds elapsed.")}),b=e.z.object({runner:e.z.string().describe("The runner to use for the target.")}),m=e.z.object({npm:e.z.boolean().optional().describe("Whether to publish to npm."),github:e.z.boolean().optional().describe("Whether to publish to github.")}),g=e.z.object({type:e.z.string().optional().describe("The type of project (e.g., library, service, application)."),language:e.z.string().optional().describe("The primary language of the project."),targets:e.z.record(e.z.string(),b).optional().describe("The targets to build."),release:m.optional()}),c=e.z.object({meta:g.optional(),output_files:e.z.array(e.z.string()).optional().describe("The output files generated.")}),l=e.z.object({task_name:e.z.string().describe("The short name of the task (e.g., 'test', 'build')."),task_command:e.z.string().describe("The command executed for the task."),project_name:e.z.string().describe("The name of the project."),project_dir:e.z.string().describe("The absolute directory path of the project."),full_task_name:e.z.string().describe("The fully qualified task name (e.g., 'omni_utils#test')."),dependencies:e.z.array(e.z.string()).describe("A list of dependent task names."),enabled:e.z.boolean().or(e.z.string()).optional().describe("Whether the task is enabled by configuration. Either a boolean or a tera template string that evaluates to a boolean."),interactive:e.z.boolean().describe("Whether the task is interactive."),persistent:e.z.boolean().describe("Whether the task is persistent.")}),f=e.z.object({status:e.z.literal("completed"),hash:e.z.string().describe("The task's content hash (Base64 encoded string). Used for caching."),task:l,exit_code:e.z.number().int().describe("The exit code of the executed command (typically 0 for success)."),elapsed:h.describe("The duration the task took to execute."),cache_hit:e.z.boolean().describe("Indicates if the result was pulled from cache."),details:c}),k=e.z.object({status:e.z.literal("errored"),task:l,error:e.z.string().describe("The error message."),details:c}),z=e.z.object({status:e.z.literal("skipped"),task:l,skip_reason:e.z.string().describe("The reason the task was skipped (e.g., 'disabled')."),details:c}),d=e.z.discriminatedUnion("status",[f,z,k]).describe("Schema for a single task execution result (completed or skipped)."),_=e.z.array(d).describe("An array of task execution results.");exports.TaskResultArraySchema=_;exports.TaskResultSchema=d;exports.createJobs=p;
|
package/package.json
CHANGED
package/src/create-jobs.spec.ts
CHANGED
|
@@ -58,7 +58,11 @@ describe("createJobs", () => {
|
|
|
58
58
|
expect(jobs.test.rust[0]).toMatchObject({
|
|
59
59
|
project_name: "rust-app",
|
|
60
60
|
task_name: "test",
|
|
61
|
-
|
|
61
|
+
artifacts: {
|
|
62
|
+
project: {
|
|
63
|
+
files: ["/mnt/c/Users/user/project/binary"],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
62
66
|
});
|
|
63
67
|
expect(jobs.build.typescript[0]?.project_name).toBe("ts-lib");
|
|
64
68
|
expect(jobs.test.typescript).toHaveLength(0);
|
|
@@ -142,7 +146,40 @@ describe("createJobs", () => {
|
|
|
142
146
|
expect(jobs.test.rust[0]).toMatchObject({
|
|
143
147
|
project_name: "minimal",
|
|
144
148
|
task_name: "test",
|
|
145
|
-
|
|
149
|
+
artifacts: {
|
|
150
|
+
project: {
|
|
151
|
+
files: ["/mnt/c/Users/user/project/target/debug/minimal"],
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("should assign output files not in the project directory to the workspace artifacts", () => {
|
|
158
|
+
const results: any[] = [
|
|
159
|
+
{
|
|
160
|
+
status: "success",
|
|
161
|
+
task: {
|
|
162
|
+
task_name: "test",
|
|
163
|
+
project_name: "minimal",
|
|
164
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
165
|
+
},
|
|
166
|
+
details: {
|
|
167
|
+
meta: { language: "rust" },
|
|
168
|
+
output_files: ["/mnt/c/Users/user/target/debug/minimal"],
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
];
|
|
172
|
+
|
|
173
|
+
const jobs = createJobs(results);
|
|
174
|
+
|
|
175
|
+
expect(jobs.test.rust[0]).toMatchObject({
|
|
176
|
+
project_name: "minimal",
|
|
177
|
+
task_name: "test",
|
|
178
|
+
artifacts: {
|
|
179
|
+
workspace: {
|
|
180
|
+
files: ["/mnt/c/Users/user/target/debug/minimal"],
|
|
181
|
+
},
|
|
182
|
+
},
|
|
146
183
|
});
|
|
147
184
|
});
|
|
148
185
|
});
|
package/src/create-jobs.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import path from "node:path";
|
|
1
2
|
import type { Meta, TaskResult, TaskResultArray } from "./schemas";
|
|
2
|
-
import path from "node:path"
|
|
3
3
|
|
|
4
4
|
export type Job = {
|
|
5
5
|
task_name: string;
|
|
6
6
|
project_name: string;
|
|
7
|
-
output_files: string[];
|
|
8
7
|
project_dir: string;
|
|
8
|
+
artifacts: {
|
|
9
|
+
workspace: {
|
|
10
|
+
files: string[];
|
|
11
|
+
};
|
|
12
|
+
project: {
|
|
13
|
+
files: string[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
9
16
|
meta: Meta;
|
|
10
17
|
};
|
|
11
18
|
|
|
@@ -88,11 +95,47 @@ export function createJobs(results: TaskResultArray): Jobs {
|
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
function jobFromResult(result: TaskResult): Job {
|
|
98
|
+
const workspaceArtifacts = [] as string[];
|
|
99
|
+
const projectArtifacts = [] as string[];
|
|
100
|
+
|
|
101
|
+
if (result.details.output_files && result.details.output_files.length > 0) {
|
|
102
|
+
for (const file of result.details.output_files) {
|
|
103
|
+
const fullPath = path.resolve(result.task.project_dir, file);
|
|
104
|
+
|
|
105
|
+
if (isPathInside(result.task.project_dir, fullPath)) {
|
|
106
|
+
projectArtifacts.push(fullPath);
|
|
107
|
+
} else {
|
|
108
|
+
workspaceArtifacts.push(fullPath);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
91
113
|
return {
|
|
92
114
|
task_name: result.task.task_name,
|
|
93
115
|
project_name: result.task.project_name,
|
|
94
|
-
|
|
116
|
+
artifacts: {
|
|
117
|
+
project: {
|
|
118
|
+
files: projectArtifacts,
|
|
119
|
+
},
|
|
120
|
+
workspace: {
|
|
121
|
+
files: workspaceArtifacts,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
95
124
|
project_dir: result.task.project_dir,
|
|
96
125
|
meta: result.details.meta ?? {},
|
|
97
126
|
};
|
|
98
127
|
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Checks if 'child' is physically inside 'parent'
|
|
131
|
+
* @param {string} parent - The potential parent directory
|
|
132
|
+
* @param {string} child - The path to check
|
|
133
|
+
*/
|
|
134
|
+
function isPathInside(parent: string, child: string) {
|
|
135
|
+
const relative = path.relative(parent, child);
|
|
136
|
+
|
|
137
|
+
// path.relative returns an empty string if paths are the same.
|
|
138
|
+
// If the path starts with '..' (or the platform equivalent),
|
|
139
|
+
// it means the child is outside the parent.
|
|
140
|
+
return relative && !relative.startsWith("..") && !path.isAbsolute(relative);
|
|
141
|
+
}
|
package/dist/schemas-B3fc8OPo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("node:path"),e=require("zod");function d(a){const s={test:{rust:[],typescript:[]},build:{rust:[],typescript:[]},publish:{npm:[],rust_github:[]}};for(const t of a){if(t.status==="skipped")continue;const r=t.task;r.task_name==="test"&&(t.details.meta?.language==="rust"&&s.test.rust.push(i(t)),t.details.meta?.language==="typescript"&&s.test.typescript.push(i(t))),r.task_name==="build"&&(t.details.meta?.language==="rust"&&s.build.rust.push(i(t)),t.details.meta?.language==="typescript"&&s.build.typescript.push(i(t))),r.task_name==="publish"&&t.details.meta?.release?.npm&&s.publish.npm.push(i(t)),t.details.meta?.release?.github&&t.details.meta?.language==="rust"&&s.publish.rust_github.push(i(t))}return s}function i(a){return{task_name:a.task.task_name,project_name:a.task.project_name,output_files:a.details.output_files?.map(s=>l.resolve(a.task.project_dir,s))??[],project_dir:a.task.project_dir,meta:a.details.meta??{}}}const u=e.z.object({secs:e.z.number().int().nonnegative().describe("The number of whole seconds elapsed."),nanos:e.z.number().int().nonnegative().describe("The number of nanoseconds elapsed.")}),p=e.z.object({runner:e.z.string().describe("The runner to use for the target.")}),h=e.z.object({npm:e.z.boolean().optional().describe("Whether to publish to npm."),github:e.z.boolean().optional().describe("Whether to publish to github.")}),b=e.z.object({type:e.z.string().optional().describe("The type of project (e.g., library, service, application)."),language:e.z.string().optional().describe("The primary language of the project."),targets:e.z.record(e.z.string(),p).optional().describe("The targets to build."),release:h.optional()}),o=e.z.object({meta:b.optional(),output_files:e.z.array(e.z.string()).optional().describe("The output files generated.")}),n=e.z.object({task_name:e.z.string().describe("The short name of the task (e.g., 'test', 'build')."),task_command:e.z.string().describe("The command executed for the task."),project_name:e.z.string().describe("The name of the project."),project_dir:e.z.string().describe("The absolute directory path of the project."),full_task_name:e.z.string().describe("The fully qualified task name (e.g., 'omni_utils#test')."),dependencies:e.z.array(e.z.string()).describe("A list of dependent task names."),enabled:e.z.boolean().or(e.z.string()).optional().describe("Whether the task is enabled by configuration. Either a boolean or a tera template string that evaluates to a boolean."),interactive:e.z.boolean().describe("Whether the task is interactive."),persistent:e.z.boolean().describe("Whether the task is persistent.")}),m=e.z.object({status:e.z.literal("completed"),hash:e.z.string().describe("The task's content hash (Base64 encoded string). Used for caching."),task:n,exit_code:e.z.number().int().describe("The exit code of the executed command (typically 0 for success)."),elapsed:u.describe("The duration the task took to execute."),cache_hit:e.z.boolean().describe("Indicates if the result was pulled from cache."),details:o}),g=e.z.object({status:e.z.literal("errored"),task:n,error:e.z.string().describe("The error message."),details:o}),k=e.z.object({status:e.z.literal("skipped"),task:n,skip_reason:e.z.string().describe("The reason the task was skipped (e.g., 'disabled')."),details:o}),c=e.z.discriminatedUnion("status",[m,k,g]).describe("Schema for a single task execution result (completed or skipped)."),z=e.z.array(c).describe("An array of task execution results.");exports.TaskResultArraySchema=z;exports.TaskResultSchema=c;exports.createJobs=d;
|