fix: Address review comments

This commit is contained in:
gsxdsm
2026-02-18 19:52:25 -08:00
parent 4ba0026aa1
commit 4ee160fae4
16 changed files with 184 additions and 35 deletions

View File

@@ -16,6 +16,7 @@ import { exec } from 'child_process';
import { promisify } from 'util';
import type { Feature, PlanningMode, ThinkingLevel } from '@automaker/types';
import { DEFAULT_MAX_CONCURRENCY, stripProviderPrefix } from '@automaker/types';
import { resolveModelString } from '@automaker/model-resolver';
import { createLogger, loadContextFiles, classifyError } from '@automaker/utils';
import { getFeatureDir } from '@automaker/platform';
import * as secureFs from '../../lib/secure-fs.js';
@@ -208,7 +209,7 @@ export class AutoModeServiceFacade {
model?: string,
opts?: Record<string, unknown>
) => {
const resolvedModel = model || 'claude-sonnet-4-6';
const resolvedModel = resolveModelString(model, 'claude-sonnet-4-6');
const provider = ProviderFactory.getProviderForModel(resolvedModel);
const effectiveBareModel = stripProviderPrefix(resolvedModel);
@@ -336,7 +337,7 @@ export class AutoModeServiceFacade {
branchName?: string | null;
}
) => {
const resolvedModel = model || 'claude-sonnet-4-6';
const resolvedModel = resolveModelString(model, 'claude-sonnet-4-6');
const provider = ProviderFactory.getProviderForModel(resolvedModel);
const effectiveBareModel = stripProviderPrefix(resolvedModel);

View File

@@ -160,7 +160,18 @@ export async function performMerge(
// If squash merge, need to commit (using safe array-based command)
if (options?.squash) {
const squashMessage = options?.message || `Merge ${branchName} (squash)`;
await execGitCommand(['commit', '-m', squashMessage], projectPath);
try {
await execGitCommand(['commit', '-m', squashMessage], projectPath);
} catch (commitError: unknown) {
const err = commitError as { message?: string };
// Emit merge:error so subscribers always receive either merge:success or merge:error
emitter?.emit('merge:error', {
branchName,
targetBranch: mergeTo,
error: err.message || String(commitError),
});
throw commitError;
}
}
// Optionally delete the worktree and branch after merging

View File

@@ -15,9 +15,8 @@
* and cherry-pick-service.ts.
*/
import { createLogger } from '@automaker/utils';
import { createLogger, getErrorMessage } from '@automaker/utils';
import { execGitCommand, execGitCommandWithLockRetry } from '../lib/git.js';
import { getErrorMessage } from '../routes/worktree/common.js';
const logger = createLogger('PullService');

View File

@@ -14,10 +14,9 @@
* merge-service.ts.
*/
import { createLogger } from '@automaker/utils';
import { createLogger, getErrorMessage } from '@automaker/utils';
import type { EventEmitter } from '../lib/events.js';
import { execGitCommand, execGitCommandWithLockRetry } from '../lib/git.js';
import { getErrorMessage, logError } from '../routes/worktree/common.js';
const logger = createLogger('StashService');
@@ -242,7 +241,7 @@ export async function applyOrPop(
} catch (error) {
const errorMessage = getErrorMessage(error);
logError(error, `Stash ${operation} failed`);
logger.error(`Stash ${operation} failed`, { error: getErrorMessage(error) });
events?.emit('stash:failure', {
worktreePath,

View File

@@ -144,11 +144,11 @@ async function fetchRemotes(cwd: string): Promise<void> {
* Parse a remote branch name like "origin/feature-branch" into its parts
*/
function parseRemoteBranch(branchName: string): { remote: string; branch: string } | null {
const slashIndex = branchName.indexOf('/');
if (slashIndex === -1) return null;
const lastSlash = branchName.lastIndexOf('/');
if (lastSlash === -1) return null;
return {
remote: branchName.substring(0, slashIndex),
branch: branchName.substring(slashIndex + 1),
remote: branchName.substring(0, lastSlash),
branch: branchName.substring(lastSlash + 1),
};
}