Preflight batch output destinations

This commit is contained in:
2026-08-01 21:51:42 +00:00
parent 28bdc04fba
commit bf1746a756
4 changed files with 64 additions and 11 deletions

View File

@@ -334,20 +334,19 @@ func RunBatchDetailed(ctx context.Context, req BatchRequest) (*BatchResult, erro
if err != nil {
return nil, err
}
if err := prepareBatchOutputs(req.OutputDir, plannedReports); err != nil {
return nil, err
}
if req.Batch == BatchEvening || req.Batch == BatchMorning {
startedAt := now
result := &BatchResult{Batch: req.Batch, StartedAt: startedAt}
for _, planned := range plannedReports {
resolved := planned.Resolved
item := batchReportResult(planned)
outputPath, err := plannedBatchOutputPath(req.OutputDir, planned)
if err != nil {
return nil, err
}
reportResult, err := generatePromptReport(ctx, promptReportRequest{
GenerateRequest: GenerateRequest{
Config: req.Config,
OutputPath: outputPath,
OutputPath: planned.OutputPath,
Notifier: req.Notifier,
Executor: req.Executor,
},
@@ -451,6 +450,17 @@ func plannedBatchOutputPath(outputDir string, planned plannedBatchReport) (strin
return validateOutputPath(filepath.Join(outputDir, outputName))
}
func prepareBatchOutputs(outputDir string, plannedReports []plannedBatchReport) error {
for index := range plannedReports {
outputPath, err := plannedBatchOutputPath(outputDir, plannedReports[index])
if err != nil {
return err
}
plannedReports[index].OutputPath = outputPath
}
return nil
}
func resolveReportOutputPath(workingDir, override string, resolved report.Resolved) (string, error) {
outputName, err := resolved.OutputName()
if err != nil {