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

Function newAgentSoulRollbackCommand

internal/cli/authored_context.go:276–322  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

274}
275
276func newAgentSoulRollbackCommand(deps commandDeps) *cobra.Command {
277 var (
278 revisionID string
279 expectedDigest string
280 idempotencyKey string
281 )
282 cmd := &cobra.Command{
283 Use: "rollback <agent>",
284 Short: "Rollback SOUL.md to a managed revision",
285 Example: " agh agent soul rollback coder --revision-id rev_123 --expected-digest sha256:old --json",
286 Args: exactOneNonBlankArg(),
287 RunE: func(cmd *cobra.Command, args []string) error {
288 client, err := clientFromDeps(deps)
289 if err != nil {
290 return err
291 }
292 workspace, err := commandWorkspaceFlag(cmd)
293 if err != nil {
294 return err
295 }
296 revision, err := changedNonEmptyStringFlag(cmd, "revision-id", revisionID)
297 if err != nil {
298 return err
299 }
300 digest, err := changedStringFlag(cmd, "expected-digest", expectedDigest)
301 if err != nil {
302 return err
303 }
304 record, err := client.RollbackAgentSoul(cmd.Context(), args[0], AgentSoulRollbackRequest{
305 WorkspaceID: workspace,
306 AgentName: args[0],
307 RevisionID: revision,
308 ExpectedDigest: digest,
309 IdempotencyKey: strings.TrimSpace(idempotencyKey),
310 })
311 if err != nil {
312 return err
313 }
314 return writeCommandOutput(cmd, agentSoulMutationBundle(&record))
315 },
316 }
317 addWorkspaceFlag(cmd)
318 cmd.Flags().StringVar(&revisionID, "revision-id", "", "Managed Soul revision id to restore")
319 cmd.Flags().StringVar(&expectedDigest, "expected-digest", "", "Expected current Soul digest for CAS")
320 cmd.Flags().StringVar(&idempotencyKey, "idempotency-key", "", "Optional idempotency key")
321 return cmd
322}
323
324func newAgentHeartbeatCommand(deps commandDeps) *cobra.Command {
325 cmd := &cobra.Command{

Callers 1

newAgentSoulCommandFunction · 0.85

Calls 9

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
commandWorkspaceFlagFunction · 0.85
changedStringFlagFunction · 0.85
writeCommandOutputFunction · 0.85
agentSoulMutationBundleFunction · 0.85
addWorkspaceFlagFunction · 0.85
RollbackAgentSoulMethod · 0.65

Tested by

no test coverage detected