@output.ai/cli 0.0.0 → 0.0.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @output.ai/cli
2
2
 
3
- CLI tool for generating Output.ai workflows.
3
+ CLI tool for generating Output workflows.
4
4
 
5
5
  ## Installation
6
6
 
@@ -14,6 +14,39 @@ npx @output.ai/cli
14
14
 
15
15
  ## Usage
16
16
 
17
+ ### List Workflows
18
+
19
+ ```bash
20
+ # List all available workflows (simple list, default)
21
+ output-cli workflow list
22
+
23
+ # List workflows with custom API URL
24
+ API_URL=http://localhost:3001 output-cli workflow list
25
+
26
+ # List workflows with authentication
27
+ API_AUTH_TOKEN=your-token output-cli workflow list
28
+
29
+ # Show detailed table view with all information
30
+ output-cli workflow list --format table
31
+
32
+ # Show detailed table with expanded parameter info
33
+ output-cli workflow list --format table --detailed
34
+
35
+ # List workflows in JSON format
36
+ output-cli workflow list --format json
37
+
38
+ # Filter workflows by name (partial match)
39
+ output-cli workflow list --filter simple
40
+ ```
41
+
42
+ #### Command Options
43
+
44
+ - `--format, -f` - Output format: `list` (default, simple column), `table`, or `json`
45
+ - `--detailed, -d` - Show detailed parameter information in table view
46
+ - `--filter` - Filter workflows by name (case-insensitive partial match)
47
+
48
+ The list command connects to the API server and retrieves all available workflows. By default, it displays a simple list of workflow names (like `ls`). Use `--format table` for detailed information.
49
+
17
50
  ### Generate a Workflow
18
51
 
19
52
  ```bash
@@ -44,12 +77,44 @@ The CLI creates a complete workflow structure:
44
77
  ```
45
78
  my-workflow/
46
79
  ├── index.ts # Main workflow definition
47
- ├── steps.ts # Activity/step implementations
80
+ ├── steps.ts # Activity/step implementations
48
81
  ├── types.ts # TypeScript interfaces
49
82
  ├── prompt@v1.prompt # LLM prompt template (if not skeleton)
50
83
  └── README.md # Workflow documentation
