Skip to content
Merged
226 changes: 223 additions & 3 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ paths:
patch:
operationId: updateMe
tags: [auth]
summary: Update profile fields (chat name color)
summary: Update profile fields (chat name color, GitHub login)
requestBody:
required: true
content:
Expand All @@ -138,6 +138,9 @@ paths:
name_color:
type: string
description: "#rrggbb, or empty string to clear"
github_login:
type: string
description: GitHub username bound for "mine" filters, or empty to clear
responses:
"200":
description: Updated user
Expand Down Expand Up @@ -2690,7 +2693,7 @@ paths:
properties:
pull:
type: object
description: "number, title, state, draft, merged, mergeable, body, url, author, head, base, additions, deletions, changed_files, commit_count, labels, created_at, updated_at, repo"
description: "number, title, state, draft, merged, mergeable, body, url, author, head, base, additions, deletions, changed_files, commit_count, labels, assignees, reviewers, teams, merged_by, created_at, updated_at, repo"
files:
type: array
items: { type: object }
Expand All @@ -2700,6 +2703,42 @@ paths:
checks:
type: array
items: { type: object }
reviews:
type: array
description: latest submitted review state per reviewer
items: { type: object }
review_decision:
type: string
description: approved | changes_requested | pending | ""
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"502": { description: "GitHub upstream error" }

/api/projects/{projectId}/github/issue:
get:
operationId: issueDetail
summary: In-app GitHub issue detail — issue plus comment thread
tags: [github]
parameters:
- $ref: "#/components/parameters/ProjectId"
- { name: repo, in: query, schema: { type: string }, description: "owner/name or repo id; optional when only one repo is linked" }
- { name: number, in: query, required: true, schema: { type: integer } }
responses:
"200":
description: Issue detail bundle
content:
application/json:
schema:
type: object
properties:
issue:
type: object
description: "number, title, state, body, url, author, avatar_url, author_type, labels, assignees, comment_count, milestone, created_at, updated_at"
comments:
type: array
items: { type: object }
repo:
type: object
"400": { $ref: "#/components/responses/BadRequest" }
"404": { $ref: "#/components/responses/NotFound" }
"502": { description: "GitHub upstream error" }
Expand Down Expand Up @@ -2858,6 +2897,159 @@ paths:
"400": { $ref: "#/components/responses/BadRequest" }
"502": { description: "GitHub upstream error" }

/api/projects/{projectId}/github/labels:
get:
operationId: repoLabels
summary: Label catalog of a linked repository
tags: [github]
parameters:
- $ref: "#/components/parameters/ProjectId"
- { name: repo, in: query, schema: { type: string } }
responses:
"200":
description: Labels
content:
application/json:
schema:
type: object
properties:
labels:
type: array
items:
type: object
properties:
name: { type: string }
color: { type: string }
description: { type: string }
"400": { $ref: "#/components/responses/BadRequest" }
"502": { description: "GitHub upstream error" }
post:
operationId: createRepoLabel
summary: Create a label on a linked repository
tags: [github]
parameters:
- $ref: "#/components/parameters/ProjectId"
- { name: repo, in: query, schema: { type: string } }
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [name]
properties:
name: { type: string }
color:
type: string
description: 6-char hex, with or without '#'
description: { type: string }
responses:
"201":
description: Created label
content:
application/json:
schema:
type: object
properties:
name: { type: string }
color: { type: string }
description: { type: string }
"400": { $ref: "#/components/responses/BadRequest" }
"502": { description: "GitHub upstream error" }

/api/projects/{projectId}/github/assignees:
get:
operationId: repoAssignees
summary: Assignable users of a linked repository
tags: [github]
parameters:
- $ref: "#/components/parameters/ProjectId"
- { name: repo, in: query, schema: { type: string } }
responses:
"200":
description: Assignable users
content:
application/json:
schema:
type: object
properties:
users:
type: array
items:
type: object
properties:
login: { type: string }
avatar_url: { type: string }
type: { type: string }
"400": { $ref: "#/components/responses/BadRequest" }
"502": { description: "GitHub upstream error" }

/api/projects/{projectId}/github/issues/update:
post:
operationId: updateGitHubIssue
summary: Update a GitHub issue's title, body, labels, or assignees
description: Each provided set replaces the whole list on GitHub. Works on PR numbers too — they share the issues endpoint upstream.
tags: [github]
parameters:
- $ref: "#/components/parameters/ProjectId"
- { name: repo, in: query, schema: { type: string } }
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [number]
properties:
number: { type: integer }
title: { type: string }
body: { type: string }
labels: { type: array, items: { type: string } }
assignees: { type: array, items: { type: string } }
responses:
"200":
description: Updated issue fields
content:
application/json:
schema:
type: object
properties:
title: { type: string }
body: { type: string }
labels: { type: array, items: { type: object } }
assignees: { type: array, items: { type: object } }
"400": { $ref: "#/components/responses/BadRequest" }
"502": { description: "GitHub upstream error" }

/api/projects/{projectId}/github/issues/state:
post:
operationId: setIssueState
summary: Close or reopen a GitHub issue
tags: [github]
parameters:
- $ref: "#/components/parameters/ProjectId"
- { name: repo, in: query, schema: { type: string } }
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [number, state]
properties:
number: { type: integer }
state: { type: string, enum: [open, closed] }
responses:
"200":
description: New issue state
content:
application/json:
schema:
type: object
properties: { state: { type: string } }
"400": { $ref: "#/components/responses/BadRequest" }
"502": { description: "GitHub upstream error" }

