-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmodule.ts
More file actions
47 lines (41 loc) · 1.33 KB
/
Copy pathmodule.ts
File metadata and controls
47 lines (41 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2023-present Eser Ozvataf and other contributors. All rights reserved. Apache-2.0 license.
/**
* Workflows module definition for @eserstack/shell integration.
*
* Tool injection is the caller's responsibility — pass tools via
* createModuleDef() or let the CLI layer compose them.
*
* @module
*/
import { Module } from "@eserstack/shell/module";
import type * as types from "./types.ts";
export const createModuleDef = (
tools?: readonly types.WorkflowTool[],
): Module =>
new Module({
description: "Workflow engine — run tool pipelines",
modules: {
run: {
description: "Run workflows by event or id",
load: async () => {
const workflowsRun = await import("./run.ts");
return {
main: (args?: readonly string[]) =>
workflowsRun.main(args, { tools: tools ?? [] }),
};
},
},
list: {
description: "List available workflows and tools",
load: async () => {
const workflowsList = await import("./list.ts");
return {
main: (args?: readonly string[]) =>
workflowsList.main(args, { tools: tools ?? [] }),
};
},
},
},
});
// Default module with no pre-injected tools (standalone use)
export const moduleDef: Module = createModuleDef();