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

Function newMemoryHistoryCommand

internal/cli/memory.go:467–510  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

465}
466
467func newMemoryHistoryCommand(deps commandDeps) *cobra.Command {
468 var flags memorySelectorFlags
469 var operation string
470 var sinceRaw string
471 var limit int
472
473 cmd := &cobra.Command{
474 Use: memoryHistoryKey,
475 Short: "Show redaction-safe Memory v2 operation history",
476 Args: cobra.NoArgs,
477 RunE: func(cmd *cobra.Command, _ []string) error {
478 client, err := clientFromDeps(deps)
479 if err != nil {
480 return err
481 }
482 selector, err := resolveMemorySelectorFlags(deps, flags, memorySelectorOptions{})
483 if err != nil {
484 return err
485 }
486 since, err := parseSinceFlag(sinceRaw, deps.now)
487 if err != nil {
488 return err
489 }
490 records, err := client.MemoryHistory(cmd.Context(), MemoryHistoryQuery{
491 Scope: selector.Scope,
492 WorkspaceID: selector.WorkspaceID,
493 AgentName: selector.AgentName,
494 AgentTier: selector.AgentTier,
495 Operation: strings.TrimSpace(operation),
496 Since: since,
497 Limit: limit,
498 })
499 if err != nil {
500 return err
501 }
502 return writeCommandOutput(cmd, memoryHistoryBundle(records, deps.now))
503 },
504 }
505 addMemorySelectorFlags(cmd, &flags)
506 cmd.Flags().StringVar(&operation, memoryOperationKey, "", "Memory operation type, for example memory.write")
507 cmd.Flags().StringVar(&sinceRaw, "since", "", "Show operations since an RFC3339 timestamp or relative duration")
508 cmd.Flags().IntVar(&limit, "limit", 25, "Maximum number of operations to return")
509 return cmd
510}
511
512func newMemoryHealthCommand(deps commandDeps) *cobra.Command {
513 return &cobra.Command{

Callers 1

newMemoryCommandFunction · 0.85

Calls 7

clientFromDepsFunction · 0.85
parseSinceFlagFunction · 0.85
writeCommandOutputFunction · 0.85
memoryHistoryBundleFunction · 0.85
addMemorySelectorFlagsFunction · 0.85
MemoryHistoryMethod · 0.65

Tested by

no test coverage detected