@kitlangton/ghui 0.1.16 → 0.1.18
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 +29 -27
- package/package.json +2 -1
- package/src/App.tsx +1006 -132
- package/src/domain.ts +47 -1
- package/src/services/CommandRunner.ts +8 -1
- package/src/services/GitHubService.ts +286 -184
- package/src/ui/DetailsPane.tsx +26 -25
- package/src/ui/FooterHints.tsx +60 -0
- package/src/ui/PullRequestDiffPane.tsx +105 -33
- package/src/ui/PullRequestList.tsx +38 -13
- package/src/ui/colors.ts +41 -0
- package/src/ui/commentEditor.ts +126 -0
- package/src/ui/diff.ts +204 -7
- package/src/ui/modals.tsx +322 -8
- package/src/ui/pullRequests.ts +2 -0
package/src/domain.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
export type PullRequestState = "open" | "closed"
|
|
1
|
+
export type PullRequestState = "open" | "closed" | "merged"
|
|
2
|
+
|
|
3
|
+
export const pullRequestQueueModes = ["authored", "review", "assigned", "mentioned"] as const
|
|
4
|
+
|
|
5
|
+
export type PullRequestQueueMode = typeof pullRequestQueueModes[number]
|
|
6
|
+
|
|
7
|
+
export const pullRequestQueueLabels = {
|
|
8
|
+
authored: "authored",
|
|
9
|
+
review: "review requested",
|
|
10
|
+
assigned: "assigned",
|
|
11
|
+
mentioned: "mentioned",
|
|
12
|
+
} as const satisfies Record<PullRequestQueueMode, string>
|
|
13
|
+
|
|
14
|
+
export const pullRequestQueueSearchQualifier = (mode: PullRequestQueueMode, author: string) => {
|
|
15
|
+
const qualifiers = {
|
|
16
|
+
authored: `author:${author}`,
|
|
17
|
+
review: "review-requested:@me",
|
|
18
|
+
assigned: "assignee:@me",
|
|
19
|
+
mentioned: "mentions:@me",
|
|
20
|
+
} as const satisfies Record<PullRequestQueueMode, string>
|
|
21
|
+
return qualifiers[mode]
|
|
22
|
+
}
|
|
2
23
|
|
|
3
24
|
export type CheckConclusion = "success" | "failure" | "neutral" | "skipped" | "cancelled" | "timed_out"
|
|
4
25
|
|
|
@@ -13,8 +34,33 @@ export interface PullRequestLabel {
|
|
|
13
34
|
readonly color: string | null
|
|
14
35
|
}
|
|
15
36
|
|
|
37
|
+
export type DiffCommentSide = "LEFT" | "RIGHT"
|
|
38
|
+
|
|
39
|
+
export interface CreatePullRequestCommentInput {
|
|
40
|
+
readonly repository: string
|
|
41
|
+
readonly number: number
|
|
42
|
+
readonly commitId: string
|
|
43
|
+
readonly path: string
|
|
44
|
+
readonly line: number
|
|
45
|
+
readonly side: DiffCommentSide
|
|
46
|
+
readonly body: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface PullRequestReviewComment {
|
|
50
|
+
readonly id: string
|
|
51
|
+
readonly path: string
|
|
52
|
+
readonly line: number
|
|
53
|
+
readonly side: DiffCommentSide
|
|
54
|
+
readonly author: string
|
|
55
|
+
readonly body: string
|
|
56
|
+
readonly createdAt: Date | null
|
|
57
|
+
readonly url: string | null
|
|
58
|
+
}
|
|
59
|
+
|
|
16
60
|
export interface PullRequestItem {
|
|
17
61
|
readonly repository: string
|
|
62
|
+
readonly author: string
|
|
63
|
+
readonly headRefOid: string
|
|
18
64
|
readonly number: number
|
|
19
65
|
readonly title: string
|
|
20
66
|
readonly body: string
|
|
@@ -28,6 +28,8 @@ const readStream = async (stream: ReadableStream | null | undefined) => {
|
|
|
28
28
|
export class CommandRunner extends Context.Service<CommandRunner, {
|
|
29
29
|
readonly run: (command: string, args: readonly string[]) => Effect.Effect<CommandResult, CommandError>
|
|
30
30
|
readonly runJson: <A>(command: string, args: readonly string[]) => Effect.Effect<A, CommandError | JsonParseError>
|
|
31
|
+
readonly runSchema: <S extends Schema.Top>(schema: S, command: string, args: readonly string[]) =>
|
|
32
|
+
Effect.Effect<S["Type"], CommandError | JsonParseError | Schema.SchemaError, S["DecodingServices"]>
|
|
31
33
|
}>()("ghui/CommandRunner") {
|
|
32
34
|
static readonly layer = Layer.effect(
|
|
33
35
|
CommandRunner,
|
|
@@ -70,7 +72,12 @@ export class CommandRunner extends Context.Service<CommandRunner, {
|
|
|
70
72
|
})
|
|
71
73
|
})
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
const runSchema = Effect.fn("CommandRunner.runSchema")(function*<S extends Schema.Top>(schema: S, command: string, args: readonly string[]) {
|
|
76
|
+
const value = yield* runJson<unknown>(command, args)
|
|
77
|
+
return yield* Schema.decodeUnknownEffect(schema)(value)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
return CommandRunner.of({ run, runJson, runSchema })
|
|
74
81
|
}),
|
|
75
82
|
)
|
|
76
83
|
}
|