Add richer in-app feedback dialog (#468)

* Add richer feedback dialog

* Keep anonymous submission client-side only

* Use lowercase feedback API host

* Fallback feedback submission when api host is unavailable
This commit is contained in:
Neil
2026-04-11 00:52:53 -07:00
committed by GitHub
parent 3cb9c99743
commit ca041b66fe
8 changed files with 364 additions and 26 deletions
+34 -1
View File
@@ -1,6 +1,12 @@
/* eslint-disable max-lines -- Why: co-locating all GitHub client functions keeps the
concurrency acquire/release pattern and error handling consistent across operations. */
import type { PRInfo, PRMergeableState, PRCheckDetail, PRComment } from '../../shared/types'
import type {
PRInfo,
PRMergeableState,
PRCheckDetail,
PRComment,
GitHubViewer
} from '../../shared/types'
import { getPRConflictSummary } from './conflict-summary'
import { execFileAsync, ghExecFileAsync, acquire, release, getOwnerRepo } from './gh-utils'
export { _resetOwnerRepoCache } from './gh-utils'
@@ -55,6 +61,33 @@ export async function starOrca(): Promise<boolean> {
}
}
/**
* Get the authenticated GitHub viewer when gh is available and logged in.
* Returns null when gh is unavailable, unauthenticated, or the lookup fails.
*/
export async function getAuthenticatedViewer(): Promise<GitHubViewer | null> {
await acquire()
try {
const { stdout } = await execFileAsync(
'gh',
['api', 'user', '--jq', '{login: .login, email: .email}'],
{ encoding: 'utf-8' }
)
const viewer = JSON.parse(stdout) as { login?: string; email?: string | null }
if (!viewer.login?.trim()) {
return null
}
return {
login: viewer.login.trim(),
email: viewer.email?.trim() || null
}
} catch {
return null
} finally {
release()
}
}
/**
* Get PR info for a given branch using gh CLI.
* Returns null if gh is not installed, or no PR exists for the branch.