mach10 icon indicating copy to clipboard operation
mach10 copied to clipboard

Bundle: pr-create improvements (pagination, closed sub-issues, comment reading)

Open LeanAndMean opened this issue 7 months ago • 3 comments

Summary

Bundle three pr-create.md improvements into a single PR.

Included Issues

  • #65 — pr-create: add --paginate flag to sub-issues API call
  • #66 — pr-create: show already-closed sub-issue state in draft
  • #67 — pr-create: read issue body and all comments before drafting PR

Rationale

All three issues modify commands/pr-create.md only. They are logically cohesive (improving pr-create's context gathering and sub-issue handling) and non-overlapping in the sections they touch.

Acceptance Criteria

  • All acceptance criteria from #65 are met
  • All acceptance criteria from #66 are met
  • All acceptance criteria from #67 are met
  • Single PR covers all three changes

LeanAndMean avatar Apr 07 '26 17:04 LeanAndMean

Implementation Plan: pr-create improvements (pagination, closed sub-issues, comment reading)

Bundle of three improvements to pr-create.md (issues #65, #66, #67), plus sync of the pagination fix to related commands.

Stage 1: All three improvements + sync

Change 1: Add --paginate to sub-issues API call (issue #65)

Add the --paginate flag to the gh api call in Strategy A of sub-issue detection. This ensures parent issues with 30+ sub-issues return complete results.

Files modified:

  • commands/pr-create.md -- Strategy A API call in Step 2
  • commands/issue-plan.md -- Strategy A API call in Step 7, sub-step 4
  • commands/issue-implement.md -- Strategy A API call in Step 2, "Assign sub-issues" section

What changes:

# Before
gh api repos/$REPO/issues/<issue-number>/sub_issues --jq '.[].number'

# After
gh api --paginate repos/$REPO/issues/<issue-number>/sub_issues --jq '.[].number'

Change 2: Show already-closed sub-issue state in draft (issue #66)

After sub-issue detection, query each sub-issue's state. When presenting the draft, include a separate summary note above the closing keywords listing which sub-issues are already closed, so the user can make an informed decision about keeping or removing those closing keywords via the "Modify" option.

Files modified:

  • commands/pr-create.md -- End of Step 2 (state query) and Step 3 (draft presentation)

What changes:

  • Add a sub-step after sub-issue detection to query each sub-issue's state: gh issue view <N> --json state --jq .state
  • In the closing keywords section of Step 3, add instruction to present a separate note above the Fixes lines listing any already-closed sub-issues, advising the user they can remove those via the "Modify" option

Change 3: Read issue comments before drafting (issue #67)

Read the issue's comments in addition to the issue body so that implementation plans, stage completion notes, scope decisions, and analysis findings inform the PR description.

Files modified:

  • commands/pr-create.md -- Step 2, issue resolution section

What changes:

  • After the existing gh issue view <issue-number>, add gh issue view <issue-number> --comments to capture all issue comments
  • Add a note that comment content (implementation plans, decisions, assessment findings, progress notes) should be used when drafting the PR title and body

Testing approach

This is a plugin definition repo with no runtime or test suite. Verification is manual: review each change against the acceptance criteria of the corresponding issue and verify sync consistency across the three files that share the sub-issue detection logic.

Decision Log

Sync Scope

Q: The --paginate fix also applies to the same API call in issue-plan.md and issue-implement.md per the sub-issue detection sync rule. Should this plan update those files too? A: Yes, update all synced files to maintain consistency per the CLAUDE.md sync rule.

Closed Sub-Issue Display

Q: How should closed sub-issues be presented in the draft? A: Use a separate summary note above the closing keywords section, keeping the Fixes lines clean.


This comment will guide staged implementation via /mach10:issue-implement.

LeanAndMean avatar Apr 08 '26 21:04 LeanAndMean

Implementation Plan: pr-create improvements (pagination, closed sub-issues, comment reading)

Bundle of three improvements to pr-create.md (issues #65, #66, #67), plus sync of the pagination fix to related commands.

Stage 1: All three improvements + sync

Change 1: Add --paginate to sub-issues API call (issue #65)

Add the --paginate flag to the gh api call in Strategy A of sub-issue detection. This ensures parent issues with 30+ sub-issues return complete results.

Files modified:

  • commands/pr-create.md -- Strategy A API call in Step 2
  • commands/issue-plan.md -- Strategy A API call in Step 7, sub-step 4
  • commands/issue-implement.md -- Strategy A API call in Step 2, "Assign sub-issues" section

What changes:

# Before
gh api repos/$REPO/issues/<issue-number>/sub_issues --jq '.[].number'

# After
gh api --paginate repos/$REPO/issues/<issue-number>/sub_issues --jq '.[].number'

Change 2: Show already-closed sub-issue state in draft (issue #66)

After sub-issue detection, identify which sub-issues are already closed and surface this in the draft presentation so the user can make an informed decision about keeping or removing those closing keywords.

Files modified:

  • commands/pr-create.md -- End of Step 2 (state capture) and Step 3 (draft presentation)

What changes:

In Step 2, modify the Strategy A jq filter in pr-create.md only to capture both number and state in a single API call (avoiding N per-sub-issue queries):

# Before (pr-create.md only)
gh api --paginate repos/$REPO/issues/<issue-number>/sub_issues --jq '.[].number'

# After (pr-create.md only)
gh api --paginate repos/$REPO/issues/<issue-number>/sub_issues --jq '.[] | {number, state}'

Note: issue-plan.md and issue-implement.md retain the .[].number filter since they only need issue numbers for assignment, not state. The jq filter divergence between pr-create.md and the assignment commands is intentional and scoped to pr-create's display needs.

For sub-issues detected via Strategy B (body-parse fallback), fall back to individual gh issue view <N> --json state --jq .state calls since the body parse only yields numbers.

In Step 3, add instruction to present a separate note above the Fixes lines listing any already-closed sub-issues, advising the user they can remove those via the "Modify" option.

Change 3: Read issue comments before drafting (issue #67)

Read the issue's comments in addition to the issue body so that implementation plans, stage completion notes, scope decisions, and analysis findings inform the PR description.

Files modified:

  • commands/pr-create.md -- Step 2, issue resolution section

What changes:

  • After the existing gh issue view <issue-number>, add gh issue view <issue-number> --comments
  • Include the established explanatory note used by the other four commands: "--comments returns only comments and silently drops the title and body, so both calls are required"
  • Add guidance that comment content (implementation plans, decisions, assessment findings, progress notes) should inform the Summary bullets and Test plan, but should not be copy-pasted verbatim into the PR body

Testing approach

This is a plugin definition repo with no runtime or test suite. Verification is manual: review each change against the acceptance criteria of the corresponding issue and verify sync consistency across the three files that share the sub-issue detection logic.

Decision Log

Sync Scope

Q: The --paginate fix also applies to the same API call in issue-plan.md and issue-implement.md per the CLAUDE.md sync rule. Should this plan update those files too? A: Yes, update all synced files to maintain consistency per the CLAUDE.md sync rule.

Closed Sub-Issue Display

Q: How should closed sub-issues be presented in the draft? A: Use a separate summary note above the closing keywords section, keeping the Fixes lines clean.

State Query Approach

Q: Should closed-state be queried per-sub-issue or batched? A: Use the Strategy A API response itself (change jq filter to .[] | {number, state}) to capture state in a single call. Fall back to individual queries only for Strategy B results.

jq Filter Divergence

Q: Should the jq filter change also apply to issue-plan.md and issue-implement.md? A: No. The assignment commands only need issue numbers, not state. The divergence is intentional and scoped to pr-create.md's display needs. Filtering closed sub-issues from assignment is a separate concern (out of scope for this bundle).

Comment Usage Guidance

Q: How should issue comments influence the PR draft? A: Comments should inform the Summary bullets and Test plan but should not be copy-pasted verbatim into the PR body.


This comment will guide staged implementation via /mach10:issue-implement.

LeanAndMean avatar Apr 09 '26 13:04 LeanAndMean

Stage 1 Progress

Implemented all three improvements in a single stage:

  1. Pagination (per issue #65): Added --paginate flag to gh api sub-issues calls in pr-create.md, issue-plan.md, and issue-implement.md
  2. Closed sub-issue state (per issue #66): Changed Strategy A jq filter in pr-create.md to capture {number, state}; added per-sub-issue state query for Strategy B fallback; added draft presentation note for already-closed sub-issues
  3. Comment reading (per issue #67): Added gh issue view --comments call for both explicit and inferred issue numbers in pr-create.md; added guidance that comment content should inform but not be copy-pasted into the PR body

Commit: 1971208

LeanAndMean avatar Apr 09 '26 15:04 LeanAndMean