preprocessProtectedFilesField preprocesses the "protected-files" field in configData, handling both the legacy string-enum form and the new object form. String form (unchanged): "blocked", "allowed", or "fallback-to-issue". Object form: { policy: "blocked", exclude: ["AGENTS.md"] } - policy is opti
(configData map[string]any, debugLog *logger.Logger)
| 137 | // When the string form is encountered the field is left unchanged and nil is returned. |
| 138 | // The debugLog parameter is optional; pass nil to suppress debug output. |
| 139 | func preprocessProtectedFilesField(configData map[string]any, debugLog *logger.Logger) []string { |
| 140 | if configData == nil { |
| 141 | return nil |
| 142 | } |
| 143 | raw, exists := configData["protected-files"] |
| 144 | if !exists || raw == nil { |
| 145 | return nil |
| 146 | } |
| 147 | pfMap, ok := raw.(map[string]any) |
| 148 | if !ok { |
| 149 | return nil |
| 150 | } |
| 151 | if policy, ok := pfMap["policy"].(string); ok && policy != "" { |
| 152 | configData["protected-files"] = policy |
| 153 | if debugLog != nil { |
| 154 | debugLog.Printf("protected-files object form: policy=%s", policy) |
| 155 | } |
| 156 | } else { |
| 157 | delete(configData, "protected-files") |
| 158 | if debugLog != nil { |
| 159 | debugLog.Print("protected-files object form: no policy, using default") |
| 160 | } |
| 161 | } |
| 162 | return parseStringSliceAny(pfMap["exclude"], debugLog) |
| 163 | } |
| 164 | |
| 165 | // preprocessExpiresField handles the common expires field preprocessing pattern. |
| 166 | // This function: |