Goal
Make the PR-template body a single maintained template or renderer, and share the created/unchanged accounting used by repo init and agent-guidance. Preserve any intended entrypoint-specific wording through an explicit parameter rather than a second copied body.
Background
Repository-wide duplication review against f9c18f3294873cbbcda9acc7af7f1bc6b17eed45 (2026-09-17).
The two PR-template writers are nearly identical heredocs but already differ: repo init emits ## Notes, while agent-guidance emits ## Reviewer Notes with different guidance. Invoking the extracted current writers against a stdout-only sink reproduced the difference. The two agent-guidance orchestration functions also repeat file-existence bookkeeping and the created/unchanged summary.
Verified source locations:
Closed #1137 extracted the agent-guidance module; current main still contains the duplicated writers and accounting shown here. No matching open issue exists.
This is a maintainability refactor. Similarity alone is not evidence of a production failure; any demonstrated differences are called out above.
Scope
Make the PR-template body a single maintained template or renderer, and share the created/unchanged accounting used by repo init and agent-guidance. Preserve any intended entrypoint-specific wording through an explicit parameter rather than a second copied body.
Acceptance Criteria
- One maintained checklist/body source serves both creation paths.
- An explicit tested parameter preserves current Notes versus Reviewer Notes behavior unless a separate intentional UX change is approved in review.
- Existing user-authored files remain untouched.
- Dry-run, failure propagation and summary counts remain correct for all-existing, all-missing and mixed cases.
Validation
Run the repo and agent-guidance BATS cases; compare both generated templates and exercise mixed existing/missing files and a failed write.
Run focused checks first, then the repository-required broader checks for the actual implementation. Preserve public command contracts and review .ai-context/ impact in the PR.
Non-Goals
No rewrite of repo commands; no broad scaffolding PR/worktree abstraction; no overwrite of customized repository files.
Project Fields
- Status: Ready
- Priority: P2
- Area: CLI
- Initiative: Contract Hardening
- Size: S
- Milestone: Unscheduled; no release commitment is implied by this audit.
Agent Assignment
Implementation-ready scoped follow-up, assigned to codeforester. Follow AGENTS.md and docs/github-workflow.md: start through basectl gh issue start, use the canonical issue worktree, characterize current behavior before extraction, and open an issue-linked PR. Keep each refactor independently reviewable.
Goal
Make the PR-template body a single maintained template or renderer, and share the created/unchanged accounting used by repo init and agent-guidance. Preserve any intended entrypoint-specific wording through an explicit parameter rather than a second copied body.
Background
Repository-wide duplication review against
f9c18f3294873cbbcda9acc7af7f1bc6b17eed45(2026-09-17).The two PR-template writers are nearly identical heredocs but already differ: repo init emits
## Notes, while agent-guidance emits## Reviewer Noteswith different guidance. Invoking the extracted current writers against a stdout-only sink reproduced the difference. The two agent-guidance orchestration functions also repeat file-existence bookkeeping and the created/unchanged summary.Verified source locations:
cli/bash/commands/basectl/subcommands/repo.sh:840-871cli/bash/commands/basectl/subcommands/repo.sh:1473-1516cli/bash/commands/basectl/subcommands/repo_agent_guidance.sh:128-159cli/bash/commands/basectl/subcommands/repo_agent_guidance.sh:226-268Closed #1137 extracted the agent-guidance module; current main still contains the duplicated writers and accounting shown here. No matching open issue exists.
This is a maintainability refactor. Similarity alone is not evidence of a production failure; any demonstrated differences are called out above.
Scope
Make the PR-template body a single maintained template or renderer, and share the created/unchanged accounting used by repo init and agent-guidance. Preserve any intended entrypoint-specific wording through an explicit parameter rather than a second copied body.
Acceptance Criteria
Validation
Run the repo and agent-guidance BATS cases; compare both generated templates and exercise mixed existing/missing files and a failed write.
Run focused checks first, then the repository-required broader checks for the actual implementation. Preserve public command contracts and review
.ai-context/impact in the PR.Non-Goals
No rewrite of repo commands; no broad scaffolding PR/worktree abstraction; no overwrite of customized repository files.
Project Fields
Agent Assignment
Implementation-ready scoped follow-up, assigned to
codeforester. FollowAGENTS.mdanddocs/github-workflow.md: start throughbasectl gh issue start, use the canonical issue worktree, characterize current behavior before extraction, and open an issue-linked PR. Keep each refactor independently reviewable.