chore: fix format
This commit is contained in:
@@ -121,42 +121,24 @@ export class PreflightChecker {
|
||||
};
|
||||
}
|
||||
|
||||
// Check for uncommitted changes
|
||||
try {
|
||||
execSync('git diff-index --quiet HEAD --', {
|
||||
cwd: this.projectRoot,
|
||||
stdio: 'pipe'
|
||||
});
|
||||
|
||||
// Also check for untracked files
|
||||
const status = execSync('git status --porcelain', {
|
||||
cwd: this.projectRoot,
|
||||
encoding: 'utf-8'
|
||||
});
|
||||
|
||||
if (status.trim().length > 0) {
|
||||
return {
|
||||
success: false,
|
||||
value: 'dirty',
|
||||
message:
|
||||
'Working tree has uncommitted changes. Please commit or stash them.'
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
value: 'clean',
|
||||
message: 'Working tree is clean'
|
||||
};
|
||||
} catch (error: any) {
|
||||
// git diff-index returns non-zero if there are changes
|
||||
// Check for changes (staged/unstaged/untracked) without requiring HEAD
|
||||
const status = execSync('git status --porcelain', {
|
||||
cwd: this.projectRoot,
|
||||
encoding: 'utf-8'
|
||||
});
|
||||
if (status.trim().length > 0) {
|
||||
return {
|
||||
success: false,
|
||||
value: 'dirty',
|
||||
message:
|
||||
'Working tree has uncommitted changes. Please commit or stash them.'
|
||||
'Working tree has uncommitted or untracked changes. Please commit or stash them.'
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: true,
|
||||
value: 'clean',
|
||||
message: 'Working tree is clean'
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -142,9 +142,7 @@ export async function getRemoteBranches(
|
||||
/**
|
||||
* Check if gh CLI is available and authenticated
|
||||
*/
|
||||
export async function isGhCliAvailable(
|
||||
projectRoot?: string
|
||||
): Promise<boolean> {
|
||||
export async function isGhCliAvailable(projectRoot?: string): Promise<boolean> {
|
||||
try {
|
||||
const options = projectRoot ? { cwd: projectRoot } : {};
|
||||
await execAsync('gh auth status', options);
|
||||
@@ -246,7 +244,11 @@ export async function isOnDefaultBranch(projectRoot: string): Promise<boolean> {
|
||||
try {
|
||||
const currentBranch = await getCurrentBranch(projectRoot);
|
||||
const defaultBranch = await getDefaultBranch(projectRoot);
|
||||
return currentBranch !== null && defaultBranch !== null && currentBranch === defaultBranch;
|
||||
return (
|
||||
currentBranch !== null &&
|
||||
defaultBranch !== null &&
|
||||
currentBranch === defaultBranch
|
||||
);
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user