@kici-dev/sdk 0.0.0 → 0.1.1

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.
Files changed (112) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +1 -6
  3. package/dist/api-types.d.ts +47 -0
  4. package/dist/api-types.js +15 -0
  5. package/dist/chunk-gOLHoazu.js +4 -0
  6. package/dist/context.d.ts +185 -0
  7. package/dist/context.js +2 -0
  8. package/dist/dynamic-group.d.ts +29 -0
  9. package/dist/dynamic-group.js +34 -0
  10. package/dist/errors.d.ts +9 -0
  11. package/dist/errors.js +17 -0
  12. package/dist/events/define-event.d.ts +32 -0
  13. package/dist/events/define-event.js +29 -0
  14. package/dist/events/event-payloads.d.ts +396 -0
  15. package/dist/events/event-payloads.js +21 -0
  16. package/dist/events/index.d.ts +6 -0
  17. package/dist/events/index.js +4 -0
  18. package/dist/events/types.d.ts +13 -0
  19. package/dist/events/types.js +2 -0
  20. package/dist/fixture.d.ts +50 -0
  21. package/dist/fixture.js +35 -0
  22. package/dist/hooks/index.d.ts +33 -0
  23. package/dist/hooks/index.js +94 -0
  24. package/dist/hooks/types.d.ts +35 -0
  25. package/dist/hooks/types.js +2 -0
  26. package/dist/idempotent.d.ts +71 -0
  27. package/dist/idempotent.js +77 -0
  28. package/dist/index.d.ts +40 -0
  29. package/dist/index.js +50 -0
  30. package/dist/job.d.ts +31 -0
  31. package/dist/job.js +46 -0
  32. package/dist/matrix/expand.d.ts +32 -0
  33. package/dist/matrix/expand.js +77 -0
  34. package/dist/matrix/index.d.ts +4 -0
  35. package/dist/matrix/index.js +4 -0
  36. package/dist/matrix/types.d.ts +60 -0
  37. package/dist/matrix/types.js +18 -0
  38. package/dist/outputs.d.ts +86 -0
  39. package/dist/outputs.js +180 -0
  40. package/dist/rules/evaluator.d.ts +24 -0
  41. package/dist/rules/evaluator.js +52 -0
  42. package/dist/rules/index.d.ts +6 -0
  43. package/dist/rules/index.js +5 -0
  44. package/dist/rules/rule.d.ts +34 -0
  45. package/dist/rules/rule.js +37 -0
  46. package/dist/rules/types.d.ts +42 -0
  47. package/dist/rules/types.js +2 -0
  48. package/dist/secrets.d.ts +192 -0
  49. package/dist/secrets.js +132 -0
  50. package/dist/step.d.ts +50 -0
  51. package/dist/step.js +78 -0
  52. package/dist/triggers/comment.d.ts +20 -0
  53. package/dist/triggers/comment.js +47 -0
  54. package/dist/triggers/create.d.ts +20 -0
  55. package/dist/triggers/create.js +32 -0
  56. package/dist/triggers/delete.d.ts +20 -0
  57. package/dist/triggers/delete.js +29 -0
  58. package/dist/triggers/dispatch.d.ts +17 -0
  59. package/dist/triggers/dispatch.js +27 -0
  60. package/dist/triggers/fork.d.ts +17 -0
  61. package/dist/triggers/fork.js +26 -0
  62. package/dist/triggers/generic-webhook.d.ts +32 -0
  63. package/dist/triggers/generic-webhook.js +45 -0
  64. package/dist/triggers/index.d.ts +28 -0
  65. package/dist/triggers/index.js +25 -0
  66. package/dist/triggers/job-complete.d.ts +23 -0
  67. package/dist/triggers/job-complete.js +33 -0
  68. package/dist/triggers/kici-event.d.ts +23 -0
  69. package/dist/triggers/kici-event.js +34 -0
  70. package/dist/triggers/lifecycle.d.ts +20 -0
  71. package/dist/triggers/lifecycle.js +29 -0
  72. package/dist/triggers/pr.d.ts +27 -0
  73. package/dist/triggers/pr.js +48 -0
  74. package/dist/triggers/push.d.ts +29 -0
  75. package/dist/triggers/push.js +48 -0
  76. package/dist/triggers/release.d.ts +17 -0
  77. package/dist/triggers/release.js +27 -0
  78. package/dist/triggers/review-comment.d.ts +17 -0
  79. package/dist/triggers/review-comment.js +27 -0
  80. package/dist/triggers/review.d.ts +17 -0
  81. package/dist/triggers/review.js +28 -0
  82. package/dist/triggers/schedule.d.ts +20 -0
  83. package/dist/triggers/schedule.js +29 -0
  84. package/dist/triggers/star.d.ts +17 -0
  85. package/dist/triggers/star.js +27 -0
  86. package/dist/triggers/status.d.ts +17 -0
  87. package/dist/triggers/status.js +28 -0
  88. package/dist/triggers/tag.d.ts +20 -0
  89. package/dist/triggers/tag.js +31 -0
  90. package/dist/triggers/types.d.ts +529 -0
  91. package/dist/triggers/types.js +36 -0
  92. package/dist/triggers/watch.d.ts +17 -0
  93. package/dist/triggers/watch.js +27 -0
  94. package/dist/triggers/webhook.d.ts +19 -0
  95. package/dist/triggers/webhook.js +29 -0
  96. package/dist/triggers/workflow-complete.d.ts +23 -0
  97. package/dist/triggers/workflow-complete.js +32 -0
  98. package/dist/triggers/workflow-run.d.ts +17 -0
  99. package/dist/triggers/workflow-run.js +29 -0
  100. package/dist/types.d.ts +483 -0
  101. package/dist/types.js +35 -0
  102. package/dist/validation/dag.d.ts +42 -0
  103. package/dist/validation/dag.js +70 -0
  104. package/dist/validation/index.d.ts +3 -0
  105. package/dist/validation/index.js +3 -0
  106. package/dist/wait-for.d.ts +109 -0
  107. package/dist/wait-for.js +144 -0
  108. package/dist/workflow.d.ts +3 -0
  109. package/dist/workflow.js +83 -0
  110. package/package.json +42 -5
  111. package/sbom.spdx.json +9150 -0
  112. package/index.js +0 -3
