@powerformer/refly-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/README.md +265 -0
- package/dist/bin/refly.d.ts +2 -0
- package/dist/bin/refly.js +12128 -0
- package/dist/bin/refly.js.map +1 -0
- package/dist/index.d.ts +637 -0
- package/dist/index.js +5037 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -0
- package/skill/SKILL.md +247 -0
- package/skill/references/api-errors.md +120 -0
- package/skill/references/node-types.md +91 -0
- package/skill/references/workflow-schema.md +95 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Builder session schema and types
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
declare const NodeSchema: z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
type: z.ZodString;
|
|
10
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
id: string;
|
|
14
|
+
type: string;
|
|
15
|
+
dependsOn: string[];
|
|
16
|
+
input: Record<string, unknown>;
|
|
17
|
+
}, {
|
|
18
|
+
id: string;
|
|
19
|
+
type: string;
|
|
20
|
+
dependsOn?: string[] | undefined;
|
|
21
|
+
input?: Record<string, unknown> | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
type WorkflowNode = z.infer<typeof NodeSchema>;
|
|
24
|
+
declare const WorkflowDraftSchema: z.ZodObject<{
|
|
25
|
+
name: z.ZodString;
|
|
26
|
+
description: z.ZodOptional<z.ZodString>;
|
|
27
|
+
nodes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
type: z.ZodString;
|
|
30
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
31
|
+
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
id: string;
|
|
34
|
+
type: string;
|
|
35
|
+
dependsOn: string[];
|
|
36
|
+
input: Record<string, unknown>;
|
|
37
|
+
}, {
|
|
38
|
+
id: string;
|
|
39
|
+
type: string;
|
|
40
|
+
dependsOn?: string[] | undefined;
|
|
41
|
+
input?: Record<string, unknown> | undefined;
|
|
42
|
+
}>, "many">>;
|
|
43
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
45
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, "strip", z.ZodTypeAny, {
|
|
47
|
+
tags?: string[] | undefined;
|
|
48
|
+
owner?: string | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
tags?: string[] | undefined;
|
|
51
|
+
owner?: string | undefined;
|
|
52
|
+
}>>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
name: string;
|
|
55
|
+
nodes: {
|
|
56
|
+
id: string;
|
|
57
|
+
type: string;
|
|
58
|
+
dependsOn: string[];
|
|
59
|
+
input: Record<string, unknown>;
|
|
60
|
+
}[];
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
metadata?: {
|
|
63
|
+
tags?: string[] | undefined;
|
|
64
|
+
owner?: string | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
name: string;
|
|
68
|
+
description?: string | undefined;
|
|
69
|
+
nodes?: {
|
|
70
|
+
id: string;
|
|
71
|
+
type: string;
|
|
72
|
+
dependsOn?: string[] | undefined;
|
|
73
|
+
input?: Record<string, unknown> | undefined;
|
|
74
|
+
}[] | undefined;
|
|
75
|
+
metadata?: {
|
|
76
|
+
tags?: string[] | undefined;
|
|
77
|
+
owner?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
type WorkflowDraft = z.infer<typeof WorkflowDraftSchema>;
|
|
81
|
+
declare const ValidationResultSchema: z.ZodObject<{
|
|
82
|
+
ok: z.ZodBoolean;
|
|
83
|
+
errors: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
84
|
+
code: z.ZodString;
|
|
85
|
+
message: z.ZodString;
|
|
86
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
87
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
code: string;
|
|
90
|
+
message: string;
|
|
91
|
+
nodeId?: string | undefined;
|
|
92
|
+
details?: Record<string, unknown> | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
code: string;
|
|
95
|
+
message: string;
|
|
96
|
+
nodeId?: string | undefined;
|
|
97
|
+
details?: Record<string, unknown> | undefined;
|
|
98
|
+
}>, "many">>;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
ok: boolean;
|
|
101
|
+
errors: {
|
|
102
|
+
code: string;
|
|
103
|
+
message: string;
|
|
104
|
+
nodeId?: string | undefined;
|
|
105
|
+
details?: Record<string, unknown> | undefined;
|
|
106
|
+
}[];
|
|
107
|
+
}, {
|
|
108
|
+
ok: boolean;
|
|
109
|
+
errors?: {
|
|
110
|
+
code: string;
|
|
111
|
+
message: string;
|
|
112
|
+
nodeId?: string | undefined;
|
|
113
|
+
details?: Record<string, unknown> | undefined;
|
|
114
|
+
}[] | undefined;
|
|
115
|
+
}>;
|
|
116
|
+
type ValidationResult = z.infer<typeof ValidationResultSchema>;
|
|
117
|
+
declare const BuilderState: {
|
|
118
|
+
readonly IDLE: "IDLE";
|
|
119
|
+
readonly DRAFT: "DRAFT";
|
|
120
|
+
readonly VALIDATED: "VALIDATED";
|
|
121
|
+
readonly COMMITTED: "COMMITTED";
|
|
122
|
+
readonly ABORTED: "ABORTED";
|
|
123
|
+
};
|
|
124
|
+
type BuilderStateType = (typeof BuilderState)[keyof typeof BuilderState];
|
|
125
|
+
declare const BuilderSessionSchema: z.ZodObject<{
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
128
|
+
state: z.ZodEnum<["IDLE", "DRAFT", "VALIDATED", "COMMITTED", "ABORTED"]>;
|
|
129
|
+
createdAt: z.ZodString;
|
|
130
|
+
updatedAt: z.ZodString;
|
|
131
|
+
workflowDraft: z.ZodObject<{
|
|
132
|
+
name: z.ZodString;
|
|
133
|
+
description: z.ZodOptional<z.ZodString>;
|
|
134
|
+
nodes: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
135
|
+
id: z.ZodString;
|
|
136
|
+
type: z.ZodString;
|
|
137
|
+
input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
138
|
+
dependsOn: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
id: string;
|
|
141
|
+
type: string;
|
|
142
|
+
dependsOn: string[];
|
|
143
|
+
input: Record<string, unknown>;
|
|
144
|
+
}, {
|
|
145
|
+
id: string;
|
|
146
|
+
type: string;
|
|
147
|
+
dependsOn?: string[] | undefined;
|
|
148
|
+
input?: Record<string, unknown> | undefined;
|
|
149
|
+
}>, "many">>;
|
|
150
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
151
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
152
|
+
owner: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
tags?: string[] | undefined;
|
|
155
|
+
owner?: string | undefined;
|
|
156
|
+
}, {
|
|
157
|
+
tags?: string[] | undefined;
|
|
158
|
+
owner?: string | undefined;
|
|
159
|
+
}>>;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
name: string;
|
|
162
|
+
nodes: {
|
|
163
|
+
id: string;
|
|
164
|
+
type: string;
|
|
165
|
+
dependsOn: string[];
|
|
166
|
+
input: Record<string, unknown>;
|
|
167
|
+
}[];
|
|
168
|
+
description?: string | undefined;
|
|
169
|
+
metadata?: {
|
|
170
|
+
tags?: string[] | undefined;
|
|
171
|
+
owner?: string | undefined;
|
|
172
|
+
} | undefined;
|
|
173
|
+
}, {
|
|
174
|
+
name: string;
|
|
175
|
+
description?: string | undefined;
|
|
176
|
+
nodes?: {
|
|
177
|
+
id: string;
|
|
178
|
+
type: string;
|
|
179
|
+
dependsOn?: string[] | undefined;
|
|
180
|
+
input?: Record<string, unknown> | undefined;
|
|
181
|
+
}[] | undefined;
|
|
182
|
+
metadata?: {
|
|
183
|
+
tags?: string[] | undefined;
|
|
184
|
+
owner?: string | undefined;
|
|
185
|
+
} | undefined;
|
|
186
|
+
}>;
|
|
187
|
+
validation: z.ZodDefault<z.ZodObject<{
|
|
188
|
+
ok: z.ZodBoolean;
|
|
189
|
+
errors: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
190
|
+
code: z.ZodString;
|
|
191
|
+
message: z.ZodString;
|
|
192
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
193
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
194
|
+
}, "strip", z.ZodTypeAny, {
|
|
195
|
+
code: string;
|
|
196
|
+
message: string;
|
|
197
|
+
nodeId?: string | undefined;
|
|
198
|
+
details?: Record<string, unknown> | undefined;
|
|
199
|
+
}, {
|
|
200
|
+
code: string;
|
|
201
|
+
message: string;
|
|
202
|
+
nodeId?: string | undefined;
|
|
203
|
+
details?: Record<string, unknown> | undefined;
|
|
204
|
+
}>, "many">>;
|
|
205
|
+
}, "strip", z.ZodTypeAny, {
|
|
206
|
+
ok: boolean;
|
|
207
|
+
errors: {
|
|
208
|
+
code: string;
|
|
209
|
+
message: string;
|
|
210
|
+
nodeId?: string | undefined;
|
|
211
|
+
details?: Record<string, unknown> | undefined;
|
|
212
|
+
}[];
|
|
213
|
+
}, {
|
|
214
|
+
ok: boolean;
|
|
215
|
+
errors?: {
|
|
216
|
+
code: string;
|
|
217
|
+
message: string;
|
|
218
|
+
nodeId?: string | undefined;
|
|
219
|
+
details?: Record<string, unknown> | undefined;
|
|
220
|
+
}[] | undefined;
|
|
221
|
+
}>>;
|
|
222
|
+
commit: z.ZodOptional<z.ZodObject<{
|
|
223
|
+
workflowId: z.ZodOptional<z.ZodString>;
|
|
224
|
+
committedAt: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, "strip", z.ZodTypeAny, {
|
|
226
|
+
workflowId?: string | undefined;
|
|
227
|
+
committedAt?: string | undefined;
|
|
228
|
+
}, {
|
|
229
|
+
workflowId?: string | undefined;
|
|
230
|
+
committedAt?: string | undefined;
|
|
231
|
+
}>>;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
id: string;
|
|
234
|
+
createdAt: string;
|
|
235
|
+
updatedAt: string;
|
|
236
|
+
version: number;
|
|
237
|
+
validation: {
|
|
238
|
+
ok: boolean;
|
|
239
|
+
errors: {
|
|
240
|
+
code: string;
|
|
241
|
+
message: string;
|
|
242
|
+
nodeId?: string | undefined;
|
|
243
|
+
details?: Record<string, unknown> | undefined;
|
|
244
|
+
}[];
|
|
245
|
+
};
|
|
246
|
+
state: "IDLE" | "DRAFT" | "VALIDATED" | "COMMITTED" | "ABORTED";
|
|
247
|
+
workflowDraft: {
|
|
248
|
+
name: string;
|
|
249
|
+
nodes: {
|
|
250
|
+
id: string;
|
|
251
|
+
type: string;
|
|
252
|
+
dependsOn: string[];
|
|
253
|
+
input: Record<string, unknown>;
|
|
254
|
+
}[];
|
|
255
|
+
description?: string | undefined;
|
|
256
|
+
metadata?: {
|
|
257
|
+
tags?: string[] | undefined;
|
|
258
|
+
owner?: string | undefined;
|
|
259
|
+
} | undefined;
|
|
260
|
+
};
|
|
261
|
+
commit?: {
|
|
262
|
+
workflowId?: string | undefined;
|
|
263
|
+
committedAt?: string | undefined;
|
|
264
|
+
} | undefined;
|
|
265
|
+
}, {
|
|
266
|
+
id: string;
|
|
267
|
+
createdAt: string;
|
|
268
|
+
updatedAt: string;
|
|
269
|
+
state: "IDLE" | "DRAFT" | "VALIDATED" | "COMMITTED" | "ABORTED";
|
|
270
|
+
workflowDraft: {
|
|
271
|
+
name: string;
|
|
272
|
+
description?: string | undefined;
|
|
273
|
+
nodes?: {
|
|
274
|
+
id: string;
|
|
275
|
+
type: string;
|
|
276
|
+
dependsOn?: string[] | undefined;
|
|
277
|
+
input?: Record<string, unknown> | undefined;
|
|
278
|
+
}[] | undefined;
|
|
279
|
+
metadata?: {
|
|
280
|
+
tags?: string[] | undefined;
|
|
281
|
+
owner?: string | undefined;
|
|
282
|
+
} | undefined;
|
|
283
|
+
};
|
|
284
|
+
commit?: {
|
|
285
|
+
workflowId?: string | undefined;
|
|
286
|
+
committedAt?: string | undefined;
|
|
287
|
+
} | undefined;
|
|
288
|
+
version?: number | undefined;
|
|
289
|
+
validation?: {
|
|
290
|
+
ok: boolean;
|
|
291
|
+
errors?: {
|
|
292
|
+
code: string;
|
|
293
|
+
message: string;
|
|
294
|
+
nodeId?: string | undefined;
|
|
295
|
+
details?: Record<string, unknown> | undefined;
|
|
296
|
+
}[] | undefined;
|
|
297
|
+
} | undefined;
|
|
298
|
+
}>;
|
|
299
|
+
type BuilderSession = z.infer<typeof BuilderSessionSchema>;
|
|
300
|
+
interface NodeDiff {
|
|
301
|
+
action: 'add' | 'update' | 'remove';
|
|
302
|
+
nodeId: string;
|
|
303
|
+
before?: WorkflowNode;
|
|
304
|
+
after?: WorkflowNode;
|
|
305
|
+
}
|
|
306
|
+
interface ConnectionDiff {
|
|
307
|
+
action: 'connect' | 'disconnect';
|
|
308
|
+
from: string;
|
|
309
|
+
to: string;
|
|
310
|
+
}
|
|
311
|
+
type Diff = NodeDiff | ConnectionDiff;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Unified output helpers for CLI commands.
|
|
315
|
+
* Supports multiple output formats: json, pretty, compact, plain.
|
|
316
|
+
* All CLI output MUST go through these functions.
|
|
317
|
+
*/
|
|
318
|
+
|
|
319
|
+
interface SuccessResponse<T = unknown> {
|
|
320
|
+
ok: true;
|
|
321
|
+
type: string;
|
|
322
|
+
version: string;
|
|
323
|
+
payload: T;
|
|
324
|
+
}
|
|
325
|
+
interface ErrorDetail {
|
|
326
|
+
code: string;
|
|
327
|
+
message: string;
|
|
328
|
+
details?: Record<string, unknown>;
|
|
329
|
+
hint?: string;
|
|
330
|
+
}
|
|
331
|
+
interface ErrorResponse {
|
|
332
|
+
ok: false;
|
|
333
|
+
type: 'error';
|
|
334
|
+
version: string;
|
|
335
|
+
error: ErrorDetail;
|
|
336
|
+
}
|
|
337
|
+
type CLIResponse<T = unknown> = SuccessResponse<T> | ErrorResponse;
|
|
338
|
+
/**
|
|
339
|
+
* Error codes used throughout the CLI
|
|
340
|
+
*/
|
|
341
|
+
declare const ErrorCodes: {
|
|
342
|
+
readonly AUTH_REQUIRED: "AUTH_REQUIRED";
|
|
343
|
+
readonly AUTH_INVALID: "AUTH_INVALID";
|
|
344
|
+
readonly AUTH_EXPIRED: "AUTH_EXPIRED";
|
|
345
|
+
readonly CLI_NOT_FOUND: "CLI_NOT_FOUND";
|
|
346
|
+
readonly CONFIG_ERROR: "CONFIG_ERROR";
|
|
347
|
+
readonly BUILDER_NOT_STARTED: "BUILDER_NOT_STARTED";
|
|
348
|
+
readonly BUILDER_ALREADY_STARTED: "BUILDER_ALREADY_STARTED";
|
|
349
|
+
readonly VALIDATION_REQUIRED: "VALIDATION_REQUIRED";
|
|
350
|
+
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
351
|
+
readonly DUPLICATE_NODE_ID: "DUPLICATE_NODE_ID";
|
|
352
|
+
readonly NODE_NOT_FOUND: "NODE_NOT_FOUND";
|
|
353
|
+
readonly CYCLE_DETECTED: "CYCLE_DETECTED";
|
|
354
|
+
readonly INVALID_STATE: "INVALID_STATE";
|
|
355
|
+
readonly WORKFLOW_NOT_FOUND: "WORKFLOW_NOT_FOUND";
|
|
356
|
+
readonly WORKFLOW_EXISTS: "WORKFLOW_EXISTS";
|
|
357
|
+
readonly RUN_NOT_FOUND: "RUN_NOT_FOUND";
|
|
358
|
+
readonly INVALID_NODE_TYPE: "INVALID_NODE_TYPE";
|
|
359
|
+
readonly INVALID_NODE_INPUT: "INVALID_NODE_INPUT";
|
|
360
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
361
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
362
|
+
readonly API_ERROR: "API_ERROR";
|
|
363
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
364
|
+
readonly CONFLICT: "CONFLICT";
|
|
365
|
+
readonly PERMISSION_DENIED: "PERMISSION_DENIED";
|
|
366
|
+
readonly INVALID_INPUT: "INVALID_INPUT";
|
|
367
|
+
readonly INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
368
|
+
};
|
|
369
|
+
type ErrorCode = (typeof ErrorCodes)[keyof typeof ErrorCodes];
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Custom error classes for CLI operations
|
|
373
|
+
*/
|
|
374
|
+
|
|
375
|
+
declare class CLIError extends Error {
|
|
376
|
+
readonly code: ErrorCode;
|
|
377
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
378
|
+
readonly hint?: string | undefined;
|
|
379
|
+
constructor(code: ErrorCode, message: string, details?: Record<string, unknown> | undefined, hint?: string | undefined);
|
|
380
|
+
}
|
|
381
|
+
declare class AuthError extends CLIError {
|
|
382
|
+
constructor(message: string, hint?: string);
|
|
383
|
+
}
|
|
384
|
+
declare class BuilderError extends CLIError {
|
|
385
|
+
}
|
|
386
|
+
declare class ValidationError extends CLIError {
|
|
387
|
+
constructor(message: string, details?: Record<string, unknown>);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Builder session persistence with atomic writes
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Create a new builder session
|
|
396
|
+
*/
|
|
397
|
+
declare function createSession(name: string, description?: string): BuilderSession;
|
|
398
|
+
/**
|
|
399
|
+
* Save session to disk atomically
|
|
400
|
+
*/
|
|
401
|
+
declare function saveSession(session: BuilderSession): void;
|
|
402
|
+
/**
|
|
403
|
+
* Load session from disk
|
|
404
|
+
*/
|
|
405
|
+
declare function loadSession(sessionId: string): BuilderSession | null;
|
|
406
|
+
/**
|
|
407
|
+
* Get current session (convenience function)
|
|
408
|
+
*/
|
|
409
|
+
declare function getCurrentSession(): BuilderSession | null;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* DAG validation for workflow drafts
|
|
413
|
+
*/
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Validate a workflow draft
|
|
417
|
+
*/
|
|
418
|
+
declare function validateDraft(session: BuilderSession): ValidationResult;
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Graph utilities for visualizing workflow DAG
|
|
422
|
+
*/
|
|
423
|
+
|
|
424
|
+
interface Edge {
|
|
425
|
+
from: string;
|
|
426
|
+
to: string;
|
|
427
|
+
}
|
|
428
|
+
interface GraphOutput {
|
|
429
|
+
nodes: Array<{
|
|
430
|
+
id: string;
|
|
431
|
+
type: string;
|
|
432
|
+
dependsOn: string[];
|
|
433
|
+
}>;
|
|
434
|
+
edges: Edge[];
|
|
435
|
+
stats: {
|
|
436
|
+
nodeCount: number;
|
|
437
|
+
edgeCount: number;
|
|
438
|
+
rootNodes: string[];
|
|
439
|
+
leafNodes: string[];
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Generate graph representation of the workflow
|
|
444
|
+
*/
|
|
445
|
+
declare function generateGraph(session: BuilderSession): GraphOutput;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Configuration management with atomic writes and secure permissions.
|
|
449
|
+
*/
|
|
450
|
+
|
|
451
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
452
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
453
|
+
auth: z.ZodOptional<z.ZodObject<{
|
|
454
|
+
method: z.ZodOptional<z.ZodEnum<["oauth", "apikey"]>>;
|
|
455
|
+
accessToken: z.ZodOptional<z.ZodString>;
|
|
456
|
+
refreshToken: z.ZodOptional<z.ZodString>;
|
|
457
|
+
expiresAt: z.ZodOptional<z.ZodString>;
|
|
458
|
+
provider: z.ZodOptional<z.ZodEnum<["google", "github"]>>;
|
|
459
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
460
|
+
apiKeyId: z.ZodOptional<z.ZodString>;
|
|
461
|
+
apiKeyName: z.ZodOptional<z.ZodString>;
|
|
462
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
463
|
+
uid: z.ZodString;
|
|
464
|
+
email: z.ZodString;
|
|
465
|
+
name: z.ZodOptional<z.ZodString>;
|
|
466
|
+
}, "strip", z.ZodTypeAny, {
|
|
467
|
+
uid: string;
|
|
468
|
+
email: string;
|
|
469
|
+
name?: string | undefined;
|
|
470
|
+
}, {
|
|
471
|
+
uid: string;
|
|
472
|
+
email: string;
|
|
473
|
+
name?: string | undefined;
|
|
474
|
+
}>>;
|
|
475
|
+
}, "strip", z.ZodTypeAny, {
|
|
476
|
+
method?: "oauth" | "apikey" | undefined;
|
|
477
|
+
accessToken?: string | undefined;
|
|
478
|
+
refreshToken?: string | undefined;
|
|
479
|
+
expiresAt?: string | undefined;
|
|
480
|
+
provider?: "google" | "github" | undefined;
|
|
481
|
+
apiKey?: string | undefined;
|
|
482
|
+
apiKeyId?: string | undefined;
|
|
483
|
+
apiKeyName?: string | undefined;
|
|
484
|
+
user?: {
|
|
485
|
+
uid: string;
|
|
486
|
+
email: string;
|
|
487
|
+
name?: string | undefined;
|
|
488
|
+
} | undefined;
|
|
489
|
+
}, {
|
|
490
|
+
method?: "oauth" | "apikey" | undefined;
|
|
491
|
+
accessToken?: string | undefined;
|
|
492
|
+
refreshToken?: string | undefined;
|
|
493
|
+
expiresAt?: string | undefined;
|
|
494
|
+
provider?: "google" | "github" | undefined;
|
|
495
|
+
apiKey?: string | undefined;
|
|
496
|
+
apiKeyId?: string | undefined;
|
|
497
|
+
apiKeyName?: string | undefined;
|
|
498
|
+
user?: {
|
|
499
|
+
uid: string;
|
|
500
|
+
email: string;
|
|
501
|
+
name?: string | undefined;
|
|
502
|
+
} | undefined;
|
|
503
|
+
}>>;
|
|
504
|
+
api: z.ZodOptional<z.ZodObject<{
|
|
505
|
+
endpoint: z.ZodDefault<z.ZodString>;
|
|
506
|
+
}, "strip", z.ZodTypeAny, {
|
|
507
|
+
endpoint: string;
|
|
508
|
+
}, {
|
|
509
|
+
endpoint?: string | undefined;
|
|
510
|
+
}>>;
|
|
511
|
+
skill: z.ZodOptional<z.ZodObject<{
|
|
512
|
+
installedVersion: z.ZodOptional<z.ZodString>;
|
|
513
|
+
installedAt: z.ZodOptional<z.ZodString>;
|
|
514
|
+
}, "strip", z.ZodTypeAny, {
|
|
515
|
+
installedVersion?: string | undefined;
|
|
516
|
+
installedAt?: string | undefined;
|
|
517
|
+
}, {
|
|
518
|
+
installedVersion?: string | undefined;
|
|
519
|
+
installedAt?: string | undefined;
|
|
520
|
+
}>>;
|
|
521
|
+
}, "strip", z.ZodTypeAny, {
|
|
522
|
+
version: number;
|
|
523
|
+
auth?: {
|
|
524
|
+
method?: "oauth" | "apikey" | undefined;
|
|
525
|
+
accessToken?: string | undefined;
|
|
526
|
+
refreshToken?: string | undefined;
|
|
527
|
+
expiresAt?: string | undefined;
|
|
528
|
+
provider?: "google" | "github" | undefined;
|
|
529
|
+
apiKey?: string | undefined;
|
|
530
|
+
apiKeyId?: string | undefined;
|
|
531
|
+
apiKeyName?: string | undefined;
|
|
532
|
+
user?: {
|
|
533
|
+
uid: string;
|
|
534
|
+
email: string;
|
|
535
|
+
name?: string | undefined;
|
|
536
|
+
} | undefined;
|
|
537
|
+
} | undefined;
|
|
538
|
+
api?: {
|
|
539
|
+
endpoint: string;
|
|
540
|
+
} | undefined;
|
|
541
|
+
skill?: {
|
|
542
|
+
installedVersion?: string | undefined;
|
|
543
|
+
installedAt?: string | undefined;
|
|
544
|
+
} | undefined;
|
|
545
|
+
}, {
|
|
546
|
+
version?: number | undefined;
|
|
547
|
+
auth?: {
|
|
548
|
+
method?: "oauth" | "apikey" | undefined;
|
|
549
|
+
accessToken?: string | undefined;
|
|
550
|
+
refreshToken?: string | undefined;
|
|
551
|
+
expiresAt?: string | undefined;
|
|
552
|
+
provider?: "google" | "github" | undefined;
|
|
553
|
+
apiKey?: string | undefined;
|
|
554
|
+
apiKeyId?: string | undefined;
|
|
555
|
+
apiKeyName?: string | undefined;
|
|
556
|
+
user?: {
|
|
557
|
+
uid: string;
|
|
558
|
+
email: string;
|
|
559
|
+
name?: string | undefined;
|
|
560
|
+
} | undefined;
|
|
561
|
+
} | undefined;
|
|
562
|
+
api?: {
|
|
563
|
+
endpoint?: string | undefined;
|
|
564
|
+
} | undefined;
|
|
565
|
+
skill?: {
|
|
566
|
+
installedVersion?: string | undefined;
|
|
567
|
+
installedAt?: string | undefined;
|
|
568
|
+
} | undefined;
|
|
569
|
+
}>;
|
|
570
|
+
type Config = z.infer<typeof ConfigSchema>;
|
|
571
|
+
/**
|
|
572
|
+
* Load configuration from file
|
|
573
|
+
*/
|
|
574
|
+
declare function loadConfig(): Config;
|
|
575
|
+
/**
|
|
576
|
+
* Save configuration atomically with secure permissions
|
|
577
|
+
*/
|
|
578
|
+
declare function saveConfig(config: Config): void;
|
|
579
|
+
/**
|
|
580
|
+
* Get the API endpoint (with override support)
|
|
581
|
+
*/
|
|
582
|
+
declare function getApiEndpoint(override?: string): string;
|
|
583
|
+
/**
|
|
584
|
+
* Check if authenticated (OAuth or API Key)
|
|
585
|
+
*/
|
|
586
|
+
declare function isAuthenticated(): boolean;
|
|
587
|
+
|
|
588
|
+
interface RequestOptions {
|
|
589
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
590
|
+
body?: unknown;
|
|
591
|
+
query?: Record<string, string>;
|
|
592
|
+
timeout?: number;
|
|
593
|
+
requireAuth?: boolean;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Make an authenticated API request with automatic token refresh (for OAuth)
|
|
597
|
+
* or API Key authentication
|
|
598
|
+
*/
|
|
599
|
+
declare function apiRequest<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
600
|
+
/**
|
|
601
|
+
* Verify API connection and authentication
|
|
602
|
+
*/
|
|
603
|
+
declare function verifyConnection(): Promise<{
|
|
604
|
+
connected: boolean;
|
|
605
|
+
authenticated: boolean;
|
|
606
|
+
authMethod?: 'oauth' | 'apikey';
|
|
607
|
+
user?: {
|
|
608
|
+
uid: string;
|
|
609
|
+
name?: string;
|
|
610
|
+
email?: string;
|
|
611
|
+
};
|
|
612
|
+
}>;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Skill installer - copies SKILL.md and references to Claude Code directories.
|
|
616
|
+
*/
|
|
617
|
+
interface InstallResult {
|
|
618
|
+
skillInstalled: boolean;
|
|
619
|
+
skillPath: string | null;
|
|
620
|
+
commandsInstalled: boolean;
|
|
621
|
+
commandsPath: string | null;
|
|
622
|
+
version: string;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Install skill files to Claude Code directories
|
|
626
|
+
*/
|
|
627
|
+
declare function installSkill(): InstallResult;
|
|
628
|
+
/**
|
|
629
|
+
* Check if skill is installed and up to date
|
|
630
|
+
*/
|
|
631
|
+
declare function isSkillInstalled(): {
|
|
632
|
+
installed: boolean;
|
|
633
|
+
upToDate: boolean;
|
|
634
|
+
currentVersion?: string;
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
export { AuthError, BuilderError, type BuilderSession, type BuilderStateType, CLIError, type CLIResponse, type Diff, ErrorCodes, type ErrorDetail, type ErrorResponse, type SuccessResponse, ValidationError, type ValidationResult, type WorkflowDraft, type WorkflowNode, apiRequest, createSession, generateGraph, getApiEndpoint, getCurrentSession, installSkill, isAuthenticated, isSkillInstalled, loadConfig, loadSession, saveConfig, saveSession, validateDraft, verifyConnection };
|