NewHashCommand creates the hash-frontmatter command
()
| 14 | |
| 15 | // NewHashCommand creates the hash-frontmatter command |
| 16 | func 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 | |
| 22 | The 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 | |
| 28 | The 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 |
| 42 | func RunHashFrontmatter(workflowPath string) error { |
no test coverage detected