Skip to content

Scaffold a draft from agentrepo pr #913

Open

Description

@tbhb-agent

Problem

scaffold-description.sh (91 lines) writes a starting PR_AGENTDESC.md from the repository's pull request template. It chooses the base, protects an existing draft, and refuses a template outside the repository. Both preflight.sh (when the draft is absent) and the test suites call it on its own, so it needs its own tested behavior before the preflight and the wrappers can move.

Part of #588 and #323. Delivers in Go the behavior of packages/agents/source/skills/pr/shared/scripts/scaffold-description.sh. This change adds Go behavior only and switches no caller. Property resolution (properties.sh, 47 lines) is not a scaffold concern and has no entry point of its own: at origin/main the only caller is create-pr.sh, which sources it, and no test or skill runs it alone. It is therefore delivered with publication in child 08.

Acceptance criteria

  1. AC1: Given no draft and a template, when the scaffold runs, then PR_AGENTDESC.md holds frontmatter with base, draft: false, labels: [], reviewers: [], assignees: [] and an empty milestone, then a blank line, the title placeholder # <type>(<scope>)?: <description>, a blank line and the template verbatim, and the run prints which file was scaffolded from which template and the guidance lines the shell prints.
  2. AC2: Given a nonempty draft exists and no --force, when the scaffold runs, then it prints that the draft already exists and was left alone, exits 0 and leaves the file byte-identical.
  3. AC3: Given an existing draft that is empty, when the scaffold runs without --force, then it populates the draft; given a nonempty draft and --force, then it replaces the draft.
  4. AC4: Given a base argument, when the scaffold runs, then base is that argument; given none and origin/HEAD set, then it is the branch origin/HEAD names; given neither, then main.
  5. AC5: Given pr_template names a path outside the repository, when the scaffold runs, then it refuses with the shell's message; given the named template does not exist, then it exits 1 with "no template at " and writes nothing.
  6. AC6: Non-functional: the scaffold writes only PR_AGENTDESC.md and makes no network connection.

Scope and non-goals

Scope: the scaffold behavior above.

Non-goal: resolving labels, milestones or issue references against GitHub, which child 08 does with publication. Non-goal: label creation or any GitHub write. Non-goal: switching the shell caller to the Go behavior, which child 12 does.

Approach

Meet AC1 to AC6 with failing table-driven cases first on scratch repositories, comparing the written draft byte for byte with the shell's. The package layout is the implementer's choice within those outcomes.

Dependencies

Blocked by: #910.

Prerequisite: the repository configuration reader delivered under #321.

Size

S. One pull request.

Verify plan

  • AC1, AC4: Go tests over a scratch repository compare the written draft and printed lines with the shell's.
  • AC2, AC3: Go tests for a nonempty draft, an empty draft, and a nonempty draft with --force, checking bytes and exit status.
  • AC5: Go tests with a template outside the repository and a missing template, checking message and exit status.
  • AC6: a test asserts the set of files written and that no network connection is attempted.
  • Go tests run in the existing Go CI on macOS, Linux and Windows.
  • Definition of done: D1 each AC is verified at the merged head, with the commands and results cited in the pull request's Verification. D2 an independent review approves the exact merged head, and every finding has a recorded disposition. D3 required checks pass with no gate loosened. D4 the leak scans the repository specifies are clean, and every post made for this work passes the per-post leak review before it is posted. D5 every commit is signed. D6 the documentation matches the change or the Verification says why there is no impact. D7 every commit has an Assisted-by trailer and the pull request has the provenance:agent-assisted label. D8 the pull request stays within the size limits. D9 follow-ups are filed as issues and listed under Related. D10 the merge closes the issue through a closing reference, the board shows Done, and the final Status: comment names the merge commit.

Risks

Overwriting a draft under revision loses the author's work. The AC2 and AC3 cases are the control. Undo: revert the change; nothing calls the Go behavior yet and the shell scaffolds as before.

Operator authority

None.

Activity

  1. tbhb-agent commented on Oct 27, 2026

    @tbhb-agent
    ContributorAuthor

    Refinement: READY — Scaffold a draft from agentrepo pr
    Model: gpt-6-astra

    Child 04 Scaffold a draft from agentrepo pr

    Verdict: READY

    Checked: Existing nonempty drafts, empty drafts and forced replacement have distinct outcomes and checks. The binding properties decision leaves this child scaffold-only; the sole maintained caller sources properties during publication. Evidence: packages/agents/source/skills/pr/shared/scripts/scaffold-description.sh:54, packages/agents/source/skills/pr/shared/scripts/scaffold-description.sh:61, packages/agents/source/skills/pr/shared/scripts/create-pr.sh:182.

    Gaps: None.

    Split: S fits the settled scope.

    Definition of done

    The definition of done for this issue (Feature). Tick each item and give its evidence.

    • D1 The author verified each AC on the merged head, and the Verification section of the pull request cites each AC ID with its evidence: the command and its result, or a link.
    • D2 An independent reviewer approved the exact merged head, and the author resolved each finding or filed it as a follow-up.
    • D3 The required checks pass on that head, and any loosened gate has the owner's approval of that exact head.
    • D4 The leak scans come back clean: gitleaks, devtools' check-leaks.sh with the repository's private-strings list, and the leak review of each post.
    • D5 The author signed each commit, the squash included.
    • D6 The docs match the change (README, docs/, CHANGELOG or help text), or the Verification section says "No doc impact" and why.
    • D7 The commits and the squash have Assisted-by trailers, and the pull request has the provenance:agent-assisted label.
    • D8 The pull request stays within the size limits, or the owner approved its exact head over the hard limit.
    • D9 The author files follow-ups and deferred findings as issues with at least a Problem and numbered AC and lists them under the Related section of the pull request. Any work left in the code links its issue.
    • D10 The merge closes the issue through a closing reference and the board shows Done. The final Status: comment names the merge commit.
    • devtools-1 mise run check is green, and so are the coverage floors mise run cover-go-check and mise run cover-py-check, which check doesn't run.
    • devtools-2 A change to skill sources under packages/agents/source/ commits what mise run generate-skills, then mise run skill-tokens, then apm install rewrite, in that order, and check-generated-skills (part of lint) passes.
    • devtools-3 A consumer-visible change (the vendored payload, a skill, a reusable workflow, a task or a pin) has its consumer steps in docs/agent-skills-migration.md or the adoption docs, or the PR's Verification says "No consumer impact" and why.

    Round: 3 of 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refinement:readyPassed the Definition of Ready; may be picked up

    Fields

    Priority

    None yet

    Work type

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions