Write native agent rules during setup

This commit is contained in:
2026-06-01 17:27:45 +00:00
parent b1c585a34c
commit eb5af7c62c
3 changed files with 32 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# tests/test_fixes.sh unit tests for code-review fixes in ai-setup.sh
# tests/test_fixes.sh - unit tests for code-review fixes in ai-setup.sh
# Run: bash tests/test_fixes.sh
set -euo pipefail
@@ -89,14 +89,18 @@ test_global_rules_include_quality_guidelines() {
}
test_native_rule_files_generated() {
if echo "$HELPERS_SECTION" | grep -q 'echo "$global_rendered" > "$HOME/.codex/AGENTS.md"' \
if grep -q 'cp "$CONFIG_DIR/global_rules.md" "$HOME/.codex/AGENTS.md"' "$SCRIPT" \
&& grep -q 'cp "$CONFIG_DIR/global_rules.md" "$HOME/.kimi-code/AGENTS.md"' "$SCRIPT" \
&& grep -q 'cp "$CONFIG_DIR/global_rules.md" "$HOME/.claude/CLAUDE.md"' "$SCRIPT" \
&& grep -q 'cp "$CONFIG_DIR/global_rules.md" "$HOME/.gemini/GEMINI.md"' "$SCRIPT" \
&& echo "$HELPERS_SECTION" | grep -q 'echo "$global_rendered" > "$HOME/.codex/AGENTS.md"' \
&& echo "$HELPERS_SECTION" | grep -q 'echo "$global_rendered" > "$HOME/.kimi-code/AGENTS.md"' \
&& echo "$HELPERS_SECTION" | grep -q 'echo "$global_rendered" > "$HOME/.claude/CLAUDE.md"' \
&& echo "$HELPERS_SECTION" | grep -q 'echo "$global_rendered" > "$HOME/.gemini/GEMINI.md"' \
&& ! echo "$HELPERS_SECTION" | grep -q 'echo "$rendered" >'; then
ok "global rules: native rule files contain only global_rules.md"
ok "global rules: setup and launchers write native rule files from global_rules.md"
else
fail "global rules: native rule files must not include project prompt render"
fail "global rules: setup and launchers must write native rule files from global_rules.md"
fi
}