/api/projects/{projectId}/github/pull/state:
post:
operationId: setPullState
Expand Down Expand Up @@ -2975,10 +3167,11 @@ paths:
/api/workspaces/{workspaceId}/github/pulls:
get:
operationId: workspacePulls
summary: Open pull requests across every linked repo in the workspace
summary: Pull requests across every linked repo in the workspace
tags: [github]
parameters:
- { name: workspaceId, in: path, required: true, schema: { type: string, format: uuid } }
- { name: state, in: query, schema: { type: string, enum: [open, closed, all], default: open } }
responses:
"200":
description: PR groups keyed by project+repo
Expand All @@ -2993,6 +3186,28 @@ paths:
"400": { $ref: "#/components/responses/BadRequest" }
"403": { $ref: "#/components/responses/Forbidden" }

/api/workspaces/{workspaceId}/github/issues:
get:
operationId: workspaceIssues
summary: Issues across every linked repo in the workspace
tags: [github]
parameters:
- { name: workspaceId, in: path, required: true, schema: { type: string, format: uuid } }
- { name: state, in: query, schema: { type: string, enum: [open, closed, all], default: open } }
responses:
"200":
description: Issue groups keyed by project+repo; issue_id links mirrored Relay issues
content:
application/json:
schema:
type: object
properties:
groups:
type: array
items: { type: object }
"400": { $ref: "#/components/responses/BadRequest" }
"403": { $ref: "#/components/responses/Forbidden" }

/api/projects/{projectId}/github/commits:
get:
operationId: gitCommits
Expand Down Expand Up @@ -4393,6 +4608,9 @@ components:
name_color:
type: ["string", "null"]
description: Chat name color as #rrggbb; null = palette default.
github_login:
type: string
description: Bound GitHub username; empty = not linked.
avatar_url: { type: ["string", "null"] }
created_at: { type: string, format: date-time }

Expand Down Expand Up @@ -4915,6 +5133,8 @@ components:
kind: { type: string, enum: [issue, pr] }
state: { type: string, enum: [open, closed, merged], description: "GitHub's raw state" }
url: { type: string }
author: { type: string, description: "GitHub login of the issue/PR author" }
avatar_url: { type: string, description: "GitHub avatar URL of the author" }

IssueActivity:
type: object
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ConfirmHost } from "./components/Confirm";
import { ProfileModalHost } from "./components/ProfileModal";
import { CommitModalHost } from "./features/github/CommitModal";
import { GitHubCreateModalHost } from "./features/github/CreateModals";
import { GitHubIssueModalHost } from "./features/github/GitHubIssueModal";
import { Rail } from "./components/Rail";
import { ServerBanner } from "./components/ServerBanner";
import { LimitedBanner } from "./components/LimitedBanner";
Expand Down Expand Up @@ -55,6 +56,7 @@ export default function App(props: ParentProps) {
<ProfileModalHost />
<CommitModalHost />
<GitHubCreateModalHost />
<GitHubIssueModalHost />
<ConfirmHost />
</div>
</ProjectsProvider>
Expand Down
32 changes: 32 additions & 0 deletions apps/web/src/components/Rail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
CircleDotIcon,
GitPullRequestIcon,
GripIcon,
BookmarkIcon,
Expand Down Expand Up @@ -757,6 +758,7 @@ export function Rail() {
if (e.type === "review.created" || e.type === "review.responded") {
void refreshUnread();
}
if (e.type.startsWith("issue.")) refetchGh();
});
onCleanup(unsub);
createEffect(() => {
Expand All @@ -768,6 +770,22 @@ export function Rail() {
onCleanup(() => window.removeEventListener("keydown", onKey));
});
const active = activeWorkspace(session.workspaces);
// Open-issue/PR counts for the nav badges. Both endpoints cache 60s
// server-side; a missing GitHub app yields null and the badges hide.
const [ghCounts, { refetch: refetchGh }] = createResource(
() => active()?.id,
async (ws) => {
const [pulls, issues] = await Promise.all([
api.workspacePulls(ws).catch(() => null),
api.workspaceIssues(ws).catch(() => null),
]);
return {
pulls: pulls?.groups.reduce((n, g) => n + g.pulls.length, 0) ?? null,
issues:
issues?.groups.reduce((n, g) => n + g.issues.length, 0) ?? null,
};
},
);
// The rail shows one workspace at a time — workspaces are separate
// namespaces, so switching swaps the whole project list.
const list = () =>
Expand Down Expand Up @@ -925,6 +943,20 @@ export function Rail() {
<NavItem href="/app/pulls">
<GitPullRequestIcon class="h-3.5 w-3.5" />
Pull requests
<Show when={(ghCounts()?.pulls ?? 0) > 0}>
<span class="ml-auto rounded-full bg-hover px-1.5 py-px font-mono text-[10px] leading-4 text-muted">
{ghCounts()?.pulls}
</span>
</Show>
</NavItem>
<NavItem href="/app/issues">
<CircleDotIcon class="h-3.5 w-3.5" />
Issues
<Show when={(ghCounts()?.issues ?? 0) > 0}>
<span class="ml-auto rounded-full bg-hover px-1.5 py-px font-mono text-[10px] leading-4 text-muted">
{ghCounts()?.issues}
</span>
</Show>
</NavItem>
</nav>

Expand Down
18 changes: 18 additions & 0 deletions apps/web/src/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,24 @@ export function IssueIcon(props: IconProps): JSX.Element {
);
}

export function CircleDotIcon(props: IconProps): JSX.Element {
return (
<svg
viewBox="0 0 16 16"
class={props.class}
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
>
<circle cx="8" cy="8" r="6" />
<circle cx="8" cy="8" r="1.5" fill="currentColor" stroke="none" />
</svg>
);
}

export function GitPullRequestIcon(props: IconProps): JSX.Element {
return (
<svg
Expand Down
Loading