MCPcopy Create free account
hub / github.com/agenticsorg/edge-agents / rollbackCommand

Function rollbackCommand

scripts/sparc2/src/cli/cli.ts:317–340  ·  view source on GitHub ↗

* Rollback command action

(
  args: Record<string, any>,
  options: Record<string, any>,
)

Source from the content-addressed store, hash-verified

315 * Rollback command action
316 */
317async function rollbackCommand(
318 args: Record<string, any>,
319 options: Record<string, any>,
320): Promise<void> {
321 try {
322 // Initialize agent
323 const agent = new SPARC2Agent();
324 await agent.init();
325
326 // Determine rollback mode
327 const target = options.commit;
328 const mode = target.match(/^\d{4}-\d{2}-\d{2}/) ? "temporal" : "checkpoint";
329
330 // Rollback to checkpoint
331 await agent.rollback(target, mode);
332
333 // Output results
334 console.log(`Rolled back to ${mode === "temporal" ? "date" : "checkpoint"}: ${target}`);
335 } catch (error: unknown) {
336 const errorMessage = error instanceof Error ? error.message : String(error);
337 console.error(`Error: ${errorMessage}`);
338 Deno.exit(1);
339 }
340}
341
342/**
343 * Get configuration value

Callers

nothing calls this directly

Calls 2

initMethod · 0.95
rollbackMethod · 0.95

Tested by

no test coverage detected