@kici-dev/compiler 0.0.0 → 0.1.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/LICENSE +202 -0
- package/README.md +1 -6
- package/dist/assets/api-TJJVHrjC.json +118 -0
- package/dist/assets/descriptor-BTtjzN9L.json +1382 -0
- package/dist/assets/package-BpQF9kR8.json +74 -0
- package/dist/assets/package-Ceo2h27X.json +89 -0
- package/dist/assets/source_context-D0atuL28.json +20 -0
- package/dist/assets/type-BFqO8SCZ.json +202 -0
- package/dist/auth/headless-detect.d.ts +14 -0
- package/dist/auth/headless-detect.js +25 -0
- package/dist/chunk-gOLHoazu.js +4 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +193 -0
- package/dist/commands/cancel.d.ts +22 -0
- package/dist/commands/cancel.js +124 -0
- package/dist/commands/compile.d.ts +17 -0
- package/dist/commands/compile.js +99 -0
- package/dist/commands/docs.d.ts +26 -0
- package/dist/commands/docs.js +60 -0
- package/dist/commands/drain-worker.d.ts +19 -0
- package/dist/commands/drain-worker.js +45 -0
- package/dist/commands/endpoints.d.ts +53 -0
- package/dist/commands/endpoints.js +185 -0
- package/dist/commands/fixture.d.ts +14 -0
- package/dist/commands/fixture.js +104 -0
- package/dist/commands/hook.d.ts +20 -0
- package/dist/commands/hook.js +97 -0
- package/dist/commands/index.d.ts +33 -0
- package/dist/commands/index.js +20 -0
- package/dist/commands/init.d.ts +35 -0
- package/dist/commands/init.js +393 -0
- package/dist/commands/login.d.ts +23 -0
- package/dist/commands/login.js +144 -0
- package/dist/commands/logout.d.ts +18 -0
- package/dist/commands/logout.js +55 -0
- package/dist/commands/org.d.ts +27 -0
- package/dist/commands/org.js +126 -0
- package/dist/commands/run.d.ts +21 -0
- package/dist/commands/run.js +562 -0
- package/dist/commands/secrets-list.d.ts +16 -0
- package/dist/commands/secrets-list.js +85 -0
- package/dist/commands/status.d.ts +30 -0
- package/dist/commands/status.js +210 -0
- package/dist/commands/test.d.ts +61 -0
- package/dist/commands/test.js +220 -0
- package/dist/commands/types.d.ts +18 -0
- package/dist/commands/types.js +74 -0
- package/dist/commands/watch.d.ts +14 -0
- package/dist/commands/watch.js +97 -0
- package/dist/commands/workflows.d.ts +28 -0
- package/dist/commands/workflows.js +154 -0
- package/dist/comment-created.json +30 -0
- package/dist/create-branch.json +17 -0
- package/dist/delete-branch.json +15 -0
- package/dist/dispatch.json +15 -0
- package/dist/errors/capability-gap.d.ts +50 -0
- package/dist/errors/capability-gap.js +54 -0
- package/dist/errors/codes.d.ts +25 -0
- package/dist/errors/formatter.d.ts +32 -0
- package/dist/errors/formatter.js +35 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/index.js +4 -0
- package/dist/execution/executor.d.ts +61 -0
- package/dist/execution/executor.js +230 -0
- package/dist/execution/index.d.ts +4 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/sdk-alias.d.ts +33 -0
- package/dist/execution/sdk-alias.js +102 -0
- package/dist/fixtures/compiler.d.ts +47 -0
- package/dist/fixtures/compiler.js +177 -0
- package/dist/fixtures/defaults/comment-created.json +30 -0
- package/dist/fixtures/defaults/create-branch.json +17 -0
- package/dist/fixtures/defaults/delete-branch.json +15 -0
- package/dist/fixtures/defaults/dispatch.json +15 -0
- package/dist/fixtures/defaults/fork.json +19 -0
- package/dist/fixtures/defaults/index.d.ts +16 -0
- package/dist/fixtures/defaults/index.js +105 -0
- package/dist/fixtures/defaults/index.ts +145 -0
- package/dist/fixtures/defaults/pr-closed.json +28 -0
- package/dist/fixtures/defaults/pr-opened.json +27 -0
- package/dist/fixtures/defaults/pr-reopened.json +27 -0
- package/dist/fixtures/defaults/pr-synchronize.json +27 -0
- package/dist/fixtures/defaults/push.json +16 -0
- package/dist/fixtures/defaults/release-published.json +23 -0
- package/dist/fixtures/defaults/review-comment-created.json +36 -0
- package/dist/fixtures/defaults/review-submitted.json +35 -0
- package/dist/fixtures/defaults/star-created.json +15 -0
- package/dist/fixtures/defaults/status.json +26 -0
- package/dist/fixtures/defaults/tag-push.json +20 -0
- package/dist/fixtures/defaults/watch-started.json +15 -0
- package/dist/fixtures/defaults/workflow-run-completed.json +23 -0
- package/dist/fork.json +19 -0
- package/dist/format.d.ts +5 -0
- package/dist/format.js +20 -0
- package/dist/generators/secrets-dts.d.ts +29 -0
- package/dist/generators/secrets-dts.js +67 -0
- package/dist/hooks/detector.d.ts +39 -0
- package/dist/hooks/detector.js +133 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/installer.d.ts +24 -0
- package/dist/hooks/installer.js +328 -0
- package/dist/hooks/templates.d.ts +26 -0
- package/dist/hooks/templates.js +63 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/llm-context/llms-full.txt +9974 -0
- package/dist/llm-context/llms.txt +61 -0
- package/dist/local-executor/dag-scheduler.d.ts +44 -0
- package/dist/local-executor/dag-scheduler.js +183 -0
- package/dist/local-executor/index.d.ts +23 -0
- package/dist/local-executor/index.js +309 -0
- package/dist/local-executor/job-runner.d.ts +40 -0
- package/dist/local-executor/job-runner.js +307 -0
- package/dist/local-executor/output-streamer.d.ts +31 -0
- package/dist/local-executor/output-streamer.js +166 -0
- package/dist/local-executor/payload-generator.d.ts +16 -0
- package/dist/local-executor/payload-generator.js +138 -0
- package/dist/local-executor/picker.d.ts +33 -0
- package/dist/local-executor/picker.js +109 -0
- package/dist/local-executor/secret-loader.d.ts +18 -0
- package/dist/local-executor/secret-loader.js +105 -0
- package/dist/local-executor/types.d.ts +80 -0
- package/dist/local-executor/types.js +2 -0
- package/dist/local-executor/workflow-lock.d.ts +81 -0
- package/dist/local-executor/workflow-lock.js +0 -0
- package/dist/lockfile/generator.d.ts +39 -0
- package/dist/lockfile/generator.js +688 -0
- package/dist/lockfile/hash-files.d.ts +14 -0
- package/dist/lockfile/hash-files.js +50 -0
- package/dist/lockfile/hasher.d.ts +36 -0
- package/dist/lockfile/hasher.js +46 -0
- package/dist/lockfile/index.d.ts +3 -0
- package/dist/lockfile/index.js +4 -0
- package/dist/lockfile/purity-analyzer.d.ts +25 -0
- package/dist/lockfile/purity-analyzer.js +204 -0
- package/dist/package-F7UXSDHW.json +74 -0
- package/dist/postinstall.d.ts +9 -0
- package/dist/postinstall.js +60 -0
- package/dist/pr-closed.json +28 -0
- package/dist/pr-opened.json +27 -0
- package/dist/pr-reopened.json +27 -0
- package/dist/pr-synchronize.json +27 -0
- package/dist/push.json +16 -0
- package/dist/release-published.json +23 -0
- package/dist/remote/client.d.ts +204 -0
- package/dist/remote/client.js +203 -0
- package/dist/remote/config.d.ts +54 -0
- package/dist/remote/config.js +92 -0
- package/dist/remote/encryption.d.ts +35 -0
- package/dist/remote/encryption.js +87 -0
- package/dist/remote/history.d.ts +91 -0
- package/dist/remote/history.js +146 -0
- package/dist/remote/oauth.d.ts +65 -0
- package/dist/remote/oauth.js +302 -0
- package/dist/remote/observer.d.ts +81 -0
- package/dist/remote/observer.js +174 -0
- package/dist/remote/output/json.d.ts +13 -0
- package/dist/remote/output/json.js +36 -0
- package/dist/remote/output/junit.d.ts +18 -0
- package/dist/remote/output/junit.js +50 -0
- package/dist/remote/output/streaming.d.ts +57 -0
- package/dist/remote/output/streaming.js +124 -0
- package/dist/remote/output/summary.d.ts +39 -0
- package/dist/remote/output/summary.js +99 -0
- package/dist/remote/uploader.d.ts +87 -0
- package/dist/remote/uploader.js +197 -0
- package/dist/review-comment-created.json +36 -0
- package/dist/review-submitted.json +35 -0
- package/dist/star-created.json +15 -0
- package/dist/status.json +26 -0
- package/dist/tag-push.json +20 -0
- package/dist/templates/agents-md.d.ts +8 -0
- package/dist/templates/agents-md.js +130 -0
- package/dist/templates/index.d.ts +43 -0
- package/dist/templates/index.js +48 -0
- package/dist/templates/package-json.d.ts +18 -0
- package/dist/templates/package-json.js +34 -0
- package/dist/templates/tsconfig-json.d.ts +9 -0
- package/dist/templates/tsconfig-json.js +26 -0
- package/dist/templates/workflows/hello-world.d.ts +2 -0
- package/dist/templates/workflows/hello-world.js +16 -0
- package/dist/templates/workflows/hello-world.ts +21 -0
- package/dist/templates/workflows/pr-checks.d.ts +2 -0
- package/dist/templates/workflows/pr-checks.js +40 -0
- package/dist/templates/workflows/pr-checks.ts +57 -0
- package/dist/test-runner/dry-run.d.ts +12 -0
- package/dist/test-runner/dry-run.js +66 -0
- package/dist/test-runner/event-types.d.ts +86 -0
- package/dist/test-runner/event-types.js +330 -0
- package/dist/test-runner/git-detector.d.ts +15 -0
- package/dist/test-runner/git-detector.js +30 -0
- package/dist/test-runner/index.d.ts +13 -0
- package/dist/test-runner/index.js +11 -0
- package/dist/test-runner/job-executor.d.ts +48 -0
- package/dist/test-runner/job-executor.js +245 -0
- package/dist/test-runner/output-formatter.d.ts +47 -0
- package/dist/test-runner/output-formatter.js +92 -0
- package/dist/test-runner/payload-builder.d.ts +20 -0
- package/dist/test-runner/payload-builder.js +216 -0
- package/dist/test-runner/rule-evaluator.d.ts +14 -0
- package/dist/test-runner/rule-evaluator.js +31 -0
- package/dist/test-runner/secrets-file.d.ts +24 -0
- package/dist/test-runner/secrets-file.js +62 -0
- package/dist/test-runner/step-context.d.ts +15 -0
- package/dist/test-runner/step-context.js +140 -0
- package/dist/test-runner/summary.d.ts +7 -0
- package/dist/types.d.ts +525 -0
- package/dist/types.js +33 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +3 -0
- package/dist/validation/validator.d.ts +26 -0
- package/dist/validation/validator.js +164 -0
- package/dist/watch-started.json +15 -0
- package/dist/workflow-run-completed.json +23 -0
- package/dist/workflows/hello-world.ts +21 -0
- package/dist/workflows/pr-checks.ts +57 -0
- package/hack/postinstall.mjs +105 -0
- package/package.json +60 -6
- package/sbom.spdx.json +10997 -0
- package/index.js +0 -3
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"forkee": {
|
|
3
|
+
"full_name": "forker/test-repo",
|
|
4
|
+
"owner": {
|
|
5
|
+
"login": "forker"
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"name": "test-repo",
|
|
10
|
+
"full_name": "test-org/test-repo",
|
|
11
|
+
"owner": {
|
|
12
|
+
"login": "test-org"
|
|
13
|
+
},
|
|
14
|
+
"default_branch": "main"
|
|
15
|
+
},
|
|
16
|
+
"sender": {
|
|
17
|
+
"login": "forker"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in fixture registry for common GitHub webhook events.
|
|
3
|
+
* Supports all 15 trigger types defined in the SDK.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get default fixture for an event type
|
|
7
|
+
* @param event - Event name (e.g., 'pr:open', 'push', 'comment:created')
|
|
8
|
+
* @returns Fixture payload
|
|
9
|
+
* @throws Error if event is unknown
|
|
10
|
+
*/
|
|
11
|
+
export declare function getDefaultFixture(event: string): unknown;
|
|
12
|
+
/**
|
|
13
|
+
* List all available event names
|
|
14
|
+
*/
|
|
15
|
+
export declare function listAvailableEvents(): string[];
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import "../../chunk-gOLHoazu.js";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
//#region src/fixtures/defaults/index.ts
|
|
6
|
+
/**
|
|
7
|
+
* Built-in fixture registry for common GitHub webhook events.
|
|
8
|
+
* Supports all 15 trigger types defined in the SDK.
|
|
9
|
+
*/
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
function load(filename) {
|
|
12
|
+
return JSON.parse(readFileSync(join(__dirname, filename), "utf-8"));
|
|
13
|
+
}
|
|
14
|
+
const prOpened = load("pr-opened.json");
|
|
15
|
+
const prSynchronize = load("pr-synchronize.json");
|
|
16
|
+
const prClosed = load("pr-closed.json");
|
|
17
|
+
const prReopened = load("pr-reopened.json");
|
|
18
|
+
const pushFixture = load("push.json");
|
|
19
|
+
const tagPush = load("tag-push.json");
|
|
20
|
+
const commentCreated = load("comment-created.json");
|
|
21
|
+
const releasePublished = load("release-published.json");
|
|
22
|
+
const dispatchFixture = load("dispatch.json");
|
|
23
|
+
const createBranch = load("create-branch.json");
|
|
24
|
+
const deleteBranch = load("delete-branch.json");
|
|
25
|
+
const statusFixture = load("status.json");
|
|
26
|
+
const forkFixture = load("fork.json");
|
|
27
|
+
const starCreated = load("star-created.json");
|
|
28
|
+
const watchStarted = load("watch-started.json");
|
|
29
|
+
const reviewSubmitted = load("review-submitted.json");
|
|
30
|
+
const reviewCommentCreated = load("review-comment-created.json");
|
|
31
|
+
const workflowRunCompleted = load("workflow-run-completed.json");
|
|
32
|
+
const FIXTURES = {
|
|
33
|
+
"pr:open": prOpened,
|
|
34
|
+
"pr:opened": prOpened,
|
|
35
|
+
"pr:sync": prSynchronize,
|
|
36
|
+
"pr:synchronize": prSynchronize,
|
|
37
|
+
"pr:close": prClosed,
|
|
38
|
+
"pr:closed": prClosed,
|
|
39
|
+
"pr:reopen": prReopened,
|
|
40
|
+
"pr:reopened": prReopened,
|
|
41
|
+
push: pushFixture,
|
|
42
|
+
tag: tagPush,
|
|
43
|
+
comment: commentCreated,
|
|
44
|
+
"comment:created": commentCreated,
|
|
45
|
+
"comment:edited": commentCreated,
|
|
46
|
+
"comment:deleted": commentCreated,
|
|
47
|
+
review: reviewSubmitted,
|
|
48
|
+
"review:submitted": reviewSubmitted,
|
|
49
|
+
"review:edited": reviewSubmitted,
|
|
50
|
+
"review:dismissed": reviewSubmitted,
|
|
51
|
+
review_comment: reviewCommentCreated,
|
|
52
|
+
"review_comment:created": reviewCommentCreated,
|
|
53
|
+
"review_comment:edited": reviewCommentCreated,
|
|
54
|
+
"review_comment:deleted": reviewCommentCreated,
|
|
55
|
+
release: releasePublished,
|
|
56
|
+
"release:published": releasePublished,
|
|
57
|
+
"release:unpublished": releasePublished,
|
|
58
|
+
"release:created": releasePublished,
|
|
59
|
+
"release:edited": releasePublished,
|
|
60
|
+
"release:deleted": releasePublished,
|
|
61
|
+
"release:prereleased": releasePublished,
|
|
62
|
+
"release:released": releasePublished,
|
|
63
|
+
dispatch: dispatchFixture,
|
|
64
|
+
create: createBranch,
|
|
65
|
+
"create:branch": createBranch,
|
|
66
|
+
"create:tag": createBranch,
|
|
67
|
+
delete: deleteBranch,
|
|
68
|
+
"delete:branch": deleteBranch,
|
|
69
|
+
"delete:tag": deleteBranch,
|
|
70
|
+
status: statusFixture,
|
|
71
|
+
workflow_run: workflowRunCompleted,
|
|
72
|
+
"workflow_run:completed": workflowRunCompleted,
|
|
73
|
+
"workflow_run:requested": workflowRunCompleted,
|
|
74
|
+
"workflow_run:in_progress": workflowRunCompleted,
|
|
75
|
+
fork: forkFixture,
|
|
76
|
+
star: starCreated,
|
|
77
|
+
"star:created": starCreated,
|
|
78
|
+
"star:deleted": starCreated,
|
|
79
|
+
watch: watchStarted,
|
|
80
|
+
"watch:started": watchStarted
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Get default fixture for an event type
|
|
84
|
+
* @param event - Event name (e.g., 'pr:open', 'push', 'comment:created')
|
|
85
|
+
* @returns Fixture payload
|
|
86
|
+
* @throws Error if event is unknown
|
|
87
|
+
*/
|
|
88
|
+
function getDefaultFixture(event) {
|
|
89
|
+
const fixture = FIXTURES[event.toLowerCase().trim()];
|
|
90
|
+
if (!fixture) {
|
|
91
|
+
const available = Object.keys(FIXTURES).filter((k, i, arr) => arr.indexOf(k) === i).join(", ");
|
|
92
|
+
throw new Error(`Unknown event type: ${event}\nAvailable events: ${available}`);
|
|
93
|
+
}
|
|
94
|
+
return fixture;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* List all available event names
|
|
98
|
+
*/
|
|
99
|
+
function listAvailableEvents() {
|
|
100
|
+
return [...new Set(Object.keys(FIXTURES))];
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { getDefaultFixture, listAvailableEvents };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in fixture registry for common GitHub webhook events.
|
|
3
|
+
* Supports all 15 trigger types defined in the SDK.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { dirname, join } from 'node:path';
|
|
9
|
+
|
|
10
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
|
|
12
|
+
function load(filename: string): unknown {
|
|
13
|
+
return JSON.parse(readFileSync(join(__dirname, filename), 'utf-8'));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// --- PR fixtures ---
|
|
17
|
+
const prOpened = load('pr-opened.json');
|
|
18
|
+
const prSynchronize = load('pr-synchronize.json');
|
|
19
|
+
const prClosed = load('pr-closed.json');
|
|
20
|
+
const prReopened = load('pr-reopened.json');
|
|
21
|
+
|
|
22
|
+
// --- Push / tag ---
|
|
23
|
+
const pushFixture = load('push.json');
|
|
24
|
+
const tagPush = load('tag-push.json');
|
|
25
|
+
|
|
26
|
+
// --- New event fixtures ---
|
|
27
|
+
const commentCreated = load('comment-created.json');
|
|
28
|
+
const releasePublished = load('release-published.json');
|
|
29
|
+
const dispatchFixture = load('dispatch.json');
|
|
30
|
+
const createBranch = load('create-branch.json');
|
|
31
|
+
const deleteBranch = load('delete-branch.json');
|
|
32
|
+
const statusFixture = load('status.json');
|
|
33
|
+
const forkFixture = load('fork.json');
|
|
34
|
+
const starCreated = load('star-created.json');
|
|
35
|
+
const watchStarted = load('watch-started.json');
|
|
36
|
+
const reviewSubmitted = load('review-submitted.json');
|
|
37
|
+
const reviewCommentCreated = load('review-comment-created.json');
|
|
38
|
+
const workflowRunCompleted = load('workflow-run-completed.json');
|
|
39
|
+
|
|
40
|
+
const FIXTURES: Record<string, unknown> = {
|
|
41
|
+
// PR events
|
|
42
|
+
'pr:open': prOpened,
|
|
43
|
+
'pr:opened': prOpened,
|
|
44
|
+
'pr:sync': prSynchronize,
|
|
45
|
+
'pr:synchronize': prSynchronize,
|
|
46
|
+
'pr:close': prClosed,
|
|
47
|
+
'pr:closed': prClosed,
|
|
48
|
+
'pr:reopen': prReopened,
|
|
49
|
+
'pr:reopened': prReopened,
|
|
50
|
+
|
|
51
|
+
// Push
|
|
52
|
+
push: pushFixture,
|
|
53
|
+
|
|
54
|
+
// Tag
|
|
55
|
+
tag: tagPush,
|
|
56
|
+
|
|
57
|
+
// Comment (issue_comment)
|
|
58
|
+
comment: commentCreated,
|
|
59
|
+
'comment:created': commentCreated,
|
|
60
|
+
'comment:edited': commentCreated, // Reuse created fixture (action overridden in payload builder)
|
|
61
|
+
'comment:deleted': commentCreated,
|
|
62
|
+
|
|
63
|
+
// Review (pull_request_review)
|
|
64
|
+
review: reviewSubmitted,
|
|
65
|
+
'review:submitted': reviewSubmitted,
|
|
66
|
+
'review:edited': reviewSubmitted,
|
|
67
|
+
'review:dismissed': reviewSubmitted,
|
|
68
|
+
|
|
69
|
+
// Review comment (pull_request_review_comment)
|
|
70
|
+
review_comment: reviewCommentCreated,
|
|
71
|
+
'review_comment:created': reviewCommentCreated,
|
|
72
|
+
'review_comment:edited': reviewCommentCreated,
|
|
73
|
+
'review_comment:deleted': reviewCommentCreated,
|
|
74
|
+
|
|
75
|
+
// Release
|
|
76
|
+
release: releasePublished,
|
|
77
|
+
'release:published': releasePublished,
|
|
78
|
+
'release:unpublished': releasePublished,
|
|
79
|
+
'release:created': releasePublished,
|
|
80
|
+
'release:edited': releasePublished,
|
|
81
|
+
'release:deleted': releasePublished,
|
|
82
|
+
'release:prereleased': releasePublished,
|
|
83
|
+
'release:released': releasePublished,
|
|
84
|
+
|
|
85
|
+
// Dispatch (repository_dispatch)
|
|
86
|
+
dispatch: dispatchFixture,
|
|
87
|
+
|
|
88
|
+
// Create
|
|
89
|
+
create: createBranch,
|
|
90
|
+
'create:branch': createBranch,
|
|
91
|
+
'create:tag': createBranch,
|
|
92
|
+
|
|
93
|
+
// Delete
|
|
94
|
+
delete: deleteBranch,
|
|
95
|
+
'delete:branch': deleteBranch,
|
|
96
|
+
'delete:tag': deleteBranch,
|
|
97
|
+
|
|
98
|
+
// Status
|
|
99
|
+
status: statusFixture,
|
|
100
|
+
|
|
101
|
+
// Workflow run
|
|
102
|
+
workflow_run: workflowRunCompleted,
|
|
103
|
+
'workflow_run:completed': workflowRunCompleted,
|
|
104
|
+
'workflow_run:requested': workflowRunCompleted,
|
|
105
|
+
'workflow_run:in_progress': workflowRunCompleted,
|
|
106
|
+
|
|
107
|
+
// Fork
|
|
108
|
+
fork: forkFixture,
|
|
109
|
+
|
|
110
|
+
// Star
|
|
111
|
+
star: starCreated,
|
|
112
|
+
'star:created': starCreated,
|
|
113
|
+
'star:deleted': starCreated,
|
|
114
|
+
|
|
115
|
+
// Watch
|
|
116
|
+
watch: watchStarted,
|
|
117
|
+
'watch:started': watchStarted,
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get default fixture for an event type
|
|
122
|
+
* @param event - Event name (e.g., 'pr:open', 'push', 'comment:created')
|
|
123
|
+
* @returns Fixture payload
|
|
124
|
+
* @throws Error if event is unknown
|
|
125
|
+
*/
|
|
126
|
+
export function getDefaultFixture(event: string): unknown {
|
|
127
|
+
const normalized = event.toLowerCase().trim();
|
|
128
|
+
const fixture = FIXTURES[normalized];
|
|
129
|
+
|
|
130
|
+
if (!fixture) {
|
|
131
|
+
const available = Object.keys(FIXTURES)
|
|
132
|
+
.filter((k, i, arr) => arr.indexOf(k) === i) // Remove duplicates
|
|
133
|
+
.join(', ');
|
|
134
|
+
throw new Error(`Unknown event type: ${event}\n` + `Available events: ${available}`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return fixture;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* List all available event names
|
|
142
|
+
*/
|
|
143
|
+
export function listAvailableEvents(): string[] {
|
|
144
|
+
return [...new Set(Object.keys(FIXTURES))]; // Deduplicate
|
|
145
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "closed",
|
|
3
|
+
"number": 1,
|
|
4
|
+
"pull_request": {
|
|
5
|
+
"number": 1,
|
|
6
|
+
"title": "Test PR",
|
|
7
|
+
"state": "closed",
|
|
8
|
+
"merged": false,
|
|
9
|
+
"head": {
|
|
10
|
+
"ref": "feature-branch",
|
|
11
|
+
"sha": "abc123"
|
|
12
|
+
},
|
|
13
|
+
"base": {
|
|
14
|
+
"ref": "main",
|
|
15
|
+
"sha": "def456"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"name": "test-repo",
|
|
20
|
+
"full_name": "owner/test-repo",
|
|
21
|
+
"owner": {
|
|
22
|
+
"login": "owner"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"sender": {
|
|
26
|
+
"login": "user"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "opened",
|
|
3
|
+
"number": 1,
|
|
4
|
+
"pull_request": {
|
|
5
|
+
"number": 1,
|
|
6
|
+
"title": "Test PR",
|
|
7
|
+
"state": "open",
|
|
8
|
+
"head": {
|
|
9
|
+
"ref": "feature-branch",
|
|
10
|
+
"sha": "abc123"
|
|
11
|
+
},
|
|
12
|
+
"base": {
|
|
13
|
+
"ref": "main",
|
|
14
|
+
"sha": "def456"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"name": "test-repo",
|
|
19
|
+
"full_name": "owner/test-repo",
|
|
20
|
+
"owner": {
|
|
21
|
+
"login": "owner"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"sender": {
|
|
25
|
+
"login": "user"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "reopened",
|
|
3
|
+
"number": 1,
|
|
4
|
+
"pull_request": {
|
|
5
|
+
"number": 1,
|
|
6
|
+
"title": "Test PR",
|
|
7
|
+
"state": "open",
|
|
8
|
+
"head": {
|
|
9
|
+
"ref": "feature-branch",
|
|
10
|
+
"sha": "abc123"
|
|
11
|
+
},
|
|
12
|
+
"base": {
|
|
13
|
+
"ref": "main",
|
|
14
|
+
"sha": "def456"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"name": "test-repo",
|
|
19
|
+
"full_name": "owner/test-repo",
|
|
20
|
+
"owner": {
|
|
21
|
+
"login": "owner"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"sender": {
|
|
25
|
+
"login": "user"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "synchronize",
|
|
3
|
+
"number": 1,
|
|
4
|
+
"pull_request": {
|
|
5
|
+
"number": 1,
|
|
6
|
+
"title": "Test PR",
|
|
7
|
+
"state": "open",
|
|
8
|
+
"head": {
|
|
9
|
+
"ref": "feature-branch",
|
|
10
|
+
"sha": "abc123"
|
|
11
|
+
},
|
|
12
|
+
"base": {
|
|
13
|
+
"ref": "main",
|
|
14
|
+
"sha": "def456"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"name": "test-repo",
|
|
19
|
+
"full_name": "owner/test-repo",
|
|
20
|
+
"owner": {
|
|
21
|
+
"login": "owner"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"sender": {
|
|
25
|
+
"login": "user"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ref": "refs/heads/main",
|
|
3
|
+
"before": "000000",
|
|
4
|
+
"after": "abc123",
|
|
5
|
+
"repository": {
|
|
6
|
+
"name": "test-repo",
|
|
7
|
+
"full_name": "owner/test-repo",
|
|
8
|
+
"owner": {
|
|
9
|
+
"login": "owner"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"pusher": {
|
|
13
|
+
"name": "user"
|
|
14
|
+
},
|
|
15
|
+
"commits": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "published",
|
|
3
|
+
"release": {
|
|
4
|
+
"id": 1,
|
|
5
|
+
"tag_name": "v1.0.0",
|
|
6
|
+
"target_commitish": "main",
|
|
7
|
+
"name": "v1.0.0",
|
|
8
|
+
"draft": false,
|
|
9
|
+
"prerelease": false,
|
|
10
|
+
"body": "Release notes"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"name": "test-repo",
|
|
14
|
+
"full_name": "test-org/test-repo",
|
|
15
|
+
"owner": {
|
|
16
|
+
"login": "test-org"
|
|
17
|
+
},
|
|
18
|
+
"default_branch": "main"
|
|
19
|
+
},
|
|
20
|
+
"sender": {
|
|
21
|
+
"login": "test-user"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "created",
|
|
3
|
+
"comment": {
|
|
4
|
+
"id": 1,
|
|
5
|
+
"body": "Consider refactoring this",
|
|
6
|
+
"path": "src/index.ts",
|
|
7
|
+
"line": 42,
|
|
8
|
+
"user": {
|
|
9
|
+
"login": "reviewer"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"pull_request": {
|
|
13
|
+
"number": 42,
|
|
14
|
+
"title": "Test PR",
|
|
15
|
+
"state": "open",
|
|
16
|
+
"head": {
|
|
17
|
+
"ref": "feature-branch",
|
|
18
|
+
"sha": "abc123"
|
|
19
|
+
},
|
|
20
|
+
"base": {
|
|
21
|
+
"ref": "main",
|
|
22
|
+
"sha": "def456"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"name": "test-repo",
|
|
27
|
+
"full_name": "test-org/test-repo",
|
|
28
|
+
"owner": {
|
|
29
|
+
"login": "test-org"
|
|
30
|
+
},
|
|
31
|
+
"default_branch": "main"
|
|
32
|
+
},
|
|
33
|
+
"sender": {
|
|
34
|
+
"login": "reviewer"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "submitted",
|
|
3
|
+
"review": {
|
|
4
|
+
"id": 1,
|
|
5
|
+
"state": "approved",
|
|
6
|
+
"body": "LGTM",
|
|
7
|
+
"user": {
|
|
8
|
+
"login": "reviewer"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"pull_request": {
|
|
12
|
+
"number": 42,
|
|
13
|
+
"title": "Test PR",
|
|
14
|
+
"state": "open",
|
|
15
|
+
"head": {
|
|
16
|
+
"ref": "feature-branch",
|
|
17
|
+
"sha": "abc123"
|
|
18
|
+
},
|
|
19
|
+
"base": {
|
|
20
|
+
"ref": "main",
|
|
21
|
+
"sha": "def456"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"name": "test-repo",
|
|
26
|
+
"full_name": "test-org/test-repo",
|
|
27
|
+
"owner": {
|
|
28
|
+
"login": "test-org"
|
|
29
|
+
},
|
|
30
|
+
"default_branch": "main"
|
|
31
|
+
},
|
|
32
|
+
"sender": {
|
|
33
|
+
"login": "reviewer"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "created",
|
|
3
|
+
"repository": {
|
|
4
|
+
"name": "test-repo",
|
|
5
|
+
"full_name": "test-org/test-repo",
|
|
6
|
+
"owner": {
|
|
7
|
+
"login": "test-org"
|
|
8
|
+
},
|
|
9
|
+
"default_branch": "main",
|
|
10
|
+
"stargazers_count": 100
|
|
11
|
+
},
|
|
12
|
+
"sender": {
|
|
13
|
+
"login": "test-user"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"state": "success",
|
|
3
|
+
"context": "ci/test",
|
|
4
|
+
"sha": "abc123def456",
|
|
5
|
+
"description": "Build succeeded",
|
|
6
|
+
"target_url": "https://ci.example.com/builds/1",
|
|
7
|
+
"branches": [
|
|
8
|
+
{
|
|
9
|
+
"name": "main",
|
|
10
|
+
"commit": {
|
|
11
|
+
"sha": "abc123def456"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"name": "test-repo",
|
|
17
|
+
"full_name": "test-org/test-repo",
|
|
18
|
+
"owner": {
|
|
19
|
+
"login": "test-org"
|
|
20
|
+
},
|
|
21
|
+
"default_branch": "main"
|
|
22
|
+
},
|
|
23
|
+
"sender": {
|
|
24
|
+
"login": "test-user"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ref": "refs/tags/v1.0.0",
|
|
3
|
+
"before": "0000000000000000000000000000000000000000",
|
|
4
|
+
"after": "abc123def456",
|
|
5
|
+
"repository": {
|
|
6
|
+
"name": "test-repo",
|
|
7
|
+
"full_name": "test-org/test-repo",
|
|
8
|
+
"owner": {
|
|
9
|
+
"login": "test-org"
|
|
10
|
+
},
|
|
11
|
+
"default_branch": "main"
|
|
12
|
+
},
|
|
13
|
+
"pusher": {
|
|
14
|
+
"name": "test-user"
|
|
15
|
+
},
|
|
16
|
+
"sender": {
|
|
17
|
+
"login": "test-user"
|
|
18
|
+
},
|
|
19
|
+
"commits": []
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": "completed",
|
|
3
|
+
"workflow_run": {
|
|
4
|
+
"id": 1,
|
|
5
|
+
"name": "CI",
|
|
6
|
+
"head_branch": "main",
|
|
7
|
+
"head_sha": "abc123def456",
|
|
8
|
+
"status": "completed",
|
|
9
|
+
"conclusion": "success",
|
|
10
|
+
"event": "push"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"name": "test-repo",
|
|
14
|
+
"full_name": "test-org/test-repo",
|
|
15
|
+
"owner": {
|
|
16
|
+
"login": "test-org"
|
|
17
|
+
},
|
|
18
|
+
"default_branch": "main"
|
|
19
|
+
},
|
|
20
|
+
"sender": {
|
|
21
|
+
"login": "test-user"
|
|
22
|
+
}
|
|
23
|
+
}
|
package/dist/fork.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"forkee": {
|
|
3
|
+
"full_name": "forker/test-repo",
|
|
4
|
+
"owner": {
|
|
5
|
+
"login": "forker"
|
|
6
|
+
}
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"name": "test-repo",
|
|
10
|
+
"full_name": "test-org/test-repo",
|
|
11
|
+
"owner": {
|
|
12
|
+
"login": "test-org"
|
|
13
|
+
},
|
|
14
|
+
"default_branch": "main"
|
|
15
|
+
},
|
|
16
|
+
"sender": {
|
|
17
|
+
"login": "forker"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/format.d.ts
ADDED
package/dist/format.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import "./chunk-gOLHoazu.js";
|
|
2
|
+
//#region src/format.ts
|
|
3
|
+
/**
|
|
4
|
+
* Format an ISO timestamp as a relative time string (e.g. "2 minutes ago").
|
|
5
|
+
*/
|
|
6
|
+
function formatRelativeTime(isoDate) {
|
|
7
|
+
const ms = Date.now() - new Date(isoDate).getTime();
|
|
8
|
+
if (ms < 0) return "just now";
|
|
9
|
+
const minutes = Math.floor(ms / (60 * 1e3));
|
|
10
|
+
if (minutes < 1) return "just now";
|
|
11
|
+
if (minutes < 60) return `${minutes} minute${minutes === 1 ? "" : "s"} ago`;
|
|
12
|
+
const hours = Math.floor(ms / (3600 * 1e3));
|
|
13
|
+
if (hours < 24) return `${hours} hour${hours === 1 ? "" : "s"} ago`;
|
|
14
|
+
const days = Math.floor(ms / (1440 * 60 * 1e3));
|
|
15
|
+
return `${days} day${days === 1 ? "" : "s"} ago`;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { formatRelativeTime };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=format.js.map
|