mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
Resolves merge conflicts: - apps/server/src/routes/terminal/common.ts: Keep randomBytes import, use @automaker/utils for createLogger - apps/ui/eslint.config.mjs: Use main's explicit globals list with XMLHttpRequest and MediaQueryListEvent additions - apps/ui/src/components/views/terminal-view.tsx: Keep our terminal improvements (killAllSessions, beforeunload, better error handling) - apps/ui/src/config/terminal-themes.ts: Keep our search highlight colors for all themes - apps/ui/src/store/app-store.ts: Keep our terminal settings persistence improvements (merge function) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
/**
|
|
* POST /run-feature endpoint - Run a single feature
|
|
*/
|
|
|
|
import type { Request, Response } from 'express';
|
|
import type { AutoModeService } from '../../../services/auto-mode-service.js';
|
|
import { createLogger } from '@automaker/utils';
|
|
import { getErrorMessage, logError } from '../common.js';
|
|
|
|
const logger = createLogger('AutoMode');
|
|
|
|
export function createRunFeatureHandler(autoModeService: AutoModeService) {
|
|
return async (req: Request, res: Response): Promise<void> => {
|
|
try {
|
|
const { projectPath, featureId, useWorktrees } = req.body as {
|
|
projectPath: string;
|
|
featureId: string;
|
|
useWorktrees?: boolean;
|
|
};
|
|
|
|
if (!projectPath || !featureId) {
|
|
res.status(400).json({
|
|
success: false,
|
|
error: 'projectPath and featureId are required',
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Start execution in background
|
|
// executeFeature derives workDir from feature.branchName
|
|
autoModeService
|
|
.executeFeature(projectPath, featureId, useWorktrees ?? false, false)
|
|
.catch((error) => {
|
|
logger.error(`[AutoMode] Feature ${featureId} error:`, error);
|
|
})
|
|
.finally(() => {
|
|
// Release the starting slot when execution completes (success or error)
|
|
// Note: The feature should be in runningFeatures by this point
|
|
});
|
|
|
|
res.json({ success: true });
|
|
} catch (error) {
|
|
logError(error, 'Run feature failed');
|
|
res.status(500).json({ success: false, error: getErrorMessage(error) });
|
|
}
|
|
};
|
|
}
|