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

Function newAgentHeartbeatValidateCommand

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

Source from the content-addressed store, hash-verified

364}
365
366func newAgentHeartbeatValidateCommand(deps commandDeps) *cobra.Command {
367 var input authoredBodyInput
368 cmd := &cobra.Command{
369 Use: "validate <agent>",
370 Short: "Validate a proposed Heartbeat policy body",
371 Example: " agh agent heartbeat validate coder --file HEARTBEAT.md --workspace checkout-api --json",
372 Args: exactOneNonBlankArg(),
373 RunE: func(cmd *cobra.Command, args []string) error {
374 client, err := clientFromDeps(deps)
375 if err != nil {
376 return err
377 }
378 workspace, err := commandWorkspaceFlag(cmd)
379 if err != nil {
380 return err
381 }
382 body, err := readAuthoredBody(cmd, input, true)
383 if err != nil {
384 return err
385 }
386 record, err := client.ValidateAgentHeartbeat(cmd.Context(), args[0], AgentHeartbeatValidateRequest{
387 WorkspaceID: workspace,
388 AgentName: args[0],
389 Body: body,
390 })
391 if err != nil {
392 return err
393 }
394 return writeCommandOutput(cmd, agentHeartbeatBundle(&record))
395 },
396 }
397 addWorkspaceFlag(cmd)
398 addAuthoredBodyFlags(cmd, &input)
399 return cmd
400}
401
402func newAgentHeartbeatWriteCommand(deps commandDeps) *cobra.Command {
403 var (

Callers 1

newAgentHeartbeatCommandFunction · 0.85

Calls 9

exactOneNonBlankArgFunction · 0.85
clientFromDepsFunction · 0.85
commandWorkspaceFlagFunction · 0.85
readAuthoredBodyFunction · 0.85
writeCommandOutputFunction · 0.85
agentHeartbeatBundleFunction · 0.85
addWorkspaceFlagFunction · 0.85
addAuthoredBodyFlagsFunction · 0.85

Tested by

no test coverage detected