2026-09-30 02:19:52 +00:00
|
|
|
package promptdef
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"crypto/sha256"
|
|
|
|
|
"encoding/hex"
|
|
|
|
|
"encoding/json"
|
|
|
|
|
|
2026-11-02 14:38:00 +00:00
|
|
|
"go.maximumdirect.net/promptkit/internal/domain"
|
2026-09-30 02:19:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// HashDefinition hashes an execution-ready prompt, including captured content.
|
|
|
|
|
func HashDefinition(definition *domain.PromptDefinition) (string, error) {
|
|
|
|
|
bytes, err := json.Marshal(definition)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return "", err
|
|
|
|
|
}
|
|
|
|
|
sum := sha256.Sum256(bytes)
|
|
|
|
|
return hex.EncodeToString(sum[:]), nil
|
|
|
|
|
}
|