51
84
  ```
52
85
 
86
+ ### Initialize Agent Configuration
87
+
88
+ ```bash
89
+ # Initialize agent configuration for your coding agent
90
+ output-cli agents init
91
+
92
+ # Specify your agent provider (default: claude-code)
93
+ output-cli agents init --agent-provider claude-code
94
+
95
+ # Force overwrite existing configuration
96
+ output-cli agents init --force
97
+ ```
98
+
99
+ #### What It Does
100
+
101
+ Sets up your coding agent of choice with context files, sub-agents, and slash commands for working with the Output SDK effectively. It creates a `.outputai/` directory and wires up your coding agent to the context files.
102
+
103
+ **Note:** Currently this only works for [Claude Code](https://claude.ai/code), but we plan to add support for other coding agents over time.
104
+
105
+ #### Command Options
106
+
107
+ - `--agent-provider` - Specify the coding agent provider (default: `claude-code`)
108
+ - `--force, -f` - Overwrite existing agent configuration files
109
+
110
+ #### Output Agent Commands
111
+
112
+ **`/plan_workflow`** - Guides you through structured workflow planning to create comprehensive implementation blueprints before writing code.
113
+
114
+ #### Output Sub-Agents
115
+
116
+ **`workflow_planner`** - A specialized AI agent that helps with workflow architecture and planning, including requirements analysis, schema design, and testing strategy definition.
117
+
53
118
  ## About
54
119
 
55
120
  Built with [OCLIF](https://oclif.io) - see their documentation for advanced CLI features, plugins, and configuration options.
@@ -0,0 +1,272 @@
1
+ export type JSONSchemaProperties = {
2
+ [key: string]: JSONSchema;
3
+ };
4
+ export type JSONSchemaPropertyNames = {
5
+ type?: string;
6
+ };
7
+ export interface JSONSchema {
8
+ $schema?: string;
9
+ type?: string;
10
+ properties?: JSONSchemaProperties;
11
+ items?: JSONSchema;
12
+ required?: string[];
13
+ description?: string;
14
+ additionalProperties?: boolean;
15
+ propertyNames?: JSONSchemaPropertyNames;
16
+ anyOf?: JSONSchema[];
17
+ [key: string]: unknown;
18
+ }
19
+ export interface Workflow {
20
+ /** The name of the workflow */
21
+ name: string;
22
+ /** The description of the workflow */
23
+ description?: string;
24
+ inputSchema?: JSONSchema;
25
+ outputSchema?: JSONSchema;
26
+ }
27
+ export type PostWorkflowRunBody = {
28
+ /** The name of the workflow to execute */
29
+ workflowName: string;
30
+ /** The payload to send to the workflow */
31
+ input: unknown;
32
+ /** The name of the task queue to send the workflow to */
33
+ taskQueue?: string;
34
+ };
35
+ export type PostWorkflowRun200 = {
36
+ /** The workflow execution id */
37
+ workflowId?: string;
38
+ /** The output of the the workflow */
39
+ output?: unknown;
40
+ };
41
+ export type PostWorkflowStartBody = {
42
+ /** The name of the workflow to execute */
43
+ workflowName: string;
44
+ /** The payload to send to the workflow */
45
+ input: unknown;
46
+ /** The name of the task queue to send the workflow to */
47
+ taskQueue?: string;
48
+ };
49
+ export type PostWorkflowStart200 = {
50
+ /** The id of the started workflow */
51
+ workflowId?: string;
52
+ };
53
+ /**
54
+ * The workflow execution status
55
+ */
56
+ export type GetWorkflowIdStatus200Status = typeof GetWorkflowIdStatus200Status[keyof typeof GetWorkflowIdStatus200Status];
57
+ export declare const GetWorkflowIdStatus200Status: {
58
+ readonly canceled: "canceled";
59
+ readonly completed: "completed";
60
+ readonly continued_as_new: "continued_as_new";
61
+ readonly failed: "failed";
62
+ readonly running: "running";
63
+ readonly terminated: "terminated";
64
+ readonly timed_out: "timed_out";
65
+ readonly unspecified: "unspecified";
66
+ };
67
+ export type GetWorkflowIdStatus200 = {
68
+ /** The id of workflow */
69
+ workflowId?: string;
70
+ /** The workflow execution status */
71
+ status?: GetWorkflowIdStatus200Status;
72
+ /** An epoch timestamp representing when the workflow started */
73
+ startedAt?: number;
74
+ /** An epoch timestamp representing when the workflow ended */
75
+ completedAt?: number;
76
+ };
77
+ /**
78
+ * The output of workflow
79
+ */
80
+ export type GetWorkflowIdOutput200Output = {
81
+ [key: string]: unknown;
82
+ };
83
+ export type GetWorkflowIdOutput200 = {
84
+ /** The workflow execution id */
85
+ workflowId?: string;
86
+ /** The output of workflow */
87
+ output?: GetWorkflowIdOutput200Output;
88
+ };
89
+ export type GetWorkflowCatalogId200 = {
90
+ /** Each workflow available in this catalog */
91
+ workflows?: Workflow[];
92
+ };
93
+ export type GetWorkflowCatalog200 = {
94
+ /** Each workflow available in this catalog */
95
+ workflows?: Workflow[];
96
+ };
97
+ export type PostWorkflowIdFeedbackBody = {
98
+ /** The payload to send to the workflow */
99
+ payload?: unknown;
100
+ };
101
+ /**
102
+ * @summary Health check the API
103
+ */
104
+ export type getHealthResponse200 = {
105
+ data: void;
106
+ status: 200;
107
+ };
108
+ export type getHealthResponseSuccess = (getHealthResponse200) & {
109
+ headers: Headers;
110
+ };
111
+ export type getHealthResponse = (getHealthResponseSuccess);
112
+ export declare const getGetHealthUrl: () => string;
113
+ export declare const getHealth: (options?: RequestInit) => Promise<getHealthResponse>;
114
+ /**
115
+ * Executes a workflow and waits for it to complete before returning the result
116
+ * @summary Execute a workflow synchronously
117
+ */
118
+ export type postWorkflowRunResponse200 = {
119
+ data: PostWorkflowRun200;
120
+ status: 200;
121
+ };
122
+ export type postWorkflowRunResponseSuccess = (postWorkflowRunResponse200) & {
123
+ headers: Headers;
124
+ };
125
+ export type postWorkflowRunResponse = (postWorkflowRunResponseSuccess);
126
+ export declare const getPostWorkflowRunUrl: () => string;
127
+ export declare const postWorkflowRun: (postWorkflowRunBody: PostWorkflowRunBody, options?: RequestInit) => Promise<postWorkflowRunResponse>;
128
+ /**
129
+ * @summary Start a workflow asynchronously
130
+ */
131
+ export type postWorkflowStartResponse200 = {
132
+ data: PostWorkflowStart200;
133
+ status: 200;
134
+ };
135
+ export type postWorkflowStartResponseSuccess = (postWorkflowStartResponse200) & {
136
+ headers: Headers;
137
+ };
138
+ export type postWorkflowStartResponse = (postWorkflowStartResponseSuccess);
139
+ export declare const getPostWorkflowStartUrl: () => string;
140
+ export declare const postWorkflowStart: (postWorkflowStartBody: PostWorkflowStartBody, options?: RequestInit) => Promise<postWorkflowStartResponse>;
141
+ /**
142
+ * @summary Get workflow execution status
143
+ */
144
+ export type getWorkflowIdStatusResponse200 = {
145
+ data: GetWorkflowIdStatus200;
146
+ status: 200;
147
+ };
148
+ export type getWorkflowIdStatusResponse404 = {
149
+ data: void;
150
+ status: 404;
151
+ };
152
+ export type getWorkflowIdStatusResponseSuccess = (getWorkflowIdStatusResponse200) & {
153
+ headers: Headers;
154
+ };
155
+ export type getWorkflowIdStatusResponseError = (getWorkflowIdStatusResponse404) & {
156
+ headers: Headers;
157
+ };
158
+ export type getWorkflowIdStatusResponse = (getWorkflowIdStatusResponseSuccess | getWorkflowIdStatusResponseError);
159
+ export declare const getGetWorkflowIdStatusUrl: (id: unknown) => string;
160
+ export declare const getWorkflowIdStatus: (id: unknown, options?: RequestInit) => Promise<getWorkflowIdStatusResponse>;
161
+ /**
162
+ * @summary Stop a workflow execution
163
+ */
164
+ export type patchWorkflowIdStopResponse200 = {
165
+ data: void;
166
+ status: 200;
167
+ };
168
+ export type patchWorkflowIdStopResponse404 = {
169
+ data: void;
170
+ status: 404;
171
+ };
172
+ export type patchWorkflowIdStopResponseSuccess = (patchWorkflowIdStopResponse200) & {
173
+ headers: Headers;
174
+ };
175
+ export type patchWorkflowIdStopResponseError = (patchWorkflowIdStopResponse404) & {
176
+ headers: Headers;
177
+ };
178
+ export type patchWorkflowIdStopResponse = (patchWorkflowIdStopResponseSuccess | patchWorkflowIdStopResponseError);
179
+ export declare const getPatchWorkflowIdStopUrl: (id: unknown) => string;
180
+ export declare const patchWorkflowIdStop: (id: unknown, options?: RequestInit) => Promise<patchWorkflowIdStopResponse>;
181
+ /**
182
+ * @summary Return the output of a workflow
183
+ */
184
+ export type getWorkflowIdOutputResponse200 = {
185
+ data: GetWorkflowIdOutput200;
186
+ status: 200;
187
+ };
188
+ export type getWorkflowIdOutputResponse404 = {
189
+ data: void;
190
+ status: 404;
191
+ };
192
+ export type getWorkflowIdOutputResponseSuccess = (getWorkflowIdOutputResponse200) & {
193
+ headers: Headers;
194
+ };
195
+ export type getWorkflowIdOutputResponseError = (getWorkflowIdOutputResponse404) & {
196
+ headers: Headers;
197
+ };
198
+ export type getWorkflowIdOutputResponse = (getWorkflowIdOutputResponseSuccess | getWorkflowIdOutputResponseError);
199
+ export declare const getGetWorkflowIdOutputUrl: (id: unknown) => string;
200
+ export declare const getWorkflowIdOutput: (id: unknown, options?: RequestInit) => Promise<getWorkflowIdOutputResponse>;
201
+ /**
202
+ * @summary Return the trace of a workflow execution
203
+ */
204
+ export type getWorkflowIdTraceResponse200 = {
205
+ data: string[];
206
+ status: 200;
207
+ };
208
+ export type getWorkflowIdTraceResponse404 = {
209
+ data: void;
210
+ status: 404;
211
+ };
212
+ export type getWorkflowIdTraceResponseSuccess = (getWorkflowIdTraceResponse200) & {
213
+ headers: Headers;
214
+ };
215
+ export type getWorkflowIdTraceResponseError = (getWorkflowIdTraceResponse404) & {
216
+ headers: Headers;
217
+ };
218
+ export type getWorkflowIdTraceResponse = (getWorkflowIdTraceResponseSuccess | getWorkflowIdTraceResponseError);
219
+ export declare const getGetWorkflowIdTraceUrl: (id: unknown) => string;
220
+ export declare const getWorkflowIdTrace: (id: unknown, options?: RequestInit) => Promise<getWorkflowIdTraceResponse>;
221
+ /**
222
+ * @summary Get a specific workflow catalog by ID
223
+ */
224
+ export type getWorkflowCatalogIdResponse200 = {
225
+ data: GetWorkflowCatalogId200;
226
+ status: 200;
227
+ };
228
+ export type getWorkflowCatalogIdResponseSuccess = (getWorkflowCatalogIdResponse200) & {
229
+ headers: Headers;
230
+ };
231
+ export type getWorkflowCatalogIdResponse = (getWorkflowCatalogIdResponseSuccess);
232
+ export declare const getGetWorkflowCatalogIdUrl: (id: unknown) => string;
233
+ export declare const getWorkflowCatalogId: (id: unknown, options?: RequestInit) => Promise<getWorkflowCatalogIdResponse>;
234
+ /**
235
+ * @summary Get the default workflow catalog
236
+ */
237
+ export type getWorkflowCatalogResponse200 = {
238
+ data: GetWorkflowCatalog200;
239
+ status: 200;
240
+ };
241
+ export type getWorkflowCatalogResponseSuccess = (getWorkflowCatalogResponse200) & {
242
+ headers: Headers;
243
+ };
244
+ export type getWorkflowCatalogResponse = (getWorkflowCatalogResponseSuccess);
245
+ export declare const getGetWorkflowCatalogUrl: () => string;
246
+ export declare const getWorkflowCatalog: (options?: RequestInit) => Promise<getWorkflowCatalogResponse>;
247
+ /**
248
+ * @summary Send feedback to a payload
249
+ */
250
+ export type postWorkflowIdFeedbackResponse200 = {
251
+ data: void;
252
+ status: 200;
253
+ };
254
+ export type postWorkflowIdFeedbackResponseSuccess = (postWorkflowIdFeedbackResponse200) & {
255
+ headers: Headers;
256
+ };
257
+ export type postWorkflowIdFeedbackResponse = (postWorkflowIdFeedbackResponseSuccess);
258
+ export declare const getPostWorkflowIdFeedbackUrl: (id: unknown) => string;
259
+ export declare const postWorkflowIdFeedback: (id: unknown, postWorkflowIdFeedbackBody: PostWorkflowIdFeedbackBody, options?: RequestInit) => Promise<postWorkflowIdFeedbackResponse>;
260
+ /**
261
+ * @summary A dummy post endpoint for test only
262
+ */
263
+ export type postHeartbeatResponse204 = {
264
+ data: void;
265
+ status: 204;
266
+ };
267
+ export type postHeartbeatResponseSuccess = (postHeartbeatResponse204) & {
268
+ headers: Headers;
269
+ };
270
+ export type postHeartbeatResponse = (postHeartbeatResponseSuccess);
271
+ export declare const getPostHeartbeatUrl: () => string;
272
+ export declare const postHeartbeat: (options?: RequestInit) => Promise<postHeartbeatResponse>;
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Generated by orval v7.13.0 🍺
3
+ * Do not edit manually.
4
+ * Output.ai SDK API
5
+ * API for managing and executing Temporal workflows through Flow SDK
6
+ * OpenAPI spec version: 1.0.0
7
+ */
8
+ import { customFetchInstance } from '../http_client.js';
9
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
10
+ export const GetWorkflowIdStatus200Status = {
11
+ canceled: 'canceled',
12
+ completed: 'completed',
13
+ continued_as_new: 'continued_as_new',
14
+ failed: 'failed',
15
+ running: 'running',
16
+ terminated: 'terminated',
17
+ timed_out: 'timed_out',
18
+ unspecified: 'unspecified',
19
+ };
20
+ ;
21
+ export const getGetHealthUrl = () => {
22
+ return `/health`;
23
+ };
24
+ export const getHealth = async (options) => {
25
+ return customFetchInstance(getGetHealthUrl(), {
26
+ ...options,
27
+ method: 'GET'
28
+ });
29
+ };
30
+ ;
31
+ export const getPostWorkflowRunUrl = () => {
32
+ return `/workflow/run`;
33
+ };
34
+ export const postWorkflowRun = async (postWorkflowRunBody, options) => {
35
+ return customFetchInstance(getPostWorkflowRunUrl(), {
36
+ ...options,
37
+ method: 'POST',
38
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
39
+ body: JSON.stringify(postWorkflowRunBody)
40
+ });
41
+ };
42
+ ;
43
+ export const getPostWorkflowStartUrl = () => {
44
+ return `/workflow/start`;
45
+ };
46
+ export const postWorkflowStart = async (postWorkflowStartBody, options) => {
47
+ return customFetchInstance(getPostWorkflowStartUrl(), {
48
+ ...options,
49
+ method: 'POST',
50
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
51
+ body: JSON.stringify(postWorkflowStartBody)
52
+ });
53
+ };
54
+ export const getGetWorkflowIdStatusUrl = (id) => {
55
+ return `/workflow/${id}/status`;
56
+ };
57
+ export const getWorkflowIdStatus = async (id, options) => {
58
+ return customFetchInstance(getGetWorkflowIdStatusUrl(id), {
59
+ ...options,
60
+ method: 'GET'
61
+ });
62
+ };
63
+ export const getPatchWorkflowIdStopUrl = (id) => {
64
+ return `/workflow/${id}/stop`;
65
+ };
66
+ export const patchWorkflowIdStop = async (id, options) => {
67
+ return customFetchInstance(getPatchWorkflowIdStopUrl(id), {
68
+ ...options,
69
+ method: 'PATCH'
70
+ });
71
+ };
72
+ export const getGetWorkflowIdOutputUrl = (id) => {
73
+ return `/workflow/${id}/output`;
74
+ };
75
+ export const getWorkflowIdOutput = async (id, options) => {
76
+ return customFetchInstance(getGetWorkflowIdOutputUrl(id), {
77
+ ...options,
78
+ method: 'GET'
79
+ });
80
+ };
81
+ export const getGetWorkflowIdTraceUrl = (id) => {
82
+ return `/workflow/${id}/trace`;
83
+ };
84
+ export const getWorkflowIdTrace = async (id, options) => {
85
+ return customFetchInstance(getGetWorkflowIdTraceUrl(id), {
86
+ ...options,
87
+ method: 'GET'
88
+ });
89
+ };
90
+ ;
91
+ export const getGetWorkflowCatalogIdUrl = (id) => {
92
+ return `/workflow/catalog/${id}`;
93
+ };
94
+ export const getWorkflowCatalogId = async (id, options) => {
95
+ return customFetchInstance(getGetWorkflowCatalogIdUrl(id), {
96
+ ...options,
97
+ method: 'GET'
98
+ });
99
+ };
100
+ ;
101
+ export const getGetWorkflowCatalogUrl = () => {
102
+ return `/workflow/catalog`;
103
+ };
104
+ export const getWorkflowCatalog = async (options) => {
105
+ return customFetchInstance(getGetWorkflowCatalogUrl(), {
106
+ ...options,
107
+ method: 'GET'
108
+ });
109
+ };
110
+ ;
111
+ export const getPostWorkflowIdFeedbackUrl = (id) => {
112
+ return `/workflow/${id}/feedback`;
113
+ };
114
+ export const postWorkflowIdFeedback = async (id, postWorkflowIdFeedbackBody, options) => {
115
+ return customFetchInstance(getPostWorkflowIdFeedbackUrl(id), {
116
+ ...options,
117
+ method: 'POST',
118
+ headers: { 'Content-Type': 'application/json', ...options?.headers },
119
+ body: JSON.stringify(postWorkflowIdFeedbackBody)
120
+ });
121
+ };
122
+ ;
123
+ export const getPostHeartbeatUrl = () => {
124
+ return `/heartbeat`;
125
+ };
126
+ export const postHeartbeat = async (options) => {
127
+ return customFetchInstance(getPostHeartbeatUrl(), {
128
+ ...options,
129
+ method: 'POST'
130
+ });
131
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Custom ky-based HTTP client for Orval-generated API
3
+ */
4
+ export declare const customFetchInstance: <T>(url: string, options: RequestInit & {
5
+ params?: Record<string, unknown>;
6
+ }) => Promise<T>;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Custom ky-based HTTP client for Orval-generated API
3
+ */
4
+ import ky from 'ky';
5
+ import { config } from '../config.js';
6
+ const api = ky.create({
7
+ prefixUrl: config.apiUrl,
8
+ timeout: config.requestTimeout,
9
+ retry: {
10
+ limit: 2,
11
+ methods: ['get', 'put', 'head', 'delete', 'options', 'trace'],
12
+ statusCodes: [408, 413, 429, 500, 502, 503, 504]
13
+ },
14
+ hooks: {
15
+ beforeRequest: [
16
+ request => {
17
+ // Add auth token if available
18
+ if (config.apiToken) {
19
+ request.headers.set('Authorization', `Basic ${config.apiToken}`);
20
+ }
21
+ }
22
+ ]
23
+ }
24
+ });
25
+ const stripLeadingSlash = (url) => url.startsWith('/') ? url.slice(1) : url;
26
+ const buildKyOptions = (options) => ({
27
+ method: options.method,
28
+ headers: options.headers,
29
+ searchParams: options.params,
30
+ body: options.body && options.method !== 'GET' ? options.body : undefined
31
+ });
32
+ const wrapResponse = (response, data) => ({
33
+ data,
34
+ status: response.status,
35
+ headers: response.headers
36
+ });
37
+ export const customFetchInstance = async (url, options) => {
38
+ const response = await api(stripLeadingSlash(url), buildKyOptions(options));
39
+ const data = await response.json().catch(() => undefined);
40
+ return wrapResponse(response, data);
41
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Orval post-generation hook to fix ES module imports by adding .js extensions.
3
+ * This is necessary because the SDK uses "type": "module" in package.json,
4
+ * which requires all relative imports to have explicit .js extensions.
5
+ */
6
+ export declare function fixEsmImports(outputPath: string): Promise<void>;
7
+ /**
8
+ * Run ESLint fix on generated files to ensure they follow project standards
9
+ */
10
+ export declare function runEslintFix(): Promise<void>;
@@ -0,0 +1,33 @@
1
+ import { readFileSync, writeFileSync } from 'fs';
2
+ import { execSync } from 'child_process';
3
+ /**
4
+ * Orval post-generation hook to fix ES module imports by adding .js extensions.
5
+ * This is necessary because the SDK uses "type": "module" in package.json,
6
+ * which requires all relative imports to have explicit .js extensions.
7
+ */
8
+ export async function fixEsmImports(outputPath) {
9
+ const content = readFileSync(outputPath, 'utf8');
10
+ const fixedContent = content.replace(/from '\.\.\/http_client'/g, 'from \'../http_client.js\'');
11
+ writeFileSync(outputPath, fixedContent, 'utf8');
12
+ console.log('✅ Fixed ESM imports in Orval generated file');
13
+ }
14
+ /**
15
+ * Run ESLint fix on generated files to ensure they follow project standards
16
+ */
17
+ export async function runEslintFix() {
18
+ try {
19
+ execSync('npx eslint --fix src/api/generated/api.ts', {
20
+ cwd: process.cwd(),
21
+ stdio: 'pipe' // Suppress output
22
+ });
23
+ console.log('✅ Applied ESLint fixes to generated file');
24
+ }
25
+ catch (error) {
26
+ if (error instanceof Error && 'status' in error && error.status === 1) {
27
+ console.log('✅ Applied ESLint fixes to generated file (with warnings)');
28
+ }
29
+ else {
30
+ console.warn('⚠️ ESLint fix encountered an issue:', error instanceof Error ? error.message : error);
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,17 @@
1
+ import type { Workflow } from './generated/api.js';
2
+ interface WorkflowParameter {
3
+ name: string;
4
+ type: string;
5
+ required: boolean;
6
+ description?: string;
7
+ }
8
+ interface ParsedWorkflow {
9
+ name: string;
10
+ description?: string;
11
+ inputs: WorkflowParameter[];
12
+ outputs: WorkflowParameter[];
13
+ }
14
+ export declare function parseWorkflowDefinition(workflow: Workflow): ParsedWorkflow;
15
+ export declare function formatParameterType(param: WorkflowParameter): string;
16
+ export declare function formatParameters(params: WorkflowParameter[]): string;
17
+ export {};
@@ -0,0 +1,71 @@
1
+ // json-schema-library is a CommonJS module that doesn't properly export named exports for ESM.
2
+ // We need to use the default import pattern and destructure from it.
3
+ import pkg from 'json-schema-library';
4
+ const { compileSchema, draft07 } = pkg;
5
+ function formatType(schema) {
6
+ if (!schema) {
7
+ return 'any';
8
+ }
9
+ if (schema.type === 'array') {
10
+ const itemsType = schema.items?.type || 'any';
11
+ return `array<${itemsType}>`;
12
+ }
13
+ return schema.type || 'any';
14
+ }
15
+ function processProperties(properties, prefix = '', requiredList = []) {
16
+ return Object.entries(properties).flatMap(([key, propSchema]) => {
17
+ const prop = propSchema;
18
+ const propName = prefix ? `${prefix}.${key}` : key;
19
+ if (prop.type === 'object' && prop.properties) {
20
+ const nestedRequired = prop.required || [];
21
+ return processProperties(prop.properties, propName, nestedRequired);
22
+ }
23
+ return {
24
+ name: propName,
25
+ type: formatType(prop),
26
+ required: requiredList.includes(key),
27
+ description: prop.description
28
+ };
29
+ });
30
+ }
31
+ function extractParametersFromSchema(schema) {
32
+ if (!schema) {
33
+ return [];
34
+ }
35
+ const schemaNode = compileSchema(schema, { drafts: [draft07] });
36
+ const compiledSchema = schemaNode.schema;
37
+ if (compiledSchema.type === 'object' && compiledSchema.properties) {
38
+ const required = compiledSchema.required || [];
39
+ return processProperties(compiledSchema.properties, '', required);
40
+ }
41
+ if (compiledSchema.type) {
42
+ return [{
43
+ name: 'value',
44
+ type: compiledSchema.type,
45
+ required: true,
46
+ description: compiledSchema.description
47
+ }];
48
+ }
49
+ return [];
50
+ }
51
+ export function parseWorkflowDefinition(workflow) {
52
+ return {
53
+ name: workflow.name,
54
+ description: workflow.description,
55
+ inputs: extractParametersFromSchema(workflow.inputSchema),
56
+ outputs: extractParametersFromSchema(workflow.outputSchema)
57
+ };
58
+ }
59
+ export function formatParameterType(param) {
60
+ const typeStr = param.type;
61
+ const reqStr = param.required ? '' : '?';
62
+ return `${typeStr}${reqStr}`;
63
+ }
64
+ export function formatParameters(params) {
65
+ if (params.length === 0) {
66
+ return 'none';
67
+ }
68
+ return params
69
+ .map(p => `${p.name}: ${formatParameterType(p)}`)
70
+ .join(', ');
71
+ }