diff --git a/package-lock.json b/package-lock.json index 01d4496..adc0e90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "git-conflicts", - "version": "1.0.0", + "name": "@sulthonzh/git-conflicts", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "git-conflicts", - "version": "1.0.0", + "name": "@sulthonzh/git-conflicts", + "version": "1.1.0", "license": "MIT", "dependencies": { "chalk": "^4.1.2", diff --git a/src/git.ts b/src/git.ts index 27e9399..517835d 100644 --- a/src/git.ts +++ b/src/git.ts @@ -140,7 +140,13 @@ export class GitOperations { async isMergeInProgress(): Promise { try { const status = await this.git.status(); - return status.files.some((f: StatusFile) => f.index === 'U'); + // Any index code containing 'U' or 'A' in both indicates a conflict + // U = unmerged, A = added by both, D = deleted by both + const conflictCodes = ['U', 'A', 'D']; + return status.files.some((f: StatusFile) => { + const code = f.index; + return conflictCodes.some(c => code.includes(c)) || code === 'AA' || code === 'DD'; + }); } catch { return false; } diff --git a/src/resolver.ts b/src/resolver.ts index 273adef..c932ee3 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -20,7 +20,12 @@ export class ConflictResolver { console.log(` Opening in ${editor}...`); return new Promise((resolvePromise, reject) => { - const editorProcess = spawn(editor, [fullPath], { + // Split editor command to handle args like "code --wait" or "subl -w --new-window" + const parts = editor.split(/\s+/); + const command = parts[0]; + const args = [...parts.slice(1), fullPath]; + + const editorProcess = spawn(command, args, { stdio: 'inherit', });