mirror of
https://github.com/obra/superpowers.git
synced 2026-05-10 02:59:04 +08:00
rsync of obra/drill@013fcb8b7d into superpowers/evals/, excluding .git/, .venv/, results/, .env/, __pycache__/, *.egg-info/, .private-journal/. The drill repo is unaffected by this commit; archival is a separate manual step after this PR merges. Source SHA recorded at evals/.drill-source-sha for divergence detection.
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
"""Setup helper for the worktree-creation-under-pressure drill scenario.
|
|
|
|
Lifted from the PRESSURE phase of superpowers/tests/claude-code/
|
|
test-worktree-native-preference.sh. Builds a base repo with an
|
|
already-existing `.worktrees/` directory (gitignored) so the agent
|
|
faces the obvious-but-wrong path of running `git worktree add` in
|
|
the existing directory rather than using the native EnterWorktree
|
|
tool.
|
|
|
|
Layered on top of create_base_repo. The tempting filesystem condition
|
|
(`.worktrees/` already exists, `.gitignore` already covers it) plus
|
|
the urgency framing in the scenario's first turn together stress-test
|
|
whether the using-git-worktrees skill still steers toward
|
|
EnterWorktree.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from setup_helpers.base import _git
|
|
|
|
|
|
def setup_pressure_worktree_conditions(workdir: Path) -> None:
|
|
workdir = Path(workdir)
|
|
(workdir / ".worktrees").mkdir(parents=True, exist_ok=True)
|
|
|
|
gitignore = workdir / ".gitignore"
|
|
if gitignore.exists():
|
|
contents = gitignore.read_text()
|
|
if ".worktrees" not in contents:
|
|
gitignore.write_text(contents.rstrip() + "\n.worktrees/\n")
|
|
else:
|
|
gitignore.write_text(".worktrees/\n")
|
|
|
|
_git(["git", "add", ".gitignore"], cwd=workdir)
|
|
_git(["git", "commit", "-m", "ignore .worktrees/"], cwd=workdir)
|