init: seed framework reference content from agent-runtimes main repo

This commit is contained in:
Paul O'Reilly
2026-04-26 12:17:42 +12:00
commit 37a5165dfb
118 changed files with 6831 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
kind: capability
name: tdd-file-lock
version: 1
description: "Locks /workspace/tests/ read-only (root-owned). Agent cannot modify test files."
requires: []
scripts:
init: "./init.sh"

View File

@@ -0,0 +1,34 @@
#!/bin/bash
# TDD file lock — runs as root before agent user takes over.
# Creates a root-owned immutable reference copy of tests/ and locks the
# working copy so the agent cannot write to any test file.
set -euo pipefail
if [ ! -d "/workspace/tests" ]; then
echo "[tdd-file-lock] No /workspace/tests found — nothing to protect."
exit 0
fi
echo "[tdd-file-lock] Locking test files (running as $(id))..."
# Root-owned reference copy — agent cannot chmod/write/delete these
mkdir -p /workspace/reference/tests
cp -r /workspace/tests/. /workspace/reference/tests/
chown -R root:root /workspace/reference/tests
find /workspace/reference/tests -type f -exec chmod 444 {} \;
find /workspace/reference/tests -type d -exec chmod 555 {} \;
# SHA256 checksums for post-task external verification
find /workspace/tests -name "*.py" | sort | xargs sha256sum > /workspace/.test-shas
chown root:root /workspace/.test-shas
chmod 444 /workspace/.test-shas
# Lock the working tests/ directory — files and dirs owned by root, no write for anyone
chown -R root:root /workspace/tests
find /workspace/tests -type f -exec chmod 444 {} \;
find /workspace/tests -type d -exec chmod 555 {} \;
TEST_COUNT=$(find /workspace/tests -name "*.py" | wc -l)
echo "[tdd-file-lock] Protected ${TEST_COUNT} test files."
echo "[tdd-file-lock] Immutable reference: /workspace/reference/tests/"
echo "[tdd-file-lock] SHA256 reference: /workspace/.test-shas"