Bundle: issue-plan next-step and auto-assignment improvements
Summary
Bundle two small, co-located changes to commands/issue-plan.md into a single PR.
Included Issues
- #51 — issue-plan should recommend issue-plan-review as the next step
- #70 — Auto-assign user to issues and sub-issues without prompting
Rationale
Both issues modify commands/issue-plan.md in non-overlapping sections (next-step text and assignment logic). Bundling avoids two separate PRs for the same file with minimal conflict risk.
Acceptance Criteria
- All acceptance criteria from #51 are met
- All acceptance criteria from #70 are met
- Single PR covers both changes
Independent Assessment
Current state: PR #69 (v1.6.0) already implemented the auto-assignment without prompting for unassigned issues in both issue-plan and issue-implement. The next-step wording in issue-plan was partially updated by PR #58 but still frames plan review as optional rather than recommended.
Remaining work:
-
Next-step wording (from issue 51): Single-line edit on line 180 of
commands/issue-plan.md. Change the "optionally" framing to makeissue-plan-reviewthe recommended next step, withissue-implementas the step after review. -
Sub-issue assignment (from issue 70): Neither
issue-plannorissue-implementcurrently assigns sub-issues. The sub-issue detection pattern frompr-create.md(API call with body-parse fallback) can be reused. Adds ~10-15 lines to each command file. -
CLAUDE.md sync note: The "Issue auto-assignment sync" note needs updating to reflect sub-issue assignment behavior.
Open questions:
- Should the sub-issue detection use the same two-strategy approach (API + body-parse fallback) as
pr-create.md? - Should
issue-implementalso assign sub-issues, or onlyissue-plan?
Scope: Small -- two command files and one sync note. Single PR as proposed.
Decisions from assessment session:
-
Sub-issue detection method: Use the two-strategy approach (API call with body-parse fallback), matching the existing pattern in
pr-create.md. -
Sub-issue assignment scope: Both
issue-planandissue-implementwill assign sub-issues, keeping behavior consistent regardless of entry point.
Independent Assessment
Summary: This bundle combines two small changes to issue-plan.md (with sync obligations to issue-implement.md and CLAUDE.md): making issue-plan-review the recommended next step (issue 51), and auto-assigning sub-issues to the current user (issue 70).
Current state: PR 69 (commit 25a1d6a) fully implemented parent-issue auto-assignment without prompting in both issue-plan.md and issue-implement.md. The next-step wording on line 180 of issue-plan.md still frames issue-plan-review as optional rather than recommended. Sub-issue assignment does not exist anywhere -- the only sub-issue detection code is in pr-create.md (lines 70-82), used for generating Fixes closing keywords.
Remaining work:
-
Next-step wording (issue 51): Single-line edit on line 180 of
commands/issue-plan.md. Change the "optionally" framing to makeissue-plan-reviewthe recommended next step, withissue-implementas the step after review. -
Sub-issue assignment (issue 70): Add sub-issue detection (adapting the two-strategy API+body-parse pattern from
pr-create.mdlines 70-82) and an assignment loop to bothissue-plan.md(Step 7, after sub-step 3) andissue-implement.md(Step 2, after the existing assignment block). Each sub-issue follows the same three-path logic: skip if current user already assigned, auto-assign if no assignees, prompt withAskUserQuestionif other assignees exist. Assignment failures are non-blocking (warn and continue). Estimated ~15-20 new lines per command file. -
CLAUDE.md sync note: Update the "Issue auto-assignment sync" note (line 66) to cover the sub-issue detection and assignment behavior across both commands.
Scope: Small -- single-stage implementation. Two command files and one sync note, with the sub-issue detection block adapted nearly verbatim from existing code.
Implementation Plan
Overview
Bundle two changes to commands/issue-plan.md (with sync obligations to issue-implement.md and CLAUDE.md):
- Make
issue-plan-reviewthe recommended next step (issue 51) - Add sub-issue auto-assignment to both
issue-planandissue-implement(issue 70)
Stage 1: Next-step wording and sub-issue auto-assignment
Files to modify
-
commands/issue-plan.md-- two edits:- Next-step wording (line 180): Change the "optionally" framing to make
/mach10:issue-plan-reviewthe recommended next step, with/mach10:issue-implementmentioned as the step after review. - Sub-issue assignment (after Step 7 sub-step 3): Add a sub-issue detection and assignment block after the parent assignment logic.
- Next-step wording (line 180): Change the "optionally" framing to make
-
commands/issue-implement.md-- one edit:- Sub-issue assignment (after Step 2 "Assign the issue" block, line 91): Add identical sub-issue detection and assignment block.
-
CLAUDE.md-- one edit:- Sync note (line 66): Update the "Issue auto-assignment sync" note to cover sub-issue detection and assignment behavior across both commands.
Sub-issue assignment logic (identical in both commands)
The sub-issue block is added immediately after the parent assignment logic:
-
Detect sub-issues using the two-strategy approach from
pr-create.md(lines 70-82):- Strategy A (API): Query
gh api repos/$REPO/issues/<issue-number>/sub_issues --jq ".[].number". If it succeeds with results, use them. If it succeeds with empty results, treat as no sub-issues (do NOT fall through). If it fails, proceed to Strategy B. - Strategy B (body-parse fallback): Scan the issue body for task-list
#<number>references, excluding relational keywords. Only runs when Strategy A fails.
- Strategy A (API): Query
-
If sub-issues found, get current user login once via
gh api user --jq .login. -
For each sub-issue, check assignees via
gh issue view <sub-issue> --json assignees. Three paths:- Current user already assigned: skip silently
- No assignees: auto-assign with
gh issue edit <sub-issue> --add-assignee @me - Other assignees exist: collect into a "conflicting" list
-
If conflicting list is non-empty, present a single
AskUserQuestionwith bulk options:- Add me: "Add yourself as an additional assignee on all conflicting sub-issues" -- run
gh issue editfor each - Skip: "Leave the current assignee(s) unchanged on all sub-issues" -- no-op
- Replace: "Remove existing assignee(s) and assign only yourself on all sub-issues" -- run
gh issue editfor each
- Add me: "Add yourself as an additional assignee on all conflicting sub-issues" -- run
-
Assignment failures are non-blocking (warn and continue).
Testing
No testable runtime code (plugin command definitions only). Testing is not applicable.
Decision Log
Sub-issue prompt UX
Q: Should sub-issues with conflicting assignees prompt individually or use a bulk decision? A: Bulk decision -- ask once and apply the same choice to all conflicting sub-issues.
Architecture choice
Single viable approach: adapt the existing sub-issue detection pattern from pr-create.md and add it to both command files. No meaningful alternatives existed given the small scope and clear existing patterns.
This plan will guide staged implementation via /mach10:issue-implement.
Implementation Plan
Overview
Bundle two changes to commands/issue-plan.md (with sync obligations to issue-implement.md and CLAUDE.md):
- Make
issue-plan-reviewthe recommended next step (issue #51) - Add sub-issue auto-assignment to both
issue-planandissue-implement(issue #70)
Stage 1: Next-step wording and sub-issue auto-assignment
Files to modify
-
commands/issue-plan.md-- two edits:- Next-step wording (line 180): Change the "optionally" framing to make
/mach10:issue-plan-reviewthe recommended next step, with/mach10:issue-implementmentioned as the step after review. New wording: "Let the user know the next step is/clearthen/mach10:issue-plan-review <issue-number>to review the plan. After review, use/mach10:issue-implement <issue-number> 1to begin Stage 1 of the implementation in a fresh session." - Sub-issue assignment (new sub-step 4 under Step 7, after sub-step 3): Add a sub-issue detection and assignment block after the parent assignment logic.
- Next-step wording (line 180): Change the "optionally" framing to make
-
commands/issue-implement.md-- one edit:- Sub-issue assignment (after Step 2 "Assign the issue" block, after line 90): Add identical sub-issue detection and assignment block.
-
CLAUDE.md-- one edit:- Sync note (line 66): Update the "Issue auto-assignment sync" note to cover sub-issue detection and assignment behavior across both commands, specifying the exact locations of the sub-issue blocks.
Sub-issue assignment logic (identical in both commands)
The sub-issue block is added immediately after the parent assignment logic:
-
Detect sub-issues using the two-strategy approach from
pr-create.md(lines 70-82):- Strategy A (API): Query
gh api repos/$REPO/issues/<issue-number>/sub_issues --jq ".[].number"(first resolveREPOviagh repo view --json nameWithOwner --jq .nameWithOwner). If it succeeds with results, use them as the confirmed sub-issue list. If it succeeds with empty results (empty array), the issue has no sub-issues -- do NOT fall through to Strategy B; treat the sub-issue list as empty. If it fails (e.g., 404, permission error), proceed to Strategy B. - Strategy B (body-parse fallback): This strategy runs only when Strategy A failed. Scan the issue body for sub-issue references. Match
#<number>references that appear on GitHub task list lines -- lines beginning with optional whitespace followed by a list marker (-,*, or+) and a checkbox ([ ],[x], or[X]). Exclude any#<number>preceded by relational keywords: "Related to", "Blocked by", "See also", or "Depends on". Collect the matched issue numbers, excluding the parent issue number itself.
- Strategy A (API): Query
-
If sub-issues found, get current user login once via
gh api user --jq .login(reuse the value from the parent assignment step if already retrieved). -
For each sub-issue, check assignees via
gh issue view <sub-issue> --json assignees --jq '[.assignees[].login] | join(",")'. Three paths:- Current user already assigned: skip silently
- No assignees: auto-assign with
gh issue edit <sub-issue> --add-assignee @me - Other assignees exist: collect into a "conflicting" list
-
If conflicting list is non-empty, present a single
AskUserQuestionwith bulk options:- Add me: "Add yourself as an additional assignee on all conflicting sub-issues" -- run
gh issue edit <sub-issue> --add-assignee @mefor each - Skip: "Leave the current assignee(s) unchanged on all sub-issues" -- no-op
- Replace: "Remove existing assignee(s) and assign only yourself on all sub-issues" -- run
gh issue edit <sub-issue> --remove-assignee <existing-logins> --add-assignee @mefor each
- Add me: "Add yourself as an additional assignee on all conflicting sub-issues" -- run
-
Assignment failures are non-blocking (warn and continue).
CLAUDE.md sync note update
The "Issue auto-assignment sync" note (line 66) should be updated to:
Issue auto-assignment sync: The assignment logic (assignee check via
gh issue view --json assignees, current user check viagh api user, skip-if-already-assigned condition,AskUserQuestionoption set for other-assignees case, and graceful failure handling) is duplicated betweencommands/issue-plan.md(Step 7, sub-step 3) andcommands/issue-implement.md(Step 2, "Assign the issue" section). The sub-issue detection and assignment block (two-strategy detection frompr-create.md, per-sub-issue three-path assignment, bulkAskUserQuestionfor conflicting assignees) immediately follows the parent assignment in both locations:commands/issue-plan.md(Step 7, sub-step 4) andcommands/issue-implement.md(Step 2, after "Assign the issue"). Any change to the parent or sub-issue assignment logic must be applied to both locations. Note:issue-implementincludes an additional note that already-assigned is the expected case for subsequent stages.
Testing
No testable runtime code (plugin command definitions only). Testing is not applicable.
Decision Log
Sub-issue prompt UX
Q: Should sub-issues with conflicting assignees prompt individually or use a bulk decision? A: Bulk decision -- ask once and apply the same choice to all conflicting sub-issues.
Architecture choice
Single viable approach: adapt the existing sub-issue detection pattern from pr-create.md and add it to both command files. No meaningful alternatives existed given the small scope and clear existing patterns.
This plan will guide staged implementation via /mach10:issue-implement.
Progress: Stage 1 implemented
Commit: bda6b92
Changes:
commands/issue-plan.md: Changed next-step wording to recommend/mach10:issue-plan-review(previously framed as optional). Added sub-issue auto-assignment as sub-step 4 in Step 7, using the two-strategy detection pattern (API + body-parse fallback) frompr-create.md.commands/issue-implement.md: Added identical sub-issue detection and assignment block in Step 2 ("Assign sub-issues" section) after parent assignment.CLAUDE.md: Updated the "Issue auto-assignment sync" note to document both parent and sub-issue assignment locations.
Sub-issue assignment uses bulk AskUserQuestion for conflicting assignees (single prompt, applied to all). issue-implement includes an "already-assigned is expected" note for sub-issues, matching the parent assignment pattern.