feat(cli): autoforge loop --mode goals --backend {auto,claude,codex} (#32 / #30 PR2)#35
Open
k-buchi4696 wants to merge 1 commit into
Open
Conversation
…32 / #30 PR2) issue #30 の PR2 (CLI integration + PATH auto-detection) を実装。 autoforge/harness/agent_loop.py: - shutil import 追加 - detect_backend() -> Backend | None: shutil.which で claude → codex の順に PATH を探索し、最初に見つかったものを返す。両方なければ None autoforge/cli.py: - loop_parser に --mode {pipeline,goals} (default: pipeline) を追加 - loop_parser に --backend {auto,claude,codex} (default: auto) を追加 - _run_loop の冒頭で args.mode を見て分岐: - pipeline (既存): API モード SDLC pipeline (ANTHROPIC_API_KEY 必須) - goals: 新設 _run_loop_goals stub - _run_loop_goals: backend を解決 (auto は detect_backend、明示指定なら そのまま) して resolved を表示。実際の goals 実行は PR3 (#33) で実装 tests/harness/test_agent_loop.py: - TestDetectBackend 4 件追加 - claude のみ PATH にある → Backend.CLAUDE - codex のみ PATH にある → Backend.CODEX - 両方ある → Backend.CLAUDE (claude を優先) - 両方ない → None tests/test_cli.py: - TestLoopModeBackend 5 件追加 - --mode default が pipeline、--backend default が auto - --mode goals --backend codex で stub にディスパッチし backend=codex 表示 - --mode goals --backend auto で claude を検出 - --mode goals --backend auto で何も無い時 stderr に分かりやすいエラー & exit 1 - --mode bogus は argparse が拒否 566 tests pass (既存 557 + 新規 9). pipeline モード回帰なし。 スコープ外(後続 PR): - goals 実行ロジック (autoforge.yml 連携) → PR3 (#33) - ドキュメント → PR4 (#34) Refs #30, #32 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
issue #30 を 4 PR で実装する内、PR2 (CLI integration + PATH auto-detection) に相当(sub-issue #32)。
`autoforge loop` サブコマンドに `--mode {pipeline,goals}` と `--backend {auto,claude,codex}` を追加。`auto` は PATH から `claude` → `codex` の順に検出。`--mode goals` の実行ロジックは PR3 で実装し、本 PR では backend resolution まで配線して stub にする。
変更内容
`autoforge/harness/agent_loop.py` (+18 行)
`autoforge/cli.py` (+44 行)
`tests/harness/test_agent_loop.py` (+30 行)
TestDetectBackend (4 件):
`tests/test_cli.py` (+59 行)
TestLoopModeBackend (5 件):
Test Plan
スコープ外(後続 PR)
Refs
loop --mode goals --backend {auto,claude,codex}を新規実装 #30🤖 Generated with Claude Code