Reframe sweep M7-27 + capstone (AI drives git, lesson=theory, de-slop) (#93)
Sync course wiki / sync-wiki (push) Successful in 11s
Sync course wiki / sync-wiki (push) Successful in 11s
Co-authored-by: claude <claude@jpaul.io> Co-committed-by: claude <claude@jpaul.io>
This commit was merged in pull request #93.
This commit is contained in:
@@ -161,6 +161,18 @@ def in_git_repo() -> bool:
|
||||
capture_output=True).returncode == 0
|
||||
|
||||
|
||||
def ensure_branch(name: str) -> None:
|
||||
"""Create and switch to the agent's working branch. The orchestrator owns this git step the same
|
||||
way agent-job.yml's runner does (`git switch -c`) — you direct the automation and then verify the
|
||||
branch (`git branch`), instead of typing `git checkout` by hand. No-op outside a Git repo."""
|
||||
if not in_git_repo():
|
||||
return
|
||||
exists = subprocess.run(["git", "rev-parse", "--verify", "--quiet", name],
|
||||
capture_output=True).returncode == 0
|
||||
subprocess.run(["git", "switch", name] if exists else ["git", "switch", "-c", name])
|
||||
print(f"[git] working on branch {name} (the orchestrator created/switched it for you).")
|
||||
|
||||
|
||||
def propose_pr(message: str) -> None:
|
||||
print("\n" + "=" * 80)
|
||||
print("GATE PASSED. Proposing a PR — NOT merging. A human reviews the diff (Module 10).")
|
||||
@@ -202,6 +214,7 @@ def reject(reason: str, gate_output: str, *, simulated: bool = False) -> None:
|
||||
# --------------------------------------------------------------------------------------------------
|
||||
def cmd_issue_to_pr(issue_path: Path, simulate: str | None) -> int:
|
||||
print(f"[issue-to-pr] brief: {issue_path}")
|
||||
ensure_branch(f"agent/{issue_path.stem}")
|
||||
if simulate:
|
||||
print(f"[issue-to-pr] simulating a '{simulate}' agent on the self-contained demo target.")
|
||||
simulate_implement(simulate)
|
||||
@@ -218,6 +231,7 @@ def cmd_issue_to_pr(issue_path: Path, simulate: str | None) -> int:
|
||||
|
||||
|
||||
def cmd_self_heal(simulate: str | None) -> int:
|
||||
ensure_branch("agent/self-heal")
|
||||
# Establish a failing state to heal. In a real pipeline this is "CI just went red on a push".
|
||||
if simulate:
|
||||
print(f"[self-heal] simulating a red build ('{simulate}') on the demo target.")
|
||||
|
||||
Reference in New Issue
Block a user