feat: expand --focus to accept issue refs (closes #202)#213
Merged
Conversation
Adds the ability to point the factory at a GitHub or GitLab issue directly, fetching the issue content and using it as the build spec. - New module factory/issue.py with IssueSpec dataclass, parse_issue_ref, infer_remote, fetch_issue, and format_issue_as_spec - --issue flag on both ceo and run subparsers - Mutual exclusion with --prompt, --focus, --no-github, --mode interactive/research - Issue spec persisted to .factory/strategy/current.md (same as --prompt) - Issue number/URL passed through to _build_ceo_task for CEO directive - 25 tests covering parsing, remote inference, formatting, fetching, and CLI validation Closes #209 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes ordering bug in cmd_run where --issue validation happened after the network call to fetch the issue. Also moves --no-github check in cmd_ceo to early validation block. Adds missing cmd_run mutual exclusion tests (4 new tests). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Instead of a separate --issue flag with its own mutual exclusion matrix, --focus now auto-detects issue references (bare numbers, URLs, owner/repo#N) and fetches them via gh/glab CLI. This eliminates duplicated validation code between cmd_ceo and cmd_run and simplifies the CLI surface. Changes: - factory/issue.py: add is_issue_ref() detector, fix GitLab nested groups regex - factory/cli.py: add _resolve_focus_issue() helper, remove --issue from both subparsers, wire focus resolution into cmd_ceo and cmd_run - CLAUDE.md: document --focus accepting issue refs - tests/test_issue.py: add is_issue_ref tests, nested GitLab groups test, _resolve_focus_issue integration tests, remove obsolete --issue CLI tests Closes #211, closes #212 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #213 +/- ##
==========================================
+ Coverage 87.01% 87.20% +0.19%
==========================================
Files 51 52 +1
Lines 7300 7440 +140
==========================================
+ Hits 6352 6488 +136
- Misses 948 952 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- _resolve_focus_issue no longer calls sys.exit() — callers check no_github before calling, consistent with all other CLI error paths - Returns 4-tuple (title, context, number, url) so callers can update the focus name to "Title (issue #N)" for better backlog/CEO context - Fix indentation on split kwargs in cmd_run Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove redundant GitLab /-/issues/ pattern in is_issue_ref — already caught by the general /issues/ pattern above it - Add test for unparseable git remote URL (file:// protocol) - Add tests for _build_ceo_task issue embedding (with/without URL) - Add test for cmd_run --focus + --no-github error path - factory/issue.py now at 100% coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced May 11, 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
Reworks the approach to issue targeting (originally PR #210). Instead of adding a separate
--issueflag, expands--focusto auto-detect issue references:--focusdoes the right thing based on input shape_resolve_focus_issue()helper replaces copy-pasted blocks incmd_ceoandcmd_run--issue-specific checks (5+ per command) collapse into existing--focusexclusionsparse_issue_refregex to handlegroup/subgroup/project/-/issues/NFiles changed
factory/issue.py— addis_issue_ref()detector, fix GitLab nested groups regexfactory/cli.py— add_resolve_focus_issue(), remove--issuefrom both subparsers, wire intocmd_ceo/cmd_runCLAUDE.md— document--focusaccepting issue refstests/test_issue.py— 34 tests:is_issue_ref, nested groups,_resolve_focus_issueintegration, all parsing/fetching/formattingAddresses all PR #210 review findings
--focusinstead of--issue(issue Rework: expand --focus to handle issue refs instead of separate --issue flag #211)--mode researchmutual exclusion — gone (no separate flag to check)contextis always set correctly nowTest plan
pytest tests/test_issue.py -v)ruff check)mypy factory/issue.py factory/cli.py)pytest tests/test_models.py tests/test_guards.py tests/test_cli.py)Closes #202, closes #211, closes #212
🤖 Generated with Claude Code