feat: add WSL support for repos on WSL filesystems (#375)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
beb62ff580
commit
f6ec69c969
@@ -1,6 +1,6 @@
|
||||
import type { IssueInfo } from '../../shared/types'
|
||||
import { mapIssueInfo } from './mappers'
|
||||
import { execFileAsync, acquire, release, getOwnerRepo } from './gh-utils'
|
||||
import { ghExecFileAsync, acquire, release, getOwnerRepo } from './gh-utils'
|
||||
|
||||
/**
|
||||
* Get a single issue by number.
|
||||
@@ -11,24 +11,22 @@ export async function getIssue(repoPath: string, issueNumber: number): Promise<I
|
||||
await acquire()
|
||||
try {
|
||||
if (ownerRepo) {
|
||||
const { stdout } = await execFileAsync(
|
||||
'gh',
|
||||
const { stdout } = await ghExecFileAsync(
|
||||
[
|
||||
'api',
|
||||
'--cache',
|
||||
'300s',
|
||||
`repos/${ownerRepo.owner}/${ownerRepo.repo}/issues/${issueNumber}`
|
||||
],
|
||||
{ cwd: repoPath, encoding: 'utf-8' }
|
||||
{ cwd: repoPath }
|
||||
)
|
||||
const data = JSON.parse(stdout)
|
||||
return mapIssueInfo(data)
|
||||
}
|
||||
// Fallback for non-GitHub remotes
|
||||
const { stdout } = await execFileAsync(
|
||||
'gh',
|
||||
const { stdout } = await ghExecFileAsync(
|
||||
['issue', 'view', String(issueNumber), '--json', 'number,title,state,url,labels'],
|
||||
{ cwd: repoPath, encoding: 'utf-8' }
|
||||
{ cwd: repoPath }
|
||||
)
|
||||
const data = JSON.parse(stdout)
|
||||
return mapIssueInfo(data)
|
||||
@@ -48,24 +46,22 @@ export async function listIssues(repoPath: string, limit = 20): Promise<IssueInf
|
||||
await acquire()
|
||||
try {
|
||||
if (ownerRepo) {
|
||||
const { stdout } = await execFileAsync(
|
||||
'gh',
|
||||
const { stdout } = await ghExecFileAsync(
|
||||
[
|
||||
'api',
|
||||
'--cache',
|
||||
'120s',
|
||||
`repos/${ownerRepo.owner}/${ownerRepo.repo}/issues?per_page=${limit}&state=open&sort=updated&direction=desc`
|
||||
],
|
||||
{ cwd: repoPath, encoding: 'utf-8' }
|
||||
{ cwd: repoPath }
|
||||
)
|
||||
const data = JSON.parse(stdout) as unknown[]
|
||||
return data.map((d) => mapIssueInfo(d as Parameters<typeof mapIssueInfo>[0]))
|
||||
}
|
||||
// Fallback for non-GitHub remotes
|
||||
const { stdout } = await execFileAsync(
|
||||
'gh',
|
||||
const { stdout } = await ghExecFileAsync(
|
||||
['issue', 'list', '--json', 'number,title,state,url,labels', '--limit', String(limit)],
|
||||
{ cwd: repoPath, encoding: 'utf-8' }
|
||||
{ cwd: repoPath }
|
||||
)
|
||||
const data = JSON.parse(stdout) as unknown[]
|
||||
return data.map((d) => mapIssueInfo(d as Parameters<typeof mapIssueInfo>[0]))
|
||||
|
||||
Reference in New Issue
Block a user