governance: keep repository root clean; remove marker file; implement repo detection via structure heuristic; update tests and system prompts/templates
This commit is contained in:
23
tests/00_cli_guardrails.sh
Normal file
23
tests/00_cli_guardrails.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
. "$ROOT_DIR/tests/helpers/assert.sh"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
# 1) Help prints usage and exits 0
|
||||
out="$(bash ./CodexHelper --help 2>&1 || true)"
|
||||
echo "$out" | grep -q "CodexHelper" || { echo "help text missing" >&2; exit 1; }
|
||||
|
||||
# 2) Guardrails: inside helper repo, run/new-project should be blocked
|
||||
if bash ./CodexHelper run 2>run.err 1>run.out; then
|
||||
echo "run should fail in helper repo" >&2; exit 1
|
||||
fi
|
||||
grep -q "Only 'new-mode'" run.err || { echo "missing guardrail message for run" >&2; exit 1; }
|
||||
|
||||
if bash ./CodexHelper new-project --mode Demo --name demo --path /tmp 2>np.err 1>np.out; then
|
||||
echo "new-project should fail in helper repo" >&2; exit 1
|
||||
fi
|
||||
grep -q "Only 'new-mode'" np.err || { echo "missing guardrail message for new-project" >&2; exit 1; }
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user