From 06d522df02410c2a043ec3a8c109909913654f5e Mon Sep 17 00:00:00 2001
From: Devin
Date: Sat, 7 Nov 2026 12:54:40 +0100
Subject: [PATCH 1/7] =?UTF-8?q?ci:=20move=20lanes=20to=20self-hosted=20run?=
=?UTF-8?q?ners=20=E2=80=94=20never=20use=20GitHub-hosted?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/ci.yml | 12 ++++++------
.github/workflows/ployz-build.yml | 4 ++--
.github/workflows/release.yml | 6 +++---
.github/workflows/tag-release.yml | 2 +-
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2600422..30dab24 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -8,7 +8,7 @@ on:
jobs:
backend:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
services:
postgres:
image: postgres:17
@@ -38,7 +38,7 @@ jobs:
RELAY_TEST_DATABASE_URL: postgres://relay:relay@127.0.0.1:5432/relay_e2e?sslmode=disable
web:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
@@ -52,7 +52,7 @@ jobs:
- run: npm run build --prefix apps/web
openapi:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
@@ -66,7 +66,7 @@ jobs:
diff -u packages/api-client/src/generated/schema.ts /tmp/schema.ts
docker:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
permissions:
packages: write
contents: read
@@ -93,7 +93,7 @@ jobs:
docker push ghcr.io/dvorinka/relay:sha-${GITHUB_SHA:0:7}
desktop:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
@@ -137,7 +137,7 @@ jobs:
path: apps/desktop/build/bin/relay-desktop
security:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v7
- uses: aquasecurity/trivy-action@master
diff --git a/.github/workflows/ployz-build.yml b/.github/workflows/ployz-build.yml
index 14f7de9..3641a3a 100644
--- a/.github/workflows/ployz-build.yml
+++ b/.github/workflows/ployz-build.yml
@@ -4,13 +4,13 @@ on:
inputs:
build: { required: true, type: string }
cloud: { required: true, type: string }
- runner: { required: false, type: string, default: ubuntu-latest }
+ runner: { required: false, type: string, default: self-hosted }
permissions:
contents: read
id-token: write
jobs:
build:
- runs-on: ${{ inputs.runner }}
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: getployz/build@v1
with:
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e833e1b..2b4c89b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,7 +11,7 @@ permissions:
jobs:
build:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
@@ -146,7 +146,7 @@ jobs:
# always set the secrets).
apk:
needs: build
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
env:
ANDROID_KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_B64 }}
steps:
@@ -194,7 +194,7 @@ jobs:
# Publish the runtime image to GHCR: ghcr.io/dvorinka/relay: + :latest
image:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v7
- uses: docker/setup-buildx-action@v4
diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml
index af4738e..6a2b7d3 100644
--- a/.github/workflows/tag-release.yml
+++ b/.github/workflows/tag-release.yml
@@ -19,7 +19,7 @@ concurrency:
jobs:
tag:
- runs-on: ubuntu-latest
+ runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v7
with:
From 4914f8c46d02b73183043a87818e18fc71bc9722 Mon Sep 17 00:00:00 2001
From: Tomas Dvorak
Date: Sat, 7 Nov 2026 16:02:00 +0100
Subject: [PATCH 2/7] fix: bump dompurify to 3.4.17 (GHSA-cg2g-xh64-v4q7,
GHSA-mrv2-3pqr-j5jr)
---
apps/web/package.json | 2 +-
package-lock.json | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/apps/web/package.json b/apps/web/package.json
index 0593367..a38d76b 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -17,7 +17,7 @@
"@excalidraw/excalidraw": "0.18.1",
"@relay/api-client": "0.0.0",
"@solidjs/router": "1.0.0",
- "dompurify": "^3.4.16",
+ "dompurify": "^3.4.17",
"marked": "^18.0.13",
"react": "19.3.0",
"react-dom": "19.3.0",
diff --git a/package-lock.json b/package-lock.json
index 67efb94..8a95ad3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -27,7 +27,7 @@
"@excalidraw/excalidraw": "0.18.1",
"@relay/api-client": "0.0.0",
"@solidjs/router": "1.0.0",
- "dompurify": "^3.4.16",
+ "dompurify": "^3.4.17",
"marked": "^18.0.13",
"react": "19.3.0",
"react-dom": "19.3.0",
@@ -5203,9 +5203,9 @@
"license": "MIT"
},
"node_modules/dompurify": {
- "version": "3.4.16",
- "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.16.tgz",
- "integrity": "sha512-sqo+pNp3qRhCIpbgRi1y8Tgk27Bo2Ry7w0dC1NBeNTdZChWjz9Xb/KOoZbRP/R6pQZ80Qw8YhXw13hWWBbMRnQ==",
+ "version": "3.4.17",
+ "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.17.tgz",
+ "integrity": "sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
From aa592f02264b59f474154d6d74d87f46cd42ba27 Mon Sep 17 00:00:00 2001
From: Tomas Dvorak
Date: Sat, 7 Nov 2026 16:04:39 +0100
Subject: [PATCH 3/7] ci: publish postgres on unique host port 15432
(self-hosted port collisions)
---
.github/workflows/ci.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 30dab24..9f95934 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,7 +16,7 @@ jobs:
POSTGRES_USER: relay
POSTGRES_PASSWORD: relay
POSTGRES_DB: relay_e2e
- ports: ["5432:5432"]
+ ports: ["15432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 5s
@@ -35,7 +35,7 @@ jobs:
- run: go build ./...
- run: go test ./...
env:
- RELAY_TEST_DATABASE_URL: postgres://relay:relay@127.0.0.1:5432/relay_e2e?sslmode=disable
+ RELAY_TEST_DATABASE_URL: postgres://relay:relay@127.0.0.1:15432/relay_e2e?sslmode=disable
web:
runs-on: [self-hosted, linux, x64]
From 0806215781aea7fccad7e8232c54920c11389d3c Mon Sep 17 00:00:00 2001
From: Tomas Dvorak
Date: Sat, 7 Nov 2026 16:06:04 +0100
Subject: [PATCH 4/7] ci: drop unused runner dispatch input (runs-on is fixed
self-hosted)
---
.github/workflows/ployz-build.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.github/workflows/ployz-build.yml b/.github/workflows/ployz-build.yml
index 3641a3a..12f916e 100644
--- a/.github/workflows/ployz-build.yml
+++ b/.github/workflows/ployz-build.yml
@@ -4,7 +4,6 @@ on:
inputs:
build: { required: true, type: string }
cloud: { required: true, type: string }
- runner: { required: false, type: string, default: self-hosted }
permissions:
contents: read
id-token: write
From c74c491bf5639865f3b6f098be2756d8bed2529f Mon Sep 17 00:00:00 2001
From: Tomas Dvorak
Date: Sat, 7 Nov 2026 16:37:23 +0100
Subject: [PATCH 5/7] =?UTF-8?q?fix:=20bump=20vulnerable=20deps=20=E2=80=94?=
=?UTF-8?q?=20echo=204.16.1,=20x/net=200.62.0,=20node-forge=201.4.3,=20dec?=
=?UTF-8?q?ode-uri-component=200.5.1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/desktop/go.mod | 6 ++---
apps/desktop/go.sum | 12 +++++-----
apps/mobile/package-lock.json | 42 ++++++-----------------------------
apps/mobile/package.json | 6 ++++-
go.mod | 2 +-
go.sum | 4 ++--
6 files changed, 24 insertions(+), 48 deletions(-)
diff --git a/apps/desktop/go.mod b/apps/desktop/go.mod
index 9fcf213..046fcbd 100644
--- a/apps/desktop/go.mod
+++ b/apps/desktop/go.mod
@@ -18,13 +18,13 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
- github.com/labstack/echo/v4 v4.15.3 // indirect
+ github.com/labstack/echo/v4 v4.16.1 // indirect
github.com/labstack/gommon v0.5.0 // indirect
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
github.com/leaanthony/gosod v1.0.4 // indirect
github.com/leaanthony/slicer v1.6.0 // indirect
github.com/leaanthony/u v1.1.1 // indirect
- github.com/mattn/go-colorable v0.1.14 // indirect
+ github.com/mattn/go-colorable v0.1.15 // indirect
github.com/mattn/go-isatty v0.0.22 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
@@ -36,6 +36,6 @@ require (
github.com/wailsapp/go-webview2 v1.0.22 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.58.0 // indirect
- golang.org/x/net v0.61.0 // indirect
+ golang.org/x/net v0.62.0 // indirect
golang.org/x/text v0.43.0 // indirect
)
diff --git a/apps/desktop/go.sum b/apps/desktop/go.sum
index 1e16a79..6897b95 100644
--- a/apps/desktop/go.sum
+++ b/apps/desktop/go.sum
@@ -16,8 +16,8 @@ github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aN
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
-github.com/labstack/echo/v4 v4.15.3 h1:lIdG4kK5RdMyhwCwSc4AmSQsLBb3AVwok6S8PX/9kwQ=
-github.com/labstack/echo/v4 v4.15.3/go.mod h1:Xzp1Ns1RA2c9fY7nSgUJkpkUZGNbEIVHZbtbOMPktBI=
+github.com/labstack/echo/v4 v4.16.1 h1:h05NuF1GvNu6jSAZxOv++AdjD/NJK+mZdGy0thiiuns=
+github.com/labstack/echo/v4 v4.16.1/go.mod h1:V/EQaTVHYJH92QhbQe7kFQ4mjgcjxLQQUQtAN87zZdw=
github.com/labstack/gommon v0.5.0 h1:6VSQ2NOzsnEJ5W6+84E0RbcaDDmgB6NIAzWCczTEe6c=
github.com/labstack/gommon v0.5.0/go.mod h1:Rzlg7HHy1maLfzBYGg9NZcVuz1sA68HHhLjhcEllYE0=
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
@@ -33,8 +33,8 @@ github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQc
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
-github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
-github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
+github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
+github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
@@ -65,8 +65,8 @@ github.com/wailsapp/wails/v2 v2.16.0/go.mod h1:scxrgwfsv6yR6fE6cCF+Flfl+JeU+SR87
golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54=
golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
-golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
-golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
+golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
+golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
diff --git a/apps/mobile/package-lock.json b/apps/mobile/package-lock.json
index 9ae6c10..98962cf 100644
--- a/apps/mobile/package-lock.json
+++ b/apps/mobile/package-lock.json
@@ -4390,12 +4390,12 @@
}
},
"node_modules/decode-uri-component": {
- "version": "0.2.2",
- "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz",
- "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==",
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.5.1.tgz",
+ "integrity": "sha512-vWHQkXgg2cE3BB4rR0c+PYw9BCQzLoNIRMI7AunIkZst74tw/vpPp7VLoYtsR/cy1f55g3XDWUslfeCZjiZJyA==",
"license": "MIT",
"engines": {
- "node": ">=0.10"
+ "node": ">=14.16"
}
},
"node_modules/deep-is": {
@@ -6131,34 +6131,6 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
- "node_modules/expo/node_modules/react-native-worklets": {
- "version": "0.10.4",
- "resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.10.4.tgz",
- "integrity": "sha512-gbk0CxMrGywEp3SJAHO+2JVaCWtl4WyAYBIxLZy6Y113+mHHuq3FuT6iV+VcaBuJzuuN34mtdZ4j5JIlBDzmeA==",
- "license": "MIT",
- "optional": true,
- "peer": true,
- "dependencies": {
- "@babel/plugin-transform-arrow-functions": "^7.27.1",
- "@babel/plugin-transform-class-properties": "^7.28.6",
- "@babel/plugin-transform-classes": "^7.28.6",
- "@babel/plugin-transform-nullish-coalescing-operator": "^7.28.6",
- "@babel/plugin-transform-optional-chaining": "^7.28.6",
- "@babel/plugin-transform-shorthand-properties": "^7.27.1",
- "@babel/plugin-transform-template-literals": "^7.27.1",
- "@babel/plugin-transform-unicode-regex": "^7.27.1",
- "@babel/preset-typescript": "^7.28.5",
- "@babel/types": "^7.27.1",
- "convert-source-map": "^2.0.0",
- "semver": "^7.7.4"
- },
- "peerDependencies": {
- "@babel/core": "*",
- "@react-native/metro-config": "*",
- "react": "*",
- "react-native": "0.83 - 0.86"
- }
- },
"node_modules/expo/node_modules/ws": {
"version": "8.22.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz",
@@ -8533,9 +8505,9 @@
}
},
"node_modules/node-forge": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.0.tgz",
- "integrity": "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==",
+ "version": "1.4.3",
+ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.3.tgz",
+ "integrity": "sha512-P6wzfh6t70avmV8FrVEAd/36sOPJQ+hkaJVX1Laap9J/77m7M0eyozDvc8SwnDf4P7MP94gwbAAo0rg3YVXT+g==",
"license": "(BSD-3-Clause OR GPL-2.0)",
"engines": {
"node": ">= 6.13.0"
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 3dfe7d2..4efdba5 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -37,5 +37,9 @@
"lint": "expo lint",
"bundle": "npm run build:bundle --prefix ../web"
},
- "private": true
+ "private": true,
+ "overrides": {
+ "decode-uri-component": "^0.5.1",
+ "node-forge": "^1.4.1"
+ }
}
diff --git a/go.mod b/go.mod
index aa85534..13f0816 100644
--- a/go.mod
+++ b/go.mod
@@ -12,7 +12,7 @@ require (
github.com/pressly/goose/v3 v3.29.0
go.uber.org/zap v1.28.0
golang.org/x/crypto v0.58.0
- golang.org/x/net v0.61.0
+ golang.org/x/net v0.62.0
)
require (
diff --git a/go.sum b/go.sum
index 5193358..eb3f54f 100644
--- a/go.sum
+++ b/go.sum
@@ -174,8 +174,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
-golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
-golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
+golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY=
+golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
From 4fbfd2756126e08f042ca49b3fe2b3782bc2e1c2 Mon Sep 17 00:00:00 2001
From: Tomas Dvorak
Date: Sat, 7 Nov 2026 16:39:54 +0100
Subject: [PATCH 6/7] =?UTF-8?q?fix:=20echo=20v4.16.3=20=E2=80=94=20clears?=
=?UTF-8?q?=20GHSA-246p-cpwv-v3jq,=20GHSA-99jh-6h7p-pp36?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
apps/desktop/go.mod | 2 +-
apps/desktop/go.sum | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/apps/desktop/go.mod b/apps/desktop/go.mod
index 046fcbd..25d5b5a 100644
--- a/apps/desktop/go.mod
+++ b/apps/desktop/go.mod
@@ -18,7 +18,7 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
- github.com/labstack/echo/v4 v4.16.1 // indirect
+ github.com/labstack/echo/v4 v4.16.3 // indirect
github.com/labstack/gommon v0.5.0 // indirect
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
github.com/leaanthony/gosod v1.0.4 // indirect
diff --git a/apps/desktop/go.sum b/apps/desktop/go.sum
index 6897b95..0c39c56 100644
--- a/apps/desktop/go.sum
+++ b/apps/desktop/go.sum
@@ -18,6 +18,8 @@ github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4P
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/labstack/echo/v4 v4.16.1 h1:h05NuF1GvNu6jSAZxOv++AdjD/NJK+mZdGy0thiiuns=
github.com/labstack/echo/v4 v4.16.1/go.mod h1:V/EQaTVHYJH92QhbQe7kFQ4mjgcjxLQQUQtAN87zZdw=
+github.com/labstack/echo/v4 v4.16.3 h1:wAzM49wiBxHpZJQ621lminvdxbwfd1Cn6KwRThKV6nA=
+github.com/labstack/echo/v4 v4.16.3/go.mod h1:V/EQaTVHYJH92QhbQe7kFQ4mjgcjxLQQUQtAN87zZdw=
github.com/labstack/gommon v0.5.0 h1:6VSQ2NOzsnEJ5W6+84E0RbcaDDmgB6NIAzWCczTEe6c=
github.com/labstack/gommon v0.5.0/go.mod h1:Rzlg7HHy1maLfzBYGg9NZcVuz1sA68HHhLjhcEllYE0=
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
From 3db47da432571d6be75c389bf60e066886d2a0c1 Mon Sep 17 00:00:00 2001
From: Tomas Dvorak
Date: Thu, 12 Nov 2026 08:59:23 +0100
Subject: [PATCH 7/7] feat(github): workspace Issues page, author identity,
review state, and issue editing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- GET /workspaces/:id/github/issues — fan-out aggregation mirroring pulls,
open/closed/all state filter, per-repo failure reporting, 60s cache
- Issues page in the rail with live open-count badge; Pulls gains the same
- Author avatars + login highlighting on every issue/PR surface; bot badges
driven by GitHub's real user.type
- Mirrored issues persist github_author/github_avatar_url (migration 0054),
backfilled by webhook, bulk import, and reconcile
- In-app GitHub issue detail modal: body, comment thread, composer,
close/reopen, deep-linkable via /app/p/:id?gh=owner/name:N
- Label/assignee editing on issues and PRs (PATCH issues/{n}), inline
label creation, and title/body editing in the issue modal
- PR review decisions: latest-state-per-reviewer reduction, decision chip,
reviewer/assignee/team-requested avatar stacks, merged_by, comment counts
- users.github_login (migration 0055) + Settings binding with existence
check; unlocks "filed by me / assigned to me / my review requested"
filters on the workspace pages
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
---
api/openapi.yaml | 226 +++++++-
apps/web/src/App.tsx | 2 +
apps/web/src/components/Rail.tsx | 32 ++
apps/web/src/components/icons.tsx | 18 +
apps/web/src/features/github/GitHub.tsx | 368 +++++++++++-
.../src/features/github/GitHubIssueModal.tsx | 378 ++++++++++++
.../src/features/github/PullRequestDetail.tsx | 108 +++-
.../src/features/github/PullRequestList.tsx | 14 +-
apps/web/src/features/issues/meta.tsx | 13 +-
.../web/src/features/projects/ProjectPage.tsx | 15 +
apps/web/src/features/workspaces/Settings.tsx | 51 ++
apps/web/src/main.tsx | 2 +
apps/web/src/pages/Issues.tsx | 343 +++++++++++
apps/web/src/pages/Pulls.tsx | 252 ++++++--
db/migrations/0054_github_author.sql | 9 +
db/migrations/0055_github_login.sql | 5 +
db/queries/github.sql | 8 +-
db/queries/users.sql | 14 +-
internal/auth/handlers.go | 105 +++-
internal/auth/service.go | 2 +-
internal/db/github.sql.go | 30 +-
internal/db/issues.sql.go | 26 +-
internal/db/mcp.sql.go | 100 ++--
internal/db/models.go | 41 +-
internal/db/users.sql.go | 99 +++-
internal/github/client.go | 226 +++++++-
internal/github/github.go | 538 +++++++++++++++++-
internal/issues/issues.go | 9 +
packages/api-client/src/generated/schema.ts | 406 ++++++++++++-
packages/api-client/src/index.ts | 153 ++++-
30 files changed, 3340 insertions(+), 253 deletions(-)
create mode 100644 apps/web/src/features/github/GitHubIssueModal.tsx
create mode 100644 apps/web/src/pages/Issues.tsx
create mode 100644 db/migrations/0054_github_author.sql
create mode 100644 db/migrations/0055_github_login.sql
diff --git a/api/openapi.yaml b/api/openapi.yaml
index 52a192d..695d88a 100644
--- a/api/openapi.yaml
+++ b/api/openapi.yaml
@@ -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:
@@ -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
@@ -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 }
@@ -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" }
@@ -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
@@ -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
@@ -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
@@ -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 }
@@ -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
diff --git a/apps/web/src/App.tsx b/apps/web/src/App.tsx
index 88d25b9..64466b8 100644
--- a/apps/web/src/App.tsx
+++ b/apps/web/src/App.tsx
@@ -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";
@@ -55,6 +56,7 @@ export default function App(props: ParentProps) {
+
diff --git a/apps/web/src/components/Rail.tsx b/apps/web/src/components/Rail.tsx
index a0fb412..5130c07 100644
--- a/apps/web/src/components/Rail.tsx
+++ b/apps/web/src/components/Rail.tsx
@@ -52,6 +52,7 @@ import {
ChevronDownIcon,
ChevronLeftIcon,
ChevronRightIcon,
+ CircleDotIcon,
GitPullRequestIcon,
GripIcon,
BookmarkIcon,
@@ -753,6 +754,7 @@ export function Rail() {
if (e.type === "review.created" || e.type === "review.responded") {
void refreshUnread();
}
+ if (e.type.startsWith("issue.")) refetchGh();
});
onCleanup(unsub);
createEffect(() => {
@@ -764,6 +766,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 = () =>
@@ -912,6 +930,20 @@ export function Rail() {
Pull requests
+ 0}>
+
+ {ghCounts()?.pulls}
+
+
+
+
+
+ Issues
+ 0}>
+
+ {ghCounts()?.issues}
+
+
diff --git a/apps/web/src/components/icons.tsx b/apps/web/src/components/icons.tsx
index 2806dc5..25cb507 100644
--- a/apps/web/src/components/icons.tsx
+++ b/apps/web/src/components/icons.tsx
@@ -227,6 +227,24 @@ export function IssueIcon(props: IconProps): JSX.Element {
);
}
+export function CircleDotIcon(props: IconProps): JSX.Element {
+ return (
+
+ );
+}
+
export function GitPullRequestIcon(props: IconProps): JSX.Element {
return (
@@ -242,13 +255,92 @@ function PRBody(props: {
conflicts
-
- {(l) => (
-
- {l}
+
+
+ approved
+
+
+
+
+ changes requested
+
+
+
+
+ review pending
+
+
+ 0}>
+
+
+ {(rv) => (
+
+
+
+ )}
+
+
+
+ 0 || (pr().teams?.length ?? 0) > 0}>
+ a.login), ...(pr().teams ?? []).map((t) => `${t.slug} (team)`)].join(", ")}`}
+ >
+
+
+ {(a) => (
+
+ )}
+
+
+ {(t) => (
+
+ T
+
+ )}
+
- )}
-
+ review requested
+
+
+ 0}>
+ a.login).join(", ")}`}
+ >
+
+
+ {(a) => (
+
+ )}
+
+
+ assigned
+
+
+ props.onMerged()}
+ />
diff --git a/apps/web/src/features/github/PullRequestList.tsx b/apps/web/src/features/github/PullRequestList.tsx
index 316d5ba..a2915e0 100644
--- a/apps/web/src/features/github/PullRequestList.tsx
+++ b/apps/web/src/features/github/PullRequestList.tsx
@@ -12,7 +12,7 @@ import { api } from "../../lib/api";
import { subscribe } from "../../lib/events";
import { Spinner, Tip } from "../../components/ui";
import { GitPullRequestIcon } from "../../components/icons";
-import { markGitHub } from "./GitHub";
+import { GhAvatar, markGitHub } from "./GitHub";
import { PullRequestDetail } from "./PullRequestDetail";
import { openCreatePull } from "./CreateModals";
import type { Issue } from "@relay/api-client";
@@ -125,6 +125,18 @@ export function PullRequestList(props: { projectId: string }) {
{markGitHub("", "h-3 w-3")}
{i.github?.repo}
+
+ {(a) => (
+
+
+ {a()}
+
+ )}
+
(
#{g().number} {g().state}
+
+
+
)}
diff --git a/apps/web/src/features/projects/ProjectPage.tsx b/apps/web/src/features/projects/ProjectPage.tsx
index 56798f2..99953a6 100644
--- a/apps/web/src/features/projects/ProjectPage.tsx
+++ b/apps/web/src/features/projects/ProjectPage.tsx
@@ -69,6 +69,7 @@ import { isClosed, statusDefs, StatusDot } from "../issues/meta";
import { Reviews } from "../reviews/Reviews";
import { WebhooksSection } from "../webhooks/Webhooks";
import { openCommit } from "../github/CommitModal";
+import { openGhIssue } from "../github/GitHubIssueModal";
type View =
| "issues"
@@ -1697,6 +1698,20 @@ export default function ProjectPage() {
}
});
+ // ?gh=owner/name:number deep link — opens the GitHub issue modal once,
+ // then drops the param (mirrors ?pr= on the pulls view).
+ createEffect(() => {
+ const raw = searchParams.gh;
+ const gh = Array.isArray(raw) ? raw[0] : raw;
+ if (!gh) return;
+ const sep = gh.lastIndexOf(":");
+ const num = Number(gh.slice(sep + 1));
+ if (sep > 0 && Number.isInteger(num) && num > 0) {
+ openGhIssue(params.projectId, gh.slice(0, sep), num);
+ setSearchParams({ gh: undefined });
+ }
+ });
+
const [overview, { refetch: refetchOverview }] = createResource(
() => params.projectId,
(id) => api.projectOverview(id),
diff --git a/apps/web/src/features/workspaces/Settings.tsx b/apps/web/src/features/workspaces/Settings.tsx
index 5b0028c..f70ef9d 100644
--- a/apps/web/src/features/workspaces/Settings.tsx
+++ b/apps/web/src/features/workspaces/Settings.tsx
@@ -829,6 +829,56 @@ function NameColorRow() {
);
}
+// GitHub login: binds the Relay user to their GitHub account so the
+// workspace Issues/Pulls pages can offer "mine" / "assigned to me" filters.
+// Free-text bind, not OAuth — the GitHub App is server-scoped, not per-user.
+function GitHubLoginRow() {
+ const session = useSession();
+ const [value, setValue] = createSignal(session.user()?.github_login ?? "");
+ const [busy, setBusy] = createSignal(false);
+ const [error, setError] = createSignal(null);
+
+ async function save() {
+ setBusy(true);
+ setError(null);
+ try {
+ await api.updateMe({ github_login: value().trim() });
+ await session.refresh();
+ } catch (err) {
+ setError(errorMessage(err, "Could not save GitHub username"));
+ } finally {
+ setBusy(false);
+ }
+ }
+
+ return (
+
+ GitHub
+ setValue(e.currentTarget.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") void save();
+ }}
+ disabled={busy()}
+ placeholder="github username"
+ class={`${inputClass} w-44`}
+ />
+
+
+
+ );
+}
+
// Connection card: which backend this app talks to. Local mode stores
// everything on this device; one connect form handles both auth styles —
// email+password in-app or approval in the system browser — and the
@@ -1403,6 +1453,7 @@ export default function Settings() {
+
diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx
index 6e87ba2..9962f09 100644
--- a/apps/web/src/main.tsx
+++ b/apps/web/src/main.tsx
@@ -22,6 +22,7 @@ import Home from "./pages/Home";
import Inbox from "./pages/Inbox";
import Overview from "./pages/Overview";
import Pulls from "./pages/Pulls";
+import Issues from "./pages/Issues";
import Saved from "./pages/Saved";
import AgentProfile from "./pages/AgentProfile";
import Connect from "./pages/Connect";
@@ -110,6 +111,7 @@ render(
+
diff --git a/apps/web/src/pages/Issues.tsx b/apps/web/src/pages/Issues.tsx
new file mode 100644
index 0000000..b72a2b1
--- /dev/null
+++ b/apps/web/src/pages/Issues.tsx
@@ -0,0 +1,343 @@
+import { A, useNavigate, useSearchParams } from "@solidjs/router";
+import {
+ createMemo,
+ createResource,
+ createSignal,
+ For,
+ onCleanup,
+ Show,
+} from "solid-js";
+import type { WorkspaceIssues } from "@relay/api-client";
+import { api } from "../lib/api";
+import { subscribe } from "../lib/events";
+import { timeAgo } from "../lib/time";
+import { FullPageSpinner, inputClass } from "../components/ui";
+import { IssueIcon, SearchIcon, ThreadIcon } from "../components/icons";
+import {
+ GhAuthor,
+ GhAvatar,
+ GhLabelChip,
+ markGitHub,
+} from "../features/github/GitHub";
+import { openGhIssue } from "../features/github/GitHubIssueModal";
+import { openCreateIssue } from "../features/github/CreateModals";
+import { Select } from "../components/Select";
+import { useSession } from "../stores/session";
+import { activeWorkspace } from "../stores/workspace";
+
+// Workspace-wide GitHub issues: every linked repo's open issues in one list,
+// sibling of the Pulls page. Rows deep-link to the mirrored Relay issue when
+// one exists, else to the project's issues view.
+export default function Issues() {
+ const session = useSession();
+ const navigate = useNavigate();
+ const active = activeWorkspace(session.workspaces);
+ const [query, setQuery] = createSignal("");
+ const [withIssuesOnly, setWithIssuesOnly] = createSignal(true);
+ // Involvement filter — only offered once the user binds their GitHub
+ // login in Settings (free-text bind, GitHub App is server-scoped).
+ const me = () => (session.user()?.github_login ?? "").toLowerCase();
+ type Who = "any" | "mine" | "assigned";
+ const [who, setWho] = createSignal("any");
+ const involvesMe = (i: Group["issues"][number]) => {
+ switch (who()) {
+ case "mine":
+ return i.author.toLowerCase() === me();
+ case "assigned":
+ return i.assignees.some((a) => a.login.toLowerCase() === me());
+ default:
+ return true;
+ }
+ };
+ // state lives in the URL — shareable and survives reload/navigation.
+ const [params, setParams] = useSearchParams<{ state?: string }>();
+ const stateFilter = () =>
+ params.state === "closed" || params.state === "all" ? params.state : "open";
+ const setStateFilter = (s: "open" | "closed" | "all") =>
+ setParams({ state: s === "open" ? undefined : s });
+
+ const [data, { refetch }] = createResource(
+ () => ({ ws: active()?.id, state: stateFilter() }),
+ (k) => (k.ws ? api.workspaceIssues(k.ws, k.state) : null),
+ );
+
+ const unsub = subscribe((e) => {
+ if (e.type.startsWith("issue.") || e.type === "stream.resync")
+ void refetch();
+ });
+ onCleanup(unsub);
+
+ // The server-side payload is 60s-cached anyway — a quiet refresh keeps the
+ // workspace view fresh without hammering GitHub.
+ const ticker = setInterval(() => void refetch(), 60_000);
+ onCleanup(() => clearInterval(ticker));
+
+ type Group = WorkspaceIssues["groups"][number];
+ const groups = createMemo(() => {
+ const q = query().trim().toLowerCase();
+ return (data.latest?.groups ?? [])
+ .map((g) => ({
+ ...g,
+ issues: g.issues
+ .slice()
+ .sort(
+ (a, b) =>
+ +new Date(b.updated_at) - +new Date(a.updated_at),
+ )
+ .filter(
+ (i) =>
+ involvesMe(i) &&
+ (!q ||
+ i.title.toLowerCase().includes(q) ||
+ i.author.toLowerCase().includes(q) ||
+ String(i.number).includes(q) ||
+ g.repo.full_name.toLowerCase().includes(q) ||
+ g.project_name.toLowerCase().includes(q)),
+ ),
+ }))
+ .filter((g) => !withIssuesOnly() || g.issues.length > 0);
+ });
+ const total = createMemo(() =>
+ groups().reduce((n, g) => n + g.issues.length, 0),
+ );
+
+ const open = (g: Group, i: Group["issues"][number]) => {
+ if (i.issue_id) {
+ navigate(`/app/p/${g.project_id}/i/${i.issue_id}`);
+ } else {
+ // Not mirrored — show the live GitHub issue in-app instead of
+ // dead-ending on the project's issues view.
+ openGhIssue(g.project_id, g.repo.full_name, i.number);
+ }
+ };
+
+ return (
+
+
+
Issues
+
+
+ {(s) => (
+
+ )}
+
+
+
0}>
+
+ {total()}
+
+
+
+
+ setQuery(e.currentTarget.value)}
+ placeholder="Filter by title, repo, author…"
+ class={`${inputClass} pl-8`}
+ />
+
+
+
+ {(t) => (
+
+ fetched {timeAgo(t())}
+
+ )}
+
+
+
+
+
+
+
+ 0}>
+
+ {data.latest!.failed!.join(", ")} failed to load
+
+
+
+
+
+
+
+ }
+ >
+ 0}
+ fallback={
+
+ {data.error
+ ? "Could not load issues — is GitHub connected?"
+ : (data.latest?.groups.length ?? 0) === 0
+ ? "No repositories linked yet. Link one under a project's Development view."
+ : query().trim()
+ ? "Nothing matches the filter."
+ : `No ${stateFilter()} issues.`}
+
+ }
+ >
+
+ {(g) => (
+
+
+
+ {g.project_name}
+
+ /
+ {markGitHub("", "h-3.5 w-3.5")}
+
+ {g.repo.full_name}
+
+
+
+
+
+ No open issues
+
+ }
+ >
+ {(i) => (
+ -
+
+
+ )}
+
+
+
+ )}
+
+
+
+
+ );
+}
diff --git a/apps/web/src/pages/Pulls.tsx b/apps/web/src/pages/Pulls.tsx
index bd527ee..58e92d6 100644
--- a/apps/web/src/pages/Pulls.tsx
+++ b/apps/web/src/pages/Pulls.tsx
@@ -1,4 +1,4 @@
-import { A, useNavigate } from "@solidjs/router";
+import { A, useNavigate, useSearchParams } from "@solidjs/router";
import {
createMemo,
createResource,
@@ -12,8 +12,19 @@ import { api } from "../lib/api";
import { subscribe } from "../lib/events";
import { timeAgo } from "../lib/time";
import { FullPageSpinner, inputClass } from "../components/ui";
-import { GitPullRequestIcon, SearchIcon } from "../components/icons";
-import { markGitHub } from "../features/github/GitHub";
+import {
+ GitPullRequestIcon,
+ SearchIcon,
+ ThreadIcon,
+} from "../components/icons";
+import {
+ GhAuthor,
+ GhAvatar,
+ GhLabelChip,
+ markGitHub,
+} from "../features/github/GitHub";
+import { openCreatePull } from "../features/github/CreateModals";
+import { Select } from "../components/Select";
import { useSession } from "../stores/session";
import { activeWorkspace } from "../stores/workspace";
@@ -26,10 +37,35 @@ export default function Pulls() {
const active = activeWorkspace(session.workspaces);
const [query, setQuery] = createSignal("");
const [withPullsOnly, setWithPullsOnly] = createSignal(true);
+ // "Needs review" — PRs still waiting on a requested reviewer. When the
+ // user has bound their GitHub login in Settings, the Involvement select
+ // narrows further to their own authored/reviewing/assigned sets.
+ const [needsReview, setNeedsReview] = createSignal(false);
+ const me = () => (session.user()?.github_login ?? "").toLowerCase();
+ type Who = "any" | "mine" | "review" | "assigned";
+ const [who, setWho] = createSignal("any");
+ const involvesMe = (p: Group["pulls"][number]) => {
+ switch (who()) {
+ case "mine":
+ return p.author.toLowerCase() === me();
+ case "review":
+ return p.reviewers.some((a) => a.login.toLowerCase() === me());
+ case "assigned":
+ return p.assignees.some((a) => a.login.toLowerCase() === me());
+ default:
+ return true;
+ }
+ };
+ // state lives in the URL — shareable and survives reload/navigation.
+ const [params, setParams] = useSearchParams<{ state?: string }>();
+ const stateFilter = () =>
+ params.state === "closed" || params.state === "all" ? params.state : "open";
+ const setStateFilter = (s: "open" | "closed" | "all") =>
+ setParams({ state: s === "open" ? undefined : s });
const [data, { refetch }] = createResource(
- () => active()?.id,
- (ws) => api.workspacePulls(ws),
+ () => ({ ws: active()?.id, state: stateFilter() }),
+ (k) => (k.ws ? api.workspacePulls(k.ws, k.state) : null),
);
// Mirrored PR issues emit issue.*; CI/deploy webhooks republish as
@@ -44,21 +80,36 @@ export default function Pulls() {
});
onCleanup(unsub);
+ // Server-side payload is 60s-cached anyway — a quiet refresh keeps the
+ // view fresh without hammering GitHub.
+ const ticker = setInterval(() => void refetch(), 60_000);
+ onCleanup(() => clearInterval(ticker));
+
type Group = WorkspacePulls["groups"][number];
const groups = createMemo(() => {
const q = query().trim().toLowerCase();
return (data.latest?.groups ?? [])
.map((g) => ({
...g,
- pulls: g.pulls.filter(
- (p) =>
- !q ||
- p.title.toLowerCase().includes(q) ||
- p.author.toLowerCase().includes(q) ||
- String(p.number).includes(q) ||
- g.repo.full_name.toLowerCase().includes(q) ||
- g.project_name.toLowerCase().includes(q),
- ),
+ pulls: g.pulls
+ .slice()
+ .sort(
+ (a, b) =>
+ +new Date(b.updated_at) - +new Date(a.updated_at),
+ )
+ .filter(
+ (p) =>
+ (!needsReview() ||
+ p.reviewers.length > 0 ||
+ (p.teams?.length ?? 0) > 0) &&
+ involvesMe(p) &&
+ (!q ||
+ p.title.toLowerCase().includes(q) ||
+ p.author.toLowerCase().includes(q) ||
+ String(p.number).includes(q) ||
+ g.repo.full_name.toLowerCase().includes(q) ||
+ g.project_name.toLowerCase().includes(q)),
+ ),
}))
.filter((g) => !withPullsOnly() || g.pulls.length > 0);
});
@@ -75,9 +126,26 @@ export default function Pulls() {
Pull requests
+
+
+ {(s) => (
+
+ )}
+
+
0}>
- {total()} open
+ {total()}
@@ -96,17 +164,54 @@ export default function Pulls() {
>
Refresh
+
+ {(t) => (
+
+ fetched {timeAgo(t())}
+
+ )}
+
-
+
+
+
+
+
+ 0}>
+
+ {data.latest!.failed!.join(", ")} failed to load
+
+
+
}
>
@@ -148,6 +255,15 @@ export default function Pulls() {
>
{g.repo.full_name}
+
@@ -179,23 +301,85 @@ export default function Pulls() {
draft
+
+
+ merged
+
+
+
+
+ closed
+
+
{p.head} → {p.base}
- {p.author}
+
+
+
- {(l) => (
-
- {l}
-
- )}
+ {(l) => }
-
- {timeAgo(p.updated_at)}
+
+ 0 || (p.teams?.length ?? 0) > 0}>
+ a.login), ...(p.teams ?? []).map((t) => `${t.slug} (team)`)].join(", ")}`}
+ >
+
+ {(a) => (
+
+ )}
+
+
+ {(t) => (
+
+ T
+
+ )}
+
+
+
+ 0}>
+ a.login).join(", ")}`}
+ >
+
+ {(a) => (
+
+ )}
+
+
+
+ 0}>
+
+
+ {p.comments}
+
+
+
+ {timeAgo(p.updated_at)}
+
diff --git a/db/migrations/0054_github_author.sql b/db/migrations/0054_github_author.sql
new file mode 100644
index 0000000..3416e3a
--- /dev/null
+++ b/db/migrations/0054_github_author.sql
@@ -0,0 +1,9 @@
+-- +goose Up
+-- Mirrored GitHub issues/PRs remember who filed them — the mirror upsert
+-- refreshes these on every write, so the reconcile sweep backfills them.
+alter table issues add column github_author text;
+alter table issues add column github_avatar_url text;
+
+-- +goose Down
+alter table issues drop column github_avatar_url;
+alter table issues drop column github_author;
diff --git a/db/migrations/0055_github_login.sql b/db/migrations/0055_github_login.sql
new file mode 100644
index 0000000..897508a
--- /dev/null
+++ b/db/migrations/0055_github_login.sql
@@ -0,0 +1,5 @@
+-- +goose Up
+alter table users add column github_login text not null default '';
+
+-- +goose Down
+alter table users drop column github_login;
diff --git a/db/queries/github.sql b/db/queries/github.sql
index ac77284..6e0661e 100644
--- a/db/queries/github.sql
+++ b/db/queries/github.sql
@@ -69,10 +69,12 @@ where github_repo_id = sqlc.arg(repo_id) and github_number = sqlc.arg(number);
-- name: CreateGitHubIssue :one
insert into issues (project_id, number, title, description, status, priority,
github_node_id, github_repo_id, github_number, origin,
- github_kind, github_state, github_url)
+ github_kind, github_state, github_url,
+ github_author, github_avatar_url)
values (sqlc.arg(project_id), sqlc.arg(number), sqlc.arg(title), sqlc.arg(description),
sqlc.arg(status), 'none', sqlc.arg(node_id), sqlc.arg(repo_id), sqlc.arg(gh_number), 'github',
- sqlc.arg(kind), sqlc.arg(gh_state), sqlc.arg(gh_url))
+ sqlc.arg(kind), sqlc.arg(gh_state), sqlc.arg(gh_url),
+ sqlc.narg(gh_author), sqlc.narg(gh_avatar_url))
returning *;
-- name: UpdateGitHubIssue :one
@@ -82,6 +84,8 @@ update issues set
status = coalesce(sqlc.narg(status)::text, status),
github_state = coalesce(sqlc.narg(gh_state)::text, github_state),
github_url = coalesce(sqlc.narg(gh_url)::text, github_url),
+ github_author = coalesce(sqlc.narg(gh_author)::text, github_author),
+ github_avatar_url = coalesce(sqlc.narg(gh_avatar_url)::text, github_avatar_url),
updated_at = now()
where id = sqlc.arg(id)
returning *;
diff --git a/db/queries/users.sql b/db/queries/users.sql
index 30d1cfb..e74bb6c 100644
--- a/db/queries/users.sql
+++ b/db/queries/users.sql
@@ -1,22 +1,26 @@
-- name: CreateUser :one
insert into users (email, password_hash, name)
values ($1, $2, $3)
-returning id, email, name, created_at;
+returning id, email, name, github_login, created_at;
-- name: GetUserByEmail :one
-select id, email, password_hash, name, name_color, avatar_key, created_at
+select id, email, password_hash, name, name_color, avatar_key, github_login, created_at
from users
where lower(email) = lower($1);
-- name: GetUserByID :one
-select id, email, name, name_color, avatar_key, created_at
+select id, email, name, name_color, avatar_key, github_login, created_at
from users
where id = $1;
-- name: UpdateUserAvatar :one
update users set avatar_key = $2 where id = $1
-returning id, email, name, name_color, avatar_key, created_at;
+returning id, email, name, name_color, avatar_key, github_login, created_at;
-- name: UpdateUserNameColor :one
update users set name_color = $2 where id = $1
-returning id, email, name, name_color, avatar_key, created_at;
+returning id, email, name, name_color, avatar_key, github_login, created_at;
+
+-- name: UpdateUserGitHubLogin :one
+update users set github_login = $2 where id = $1
+returning id, email, name, name_color, avatar_key, github_login, created_at;
diff --git a/internal/auth/handlers.go b/internal/auth/handlers.go
index a28e2d7..c7c9e6e 100644
--- a/internal/auth/handlers.go
+++ b/internal/auth/handlers.go
@@ -1,10 +1,13 @@
package auth
import (
+ "context"
"errors"
+ "fmt"
"net/http"
"regexp"
"strings"
+ "time"
"github.com/Dvorinka/relay/internal/db"
"github.com/Dvorinka/relay/internal/httpx"
@@ -56,12 +59,13 @@ type sessionOut struct {
}
type userOut struct {
- ID string `json:"id"`
- Email string `json:"email"`
- Name string `json:"name"`
- NameColor *string `json:"name_color"`
- AvatarURL *string `json:"avatar_url"`
- CreatedAt string `json:"created_at"`
+ ID string `json:"id"`
+ Email string `json:"email"`
+ Name string `json:"name"`
+ NameColor *string `json:"name_color"`
+ GitHubLogin string `json:"github_login"`
+ AvatarURL *string `json:"avatar_url"`
+ CreatedAt string `json:"created_at"`
}
func toSessionOut(c Credentials) sessionOut {
@@ -90,41 +94,90 @@ func UserOut(u db.GetUserByIDRow) userOut {
}
return userOut{
ID: u.ID.String(), Email: u.Email, Name: u.Name, NameColor: color,
- AvatarURL: avatar,
- CreatedAt: u.CreatedAt.Time.Format("2006-01-02T15:04:05Z07:00"),
+ GitHubLogin: u.GithubLogin,
+ AvatarURL: avatar,
+ CreatedAt: u.CreatedAt.Time.Format("2006-01-02T15:04:05Z07:00"),
}
}
var nameColorPattern = regexp.MustCompile(`^#[0-9a-fA-F]{6}$`)
+// GitHub login rules: 1–39 chars, alnum or single hyphens, no edge hyphen.
+var githubLoginPattern = regexp.MustCompile(`^[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38})$`)
+
+var githubLookupClient = &http.Client{Timeout: 5 * time.Second}
+
+// githubUserExists asks GitHub's public user endpoint. A 404 is a firm no;
+// anything else — rate limit, outage, network — returns true so a transient
+// failure never blocks a profile save.
+func githubUserExists(ctx context.Context, login string) bool {
+ ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
+ defer cancel()
+ req, err := http.NewRequestWithContext(ctx, "GET",
+ fmt.Sprintf("https://api.github.com/users/%s", login), nil)
+ if err != nil {
+ return true
+ }
+ req.Header.Set("Accept", "application/vnd.github+json")
+ res, err := githubLookupClient.Do(req)
+ if err != nil {
+ return true
+ }
+ _ = res.Body.Close()
+ return res.StatusCode != http.StatusNotFound
+}
+
// handleUpdateMe patches profile fields. name_color accepts "#rrggbb" or
-// empty (clears back to the palette default).
+// empty (clears back to the palette default); github_login binds the user's
+// GitHub account so issue/PR surfaces can offer "mine" filters — empty
+// clears the binding.
func (s *Service) handleUpdateMe(c *gin.Context) {
user := CurrentUser(c)
var req struct {
- NameColor *string `json:"name_color"`
+ NameColor *string `json:"name_color"`
+ GitHubLogin *string `json:"github_login"`
}
if !httpx.BindJSON(c, &req) {
return
}
- if req.NameColor == nil {
+ switch {
+ case req.NameColor != nil:
+ v := strings.TrimSpace(*req.NameColor)
+ if v != "" && !nameColorPattern.MatchString(v) {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "name_color must be #rrggbb or empty")
+ return
+ }
+ row, err := s.q.UpdateUserNameColor(c.Request.Context(), db.UpdateUserNameColorParams{
+ ID: user.ID,
+ NameColor: pgtype.Text{String: strings.ToLower(v), Valid: v != ""},
+ })
+ if err != nil {
+ httpx.Error(c, http.StatusInternalServerError, "internal", "internal error")
+ return
+ }
+ c.JSON(http.StatusOK, gin.H{"user": UserOut(db.GetUserByIDRow(row))})
+ case req.GitHubLogin != nil:
+ v := strings.TrimSpace(*req.GitHubLogin)
+ if v != "" && !githubLoginPattern.MatchString(v) {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "github_login must be a valid GitHub username or empty")
+ return
+ }
+ if v != "" && !githubUserExists(c.Request.Context(), v) {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "no GitHub account with that username")
+ return
+ }
+ row, err := s.q.UpdateUserGitHubLogin(c.Request.Context(), db.UpdateUserGitHubLoginParams{
+ ID: user.ID,
+ GithubLogin: v,
+ })
+ if err != nil {
+ httpx.Error(c, http.StatusInternalServerError, "internal", "internal error")
+ return
+ }
+ c.JSON(http.StatusOK, gin.H{"user": UserOut(db.GetUserByIDRow(row))})
+ default:
httpx.Error(c, http.StatusBadRequest, "bad_request", "nothing to update")
- return
- }
- v := strings.TrimSpace(*req.NameColor)
- if v != "" && !nameColorPattern.MatchString(v) {
- httpx.Error(c, http.StatusBadRequest, "bad_request", "name_color must be #rrggbb or empty")
- return
- }
- row, err := s.q.UpdateUserNameColor(c.Request.Context(), db.UpdateUserNameColorParams{
- ID: user.ID,
- NameColor: pgtype.Text{String: strings.ToLower(v), Valid: v != ""},
- })
- if err != nil {
- httpx.Error(c, http.StatusInternalServerError, "internal", "internal error")
- return
}
- c.JSON(http.StatusOK, gin.H{"user": UserOut(db.GetUserByIDRow(row))})
}
// --- handlers ---
diff --git a/internal/auth/service.go b/internal/auth/service.go
index 43d9289..85bed6e 100644
--- a/internal/auth/service.go
+++ b/internal/auth/service.go
@@ -112,7 +112,7 @@ func (s *Service) Login(ctx context.Context, email, password, ip, ua string) (Cr
if err != nil {
return creds, "", err
}
- creds.User = db.GetUserByIDRow{ID: row.ID, Email: row.Email, Name: row.Name, AvatarKey: row.AvatarKey}
+ creds.User = db.GetUserByIDRow{ID: row.ID, Email: row.Email, Name: row.Name, AvatarKey: row.AvatarKey, NameColor: row.NameColor, GithubLogin: row.GithubLogin}
creds.Workspaces, _ = s.q.ListWorkspacesForUser(ctx, row.ID)
return creds, token, nil
}
diff --git a/internal/db/github.sql.go b/internal/db/github.sql.go
index 304af20..a12dc06 100644
--- a/internal/db/github.sql.go
+++ b/internal/db/github.sql.go
@@ -14,11 +14,13 @@ import (
const createGitHubIssue = `-- name: CreateGitHubIssue :one
insert into issues (project_id, number, title, description, status, priority,
github_node_id, github_repo_id, github_number, origin,
- github_kind, github_state, github_url)
+ github_kind, github_state, github_url,
+ github_author, github_avatar_url)
values ($1, $2, $3, $4,
$5, 'none', $6, $7, $8, 'github',
- $9, $10, $11)
-returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url
+ $9, $10, $11,
+ $12, $13)
+returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url, github_author, github_avatar_url
`
type CreateGitHubIssueParams struct {
@@ -33,6 +35,8 @@ type CreateGitHubIssueParams struct {
Kind string `json:"kind"`
GhState pgtype.Text `json:"gh_state"`
GhUrl pgtype.Text `json:"gh_url"`
+ GhAuthor pgtype.Text `json:"gh_author"`
+ GhAvatarUrl pgtype.Text `json:"gh_avatar_url"`
}
func (q *Queries) CreateGitHubIssue(ctx context.Context, arg CreateGitHubIssueParams) (Issue, error) {
@@ -48,6 +52,8 @@ func (q *Queries) CreateGitHubIssue(ctx context.Context, arg CreateGitHubIssuePa
arg.Kind,
arg.GhState,
arg.GhUrl,
+ arg.GhAuthor,
+ arg.GhAvatarUrl,
)
var i Issue
err := row.Scan(
@@ -70,6 +76,8 @@ func (q *Queries) CreateGitHubIssue(ctx context.Context, arg CreateGitHubIssuePa
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
)
return i, err
}
@@ -102,7 +110,7 @@ func (q *Queries) DeleteRepoLink(ctx context.Context, id pgtype.UUID) error {
}
const findIssueByGitHub = `-- name: FindIssueByGitHub :one
-select id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url from issues
+select id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url, github_author, github_avatar_url from issues
where github_repo_id = $1 and github_number = $2
`
@@ -134,6 +142,8 @@ func (q *Queries) FindIssueByGitHub(ctx context.Context, arg FindIssueByGitHubPa
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
)
return i, err
}
@@ -474,9 +484,11 @@ update issues set
status = coalesce($3::text, status),
github_state = coalesce($4::text, github_state),
github_url = coalesce($5::text, github_url),
+ github_author = coalesce($6::text, github_author),
+ github_avatar_url = coalesce($7::text, github_avatar_url),
updated_at = now()
-where id = $6
-returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url
+where id = $8
+returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url, github_author, github_avatar_url
`
type UpdateGitHubIssueParams struct {
@@ -485,6 +497,8 @@ type UpdateGitHubIssueParams struct {
Status pgtype.Text `json:"status"`
GhState pgtype.Text `json:"gh_state"`
GhUrl pgtype.Text `json:"gh_url"`
+ GhAuthor pgtype.Text `json:"gh_author"`
+ GhAvatarUrl pgtype.Text `json:"gh_avatar_url"`
ID pgtype.UUID `json:"id"`
}
@@ -495,6 +509,8 @@ func (q *Queries) UpdateGitHubIssue(ctx context.Context, arg UpdateGitHubIssuePa
arg.Status,
arg.GhState,
arg.GhUrl,
+ arg.GhAuthor,
+ arg.GhAvatarUrl,
arg.ID,
)
var i Issue
@@ -518,6 +534,8 @@ func (q *Queries) UpdateGitHubIssue(ctx context.Context, arg UpdateGitHubIssuePa
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
)
return i, err
}
diff --git a/internal/db/issues.sql.go b/internal/db/issues.sql.go
index 9b233f7..b6b6abb 100644
--- a/internal/db/issues.sql.go
+++ b/internal/db/issues.sql.go
@@ -32,7 +32,7 @@ const createIssue = `-- name: CreateIssue :one
insert into issues (project_id, number, title, description, status, priority, assignee_id, created_by)
values ($1, $2, $3, $4,
$5, $6, $7, $8)
-returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url
+returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url, github_author, github_avatar_url
`
type CreateIssueParams struct {
@@ -78,6 +78,8 @@ func (q *Queries) CreateIssue(ctx context.Context, arg CreateIssueParams) (Issue
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
)
return i, err
}
@@ -142,7 +144,7 @@ func (q *Queries) CreateLabel(ctx context.Context, arg CreateLabelParams) (Issue
}
const getIssueByID = `-- name: GetIssueByID :one
-select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, u.name as assignee_name, u.avatar_key as assignee_avatar,
+select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, i.github_author, i.github_avatar_url, u.name as assignee_name, u.avatar_key as assignee_avatar,
gr.owner as github_repo_owner, gr.name as github_repo_name
from issues i
left join users u on u.id = i.assignee_id
@@ -170,6 +172,8 @@ type GetIssueByIDRow struct {
GithubKind string `json:"github_kind"`
GithubState pgtype.Text `json:"github_state"`
GithubUrl pgtype.Text `json:"github_url"`
+ GithubAuthor pgtype.Text `json:"github_author"`
+ GithubAvatarUrl pgtype.Text `json:"github_avatar_url"`
AssigneeName pgtype.Text `json:"assignee_name"`
AssigneeAvatar pgtype.Text `json:"assignee_avatar"`
GithubRepoOwner pgtype.Text `json:"github_repo_owner"`
@@ -199,6 +203,8 @@ func (q *Queries) GetIssueByID(ctx context.Context, id pgtype.UUID) (GetIssueByI
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
&i.AssigneeName,
&i.AssigneeAvatar,
&i.GithubRepoOwner,
@@ -235,7 +241,7 @@ func (q *Queries) GetIssueConversation(ctx context.Context, issueID pgtype.UUID)
}
const getIssueForUser = `-- name: GetIssueForUser :one
-select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, u.name as assignee_name, u.avatar_key as assignee_avatar,
+select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, i.github_author, i.github_avatar_url, u.name as assignee_name, u.avatar_key as assignee_avatar,
gr.owner as github_repo_owner, gr.name as github_repo_name,
gr.installation_id as github_installation_id
from issues i
@@ -271,6 +277,8 @@ type GetIssueForUserRow struct {
GithubKind string `json:"github_kind"`
GithubState pgtype.Text `json:"github_state"`
GithubUrl pgtype.Text `json:"github_url"`
+ GithubAuthor pgtype.Text `json:"github_author"`
+ GithubAvatarUrl pgtype.Text `json:"github_avatar_url"`
AssigneeName pgtype.Text `json:"assignee_name"`
AssigneeAvatar pgtype.Text `json:"assignee_avatar"`
GithubRepoOwner pgtype.Text `json:"github_repo_owner"`
@@ -301,6 +309,8 @@ func (q *Queries) GetIssueForUser(ctx context.Context, arg GetIssueForUserParams
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
&i.AssigneeName,
&i.AssigneeAvatar,
&i.GithubRepoOwner,
@@ -480,7 +490,7 @@ func (q *Queries) ListIssueLabels(ctx context.Context, issueID pgtype.UUID) ([]I
}
const listIssuesForUser = `-- name: ListIssuesForUser :many
-select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, u.name as assignee_name, u.avatar_key as assignee_avatar,
+select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, i.github_author, i.github_avatar_url, u.name as assignee_name, u.avatar_key as assignee_avatar,
gr.owner as github_repo_owner, gr.name as github_repo_name
from issues i
join projects p on p.id = i.project_id
@@ -526,6 +536,8 @@ type ListIssuesForUserRow struct {
GithubKind string `json:"github_kind"`
GithubState pgtype.Text `json:"github_state"`
GithubUrl pgtype.Text `json:"github_url"`
+ GithubAuthor pgtype.Text `json:"github_author"`
+ GithubAvatarUrl pgtype.Text `json:"github_avatar_url"`
AssigneeName pgtype.Text `json:"assignee_name"`
AssigneeAvatar pgtype.Text `json:"assignee_avatar"`
GithubRepoOwner pgtype.Text `json:"github_repo_owner"`
@@ -568,6 +580,8 @@ func (q *Queries) ListIssuesForUser(ctx context.Context, arg ListIssuesForUserPa
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
&i.AssigneeName,
&i.AssigneeAvatar,
&i.GithubRepoOwner,
@@ -825,7 +839,7 @@ update issues set
priority = coalesce($4, priority),
updated_at = now()
where id = $5
-returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url
+returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url, github_author, github_avatar_url
`
type UpdateIssueFieldsParams struct {
@@ -865,6 +879,8 @@ func (q *Queries) UpdateIssueFields(ctx context.Context, arg UpdateIssueFieldsPa
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
)
return i, err
}
diff --git a/internal/db/mcp.sql.go b/internal/db/mcp.sql.go
index 3638749..58e475a 100644
--- a/internal/db/mcp.sql.go
+++ b/internal/db/mcp.sql.go
@@ -439,7 +439,7 @@ const createIssueForAgent = `-- name: CreateIssueForAgent :one
insert into issues (project_id, number, title, description, status, priority, assignee_id, created_by, agent_id)
values ($1, $2, $3, $4,
'todo', $5, null, null, $6)
-returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url
+returning id, project_id, number, title, description, status, priority, assignee_id, agent_id, created_by, created_at, updated_at, github_node_id, github_repo_id, github_number, origin, github_kind, github_state, github_url, github_author, github_avatar_url
`
type CreateIssueForAgentParams struct {
@@ -481,6 +481,8 @@ func (q *Queries) CreateIssueForAgent(ctx context.Context, arg CreateIssueForAge
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
)
return i, err
}
@@ -508,34 +510,36 @@ func (q *Queries) GetAttachmentByID(ctx context.Context, id pgtype.UUID) (Attach
}
const getIssueForAgent = `-- name: GetIssueForAgent :one
-select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, u.name as assignee_name, u.avatar_key as assignee_avatar
+select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, i.github_author, i.github_avatar_url, u.name as assignee_name, u.avatar_key as assignee_avatar
from issues i
left join users u on u.id = i.assignee_id
where i.id = $1
`
type GetIssueForAgentRow struct {
- ID pgtype.UUID `json:"id"`
- ProjectID pgtype.UUID `json:"project_id"`
- Number int32 `json:"number"`
- Title string `json:"title"`
- Description string `json:"description"`
- Status string `json:"status"`
- Priority string `json:"priority"`
- AssigneeID pgtype.UUID `json:"assignee_id"`
- AgentID pgtype.UUID `json:"agent_id"`
- CreatedBy pgtype.UUID `json:"created_by"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
- UpdatedAt pgtype.Timestamptz `json:"updated_at"`
- GithubNodeID pgtype.Text `json:"github_node_id"`
- GithubRepoID pgtype.UUID `json:"github_repo_id"`
- GithubNumber pgtype.Int4 `json:"github_number"`
- Origin string `json:"origin"`
- GithubKind string `json:"github_kind"`
- GithubState pgtype.Text `json:"github_state"`
- GithubUrl pgtype.Text `json:"github_url"`
- AssigneeName pgtype.Text `json:"assignee_name"`
- AssigneeAvatar pgtype.Text `json:"assignee_avatar"`
+ ID pgtype.UUID `json:"id"`
+ ProjectID pgtype.UUID `json:"project_id"`
+ Number int32 `json:"number"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Status string `json:"status"`
+ Priority string `json:"priority"`
+ AssigneeID pgtype.UUID `json:"assignee_id"`
+ AgentID pgtype.UUID `json:"agent_id"`
+ CreatedBy pgtype.UUID `json:"created_by"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
+ UpdatedAt pgtype.Timestamptz `json:"updated_at"`
+ GithubNodeID pgtype.Text `json:"github_node_id"`
+ GithubRepoID pgtype.UUID `json:"github_repo_id"`
+ GithubNumber pgtype.Int4 `json:"github_number"`
+ Origin string `json:"origin"`
+ GithubKind string `json:"github_kind"`
+ GithubState pgtype.Text `json:"github_state"`
+ GithubUrl pgtype.Text `json:"github_url"`
+ GithubAuthor pgtype.Text `json:"github_author"`
+ GithubAvatarUrl pgtype.Text `json:"github_avatar_url"`
+ AssigneeName pgtype.Text `json:"assignee_name"`
+ AssigneeAvatar pgtype.Text `json:"assignee_avatar"`
}
func (q *Queries) GetIssueForAgent(ctx context.Context, id pgtype.UUID) (GetIssueForAgentRow, error) {
@@ -561,6 +565,8 @@ func (q *Queries) GetIssueForAgent(ctx context.Context, id pgtype.UUID) (GetIssu
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
&i.AssigneeName,
&i.AssigneeAvatar,
)
@@ -754,7 +760,7 @@ func (q *Queries) ListProjectConversations(ctx context.Context, projectID pgtype
}
const listProjectIssuesForAgent = `-- name: ListProjectIssuesForAgent :many
-select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, u.name as assignee_name, u.avatar_key as assignee_avatar
+select i.id, i.project_id, i.number, i.title, i.description, i.status, i.priority, i.assignee_id, i.agent_id, i.created_by, i.created_at, i.updated_at, i.github_node_id, i.github_repo_id, i.github_number, i.origin, i.github_kind, i.github_state, i.github_url, i.github_author, i.github_avatar_url, u.name as assignee_name, u.avatar_key as assignee_avatar
from issues i
left join users u on u.id = i.assignee_id
where i.project_id = $1
@@ -770,27 +776,29 @@ type ListProjectIssuesForAgentParams struct {
}
type ListProjectIssuesForAgentRow struct {
- ID pgtype.UUID `json:"id"`
- ProjectID pgtype.UUID `json:"project_id"`
- Number int32 `json:"number"`
- Title string `json:"title"`
- Description string `json:"description"`
- Status string `json:"status"`
- Priority string `json:"priority"`
- AssigneeID pgtype.UUID `json:"assignee_id"`
- AgentID pgtype.UUID `json:"agent_id"`
- CreatedBy pgtype.UUID `json:"created_by"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
- UpdatedAt pgtype.Timestamptz `json:"updated_at"`
- GithubNodeID pgtype.Text `json:"github_node_id"`
- GithubRepoID pgtype.UUID `json:"github_repo_id"`
- GithubNumber pgtype.Int4 `json:"github_number"`
- Origin string `json:"origin"`
- GithubKind string `json:"github_kind"`
- GithubState pgtype.Text `json:"github_state"`
- GithubUrl pgtype.Text `json:"github_url"`
- AssigneeName pgtype.Text `json:"assignee_name"`
- AssigneeAvatar pgtype.Text `json:"assignee_avatar"`
+ ID pgtype.UUID `json:"id"`
+ ProjectID pgtype.UUID `json:"project_id"`
+ Number int32 `json:"number"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Status string `json:"status"`
+ Priority string `json:"priority"`
+ AssigneeID pgtype.UUID `json:"assignee_id"`
+ AgentID pgtype.UUID `json:"agent_id"`
+ CreatedBy pgtype.UUID `json:"created_by"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
+ UpdatedAt pgtype.Timestamptz `json:"updated_at"`
+ GithubNodeID pgtype.Text `json:"github_node_id"`
+ GithubRepoID pgtype.UUID `json:"github_repo_id"`
+ GithubNumber pgtype.Int4 `json:"github_number"`
+ Origin string `json:"origin"`
+ GithubKind string `json:"github_kind"`
+ GithubState pgtype.Text `json:"github_state"`
+ GithubUrl pgtype.Text `json:"github_url"`
+ GithubAuthor pgtype.Text `json:"github_author"`
+ GithubAvatarUrl pgtype.Text `json:"github_avatar_url"`
+ AssigneeName pgtype.Text `json:"assignee_name"`
+ AssigneeAvatar pgtype.Text `json:"assignee_avatar"`
}
func (q *Queries) ListProjectIssuesForAgent(ctx context.Context, arg ListProjectIssuesForAgentParams) ([]ListProjectIssuesForAgentRow, error) {
@@ -822,6 +830,8 @@ func (q *Queries) ListProjectIssuesForAgent(ctx context.Context, arg ListProject
&i.GithubKind,
&i.GithubState,
&i.GithubUrl,
+ &i.GithubAuthor,
+ &i.GithubAvatarUrl,
&i.AssigneeName,
&i.AssigneeAvatar,
); err != nil {
diff --git a/internal/db/models.go b/internal/db/models.go
index 5e56825..01b8d09 100644
--- a/internal/db/models.go
+++ b/internal/db/models.go
@@ -198,25 +198,27 @@ type InboundHookThread struct {
}
type Issue struct {
- ID pgtype.UUID `json:"id"`
- ProjectID pgtype.UUID `json:"project_id"`
- Number int32 `json:"number"`
- Title string `json:"title"`
- Description string `json:"description"`
- Status string `json:"status"`
- Priority string `json:"priority"`
- AssigneeID pgtype.UUID `json:"assignee_id"`
- AgentID pgtype.UUID `json:"agent_id"`
- CreatedBy pgtype.UUID `json:"created_by"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
- UpdatedAt pgtype.Timestamptz `json:"updated_at"`
- GithubNodeID pgtype.Text `json:"github_node_id"`
- GithubRepoID pgtype.UUID `json:"github_repo_id"`
- GithubNumber pgtype.Int4 `json:"github_number"`
- Origin string `json:"origin"`
- GithubKind string `json:"github_kind"`
- GithubState pgtype.Text `json:"github_state"`
- GithubUrl pgtype.Text `json:"github_url"`
+ ID pgtype.UUID `json:"id"`
+ ProjectID pgtype.UUID `json:"project_id"`
+ Number int32 `json:"number"`
+ Title string `json:"title"`
+ Description string `json:"description"`
+ Status string `json:"status"`
+ Priority string `json:"priority"`
+ AssigneeID pgtype.UUID `json:"assignee_id"`
+ AgentID pgtype.UUID `json:"agent_id"`
+ CreatedBy pgtype.UUID `json:"created_by"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
+ UpdatedAt pgtype.Timestamptz `json:"updated_at"`
+ GithubNodeID pgtype.Text `json:"github_node_id"`
+ GithubRepoID pgtype.UUID `json:"github_repo_id"`
+ GithubNumber pgtype.Int4 `json:"github_number"`
+ Origin string `json:"origin"`
+ GithubKind string `json:"github_kind"`
+ GithubState pgtype.Text `json:"github_state"`
+ GithubUrl pgtype.Text `json:"github_url"`
+ GithubAuthor pgtype.Text `json:"github_author"`
+ GithubAvatarUrl pgtype.Text `json:"github_avatar_url"`
}
type IssueActivity struct {
@@ -460,6 +462,7 @@ type User struct {
NameColor pgtype.Text `json:"name_color"`
LastSeenAt pgtype.Timestamptz `json:"last_seen_at"`
DigestEnabled bool `json:"digest_enabled"`
+ GithubLogin string `json:"github_login"`
}
type WebhookDelivery struct {
diff --git a/internal/db/users.sql.go b/internal/db/users.sql.go
index 127a1ef..f560a48 100644
--- a/internal/db/users.sql.go
+++ b/internal/db/users.sql.go
@@ -14,7 +14,7 @@ import (
const createUser = `-- name: CreateUser :one
insert into users (email, password_hash, name)
values ($1, $2, $3)
-returning id, email, name, created_at
+returning id, email, name, github_login, created_at
`
type CreateUserParams struct {
@@ -24,10 +24,11 @@ type CreateUserParams struct {
}
type CreateUserRow struct {
- ID pgtype.UUID `json:"id"`
- Email string `json:"email"`
- Name string `json:"name"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
+ ID pgtype.UUID `json:"id"`
+ Email string `json:"email"`
+ Name string `json:"name"`
+ GithubLogin string `json:"github_login"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
}
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error) {
@@ -37,13 +38,14 @@ func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (CreateU
&i.ID,
&i.Email,
&i.Name,
+ &i.GithubLogin,
&i.CreatedAt,
)
return i, err
}
const getUserByEmail = `-- name: GetUserByEmail :one
-select id, email, password_hash, name, name_color, avatar_key, created_at
+select id, email, password_hash, name, name_color, avatar_key, github_login, created_at
from users
where lower(email) = lower($1)
`
@@ -55,6 +57,7 @@ type GetUserByEmailRow struct {
Name string `json:"name"`
NameColor pgtype.Text `json:"name_color"`
AvatarKey pgtype.Text `json:"avatar_key"`
+ GithubLogin string `json:"github_login"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
@@ -68,24 +71,26 @@ func (q *Queries) GetUserByEmail(ctx context.Context, lower string) (GetUserByEm
&i.Name,
&i.NameColor,
&i.AvatarKey,
+ &i.GithubLogin,
&i.CreatedAt,
)
return i, err
}
const getUserByID = `-- name: GetUserByID :one
-select id, email, name, name_color, avatar_key, created_at
+select id, email, name, name_color, avatar_key, github_login, created_at
from users
where id = $1
`
type GetUserByIDRow struct {
- ID pgtype.UUID `json:"id"`
- Email string `json:"email"`
- Name string `json:"name"`
- NameColor pgtype.Text `json:"name_color"`
- AvatarKey pgtype.Text `json:"avatar_key"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
+ ID pgtype.UUID `json:"id"`
+ Email string `json:"email"`
+ Name string `json:"name"`
+ NameColor pgtype.Text `json:"name_color"`
+ AvatarKey pgtype.Text `json:"avatar_key"`
+ GithubLogin string `json:"github_login"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
}
func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDRow, error) {
@@ -97,6 +102,7 @@ func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDR
&i.Name,
&i.NameColor,
&i.AvatarKey,
+ &i.GithubLogin,
&i.CreatedAt,
)
return i, err
@@ -104,7 +110,7 @@ func (q *Queries) GetUserByID(ctx context.Context, id pgtype.UUID) (GetUserByIDR
const updateUserAvatar = `-- name: UpdateUserAvatar :one
update users set avatar_key = $2 where id = $1
-returning id, email, name, name_color, avatar_key, created_at
+returning id, email, name, name_color, avatar_key, github_login, created_at
`
type UpdateUserAvatarParams struct {
@@ -113,12 +119,13 @@ type UpdateUserAvatarParams struct {
}
type UpdateUserAvatarRow struct {
- ID pgtype.UUID `json:"id"`
- Email string `json:"email"`
- Name string `json:"name"`
- NameColor pgtype.Text `json:"name_color"`
- AvatarKey pgtype.Text `json:"avatar_key"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
+ ID pgtype.UUID `json:"id"`
+ Email string `json:"email"`
+ Name string `json:"name"`
+ NameColor pgtype.Text `json:"name_color"`
+ AvatarKey pgtype.Text `json:"avatar_key"`
+ GithubLogin string `json:"github_login"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
}
func (q *Queries) UpdateUserAvatar(ctx context.Context, arg UpdateUserAvatarParams) (UpdateUserAvatarRow, error) {
@@ -130,6 +137,42 @@ func (q *Queries) UpdateUserAvatar(ctx context.Context, arg UpdateUserAvatarPara
&i.Name,
&i.NameColor,
&i.AvatarKey,
+ &i.GithubLogin,
+ &i.CreatedAt,
+ )
+ return i, err
+}
+
+const updateUserGitHubLogin = `-- name: UpdateUserGitHubLogin :one
+update users set github_login = $2 where id = $1
+returning id, email, name, name_color, avatar_key, github_login, created_at
+`
+
+type UpdateUserGitHubLoginParams struct {
+ ID pgtype.UUID `json:"id"`
+ GithubLogin string `json:"github_login"`
+}
+
+type UpdateUserGitHubLoginRow struct {
+ ID pgtype.UUID `json:"id"`
+ Email string `json:"email"`
+ Name string `json:"name"`
+ NameColor pgtype.Text `json:"name_color"`
+ AvatarKey pgtype.Text `json:"avatar_key"`
+ GithubLogin string `json:"github_login"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
+}
+
+func (q *Queries) UpdateUserGitHubLogin(ctx context.Context, arg UpdateUserGitHubLoginParams) (UpdateUserGitHubLoginRow, error) {
+ row := q.db.QueryRow(ctx, updateUserGitHubLogin, arg.ID, arg.GithubLogin)
+ var i UpdateUserGitHubLoginRow
+ err := row.Scan(
+ &i.ID,
+ &i.Email,
+ &i.Name,
+ &i.NameColor,
+ &i.AvatarKey,
+ &i.GithubLogin,
&i.CreatedAt,
)
return i, err
@@ -137,7 +180,7 @@ func (q *Queries) UpdateUserAvatar(ctx context.Context, arg UpdateUserAvatarPara
const updateUserNameColor = `-- name: UpdateUserNameColor :one
update users set name_color = $2 where id = $1
-returning id, email, name, name_color, avatar_key, created_at
+returning id, email, name, name_color, avatar_key, github_login, created_at
`
type UpdateUserNameColorParams struct {
@@ -146,12 +189,13 @@ type UpdateUserNameColorParams struct {
}
type UpdateUserNameColorRow struct {
- ID pgtype.UUID `json:"id"`
- Email string `json:"email"`
- Name string `json:"name"`
- NameColor pgtype.Text `json:"name_color"`
- AvatarKey pgtype.Text `json:"avatar_key"`
- CreatedAt pgtype.Timestamptz `json:"created_at"`
+ ID pgtype.UUID `json:"id"`
+ Email string `json:"email"`
+ Name string `json:"name"`
+ NameColor pgtype.Text `json:"name_color"`
+ AvatarKey pgtype.Text `json:"avatar_key"`
+ GithubLogin string `json:"github_login"`
+ CreatedAt pgtype.Timestamptz `json:"created_at"`
}
func (q *Queries) UpdateUserNameColor(ctx context.Context, arg UpdateUserNameColorParams) (UpdateUserNameColorRow, error) {
@@ -163,6 +207,7 @@ func (q *Queries) UpdateUserNameColor(ctx context.Context, arg UpdateUserNameCol
&i.Name,
&i.NameColor,
&i.AvatarKey,
+ &i.GithubLogin,
&i.CreatedAt,
)
return i, err
diff --git a/internal/github/client.go b/internal/github/client.go
index 884c905..93019a3 100644
--- a/internal/github/client.go
+++ b/internal/github/client.go
@@ -155,34 +155,64 @@ type GHIssue struct {
Body string `json:"body"`
NodeID string `json:"node_id"`
User struct {
- Login string `json:"login"`
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ Type string `json:"type"` // User | Bot
} `json:"user"`
PullRequest *struct{} `json:"pull_request"` // non-nil means it's a PR
Labels []struct {
Name string `json:"name"`
Color string `json:"color"`
} `json:"labels"`
+ Assignees []struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ } `json:"assignees"`
+ Milestone *struct {
+ Title string `json:"title"`
+ } `json:"milestone"`
+ Comments int `json:"comments"`
+ CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
+// GHIssueComment is one comment on an issue or pull request — GitHub serves
+// both through the issues comments API.
+type GHIssueComment struct {
+ HTMLURL string `json:"html_url"`
+ Body string `json:"body"`
+ User struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ Type string `json:"type"`
+ } `json:"user"`
+ CreatedAt time.Time `json:"created_at"`
+}
+
type PR struct {
- Number int `json:"number"`
- Title string `json:"title"`
- State string `json:"state"`
- Draft bool `json:"draft"`
- Body string `json:"body"`
- NodeID string `json:"node_id"`
- Merged bool `json:"merged"`
- MergedAt *time.Time `json:"merged_at"`
- Mergeable *bool `json:"mergeable"`
- MergeableState string `json:"mergeable_state"`
- Additions int `json:"additions"`
- Deletions int `json:"deletions"`
- ChangedFiles int `json:"changed_files"`
- Commits int `json:"commits"`
- HTMLURL string `json:"html_url"`
+ Number int `json:"number"`
+ Title string `json:"title"`
+ State string `json:"state"`
+ Draft bool `json:"draft"`
+ Body string `json:"body"`
+ NodeID string `json:"node_id"`
+ Merged bool `json:"merged"`
+ MergedAt *time.Time `json:"merged_at"`
+ MergedBy *struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ } `json:"merged_by"`
+ Mergeable *bool `json:"mergeable"`
+ MergeableState string `json:"mergeable_state"`
+ Additions int `json:"additions"`
+ Deletions int `json:"deletions"`
+ ChangedFiles int `json:"changed_files"`
+ Commits int `json:"commits"`
+ HTMLURL string `json:"html_url"`
User struct {
- Login string `json:"login"`
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ Type string `json:"type"` // User | Bot
} `json:"user"`
Head struct {
Ref string `json:"ref"`
@@ -192,8 +222,21 @@ type PR struct {
Ref string `json:"ref"`
} `json:"base"`
Labels []struct {
- Name string `json:"name"`
+ Name string `json:"name"`
+ Color string `json:"color"`
} `json:"labels"`
+ Assignees []struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ } `json:"assignees"`
+ RequestedReviewers []struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ } `json:"requested_reviewers"`
+ RequestedTeams []struct {
+ Slug string `json:"slug"`
+ Name string `json:"name"`
+ } `json:"requested_teams"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
@@ -783,6 +826,153 @@ func (c *Client) CreateIssueComment(ctx context.Context, installID int64, owner,
tok, bytes.NewReader(payload), nil)
}
+// IssuePatch carries the fields PATCH issues/{n} accepts — labels and
+// assignees both REPLACE the whole set when non-nil, so callers send the
+// full desired list, not a delta.
+type IssuePatch struct {
+ Labels *[]string `json:"labels,omitempty"`
+ Assignees *[]string `json:"assignees,omitempty"`
+ Title string `json:"title,omitempty"`
+ Body *string `json:"body,omitempty"`
+}
+
+// UpdateIssue edits a GitHub issue — works on PRs too, they share the
+// issues endpoint upstream (labels/assignees on a PR go through here).
+func (c *Client) UpdateIssue(ctx context.Context, installID int64, owner, repo string, number int, patch IssuePatch) (*GHIssue, error) {
+ tok, err := c.installationToken(ctx, installID)
+ if err != nil {
+ return nil, err
+ }
+ payload, _ := json.Marshal(patch)
+ var out GHIssue
+ err = c.do(ctx, "PATCH",
+ fmt.Sprintf("%s/repos/%s/%s/issues/%d", apiBase, owner, repo, number),
+ tok, bytes.NewReader(payload), &out)
+ return &out, err
+}
+
+// RepoLabel is one label defined on the repository.
+type RepoLabel struct {
+ Name string `json:"name"`
+ Color string `json:"color"`
+ Description string `json:"description"`
+}
+
+// ListRepoLabels returns the repo's label catalog — the picker options for
+// label editing. First page (100) covers almost every repo.
+func (c *Client) ListRepoLabels(ctx context.Context, installID int64, owner, repo string) ([]RepoLabel, error) {
+ tok, err := c.installationToken(ctx, installID)
+ if err != nil {
+ return nil, err
+ }
+ var out []RepoLabel
+ err = c.do(ctx, "GET",
+ fmt.Sprintf("%s/repos/%s/%s/labels?per_page=100", apiBase, owner, repo),
+ tok, nil, &out)
+ return out, err
+}
+
+// CreateRepoLabel defines a new label on the repository. color is a 6-char
+// hex string without '#'; empty lets GitHub pick.
+func (c *Client) CreateRepoLabel(ctx context.Context, installID int64, owner, repo, name, color, description string) (*RepoLabel, error) {
+ tok, err := c.installationToken(ctx, installID)
+ if err != nil {
+ return nil, err
+ }
+ payload, _ := json.Marshal(map[string]string{
+ "name": name, "color": color, "description": description,
+ })
+ var out RepoLabel
+ err = c.do(ctx, "POST",
+ fmt.Sprintf("%s/repos/%s/%s/labels", apiBase, owner, repo),
+ tok, bytes.NewReader(payload), &out)
+ return &out, err
+}
+
+// GHUser is GitHub's compact user object — login/avatar/type.
+type GHUser struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ Type string `json:"type"` // User | Bot
+}
+
+// ListRepoAssignees returns users issues may be assigned to — collaborators
+// and org members. First page (100).
+func (c *Client) ListRepoAssignees(ctx context.Context, installID int64, owner, repo string) ([]GHUser, error) {
+ tok, err := c.installationToken(ctx, installID)
+ if err != nil {
+ return nil, err
+ }
+ var out []GHUser
+ err = c.do(ctx, "GET",
+ fmt.Sprintf("%s/repos/%s/%s/assignees?per_page=100", apiBase, owner, repo),
+ tok, nil, &out)
+ return out, err
+}
+
+// PRReview is one submitted review on a pull request.
+type PRReview struct {
+ User struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ Type string `json:"type"`
+ } `json:"user"`
+ State string `json:"state"` // APPROVED | CHANGES_REQUESTED | COMMENTED | DISMISSED | PENDING
+ SubmittedAt time.Time `json:"submitted_at"`
+}
+
+// ListPRReviews returns submitted reviews on a PR — the REST stand-in for
+// GraphQL's reviewDecision. Caller reduces to latest-per-reviewer.
+func (c *Client) ListPRReviews(ctx context.Context, installID int64, owner, repo string, number int) ([]PRReview, error) {
+ tok, err := c.installationToken(ctx, installID)
+ if err != nil {
+ return nil, err
+ }
+ var out []PRReview
+ err = c.do(ctx, "GET",
+ fmt.Sprintf("%s/repos/%s/%s/pulls/%d/reviews?per_page=100", apiBase, owner, repo, number),
+ tok, nil, &out)
+ return out, err
+}
+
+// ListPRCommentCounts returns issue-thread comment counts keyed by PR
+// number. The pulls endpoint omits the count; the issues endpoint carries
+// it on PR entries, which the issue listers fold out — so this walks the
+// issues endpoint raw and keeps only PR rows.
+func (c *Client) ListPRCommentCounts(ctx context.Context, installID int64, owner, repo, state string) (map[int]int, error) {
+ tok, err := c.installationToken(ctx, installID)
+ if err != nil {
+ return nil, err
+ }
+ out := map[int]int{}
+ u := fmt.Sprintf("%s/repos/%s/%s/issues?state=%s", apiBase, owner, repo, url.QueryEscape(state))
+ err = c.listPaged(ctx, tok, u, func(dec *json.Decoder) error {
+ var i GHIssue
+ if err := dec.Decode(&i); err != nil {
+ return err
+ }
+ if i.PullRequest != nil {
+ out[i.Number] = i.Comments
+ }
+ return nil
+ })
+ return out, err
+}
+
+// ListIssueComments returns the comment thread on an issue or PR — both
+// ride the issues comments API. First page, oldest first.
+func (c *Client) ListIssueComments(ctx context.Context, installID int64, owner, repo string, number int) ([]GHIssueComment, error) {
+ tok, err := c.installationToken(ctx, installID)
+ if err != nil {
+ return nil, err
+ }
+ var out []GHIssueComment
+ err = c.do(ctx, "GET",
+ fmt.Sprintf("%s/repos/%s/%s/issues/%d/comments?per_page=100", apiBase, owner, repo, number),
+ tok, nil, &out)
+ return out, err
+}
+
// CreatePR opens a pull request on GitHub.
func (c *Client) CreatePR(ctx context.Context, installID int64, owner, repo, head, base, title, body string, draft bool) (*PR, error) {
tok, err := c.installationToken(ctx, installID)
diff --git a/internal/github/github.go b/internal/github/github.go
index fa406ba..5a1ea0f 100644
--- a/internal/github/github.go
+++ b/internal/github/github.go
@@ -17,6 +17,7 @@ import (
"net/http"
"net/url"
"os/exec"
+ "regexp"
"sort"
"strconv"
"strings"
@@ -97,6 +98,12 @@ func (s *Service) RegisterRoutes(g *gin.RouterGroup, pub *gin.RouterGroup) {
g.GET("/projects/:id/github/files", s.projectMemberOnly, s.handleRepoTree)
g.GET("/projects/:id/github/files/read", s.projectMemberOnly, s.handleRepoFile)
g.GET("/projects/:id/github/pull", s.projectMemberOnly, s.handlePullDetail)
+ g.GET("/projects/:id/github/issue", s.projectMemberOnly, s.handleIssueDetail)
+ g.POST("/projects/:id/github/issues/state", s.projectMemberOnly, s.handleIssueState)
+ g.POST("/projects/:id/github/issues/update", s.projectMemberOnly, s.handleIssueUpdate)
+ g.GET("/projects/:id/github/labels", s.projectMemberOnly, s.handleRepoLabels)
+ g.POST("/projects/:id/github/labels", s.projectMemberOnly, s.handleCreateLabel)
+ g.GET("/projects/:id/github/assignees", s.projectMemberOnly, s.handleRepoAssignees)
g.POST("/projects/:id/github/pulls", s.projectMemberOnly, s.handleCreatePull)
g.POST("/projects/:id/github/issues", s.projectMemberOnly, s.handleCreateGitHubIssue)
g.POST("/messages/:id/github", s.handleFileMessage)
@@ -107,6 +114,7 @@ func (s *Service) RegisterRoutes(g *gin.RouterGroup, pub *gin.RouterGroup) {
g.GET("/projects/:id/github/actions", s.projectMemberOnly, s.handleActions)
g.POST("/projects/:id/github/actions/rerun", s.projectMemberOnly, s.handleActionRerun)
g.GET("/workspaces/:id/github/pulls", s.memberOnly, s.handleWorkspacePulls)
+ g.GET("/workspaces/:id/github/issues", s.memberOnly, s.handleWorkspaceIssues)
g.GET("/projects/:id/github/commits", s.projectMemberOnly, s.handleCommits)
g.GET("/projects/:id/github/commit", s.projectMemberOnly, s.handleCommitDetail)
g.GET("/projects/:id/github/branches", s.projectMemberOnly, s.handleBranches)
@@ -648,6 +656,8 @@ func (s *Service) handleDevelopment(c *gin.Context) {
panel.Issues = append(panel.Issues, gin.H{
"number": i.Number, "title": i.Title, "state": i.State,
"url": i.HTMLURL, "author": i.User.Login,
+ "avatar_url": i.User.AvatarURL, "author_type": i.User.Type,
+ "comments": i.Comments,
"updated_at": i.UpdatedAt,
})
}
@@ -657,6 +667,7 @@ func (s *Service) handleDevelopment(c *gin.Context) {
panel.PRs = append(panel.PRs, gin.H{
"number": pr.Number, "title": pr.Title, "state": pr.State,
"draft": pr.Draft, "url": pr.HTMLURL, "author": pr.User.Login,
+ "avatar_url": pr.User.AvatarURL, "author_type": pr.User.Type,
"head": pr.Head.Ref, "base": pr.Base.Ref,
"updated_at": pr.UpdatedAt,
})
@@ -734,6 +745,7 @@ func (s *Service) handlePullDetail(c *gin.Context) {
if pr.Head.SHA != "" {
checks, _ = cli.ListCheckRuns(ctx, repo.InstallationID, repo.Owner, repo.Name, pr.Head.SHA)
}
+ reviews, _ := cli.ListPRReviews(ctx, repo.InstallationID, repo.Owner, repo.Name, number)
mergeable := ""
if pr.Mergeable != nil {
if *pr.Mergeable {
@@ -742,9 +754,31 @@ func (s *Service) handlePullDetail(c *gin.Context) {
mergeable = "conflicting"
}
}
- labels := make([]string, 0, len(pr.Labels))
+ labels := make([]gin.H, 0, len(pr.Labels))
for _, l := range pr.Labels {
- labels = append(labels, l.Name)
+ labels = append(labels, gin.H{"name": l.Name, "color": l.Color})
+ }
+ assignees := make([]gin.H, 0, len(pr.Assignees))
+ for _, a := range pr.Assignees {
+ assignees = append(assignees, gin.H{
+ "login": a.Login, "avatar_url": a.AvatarURL,
+ })
+ }
+ reviewers := make([]gin.H, 0, len(pr.RequestedReviewers))
+ for _, a := range pr.RequestedReviewers {
+ reviewers = append(reviewers, gin.H{
+ "login": a.Login, "avatar_url": a.AvatarURL,
+ })
+ }
+ teams := make([]gin.H, 0, len(pr.RequestedTeams))
+ for _, t := range pr.RequestedTeams {
+ teams = append(teams, gin.H{"slug": t.Slug, "name": t.Name})
+ }
+ var mergedBy gin.H
+ if pr.MergedBy != nil {
+ mergedBy = gin.H{
+ "login": pr.MergedBy.Login, "avatar_url": pr.MergedBy.AvatarURL,
+ }
}
outFiles := make([]gin.H, 0, len(files))
for _, f := range files {
@@ -768,22 +802,53 @@ func (s *Service) handlePullDetail(c *gin.Context) {
"conclusion": ch.Conclusion, "url": ch.HTMLURL,
})
}
+ // Latest submitted state per reviewer — DISMISSED cancels that reviewer's
+ // earlier vote. COMMENTED reviews count as activity, not a decision.
+ latest := map[string]gin.H{}
+ for _, rv := range reviews {
+ latest[rv.User.Login] = gin.H{
+ "login": rv.User.Login, "avatar_url": rv.User.AvatarURL,
+ "state": rv.State, "submitted_at": rv.SubmittedAt,
+ }
+ }
+ outReviews := make([]gin.H, 0, len(latest))
+ decision := ""
+ for _, rv := range latest {
+ outReviews = append(outReviews, rv)
+ switch rv["state"] {
+ case "CHANGES_REQUESTED":
+ decision = "changes_requested"
+ case "APPROVED":
+ if decision == "" {
+ decision = "approved"
+ }
+ }
+ }
+ if decision == "" && len(pr.RequestedReviewers) > 0 {
+ decision = "pending"
+ }
c.JSON(http.StatusOK, gin.H{
"pull": gin.H{
"number": pr.Number, "title": pr.Title, "state": pr.State,
"draft": pr.Draft, "merged": pr.Merged, "merged_at": pr.MergedAt,
"mergeable": mergeable, "mergeable_state": pr.MergeableState,
"body": pr.Body, "url": pr.HTMLURL, "author": pr.User.Login,
+ "avatar_url": pr.User.AvatarURL, "author_type": pr.User.Type,
"head": pr.Head.Ref, "base": pr.Base.Ref,
"additions": pr.Additions, "deletions": pr.Deletions,
"changed_files": pr.ChangedFiles, "commit_count": pr.Commits,
- "labels": labels,
+ "labels": labels,
+ "assignees": assignees, "reviewers": reviewers,
+ "teams": teams,
+ "merged_by": mergedBy,
"created_at": pr.CreatedAt, "updated_at": pr.UpdatedAt,
"repo": repoJSON(repo),
},
- "files": outFiles,
- "commits": outCommits,
- "checks": outChecks,
+ "files": outFiles,
+ "commits": outCommits,
+ "checks": outChecks,
+ "reviews": outReviews,
+ "review_decision": decision,
})
}
@@ -1090,6 +1155,259 @@ func (s *Service) handleCreatePull(c *gin.Context) {
})
}
+// handleIssueDetail bundles a GitHub issue with its comment thread for the
+// in-app issue view — sibling of handlePullDetail.
+func (s *Service) handleIssueDetail(c *gin.Context) {
+ p := project(c)
+ repo, ok := s.linkedRepo(c, p)
+ if !ok {
+ return
+ }
+ number, err := strconv.Atoi(c.Query("number"))
+ if err != nil || number <= 0 {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "number is required")
+ return
+ }
+ cli, err := s.githubClient(c.Request.Context())
+ if err != nil {
+ httpx.Error(c, http.StatusBadRequest, "not_registered", "GitHub is not connected")
+ return
+ }
+ ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
+ defer cancel()
+
+ iss, err := cli.GetIssue(ctx, repo.InstallationID, repo.Owner, repo.Name, number)
+ if err != nil {
+ httpx.Error(c, http.StatusBadGateway, "github_error", "could not load the issue")
+ return
+ }
+ // Comments are supplementary — a failure degrades to an empty thread.
+ comments, _ := cli.ListIssueComments(ctx, repo.InstallationID, repo.Owner, repo.Name, number)
+
+ labels := make([]gin.H, 0, len(iss.Labels))
+ for _, l := range iss.Labels {
+ labels = append(labels, gin.H{"name": l.Name, "color": l.Color})
+ }
+ assignees := make([]gin.H, 0, len(iss.Assignees))
+ for _, a := range iss.Assignees {
+ assignees = append(assignees, gin.H{
+ "login": a.Login, "avatar_url": a.AvatarURL,
+ })
+ }
+ outComments := make([]gin.H, 0, len(comments))
+ for _, cm := range comments {
+ outComments = append(outComments, gin.H{
+ "body": cm.Body, "url": cm.HTMLURL,
+ "author": cm.User.Login, "avatar_url": cm.User.AvatarURL,
+ "author_type": cm.User.Type, "created_at": cm.CreatedAt,
+ })
+ }
+ issue := gin.H{
+ "number": iss.Number, "title": iss.Title, "state": iss.State,
+ "body": iss.Body, "url": iss.HTMLURL, "author": iss.User.Login,
+ "avatar_url": iss.User.AvatarURL, "author_type": iss.User.Type,
+ "labels": labels,
+ "assignees": assignees, "comment_count": iss.Comments,
+ "created_at": iss.CreatedAt, "updated_at": iss.UpdatedAt,
+ }
+ if iss.Milestone != nil {
+ issue["milestone"] = iss.Milestone.Title
+ }
+ c.JSON(http.StatusOK, gin.H{
+ "issue": issue,
+ "comments": outComments,
+ "repo": repoJSON(repo),
+ })
+}
+
+// handleIssueState closes or reopens a GitHub issue — mirror of the pull
+// state endpoint.
+func (s *Service) handleIssueState(c *gin.Context) {
+ p := project(c)
+ repo, ok := s.linkedRepo(c, p)
+ if !ok {
+ return
+ }
+ var req struct {
+ Number int `json:"number"`
+ State string `json:"state"`
+ }
+ if err := c.ShouldBindJSON(&req); err != nil || req.Number <= 0 ||
+ (req.State != "open" && req.State != "closed") {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "number and state open|closed are required")
+ return
+ }
+ cli, err := s.githubClient(c.Request.Context())
+ if err != nil {
+ httpx.Error(c, http.StatusBadRequest, "not_registered", "GitHub is not connected")
+ return
+ }
+ ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
+ defer cancel()
+ if err := cli.SetIssueState(ctx, repo.InstallationID, repo.Owner, repo.Name,
+ req.Number, req.State); err != nil {
+ httpx.Error(c, http.StatusBadGateway, "github_error", truncate(err.Error(), 300))
+ return
+ }
+ s.invalidateDevPanel(p.ID)
+ c.JSON(http.StatusOK, gin.H{"state": req.State})
+}
+
+// handleRepoLabels returns the repo's label catalog — picker options for
+// the issue/PR label editor.
+func (s *Service) handleRepoLabels(c *gin.Context) {
+ p := project(c)
+ repo, ok := s.linkedRepo(c, p)
+ if !ok {
+ return
+ }
+ cli, err := s.githubClient(c.Request.Context())
+ if err != nil {
+ httpx.Error(c, http.StatusBadRequest, "not_registered", "GitHub is not connected")
+ return
+ }
+ ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
+ defer cancel()
+ labels, err := cli.ListRepoLabels(ctx, repo.InstallationID, repo.Owner, repo.Name)
+ if err != nil {
+ httpx.Error(c, http.StatusBadGateway, "github_error", truncate(err.Error(), 300))
+ return
+ }
+ out := make([]gin.H, 0, len(labels))
+ for _, l := range labels {
+ out = append(out, gin.H{
+ "name": l.Name, "color": l.Color, "description": l.Description,
+ })
+ }
+ c.JSON(http.StatusOK, gin.H{"labels": out})
+}
+
+var labelColorPattern = regexp.MustCompile(`^[0-9a-fA-F]{6}$`)
+
+// handleCreateLabel defines a new label on the linked repo — feeds the
+// "new label" affordance in the issue/PR meta editor.
+func (s *Service) handleCreateLabel(c *gin.Context) {
+ p := project(c)
+ repo, ok := s.linkedRepo(c, p)
+ if !ok {
+ return
+ }
+ var req struct {
+ Name string `json:"name"`
+ Color string `json:"color"`
+ Description string `json:"description"`
+ }
+ if err := c.ShouldBindJSON(&req); err != nil ||
+ strings.TrimSpace(req.Name) == "" {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "name is required")
+ return
+ }
+ color := strings.TrimPrefix(strings.TrimSpace(req.Color), "#")
+ if color != "" && !labelColorPattern.MatchString(color) {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "color must be a 6-char hex")
+ return
+ }
+ cli, err := s.githubClient(c.Request.Context())
+ if err != nil {
+ httpx.Error(c, http.StatusBadRequest, "not_registered", "GitHub is not connected")
+ return
+ }
+ ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
+ defer cancel()
+ l, err := cli.CreateRepoLabel(ctx, repo.InstallationID, repo.Owner, repo.Name,
+ strings.TrimSpace(req.Name), color, req.Description)
+ if err != nil {
+ httpx.Error(c, http.StatusBadGateway, "github_error", truncate(err.Error(), 300))
+ return
+ }
+ c.JSON(http.StatusCreated, gin.H{
+ "name": l.Name, "color": l.Color, "description": l.Description,
+ })
+}
+
+// handleRepoAssignees returns the repo's assignable users — picker options
+// for the issue/PR assignee editor.
+func (s *Service) handleRepoAssignees(c *gin.Context) {
+ p := project(c)
+ repo, ok := s.linkedRepo(c, p)
+ if !ok {
+ return
+ }
+ cli, err := s.githubClient(c.Request.Context())
+ if err != nil {
+ httpx.Error(c, http.StatusBadRequest, "not_registered", "GitHub is not connected")
+ return
+ }
+ ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
+ defer cancel()
+ users, err := cli.ListRepoAssignees(ctx, repo.InstallationID, repo.Owner, repo.Name)
+ if err != nil {
+ httpx.Error(c, http.StatusBadGateway, "github_error", truncate(err.Error(), 300))
+ return
+ }
+ out := make([]gin.H, 0, len(users))
+ for _, u := range users {
+ out = append(out, gin.H{
+ "login": u.Login, "avatar_url": u.AvatarURL, "type": u.Type,
+ })
+ }
+ c.JSON(http.StatusOK, gin.H{"users": out})
+}
+
+// handleIssueUpdate edits labels/assignees on a GitHub issue — PATCH
+// replaces each set wholesale when provided. Works on PR numbers too.
+func (s *Service) handleIssueUpdate(c *gin.Context) {
+ p := project(c)
+ repo, ok := s.linkedRepo(c, p)
+ if !ok {
+ return
+ }
+ var req struct {
+ Number int `json:"number"`
+ Labels *[]string `json:"labels"`
+ Assignees *[]string `json:"assignees"`
+ Title *string `json:"title"`
+ Body *string `json:"body"`
+ }
+ if err := c.ShouldBindJSON(&req); err != nil || req.Number <= 0 ||
+ (req.Labels == nil && req.Assignees == nil && req.Title == nil && req.Body == nil) {
+ httpx.Error(c, http.StatusBadRequest, "bad_request", "number plus at least one field to update are required")
+ return
+ }
+ cli, err := s.githubClient(c.Request.Context())
+ if err != nil {
+ httpx.Error(c, http.StatusBadRequest, "not_registered", "GitHub is not connected")
+ return
+ }
+ ctx, cancel := context.WithTimeout(c.Request.Context(), 15*time.Second)
+ defer cancel()
+ patch := IssuePatch{Labels: req.Labels, Assignees: req.Assignees, Body: req.Body}
+ if req.Title != nil {
+ patch.Title = *req.Title
+ }
+ iss, err := cli.UpdateIssue(ctx, repo.InstallationID, repo.Owner, repo.Name,
+ req.Number, patch)
+ if err != nil {
+ httpx.Error(c, http.StatusBadGateway, "github_error", truncate(err.Error(), 300))
+ return
+ }
+ s.invalidateDevPanel(p.ID)
+ labels := make([]gin.H, 0, len(iss.Labels))
+ for _, l := range iss.Labels {
+ labels = append(labels, gin.H{"name": l.Name, "color": l.Color})
+ }
+ assignees := make([]gin.H, 0, len(iss.Assignees))
+ for _, a := range iss.Assignees {
+ assignees = append(assignees, gin.H{
+ "login": a.Login, "avatar_url": a.AvatarURL,
+ })
+ }
+ c.JSON(http.StatusOK, gin.H{
+ "title": iss.Title, "body": iss.Body,
+ "labels": labels, "assignees": assignees,
+ })
+}
+
// handleIssueComment posts a comment on a GitHub issue or pull request —
// both ride the issues comments API upstream.
func (s *Service) handleIssueComment(c *gin.Context) {
@@ -1134,7 +1452,8 @@ func (s *Service) invalidateDevPanel(projectID pgtype.UUID) {
// that group rather than blanking the whole view.
func (s *Service) handleWorkspacePulls(c *gin.Context) {
wsID, _ := httpx.PathUUID(c, "id")
- key := "wspulls:" + wsID.String()
+ state := c.DefaultQuery("state", "open")
+ key := "wspulls:" + wsID.String() + ":" + state
if v, ok := s.cache.Load(key); ok {
if e := v.(cacheEntry); time.Now().Before(e.expiry) {
c.JSON(http.StatusOK, e.data)
@@ -1169,7 +1488,10 @@ func (s *Service) handleWorkspacePulls(c *gin.Context) {
for i := range jobs {
r := repos[i]
ctx, cancel := context.WithTimeout(c.Request.Context(), 12*time.Second)
- prs, err := cli.ListPRs(ctx, r.InstallationID, r.Owner, r.Name)
+ prs, err := cli.ListPRsWithState(ctx, r.InstallationID, r.Owner, r.Name, state)
+ // Comment counts ride the issues endpoint — best-effort, a
+ // failure here degrades the field, not the whole group.
+ counts, _ := cli.ListPRCommentCounts(ctx, r.InstallationID, r.Owner, r.Name, state)
cancel()
if err != nil {
s.log.Warn("workspace pulls", zap.String("repo", r.Owner+"/"+r.Name), zap.Error(err))
@@ -1178,14 +1500,34 @@ func (s *Service) handleWorkspacePulls(c *gin.Context) {
}
out := make([]gin.H, 0, len(prs))
for _, pr := range prs {
- labels := make([]string, 0, len(pr.Labels))
+ labels := make([]gin.H, 0, len(pr.Labels))
for _, l := range pr.Labels {
- labels = append(labels, l.Name)
+ labels = append(labels, gin.H{"name": l.Name, "color": l.Color})
+ }
+ assignees := make([]gin.H, 0, len(pr.Assignees))
+ for _, a := range pr.Assignees {
+ assignees = append(assignees, gin.H{
+ "login": a.Login, "avatar_url": a.AvatarURL,
+ })
+ }
+ reviewers := make([]gin.H, 0, len(pr.RequestedReviewers))
+ for _, a := range pr.RequestedReviewers {
+ reviewers = append(reviewers, gin.H{
+ "login": a.Login, "avatar_url": a.AvatarURL,
+ })
+ }
+ teams := make([]gin.H, 0, len(pr.RequestedTeams))
+ for _, t := range pr.RequestedTeams {
+ teams = append(teams, gin.H{"slug": t.Slug, "name": t.Name})
}
out = append(out, gin.H{
"number": pr.Number, "title": pr.Title, "state": pr.State,
"draft": pr.Draft, "url": pr.HTMLURL, "author": pr.User.Login,
- "head": pr.Head.Ref, "base": pr.Base.Ref, "labels": labels,
+ "avatar_url": pr.User.AvatarURL, "author_type": pr.User.Type,
+ "merged_at": pr.MergedAt,
+ "head": pr.Head.Ref, "base": pr.Base.Ref, "labels": labels,
+ "assignees": assignees, "reviewers": reviewers, "teams": teams,
+ "comments": counts[pr.Number],
"created_at": pr.CreatedAt, "updated_at": pr.UpdatedAt,
})
}
@@ -1204,9 +1546,11 @@ func (s *Service) handleWorkspacePulls(c *gin.Context) {
pulls[res.idx] = res.pulls
}
groups := make([]gin.H, 0, len(repos))
+ var failed []string
for i, r := range repos {
if pulls[i] == nil {
- continue // repo call failed
+ failed = append(failed, r.Owner+"/"+r.Name) // repo call failed
+ continue
}
groups = append(groups, gin.H{
"project_id": r.ProjectID.String(),
@@ -1219,7 +1563,123 @@ func (s *Service) handleWorkspacePulls(c *gin.Context) {
"pulls": pulls[i],
})
}
- payload := gin.H{"groups": groups, "fetched_at": time.Now()}
+ payload := gin.H{"groups": groups, "failed": failed, "fetched_at": time.Now()}
+ s.cache.Store(key, cacheEntry{data: payload, expiry: time.Now().Add(60 * time.Second)})
+ c.JSON(http.StatusOK, payload)
+}
+
+// handleWorkspaceIssues aggregates open issues across every linked repo in
+// the workspace — sibling of handleWorkspacePulls. issue_id links the row to
+// its mirrored Relay issue when one exists, so rows can deep-link in-app.
+func (s *Service) handleWorkspaceIssues(c *gin.Context) {
+ wsID, _ := httpx.PathUUID(c, "id")
+ state := c.DefaultQuery("state", "open")
+ key := "wsissues:" + wsID.String() + ":" + state
+ if v, ok := s.cache.Load(key); ok {
+ if e := v.(cacheEntry); time.Now().Before(e.expiry) {
+ c.JSON(http.StatusOK, e.data)
+ return
+ }
+ }
+ repos, err := s.q.ListWorkspaceRepoProjects(c.Request.Context(), wsID)
+ if err != nil {
+ httpx.Error(c, http.StatusInternalServerError, "internal", "internal error")
+ return
+ }
+ cli, err := s.githubClient(c.Request.Context())
+ if err != nil {
+ httpx.Error(c, http.StatusBadRequest, "not_registered", "GitHub is not connected")
+ return
+ }
+ type result struct {
+ idx int
+ issues []gin.H
+ }
+ jobs := make(chan int, len(repos))
+ results := make(chan result, len(repos))
+ workers := 4
+ if len(repos) < workers {
+ workers = len(repos)
+ }
+ var wg sync.WaitGroup
+ for range workers {
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ for i := range jobs {
+ r := repos[i]
+ ctx, cancel := context.WithTimeout(c.Request.Context(), 12*time.Second)
+ list, err := cli.ListIssuesWithState(ctx, r.InstallationID, r.Owner, r.Name, state)
+ if err != nil {
+ cancel()
+ s.log.Warn("workspace issues", zap.String("repo", r.Owner+"/"+r.Name), zap.Error(err))
+ results <- result{i, nil}
+ continue
+ }
+ out := make([]gin.H, 0, len(list))
+ for _, iss := range list {
+ labels := make([]gin.H, 0, len(iss.Labels))
+ for _, l := range iss.Labels {
+ labels = append(labels, gin.H{"name": l.Name, "color": l.Color})
+ }
+ assignees := make([]gin.H, 0, len(iss.Assignees))
+ for _, a := range iss.Assignees {
+ assignees = append(assignees, gin.H{
+ "login": a.Login, "avatar_url": a.AvatarURL,
+ })
+ }
+ entry := gin.H{
+ "number": iss.Number, "title": iss.Title, "state": iss.State,
+ "url": iss.HTMLURL, "author": iss.User.Login,
+ "avatar_url": iss.User.AvatarURL, "author_type": iss.User.Type,
+ "labels": labels,
+ "assignees": assignees, "comments": iss.Comments,
+ "created_at": iss.CreatedAt, "updated_at": iss.UpdatedAt,
+ }
+ if iss.Milestone != nil {
+ entry["milestone"] = iss.Milestone.Title
+ }
+ if mirrored, err := s.q.FindIssueByGitHub(ctx, db.FindIssueByGitHubParams{
+ RepoID: r.ID, Number: pgtype.Int4{Int32: int32(iss.Number), Valid: true},
+ }); err == nil {
+ entry["issue_id"] = mirrored.ID.String()
+ }
+ out = append(out, entry)
+ }
+ cancel()
+ results <- result{i, out}
+ }
+ }()
+ }
+ for i := range repos {
+ jobs <- i
+ }
+ close(jobs)
+ wg.Wait()
+ close(results)
+ issues := make([][]gin.H, len(repos))
+ for res := range results {
+ issues[res.idx] = res.issues
+ }
+ groups := make([]gin.H, 0, len(repos))
+ var failed []string
+ for i, r := range repos {
+ if issues[i] == nil {
+ failed = append(failed, r.Owner+"/"+r.Name) // repo call failed
+ continue
+ }
+ groups = append(groups, gin.H{
+ "project_id": r.ProjectID.String(),
+ "project_name": r.ProjectName,
+ "project_key": r.ProjectKey,
+ "repo": repoJSON(db.Repository{
+ ID: r.ID, Owner: r.Owner, Name: r.Name,
+ DefaultBranch: r.DefaultBranch, InstallationID: r.InstallationID,
+ }),
+ "issues": issues[i],
+ })
+ }
+ payload := gin.H{"groups": groups, "failed": failed, "fetched_at": time.Now()}
s.cache.Store(key, cacheEntry{data: payload, expiry: time.Now().Add(60 * time.Second)})
c.JSON(http.StatusOK, payload)
}
@@ -1409,6 +1869,10 @@ type webhookPayload struct {
State string `json:"state"`
NodeID string `json:"node_id"`
HTMLURL string `json:"html_url"`
+ User struct {
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
+ } `json:"user"`
} `json:"issue"`
PullRequest *struct {
Number int `json:"number"`
@@ -1420,7 +1884,8 @@ type webhookPayload struct {
NodeID string `json:"node_id"`
HTMLURL string `json:"html_url"`
User struct {
- Login string `json:"login"`
+ Login string `json:"login"`
+ AvatarURL string `json:"avatar_url"`
} `json:"user"`
} `json:"pull_request"`
}
@@ -1569,6 +2034,7 @@ func (s *Service) onIssue(ctx context.Context, p webhookPayload) {
url: p.Issue.HTMLURL,
nodeID: p.Issue.NodeID,
status: issueStatus(p.Issue.State),
+ author: p.Issue.User.Login, avatarURL: p.Issue.User.AvatarURL,
}
_, created, _, err := s.upsertGitHub(ctx, repo, item)
if err != nil {
@@ -1600,15 +2066,17 @@ func (s *Service) publishIssue(projectID pgtype.UUID, issueID pgtype.UUID, creat
// importItem is one GitHub object normalized for upsertGitHub.
type importItem struct {
- kind string // 'issue' | 'pr'
- number int
- title string
- body string
- state string // raw GitHub state: open|closed|merged
- url string
- nodeID string
- status string // mapped Relay status
- issueID pgtype.UUID // filled by upsertGitHub
+ kind string // 'issue' | 'pr'
+ number int
+ title string
+ body string
+ state string // raw GitHub state: open|closed|merged
+ url string
+ nodeID string
+ status string // mapped Relay status
+ author string // GitHub login of whoever filed it
+ avatarURL string // their avatar — hotlinked, never stored
+ issueID pgtype.UUID // filled by upsertGitHub
}
// issueStatus maps a GitHub issue state onto a Relay status.
@@ -1653,9 +2121,11 @@ func (s *Service) upsertGitHub(ctx context.Context, repo db.Repository, in impor
Status: in.status,
NodeID: pgtype.Text{String: in.nodeID, Valid: in.nodeID != ""},
RepoID: repo.ID, GhNumber: pgtype.Int4{Int32: int32(in.number), Valid: true},
- Kind: in.kind,
- GhState: pgtype.Text{String: in.state, Valid: in.state != ""},
- GhUrl: pgtype.Text{String: in.url, Valid: in.url != ""},
+ Kind: in.kind,
+ GhState: pgtype.Text{String: in.state, Valid: in.state != ""},
+ GhUrl: pgtype.Text{String: in.url, Valid: in.url != ""},
+ GhAuthor: pgtype.Text{String: in.author, Valid: in.author != ""},
+ GhAvatarUrl: pgtype.Text{String: in.avatarURL, Valid: in.avatarURL != ""},
})
if err != nil {
return pgtype.UUID{}, false, false, err
@@ -1667,9 +2137,14 @@ func (s *Service) upsertGitHub(ctx context.Context, repo db.Repository, in impor
return pgtype.UUID{}, false, false, err
}
desc := truncate(in.body, 40000)
+ // Webhook payloads lack avatar_url — treat empty incoming fields as
+ // "no data" rather than a change to blank.
+ authorMoved := in.author != "" && existing.GithubAuthor.String != in.author
+ avatarMoved := in.avatarURL != "" && existing.GithubAvatarUrl.String != in.avatarURL
if existing.Status == in.status && existing.Title == in.title &&
existing.Description == desc &&
- existing.GithubState.String == in.state && existing.GithubUrl.String == in.url {
+ existing.GithubState.String == in.state && existing.GithubUrl.String == in.url &&
+ !authorMoved && !avatarMoved {
return existing.ID, false, false, nil
}
if existing.Status != in.status {
@@ -1683,6 +2158,8 @@ func (s *Service) upsertGitHub(ctx context.Context, repo db.Repository, in impor
Status: pgtype.Text{String: in.status, Valid: true},
GhState: pgtype.Text{String: in.state, Valid: in.state != ""},
GhUrl: pgtype.Text{String: in.url, Valid: in.url != ""},
+ GhAuthor: pgtype.Text{String: in.author, Valid: in.author != ""},
+ GhAvatarUrl: pgtype.Text{String: in.avatarURL, Valid: in.avatarURL != ""},
})
return row.ID, false, true, err
}
@@ -1695,6 +2172,7 @@ func (s *Service) MirrorIssue(ctx context.Context, repo db.Repository, i GHIssue
kind: "issue", number: i.Number, title: i.Title, body: i.Body,
state: i.State, url: i.HTMLURL, nodeID: i.NodeID,
status: issueStatus(i.State),
+ author: i.User.Login, avatarURL: i.User.AvatarURL,
})
return id, err
}
@@ -1705,6 +2183,7 @@ func (s *Service) MirrorPR(ctx context.Context, repo db.Repository, p PR) (pgtyp
kind: "pr", number: p.Number, title: p.Title, body: p.Body,
state: p.State, url: p.HTMLURL, nodeID: p.NodeID,
status: prStatus(p.State, p.Merged, p.Draft),
+ author: p.User.Login, avatarURL: p.User.AvatarURL,
})
return id, err
}
@@ -1744,6 +2223,7 @@ func (s *Service) onPullRequest(ctx context.Context, p webhookPayload) {
url: pr.HTMLURL,
nodeID: pr.NodeID,
status: prStatus(pr.State, pr.Merged, pr.Draft),
+ author: pr.User.Login, avatarURL: pr.User.AvatarURL,
}
_, created, _, err := s.upsertGitHub(ctx, repo, item)
if err != nil {
@@ -1843,6 +2323,7 @@ func (s *Service) importRepo(ctx context.Context, cli *Client, repo db.Repositor
kind: "issue", number: gi.Number, title: gi.Title, body: gi.Body,
state: gi.State, url: gi.HTMLURL, nodeID: gi.NodeID,
status: issueStatus(gi.State),
+ author: gi.User.Login, avatarURL: gi.User.AvatarURL,
}
id, created, _, err := s.upsertGitHub(ctx, repo, item)
if err != nil {
@@ -1861,6 +2342,7 @@ func (s *Service) importRepo(ctx context.Context, cli *Client, repo db.Repositor
kind: "pr", number: pr.Number, title: pr.Title, body: pr.Body,
state: state, url: pr.HTMLURL, nodeID: pr.NodeID,
status: prStatus(pr.State, pr.MergedAt != nil, pr.Draft),
+ author: pr.User.Login, avatarURL: pr.User.AvatarURL,
}
_, created, _, err := s.upsertGitHub(ctx, repo, item)
if err != nil {
@@ -1952,6 +2434,7 @@ func (s *Service) reconcileRepo(ctx context.Context, cli *Client, repo db.Reposi
kind: "issue", number: gi.Number, title: gi.Title, body: gi.Body,
state: gi.State, url: gi.HTMLURL, nodeID: gi.NodeID,
status: issueStatus(gi.State),
+ author: gi.User.Login, avatarURL: gi.User.AvatarURL,
})
}
prs, err := cli.ListPRsRecently(ctx, repo.InstallationID, repo.Owner, repo.Name)
@@ -1967,6 +2450,7 @@ func (s *Service) reconcileRepo(ctx context.Context, cli *Client, repo db.Reposi
kind: "pr", number: pr.Number, title: pr.Title, body: pr.Body,
state: state, url: pr.HTMLURL, nodeID: pr.NodeID,
status: prStatus(pr.State, pr.MergedAt != nil, pr.Draft),
+ author: pr.User.Login, avatarURL: pr.User.AvatarURL,
})
}
}
diff --git a/internal/issues/issues.go b/internal/issues/issues.go
index 3d42016..50e04d7 100644
--- a/internal/issues/issues.go
+++ b/internal/issues/issues.go
@@ -783,6 +783,12 @@ func issueJSON(i db.Issue, assigneeName, assigneeAvatar pgtype.Text, labels []gi
"state": state,
"url": url,
}
+ if i.GithubAuthor.Valid && i.GithubAuthor.String != "" {
+ out["github"].(gin.H)["author"] = i.GithubAuthor.String
+ }
+ if i.GithubAvatarUrl.Valid && i.GithubAvatarUrl.String != "" {
+ out["github"].(gin.H)["avatar_url"] = i.GithubAvatarUrl.String
+ }
}
return out
}
@@ -803,6 +809,7 @@ func listRowToIssue(r db.ListIssuesForUserRow) db.Issue {
GithubNodeID: r.GithubNodeID, GithubRepoID: r.GithubRepoID,
GithubNumber: r.GithubNumber, Origin: r.Origin,
GithubKind: r.GithubKind, GithubState: r.GithubState, GithubUrl: r.GithubUrl,
+ GithubAuthor: r.GithubAuthor, GithubAvatarUrl: r.GithubAvatarUrl,
CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt,
}
}
@@ -815,6 +822,7 @@ func forUserRowToIssue(r db.GetIssueForUserRow) db.Issue {
GithubNodeID: r.GithubNodeID, GithubRepoID: r.GithubRepoID,
GithubNumber: r.GithubNumber, Origin: r.Origin,
GithubKind: r.GithubKind, GithubState: r.GithubState, GithubUrl: r.GithubUrl,
+ GithubAuthor: r.GithubAuthor, GithubAvatarUrl: r.GithubAvatarUrl,
CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt,
}
}
@@ -827,6 +835,7 @@ func byIDRowToIssue(r db.GetIssueByIDRow) db.Issue {
GithubNodeID: r.GithubNodeID, GithubRepoID: r.GithubRepoID,
GithubNumber: r.GithubNumber, Origin: r.Origin,
GithubKind: r.GithubKind, GithubState: r.GithubState, GithubUrl: r.GithubUrl,
+ GithubAuthor: r.GithubAuthor, GithubAvatarUrl: r.GithubAvatarUrl,
CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt,
}
}
diff --git a/packages/api-client/src/generated/schema.ts b/packages/api-client/src/generated/schema.ts
index 4c7506b..3f39050 100644
--- a/packages/api-client/src/generated/schema.ts
+++ b/packages/api-client/src/generated/schema.ts
@@ -102,7 +102,7 @@ export interface paths {
delete?: never;
options?: never;
head?: never;
- /** Update profile fields (chat name color) */
+ /** Update profile fields (chat name color, GitHub login) */
patch: operations["updateMe"];
trace?: never;
};
@@ -1651,6 +1651,23 @@ export interface paths {
patch?: never;
trace?: never;
};
+ "/api/projects/{projectId}/github/issue": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** In-app GitHub issue detail — issue plus comment thread */
+ get: operations["issueDetail"];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
"/api/projects/{projectId}/github/pull/merge": {
parameters: {
query?: never;
@@ -1731,6 +1748,78 @@ export interface paths {
patch?: never;
trace?: never;
};
+ "/api/projects/{projectId}/github/labels": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Label catalog of a linked repository */
+ get: operations["repoLabels"];
+ put?: never;
+ /** Create a label on a linked repository */
+ post: operations["createRepoLabel"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/api/projects/{projectId}/github/assignees": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Assignable users of a linked repository */
+ get: operations["repoAssignees"];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/api/projects/{projectId}/github/issues/update": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /**
+ * 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.
+ */
+ post: operations["updateGitHubIssue"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/api/projects/{projectId}/github/issues/state": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** Close or reopen a GitHub issue */
+ post: operations["setIssueState"];
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
"/api/projects/{projectId}/github/pull/state": {
parameters: {
query?: never;
@@ -1809,7 +1898,7 @@ export interface paths {
path?: never;
cookie?: never;
};
- /** Open pull requests across every linked repo in the workspace */
+ /** Pull requests across every linked repo in the workspace */
get: operations["workspacePulls"];
put?: never;
post?: never;
@@ -1819,6 +1908,23 @@ export interface paths {
patch?: never;
trace?: never;
};
+ "/api/workspaces/{workspaceId}/github/issues": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Issues across every linked repo in the workspace */
+ get: operations["workspaceIssues"];
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
"/api/projects/{projectId}/github/commits": {
parameters: {
query?: never;
@@ -2650,6 +2756,8 @@ export interface components {
name: string;
/** @description Chat name color as */
name_color?: string | null;
+ /** @description Bound GitHub username; empty = not linked. */
+ github_login?: string;
avatar_url?: string | null;
/** Format: date-time */
created_at?: string;
@@ -3144,6 +3252,10 @@ export interface components {
*/
state?: "open" | "closed" | "merged";
url?: string;
+ /** @description GitHub login of the issue/PR author */
+ author?: string;
+ /** @description GitHub avatar URL of the author */
+ avatar_url?: string;
};
};
IssueActivity: {
@@ -3601,6 +3713,8 @@ export interface operations {
"application/json": {
/** @description #rrggbb, or empty string to clear */
name_color?: string;
+ /** @description GitHub username bound for "mine" filters, or empty to clear */
+ github_login?: string;
};
};
};
@@ -7041,11 +7155,55 @@ export interface operations {
};
content: {
"application/json": {
- /** @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 */
pull?: Record;
files?: Record[];
commits?: Record[];
checks?: Record[];
+ /** @description latest submitted review state per reviewer */
+ reviews?: Record[];
+ /** @description approved | changes_requested | pending | "" */
+ review_decision?: string;
+ };
+ };
+ };
+ 400: components["responses"]["BadRequest"];
+ 404: components["responses"]["NotFound"];
+ /** @description GitHub upstream error */
+ 502: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ issueDetail: {
+ parameters: {
+ query: {
+ /** @description owner/name or repo id; optional when only one repo is linked */
+ repo?: string;
+ number: number;
+ };
+ header?: never;
+ path: {
+ projectId: components["parameters"]["ProjectId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Issue detail bundle */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ /** @description number, title, state, body, url, author, avatar_url, author_type, labels, assignees, comment_count, milestone, created_at, updated_at */
+ issue?: Record;
+ comments?: Record[];
+ repo?: Record;
};
};
};
@@ -7258,6 +7416,216 @@ export interface operations {
};
};
};
+ repoLabels: {
+ parameters: {
+ query?: {
+ repo?: string;
+ };
+ header?: never;
+ path: {
+ projectId: components["parameters"]["ProjectId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Labels */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ labels?: {
+ name?: string;
+ color?: string;
+ description?: string;
+ }[];
+ };
+ };
+ };
+ 400: components["responses"]["BadRequest"];
+ /** @description GitHub upstream error */
+ 502: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ createRepoLabel: {
+ parameters: {
+ query?: {
+ repo?: string;
+ };
+ header?: never;
+ path: {
+ projectId: components["parameters"]["ProjectId"];
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": {
+ name: string;
+ /** @description 6-char hex, with or without '#' */
+ color?: string;
+ description?: string;
+ };
+ };
+ };
+ responses: {
+ /** @description Created label */
+ 201: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ name?: string;
+ color?: string;
+ description?: string;
+ };
+ };
+ };
+ 400: components["responses"]["BadRequest"];
+ /** @description GitHub upstream error */
+ 502: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ repoAssignees: {
+ parameters: {
+ query?: {
+ repo?: string;
+ };
+ header?: never;
+ path: {
+ projectId: components["parameters"]["ProjectId"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Assignable users */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ users?: {
+ login?: string;
+ avatar_url?: string;
+ type?: string;
+ }[];
+ };
+ };
+ };
+ 400: components["responses"]["BadRequest"];
+ /** @description GitHub upstream error */
+ 502: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ updateGitHubIssue: {
+ parameters: {
+ query?: {
+ repo?: string;
+ };
+ header?: never;
+ path: {
+ projectId: components["parameters"]["ProjectId"];
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": {
+ number: number;
+ title?: string;
+ body?: string;
+ labels?: string[];
+ assignees?: string[];
+ };
+ };
+ };
+ responses: {
+ /** @description Updated issue fields */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ title?: string;
+ body?: string;
+ labels?: Record[];
+ assignees?: Record[];
+ };
+ };
+ };
+ 400: components["responses"]["BadRequest"];
+ /** @description GitHub upstream error */
+ 502: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ setIssueState: {
+ parameters: {
+ query?: {
+ repo?: string;
+ };
+ header?: never;
+ path: {
+ projectId: components["parameters"]["ProjectId"];
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": {
+ number: number;
+ /** @enum {string} */
+ state: "open" | "closed";
+ };
+ };
+ };
+ responses: {
+ /** @description New issue state */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ state?: string;
+ };
+ };
+ };
+ 400: components["responses"]["BadRequest"];
+ /** @description GitHub upstream error */
+ 502: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
setPullState: {
parameters: {
query?: {
@@ -7423,7 +7791,9 @@ export interface operations {
};
workspacePulls: {
parameters: {
- query?: never;
+ query?: {
+ state?: "open" | "closed" | "all";
+ };
header?: never;
path: {
workspaceId: string;
@@ -7447,6 +7817,34 @@ export interface operations {
403: components["responses"]["Forbidden"];
};
};
+ workspaceIssues: {
+ parameters: {
+ query?: {
+ state?: "open" | "closed" | "all";
+ };
+ header?: never;
+ path: {
+ workspaceId: string;
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Issue groups keyed by project+repo; issue_id links mirrored Relay issues */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": {
+ groups?: Record[];
+ };
+ };
+ };
+ 400: components["responses"]["BadRequest"];
+ 403: components["responses"]["Forbidden"];
+ };
+ };
gitCommits: {
parameters: {
query?: {
diff --git a/packages/api-client/src/index.ts b/packages/api-client/src/index.ts
index d60fb3d..20f70e6 100644
--- a/packages/api-client/src/index.ts
+++ b/packages/api-client/src/index.ts
@@ -155,13 +155,19 @@ export interface PullDetail {
body: string;
url: string;
author: string;
+ avatar_url?: string;
+ author_type?: string;
head: string;
base: string;
additions: number;
deletions: number;
changed_files: number;
commit_count: number;
- labels: string[];
+ labels: { name: string; color?: string }[];
+ assignees: { login: string; avatar_url?: string }[];
+ reviewers: { login: string; avatar_url?: string }[];
+ teams?: { slug: string; name: string }[];
+ merged_by?: { login: string; avatar_url?: string } | null;
created_at: string;
updated_at: string;
repo: LinkedRepo;
@@ -179,6 +185,14 @@ export interface PullDetail {
conclusion: string;
url: string;
}[];
+ // Latest submitted review state per reviewer + the reduced decision.
+ reviews: {
+ login: string;
+ avatar_url?: string;
+ state: string; // APPROVED | CHANGES_REQUESTED | COMMENTED | …
+ submitted_at: string;
+ }[];
+ review_decision: string; // "approved" | "changes_requested" | "pending" | ""
}
// WorkflowRun is one row of a repo's GitHub Actions list.
@@ -213,13 +227,84 @@ export interface WorkspacePulls {
draft: boolean;
url: string;
author: string;
+ avatar_url?: string;
+ merged_at?: string | null;
head: string;
base: string;
- labels: string[];
+ labels: { name: string; color?: string }[];
+ assignees: { login: string; avatar_url?: string }[];
+ reviewers: { login: string; avatar_url?: string }[];
+ teams?: { slug: string; name: string }[];
+ comments?: number;
+ author_type?: string; // "User" | "Bot"
created_at: string;
updated_at: string;
}[];
}[];
+ // Repos whose GitHub call failed — their groups are omitted, this is how
+ // the page can still say so.
+ failed?: string[];
+ fetched_at?: string;
+}
+
+// WorkspaceIssues groups every linked repo's open GitHub issues by project —
+// sibling of WorkspacePulls. issue_id links the mirrored Relay issue when
+// one exists, so rows can deep-link in-app.
+export interface WorkspaceIssues {
+ groups: {
+ project_id: string;
+ project_name: string;
+ project_key: string;
+ repo: LinkedRepo;
+ issues: {
+ number: number;
+ title: string;
+ state: string;
+ url: string;
+ author: string;
+ avatar_url?: string;
+ labels: { name: string; color?: string }[];
+ assignees: { login: string; avatar_url?: string }[];
+ comments: number;
+ author_type?: string; // "User" | "Bot"
+ milestone?: string;
+ issue_id?: string;
+ created_at: string;
+ updated_at: string;
+ }[];
+ }[];
+ failed?: string[]; // repos whose GitHub call failed
+ fetched_at: string;
+}
+
+// IssueDetail is the in-app GitHub issue view: the issue plus its comment
+// thread — sibling of PullDetail.
+export interface IssueDetail {
+ issue: {
+ number: number;
+ title: string;
+ state: string;
+ body: string;
+ url: string;
+ author: string;
+ avatar_url?: string;
+ author_type?: string;
+ labels: { name: string; color?: string }[];
+ assignees: { login: string; avatar_url?: string }[];
+ comment_count: number;
+ milestone?: string;
+ created_at: string;
+ updated_at: string;
+ };
+ comments: {
+ body: string;
+ url: string;
+ author: string;
+ avatar_url?: string;
+ author_type?: string;
+ created_at: string;
+ }[];
+ repo: LinkedRepo;
}
export interface RepoCommit {
@@ -279,6 +364,9 @@ export interface DevRepoPanel {
state: string;
url: string;
author: string;
+ avatar_url?: string;
+ author_type?: string;
+ comments?: number;
updated_at: string;
}[];
prs: {
@@ -288,6 +376,8 @@ export interface DevRepoPanel {
draft: boolean;
url: string;
author: string;
+ avatar_url?: string;
+ author_type?: string;
head: string;
base: string;
updated_at?: string;
@@ -502,7 +592,7 @@ export function createClient(
current_password: currentPassword,
new_password: newPassword,
}),
- updateMe: (input: { name_color: string }) =>
+ updateMe: (input: { name_color?: string; github_login?: string }) =>
patch<{ user: User }>("/api/auth/me", input),
// Browser sign-in for the desktop shell: start, approve (signed-in),
// poll until approved. The approve call rides the existing session.
@@ -875,6 +965,20 @@ export function createClient(
request(
`/api/projects/${projectId}/github/pull?repo=${encodeURIComponent(repo)}&number=${number}`,
),
+ issueDetail: (projectId: string, repo: string, number: number) =>
+ request(
+ `/api/projects/${projectId}/github/issue?repo=${encodeURIComponent(repo)}&number=${number}`,
+ ),
+ setIssueState: (
+ projectId: string,
+ repo: string,
+ number: number,
+ state: "open" | "closed",
+ ) =>
+ post<{ state: string }>(
+ `/api/projects/${projectId}/github/issues/state?repo=${encodeURIComponent(repo)}`,
+ { number, state },
+ ),
createPullRequest: (
projectId: string,
repo: string,
@@ -897,6 +1001,43 @@ export function createClient(
`/api/projects/${projectId}/github/issues?repo=${encodeURIComponent(repo)}`,
input,
),
+ createRepoLabel: (
+ projectId: string,
+ repo: string,
+ input: { name: string; color?: string; description?: string },
+ ) =>
+ post<{ name: string; color?: string; description?: string }>(
+ `/api/projects/${projectId}/github/labels?repo=${encodeURIComponent(repo)}`,
+ input,
+ ),
+ repoLabels: (projectId: string, repo: string) =>
+ request<{ labels: { name: string; color: string; description: string }[] }>(
+ `/api/projects/${projectId}/github/labels?repo=${encodeURIComponent(repo)}`,
+ ),
+ repoAssignees: (projectId: string, repo: string) =>
+ request<{ users: { login: string; avatar_url?: string; type?: string }[] }>(
+ `/api/projects/${projectId}/github/assignees?repo=${encodeURIComponent(repo)}`,
+ ),
+ updateGitHubIssue: (
+ projectId: string,
+ repo: string,
+ input: {
+ number: number;
+ labels?: string[];
+ assignees?: string[];
+ title?: string;
+ body?: string;
+ },
+ ) =>
+ post<{
+ title: string;
+ body: string;
+ labels: { name: string; color?: string }[];
+ assignees: { login: string; avatar_url?: string }[];
+ }>(
+ `/api/projects/${projectId}/github/issues/update?repo=${encodeURIComponent(repo)}`,
+ input,
+ ),
commentOnIssue: (projectId: string, repo: string, number: number, body: string) =>
post<{ commented: boolean }>(
`/api/projects/${projectId}/github/issues/comments?repo=${encodeURIComponent(repo)}`,
@@ -942,8 +1083,10 @@ export function createClient(
`/api/projects/${projectId}/github/actions/rerun?repo=${encodeURIComponent(repo)}`,
{ run_id: runId },
),
- workspacePulls: (workspaceId: string) =>
- request(`/api/workspaces/${workspaceId}/github/pulls`),
+ workspacePulls: (workspaceId: string, state = "open") =>
+ request(`/api/workspaces/${workspaceId}/github/pulls?state=${state}`),
+ workspaceIssues: (workspaceId: string, state = "open") =>
+ request(`/api/workspaces/${workspaceId}/github/issues?state=${state}`),
repoCommits: (projectId: string, repo: string, branch?: string) =>
request<{ commits: RepoCommit[]; branch: string }>(
`/api/projects/${projectId}/github/commits?repo=${encodeURIComponent(repo)}${branch ? `&branch=${encodeURIComponent(branch)}` : ""}`,