@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.
- package/README.md +22 -1
- package/cli.ts +23 -0
- package/package.json +1 -1
- package/schemas/agency-graph-v1.schema.json +141 -38
- package/src/cli-parser.test.ts +62 -0
- package/src/cli-parser.ts +55 -1
- package/src/commands/review.ts +38 -0
- package/src/commands/task.ts +27 -5
- package/src/commands/work.test.ts +2 -0
- package/src/commands/work.ts +2 -2
- package/src/graph-schema.ts +35 -13
- package/src/protocol.ts +1 -0
- package/src/services/ArchiveService.test.ts +2 -2
- package/src/services/ArchiveService.ts +1 -0
- package/src/services/ClaimService.ts +3 -2
- package/src/services/ContextService.ts +56 -4
- package/src/services/DoctorService.ts +45 -1
- package/src/services/GraphMutationService.ts +5 -0
- package/src/services/GraphService.ts +118 -54
- package/src/services/PhaseService.ts +5 -0
- package/src/services/PullRequestService.test.ts +2 -2
- package/src/services/PullRequestService.ts +23 -3
- package/src/services/ReadinessService.ts +7 -3
- package/src/services/ReviewService.test.ts +472 -0
- package/src/services/ReviewService.ts +404 -0
- package/src/services/SyncService.test.ts +2 -2
- package/src/services/SyncService.ts +110 -6
- package/src/services/TaskService.ts +82 -9
- package/src/services/WorkbaseService.ts +2 -1
- package/src/services/WorktreeService.test.ts +16 -16
- package/src/services/WorktreeService.ts +76 -40
- package/src/test-utils.ts +2 -0
- package/src/work-view.ts +14 -6
- package/src/workbase/schemas.test.ts +57 -0
- package/src/workbase/schemas.ts +56 -0
package/src/workbase/schemas.ts
CHANGED
|
@@ -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>
|