mach10 icon indicating copy to clipboard operation
mach10 copied to clipboard

Bundle: issue-plan next-step and auto-assignment improvements

Open LeanAndMean opened this issue 7 months ago • 6 comments

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

LeanAndMean avatar Apr 07 '26 17:04 LeanAndMean

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:

  1. Next-step wording (from issue 51): Single-line edit on line 180 of commands/issue-plan.md. Change the "optionally" framing to make issue-plan-review the recommended next step, with issue-implement as the step after review.

  2. Sub-issue assignment (from issue 70): Neither issue-plan nor issue-implement currently assigns sub-issues. The sub-issue detection pattern from pr-create.md (API call with body-parse fallback) can be reused. Adds ~10-15 lines to each command file.

  3. 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-implement also assign sub-issues, or only issue-plan?

Scope: Small -- two command files and one sync note. Single PR as proposed.

LeanAndMean avatar Apr 07 '26 17:04 LeanAndMean

Decisions from assessment session:

  1. Sub-issue detection method: Use the two-strategy approach (API call with body-parse fallback), matching the existing pattern in pr-create.md.

  2. Sub-issue assignment scope: Both issue-plan and issue-implement will assign sub-issues, keeping behavior consistent regardless of entry point.

LeanAndMean avatar Apr 07 '26 17:04 LeanAndMean

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:

  1. Next-step wording (issue 51): Single-line edit on line 180 of commands/issue-plan.md. Change the "optionally" framing to make issue-plan-review the recommended next step, with issue-implement as the step after review.

  2. Sub-issue assignment (issue 70): Add sub-issue detection (adapting the two-strategy API+body-parse pattern from pr-create.md lines 70-82) and an assignment loop to both issue-plan.md (Step 7, after sub-step 3) and issue-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 with AskUserQuestion if other assignees exist. Assignment failures are non-blocking (warn and continue). Estimated ~15-20 new lines per command file.

  3. 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.

LeanAndMean avatar Apr 07 '26 20:04 LeanAndMean

Implementation Plan

Overview

Bundle two changes to commands/issue-plan.md (with sync obligations to issue-implement.md and CLAUDE.md):

  1. Make issue-plan-review the recommended next step (issue 51)
  2. Add sub-issue auto-assignment to both issue-plan and issue-implement (issue 70)

Stage 1: Next-step wording and sub-issue auto-assignment

Files to modify

  1. commands/issue-plan.md -- two edits:

    • Next-step wording (line 180): Change the "optionally" framing to make /mach10:issue-plan-review the recommended next step, with /mach10:issue-implement mentioned 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.
  2. 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.
  3. 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:

  1. 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.
  2. If sub-issues found, get current user login once via gh api user --jq .login.

  3. 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
  4. If conflicting list is non-empty, present a single AskUserQuestion with bulk options:

    • Add me: "Add yourself as an additional assignee on all conflicting sub-issues" -- run gh issue edit for 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 for each
  5. 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.

LeanAndMean avatar Apr 07 '26 21:04 LeanAndMean

Implementation Plan

Overview

Bundle two changes to commands/issue-plan.md (with sync obligations to issue-implement.md and CLAUDE.md):

  1. Make issue-plan-review the recommended next step (issue #51)
  2. Add sub-issue auto-assignment to both issue-plan and issue-implement (issue #70)

Stage 1: Next-step wording and sub-issue auto-assignment

Files to modify

  1. commands/issue-plan.md -- two edits:

    • Next-step wording (line 180): Change the "optionally" framing to make /mach10:issue-plan-review the recommended next step, with /mach10:issue-implement mentioned as the step after review. New wording: "Let the user know the next step is /clear then /mach10:issue-plan-review <issue-number> to review the plan. After review, use /mach10:issue-implement <issue-number> 1 to 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.
  2. 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.
  3. 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:

  1. 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 resolve REPO via gh 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.
  2. 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).

  3. 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
  4. If conflicting list is non-empty, present a single AskUserQuestion with bulk options:

    • Add me: "Add yourself as an additional assignee on all conflicting sub-issues" -- run gh issue edit <sub-issue> --add-assignee @me for 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 @me for each
  5. 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 via gh api user, skip-if-already-assigned condition, AskUserQuestion option set for other-assignees case, and graceful failure handling) is duplicated between commands/issue-plan.md (Step 7, sub-step 3) and commands/issue-implement.md (Step 2, "Assign the issue" section). The sub-issue detection and assignment block (two-strategy detection from pr-create.md, per-sub-issue three-path assignment, bulk AskUserQuestion for conflicting assignees) immediately follows the parent assignment in both locations: commands/issue-plan.md (Step 7, sub-step 4) and commands/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-implement includes 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.

LeanAndMean avatar Apr 07 '26 21:04 LeanAndMean

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) from pr-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.

LeanAndMean avatar Apr 07 '26 21:04 LeanAndMean