@trifoli/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/LICENSE +185 -0
- package/README.md +38 -0
- package/dist/argv.d.ts +14 -0
- package/dist/argv.d.ts.map +1 -0
- package/dist/argv.js +35 -0
- package/dist/argv.js.map +1 -0
- package/dist/commands/list.d.ts +15 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +60 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/mcp.d.ts +19 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +82 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/run.d.ts +17 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +92 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/validate.d.ts +14 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +58 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +23 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +62 -0
- package/dist/io.js.map +1 -0
- package/dist/schema-resolver.d.ts +23 -0
- package/dist/schema-resolver.d.ts.map +1 -0
- package/dist/schema-resolver.js +57 -0
- package/dist/schema-resolver.js.map +1 -0
- package/package.json +36 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2025 CleverCube AI (https://github.com/CleverCubeAi)
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
12
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
15
|
+
the copyright owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
18
|
+
other entities that control, are controlled by, or are under common
|
|
19
|
+
control with that entity. For the purposes of this definition,
|
|
20
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
21
|
+
direction or management of such entity, whether by contract or
|
|
22
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
23
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
24
|
+
|
|
25
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
26
|
+
exercising permissions granted by this License.
|
|
27
|
+
|
|
28
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
29
|
+
including but not limited to software source code, documentation
|
|
30
|
+
source, and configuration files.
|
|
31
|
+
|
|
32
|
+
"Object" form shall mean any form resulting from mechanical
|
|
33
|
+
transformation or translation of a Source form, including but
|
|
34
|
+
not limited to compiled object code, generated documentation,
|
|
35
|
+
and conversions to other media types.
|
|
36
|
+
|
|
37
|
+
"Work" shall mean the work of authorship made available under
|
|
38
|
+
the License, as indicated by a copyright notice that is included in
|
|
39
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
50
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
51
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
52
|
+
of this definition, "submitted" means any form of electronic, verbal,
|
|
53
|
+
or written communication sent to the Licensor or its representatives,
|
|
54
|
+
including but not limited to communication on electronic mailing lists,
|
|
55
|
+
source code control systems, and issue tracking systems that are managed
|
|
56
|
+
by, or on behalf of, the Licensor for the purpose of discussing and
|
|
57
|
+
improving the Work, but excluding communication that is conspicuously
|
|
58
|
+
marked or otherwise designated in writing by the copyright owner as
|
|
59
|
+
"Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
62
|
+
whom a Contribution has been received by the Licensor and subsequently
|
|
63
|
+
incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
69
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
70
|
+
Work and such Derivative Works in Source or Object form.
|
|
71
|
+
|
|
72
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
73
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
75
|
+
(except as stated in this section) patent license to make, have made,
|
|
76
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
77
|
+
where such license applies only to those patent claims licensable
|
|
78
|
+
by such Contributor that are necessarily infringed by their
|
|
79
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
80
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
81
|
+
institute patent litigation against any entity (including a cross-claim
|
|
82
|
+
or counterclaim in a lawsuit) alleging that the Work or a Contribution
|
|
83
|
+
incorporated within the Work constitutes patent or contributory patent
|
|
84
|
+
infringement, then any patent licenses granted to You under this License
|
|
85
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
86
|
+
|
|
87
|
+
4. Redistribution. You may reproduce and distribute copies of the Work
|
|
88
|
+
or Derivative Works thereof in any medium, with or without modifications,
|
|
89
|
+
and in Source or Object form, provided that You meet the following
|
|
90
|
+
conditions:
|
|
91
|
+
|
|
92
|
+
(a) You must give any other recipients of the Work or Derivative Works
|
|
93
|
+
a copy of this License; and
|
|
94
|
+
|
|
95
|
+
(b) You must cause any modified files to carry prominent notices stating
|
|
96
|
+
that You changed the files; and
|
|
97
|
+
|
|
98
|
+
(c) You must retain, in the Source form of any Derivative Works that
|
|
99
|
+
You distribute, all copyright, patent, trademark, and attribution
|
|
100
|
+
notices from the Source form of the Work, excluding those notices
|
|
101
|
+
that do not pertain to any part of the Derivative Works; and
|
|
102
|
+
|
|
103
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
104
|
+
distribution, You must include a readable copy of the attribution
|
|
105
|
+
notices contained within such NOTICE file, in at least one of the
|
|
106
|
+
following places: within a NOTICE text provided as part of the
|
|
107
|
+
Derivative Works; within the Source form or documentation, if
|
|
108
|
+
provided along with the Derivative Works; or, within a display
|
|
109
|
+
generated by the Derivative Works, if and wherever such third-party
|
|
110
|
+
notices normally appear. The contents of the NOTICE file are for
|
|
111
|
+
informational purposes only and do not modify the License. You may
|
|
112
|
+
add Your own attribution notices within Derivative Works that You
|
|
113
|
+
distribute, alongside or as an addendum to the NOTICE text from
|
|
114
|
+
the Work, provided that such additional attribution notices cannot
|
|
115
|
+
be construed as modifying the License.
|
|
116
|
+
|
|
117
|
+
You may add Your own license statement for Your modifications and may
|
|
118
|
+
provide additional grant of rights to use, copy, modify, merge,
|
|
119
|
+
publish, distribute, sublicense, and/or sell copies of Your
|
|
120
|
+
modifications, or for such combined works, as a whole, under terms
|
|
121
|
+
of Your choice, if You accept that You have not modified the Work's
|
|
122
|
+
legal terms and conditions for reproduction, distribution, and
|
|
123
|
+
modification of the Work.
|
|
124
|
+
|
|
125
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
126
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
127
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
128
|
+
this License, without any additional terms or conditions.
|
|
129
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
130
|
+
the terms of any separate license agreement you may have executed
|
|
131
|
+
with Licensor regarding such Contributions.
|
|
132
|
+
|
|
133
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
134
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
135
|
+
except as required for reasonable and customary use in describing the
|
|
136
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
137
|
+
|
|
138
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed
|
|
139
|
+
to in writing, Licensor provides the Work (and each Contributor
|
|
140
|
+
provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES
|
|
141
|
+
OR CONDITIONS OF ANY KIND, either express or implied, including,
|
|
142
|
+
without limitation, any warranties or conditions of TITLE,
|
|
143
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR
|
|
144
|
+
PURPOSE. You are solely responsible for determining the
|
|
145
|
+
appropriateness of using or reproducing the Work and assume any
|
|
146
|
+
risks associated with Your exercise of permissions under this License.
|
|
147
|
+
|
|
148
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
149
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
150
|
+
unless required by applicable law (such as deliberate and grossly
|
|
151
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
152
|
+
liable to You for damages, including any direct, indirect, special,
|
|
153
|
+
incidental, or exemplary damages of any character arising as a result
|
|
154
|
+
of this License or out of the use or inability to use the Work
|
|
155
|
+
(including but not limited to damages for loss of goodwill, work
|
|
156
|
+
stoppage, computer failure or malfunction, or all other commercial
|
|
157
|
+
damages or losses), even if such Contributor has been advised of the
|
|
158
|
+
possibility of such damages.
|
|
159
|
+
|
|
160
|
+
9. Accepting Warranty or Additional Liability. While redistributing the
|
|
161
|
+
Work or Derivative Works thereof, You may choose to offer, and charge
|
|
162
|
+
a fee for, acceptance of support, warranty, indemnity, or other
|
|
163
|
+
liability obligations and/or rights consistent with this License.
|
|
164
|
+
However, in accepting such obligations, You may act only on Your own
|
|
165
|
+
behalf and on Your sole responsibility, not on behalf of any other
|
|
166
|
+
Contributor, and only if You agree to indemnify, defend, and hold each
|
|
167
|
+
Contributor harmless for any liability incurred by, or claims asserted
|
|
168
|
+
against, such Contributor by reason of your accepting any such
|
|
169
|
+
warranty or additional liability.
|
|
170
|
+
|
|
171
|
+
END OF TERMS AND CONDITIONS
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
176
|
+
you may not use this file except in compliance with the License.
|
|
177
|
+
You may obtain a copy of the License at
|
|
178
|
+
|
|
179
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
180
|
+
|
|
181
|
+
Unless required by applicable law or agreed to in writing, software
|
|
182
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
183
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
184
|
+
See the License for the specific language governing permissions and
|
|
185
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# @trifoli/cli
|
|
2
|
+
|
|
3
|
+
Command-line tools for the [Trifoli Protocol](https://github.com/CleverCubeAi/trifoli-protocol).
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
| Command | Description |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `trifoli validate <file>` | Validate a Trifoli document against the JSON Schema. |
|
|
10
|
+
| `trifoli run <file>` | Run a workflow; pass inputs with `--input <json>` or `--input-file <path>`. Use `--workflow <id>` when the file contains multiple workflows. |
|
|
11
|
+
| `trifoli list <dir>` | List workflow IDs discovered under a directory. |
|
|
12
|
+
| `trifoli mcp <dir>` | Serve all workflows in a directory over MCP (stdio transport). |
|
|
13
|
+
|
|
14
|
+
Run `trifoli --help` for common flags (`--schema`, `--credentials-env`, etc.).
|
|
15
|
+
|
|
16
|
+
## Build and run (monorepo)
|
|
17
|
+
|
|
18
|
+
From `trifoli-engine/` after `pnpm install` and `pnpm build`:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
node packages/cli/dist/index.js validate ../examples/01-weather/get-city-weather.trifoli.json
|
|
22
|
+
node packages/cli/dist/index.js run ../examples/01-weather/get-city-weather.trifoli.json --input '{"city":"Casablanca"}'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
When the package is published or linked, the same entrypoint is available as the `trifoli` binary (see `package.json` `"bin"`).
|
|
26
|
+
|
|
27
|
+
## Not implemented
|
|
28
|
+
|
|
29
|
+
The following ideas may land in later releases; they are **not** in this package today:
|
|
30
|
+
|
|
31
|
+
- `trifoli serve` — HTTP server for workflows
|
|
32
|
+
- `trifoli inspect` — DAG visualization
|
|
33
|
+
|
|
34
|
+
For programmatic execution and custom hosting, use **`@trifoli/engine`** (see [`../engine/README.md`](../engine/README.md)).
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
Apache 2.0.
|
package/dist/argv.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal argv parser. Splits an array of arguments into positional values
|
|
3
|
+
* and flags. Supports `--flag value` (string) and `--flag` (boolean).
|
|
4
|
+
*
|
|
5
|
+
* Not a full POSIX parser; we accept what `trifoli` actually needs.
|
|
6
|
+
*/
|
|
7
|
+
export interface ParsedArgs {
|
|
8
|
+
positional: string[];
|
|
9
|
+
flags: Record<string, string | boolean>;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
12
|
+
export declare function flagString(flags: Record<string, string | boolean>, key: string): string | undefined;
|
|
13
|
+
export declare function flagBoolean(flags: Record<string, string | boolean>, key: string): boolean;
|
|
14
|
+
//# sourceMappingURL=argv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv.d.ts","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAqBpD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGnG;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAEzF"}
|
package/dist/argv.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal argv parser. Splits an array of arguments into positional values
|
|
3
|
+
* and flags. Supports `--flag value` (string) and `--flag` (boolean).
|
|
4
|
+
*
|
|
5
|
+
* Not a full POSIX parser; we accept what `trifoli` actually needs.
|
|
6
|
+
*/
|
|
7
|
+
export function parseArgs(argv) {
|
|
8
|
+
const positional = [];
|
|
9
|
+
const flags = {};
|
|
10
|
+
for (let i = 0; i < argv.length; i++) {
|
|
11
|
+
const tok = argv[i];
|
|
12
|
+
if (!tok.startsWith("--")) {
|
|
13
|
+
positional.push(tok);
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
const name = tok.slice(2);
|
|
17
|
+
const next = argv[i + 1];
|
|
18
|
+
if (next === undefined || next.startsWith("--")) {
|
|
19
|
+
flags[name] = true;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
flags[name] = next;
|
|
23
|
+
i++;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return { positional, flags };
|
|
27
|
+
}
|
|
28
|
+
export function flagString(flags, key) {
|
|
29
|
+
const v = flags[key];
|
|
30
|
+
return typeof v === "string" ? v : undefined;
|
|
31
|
+
}
|
|
32
|
+
export function flagBoolean(flags, key) {
|
|
33
|
+
return flags[key] === true || flags[key] === "true";
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=argv.js.map
|
package/dist/argv.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv.js","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,KAAK,GAAqC,EAAE,CAAC;IAEnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1B,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrB,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC1B,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YAChD,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACnB,CAAC,EAAE,CAAC;QACN,CAAC;IACH,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAuC,EAAE,GAAW;IAC7E,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAuC,EAAE,GAAW;IAC9E,OAAO,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ParsedArgs } from "../argv.js";
|
|
2
|
+
import { type CliIo } from "../io.js";
|
|
3
|
+
export interface ListOptions {
|
|
4
|
+
io?: CliIo;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* `trifoli list <dir>` — load all `.trifoli.json` files in a directory and
|
|
8
|
+
* print one row per workflow: `<id>\t<title>`.
|
|
9
|
+
*
|
|
10
|
+
* Exit codes:
|
|
11
|
+
* 0 — listing succeeded (may be empty)
|
|
12
|
+
* 1 — runtime error (dir not found, schema missing, document invalid)
|
|
13
|
+
*/
|
|
14
|
+
export declare function listCommand(args: ParsedArgs, opts?: ListOptions): Promise<number>;
|
|
15
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjD,MAAM,WAAW,WAAW;IAC1B,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ;AAED;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CA8C3F"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { TrifoliEngine, TrifoliEngineError, loadSchemaFromFile } from "@trifoli/engine";
|
|
3
|
+
import { flagString } from "../argv.js";
|
|
4
|
+
import { consoleIo } from "../io.js";
|
|
5
|
+
import { resolveSchemaPath } from "../schema-resolver.js";
|
|
6
|
+
/**
|
|
7
|
+
* `trifoli list <dir>` — load all `.trifoli.json` files in a directory and
|
|
8
|
+
* print one row per workflow: `<id>\t<title>`.
|
|
9
|
+
*
|
|
10
|
+
* Exit codes:
|
|
11
|
+
* 0 — listing succeeded (may be empty)
|
|
12
|
+
* 1 — runtime error (dir not found, schema missing, document invalid)
|
|
13
|
+
*/
|
|
14
|
+
export async function listCommand(args, opts = {}) {
|
|
15
|
+
const io = opts.io ?? consoleIo;
|
|
16
|
+
const dir = args.positional[0];
|
|
17
|
+
if (!dir) {
|
|
18
|
+
io.stderr("Usage: trifoli list <dir> [--schema <path>]");
|
|
19
|
+
return 1;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const s = await stat(dir);
|
|
23
|
+
if (!s.isDirectory()) {
|
|
24
|
+
io.stderr(`Not a directory: ${dir}`);
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
io.stderr(`Cannot read ${dir}: ${e.message}`);
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
let schema;
|
|
33
|
+
try {
|
|
34
|
+
const schemaPath = await resolveSchemaPath({ explicit: flagString(args.flags, "schema") });
|
|
35
|
+
schema = await loadSchemaFromFile(schemaPath);
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
io.stderr(e.message);
|
|
39
|
+
return 1;
|
|
40
|
+
}
|
|
41
|
+
const engine = new TrifoliEngine({ schema });
|
|
42
|
+
try {
|
|
43
|
+
await engine.loadFromDirectory(dir);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
if (e instanceof TrifoliEngineError) {
|
|
47
|
+
io.stderr(`${e.errorCode}: ${e.message}`);
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
io.stderr(e.message);
|
|
51
|
+
return 1;
|
|
52
|
+
}
|
|
53
|
+
for (const id of engine.list()) {
|
|
54
|
+
const doc = engine.getWorkflow(id);
|
|
55
|
+
const title = doc?.info.title ?? "";
|
|
56
|
+
io.stdout(`${id}\t${title}`);
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/commands/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EAAE,UAAU,EAAmB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,SAAS,EAAc,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAM1D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAgB,EAAE,OAAoB,EAAE;IACxE,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,EAAE,CAAC,MAAM,CAAC,6CAA6C,CAAC,CAAC;QACzD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B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AW,CAAC,EAAE,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,GAAG,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;QACpC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,KAAK,EAAE,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ParsedArgs } from "../argv.js";
|
|
2
|
+
import { type CliIo } from "../io.js";
|
|
3
|
+
export interface McpOptions {
|
|
4
|
+
io?: CliIo;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* `trifoli mcp <dir> [--schema <path>] [--credentials-env]`
|
|
9
|
+
*
|
|
10
|
+
* Loads every workflow in `<dir>` and starts an MCP server (stdio transport).
|
|
11
|
+
* Each workflow is exposed as one MCP tool. The process stays alive until
|
|
12
|
+
* the parent (e.g., Claude Desktop) closes the pipe.
|
|
13
|
+
*
|
|
14
|
+
* Exit codes:
|
|
15
|
+
* 0 — server started and exited cleanly
|
|
16
|
+
* 1 — runtime error (dir/schema missing, document invalid)
|
|
17
|
+
*/
|
|
18
|
+
export declare function mcpCommand(args: ParsedArgs, opts?: McpOptions): Promise<number>;
|
|
19
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAqC,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAGzE,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,KAAK,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAoEzF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { TrifoliEngine, TrifoliEngineError, loadSchemaFromFile } from "@trifoli/engine";
|
|
3
|
+
import { createMcpServer } from "@trifoli/mcp-adapter";
|
|
4
|
+
import { flagString } from "../argv.js";
|
|
5
|
+
import { consoleIo, readCredentialsFromEnv } from "../io.js";
|
|
6
|
+
import { resolveSchemaPath } from "../schema-resolver.js";
|
|
7
|
+
/**
|
|
8
|
+
* `trifoli mcp <dir> [--schema <path>] [--credentials-env]`
|
|
9
|
+
*
|
|
10
|
+
* Loads every workflow in `<dir>` and starts an MCP server (stdio transport).
|
|
11
|
+
* Each workflow is exposed as one MCP tool. The process stays alive until
|
|
12
|
+
* the parent (e.g., Claude Desktop) closes the pipe.
|
|
13
|
+
*
|
|
14
|
+
* Exit codes:
|
|
15
|
+
* 0 — server started and exited cleanly
|
|
16
|
+
* 1 — runtime error (dir/schema missing, document invalid)
|
|
17
|
+
*/
|
|
18
|
+
export async function mcpCommand(args, opts = {}) {
|
|
19
|
+
const io = opts.io ?? consoleIo;
|
|
20
|
+
const env = opts.env ?? process.env;
|
|
21
|
+
const dir = args.positional[0];
|
|
22
|
+
if (!dir) {
|
|
23
|
+
io.stderr("Usage: trifoli mcp <dir> [--schema <path>] [--credentials-env]");
|
|
24
|
+
return 1;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
const s = await stat(dir);
|
|
28
|
+
if (!s.isDirectory()) {
|
|
29
|
+
io.stderr(`Not a directory: ${dir}`);
|
|
30
|
+
return 1;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
io.stderr(`Cannot read ${dir}: ${e.message}`);
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
let schema;
|
|
38
|
+
try {
|
|
39
|
+
const schemaPath = await resolveSchemaPath({ explicit: flagString(args.flags, "schema") });
|
|
40
|
+
schema = await loadSchemaFromFile(schemaPath);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
io.stderr(e.message);
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
const credentials = args.flags["credentials-env"] ? readCredentialsFromEnv(env) : undefined;
|
|
47
|
+
const engine = new TrifoliEngine({ schema, credentials });
|
|
48
|
+
try {
|
|
49
|
+
await engine.loadFromDirectory(dir);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
if (e instanceof TrifoliEngineError) {
|
|
53
|
+
io.stderr(`${e.errorCode}: ${e.message}`);
|
|
54
|
+
return 1;
|
|
55
|
+
}
|
|
56
|
+
io.stderr(e.message);
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
const ids = engine.list();
|
|
60
|
+
if (ids.length === 0) {
|
|
61
|
+
io.stderr(`No workflows found in ${dir}`);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
io.stderr(`Trifoli MCP — exposing ${ids.length} workflow(s): ${ids.join(", ")}`);
|
|
65
|
+
const server = createMcpServer({ engine });
|
|
66
|
+
await server.start();
|
|
67
|
+
await new Promise((resolve) => {
|
|
68
|
+
const shutdown = async () => {
|
|
69
|
+
try {
|
|
70
|
+
await server.stop();
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
resolve();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
process.once("SIGINT", shutdown);
|
|
77
|
+
process.once("SIGTERM", shutdown);
|
|
78
|
+
process.stdin.once("close", shutdown);
|
|
79
|
+
});
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/commands/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EA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AM,EAAE,CAAC,CAAC;IAC3C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IAErB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QAClC,MAAM,QAAQ,GAAG,KAAK,IAAI,EAAE;YAC1B,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YACtB,CAAC;oBAAS,CAAC;gBACT,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ParsedArgs } from "../argv.js";
|
|
2
|
+
import { type CliIo } from "../io.js";
|
|
3
|
+
export interface RunOptions {
|
|
4
|
+
io?: CliIo;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* `trifoli run <file> [--input <json>] [--input-file <path>] [--workflow <id>] [--credentials-env]`
|
|
9
|
+
*
|
|
10
|
+
* Exit codes:
|
|
11
|
+
* 0 — workflow ran and status is "succeeded"
|
|
12
|
+
* 1 — runtime error (file/schema/inputs invalid)
|
|
13
|
+
* 2 — document failed schema validation
|
|
14
|
+
* 3 — workflow ran but status is "failed"
|
|
15
|
+
*/
|
|
16
|
+
export declare function runCommand(args: ParsedArgs, opts?: RunOptions): Promise<number>;
|
|
17
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,EAKL,KAAK,KAAK,EACX,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,KAAK,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAkFzF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { TrifoliEngine, TrifoliEngineError, loadSchemaFromFile } from "@trifoli/engine";
|
|
2
|
+
import { flagBoolean, flagString } from "../argv.js";
|
|
3
|
+
import { consoleIo, formatResult, loadInputs, readCredentialsFromEnv, } from "../io.js";
|
|
4
|
+
import { resolveSchemaPath } from "../schema-resolver.js";
|
|
5
|
+
/**
|
|
6
|
+
* `trifoli run <file> [--input <json>] [--input-file <path>] [--workflow <id>] [--credentials-env]`
|
|
7
|
+
*
|
|
8
|
+
* Exit codes:
|
|
9
|
+
* 0 — workflow ran and status is "succeeded"
|
|
10
|
+
* 1 — runtime error (file/schema/inputs invalid)
|
|
11
|
+
* 2 — document failed schema validation
|
|
12
|
+
* 3 — workflow ran but status is "failed"
|
|
13
|
+
*/
|
|
14
|
+
export async function runCommand(args, opts = {}) {
|
|
15
|
+
const io = opts.io ?? consoleIo;
|
|
16
|
+
const env = opts.env ?? process.env;
|
|
17
|
+
const file = args.positional[0];
|
|
18
|
+
if (!file) {
|
|
19
|
+
io.stderr("Usage: trifoli run <file> [--input <json>] [--input-file <path>] [--workflow <id>] [--credentials-env]");
|
|
20
|
+
return 1;
|
|
21
|
+
}
|
|
22
|
+
let schema;
|
|
23
|
+
try {
|
|
24
|
+
const schemaPath = await resolveSchemaPath({ explicit: flagString(args.flags, "schema") });
|
|
25
|
+
schema = await loadSchemaFromFile(schemaPath);
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
io.stderr(e.message);
|
|
29
|
+
return 1;
|
|
30
|
+
}
|
|
31
|
+
let inputs;
|
|
32
|
+
try {
|
|
33
|
+
inputs = await loadInputs({
|
|
34
|
+
input: flagString(args.flags, "input"),
|
|
35
|
+
inputFile: flagString(args.flags, "input-file"),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
io.stderr(e.message);
|
|
40
|
+
return 1;
|
|
41
|
+
}
|
|
42
|
+
const credentials = flagBoolean(args.flags, "credentials-env")
|
|
43
|
+
? readCredentialsFromEnv(env)
|
|
44
|
+
: undefined;
|
|
45
|
+
const engine = new TrifoliEngine({ schema, credentials });
|
|
46
|
+
try {
|
|
47
|
+
await engine.load(file);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
if (e instanceof TrifoliEngineError && e.errorCode === "DOCUMENT_INVALID") {
|
|
51
|
+
io.stderr(`Invalid document: ${e.message}`);
|
|
52
|
+
if (e.detail)
|
|
53
|
+
io.stderr(JSON.stringify(e.detail, null, 2));
|
|
54
|
+
return 2;
|
|
55
|
+
}
|
|
56
|
+
io.stderr(e.message);
|
|
57
|
+
return 1;
|
|
58
|
+
}
|
|
59
|
+
const ids = engine.list();
|
|
60
|
+
if (ids.length === 0) {
|
|
61
|
+
io.stderr(`No workflows found in ${file}`);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
let workflowId = flagString(args.flags, "workflow");
|
|
65
|
+
if (!workflowId) {
|
|
66
|
+
if (ids.length > 1) {
|
|
67
|
+
io.stderr(`Multiple workflows in ${file} (${ids.join(", ")}). Use --workflow <id> to choose one.`);
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
workflowId = ids[0];
|
|
71
|
+
}
|
|
72
|
+
else if (!ids.includes(workflowId)) {
|
|
73
|
+
io.stderr(`Workflow '${workflowId}' not found in ${file}. Available: ${ids.join(", ")}`);
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
const result = await engine.run(workflowId, inputs);
|
|
78
|
+
io.stdout(formatResult(result));
|
|
79
|
+
return result.status === "succeeded" ? 0 : 3;
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
if (e instanceof TrifoliEngineError) {
|
|
83
|
+
io.stderr(`${e.errorCode}: ${e.message}`);
|
|
84
|
+
if (e.errorCode === "INPUT_INVALID")
|
|
85
|
+
return 1;
|
|
86
|
+
return 3;
|
|
87
|
+
}
|
|
88
|
+
io.stderr(e.message);
|
|
89
|
+
return 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAmB,MAAM,YAAY,CAAC;AACtE,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,sBAAsB,GAEvB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAO1D;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAgB,EAAE,OAAmB,EAAE;IACtE,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IAEpC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,EAAE,CAAC,MAAM,CACP,wGAAwG,CACzG,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,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C,OAAO,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,kBAAkB,EAAE,CAAC;YACpC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1C,IAAI,CAAC,CAAC,SAAS,KAAK,eAAe;gBAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,CAAC,CAAC;QACX,CAAC;QACD,EAAE,CAAC,MAAM,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;QAChC,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ParsedArgs } from "../argv.js";
|
|
2
|
+
import { type CliIo } from "../io.js";
|
|
3
|
+
export interface ValidateOptions {
|
|
4
|
+
io?: CliIo;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* `trifoli validate <file>` — load and validate one Trifoli document.
|
|
8
|
+
* Returns process exit code:
|
|
9
|
+
* 0 — document is valid
|
|
10
|
+
* 1 — runtime error (file not found, schema not found, etc.)
|
|
11
|
+
* 2 — document failed schema validation
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateCommand(args: ParsedArgs, opts?: ValidateOptions): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjD,MAAM,WAAW,eAAe;IAC9B,EAAE,CAAC,EAAE,KAAK,CAAC;CACZ;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,GAAE,eAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4CnG"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { DocumentValidationError, TrifoliEngine, TrifoliEngineError, loadSchemaFromFile, } from "@trifoli/engine";
|
|
2
|
+
import { flagString } from "../argv.js";
|
|
3
|
+
import { consoleIo } from "../io.js";
|
|
4
|
+
import { resolveSchemaPath } from "../schema-resolver.js";
|
|
5
|
+
/**
|
|
6
|
+
* `trifoli validate <file>` — load and validate one Trifoli document.
|
|
7
|
+
* Returns process exit code:
|
|
8
|
+
* 0 — document is valid
|
|
9
|
+
* 1 — runtime error (file not found, schema not found, etc.)
|
|
10
|
+
* 2 — document failed schema validation
|
|
11
|
+
*/
|
|
12
|
+
export async function validateCommand(args, opts = {}) {
|
|
13
|
+
const io = opts.io ?? consoleIo;
|
|
14
|
+
const file = args.positional[0];
|
|
15
|
+
if (!file) {
|
|
16
|
+
io.stderr("Usage: trifoli validate <file> [--schema <path>]");
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
let schemaPath;
|
|
20
|
+
try {
|
|
21
|
+
schemaPath = await resolveSchemaPath({ explicit: flagString(args.flags, "schema") });
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
io.stderr(e.message);
|
|
25
|
+
return 1;
|
|
26
|
+
}
|
|
27
|
+
let schema;
|
|
28
|
+
try {
|
|
29
|
+
schema = await loadSchemaFromFile(schemaPath);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
io.stderr(`Failed to load schema from ${schemaPath}: ${e.message}`);
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
const engine = new TrifoliEngine({ schema });
|
|
36
|
+
try {
|
|
37
|
+
await engine.load(file);
|
|
38
|
+
const ids = engine.list();
|
|
39
|
+
for (const id of ids)
|
|
40
|
+
io.stdout(`OK ${id}`);
|
|
41
|
+
return 0;
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
if (e instanceof DocumentValidationError) {
|
|
45
|
+
io.stderr(`Invalid document: ${e.message}`);
|
|
46
|
+
if (e.detail)
|
|
47
|
+
io.stderr(JSON.stringify(e.detail, null, 2));
|
|
48
|
+
return 2;
|
|
49
|
+
}
|
|
50
|
+
if (e instanceof TrifoliEngineError) {
|
|
51
|
+
io.stderr(`${e.errorCode}: ${e.message}`);
|
|
52
|
+
return 1;
|
|
53
|
+
}
|
|
54
|
+
io.stderr(e.message);
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAmB,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,SAAS,EAAc,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAM1D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAgB,EAAE,OAAwB,EAAE;IAChF,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,SAAS,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,EAAE,CAAC,MAAM,CAAC,kDAAkD,CAAC,CAAC;QAC9D,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,UAAkB,CAAC;IACvB,IAAI,CAAC;QACH,UAAU,GAAG,MAAM,iBAAiB,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC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AC,CAAC;YAC1C,OAAO,CAAC,CAAC;QACX,CAAC;QACD,EAAE,CAAC,MAAM,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;QAChC,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Trifoli CLI — `trifoli` command.
|
|
4
|
+
*
|
|
5
|
+
* Subcommands:
|
|
6
|
+
* trifoli validate <file> Validate a Trifoli document against the schema.
|
|
7
|
+
* trifoli run <file> [opts] Execute a workflow.
|
|
8
|
+
* trifoli list <dir> List workflows in a directory.
|
|
9
|
+
* trifoli mcp <dir> Serve workflows over MCP (stdio).
|
|
10
|
+
*/
|
|
11
|
+
export declare function main(argv: string[]): Promise<number>;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAiDH,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAa1D"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Trifoli CLI — `trifoli` command.
|
|
4
|
+
*
|
|
5
|
+
* Subcommands:
|
|
6
|
+
* trifoli validate <file> Validate a Trifoli document against the schema.
|
|
7
|
+
* trifoli run <file> [opts] Execute a workflow.
|
|
8
|
+
* trifoli list <dir> List workflows in a directory.
|
|
9
|
+
* trifoli mcp <dir> Serve workflows over MCP (stdio).
|
|
10
|
+
*/
|
|
11
|
+
import { parseArgs } from "./argv.js";
|
|
12
|
+
import { mcpCommand } from "./commands/mcp.js";
|
|
13
|
+
import { listCommand } from "./commands/list.js";
|
|
14
|
+
import { runCommand } from "./commands/run.js";
|
|
15
|
+
import { validateCommand } from "./commands/validate.js";
|
|
16
|
+
const HELP = `
|
|
17
|
+
trifoli — command-line tools for the Trifoli Protocol
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
trifoli validate <file> [--schema <path>]
|
|
21
|
+
Validate a Trifoli document.
|
|
22
|
+
|
|
23
|
+
trifoli run <file> [--input <json>] [--input-file <path>]
|
|
24
|
+
[--workflow <id>] [--credentials-env] [--schema <path>]
|
|
25
|
+
Execute a workflow. Prints the WorkflowRunResult as JSON.
|
|
26
|
+
|
|
27
|
+
trifoli list <dir> [--schema <path>]
|
|
28
|
+
List workflows in a directory.
|
|
29
|
+
|
|
30
|
+
trifoli mcp <dir> [--credentials-env] [--schema <path>]
|
|
31
|
+
Serve workflows over the Model Context Protocol (stdio transport).
|
|
32
|
+
|
|
33
|
+
Common flags:
|
|
34
|
+
--schema <path> Path to the Trifoli JSON Schema. Defaults to the
|
|
35
|
+
schema/ folder walking up from cwd, then to the
|
|
36
|
+
schema bundled inside @trifoli/engine.
|
|
37
|
+
--credentials-env Read auth credentials from TRIFOLI_AUTH_* env vars.
|
|
38
|
+
|
|
39
|
+
Exit codes:
|
|
40
|
+
0 success
|
|
41
|
+
1 runtime error (file/schema missing, bad inputs)
|
|
42
|
+
2 document failed schema validation
|
|
43
|
+
3 workflow ran but reported status=failed
|
|
44
|
+
|
|
45
|
+
See: https://github.com/CleverCubeAi/trifoli-protocol
|
|
46
|
+
`.trim();
|
|
47
|
+
const handlers = {
|
|
48
|
+
validate: (a) => validateCommand(a),
|
|
49
|
+
run: (a) => runCommand(a),
|
|
50
|
+
list: (a) => listCommand(a),
|
|
51
|
+
mcp: (a) => mcpCommand(a),
|
|
52
|
+
};
|
|
53
|
+
export async function main(argv) {
|
|
54
|
+
const cmd = argv[0];
|
|
55
|
+
if (!cmd || cmd === "--help" || cmd === "-h" || cmd === "help") {
|
|
56
|
+
process.stdout.write(HELP + "\n");
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
const handler = handlers[cmd];
|
|
60
|
+
if (!handler) {
|
|
61
|
+
process.stderr.write(`Unknown command '${cmd}'.\n${HELP}\n`);
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
const parsed = parseArgs(argv.slice(1));
|
|
65
|
+
return handler(parsed);
|
|
66
|
+
}
|
|
67
|
+
const isMain = (() => {
|
|
68
|
+
try {
|
|
69
|
+
return import.meta.url === `file://${process.argv[1]}`;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
})();
|
|
75
|
+
if (isMain) {
|
|
76
|
+
main(process.argv.slice(2)).then((code) => process.exit(code), (err) => {
|
|
77
|
+
process.stderr.write(`Unhandled error: ${err.message ?? err}\n`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,OAAO,EAAE,SAAS,EAAmB,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BZ,CAAC,IAAI,EAAE,CAAC;AAIT,MAAM,QAAQ,GAA4B;IACxC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IACnC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IACzB,IAAI,EAAE,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CAAC,IAAI,CAAC,EAC5B,CAAC,GAAG,EAAE,EAAE;QACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAqB,GAAa,CAAC,OAAO,IAAI,GAAG,IAAI,CAAC,CAAC;QAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/io.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WorkflowRunResult } from "@trifoli/engine";
|
|
2
|
+
export interface CliIo {
|
|
3
|
+
stdout: (line: string) => void;
|
|
4
|
+
stderr: (line: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const consoleIo: CliIo;
|
|
7
|
+
export declare function readJsonFile<T = unknown>(path: string): Promise<T>;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve workflow inputs from `--input <json>` or `--input-file <path>`.
|
|
10
|
+
* Returns `{}` if neither flag is set. Errors if both are set.
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadInputs(opts: {
|
|
13
|
+
input?: string;
|
|
14
|
+
inputFile?: string;
|
|
15
|
+
}): Promise<Record<string, unknown>>;
|
|
16
|
+
/**
|
|
17
|
+
* Read auth credentials from environment variables prefixed `TRIFOLI_AUTH_`.
|
|
18
|
+
* `TRIFOLI_AUTH_FOO=bar` becomes `{ foo: "bar" }`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readCredentialsFromEnv(env?: NodeJS.ProcessEnv): Record<string, string>;
|
|
21
|
+
/** Format a WorkflowRunResult as pretty JSON. */
|
|
22
|
+
export declare function formatResult(result: WorkflowRunResult): string;
|
|
23
|
+
//# sourceMappingURL=io.d.ts.map
|
package/dist/io.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,SAAS,EAAE,KAGvB,CAAC;AAEF,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAOxE;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAuBnC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQnG;AAED,iDAAiD;AACjD,wBAAgB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAE9D"}
|
package/dist/io.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
export const consoleIo = {
|
|
3
|
+
stdout: (s) => process.stdout.write(s + "\n"),
|
|
4
|
+
stderr: (s) => process.stderr.write(s + "\n"),
|
|
5
|
+
};
|
|
6
|
+
export async function readJsonFile(path) {
|
|
7
|
+
const raw = await readFile(path, "utf-8");
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(raw);
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
throw new Error(`Failed to parse JSON from ${path}: ${e.message}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve workflow inputs from `--input <json>` or `--input-file <path>`.
|
|
17
|
+
* Returns `{}` if neither flag is set. Errors if both are set.
|
|
18
|
+
*/
|
|
19
|
+
export async function loadInputs(opts) {
|
|
20
|
+
if (opts.input && opts.inputFile) {
|
|
21
|
+
throw new Error("Pass either --input or --input-file, not both.");
|
|
22
|
+
}
|
|
23
|
+
if (opts.input) {
|
|
24
|
+
try {
|
|
25
|
+
const parsed = JSON.parse(opts.input);
|
|
26
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
27
|
+
throw new Error("--input JSON must be an object");
|
|
28
|
+
}
|
|
29
|
+
return parsed;
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
throw new Error(`Failed to parse --input JSON: ${e.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (opts.inputFile) {
|
|
36
|
+
const obj = await readJsonFile(opts.inputFile);
|
|
37
|
+
if (obj === null || typeof obj !== "object" || Array.isArray(obj)) {
|
|
38
|
+
throw new Error(`--input-file must contain a JSON object: ${opts.inputFile}`);
|
|
39
|
+
}
|
|
40
|
+
return obj;
|
|
41
|
+
}
|
|
42
|
+
return {};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Read auth credentials from environment variables prefixed `TRIFOLI_AUTH_`.
|
|
46
|
+
* `TRIFOLI_AUTH_FOO=bar` becomes `{ foo: "bar" }`.
|
|
47
|
+
*/
|
|
48
|
+
export function readCredentialsFromEnv(env = process.env) {
|
|
49
|
+
const out = {};
|
|
50
|
+
for (const [k, v] of Object.entries(env)) {
|
|
51
|
+
if (!k.startsWith("TRIFOLI_AUTH_") || v === undefined)
|
|
52
|
+
continue;
|
|
53
|
+
const name = k.slice("TRIFOLI_AUTH_".length).toLowerCase();
|
|
54
|
+
out[name] = v;
|
|
55
|
+
}
|
|
56
|
+
return out;
|
|
57
|
+
}
|
|
58
|
+
/** Format a WorkflowRunResult as pretty JSON. */
|
|
59
|
+
export function formatResult(result) {
|
|
60
|
+
return JSON.stringify(result, null, 2);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=io.js.map
|
package/dist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|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare class SchemaNotFoundError extends Error {
|
|
2
|
+
constructor();
|
|
3
|
+
}
|
|
4
|
+
export interface ResolveSchemaOptions {
|
|
5
|
+
/** Explicit `--schema <path>` override. Takes precedence. */
|
|
6
|
+
explicit?: string;
|
|
7
|
+
/** Directory to start the upward walk from (defaults to process.cwd()). */
|
|
8
|
+
cwd?: string;
|
|
9
|
+
/** Schema version to look for (defaults to 0.1.0). */
|
|
10
|
+
version?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the path to a Trifoli JSON Schema.
|
|
14
|
+
*
|
|
15
|
+
* Order of precedence:
|
|
16
|
+
* 1. `opts.explicit` (the `--schema` flag)
|
|
17
|
+
* 2. `schema/trifoli-<version>.json` walking up from `cwd`
|
|
18
|
+
* 3. The schema bundled inside `@trifoli/engine`
|
|
19
|
+
*
|
|
20
|
+
* Throws `SchemaNotFoundError` if none of these resolve.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveSchemaPath(opts?: ResolveSchemaOptions): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=schema-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-resolver.d.ts","sourceRoot":"","sources":["../src/schema-resolver.ts"],"names":[],"mappings":"AAKA,qBAAa,mBAAoB,SAAQ,KAAK;;CAO7C;AAuBD,MAAM,WAAW,oBAAoB;IACnC,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,oBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAexF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
import { getBundledSchemaPath } from "@trifoli/engine";
|
|
4
|
+
export class SchemaNotFoundError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super("Could not locate the Trifoli JSON Schema. Pass --schema <path>, run from a repo containing schema/trifoli-*.json, or build @trifoli/engine to populate the bundled copy.");
|
|
7
|
+
this.name = "SchemaNotFoundError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
async function exists(path) {
|
|
11
|
+
try {
|
|
12
|
+
await access(path);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function findUpwards(startDir, version) {
|
|
20
|
+
let dir = resolve(startDir);
|
|
21
|
+
for (let i = 0; i < 32; i++) {
|
|
22
|
+
const candidate = join(dir, "schema", `trifoli-${version}.json`);
|
|
23
|
+
if (await exists(candidate))
|
|
24
|
+
return candidate;
|
|
25
|
+
const parent = dirname(dir);
|
|
26
|
+
if (parent === dir)
|
|
27
|
+
return null;
|
|
28
|
+
dir = parent;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolve the path to a Trifoli JSON Schema.
|
|
34
|
+
*
|
|
35
|
+
* Order of precedence:
|
|
36
|
+
* 1. `opts.explicit` (the `--schema` flag)
|
|
37
|
+
* 2. `schema/trifoli-<version>.json` walking up from `cwd`
|
|
38
|
+
* 3. The schema bundled inside `@trifoli/engine`
|
|
39
|
+
*
|
|
40
|
+
* Throws `SchemaNotFoundError` if none of these resolve.
|
|
41
|
+
*/
|
|
42
|
+
export async function resolveSchemaPath(opts = {}) {
|
|
43
|
+
const version = opts.version ?? "0.1.0";
|
|
44
|
+
if (opts.explicit) {
|
|
45
|
+
if (await exists(opts.explicit))
|
|
46
|
+
return opts.explicit;
|
|
47
|
+
throw new Error(`Schema file not found: ${opts.explicit}`);
|
|
48
|
+
}
|
|
49
|
+
const walked = await findUpwards(opts.cwd ?? process.cwd(), version);
|
|
50
|
+
if (walked)
|
|
51
|
+
return walked;
|
|
52
|
+
const bundled = getBundledSchemaPath(version);
|
|
53
|
+
if (await exists(bundled))
|
|
54
|
+
return bundled;
|
|
55
|
+
throw new SchemaNotFoundError();
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=schema-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-resolver.js","sourceRoot":"","sources":["../src/schema-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAC5C;QACE,KAAK,CACH,0KAA0K,CAC3K,CAAC;QACF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,QAAgB,EAAE,OAAe;IAC1D,IAAI,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,OAAO,OAAO,CAAC,CAAC;QACjE,IAAI,MAAM,MAAM,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAChC,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAWD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,OAA6B,EAAE;IACrE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC;IAExC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,IAAI,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAC;QACtD,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC;IACrE,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,MAAM,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9C,IAAI,MAAM,MAAM,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAE1C,MAAM,IAAI,mBAAmB,EAAE,CAAC;AAClC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trifoli/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Command-line tools for the Trifoli Protocol — validate, run, and serve workflows.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"trifoli": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@trifoli/engine": "0.1.0",
|
|
17
|
+
"@trifoli/mcp-adapter": "0.1.0"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^20.11.0",
|
|
21
|
+
"typescript": "^5.4.0",
|
|
22
|
+
"vitest": "^1.4.0"
|
|
23
|
+
},
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20.0.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"pretest": "pnpm --filter @trifoli/engine --filter @trifoli/mcp-adapter run build",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"test:watch": "vitest",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"lint": "echo 'lint not configured yet'"
|
|
35
|
+
}
|
|
36
|
+
}
|