MCPcopy Create free account
hub / github.com/github/gh-aw / NewHashCommand

Function NewHashCommand

pkg/cli/hash_command.go:16–39  ·  view source on GitHub ↗

NewHashCommand creates the hash-frontmatter command

()

Source from the content-addressed store, hash-verified

14
15// NewHashCommand creates the hash-frontmatter command
16func NewHashCommand() *cobra.Command {
17 cmd := &cobra.Command{
18 Use: "hash-frontmatter <workflow>",
19 Short: "Compute the frontmatter hash for a workflow",
20 Long: `Compute a deterministic SHA-256 hash of workflow frontmatter.
21
22The hash includes:
23- All frontmatter fields from the main workflow
24- Frontmatter from all imported workflows (BFS traversal)
25- Template expressions containing env. or vars. from the markdown body
26- Version information (gh-aw, awf, agents)
27
28The hash can be used to detect configuration changes between compilation and execution.`,
29 Example: ` gh aw hash-frontmatter my-workflow.md
30 gh aw hash-frontmatter .github/workflows/audit-workflows.md`,
31 Args: cobra.ExactArgs(1),
32 RunE: func(cmd *cobra.Command, args []string) error {
33 workflowPath := args[0]
34 return RunHashFrontmatter(workflowPath)
35 },
36 }
37
38 return cmd
39}
40
41// RunHashFrontmatter computes and prints the frontmatter hash for a workflow
42func RunHashFrontmatter(workflowPath string) error {

Callers 1

initFunction · 0.92

Calls 1

RunHashFrontmatterFunction · 0.85

Tested by

no test coverage detected