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

Function checkpointCommand

scripts/sparc2/src/cli/cli.ts:291–312  ·  view source on GitHub ↗

* Checkpoint command action

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

Source from the content-addressed store, hash-verified

289 * Checkpoint command action
290 */
291async function checkpointCommand(
292 args: Record<string, any>,
293 options: Record<string, any>,
294): Promise<void> {
295 try {
296 // Initialize agent
297 const agent = new SPARC2Agent();
298 await agent.init();
299
300 // Create checkpoint
301 // Sanitize the message to create a valid git tag (no spaces, special characters)
302 const sanitizedMessage = options.message.replace(/[^a-zA-Z0-9_-]/g, "_");
303 const commitHash = await agent.createCheckpoint(sanitizedMessage);
304
305 // Output results
306 console.log(`Checkpoint created: ${commitHash}`);
307 } catch (error: unknown) {
308 const errorMessage = error instanceof Error ? error.message : String(error);
309 console.error(`Error: ${errorMessage}`);
310 Deno.exit(1);
311 }
312}
313
314/**
315 * Rollback command action

Callers

nothing calls this directly

Calls 2

initMethod · 0.95
createCheckpointMethod · 0.95

Tested by

no test coverage detected