@@ -0,0 +1,529 @@
1
+ /**
2
+ * Trigger types and interfaces for pr() and push() trigger helpers.
3
+ * Supports both glob patterns and regex patterns for branch/path matching.
4
+ */
5
+ /**
6
+ * Branch pattern - discriminated union supporting both glob and regex patterns.
7
+ * Glob patterns use micromatch syntax, regex patterns use standard JS regex.
8
+ */
9
+ export type BranchPattern = {
10
+ readonly type: 'glob';
11
+ readonly pattern: string;
12
+ } | {
13
+ readonly type: 'regex';
14
+ readonly pattern: string;
15
+ readonly flags?: string;
16
+ };
17
+ /**
18
+ * All supported GitHub PR event types.
19
+ */
20
+ export type PrEvent = 'opened' | 'synchronize' | 'reopened' | 'closed' | 'assigned' | 'unassigned' | 'labeled' | 'unlabeled' | 'edited' | 'converted_to_draft' | 'ready_for_review' | 'locked' | 'unlocked' | 'review_requested' | 'review_request_removed' | 'auto_merge_enabled' | 'auto_merge_disabled';
21
+ /**
22
+ * Default PR events when pr() is called without explicit events.
23
+ */
24
+ export declare const DEFAULT_PR_EVENTS: readonly PrEvent[];
25
+ /**
26
+ * Push event type (currently only 'push').
27
+ */
28
+ export type PushEvent = 'push';
29
+ /**
30
+ * Configuration for a PR trigger.
31
+ */
32
+ export interface PrTriggerConfig {
33
+ readonly _tag: 'PrTrigger';
34
+ readonly events: readonly PrEvent[];
35
+ readonly targetBranches: readonly BranchPattern[];
36
+ readonly sourceBranches: readonly BranchPattern[];
37
+ readonly paths: readonly string[];
38
+ readonly repos: readonly BranchPattern[];
39
+ readonly description?: string;
40
+ }
41
+ /**
42
+ * Configuration for a push trigger.
43
+ */
44
+ export interface PushTriggerConfig {
45
+ readonly _tag: 'PushTrigger';
46
+ readonly branches: readonly BranchPattern[];
47
+ readonly tags: readonly BranchPattern[];
48
+ readonly paths: readonly string[];
49
+ readonly repos: readonly BranchPattern[];
50
+ readonly description?: string;
51
+ }
52
+ /**
53
+ * Configuration for a tag trigger.
54
+ */
55
+ export interface TagTriggerConfig {
56
+ readonly _tag: 'TagTrigger';
57
+ readonly patterns: readonly BranchPattern[];
58
+ readonly repos: readonly BranchPattern[];
59
+ readonly description?: string;
60
+ }
61
+ /**
62
+ * Input configuration for tag() factory function.
63
+ */
64
+ export interface TagConfigInput {
65
+ readonly patterns?: string | RegExp | (string | RegExp)[];
66
+ readonly repos?: string | RegExp | (string | RegExp)[];
67
+ readonly description?: string;
68
+ }
69
+ export type CommentAction = 'created' | 'edited' | 'deleted';
70
+ export type CommentSource = 'issue' | 'pr';
71
+ /**
72
+ * Serialized body match pattern for comment triggers.
73
+ */
74
+ export type BodyMatchPattern = {
75
+ readonly type: 'glob';
76
+ readonly pattern: string;
77
+ } | {
78
+ readonly type: 'regex';
79
+ readonly pattern: string;
80
+ readonly flags?: string;
81
+ };
82
+ /**
83
+ * Configuration for a comment trigger (issue_comment / PR review comment).
84
+ */
85
+ export interface CommentTriggerConfig {
86
+ readonly _tag: 'CommentTrigger';
87
+ readonly actions: readonly CommentAction[];
88
+ readonly source?: CommentSource;
89
+ readonly bodyMatch?: BodyMatchPattern;
90
+ readonly repos: readonly BranchPattern[];
91
+ readonly description?: string;
92
+ }
93
+ /**
94
+ * Input configuration for comment() factory function.
95
+ */
96
+ export interface CommentConfigInput {
97
+ readonly actions?: CommentAction[];
98
+ readonly source?: CommentSource;
99
+ readonly bodyMatch?: string | RegExp;
100
+ readonly repos?: string | RegExp | (string | RegExp)[];
101
+ readonly description?: string;
102
+ }
103
+ export type ReviewAction = 'submitted' | 'edited' | 'dismissed';
104
+ export type ReviewState = 'approved' | 'changes_requested' | 'commented' | 'dismissed';
105
+ /**
106
+ * Configuration for a pull request review trigger.
107
+ */
108
+ export interface ReviewTriggerConfig {
109
+ readonly _tag: 'ReviewTrigger';
110
+ readonly actions: readonly ReviewAction[];
111
+ readonly states: readonly ReviewState[];
112
+ readonly repos: readonly BranchPattern[];
113
+ readonly description?: string;
114
+ }
115
+ /**
116
+ * Input configuration for review() factory function.
117
+ */
118
+ export interface ReviewConfigInput {
119
+ readonly actions?: ReviewAction[];
120
+ readonly states?: ReviewState[];
121
+ readonly repos?: string | RegExp | (string | RegExp)[];
122
+ readonly description?: string;
123
+ }
124
+ export type ReviewCommentAction = 'created' | 'edited' | 'deleted';
125
+ /**
126
+ * Configuration for a pull request review comment trigger.
127
+ */
128
+ export interface ReviewCommentTriggerConfig {
129
+ readonly _tag: 'ReviewCommentTrigger';
130
+ readonly actions: readonly ReviewCommentAction[];
131
+ readonly repos: readonly BranchPattern[];
132
+ readonly description?: string;
133
+ }
134
+ /**
135
+ * Input configuration for reviewComment() factory function.
136
+ */
137
+ export interface ReviewCommentConfigInput {
138
+ readonly actions?: ReviewCommentAction[];
139
+ readonly repos?: string | RegExp | (string | RegExp)[];
140
+ readonly description?: string;
141
+ }
142
+ export type ReleaseAction = 'published' | 'unpublished' | 'created' | 'edited' | 'deleted' | 'prereleased' | 'released';
143
+ /**
144
+ * Configuration for a release trigger.
145
+ */
146
+ export interface ReleaseTriggerConfig {
147
+ readonly _tag: 'ReleaseTrigger';
148
+ readonly actions: readonly ReleaseAction[];
149
+ readonly repos: readonly BranchPattern[];
150
+ readonly description?: string;
151
+ }
152
+ /**
153
+ * Input configuration for release() factory function.
154
+ */
155
+ export interface ReleaseConfigInput {
156
+ readonly actions?: ReleaseAction[];
157
+ readonly repos?: string | RegExp | (string | RegExp)[];
158
+ readonly description?: string;
159
+ }
160
+ /**
161
+ * Configuration for a repository_dispatch trigger.
162
+ */
163
+ export interface DispatchTriggerConfig {
164
+ readonly _tag: 'DispatchTrigger';
165
+ readonly types: readonly string[];
166
+ readonly repos: readonly BranchPattern[];
167
+ readonly description?: string;
168
+ }
169
+ /**
170
+ * Input configuration for dispatch() factory function.
171
+ */
172
+ export interface DispatchConfigInput {
173
+ readonly types?: string[];
174
+ readonly repos?: string | RegExp | (string | RegExp)[];
175
+ readonly description?: string;
176
+ }
177
+ export type RefType = 'branch' | 'tag';
178
+ /**
179
+ * Configuration for a create ref trigger.
180
+ */
181
+ export interface CreateTriggerConfig {
182
+ readonly _tag: 'CreateTrigger';
183
+ readonly refTypes: readonly RefType[];
184
+ readonly patterns: readonly BranchPattern[];
185
+ readonly repos: readonly BranchPattern[];
186
+ readonly description?: string;
187
+ }
188
+ /**
189
+ * Input configuration for create() factory function.
190
+ */
191
+ export interface CreateConfigInput {
192
+ readonly refTypes?: RefType[];
193
+ readonly patterns?: string | RegExp | (string | RegExp)[];
194
+ readonly repos?: string | RegExp | (string | RegExp)[];
195
+ readonly description?: string;
196
+ }
197
+ /**
198
+ * Configuration for a delete ref trigger.
199
+ */
200
+ export interface DeleteTriggerConfig {
201
+ readonly _tag: 'DeleteTrigger';
202
+ readonly refTypes: readonly RefType[];
203
+ readonly patterns: readonly BranchPattern[];
204
+ readonly repos: readonly BranchPattern[];
205
+ readonly description?: string;
206
+ }
207
+ /**
208
+ * Input configuration for delete() factory function.
209
+ */
210
+ export interface DeleteConfigInput {
211
+ readonly refTypes?: RefType[];
212
+ readonly patterns?: string | RegExp | (string | RegExp)[];
213
+ readonly repos?: string | RegExp | (string | RegExp)[];
214
+ readonly description?: string;
215
+ }
216
+ export type StatusState = 'error' | 'failure' | 'pending' | 'success';
217
+ /**
218
+ * Configuration for a commit status trigger.
219
+ */
220
+ export interface StatusTriggerConfig {
221
+ readonly _tag: 'StatusTrigger';
222
+ readonly contexts: readonly string[];
223
+ readonly states: readonly StatusState[];
224
+ readonly repos: readonly BranchPattern[];
225
+ readonly description?: string;
226
+ }
227
+ /**
228
+ * Input configuration for status() factory function.
229
+ */
230
+ export interface StatusConfigInput {
231
+ readonly contexts?: string[];
232
+ readonly states?: StatusState[];
233
+ readonly repos?: string | RegExp | (string | RegExp)[];
234
+ readonly description?: string;
235
+ }
236
+ export type WorkflowRunAction = 'requested' | 'completed' | 'in_progress';
237
+ /**
238
+ * Configuration for a workflow_run trigger.
239
+ */
240
+ export interface WorkflowRunTriggerConfig {
241
+ readonly _tag: 'WorkflowRunTrigger';
242
+ readonly actions: readonly WorkflowRunAction[];
243
+ readonly workflows: readonly string[];
244
+ readonly conclusions: readonly string[];
245
+ readonly repos: readonly BranchPattern[];
246
+ readonly description?: string;
247
+ }
248
+ /**
249
+ * Input configuration for workflowRun() factory function.
250
+ */
251
+ export interface WorkflowRunConfigInput {
252
+ readonly actions?: WorkflowRunAction[];
253
+ readonly workflows?: string[];
254
+ readonly conclusions?: string[];
255
+ readonly repos?: string | RegExp | (string | RegExp)[];
256
+ readonly description?: string;
257
+ }
258
+ /**
259
+ * Configuration for a fork trigger. No filter fields.
260
+ */
261
+ export interface ForkTriggerConfig {
262
+ readonly _tag: 'ForkTrigger';
263
+ readonly repos: readonly BranchPattern[];
264
+ readonly description?: string;
265
+ }
266
+ /**
267
+ * Input configuration for fork() factory function.
268
+ */
269
+ export interface ForkConfigInput {
270
+ readonly repos?: string | RegExp | (string | RegExp)[];
271
+ readonly description?: string;
272
+ }
273
+ export type StarAction = 'created' | 'deleted';
274
+ /**
275
+ * Configuration for a star trigger.
276
+ */
277
+ export interface StarTriggerConfig {
278
+ readonly _tag: 'StarTrigger';
279
+ readonly actions: readonly StarAction[];
280
+ readonly repos: readonly BranchPattern[];
281
+ readonly description?: string;
282
+ }
283
+ /**
284
+ * Input configuration for star() factory function.
285
+ */
286
+ export interface StarConfigInput {
287
+ readonly actions?: StarAction[];
288
+ readonly repos?: string | RegExp | (string | RegExp)[];
289
+ readonly description?: string;
290
+ }
291
+ export type WatchAction = 'started';
292
+ /**
293
+ * Configuration for a watch trigger.
294
+ */
295
+ export interface WatchTriggerConfig {
296
+ readonly _tag: 'WatchTrigger';
297
+ readonly actions: readonly WatchAction[];
298
+ readonly repos: readonly BranchPattern[];
299
+ readonly description?: string;
300
+ }
301
+ /**
302
+ * Input configuration for watch() factory function.
303
+ */
304
+ export interface WatchConfigInput {
305
+ readonly actions?: WatchAction[];
306
+ readonly repos?: string | RegExp | (string | RegExp)[];
307
+ readonly description?: string;
308
+ }
309
+ /**
310
+ * Input configuration for kiciEvent() factory function.
311
+ * `name` is required -- identifies the custom event to listen for.
312
+ */
313
+ export interface KiciEventConfigInput {
314
+ readonly name: string;
315
+ readonly match?: Record<string, unknown>;
316
+ readonly source?: string;
317
+ readonly not?: Record<string, unknown>;
318
+ readonly description?: string;
319
+ }
320
+ /**
321
+ * Configuration for a KiCI custom event trigger.
322
+ */
323
+ export interface KiciEventTriggerConfig {
324
+ readonly _tag: 'KiciEventTrigger';
325
+ readonly name: string;
326
+ readonly match?: Record<string, unknown>;
327
+ readonly source?: string;
328
+ readonly not?: Record<string, unknown>;
329
+ readonly description?: string;
330
+ }
331
+ /**
332
+ * Valid workflow completion statuses.
333
+ */
334
+ export type WorkflowCompleteStatus = 'success' | 'failed' | 'cancelled';
335
+ /**
336
+ * Input configuration for workflowComplete() factory function.
337
+ */
338
+ export interface WorkflowCompleteConfigInput {
339
+ readonly name?: string;
340
+ readonly status?: WorkflowCompleteStatus[];
341
+ readonly source?: string;
342
+ readonly description?: string;
343
+ }
344
+ /**
345
+ * Configuration for a workflow completion trigger.
346
+ */
347
+ export interface WorkflowCompleteTriggerConfig {
348
+ readonly _tag: 'WorkflowCompleteTrigger';
349
+ readonly name?: string;
350
+ readonly status?: readonly string[];
351
+ readonly source?: string;
352
+ readonly description?: string;
353
+ }
354
+ /**
355
+ * Valid job completion statuses.
356
+ */
357
+ export type JobCompleteStatus = 'success' | 'failed' | 'cancelled' | 'skipped';
358
+ /**
359
+ * Input configuration for jobComplete() factory function.
360
+ */
361
+ export interface JobCompleteConfigInput {
362
+ readonly workflow?: string;
363
+ readonly job?: string;
364
+ readonly status?: JobCompleteStatus[];
365
+ readonly source?: string;
366
+ readonly description?: string;
367
+ }
368
+ /**
369
+ * Configuration for a job completion trigger.
370
+ */
371
+ export interface JobCompleteTriggerConfig {
372
+ readonly _tag: 'JobCompleteTrigger';
373
+ readonly workflow?: string;
374
+ readonly job?: string;
375
+ readonly status?: readonly string[];
376
+ readonly source?: string;
377
+ readonly description?: string;
378
+ }
379
+ /**
380
+ * Auth method for generic webhook verification.
381
+ */
382
+ export type GenericWebhookAuthMethod = 'hmac-sha256' | 'api-key';
383
+ /**
384
+ * HMAC-SHA256 auth config for generic webhooks.
385
+ */
386
+ export interface GenericWebhookHmacAuth {
387
+ readonly method: 'hmac-sha256';
388
+ /** Name of the secret containing the HMAC signing key */
389
+ readonly secret: string;
390
+ /** Header containing the signature (e.g., 'x-hub-signature-256', 'stripe-signature') */
391
+ readonly signatureHeader: string;
392
+ }
393
+ /**
394
+ * API key auth config for generic webhooks.
395
+ */
396
+ export interface GenericWebhookApiKeyAuth {
397
+ readonly method: 'api-key';
398
+ /** Name of the secret containing the API key value */
399
+ readonly secret: string;
400
+ /** Header to check for the API key (defaults to 'authorization') */
401
+ readonly header?: string;
402
+ }
403
+ /**
404
+ * Union of generic webhook auth configurations.
405
+ */
406
+ export type GenericWebhookAuth = GenericWebhookHmacAuth | GenericWebhookApiKeyAuth;
407
+ /**
408
+ * Input configuration for genericWebhook() factory function.
409
+ * `source` is required -- identifies the webhook source.
410
+ */
411
+ export interface GenericWebhookConfigInput {
412
+ readonly source: string;
413
+ readonly events?: string[];
414
+ readonly match?: Record<string, unknown>;
415
+ readonly not?: Record<string, unknown>;
416
+ /** Auth configuration for webhook verification */
417
+ readonly auth?: GenericWebhookAuth;
418
+ /** URL path pattern (replaces source for URL matching; source becomes alias for path) */
419
+ readonly path?: string;
420
+ readonly description?: string;
421
+ }
422
+ /**
423
+ * Configuration for a generic webhook trigger.
424
+ */
425
+ export interface GenericWebhookTriggerConfig {
426
+ readonly _tag: 'GenericWebhookTrigger';
427
+ readonly source: string;
428
+ readonly events?: readonly string[];
429
+ readonly match?: Record<string, unknown>;
430
+ readonly not?: Record<string, unknown>;
431
+ readonly auth?: GenericWebhookAuth;
432
+ readonly path?: string;
433
+ readonly description?: string;
434
+ }
435
+ /**
436
+ * Input configuration for schedule() factory function.
437
+ */
438
+ export interface ScheduleConfigInput {
439
+ readonly cron: string;
440
+ readonly timezone?: string;
441
+ readonly description?: string;
442
+ }
443
+ /**
444
+ * Configuration for a schedule trigger.
445
+ */
446
+ export interface ScheduleTriggerConfig {
447
+ readonly _tag: 'ScheduleTrigger';
448
+ readonly cron: string;
449
+ readonly timezone: string;
450
+ readonly description?: string;
451
+ }
452
+ /**
453
+ * Lifecycle event types for cross-workflow orchestration.
454
+ */
455
+ export type LifecycleEvent = 'workflow_complete' | 'job_complete' | 'job_failed' | 'registration_updated';
456
+ /**
457
+ * Input configuration for lifecycle() factory function.
458
+ */
459
+ export interface LifecycleConfigInput {
460
+ readonly events: LifecycleEvent[];
461
+ readonly sources?: string[];
462
+ readonly description?: string;
463
+ }
464
+ /**
465
+ * Configuration for a lifecycle trigger.
466
+ */
467
+ export interface LifecycleTriggerConfig {
468
+ readonly _tag: 'LifecycleTrigger';
469
+ readonly events: readonly LifecycleEvent[];
470
+ readonly sources?: readonly string[];
471
+ readonly description?: string;
472
+ }
473
+ /**
474
+ * Configuration for a catch-all webhook trigger.
475
+ */
476
+ export interface WebhookTriggerConfig {
477
+ readonly _tag: 'WebhookTrigger';
478
+ readonly events: readonly string[];
479
+ readonly actions: readonly string[];
480
+ readonly repos: readonly BranchPattern[];
481
+ readonly description?: string;
482
+ }
483
+ /**
484
+ * Input configuration for webhook() factory function.
485
+ * `events` is required -- catch-all must specify what to catch.
486
+ */
487
+ export interface WebhookConfigInput {
488
+ readonly events: string[];
489
+ readonly actions?: string[];
490
+ readonly repos?: string | RegExp | (string | RegExp)[];
491
+ readonly description?: string;
492
+ }
493
+ /**
494
+ * Union type for all trigger configurations (21 types).
495
+ */
496
+ export type TriggerConfig = PrTriggerConfig | PushTriggerConfig | TagTriggerConfig | CommentTriggerConfig | ReviewTriggerConfig | ReviewCommentTriggerConfig | ReleaseTriggerConfig | DispatchTriggerConfig | CreateTriggerConfig | DeleteTriggerConfig | StatusTriggerConfig | WorkflowRunTriggerConfig | ForkTriggerConfig | StarTriggerConfig | WatchTriggerConfig | WebhookTriggerConfig | KiciEventTriggerConfig | WorkflowCompleteTriggerConfig | JobCompleteTriggerConfig | GenericWebhookTriggerConfig | ScheduleTriggerConfig | LifecycleTriggerConfig;
497
+ /**
498
+ * Input configuration for pr() factory function.
499
+ * All fields optional - sensible defaults applied.
500
+ */
501
+ export interface PrConfigInput {
502
+ readonly events?: PrEvent[];
503
+ readonly target?: string | RegExp | (string | RegExp)[];
504
+ readonly source?: string | RegExp | (string | RegExp)[];
505
+ readonly paths?: string[];
506
+ readonly repos?: string | RegExp | (string | RegExp)[];
507
+ readonly description?: string;
508
+ }
509
+ /**
510
+ * Input configuration for push() factory function.
511
+ * All fields optional - sensible defaults applied.
512
+ */
513
+ export interface PushConfigInput {
514
+ readonly branches?: string | RegExp | (string | RegExp)[];
515
+ readonly tags?: string | RegExp | (string | RegExp)[];
516
+ readonly paths?: string[];
517
+ readonly repos?: string | RegExp | (string | RegExp)[];
518
+ readonly description?: string;
519
+ }
520
+ /**
521
+ * Convert a string or RegExp to a BranchPattern.
522
+ * Strings become glob patterns, RegExp becomes regex patterns.
523
+ */
524
+ export declare function toBranchPattern(input: string | RegExp): BranchPattern;
525
+ /**
526
+ * Helper to normalize single value or array to array.
527
+ */
528
+ export declare function asArray<T>(value: T | T[]): T[];
529
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,36 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ //#region src/triggers/types.ts
3
+ /**
4
+ * Default PR events when pr() is called without explicit events.
5
+ */
6
+ const DEFAULT_PR_EVENTS = [
7
+ "opened",
8
+ "synchronize",
9
+ "reopened",
10
+ "closed"
11
+ ];
12
+ /**
13
+ * Convert a string or RegExp to a BranchPattern.
14
+ * Strings become glob patterns, RegExp becomes regex patterns.
15
+ */
16
+ function toBranchPattern(input) {
17
+ if (input instanceof RegExp) return {
18
+ type: "regex",
19
+ pattern: input.source,
20
+ flags: input.flags || void 0
21
+ };
22
+ return {
23
+ type: "glob",
24
+ pattern: input
25
+ };
26
+ }
27
+ /**
28
+ * Helper to normalize single value or array to array.
29
+ */
30
+ function asArray(value) {
31
+ return Array.isArray(value) ? value : [value];
32
+ }
33
+ //#endregion
34
+ export { DEFAULT_PR_EVENTS, asArray, toBranchPattern };
35
+
36
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Watch trigger helper - creates triggers for watch events.
3
+ * Returns a frozen WatchTriggerConfig directly.
4
+ */
5
+ import type { WatchConfigInput, WatchTriggerConfig } from './types.js';
6
+ /**
7
+ * Create a watch trigger configuration.
8
+ *
9
+ * @example
10
+ * // Match any watch event
11
+ * watch()
12
+ *
13
+ * // Match specific actions
14
+ * watch({ actions: ['started'] })
15
+ */
16
+ export declare function watch(config?: WatchConfigInput): WatchTriggerConfig;
17
+ //# sourceMappingURL=watch.d.ts.map
@@ -0,0 +1,27 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { asArray, toBranchPattern } from "./types.js";
3
+ //#region src/triggers/watch.ts
4
+ /**
5
+ * Create a watch trigger configuration.
6
+ *
7
+ * @example
8
+ * // Match any watch event
9
+ * watch()
10
+ *
11
+ * // Match specific actions
12
+ * watch({ actions: ['started'] })
13
+ */
14
+ function watch(config) {
15
+ const repos = config?.repos ? asArray(config.repos).map(toBranchPattern) : [];
16
+ const result = {
17
+ _tag: "WatchTrigger",
18
+ actions: Object.freeze(config?.actions ? [...config.actions] : []),
19
+ repos: Object.freeze([...repos]),
20
+ ...config?.description !== void 0 && { description: config.description }
21
+ };
22
+ return Object.freeze(result);
23
+ }
24
+ //#endregion
25
+ export { watch };
26
+
27
+ //# sourceMappingURL=watch.js.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Webhook trigger helper - catch-all trigger for any GitHub webhook event.
3
+ * Returns a frozen WebhookTriggerConfig directly.
4
+ *
5
+ * Unlike other triggers, `events` is required -- catch-all must specify what to catch.
6
+ */
7
+ import type { WebhookConfigInput, WebhookTriggerConfig } from './types.js';
8
+ /**
9
+ * Create a catch-all webhook trigger configuration.
10
+ *
11
+ * @example
12
+ * // Match deployment events
13
+ * webhook({ events: ['deployment'] })
14
+ *
15
+ * // Match multiple events with actions
16
+ * webhook({ events: ['deployment', 'deployment_status'], actions: ['created'] })
17
+ */
18
+ export declare function webhook(config: WebhookConfigInput): WebhookTriggerConfig;
19
+ //# sourceMappingURL=webhook.d.ts.map
@@ -0,0 +1,29 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { asArray, toBranchPattern } from "./types.js";
3
+ //#region src/triggers/webhook.ts
4
+ /**
5
+ * Create a catch-all webhook trigger configuration.
6
+ *
7
+ * @example
8
+ * // Match deployment events
9
+ * webhook({ events: ['deployment'] })
10
+ *
11
+ * // Match multiple events with actions
12
+ * webhook({ events: ['deployment', 'deployment_status'], actions: ['created'] })
13
+ */
14
+ function webhook(config) {
15
+ if (!config.events || config.events.length === 0) throw new Error("webhook() requires a non-empty events array");
16
+ const repos = config.repos ? asArray(config.repos).map(toBranchPattern) : [];
17
+ const result = {
18
+ _tag: "WebhookTrigger",
19
+ events: Object.freeze([...config.events]),
20
+ actions: Object.freeze(config.actions ? [...config.actions] : []),
21
+ repos: Object.freeze([...repos]),
22
+ ...config.description !== void 0 && { description: config.description }
23
+ };
24
+ return Object.freeze(result);
25
+ }
26
+ //#endregion
27
+ export { webhook };
28
+
29
+ //# sourceMappingURL=webhook.js.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Workflow complete trigger helper - creates triggers for workflow completion events.
3
+ * Returns a frozen WorkflowCompleteTriggerConfig directly.
4
+ */
5
+ import type { WorkflowCompleteConfigInput, WorkflowCompleteTriggerConfig } from './types.js';
6
+ /**
7
+ * Create a workflow completion trigger configuration.
8
+ *
9
+ * @example
10
+ * // Match any workflow completion
11
+ * workflowComplete()
12
+ *
13
+ * // Match specific workflow by name
14
+ * workflowComplete({ name: 'CI' })
15
+ *
16
+ * // Match successful completions only
17
+ * workflowComplete({ name: 'CI', status: ['success'] })
18
+ *
19
+ * // Cross-repo source filter
20
+ * workflowComplete({ name: 'CI', status: ['success'], source: 'org/repo' })
21
+ */
22
+ export declare function workflowComplete(config?: WorkflowCompleteConfigInput): WorkflowCompleteTriggerConfig;
23
+ //# sourceMappingURL=workflow-complete.d.ts.map