Fix pre-existing issues and update README for v2.0
CI / build (push) Has been cancelled

- Fix _infer_state_from_artifacts: SPEC-only maps to research (was bug_find)
- Fix cmd_validate_folder: corrupted .state files now error instead of silent fallback
- Fix upgrade.sh: remove || true, add python3 check, use git rev-parse --git-dir
- Update README.md with --project flag, --can-edit modes, --upgrade, enforcement layers
- Add 6 new tests for inference and validation fixes
- Complete hook-install-process and readme-upgrade-docs tasks
This commit is contained in:
2026-06-15 14:56:33 -04:00
parent 06e47c5503
commit af66f5081d
26 changed files with 511 additions and 27 deletions
+6 -6
View File
@@ -303,10 +303,8 @@ def _infer_state_from_artifacts(task_path: Path) -> Optional[str]:
return "referee"
if "ADVERSARIAL_BUG_REPORT.md" in artifacts and "BUG_REPORT.md" in artifacts:
return "doc_review"
if "BUG_REPORT.md" in artifacts and "SPEC.md" in artifacts:
if "BUG_REPORT.md" in artifacts:
return "adversarial_bug_find"
if "SPEC.md" in artifacts and "BUG_REPORT.md" not in artifacts:
return "bug_find"
if "IMPLEMENTATION.md" in artifacts:
return "bug_find"
if "TEST_PLAN.md" in artifacts:
@@ -562,9 +560,11 @@ def cmd_validate_folder(args):
return 1
phase = _read_state(task_path)
if phase is None:
phase = _infer_state_from_artifacts(task_path)
if phase is None:
phase = "unknown"
print(f"Task: {args.task}")
print(f"Phase: unknown (corrupted .state file)")
print(f"Folder validation: FAIL — .state file exists but is empty or unreadable.")
print(f" Run 'python ~/.automaton/scripts/status.py --upgrade --task {args.task} --project <project-path>' to re-bootstrap .state file.")
return 1
base = _base_phase(phase)
forbidden = _check_forbidden_artifacts(task_path, base)
print(f"Task: {args.task}")
+22 -6
View File
@@ -4,6 +4,13 @@
set -euo pipefail
# Verify python3 is available
if ! command -v python3 &>/dev/null; then
echo "ERROR: python3 is required but not found in PATH."
echo "Install Python 3 and rerun this script."
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
STATUS_SCRIPT="$SCRIPT_DIR/status.py"
@@ -23,8 +30,15 @@ echo ""
# Bootstrap .state files for tasks using status.py --upgrade
if [ -f "$STATUS_SCRIPT" ]; then
echo "Step 1: Bootstrapping .state files for existing tasks..."
python3 "$STATUS_SCRIPT" --upgrade --project "$PROJECT_DIR" || true
if ! python3 "$STATUS_SCRIPT" --upgrade --project "$PROJECT_DIR"; then
echo "ERROR: status.py --upgrade failed. See errors above."
echo "Fix the reported issues and rerun this script."
exit 1
fi
echo ""
else
echo "WARNING: status.py not found at $STATUS_SCRIPT. Skipping .state bootstrap."
echo "Ensure the framework is installed at ~/.automaton/ and rerun."
fi
# Add version marker to config.md if not present
@@ -58,10 +72,12 @@ echo "Run 'python ~/.automaton/scripts/status.py --audit --project $PROJECT_DIR'
echo ""
# Install pre-commit hook if project uses git
GIT_DIR="$PROJECT_DIR/.git"
if [ -d "$GIT_DIR/hooks" ]; then
HOOK_TARGET="$GIT_DIR/hooks/pre-commit"
if git -C "$PROJECT_DIR" rev-parse --git-dir &>/dev/null; then
HOOK_DIR="$(git -C "$PROJECT_DIR" rev-parse --git-dir)/hooks"
HOOK_TARGET="$HOOK_DIR/pre-commit"
HOOK_SOURCE="$FRAMEWORK_DIR/scripts/git-hooks/pre-commit"
# Ensure hooks directory exists
mkdir -p "$HOOK_DIR"
if [ -f "$HOOK_TARGET" ]; then
if [ -L "$HOOK_TARGET" ]; then
EXISTING_TARGET="$(readlink "$HOOK_TARGET")"
@@ -80,6 +96,6 @@ if [ -d "$GIT_DIR/hooks" ]; then
echo "Installed pre-commit hook at $HOOK_TARGET"
fi
else
echo "NOTE: No .git/hooks/ directory found. Install the hook manually if this project uses git:"
echo " ln -sf $FRAMEWORK_DIR/scripts/git-hooks/pre-commit \$PROJECT_DIR/.git/hooks/pre-commit"
echo "NOTE: Not a git repository. Install the hook manually if needed:"
echo " ln -sf $FRAMEWORK_DIR/scripts/git-hooks/pre-commit .git/hooks/pre-commit"
fi