require('../config/loadEnv')();

const persistentStore = require('../services/persistentStore');
const mongoObservation = require('../services/mongoLedgerObservationAdapter');

async function main() {
  const state = persistentStore.readState();
  const result = await mongoObservation.syncState(state, { reason: 'manual-cli-sync' });
  console.log(JSON.stringify(result, null, 2));
}

main().catch((err) => {
  console.error(JSON.stringify({ ok: false, error: err.message }, null, 2));
  process.exitCode = 1;
});
