@markjaquith/agency 2.49.0 → 2.50.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.
@@ -43,6 +43,8 @@ const IsoTimestamp = NonEmptyString.pipe(
43
43
  Schema.pattern(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/),
44
44
  )
45
45
 
46
+ const GitCommit = Schema.String.pipe(Schema.pattern(/^[a-f0-9]{40}$/))
47
+
46
48
  const DocumentRevision = Schema.String.pipe(Schema.pattern(/^[a-f0-9]{64}$/))
47
49
 
48
50
  export const ClaimRecord = Schema.Struct({
@@ -172,9 +174,61 @@ const MultiPhaseTaskFrontmatter = Schema.Struct({
172
174
  phases: Schema.Array(Dependency),
173
175
  })
174
176
 
177
+ export const ReviewPullRequestSource = Schema.Struct({
178
+ kind: Schema.Literal("pull-request"),
179
+ provider: Schema.Literal("github"),
180
+ repository: NonEmptyString,
181
+ identifier: NonEmptyString.pipe(Schema.pattern(/^\d+$/)),
182
+ url: GitHubPullRequestUrl,
183
+ fetchRef: NonEmptyString,
184
+ }).pipe(
185
+ Schema.filter(
186
+ (source) =>
187
+ source.url ===
188
+ `https://github.com/${source.repository}/pull/${source.identifier}` &&
189
+ source.fetchRef === `refs/pull/${source.identifier}/head`,
190
+ {
191
+ message: () =>
192
+ "Pull request review source URL, repository, identifier, and fetch ref must agree",
193
+ },
194
+ ),
195
+ )
196
+
197
+ export const ReviewBranchSource = Schema.Struct({
198
+ kind: Schema.Literal("branch"),
199
+ ref: NonEmptyString.pipe(
200
+ Schema.pattern(
201
+ /^refs\/heads\/(?!HEAD$)(?!.*(?:\.\.|@\{|[ ~^:?*\[\\\]]))(?!.*\/\/)(?!.*(?:^|\/)\.)(?!.*\/$)(?!.*\.lock(?:\/|$))[A-Za-z0-9._\/-]+$/,
202
+ ),
203
+ ),
204
+ })
205
+
206
+ export const ReviewSource = Schema.Union(
207
+ ReviewPullRequestSource,
208
+ ReviewBranchSource,
209
+ )
210
+
211
+ export const ReviewRecord = Schema.Struct({
212
+ repo: RepositoryAlias,
213
+ source: ReviewSource,
214
+ commit: GitCommit,
215
+ refreshedAt: IsoTimestamp,
216
+ })
217
+
218
+ const ReviewTaskFrontmatter = Schema.Struct({
219
+ ticketUrl: Schema.NullOr(Url),
220
+ description: Description,
221
+ epic: Schema.optional(EntityId),
222
+ review: ReviewRecord,
223
+ status: Schema.optionalWith(WorkStatus, { default: () => "open" as const }),
224
+ claim: Schema.optional(ClaimRecord),
225
+ completion: Schema.optional(CompletionRecord),
226
+ })
227
+
175
228
  export const TaskFrontmatter = Schema.Union(
176
229
  SinglePhaseTaskFrontmatter,
177
230
  MultiPhaseTaskFrontmatter,
231
+ ReviewTaskFrontmatter,
178
232
  )
179
233
 
180
234
  export const PhaseFrontmatter = Schema.Struct({
@@ -195,6 +249,8 @@ export type RepositoryDeclaration = Schema.Schema.Type<
195
249
  export type WorkStatus = Schema.Schema.Type<typeof WorkStatus>
196
250
  export type ClaimRecord = Schema.Schema.Type<typeof ClaimRecord>
197
251
  export type PullRequestRecord = Schema.Schema.Type<typeof PullRequestRecord>
252
+ export type ReviewSource = Schema.Schema.Type<typeof ReviewSource>
253
+ export type ReviewRecord = Schema.Schema.Type<typeof ReviewRecord>
198
254
  export type CompletionRecord = Schema.Schema.Type<typeof CompletionRecord>
199
255
  export type EpicFrontmatter = Schema.Schema.Type<typeof EpicFrontmatter>
200
256
  export type TaskFrontmatter = Schema.Schema.Type<typeof TaskFrontmatter>