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

Function newConfigApplyHistoryCommand

internal/cli/config.go:800–828  ·  view source on GitHub ↗
(deps commandDeps)

Source from the content-addressed store, hash-verified

798}
799
800func newConfigApplyHistoryCommand(deps commandDeps) *cobra.Command {
801 var status string
802 var actor string
803 var limit int
804 cmd := &cobra.Command{
805 Use: "apply-history",
806 Short: "List persisted config apply records",
807 Args: cobra.NoArgs,
808 RunE: func(cmd *cobra.Command, _ []string) error {
809 client, err := clientFromDeps(deps)
810 if err != nil {
811 return fmt.Errorf("cli: create daemon client for config apply-history: %w", err)
812 }
813 history, err := client.ListSettingsApplyRecords(cmd.Context(), SettingsApplyHistoryQuery{
814 Status: status,
815 Actor: actor,
816 Limit: limit,
817 })
818 if err != nil {
819 return fmt.Errorf("cli: list config apply-history: %w", err)
820 }
821 return writeCommandOutput(cmd, configApplyHistoryBundle(history))
822 },
823 }
824 cmd.Flags().StringVar(&status, configStatusKey, "", "Filter by apply status")
825 cmd.Flags().StringVar(&actor, "actor", "", "Filter by apply actor")
826 cmd.Flags().IntVar(&limit, "limit", 50, "Maximum records to return")
827 return cmd
828}
829
830func loadConfigForDisplay(deps commandDeps, workspaceRoot string) (aghconfig.Config, string, error) {
831 workspace, err := resolveOptionalConfigWorkspaceRoot(workspaceRoot)

Callers 1

newConfigCommandFunction · 0.85

Calls 4

clientFromDepsFunction · 0.85
writeCommandOutputFunction · 0.85
configApplyHistoryBundleFunction · 0.85

Tested by

no test coverage detected