Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions validexor.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# VALIDEXOR v0.0.0
# VALIDEXOR v0.1.0
# Deterministic verification utility
# Verifies claims against observable reality. No judgment. No execution.

Expand All @@ -8,7 +8,7 @@ set -eu
# --- Preconditions ---------------------------------------------------------

git rev-parse --is-inside-work-tree >/dev/null 2>&1 || {
printf '%s\n' "VALIDEXOR: not a git repository" >&2
printf '%s\n' "VALIDEXOR: NOT_A_GIT_REPOSITORY" >&2
exit 2
}

Expand All @@ -17,7 +17,7 @@ git rev-parse --is-inside-work-tree >/dev/null 2>&1 || {
INPUT="$(cat)"

[ -z "$INPUT" ] && {
printf '%s\n' "INVALID"
printf '%s\n' "VALIDEXOR: EMPTY_INPUT"
exit 1
}

Expand All @@ -28,7 +28,7 @@ TEXT="$(printf '%s' "$INPUT")"
# No speculation, hedging, or approximation
printf '%s' "$TEXT" | grep -Eiq \
'(^|[^a-z])(maybe|might|could|should|approx|guess|probably|likely|unclear|unknown)([^a-z]|$)' && {
printf '%s\n' "INVALID"
printf '%s\n' "RULE: VERIFICATION.SPECULATION"
exit 1
}

Expand All @@ -37,7 +37,7 @@ printf '%s' "$TEXT" | grep -Eiq \
# Must contain at least one falsifiable anchor
printf '%s' "$TEXT" | grep -Eq \
'([0-9]+|true|false|/[^[:space:]]+|[a-f0-9]{7,40}|==|!=|<=|>=|<|>)' || {
printf '%s\n' "UNVERIFIABLE"
printf '%s\n' "RULE: VERIFICATION.UNVERIFIABLE"
exit 1
}

Expand All @@ -47,7 +47,7 @@ printf '%s' "$TEXT" | grep -Eq \
for h in $(printf '%s' "$TEXT" | grep -Eo '[a-f0-9]{7,40}' | sort -u); do
git cat-file -e "$h^{commit}" 2>/dev/null ||
git cat-file -e "$h^{tree}" 2>/dev/null || {
printf '%s\n' "INVALID"
printf '%s\n' "RULE: VERIFICATION.INVALID_REFERENCE"
exit 1
}
done
Expand Down