mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-21 23:33:07 +00:00
- stop-feature.ts: Add facade parameter for feature stopping - stop.ts: Add facadeFactory parameter for auto loop control - verify-feature.ts: Add facadeFactory parameter for verification - commit-feature.ts: Add facadeFactory parameter for committing All routes maintain backward compatibility by accepting both autoModeService (legacy) and facade/facadeFactory (new).
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
/**
|
|
* POST /verify-feature endpoint - Verify a feature
|
|
*/
|
|
|
|
import type { Request, Response } from 'express';
|
|
import type { AutoModeService } from '../../../services/auto-mode-service.js';
|
|
import type { AutoModeServiceFacade } from '../../../services/auto-mode/index.js';
|
|
import { getErrorMessage, logError } from '../common.js';
|
|
|
|
/**
|
|
* Create verify feature handler with transition compatibility.
|
|
* Accepts either autoModeService (legacy) or facadeFactory (new).
|
|
*/
|
|
export function createVerifyFeatureHandler(
|
|
autoModeService: AutoModeService,
|
|
facadeFactory?: (projectPath: string) => AutoModeServiceFacade
|
|
) {
|
|
return async (req: Request, res: Response): Promise<void> => {
|
|
try {
|
|
const { projectPath, featureId } = req.body as {
|
|
projectPath: string;
|
|
featureId: string;
|
|
};
|
|
|
|
if (!projectPath || !featureId) {
|
|
res.status(400).json({
|
|
success: false,
|
|
error: 'projectPath and featureId are required',
|
|
});
|
|
return;
|
|
}
|
|
|
|
// Use facade if factory is provided, otherwise fall back to autoModeService
|
|
if (facadeFactory) {
|
|
const facade = facadeFactory(projectPath);
|
|
const passes = await facade.verifyFeature(featureId);
|
|
res.json({ success: true, passes });
|
|
return;
|
|
}
|
|
|
|
// Legacy path: use autoModeService directly
|
|
const passes = await autoModeService.verifyFeature(projectPath, featureId);
|
|
res.json({ success: true, passes });
|
|
} catch (error) {
|
|
logError(error, 'Verify feature failed');
|
|
res.status(500).json({ success: false, error: getErrorMessage(error) });
|
|
}
|
|
};
|
|
}
|