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