MCPcopy Create free account
hub / github.com/compozy/agh / newSessionRepairCommand

Function newSessionRepairCommand

internal/cli/session.go:367–401  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

365}
366
367func newSessionRepairCommand(deps commandDeps) *cobra.Command {
368 var (
369 dryRun bool
370 force bool
371 )
372
373 cmd := &cobra.Command{
374 Use: "repair <id>",
375 Short: "Inspect and repair an interrupted session transcript",
376 Example: ` # Report the repair actions without writing new events
377 agh session repair sess_1234 --dry-run
378
379 # Force repair for a stopped session whose stop reason is not crash or error
380 agh session repair sess_1234 --force`,
381 Args: exactOneNonBlankArg(),
382 RunE: func(cmd *cobra.Command, args []string) error {
383 client, err := clientFromDeps(deps)
384 if err != nil {
385 return err
386 }
387
388 result, err := client.RepairSession(cmd.Context(), args[0], SessionRepairQuery{
389 DryRun: dryRun,
390 Force: force,
391 })
392 if err != nil {
393 return err
394 }
395 return writeCommandOutput(cmd, sessionRepairBundle(result))
396 },
397 }
398 cmd.Flags().BoolVar(&dryRun, "dry-run", false, "Report planned repairs without persisting events")
399 cmd.Flags().BoolVar(&force, "force", false, "Allow repair for stopped non-crash sessions")
400 return cmd
401}
402
403func newSessionApproveCommand(deps commandDeps) *cobra.Command {
404 var request SessionApprovalRequest

Callers 1

newSessionCommandFunction · 0.85

Calls 5

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
sessionRepairBundleFunction · 0.85
RepairSessionMethod · 0.65

Tested by

no test coverage detected