@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,132 @@
1
+ import "./chunk-gOLHoazu.js";
2
+ import { SecretNotFoundError } from "./errors.js";
3
+ //#region src/secrets.ts
4
+ /**
5
+ * Create a StepSecrets instance backed by a plain secrets map.
6
+ * The env parameter receives exposed secrets via expose().
7
+ * Tracks which secrets are accessed for audit/observability purposes.
8
+ *
9
+ * @param secretsMap - Flat key-value secrets map
10
+ * @param env - Process environment to inject exposed secrets into
11
+ * @param metaMap - Optional metadata map from resolveForJobWithMeta (backend + scope per key)
12
+ * @param fileWiring - Optional file-mount host adapter. When omitted, `mountFile`
13
+ * and `exposeFile` throw -- callers that don't wire a host can still use the
14
+ * string-only `get` / `expose` / `has` / `list` surface.
15
+ */
16
+ function createStepSecrets(secretsMap, env, metaMap, fileWiring) {
17
+ const accessed = /* @__PURE__ */ new Set();
18
+ const mountedKeys = /* @__PURE__ */ new Set();
19
+ const mountRecords = [];
20
+ function assertFileWiring(method) {
21
+ if (!fileWiring) throw new Error(`ctx.secrets.${method}() requires a file-mount host. The current secrets runtime did not wire one in (e.g. you may be running outside the agent or local-test mode).`);
22
+ return fileWiring;
23
+ }
24
+ async function buildContent(opts) {
25
+ const sources = opts.sources;
26
+ if (!Array.isArray(sources) || sources.length === 0) throw new Error("mountFile(): \"sources\" must be a non-empty array of secret keys");
27
+ const missing = [];
28
+ const parts = [];
29
+ for (const key of sources) {
30
+ if (!(key in secretsMap)) {
31
+ missing.push(key);
32
+ continue;
33
+ }
34
+ parts.push(secretsMap[key]);
35
+ }
36
+ if (missing.length > 0) {
37
+ const err = new SecretNotFoundError(missing[0], Object.keys(secretsMap));
38
+ if (missing.length > 1) err.message = `Secrets ${missing.map((k) => `"${k}"`).join(", ")} not found. Available keys: ${Object.keys(secretsMap).join(", ") || "(none)"}.`;
39
+ throw err;
40
+ }
41
+ for (const key of sources) {
42
+ accessed.add(key);
43
+ mountedKeys.add(key);
44
+ }
45
+ const divider = opts.divider ?? "";
46
+ return {
47
+ content: parts.join(divider),
48
+ sources: [...sources]
49
+ };
50
+ }
51
+ return {
52
+ secrets: {
53
+ async get(key) {
54
+ if (!(key in secretsMap)) throw new SecretNotFoundError(key, Object.keys(secretsMap));
55
+ accessed.add(key);
56
+ return secretsMap[key];
57
+ },
58
+ async expose(key) {
59
+ if (!(key in secretsMap)) throw new SecretNotFoundError(key, Object.keys(secretsMap));
60
+ accessed.add(key);
61
+ env[key] = secretsMap[key];
62
+ },
63
+ has(key) {
64
+ return key in secretsMap;
65
+ },
66
+ getMeta(key) {
67
+ if (!metaMap || !(key in metaMap)) return void 0;
68
+ return metaMap[key];
69
+ },
70
+ list() {
71
+ return Object.keys(secretsMap).sort();
72
+ },
73
+ async mountFile(opts) {
74
+ const wiring = assertFileWiring("mountFile");
75
+ const { content, sources } = await buildContent(opts);
76
+ const path = await wiring.host.writeMountedFile({
77
+ content,
78
+ sources,
79
+ mode: opts.mode ?? 384,
80
+ name: opts.name
81
+ });
82
+ mountRecords.push({
83
+ sources,
84
+ target: path,
85
+ kind: "mountFile"
86
+ });
87
+ return { path };
88
+ },
89
+ async exposeFile(envVar, opts) {
90
+ if (typeof envVar !== "string" || envVar.length === 0) throw new Error("exposeFile(): \"envVar\" must be a non-empty string");
91
+ const wiring = assertFileWiring("exposeFile");
92
+ const { content, sources } = await buildContent(opts);
93
+ const path = await wiring.host.writeMountedFile({
94
+ content,
95
+ sources,
96
+ mode: opts.mode ?? 384,
97
+ name: opts.name
98
+ });
99
+ env[envVar] = path;
100
+ wiring.host.trackExposedEnv(envVar);
101
+ mountRecords.push({
102
+ sources,
103
+ target: path,
104
+ envVar,
105
+ kind: "exposeFile"
106
+ });
107
+ return { path };
108
+ },
109
+ getAccessLog() {
110
+ return [...accessed].sort();
111
+ },
112
+ getMountedKeys() {
113
+ return [...mountedKeys].sort();
114
+ },
115
+ getMountRecords() {
116
+ return mountRecords;
117
+ }
118
+ },
119
+ dispose: async () => {
120
+ if (!fileWiring) return;
121
+ try {
122
+ await fileWiring.cleanup();
123
+ } catch (err) {
124
+ fileWiring.onDisposeError?.(err);
125
+ }
126
+ }
127
+ };
128
+ }
129
+ //#endregion
130
+ export { createStepSecrets };
131
+
132
+ //# sourceMappingURL=secrets.js.map
package/dist/step.d.ts ADDED
@@ -0,0 +1,50 @@
1
+ import type { Step, StepOptions, StepRunFn } from './types.js';
2
+ /**
3
+ * Create an id-less step with just a run function.
4
+ * The compiler assigns a counter-based ID (step-1, step-2, etc.) at lock file generation.
5
+ *
6
+ * @example
7
+ * const s = step(async (ctx) => {
8
+ * await ctx.$`echo hello`;
9
+ * });
10
+ */
11
+ export declare function step<TResult = void>(run: (ctx: import('./context.js').StepContext) => Promise<TResult>): Step<TResult>;
12
+ /**
13
+ * Create an id-less step with full options.
14
+ * The compiler assigns a counter-based ID at lock file generation.
15
+ *
16
+ * @example
17
+ * const s = step({
18
+ * run: async (ctx) => {
19
+ * return { version: '1.0.0' };
20
+ * },
21
+ * timeout: 60000,
22
+ * });
23
+ */
24
+ export declare function step<TResult = void>(options: StepOptions<TResult>): Step<TResult>;
25
+ /**
26
+ * Create a named step with just a run function (no outputs).
27
+ *
28
+ * @example
29
+ * const checkout = step('checkout', async (ctx) => {
30
+ * await ctx.$`git checkout`;
31
+ * });
32
+ */
33
+ export declare function step(name: string, run: StepRunFn): Step<void>;
34
+ /**
35
+ * Create a named step with full options and generic return type.
36
+ *
37
+ * @example
38
+ * const build = step('build', {
39
+ * outputs: {
40
+ * version: z.string(),
41
+ * artifacts: z.array(z.string()),
42
+ * },
43
+ * run: async (ctx) => {
44
+ * await ctx.$`pnpm build`;
45
+ * return { version: '1.0.0', artifacts: ['dist/main.js'] };
46
+ * }
47
+ * });
48
+ */
49
+ export declare function step<TResult = void>(name: string, options: StepOptions<TResult>): Step<TResult>;
50
+ //# sourceMappingURL=step.d.ts.map
package/dist/step.js ADDED
@@ -0,0 +1,78 @@
1
+ import "./chunk-gOLHoazu.js";
2
+ import { createStepOutputProxy } from "./outputs.js";
3
+ //#region src/step.ts
4
+ /**
5
+ * Capture the call-site source location of step() using the V8 stack trace API.
6
+ * Uses Error.captureStackTrace with the `step` function as the constructor argument
7
+ * so the stack starts from step()'s caller.
8
+ *
9
+ * @returns SourceLocation or undefined if parsing fails
10
+ */
11
+ function captureCallSite() {
12
+ const originalLimit = Error.stackTraceLimit;
13
+ try {
14
+ Error.stackTraceLimit = 4;
15
+ const err = {};
16
+ Error.captureStackTrace(err, captureCallSite);
17
+ const stack = err.stack;
18
+ if (!stack) return void 0;
19
+ const lines = stack.split("\n");
20
+ for (let i = 2; i < lines.length; i++) {
21
+ const line = lines[i].trim();
22
+ const match = line.match(/\((.+):(\d+):(\d+)\)$/) || line.match(/^at (.+):(\d+):(\d+)$/);
23
+ if (match) {
24
+ let file = match[1];
25
+ if (file.startsWith("file://")) file = file.slice(7);
26
+ return {
27
+ file,
28
+ line: parseInt(match[2], 10),
29
+ column: parseInt(match[3], 10)
30
+ };
31
+ }
32
+ }
33
+ return;
34
+ } catch {
35
+ return;
36
+ } finally {
37
+ Error.stackTraceLimit = originalLimit;
38
+ }
39
+ }
40
+ /**
41
+ * Implementation of step() factory.
42
+ * Discriminates overloads by first arg type:
43
+ * - string => named variant (existing)
44
+ * - function => id-less simple (wrap as { run: fn }, name = '')
45
+ * - object => id-less full options (name = '')
46
+ */
47
+ function step(nameOrRunOrOptions, runOrOptions) {
48
+ const _sourceLocation = captureCallSite();
49
+ let name;
50
+ let options;
51
+ if (typeof nameOrRunOrOptions === "string") {
52
+ name = nameOrRunOrOptions;
53
+ options = typeof runOrOptions === "function" ? { run: runOrOptions } : runOrOptions;
54
+ } else if (typeof nameOrRunOrOptions === "function") {
55
+ name = "";
56
+ options = { run: nameOrRunOrOptions };
57
+ } else {
58
+ name = "";
59
+ options = nameOrRunOrOptions;
60
+ }
61
+ return {
62
+ _tag: "Step",
63
+ name,
64
+ outputs: options.outputs,
65
+ run: options.run,
66
+ continueOnError: options.continueOnError,
67
+ timeout: options.timeout,
68
+ rules: options.rules,
69
+ onCancel: options.onCancel,
70
+ cleanup: options.cleanup,
71
+ _sourceLocation,
72
+ result: createStepOutputProxy(name)
73
+ };
74
+ }
75
+ //#endregion
76
+ export { step };
77
+
78
+ //# sourceMappingURL=step.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Comment trigger helper - creates triggers for issue/PR comment events.
3
+ * Returns a frozen CommentTriggerConfig directly.
4
+ */
5
+ import type { CommentConfigInput, CommentTriggerConfig } from './types.js';
6
+ /**
7
+ * Create a comment trigger configuration.
8
+ *
9
+ * @example
10
+ * // Match any comment
11
+ * comment()
12
+ *
13
+ * // Match deploy commands
14
+ * comment({ bodyMatch: '/deploy' })
15
+ *
16
+ * // Match with regex
17
+ * comment({ bodyMatch: /^\/deploy/i, source: 'pr' })
18
+ */
19
+ export declare function comment(config?: CommentConfigInput): CommentTriggerConfig;
20
+ //# sourceMappingURL=comment.d.ts.map
@@ -0,0 +1,47 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { asArray, toBranchPattern } from "./types.js";
3
+ //#region src/triggers/comment.ts
4
+ /**
5
+ * Convert a string or RegExp to a BodyMatchPattern.
6
+ * Strings become glob patterns, RegExp becomes regex patterns.
7
+ */
8
+ function toBodyMatchPattern(input) {
9
+ if (input instanceof RegExp) return {
10
+ type: "regex",
11
+ pattern: input.source,
12
+ flags: input.flags || void 0
13
+ };
14
+ return {
15
+ type: "glob",
16
+ pattern: input
17
+ };
18
+ }
19
+ /**
20
+ * Create a comment trigger configuration.
21
+ *
22
+ * @example
23
+ * // Match any comment
24
+ * comment()
25
+ *
26
+ * // Match deploy commands
27
+ * comment({ bodyMatch: '/deploy' })
28
+ *
29
+ * // Match with regex
30
+ * comment({ bodyMatch: /^\/deploy/i, source: 'pr' })
31
+ */
32
+ function comment(config) {
33
+ const repos = config?.repos ? asArray(config.repos).map(toBranchPattern) : [];
34
+ const result = {
35
+ _tag: "CommentTrigger",
36
+ actions: Object.freeze(config?.actions ? [...config.actions] : []),
37
+ ...config?.source !== void 0 && { source: config.source },
38
+ ...config?.bodyMatch !== void 0 && { bodyMatch: toBodyMatchPattern(config.bodyMatch) },
39
+ repos: Object.freeze([...repos]),
40
+ ...config?.description !== void 0 && { description: config.description }
41
+ };
42
+ return Object.freeze(result);
43
+ }
44
+ //#endregion
45
+ export { comment };
46
+
47
+ //# sourceMappingURL=comment.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Create trigger helper - creates triggers for ref creation events (branches/tags).
3
+ * Returns a frozen CreateTriggerConfig directly.
4
+ */
5
+ import type { CreateConfigInput, CreateTriggerConfig } from './types.js';
6
+ /**
7
+ * Create a ref creation trigger configuration.
8
+ *
9
+ * @example
10
+ * // Match any ref creation
11
+ * create()
12
+ *
13
+ * // Match tag creation with patterns
14
+ * create({ refTypes: ['tag'], patterns: ['v*'] })
15
+ *
16
+ * // Match branch creation
17
+ * create({ refTypes: ['branch'], patterns: ['release/*'] })
18
+ */
19
+ export declare function create(config?: CreateConfigInput): CreateTriggerConfig;
20
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1,32 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { asArray, toBranchPattern } from "./types.js";
3
+ //#region src/triggers/create.ts
4
+ /**
5
+ * Create a ref creation trigger configuration.
6
+ *
7
+ * @example
8
+ * // Match any ref creation
9
+ * create()
10
+ *
11
+ * // Match tag creation with patterns
12
+ * create({ refTypes: ['tag'], patterns: ['v*'] })
13
+ *
14
+ * // Match branch creation
15
+ * create({ refTypes: ['branch'], patterns: ['release/*'] })
16
+ */
17
+ function create(config) {
18
+ const patterns = config?.patterns ? asArray(config.patterns).map(toBranchPattern) : [];
19
+ const repos = config?.repos ? asArray(config.repos).map(toBranchPattern) : [];
20
+ const result = {
21
+ _tag: "CreateTrigger",
22
+ refTypes: Object.freeze(config?.refTypes ? [...config.refTypes] : []),
23
+ patterns: Object.freeze([...patterns]),
24
+ repos: Object.freeze([...repos]),
25
+ ...config?.description !== void 0 && { description: config.description }
26
+ };
27
+ return Object.freeze(result);
28
+ }
29
+ //#endregion
30
+ export { create };
31
+
32
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Delete trigger helper - creates triggers for ref deletion events (branches/tags).
3
+ * Returns a frozen DeleteTriggerConfig directly.
4
+ *
5
+ * Note: `delete` is a reserved word in JavaScript, so the internal function
6
+ * is named `del` and re-exported as `delete` from index.ts.
7
+ */
8
+ import type { DeleteConfigInput, DeleteTriggerConfig } from './types.js';
9
+ /**
10
+ * Create a ref deletion trigger configuration.
11
+ *
12
+ * @example
13
+ * // Match any ref deletion
14
+ * del()
15
+ *
16
+ * // Match tag deletion
17
+ * del({ refTypes: ['tag'], patterns: ['v*'] })
18
+ */
19
+ export declare function del(config?: DeleteConfigInput): DeleteTriggerConfig;
20
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1,29 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { asArray, toBranchPattern } from "./types.js";
3
+ //#region src/triggers/delete.ts
4
+ /**
5
+ * Create a ref deletion trigger configuration.
6
+ *
7
+ * @example
8
+ * // Match any ref deletion
9
+ * del()
10
+ *
11
+ * // Match tag deletion
12
+ * del({ refTypes: ['tag'], patterns: ['v*'] })
13
+ */
14
+ function del(config) {
15
+ const patterns = config?.patterns ? asArray(config.patterns).map(toBranchPattern) : [];
16
+ const repos = config?.repos ? asArray(config.repos).map(toBranchPattern) : [];
17
+ const result = {
18
+ _tag: "DeleteTrigger",
19
+ refTypes: Object.freeze(config?.refTypes ? [...config.refTypes] : []),
20
+ patterns: Object.freeze([...patterns]),
21
+ repos: Object.freeze([...repos]),
22
+ ...config?.description !== void 0 && { description: config.description }
23
+ };
24
+ return Object.freeze(result);
25
+ }
26
+ //#endregion
27
+ export { del };
28
+
29
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Dispatch trigger helper - creates triggers for repository_dispatch events.
3
+ * Returns a frozen DispatchTriggerConfig directly.
4
+ */
5
+ import type { DispatchConfigInput, DispatchTriggerConfig } from './types.js';
6
+ /**
7
+ * Create a repository dispatch trigger configuration.
8
+ *
9
+ * @example
10
+ * // Match any dispatch event
11
+ * dispatch()
12
+ *
13
+ * // Match specific event types
14
+ * dispatch({ types: ['deploy', 'rollback'] })
15
+ */
16
+ export declare function dispatch(config?: DispatchConfigInput): DispatchTriggerConfig;
17
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -0,0 +1,27 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { asArray, toBranchPattern } from "./types.js";
3
+ //#region src/triggers/dispatch.ts
4
+ /**
5
+ * Create a repository dispatch trigger configuration.
6
+ *
7
+ * @example
8
+ * // Match any dispatch event
9
+ * dispatch()
10
+ *
11
+ * // Match specific event types
12
+ * dispatch({ types: ['deploy', 'rollback'] })
13
+ */
14
+ function dispatch(config) {
15
+ const repos = config?.repos ? asArray(config.repos).map(toBranchPattern) : [];
16
+ const result = {
17
+ _tag: "DispatchTrigger",
18
+ types: Object.freeze(config?.types ? [...config.types] : []),
19
+ repos: Object.freeze([...repos]),
20
+ ...config?.description !== void 0 && { description: config.description }
21
+ };
22
+ return Object.freeze(result);
23
+ }
24
+ //#endregion
25
+ export { dispatch };
26
+
27
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Fork trigger helper - creates triggers for fork events.
3
+ * Returns a frozen ForkTriggerConfig directly.
4
+ */
5
+ import type { ForkConfigInput, ForkTriggerConfig } from './types.js';
6
+ /**
7
+ * Create a fork trigger configuration. No filter fields.
8
+ *
9
+ * @example
10
+ * // Match any fork event
11
+ * fork()
12
+ *
13
+ * // With description
14
+ * fork({ description: 'Track repository forks' })
15
+ */
16
+ export declare function fork(config?: ForkConfigInput): ForkTriggerConfig;
17
+ //# sourceMappingURL=fork.d.ts.map
@@ -0,0 +1,26 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { asArray, toBranchPattern } from "./types.js";
3
+ //#region src/triggers/fork.ts
4
+ /**
5
+ * Create a fork trigger configuration. No filter fields.
6
+ *
7
+ * @example
8
+ * // Match any fork event
9
+ * fork()
10
+ *
11
+ * // With description
12
+ * fork({ description: 'Track repository forks' })
13
+ */
14
+ function fork(config) {
15
+ const repos = config?.repos ? asArray(config.repos).map(toBranchPattern) : [];
16
+ const result = {
17
+ _tag: "ForkTrigger",
18
+ repos: Object.freeze([...repos]),
19
+ ...config?.description !== void 0 && { description: config.description }
20
+ };
21
+ return Object.freeze(result);
22
+ }
23
+ //#endregion
24
+ export { fork };
25
+
26
+ //# sourceMappingURL=fork.js.map
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Generic webhook trigger helper - creates triggers for non-GitHub webhook sources.
3
+ * Returns a frozen GenericWebhookTriggerConfig directly.
4
+ */
5
+ import type { GenericWebhookConfigInput, GenericWebhookTriggerConfig } from './types.js';
6
+ /**
7
+ * Create a generic webhook trigger configuration.
8
+ *
9
+ * @example
10
+ * // Match any event from a source
11
+ * genericWebhook({ source: 'my-service' })
12
+ *
13
+ * // Match specific event types
14
+ * genericWebhook({ source: 'my-service', events: ['deploy', 'rollback'] })
15
+ *
16
+ * // With JSONPath payload matching
17
+ * genericWebhook({ source: 'my-service', events: ['deploy'], match: { '$.env': 'prod' } })
18
+ *
19
+ * // With negative filter
20
+ * genericWebhook({ source: 'my-service', not: { '$.dry_run': true } })
21
+ *
22
+ * // With HMAC-SHA256 auth
23
+ * genericWebhook({ source: 'stripe', auth: { method: 'hmac-sha256', secret: 'stripe-key', signatureHeader: 'stripe-signature' } })
24
+ *
25
+ * // With API key auth
26
+ * genericWebhook({ source: 'slack', auth: { method: 'api-key', secret: 'slack-token' } })
27
+ *
28
+ * // With path pattern
29
+ * genericWebhook({ source: 'stripe', path: 'stripe/payments' })
30
+ */
31
+ export declare function genericWebhook(config: GenericWebhookConfigInput): GenericWebhookTriggerConfig;
32
+ //# sourceMappingURL=generic-webhook.d.ts.map
@@ -0,0 +1,45 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ //#region src/triggers/generic-webhook.ts
3
+ /**
4
+ * Create a generic webhook trigger configuration.
5
+ *
6
+ * @example
7
+ * // Match any event from a source
8
+ * genericWebhook({ source: 'my-service' })
9
+ *
10
+ * // Match specific event types
11
+ * genericWebhook({ source: 'my-service', events: ['deploy', 'rollback'] })
12
+ *
13
+ * // With JSONPath payload matching
14
+ * genericWebhook({ source: 'my-service', events: ['deploy'], match: { '$.env': 'prod' } })
15
+ *
16
+ * // With negative filter
17
+ * genericWebhook({ source: 'my-service', not: { '$.dry_run': true } })
18
+ *
19
+ * // With HMAC-SHA256 auth
20
+ * genericWebhook({ source: 'stripe', auth: { method: 'hmac-sha256', secret: 'stripe-key', signatureHeader: 'stripe-signature' } })
21
+ *
22
+ * // With API key auth
23
+ * genericWebhook({ source: 'slack', auth: { method: 'api-key', secret: 'slack-token' } })
24
+ *
25
+ * // With path pattern
26
+ * genericWebhook({ source: 'stripe', path: 'stripe/payments' })
27
+ */
28
+ function genericWebhook(config) {
29
+ if (!config.source || config.source.trim() === "") throw new Error("genericWebhook() requires a non-empty source");
30
+ const result = {
31
+ _tag: "GenericWebhookTrigger",
32
+ source: config.source,
33
+ ...config.events !== void 0 && { events: Object.freeze([...config.events]) },
34
+ ...config.match !== void 0 && { match: Object.freeze({ ...config.match }) },
35
+ ...config.not !== void 0 && { not: Object.freeze({ ...config.not }) },
36
+ ...config.auth !== void 0 && { auth: Object.freeze({ ...config.auth }) },
37
+ ...config.path !== void 0 && { path: config.path },
38
+ ...config.description !== void 0 && { description: config.description }
39
+ };
40
+ return Object.freeze(result);
41
+ }
42
+ //#endregion
43
+ export { genericWebhook };
44
+
45
+ //# sourceMappingURL=generic-webhook.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Trigger helpers for defining when workflows run.
3
+ */
4
+ export { pr } from './pr.js';
5
+ export { push } from './push.js';
6
+ export { tag } from './tag.js';
7
+ export { comment } from './comment.js';
8
+ export { review } from './review.js';
9
+ export { reviewComment } from './review-comment.js';
10
+ export { release } from './release.js';
11
+ export { dispatch } from './dispatch.js';
12
+ export { create } from './create.js';
13
+ export { del as delete } from './delete.js';
14
+ export { status } from './status.js';
15
+ export { workflowRun } from './workflow-run.js';
16
+ export { fork } from './fork.js';
17
+ export { star } from './star.js';
18
+ export { watch } from './watch.js';
19
+ export { webhook } from './webhook.js';
20
+ export { kiciEvent } from './kici-event.js';
21
+ export { workflowComplete } from './workflow-complete.js';
22
+ export { jobComplete } from './job-complete.js';
23
+ export { genericWebhook } from './generic-webhook.js';
24
+ export { schedule } from './schedule.js';
25
+ export { lifecycle } from './lifecycle.js';
26
+ export type { BranchPattern, BodyMatchPattern, PrEvent, PushEvent, PrTriggerConfig, PushTriggerConfig, TagTriggerConfig, CommentTriggerConfig, ReviewTriggerConfig, ReviewCommentTriggerConfig, ReleaseTriggerConfig, DispatchTriggerConfig, CreateTriggerConfig, DeleteTriggerConfig, StatusTriggerConfig, WorkflowRunTriggerConfig, ForkTriggerConfig, StarTriggerConfig, WatchTriggerConfig, WebhookTriggerConfig, TriggerConfig, PrConfigInput, PushConfigInput, TagConfigInput, CommentConfigInput, CommentAction, CommentSource, ReviewConfigInput, ReviewAction, ReviewState, ReviewCommentConfigInput, ReviewCommentAction, ReleaseConfigInput, ReleaseAction, DispatchConfigInput, CreateConfigInput, DeleteConfigInput, RefType, StatusConfigInput, StatusState, WorkflowRunConfigInput, WorkflowRunAction, ForkConfigInput, StarConfigInput, StarAction, WatchConfigInput, WatchAction, WebhookConfigInput, KiciEventConfigInput, KiciEventTriggerConfig, WorkflowCompleteConfigInput, WorkflowCompleteTriggerConfig, WorkflowCompleteStatus, JobCompleteConfigInput, JobCompleteTriggerConfig, JobCompleteStatus, GenericWebhookConfigInput, GenericWebhookTriggerConfig, GenericWebhookAuthMethod, GenericWebhookHmacAuth, GenericWebhookApiKeyAuth, GenericWebhookAuth, ScheduleConfigInput, ScheduleTriggerConfig, LifecycleEvent, LifecycleConfigInput, LifecycleTriggerConfig, } from './types.js';
27
+ export { DEFAULT_PR_EVENTS, toBranchPattern } from './types.js';
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,25 @@
1
+ import "../chunk-gOLHoazu.js";
2
+ import { DEFAULT_PR_EVENTS, toBranchPattern } from "./types.js";
3
+ import { pr } from "./pr.js";
4
+ import { push } from "./push.js";
5
+ import { tag } from "./tag.js";
6
+ import { comment } from "./comment.js";
7
+ import { review } from "./review.js";
8
+ import { reviewComment } from "./review-comment.js";
9
+ import { release } from "./release.js";
10
+ import { dispatch } from "./dispatch.js";
11
+ import { create } from "./create.js";
12
+ import { del } from "./delete.js";
13
+ import { status } from "./status.js";
14
+ import { workflowRun } from "./workflow-run.js";
15
+ import { fork } from "./fork.js";
16
+ import { star } from "./star.js";
17
+ import { watch } from "./watch.js";
18
+ import { webhook } from "./webhook.js";
19
+ import { kiciEvent } from "./kici-event.js";
20
+ import { workflowComplete } from "./workflow-complete.js";
21
+ import { jobComplete } from "./job-complete.js";
22
+ import { genericWebhook } from "./generic-webhook.js";
23
+ import { schedule } from "./schedule.js";
24
+ import { lifecycle } from "./lifecycle.js";
25
+ export { DEFAULT_PR_EVENTS, comment, create, del as delete, dispatch, fork, genericWebhook, jobComplete, kiciEvent, lifecycle, pr, push, release, review, reviewComment, schedule, star, status, tag, toBranchPattern, watch, webhook, workflowComplete, workflowRun };