const fs = require('fs'); let view = fs.readFileSync('frontend/src/pages/cases/cases-view.tsx', 'utf8'); if (!view.includes('updateCase')) { view = view.replace("import { fetch as fetchCase } from '../../stores/cases/casesSlice';", "import { fetch as fetchCase, update as updateCase } from '../../stores/cases/casesSlice';"); } const commandArea = ` {activeTab === 'overview' && (

Command Actions

{ const reason = prompt("Enter reason (optional)"); dispatch(updateCase({ id, data: { status: 'won', reopenReason: reason }})).then(() => dispatch(fetchCase({id}))); }} /> { const reason = prompt("Enter reason (optional)"); dispatch(updateCase({ id, data: { status: 'lost', reopenReason: reason }})).then(() => dispatch(fetchCase({id}))); }} />
) `; if (!view.includes('Command Actions')) { view = view.replace('{activeTab === \'overview\' && (', commandArea + '\n {activeTab === \'overview\' && ('); } fs.writeFileSync('frontend/src/pages/cases/cases-view.tsx', view);