pi-ghwebhook 0.0.0-stage → 0.2.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/CHANGELOG.md +25 -0
- package/LICENSE +21 -0
- package/README.md +141 -2
- package/README_zh.md +142 -0
- package/dist/bus/event-bus.d.ts +14 -0
- package/dist/bus/event-bus.d.ts.map +1 -0
- package/dist/bus/event-bus.js +46 -0
- package/dist/bus/event-bus.js.map +1 -0
- package/dist/bus/guards.d.ts +10 -0
- package/dist/bus/guards.d.ts.map +1 -0
- package/dist/bus/guards.js +88 -0
- package/dist/bus/guards.js.map +1 -0
- package/dist/bus/matcher.d.ts +7 -0
- package/dist/bus/matcher.d.ts.map +1 -0
- package/dist/bus/matcher.js +122 -0
- package/dist/bus/matcher.js.map +1 -0
- package/dist/bus/normalizer.d.ts +14 -0
- package/dist/bus/normalizer.d.ts.map +1 -0
- package/dist/bus/normalizer.js +25 -0
- package/dist/bus/normalizer.js.map +1 -0
- package/dist/config/loader.d.ts +6 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +63 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/template/renderer.d.ts +4 -0
- package/dist/template/renderer.d.ts.map +1 -0
- package/dist/template/renderer.js +121 -0
- package/dist/template/renderer.js.map +1 -0
- package/dist/transport/forwarder.d.ts +18 -0
- package/dist/transport/forwarder.d.ts.map +1 -0
- package/dist/transport/forwarder.js +73 -0
- package/dist/transport/forwarder.js.map +1 -0
- package/dist/transport/loopback.d.ts +20 -0
- package/dist/transport/loopback.d.ts.map +1 -0
- package/dist/transport/loopback.js +96 -0
- package/dist/transport/loopback.js.map +1 -0
- package/dist/types/enums.d.ts +41 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/enums.js +44 -0
- package/dist/types/enums.js.map +1 -0
- package/dist/types/payload.d.ts +28 -0
- package/dist/types/payload.d.ts.map +1 -0
- package/dist/types/payload.js +2 -0
- package/dist/types/payload.js.map +1 -0
- package/dist/types/schema.d.ts +33 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +35 -0
- package/dist/types/schema.js.map +1 -0
- package/package.json +69 -4
- package/schemas/ghwebhook.schema.json +225 -0
- package/skills/setup-ghwebhook/SKILL.md +149 -0
- package/skills/setup-ghwebhook/assets/default-config.json +31 -0
- package/src/bus/event-bus.ts +64 -0
- package/src/bus/matcher.ts +164 -0
- package/src/config/loader.ts +80 -0
- package/src/index.ts +107 -0
- package/src/template/renderer.ts +145 -0
- package/src/transport/forwarder.ts +92 -0
- package/src/transport/loopback.ts +130 -0
- package/src/types/enums.ts +42 -0
- package/src/types/payload.ts +75 -0
- package/src/types/schema.ts +73 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard GitHub Webhook Event names as sent in the `X-GitHub-Event` HTTP header.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum GitHubEvent {
|
|
5
|
+
WorkflowRun = "workflow_run",
|
|
6
|
+
WorkflowJob = "workflow_job",
|
|
7
|
+
PullRequest = "pull_request",
|
|
8
|
+
PullRequestReview = "pull_request_review",
|
|
9
|
+
PullRequestReviewComment = "pull_request_review_comment",
|
|
10
|
+
CheckSuite = "check_suite",
|
|
11
|
+
CheckRun = "check_run",
|
|
12
|
+
IssueComment = "issue_comment",
|
|
13
|
+
Issues = "issues",
|
|
14
|
+
Push = "push",
|
|
15
|
+
Release = "release"
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Standard conclusions for GitHub Actions workflow runs and check suites,
|
|
19
|
+
* aligned with GitHub OpenAPI specification (@octokit/openapi-webhooks-types).
|
|
20
|
+
*/
|
|
21
|
+
export declare enum WorkflowConclusion {
|
|
22
|
+
Success = "success",
|
|
23
|
+
Failure = "failure",
|
|
24
|
+
Cancelled = "cancelled",
|
|
25
|
+
TimedOut = "timed_out",
|
|
26
|
+
Neutral = "neutral",
|
|
27
|
+
ActionRequired = "action_required",
|
|
28
|
+
Skipped = "skipped",
|
|
29
|
+
Stale = "stale",
|
|
30
|
+
StartupFailure = "startup_failure"
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Review state for pull request reviews.
|
|
34
|
+
*/
|
|
35
|
+
export declare enum ReviewState {
|
|
36
|
+
Approved = "approved",
|
|
37
|
+
ChangesRequested = "changes_requested",
|
|
38
|
+
Commented = "commented",
|
|
39
|
+
Dismissed = "dismissed"
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,WAAW;IACrB,WAAW,iBAAiB;IAC5B,WAAW,iBAAiB;IAC5B,WAAW,iBAAiB;IAC5B,iBAAiB,wBAAwB;IACzC,wBAAwB,gCAAgC;IACxD,UAAU,gBAAgB;IAC1B,QAAQ,cAAc;IACtB,YAAY,kBAAkB;IAC9B,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,cAAc;IACtB,OAAO,YAAY;IACnB,cAAc,oBAAoB;IAClC,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,cAAc,oBAAoB;CACnC;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,QAAQ,aAAa;IACrB,gBAAgB,sBAAsB;IACtC,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard GitHub Webhook Event names as sent in the `X-GitHub-Event` HTTP header.
|
|
3
|
+
*/
|
|
4
|
+
export var GitHubEvent;
|
|
5
|
+
(function (GitHubEvent) {
|
|
6
|
+
GitHubEvent["WorkflowRun"] = "workflow_run";
|
|
7
|
+
GitHubEvent["WorkflowJob"] = "workflow_job";
|
|
8
|
+
GitHubEvent["PullRequest"] = "pull_request";
|
|
9
|
+
GitHubEvent["PullRequestReview"] = "pull_request_review";
|
|
10
|
+
GitHubEvent["PullRequestReviewComment"] = "pull_request_review_comment";
|
|
11
|
+
GitHubEvent["CheckSuite"] = "check_suite";
|
|
12
|
+
GitHubEvent["CheckRun"] = "check_run";
|
|
13
|
+
GitHubEvent["IssueComment"] = "issue_comment";
|
|
14
|
+
GitHubEvent["Issues"] = "issues";
|
|
15
|
+
GitHubEvent["Push"] = "push";
|
|
16
|
+
GitHubEvent["Release"] = "release";
|
|
17
|
+
})(GitHubEvent || (GitHubEvent = {}));
|
|
18
|
+
/**
|
|
19
|
+
* Standard conclusions for GitHub Actions workflow runs and check suites,
|
|
20
|
+
* aligned with GitHub OpenAPI specification (@octokit/openapi-webhooks-types).
|
|
21
|
+
*/
|
|
22
|
+
export var WorkflowConclusion;
|
|
23
|
+
(function (WorkflowConclusion) {
|
|
24
|
+
WorkflowConclusion["Success"] = "success";
|
|
25
|
+
WorkflowConclusion["Failure"] = "failure";
|
|
26
|
+
WorkflowConclusion["Cancelled"] = "cancelled";
|
|
27
|
+
WorkflowConclusion["TimedOut"] = "timed_out";
|
|
28
|
+
WorkflowConclusion["Neutral"] = "neutral";
|
|
29
|
+
WorkflowConclusion["ActionRequired"] = "action_required";
|
|
30
|
+
WorkflowConclusion["Skipped"] = "skipped";
|
|
31
|
+
WorkflowConclusion["Stale"] = "stale";
|
|
32
|
+
WorkflowConclusion["StartupFailure"] = "startup_failure";
|
|
33
|
+
})(WorkflowConclusion || (WorkflowConclusion = {}));
|
|
34
|
+
/**
|
|
35
|
+
* Review state for pull request reviews.
|
|
36
|
+
*/
|
|
37
|
+
export var ReviewState;
|
|
38
|
+
(function (ReviewState) {
|
|
39
|
+
ReviewState["Approved"] = "approved";
|
|
40
|
+
ReviewState["ChangesRequested"] = "changes_requested";
|
|
41
|
+
ReviewState["Commented"] = "commented";
|
|
42
|
+
ReviewState["Dismissed"] = "dismissed";
|
|
43
|
+
})(ReviewState || (ReviewState = {}));
|
|
44
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,WAYX;AAZD,WAAY,WAAW;IACrB,2CAA4B,CAAA;IAC5B,2CAA4B,CAAA;IAC5B,2CAA4B,CAAA;IAC5B,wDAAyC,CAAA;IACzC,uEAAwD,CAAA;IACxD,yCAA0B,CAAA;IAC1B,qCAAsB,CAAA;IACtB,6CAA8B,CAAA;IAC9B,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,kCAAmB,CAAA;AACrB,CAAC,EAZW,WAAW,KAAX,WAAW,QAYtB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,yCAAmB,CAAA;IACnB,6CAAuB,CAAA;IACvB,4CAAsB,CAAA;IACtB,yCAAmB,CAAA;IACnB,wDAAkC,CAAA;IAClC,yCAAmB,CAAA;IACnB,qCAAe,CAAA;IACf,wDAAkC,CAAA;AACpC,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,qDAAsC,CAAA;IACtC,sCAAuB,CAAA;IACvB,sCAAuB,CAAA;AACzB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { components } from "@octokit/openapi-webhooks-types";
|
|
2
|
+
export type WebhookSchemas = components["schemas"];
|
|
3
|
+
export type WorkflowRunCompletedPayload = WebhookSchemas["webhook-workflow-run-completed"];
|
|
4
|
+
export type WorkflowRunInProgressPayload = WebhookSchemas["webhook-workflow-run-in-progress"];
|
|
5
|
+
export type WorkflowRunRequestedPayload = WebhookSchemas["webhook-workflow-run-requested"];
|
|
6
|
+
export type WorkflowRunPayload = WorkflowRunCompletedPayload | WorkflowRunInProgressPayload | WorkflowRunRequestedPayload;
|
|
7
|
+
export type PullRequestReviewSubmittedPayload = WebhookSchemas["webhook-pull-request-review-submitted"];
|
|
8
|
+
export type PullRequestReviewEditedPayload = WebhookSchemas["webhook-pull-request-review-edited"];
|
|
9
|
+
export type PullRequestReviewDismissedPayload = WebhookSchemas["webhook-pull-request-review-dismissed"];
|
|
10
|
+
export type PullRequestReviewPayload = PullRequestReviewSubmittedPayload | PullRequestReviewEditedPayload | PullRequestReviewDismissedPayload;
|
|
11
|
+
export type PullRequestReviewCommentCreatedPayload = WebhookSchemas["webhook-pull-request-review-comment-created"];
|
|
12
|
+
export type PullRequestReviewCommentEditedPayload = WebhookSchemas["webhook-pull-request-review-comment-edited"];
|
|
13
|
+
export type PullRequestReviewCommentDeletedPayload = WebhookSchemas["webhook-pull-request-review-comment-deleted"];
|
|
14
|
+
export type PullRequestReviewCommentPayload = PullRequestReviewCommentCreatedPayload | PullRequestReviewCommentEditedPayload | PullRequestReviewCommentDeletedPayload;
|
|
15
|
+
export type CheckSuiteCompletedPayload = WebhookSchemas["webhook-check-suite-completed"];
|
|
16
|
+
export type CheckSuiteRequestedPayload = WebhookSchemas["webhook-check-suite-requested"];
|
|
17
|
+
export type CheckSuiteRerequestedPayload = WebhookSchemas["webhook-check-suite-rerequested"];
|
|
18
|
+
export type CheckSuitePayload = CheckSuiteCompletedPayload | CheckSuiteRequestedPayload | CheckSuiteRerequestedPayload;
|
|
19
|
+
export type IssueCommentCreatedPayload = WebhookSchemas["webhook-issue-comment-created"];
|
|
20
|
+
export type IssueCommentEditedPayload = WebhookSchemas["webhook-issue-comment-edited"];
|
|
21
|
+
export type IssueCommentDeletedPayload = WebhookSchemas["webhook-issue-comment-deleted"];
|
|
22
|
+
export type IssueCommentPayload = IssueCommentCreatedPayload | IssueCommentEditedPayload | IssueCommentDeletedPayload;
|
|
23
|
+
export type SupportedWebhookPayload = WorkflowRunPayload | PullRequestReviewPayload | PullRequestReviewCommentPayload | CheckSuitePayload | IssueCommentPayload;
|
|
24
|
+
/**
|
|
25
|
+
* Fallback generic webhook payload structure for unknown or untyped events.
|
|
26
|
+
*/
|
|
27
|
+
export type WebhookPayload = Record<string, any>;
|
|
28
|
+
//# sourceMappingURL=payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/types/payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAGnD,MAAM,MAAM,2BAA2B,GACrC,cAAc,CAAC,gCAAgC,CAAC,CAAC;AACnD,MAAM,MAAM,4BAA4B,GACtC,cAAc,CAAC,kCAAkC,CAAC,CAAC;AACrD,MAAM,MAAM,2BAA2B,GACrC,cAAc,CAAC,gCAAgC,CAAC,CAAC;AACnD,MAAM,MAAM,kBAAkB,GAC1B,2BAA2B,GAC3B,4BAA4B,GAC5B,2BAA2B,CAAC;AAGhC,MAAM,MAAM,iCAAiC,GAC3C,cAAc,CAAC,uCAAuC,CAAC,CAAC;AAC1D,MAAM,MAAM,8BAA8B,GACxC,cAAc,CAAC,oCAAoC,CAAC,CAAC;AACvD,MAAM,MAAM,iCAAiC,GAC3C,cAAc,CAAC,uCAAuC,CAAC,CAAC;AAC1D,MAAM,MAAM,wBAAwB,GAChC,iCAAiC,GACjC,8BAA8B,GAC9B,iCAAiC,CAAC;AAGtC,MAAM,MAAM,sCAAsC,GAChD,cAAc,CAAC,6CAA6C,CAAC,CAAC;AAChE,MAAM,MAAM,qCAAqC,GAC/C,cAAc,CAAC,4CAA4C,CAAC,CAAC;AAC/D,MAAM,MAAM,sCAAsC,GAChD,cAAc,CAAC,6CAA6C,CAAC,CAAC;AAChE,MAAM,MAAM,+BAA+B,GACvC,sCAAsC,GACtC,qCAAqC,GACrC,sCAAsC,CAAC;AAG3C,MAAM,MAAM,0BAA0B,GACpC,cAAc,CAAC,+BAA+B,CAAC,CAAC;AAClD,MAAM,MAAM,0BAA0B,GACpC,cAAc,CAAC,+BAA+B,CAAC,CAAC;AAClD,MAAM,MAAM,4BAA4B,GACtC,cAAc,CAAC,iCAAiC,CAAC,CAAC;AACpD,MAAM,MAAM,iBAAiB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,4BAA4B,CAAC;AAGjC,MAAM,MAAM,0BAA0B,GACpC,cAAc,CAAC,+BAA+B,CAAC,CAAC;AAClD,MAAM,MAAM,yBAAyB,GACnC,cAAc,CAAC,8BAA8B,CAAC,CAAC;AACjD,MAAM,MAAM,0BAA0B,GACpC,cAAc,CAAC,+BAA+B,CAAC,CAAC;AAClD,MAAM,MAAM,mBAAmB,GAC3B,0BAA0B,GAC1B,yBAAyB,GACzB,0BAA0B,CAAC;AAE/B,MAAM,MAAM,uBAAuB,GAC/B,kBAAkB,GAClB,wBAAwB,GACxB,+BAA+B,GAC/B,iBAAiB,GACjB,mBAAmB,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload.js","sourceRoot":"","sources":["../../src/types/payload.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Type, type Static } from "typebox";
|
|
2
|
+
export declare const EventTriggerSchema: Type.TObject<{
|
|
3
|
+
types: Type.TOptional<Type.TArray<Type.TString>>;
|
|
4
|
+
branches: Type.TOptional<Type.TArray<Type.TString>>;
|
|
5
|
+
workflows: Type.TOptional<Type.TArray<Type.TString>>;
|
|
6
|
+
}>;
|
|
7
|
+
export type EventTriggerConfig = Static<typeof EventTriggerSchema>;
|
|
8
|
+
export declare const JobSchema: Type.TObject<{
|
|
9
|
+
name: Type.TOptional<Type.TString>;
|
|
10
|
+
if: Type.TOptional<Type.TString>;
|
|
11
|
+
prompt: Type.TString;
|
|
12
|
+
deliverAs: Type.TOptional<Type.TUnion<[Type.TLiteral<"steer">, Type.TLiteral<"followUp">]>>;
|
|
13
|
+
}>;
|
|
14
|
+
export type JobConfig = Static<typeof JobSchema>;
|
|
15
|
+
export declare const WorkflowSchema: Type.TObject<{
|
|
16
|
+
$schema: Type.TOptional<Type.TString>;
|
|
17
|
+
name: Type.TOptional<Type.TString>;
|
|
18
|
+
repo: Type.TOptional<Type.TString>;
|
|
19
|
+
secret: Type.TOptional<Type.TString>;
|
|
20
|
+
on: Type.TUnion<[Type.TString, Type.TArray<Type.TString>, Type.TRecord<"^.*$", Type.TUnion<[Type.TNull, Type.TObject<{
|
|
21
|
+
types: Type.TOptional<Type.TArray<Type.TString>>;
|
|
22
|
+
branches: Type.TOptional<Type.TArray<Type.TString>>;
|
|
23
|
+
workflows: Type.TOptional<Type.TArray<Type.TString>>;
|
|
24
|
+
}>]>>]>;
|
|
25
|
+
jobs: Type.TRecord<"^.*$", Type.TObject<{
|
|
26
|
+
name: Type.TOptional<Type.TString>;
|
|
27
|
+
if: Type.TOptional<Type.TString>;
|
|
28
|
+
prompt: Type.TString;
|
|
29
|
+
deliverAs: Type.TOptional<Type.TUnion<[Type.TLiteral<"steer">, Type.TLiteral<"followUp">]>>;
|
|
30
|
+
}>>;
|
|
31
|
+
}>;
|
|
32
|
+
export type GhWebhookWorkflow = Static<typeof WorkflowSchema>;
|
|
33
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,kBAAkB;;;;EAe9B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,eAAO,MAAM,SAAS;;;;;EAkBrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAEjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;EA2B1B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
export const EventTriggerSchema = Type.Object({
|
|
3
|
+
types: Type.Optional(Type.Array(Type.String(), { description: "Event activity types" })),
|
|
4
|
+
branches: Type.Optional(Type.Array(Type.String(), {
|
|
5
|
+
description: "Branch filters, supports '@current' and globs",
|
|
6
|
+
})),
|
|
7
|
+
workflows: Type.Optional(Type.Array(Type.String(), { description: "Workflow names filter" })),
|
|
8
|
+
}, { additionalProperties: true });
|
|
9
|
+
export const JobSchema = Type.Object({
|
|
10
|
+
name: Type.Optional(Type.String({ description: "Optional job name" })),
|
|
11
|
+
if: Type.Optional(Type.String({
|
|
12
|
+
description: "Condition expression (e.g. \"conclusion == 'failure'\")",
|
|
13
|
+
})),
|
|
14
|
+
prompt: Type.String({ description: "Template string sent to Pi Agent" }),
|
|
15
|
+
deliverAs: Type.Optional(Type.Union([Type.Literal("steer"), Type.Literal("followUp")], {
|
|
16
|
+
description: "Delivery urgency: steer interrupts turn, followUp queues next",
|
|
17
|
+
default: "followUp",
|
|
18
|
+
})),
|
|
19
|
+
}, { additionalProperties: false });
|
|
20
|
+
export const WorkflowSchema = Type.Object({
|
|
21
|
+
$schema: Type.Optional(Type.String()),
|
|
22
|
+
name: Type.Optional(Type.String({ description: "Workflow display name" })),
|
|
23
|
+
repo: Type.Optional(Type.String({
|
|
24
|
+
default: "auto",
|
|
25
|
+
description: "Target GitHub repo (owner/repo or 'auto')",
|
|
26
|
+
})),
|
|
27
|
+
secret: Type.Optional(Type.String({ description: "Optional Webhook HMAC secret" })),
|
|
28
|
+
on: Type.Union([
|
|
29
|
+
Type.String(),
|
|
30
|
+
Type.Array(Type.String()),
|
|
31
|
+
Type.Record(Type.String(), Type.Union([Type.Null(), EventTriggerSchema])),
|
|
32
|
+
], { description: "GitHub event triggers specification" }),
|
|
33
|
+
jobs: Type.Record(Type.String(), JobSchema, { description: "Jobs map" }),
|
|
34
|
+
}, { additionalProperties: false });
|
|
35
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,SAAS,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAC3C;IACE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAClB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC,CACnE;IACD,QAAQ,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE;QACxB,WAAW,EAAE,+CAA+C;KAC7D,CAAC,CACH;IACD,SAAS,EAAE,IAAI,CAAC,QAAQ,CACtB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC,CACpE;CACF,EACD,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAC/B,CAAC;AAIF,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAClC;IACE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC,CAAC;IACtE,EAAE,EAAE,IAAI,CAAC,QAAQ,CACf,IAAI,CAAC,MAAM,CAAC;QACV,WAAW,EAAE,yDAAyD;KACvE,CAAC,CACH;IACD,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,kCAAkC,EAAE,CAAC;IACxE,SAAS,EAAE,IAAI,CAAC,QAAQ,CACtB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE;QAC5D,WAAW,EACT,+DAA+D;QACjE,OAAO,EAAE,UAAU;KACpB,CAAC,CACH;CACF,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAChC,CAAC;AAIF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CACvC;IACE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACrC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAC1E,IAAI,EAAE,IAAI,CAAC,QAAQ,CACjB,IAAI,CAAC,MAAM,CAAC;QACV,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,2CAA2C;KACzD,CAAC,CACH;IACD,MAAM,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8BAA8B,EAAE,CAAC,CAC7D;IACD,EAAE,EAAE,IAAI,CAAC,KAAK,CACZ;QACE,IAAI,CAAC,MAAM,EAAE;QACb,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,CACT,IAAI,CAAC,MAAM,EAAE,EACb,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAC9C;KACF,EACD,EAAE,WAAW,EAAE,qCAAqC,EAAE,CACvD;IACD,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;CACzE,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAChC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,71 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-ghwebhook",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Universal GitHub Webhook event bus and wake-up engine for Pi coding agent",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package",
|
|
7
|
+
"pi",
|
|
8
|
+
"pi-coding-agent",
|
|
9
|
+
"pi-extension",
|
|
10
|
+
"extension",
|
|
11
|
+
"github",
|
|
12
|
+
"webhook",
|
|
13
|
+
"event-bus",
|
|
14
|
+
"automation"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/xifan2333/pi-ghwebhook#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/xifan2333/pi-ghwebhook/issues"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/xifan2333/pi-ghwebhook.git"
|
|
23
|
+
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "xifan",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"src",
|
|
32
|
+
"skills",
|
|
33
|
+
"schemas",
|
|
34
|
+
"README.md",
|
|
35
|
+
"README_zh.md",
|
|
36
|
+
"CHANGELOG.md",
|
|
37
|
+
"LICENSE"
|
|
38
|
+
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc",
|
|
41
|
+
"check": "mise run check",
|
|
42
|
+
"prepublishOnly": "npm run check && npm test",
|
|
43
|
+
"test": "mise run test"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@earendil-works/pi-coding-agent": "^1.5.0",
|
|
47
|
+
"@octokit/openapi-webhooks-types": "^12.2.0",
|
|
48
|
+
"@types/node": "^22.13.0",
|
|
49
|
+
"typebox": "^1.3.27",
|
|
50
|
+
"typescript": "^5.8.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
54
|
+
"typebox": "*"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=22.19.0"
|
|
58
|
+
},
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public",
|
|
61
|
+
"registry": "https://registry.npmjs.org/"
|
|
62
|
+
},
|
|
63
|
+
"pi": {
|
|
64
|
+
"extensions": [
|
|
65
|
+
"./dist/index.js"
|
|
66
|
+
],
|
|
67
|
+
"skills": [
|
|
68
|
+
"./skills"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/xifan2333/pi-ghwebhook/main/schemas/ghwebhook.schema.json",
|
|
4
|
+
"title": "Pi GitHub Webhook Workflow Configuration",
|
|
5
|
+
"description": "GitHub Actions Workflow-compatible event automation configuration for Pi coding agent",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["on", "jobs"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"$schema": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "URL of the JSON schema for validation and autocompletion"
|
|
12
|
+
},
|
|
13
|
+
"name": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Optional display name for this event automation workflow"
|
|
16
|
+
},
|
|
17
|
+
"repo": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"default": "auto",
|
|
20
|
+
"description": "Target GitHub repository in 'owner/repo' format, or 'auto' to detect from git remote"
|
|
21
|
+
},
|
|
22
|
+
"secret": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Optional Webhook HMAC SHA-256 verification secret"
|
|
25
|
+
},
|
|
26
|
+
"on": {
|
|
27
|
+
"description": "GitHub event triggers, matching GitHub Actions 'on' specification",
|
|
28
|
+
"oneOf": [
|
|
29
|
+
{
|
|
30
|
+
"type": "string",
|
|
31
|
+
"description": "Single GitHub event name, e.g. 'push' or 'workflow_run'"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": { "type": "string" },
|
|
36
|
+
"description": "List of GitHub event names, e.g. ['push', 'pull_request']"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "object",
|
|
40
|
+
"description": "Map of event names to their trigger filtering criteria",
|
|
41
|
+
"properties": {
|
|
42
|
+
"workflow_run": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"properties": {
|
|
45
|
+
"types": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"enum": ["completed", "requested", "in_progress"]
|
|
50
|
+
},
|
|
51
|
+
"description": "Activity types that trigger the workflow"
|
|
52
|
+
},
|
|
53
|
+
"branches": {
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": { "type": "string" },
|
|
56
|
+
"description": "Branches to filter on (supports '@current' and globs like 'main', 'feat/*')"
|
|
57
|
+
},
|
|
58
|
+
"workflows": {
|
|
59
|
+
"type": "array",
|
|
60
|
+
"items": { "type": "string" },
|
|
61
|
+
"description": "Workflow names to filter on (e.g. ['CI'])"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"additionalProperties": false
|
|
65
|
+
},
|
|
66
|
+
"pull_request": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"properties": {
|
|
69
|
+
"types": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"items": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"enum": [
|
|
74
|
+
"opened",
|
|
75
|
+
"edited",
|
|
76
|
+
"closed",
|
|
77
|
+
"reopened",
|
|
78
|
+
"synchronize",
|
|
79
|
+
"ready_for_review"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"branches": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": { "type": "string" }
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"additionalProperties": false
|
|
89
|
+
},
|
|
90
|
+
"pull_request_review": {
|
|
91
|
+
"type": "object",
|
|
92
|
+
"properties": {
|
|
93
|
+
"types": {
|
|
94
|
+
"type": "array",
|
|
95
|
+
"items": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"enum": ["submitted", "edited", "dismissed"]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"branches": {
|
|
101
|
+
"type": "array",
|
|
102
|
+
"items": { "type": "string" }
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"additionalProperties": false
|
|
106
|
+
},
|
|
107
|
+
"pull_request_review_comment": {
|
|
108
|
+
"type": "object",
|
|
109
|
+
"properties": {
|
|
110
|
+
"types": {
|
|
111
|
+
"type": "array",
|
|
112
|
+
"items": {
|
|
113
|
+
"type": "string",
|
|
114
|
+
"enum": ["created", "edited", "deleted"]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"additionalProperties": false
|
|
119
|
+
},
|
|
120
|
+
"check_suite": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"properties": {
|
|
123
|
+
"types": {
|
|
124
|
+
"type": "array",
|
|
125
|
+
"items": {
|
|
126
|
+
"type": "string",
|
|
127
|
+
"enum": ["completed", "requested", "rerequested"]
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"branches": {
|
|
131
|
+
"type": "array",
|
|
132
|
+
"items": { "type": "string" }
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"additionalProperties": false
|
|
136
|
+
},
|
|
137
|
+
"issues": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"properties": {
|
|
140
|
+
"types": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"enum": [
|
|
145
|
+
"opened",
|
|
146
|
+
"edited",
|
|
147
|
+
"deleted",
|
|
148
|
+
"closed",
|
|
149
|
+
"reopened",
|
|
150
|
+
"assigned",
|
|
151
|
+
"labeled"
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"additionalProperties": false
|
|
157
|
+
},
|
|
158
|
+
"issue_comment": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"properties": {
|
|
161
|
+
"types": {
|
|
162
|
+
"type": "array",
|
|
163
|
+
"items": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"enum": ["created", "edited", "deleted"]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"additionalProperties": false
|
|
170
|
+
},
|
|
171
|
+
"push": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"properties": {
|
|
174
|
+
"branches": {
|
|
175
|
+
"type": "array",
|
|
176
|
+
"items": { "type": "string" }
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"additionalProperties": false
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"additionalProperties": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"properties": {
|
|
185
|
+
"types": { "type": "array", "items": { "type": "string" } },
|
|
186
|
+
"branches": { "type": "array", "items": { "type": "string" } },
|
|
187
|
+
"workflows": { "type": "array", "items": { "type": "string" } }
|
|
188
|
+
},
|
|
189
|
+
"additionalProperties": true
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
},
|
|
194
|
+
"jobs": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"description": "Map of jobs to execute when matching events arrive",
|
|
197
|
+
"additionalProperties": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"required": ["prompt"],
|
|
200
|
+
"properties": {
|
|
201
|
+
"name": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"description": "Optional job title"
|
|
204
|
+
},
|
|
205
|
+
"if": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"description": "Conditional expression, e.g. \"github.event.workflow_run.conclusion == 'failure'\""
|
|
208
|
+
},
|
|
209
|
+
"prompt": {
|
|
210
|
+
"type": "string",
|
|
211
|
+
"description": "Prompt template sent to Pi Agent, supporting {{ branch }}, {{ run_url }}, etc."
|
|
212
|
+
},
|
|
213
|
+
"deliverAs": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"enum": ["followUp", "steer"],
|
|
216
|
+
"default": "followUp",
|
|
217
|
+
"description": "Pi message delivery mode: 'followUp' (wait for agent to finish) or 'steer' (interrupt turn)"
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
"additionalProperties": false
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"additionalProperties": false
|
|
225
|
+
}
|