feat(workflow): add scheduled resume-and-report runner
This commit is contained in:
parent
0510009597
commit
61846b5d2a
|
|
@ -10,7 +10,8 @@
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"migrate": "ts-node-esm src/backend/db/migrate.ts",
|
"migrate": "ts-node-esm src/backend/db/migrate.ts",
|
||||||
"workflow:run": "ts-node scripts/run-workflow.ts"
|
"workflow:run": "ts-node scripts/run-workflow.ts",
|
||||||
|
"workflow:schedule": "ts-node scripts/schedule-workflow.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { WorkflowStatusManager } from '../src/backend/services/WorkflowStatusManager';
|
import { WorkflowStatusManager } from '../src/backend/services/WorkflowStatusManager.ts';
|
||||||
import { getPendingPhaseUpdates } from '../src/backend/services/PhaseUpdateQueue';
|
import { getPendingPhaseUpdates } from '../src/backend/services/PhaseUpdateQueue.ts';
|
||||||
import { exec as execCb } from 'child_process';
|
import { exec as execCb } from 'child_process';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env ts-node
|
||||||
|
import { runWorkflow } from './run-workflow.ts';
|
||||||
|
import { generateMorningReport } from './morning-report.ts';
|
||||||
|
|
||||||
|
export async function runScheduledWorkflow(): Promise<void> {
|
||||||
|
await runWorkflow({ mode: 'resume' });
|
||||||
|
await generateMorningReport();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (import.meta.url === `file://${process.argv[1]}`) {
|
||||||
|
runScheduledWorkflow().catch((error) => {
|
||||||
|
const message = error instanceof Error ? error.message : String(error);
|
||||||
|
console.error(`[workflow:schedule] failed: ${message}`);
|
||||||
|
process.exitCode = 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue