@omni-oss/create-jobs 0.1.0 → 0.1.2
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 +15 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/create-jobs.cjs +2 -1
- package/dist/{utils.d.ts → create-jobs.d.ts} +2 -1
- package/dist/create-jobs.d.ts.map +1 -0
- package/dist/create-jobs.mjs +6 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/schemas-B3fc8OPo.js +1 -0
- package/dist/{utils-CSiXyoWV.mjs → schemas-BKjl6CL-.mjs} +52 -52
- package/dist/schemas.d.ts +0 -18
- package/dist/schemas.d.ts.map +1 -1
- package/package.json +2 -2
- package/project.omni.yaml +1 -1
- package/src/cli/index.ts +1 -0
- package/src/create-jobs.spec.ts +148 -0
- package/src/{utils.ts → create-jobs.ts} +4 -1
- package/src/index.ts +1 -1
- package/src/schemas.ts +0 -8
- package/dist/utils-DeP5M93O.js +0 -1
- package/dist/utils.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
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.2 - 2026-02-08
|
|
6
|
+
#### Bug Fixes
|
|
7
|
+
- (**@omni-oss/create-jobs**) remove unused properties - (c5f5d01) - Clarence Manuel
|
|
8
|
+
#### Miscellaneous Chores
|
|
9
|
+
- (**@omni-oss/create-jobs**) add unit tests - (0d2e86e) - Clarence Manuel
|
|
10
|
+
- bump node version [skip ci] - (04067be) - Clarence Manuel
|
|
11
|
+
|
|
12
|
+
- - -
|
|
13
|
+
|
|
14
|
+
## @omni-oss/create-jobs-v0.1.1 - 2026-02-08
|
|
15
|
+
#### Bug Fixes
|
|
16
|
+
- (**@omni-oss/set-version**) add shebang - (f972dec) - Clarence Manuel
|
|
17
|
+
|
|
18
|
+
- - -
|
|
19
|
+
|
|
5
20
|
## @omni-oss/create-jobs-v0.1.0 - 2026-02-07
|
|
6
21
|
#### Features
|
|
7
22
|
- (**@omni-oss/create-jobs**) implement create-jobs script - (81cc8cf) - Clarence Manuel
|
package/dist/cli/index.d.ts
CHANGED
package/dist/create-jobs.cjs
CHANGED
|
@@ -1 +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-B3fc8OPo.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();
|
|
@@ -3,6 +3,7 @@ export type Job = {
|
|
|
3
3
|
task_name: string;
|
|
4
4
|
project_name: string;
|
|
5
5
|
output_files: string[];
|
|
6
|
+
project_dir: string;
|
|
6
7
|
meta: Meta;
|
|
7
8
|
};
|
|
8
9
|
export type Jobs = {
|
|
@@ -23,4 +24,4 @@ export type PublishJobs = {
|
|
|
23
24
|
rust_github: Job[];
|
|
24
25
|
};
|
|
25
26
|
export declare function createJobs(results: TaskResultArray): Jobs;
|
|
26
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=create-jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-jobs.d.ts","sourceRoot":"","sources":["../src/create-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAc,eAAe,EAAE,MAAM,WAAW,CAAC;AAGnE,MAAM,MAAM,GAAG,GAAG;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,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,11 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
1
2
|
import s from "node:fs/promises";
|
|
2
|
-
import { Command as
|
|
3
|
-
import { T as
|
|
4
|
-
const p = new
|
|
3
|
+
import { Command as u } from "@commander-js/extra-typings";
|
|
4
|
+
import { T as c, c as l } from "./schemas-BKjl6CL-.mjs";
|
|
5
|
+
const p = new u();
|
|
5
6
|
p.argument("<input>", "The input file to read from.").option("-o, --output <output>", "The output file to write to.").action(async (r, e) => {
|
|
6
|
-
const a = await s.readFile(r, "utf-8"),
|
|
7
|
+
const a = await s.readFile(r, "utf-8"), n = JSON.parse(a), t = c.safeParse(n);
|
|
7
8
|
if (t.success) {
|
|
8
|
-
const
|
|
9
|
+
const i = t.data, o = l(i);
|
|
9
10
|
e.output ? await s.writeFile(
|
|
10
11
|
e.output,
|
|
11
12
|
JSON.stringify(o, null, 2)
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./schemas-B3fc8OPo.js");exports.TaskResultArraySchema=e.TaskResultArraySchema;exports.TaskResultSchema=e.TaskResultSchema;exports.createJobs=e.createJobs;
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -1,21 +1,52 @@
|
|
|
1
|
+
import c from "node:path";
|
|
1
2
|
import { z as e } from "zod";
|
|
2
|
-
|
|
3
|
+
function T(a) {
|
|
4
|
+
const s = {
|
|
5
|
+
test: {
|
|
6
|
+
rust: [],
|
|
7
|
+
typescript: []
|
|
8
|
+
},
|
|
9
|
+
build: {
|
|
10
|
+
rust: [],
|
|
11
|
+
typescript: []
|
|
12
|
+
},
|
|
13
|
+
publish: {
|
|
14
|
+
npm: [],
|
|
15
|
+
rust_github: []
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
for (const t of a) {
|
|
19
|
+
if (t.status === "skipped")
|
|
20
|
+
continue;
|
|
21
|
+
const r = t.task;
|
|
22
|
+
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));
|
|
23
|
+
}
|
|
24
|
+
return s;
|
|
25
|
+
}
|
|
26
|
+
function i(a) {
|
|
27
|
+
return {
|
|
28
|
+
task_name: a.task.task_name,
|
|
29
|
+
project_name: a.task.project_name,
|
|
30
|
+
output_files: a.details.output_files?.map((s) => c.resolve(a.task.project_dir, s)) ?? [],
|
|
31
|
+
project_dir: a.task.project_dir,
|
|
32
|
+
meta: a.details.meta ?? {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const l = e.object({
|
|
3
36
|
secs: e.number().int().nonnegative().describe("The number of whole seconds elapsed."),
|
|
4
37
|
nanos: e.number().int().nonnegative().describe("The number of nanoseconds elapsed.")
|
|
5
|
-
}), l = e.object({
|
|
6
|
-
runner: e.string().describe("The runner to use for the target."),
|
|
7
|
-
build_flags: e.string().optional().describe("The build flags to use for the target."),
|
|
8
|
-
test_flags: e.string().optional().describe("The test flags to use for the target.")
|
|
9
38
|
}), d = e.object({
|
|
39
|
+
runner: e.string().describe("The runner to use for the target.")
|
|
40
|
+
}), p = e.object({
|
|
10
41
|
npm: e.boolean().optional().describe("Whether to publish to npm."),
|
|
11
42
|
github: e.boolean().optional().describe("Whether to publish to github.")
|
|
12
|
-
}),
|
|
43
|
+
}), h = e.object({
|
|
13
44
|
type: e.string().optional().describe("The type of project (e.g., library, service, application)."),
|
|
14
45
|
language: e.string().optional().describe("The primary language of the project."),
|
|
15
|
-
targets: e.record(e.string(),
|
|
16
|
-
release:
|
|
46
|
+
targets: e.record(e.string(), d).optional().describe("The targets to build."),
|
|
47
|
+
release: p.optional()
|
|
17
48
|
}), o = e.object({
|
|
18
|
-
meta:
|
|
49
|
+
meta: h.optional(),
|
|
19
50
|
output_files: e.array(e.string()).optional().describe("The output files generated.")
|
|
20
51
|
}), n = e.object({
|
|
21
52
|
task_name: e.string().describe("The short name of the task (e.g., 'test', 'build')."),
|
|
@@ -29,7 +60,7 @@ const c = e.object({
|
|
|
29
60
|
),
|
|
30
61
|
interactive: e.boolean().describe("Whether the task is interactive."),
|
|
31
62
|
persistent: e.boolean().describe("Whether the task is persistent.")
|
|
32
|
-
}),
|
|
63
|
+
}), u = e.object({
|
|
33
64
|
status: e.literal("completed"),
|
|
34
65
|
hash: e.string().describe(
|
|
35
66
|
"The task's content hash (Base64 encoded string). Used for caching."
|
|
@@ -38,59 +69,28 @@ const c = e.object({
|
|
|
38
69
|
exit_code: e.number().int().describe(
|
|
39
70
|
"The exit code of the executed command (typically 0 for success)."
|
|
40
71
|
),
|
|
41
|
-
elapsed:
|
|
72
|
+
elapsed: l.describe("The duration the task took to execute."),
|
|
42
73
|
cache_hit: e.boolean().describe("Indicates if the result was pulled from cache."),
|
|
43
74
|
details: o
|
|
44
|
-
}),
|
|
75
|
+
}), b = e.object({
|
|
45
76
|
status: e.literal("errored"),
|
|
46
77
|
task: n,
|
|
47
78
|
error: e.string().describe("The error message."),
|
|
48
79
|
details: o
|
|
49
|
-
}),
|
|
80
|
+
}), m = e.object({
|
|
50
81
|
status: e.literal("skipped"),
|
|
51
82
|
task: n,
|
|
52
83
|
skip_reason: e.string().describe("The reason the task was skipped (e.g., 'disabled')."),
|
|
53
84
|
details: o
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
85
|
+
}), g = e.discriminatedUnion("status", [
|
|
86
|
+
u,
|
|
87
|
+
m,
|
|
88
|
+
b
|
|
58
89
|
]).describe(
|
|
59
90
|
"Schema for a single task execution result (completed or skipped)."
|
|
60
|
-
),
|
|
61
|
-
function k(a) {
|
|
62
|
-
const s = {
|
|
63
|
-
test: {
|
|
64
|
-
rust: [],
|
|
65
|
-
typescript: []
|
|
66
|
-
},
|
|
67
|
-
build: {
|
|
68
|
-
rust: [],
|
|
69
|
-
typescript: []
|
|
70
|
-
},
|
|
71
|
-
publish: {
|
|
72
|
-
npm: [],
|
|
73
|
-
rust_github: []
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
for (const t of a) {
|
|
77
|
-
if (t.status === "skipped")
|
|
78
|
-
continue;
|
|
79
|
-
const r = t.task;
|
|
80
|
-
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));
|
|
81
|
-
}
|
|
82
|
-
return s;
|
|
83
|
-
}
|
|
84
|
-
function i(a) {
|
|
85
|
-
return {
|
|
86
|
-
task_name: a.task.task_name,
|
|
87
|
-
project_name: a.task.project_name,
|
|
88
|
-
output_files: a.details.output_files ?? [],
|
|
89
|
-
meta: a.details.meta ?? {}
|
|
90
|
-
};
|
|
91
|
-
}
|
|
91
|
+
), _ = e.array(g).describe("An array of task execution results.");
|
|
92
92
|
export {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
_ as T,
|
|
94
|
+
g as a,
|
|
95
|
+
T as c
|
|
96
96
|
};
|
package/dist/schemas.d.ts
CHANGED
|
@@ -14,8 +14,6 @@ declare const MetaSchema: z.ZodObject<{
|
|
|
14
14
|
language: z.ZodOptional<z.ZodString>;
|
|
15
15
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
16
16
|
runner: z.ZodString;
|
|
17
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
18
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
19
17
|
}, z.core.$strip>>>;
|
|
20
18
|
release: z.ZodOptional<z.ZodObject<{
|
|
21
19
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -66,8 +64,6 @@ declare const CompletedTaskSchema: z.ZodObject<{
|
|
|
66
64
|
language: z.ZodOptional<z.ZodString>;
|
|
67
65
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
68
66
|
runner: z.ZodString;
|
|
69
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
70
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
71
67
|
}, z.core.$strip>>>;
|
|
72
68
|
release: z.ZodOptional<z.ZodObject<{
|
|
73
69
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -101,8 +97,6 @@ declare const SkippedTaskSchema: z.ZodObject<{
|
|
|
101
97
|
language: z.ZodOptional<z.ZodString>;
|
|
102
98
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
103
99
|
runner: z.ZodString;
|
|
104
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
105
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
106
100
|
}, z.core.$strip>>>;
|
|
107
101
|
release: z.ZodOptional<z.ZodObject<{
|
|
108
102
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -142,8 +136,6 @@ export declare const TaskResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
142
136
|
language: z.ZodOptional<z.ZodString>;
|
|
143
137
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
144
138
|
runner: z.ZodString;
|
|
145
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
146
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
147
139
|
}, z.core.$strip>>>;
|
|
148
140
|
release: z.ZodOptional<z.ZodObject<{
|
|
149
141
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -172,8 +164,6 @@ export declare const TaskResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
172
164
|
language: z.ZodOptional<z.ZodString>;
|
|
173
165
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
174
166
|
runner: z.ZodString;
|
|
175
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
176
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
177
167
|
}, z.core.$strip>>>;
|
|
178
168
|
release: z.ZodOptional<z.ZodObject<{
|
|
179
169
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -202,8 +192,6 @@ export declare const TaskResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
202
192
|
language: z.ZodOptional<z.ZodString>;
|
|
203
193
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
204
194
|
runner: z.ZodString;
|
|
205
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
206
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
207
195
|
}, z.core.$strip>>>;
|
|
208
196
|
release: z.ZodOptional<z.ZodObject<{
|
|
209
197
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -242,8 +230,6 @@ export declare const TaskResultArraySchema: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
|
242
230
|
language: z.ZodOptional<z.ZodString>;
|
|
243
231
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
244
232
|
runner: z.ZodString;
|
|
245
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
246
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
247
233
|
}, z.core.$strip>>>;
|
|
248
234
|
release: z.ZodOptional<z.ZodObject<{
|
|
249
235
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -272,8 +258,6 @@ export declare const TaskResultArraySchema: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
|
272
258
|
language: z.ZodOptional<z.ZodString>;
|
|
273
259
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
274
260
|
runner: z.ZodString;
|
|
275
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
276
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
277
261
|
}, z.core.$strip>>>;
|
|
278
262
|
release: z.ZodOptional<z.ZodObject<{
|
|
279
263
|
npm: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -302,8 +286,6 @@ export declare const TaskResultArraySchema: z.ZodArray<z.ZodDiscriminatedUnion<[
|
|
|
302
286
|
language: z.ZodOptional<z.ZodString>;
|
|
303
287
|
targets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
304
288
|
runner: z.ZodString;
|
|
305
|
-
build_flags: z.ZodOptional<z.ZodString>;
|
|
306
|
-
test_flags: z.ZodOptional<z.ZodString>;
|
|
307
289
|
}, z.core.$strip>>>;
|
|
308
290
|
release: z.ZodOptional<z.ZodObject<{
|
|
309
291
|
npm: z.ZodOptional<z.ZodBoolean>;
|
package/dist/schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,QAAA,MAAM,aAAa;;;iBAWjB,CAAC;
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;GAEG;AACH,QAAA,MAAM,aAAa;;;iBAWjB,CAAC;AAWH;;GAEG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;iBAcd,CAAC;AAUH;;GAEG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;iBAwBd,CAAC;AAIH;;;GAGG;AACH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBvB,CAAC;AASH;;;GAGG;AACH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOrB,CAAC;AAIH;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAQxB,CAAC;AAEN;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAEkB,CAAC;AAIrD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omni-oss/create-jobs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"bin": "./dist/create-jobs.mjs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@omni-oss/vite-config": "^0.1.0",
|
|
29
29
|
"@omni-oss/vitest-config": "^0.0.0",
|
|
30
30
|
"typescript": "^5.9.3",
|
|
31
|
-
"@types/node": "25.2.
|
|
31
|
+
"@types/node": "25.2.2",
|
|
32
32
|
"@types/bun": "^1.3.8"
|
|
33
33
|
}
|
|
34
34
|
}
|
package/project.omni.yaml
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/** biome-ignore-all lint/suspicious/noExplicitAny: test file */
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { createJobs } from "./create-jobs"; // Update with actual path
|
|
4
|
+
|
|
5
|
+
describe("createJobs", () => {
|
|
6
|
+
it("should return an empty structure when given an empty array", () => {
|
|
7
|
+
const results: any[] = [];
|
|
8
|
+
const jobs = createJobs(results);
|
|
9
|
+
|
|
10
|
+
expect(jobs.test.rust).toHaveLength(0);
|
|
11
|
+
expect(jobs.build.typescript).toHaveLength(0);
|
|
12
|
+
expect(jobs.publish.npm).toHaveLength(0);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should skip tasks with status "skipped"', () => {
|
|
16
|
+
const results: any[] = [
|
|
17
|
+
{
|
|
18
|
+
status: "skipped",
|
|
19
|
+
task: {
|
|
20
|
+
task_name: "test",
|
|
21
|
+
project_name: "p1",
|
|
22
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
23
|
+
},
|
|
24
|
+
details: { meta: { language: "rust" } },
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const jobs = createJobs(results);
|
|
28
|
+
expect(jobs.test.rust).toHaveLength(0);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should categorize test and build tasks by language", () => {
|
|
32
|
+
const results: any[] = [
|
|
33
|
+
{
|
|
34
|
+
status: "success",
|
|
35
|
+
task: {
|
|
36
|
+
task_name: "test",
|
|
37
|
+
project_name: "rust-app",
|
|
38
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
39
|
+
},
|
|
40
|
+
details: {
|
|
41
|
+
meta: { language: "rust" },
|
|
42
|
+
output_files: ["binary"],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
status: "success",
|
|
47
|
+
task: {
|
|
48
|
+
task_name: "build",
|
|
49
|
+
project_name: "ts-lib",
|
|
50
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
51
|
+
},
|
|
52
|
+
details: { meta: { language: "typescript" } },
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const jobs = createJobs(results);
|
|
57
|
+
|
|
58
|
+
expect(jobs.test.rust[0]).toMatchObject({
|
|
59
|
+
project_name: "rust-app",
|
|
60
|
+
task_name: "test",
|
|
61
|
+
output_files: ["/mnt/c/Users/user/project/binary"],
|
|
62
|
+
});
|
|
63
|
+
expect(jobs.build.typescript[0]?.project_name).toBe("ts-lib");
|
|
64
|
+
expect(jobs.test.typescript).toHaveLength(0);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should handle publish tasks correctly (npm vs rust_github)", () => {
|
|
68
|
+
const results: any[] = [
|
|
69
|
+
{
|
|
70
|
+
status: "success",
|
|
71
|
+
task: {
|
|
72
|
+
task_name: "publish",
|
|
73
|
+
project_name: "js-pkg",
|
|
74
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
75
|
+
},
|
|
76
|
+
details: { meta: { release: { npm: true } } },
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
status: "success",
|
|
80
|
+
task: {
|
|
81
|
+
task_name: "any-task",
|
|
82
|
+
project_name: "rust-pkg",
|
|
83
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
84
|
+
},
|
|
85
|
+
details: {
|
|
86
|
+
meta: {
|
|
87
|
+
language: "rust",
|
|
88
|
+
release: { github: true },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
const jobs = createJobs(results);
|
|
95
|
+
|
|
96
|
+
// Checks NPM logic: task_name must be "publish" AND meta.release.npm must be true
|
|
97
|
+
expect(jobs.publish.npm).toHaveLength(1);
|
|
98
|
+
expect(jobs.publish.npm[0]?.project_name).toBe("js-pkg");
|
|
99
|
+
|
|
100
|
+
// Checks GitHub logic: meta.release.github must be true AND language must be "rust"
|
|
101
|
+
// Note: your code doesn't strictly check if task_name === "publish" for rust_github!
|
|
102
|
+
expect(jobs.publish.rust_github).toHaveLength(1);
|
|
103
|
+
expect(jobs.publish.rust_github[0]?.project_name).toBe("rust-pkg");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("should provide default values for missing meta or output_files", () => {
|
|
107
|
+
const results: any[] = [
|
|
108
|
+
{
|
|
109
|
+
status: "success",
|
|
110
|
+
task: {
|
|
111
|
+
task_name: "test",
|
|
112
|
+
project_name: "minimal",
|
|
113
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
114
|
+
},
|
|
115
|
+
details: {}, // Missing meta and output_files
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
// This won't be added to test.rust because meta.language is missing
|
|
120
|
+
const jobs = createJobs(results);
|
|
121
|
+
expect(jobs.test.rust).toHaveLength(0);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it("should resolve the relative output files to the project directory", () => {
|
|
125
|
+
const results: any[] = [
|
|
126
|
+
{
|
|
127
|
+
status: "success",
|
|
128
|
+
task: {
|
|
129
|
+
task_name: "test",
|
|
130
|
+
project_name: "minimal",
|
|
131
|
+
project_dir: "/mnt/c/Users/user/project",
|
|
132
|
+
},
|
|
133
|
+
details: {
|
|
134
|
+
meta: { language: "rust" },
|
|
135
|
+
output_files: ["target/debug/minimal"],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
const jobs = createJobs(results);
|
|
141
|
+
|
|
142
|
+
expect(jobs.test.rust[0]).toMatchObject({
|
|
143
|
+
project_name: "minimal",
|
|
144
|
+
task_name: "test",
|
|
145
|
+
output_files: ["/mnt/c/Users/user/project/target/debug/minimal"],
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Meta, TaskResult, TaskResultArray } from "./schemas";
|
|
2
|
+
import path from "node:path"
|
|
2
3
|
|
|
3
4
|
export type Job = {
|
|
4
5
|
task_name: string;
|
|
5
6
|
project_name: string;
|
|
6
7
|
output_files: string[];
|
|
8
|
+
project_dir: string;
|
|
7
9
|
meta: Meta;
|
|
8
10
|
};
|
|
9
11
|
|
|
@@ -89,7 +91,8 @@ function jobFromResult(result: TaskResult): Job {
|
|
|
89
91
|
return {
|
|
90
92
|
task_name: result.task.task_name,
|
|
91
93
|
project_name: result.task.project_name,
|
|
92
|
-
output_files: result.details.output_files ?? [],
|
|
94
|
+
output_files: result.details.output_files?.map((file) => path.resolve(result.task.project_dir, file)) ?? [],
|
|
95
|
+
project_dir: result.task.project_dir,
|
|
93
96
|
meta: result.details.meta ?? {},
|
|
94
97
|
};
|
|
95
98
|
}
|
package/src/index.ts
CHANGED
package/src/schemas.ts
CHANGED
|
@@ -20,14 +20,6 @@ const ElapsedSchema = z.object({
|
|
|
20
20
|
|
|
21
21
|
const TargetSchema = z.object({
|
|
22
22
|
runner: z.string().describe("The runner to use for the target."),
|
|
23
|
-
build_flags: z
|
|
24
|
-
.string()
|
|
25
|
-
.optional()
|
|
26
|
-
.describe("The build flags to use for the target."),
|
|
27
|
-
test_flags: z
|
|
28
|
-
.string()
|
|
29
|
-
.optional()
|
|
30
|
-
.describe("The test flags to use for the target."),
|
|
31
23
|
});
|
|
32
24
|
|
|
33
25
|
const ReleaseSchema = z.object({
|
package/dist/utils-DeP5M93O.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("zod"),l=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.")}),d=e.z.object({runner:e.z.string().describe("The runner to use for the target."),build_flags:e.z.string().optional().describe("The build flags to use for the target."),test_flags:e.z.string().optional().describe("The test flags to use for the target.")}),u=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.")}),h=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(),d).optional().describe("The targets to build."),release:u.optional()}),o=e.z.object({meta:h.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.")}),p=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:l.describe("The duration the task took to execute."),cache_hit:e.z.boolean().describe("Indicates if the result was pulled from cache."),details:o}),b=e.z.object({status:e.z.literal("errored"),task:n,error:e.z.string().describe("The error message."),details:o}),m=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",[p,m,b]).describe("Schema for a single task execution result (completed or skipped)."),g=e.z.array(c).describe("An array of task execution results.");function f(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??[],meta:a.details.meta??{}}}exports.TaskResultArraySchema=g;exports.TaskResultSchema=c;exports.createJobs=f;
|
package/dist/utils.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,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,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,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"}
|