feat(setup): show operator automation and backup state in summary
This commit is contained in:
@@ -42,6 +42,8 @@ export interface SetupConfig {
|
||||
gdrive?: { enabled?: boolean };
|
||||
gtasks?: { enabled?: boolean };
|
||||
heartbeat?: { enabled?: boolean };
|
||||
daily_briefing?: { enabled?: boolean };
|
||||
minio_sync?: { enabled?: boolean };
|
||||
} & Record<string, unknown>;
|
||||
backup?: {
|
||||
enabled?: boolean;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { renderSummary } from './summary.js';
|
||||
import type { SetupConfig } from './config.js';
|
||||
|
||||
describe('renderSummary', () => {
|
||||
it('renders operator-pack related automation and backup state', () => {
|
||||
const config = {
|
||||
models: {
|
||||
default: { provider: 'anthropic', model: 'claude-sonnet' },
|
||||
},
|
||||
server: { port: 18800, localhost: true },
|
||||
automation: {
|
||||
heartbeat: { enabled: true },
|
||||
daily_briefing: { enabled: true },
|
||||
minio_sync: { enabled: true },
|
||||
},
|
||||
backup: {
|
||||
enabled: true,
|
||||
schedule: '0 2 * * *',
|
||||
},
|
||||
} as unknown as SetupConfig;
|
||||
|
||||
const output = renderSummary(config);
|
||||
expect(output).toContain('Automation: heartbeat, daily-briefing, minio-sync');
|
||||
expect(output).toContain('Backup: enabled (cron 0 2 * * *)');
|
||||
});
|
||||
});
|
||||
@@ -32,8 +32,20 @@ export function renderSummary(config: SetupConfig): string {
|
||||
if (auto.gdrive?.enabled) {autoFeatures.push('gdrive');}
|
||||
if (auto.gtasks?.enabled) {autoFeatures.push('gtasks');}
|
||||
if (auto.heartbeat?.enabled) {autoFeatures.push('heartbeat');}
|
||||
if (auto.daily_briefing?.enabled) {autoFeatures.push('daily-briefing');}
|
||||
if (auto.minio_sync?.enabled) {autoFeatures.push('minio-sync');}
|
||||
lines.push(` Automation: ${autoFeatures.join(', ') || 'none'}`);
|
||||
|
||||
const backup = config.backup;
|
||||
if (backup?.enabled) {
|
||||
const mode = typeof backup.schedule === 'string' && backup.schedule.trim().length > 0
|
||||
? `cron ${backup.schedule}`
|
||||
: 'interval';
|
||||
lines.push(` Backup: enabled (${mode})`);
|
||||
} else {
|
||||
lines.push(' Backup: disabled');
|
||||
}
|
||||
|
||||
const secFeatures: string[] = [];
|
||||
secFeatures.push(`tools:${config.tools?.profile ?? 'full'}`);
|
||||
if (config.sandbox?.enabled) {secFeatures.push('sandbox');}
|
||||
|
||||
Reference in New Issue
Block a user