@chernabog/sdk 0.1.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chernabog/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "description": "Services and helpers for writing Chernabog flows and steps",
6
6
  "repository": {
@@ -12,7 +12,9 @@
12
12
  "exports": {
13
13
  ".": "./src/index.ts"
14
14
  },
15
- "files": ["src"],
15
+ "files": [
16
+ "src"
17
+ ],
16
18
  "peerDependencies": {
17
19
  "effect": "4.0.5"
18
20
  },
package/src/implement.ts CHANGED
@@ -32,6 +32,7 @@ export const issueItem = (issue: Issue): WorkItem => ({
32
32
  title: issue.title,
33
33
  url: issue.url,
34
34
  data: { issue: issue.number },
35
+ assignees: issue.assignees,
35
36
  });
36
37
 
37
38
  // The issue number a work item from `trigger` carries.
@@ -50,7 +51,7 @@ export const sessionIdFor = (runId: string, purpose: string) => {
50
51
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-4${hex.slice(13, 16)}-${variant}${hex.slice(17, 20)}-${hex.slice(20, 32)}`;
51
52
  };
52
53
 
53
- // Issues labelled eligible, oldest first.
54
+ // Issues labelled eligible, oldest first, each with its assignees.
54
55
  export const trigger = GitHub.use((github) => github.queuedIssues).pipe(Effect.map((issues) => issues.map(issueItem)));
55
56
 
56
57
  // The account is the one machine config expects, and it has room for a task.
package/src/review.ts CHANGED
@@ -44,6 +44,8 @@ const reviewItem = (pull: PullRequest): WorkItem => ({
44
44
  title: pull.title,
45
45
  url: pull.url,
46
46
  data: { pullRequest: pull.number, headRef: pull.headRef, agentWritten: isAgentBranch(pull.headRef) },
47
+ assignees: pull.assignees,
48
+ reviewers: pull.requestedReviewers,
47
49
  });
48
50
 
49
51
  // The head the latest review saw.
package/src/services.ts CHANGED
@@ -117,6 +117,10 @@ export const WorkItem = Schema.Struct({
117
117
  signals: Schema.optionalKey(Schema.Array(Schema.String)),
118
118
  // Only wakes a run already waiting on it; never starts one.
119
119
  wakeOnly: Schema.optionalKey(Schema.Boolean),
120
+ // GitHub logins assigned to the item, and asked to review it, which
121
+ // flows.<flow>.assignee and reviewRequested match to choose the machines it starts on.
122
+ assignees: Schema.optionalKey(Schema.Array(Schema.String)),
123
+ reviewers: Schema.optionalKey(Schema.Array(Schema.String)),
120
124
  });
121
125
 
122
126
  export type WorkItem = typeof WorkItem.Type;
@@ -134,6 +138,7 @@ export type Issue = {
134
138
  readonly url: string;
135
139
  readonly createdAt: string;
136
140
  readonly labels: ReadonlyArray<string>;
141
+ readonly assignees: ReadonlyArray<string>;
137
142
  };
138
143
 
139
144
  export type Comment = { readonly id: number; readonly author: string; readonly body: string; readonly createdAt: string; readonly trusted: boolean };
@@ -152,6 +157,9 @@ export type PullRequest = {
152
157
  readonly baseRef: string;
153
158
  readonly labels: ReadonlyArray<string>;
154
159
  readonly author: string;
160
+ readonly assignees: ReadonlyArray<string>;
161
+ // Users asked to review it who haven't yet; GitHub drops one once they review.
162
+ readonly requestedReviewers: ReadonlyArray<string>;
155
163
  };
156
164
 
157
165
  export type ReviewComment = { readonly path: string; readonly line: number; readonly body: string };