fix: extract path-security helpers, add tests, and improve type safety (#102)
* fix: extract path-security helpers and refactor IPC modules - Extracted path-security helpers from filesystem.ts into filesystem-auth.ts to fix max-lines lint error (402 -> 293 lines) - Extracted duplicated ENOENT detection into isENOENT() helper to eliminate code duplication - Fixed missing curly braces on single-line if-return in isDescendantOrEqual (lint violation) - Replaced any with unknown in test files to satisfy lint rules - All tests passing (29/29) - Lint clean (0 errors, 0 warnings) * fix: bundle preload deps for sandbox mode and fix editor test types The sandbox: true change in createMainWindow broke the app because electron-vite was externalizing @electron-toolkit/preload, producing a require() call that fails in sandboxed preload scripts. Exclude it from externalization so it gets bundled inline. Also fix type errors in editor.test.ts from the partial store setup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
6aab126edb
commit
4c0eee235b
@@ -41,7 +41,13 @@ export async function getPRForBranch(repoPath: string, branch: string): Promise<
|
||||
const branchName = branch.replace(/^refs\/heads\//, '')
|
||||
const { stdout } = await execFileAsync(
|
||||
'gh',
|
||||
['pr', 'view', branchName, '--json', 'number,title,state,url,statusCheckRollup,updatedAt'],
|
||||
[
|
||||
'pr',
|
||||
'view',
|
||||
branchName,
|
||||
'--json',
|
||||
'number,title,state,url,statusCheckRollup,updatedAt,isDraft'
|
||||
],
|
||||
{
|
||||
cwd: repoPath,
|
||||
encoding: 'utf-8'
|
||||
@@ -51,7 +57,7 @@ export async function getPRForBranch(repoPath: string, branch: string): Promise<
|
||||
return {
|
||||
number: data.number,
|
||||
title: data.title,
|
||||
state: mapPRState(data.state),
|
||||
state: mapPRState(data.state, data.isDraft),
|
||||
url: data.url,
|
||||
checksStatus: deriveCheckStatus(data.statusCheckRollup),
|
||||
updatedAt: data.updatedAt
|
||||
@@ -216,7 +222,7 @@ function mapCheckConclusion(state: string): PRCheckDetail['conclusion'] {
|
||||
return null
|
||||
}
|
||||
|
||||
export function mapPRState(state: string): PRInfo['state'] {
|
||||
export function mapPRState(state: string, isDraft?: boolean): PRInfo['state'] {
|
||||
const s = state?.toUpperCase()
|
||||
if (s === 'MERGED') {
|
||||
return 'merged'
|
||||
@@ -224,7 +230,9 @@ export function mapPRState(state: string): PRInfo['state'] {
|
||||
if (s === 'CLOSED') {
|
||||
return 'closed'
|
||||
}
|
||||
// gh CLI returns isDraft separately, but state field is OPEN for drafts too
|
||||
if (isDraft) {
|
||||
return 'draft'
|
||||
}
|
||||
return 'open'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user