From 17e8f38813189320cc62f2c6433dc72ad1af511f Mon Sep 17 00:00:00 2001 From: Jean du Plessis Date: Wed, 4 Mar 2026 11:05:47 +0200 Subject: [PATCH 1/4] Add PR template and prepare-pr workflow --- .github/pull_request_template.md | 23 +++++++++++++++ .kilocode/workflows/prepare-pr.md | 48 +++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/pull_request_template.md create mode 100644 .kilocode/workflows/prepare-pr.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000000..7ce09c7aa62 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,23 @@ +## Summary + + + + +## Verification + + + +- [ ] + +## Visual Changes + + + + +| Before | After | +| ------ | ----- | +| | | + +## Reviewer Notes + + diff --git a/.kilocode/workflows/prepare-pr.md b/.kilocode/workflows/prepare-pr.md new file mode 100644 index 00000000000..a2385fbda40 --- /dev/null +++ b/.kilocode/workflows/prepare-pr.md @@ -0,0 +1,48 @@ +# Prepare PR + +Prepare a pull request description using this repository's PR template and then create or update the PR. + +## Required source of truth + +- Read and use `/.github/pull_request_template.md` from this repository. +- Preserve section headings and order exactly as they appear in the template. +- Do not add sections that are not present in the template. + +## Build the PR description + +1. Collect branch context. + - Run git commands to understand all changes that will be included in the PR. + - Include all commits since branch divergence, not just the latest commit. + +2. Prefill `## Summary`. + - Describe what changed and why. + - Explicitly call out any architectural changes. + - Include enough context for a reviewer unfamiliar with this code area. + - Keep it concise and reviewer-friendly. + +3. Prefill `## Verification` from this session. + - Capture verification already performed in this session (tests, typecheck, lint, builds, manual checks). + - Include command names and short pass/fail outcomes when available. + - Add a final placeholder bullet for extra user-provided verification details. + +4. Prepare `## Visual Changes`. + - Detect likely visual/UI changes from changed files (for example: `*.tsx`, `*.jsx`, CSS, Tailwind config, component/page/view files). + - If visual/UI changes are likely, keep the before/after screenshot table and add meaningful row labels/placeholders. + - If no visual/UI changes are likely, replace the section content with `N/A`. + +5. Prefill `## Reviewer Notes`. + - Add concise context that helps reviewer efficiency (risk areas, tricky logic, rollout notes). + - Keep this section brief. + +## Confirm with the user + +- Print the full generated PR description in markdown. +- Ask for confirmation and any edits. +- Apply edits and show the final version before writing it to GitHub. + +## Create or update PR + +1. Check whether a PR already exists for the current branch. +2. If a PR exists, update the PR body using `gh pr edit --body`. +3. If a PR does not exist, create it using `gh pr create` with the generated body. +4. Return the PR URL. From efb71fe72f645f4a41ae0eb20ea89863d53976d4 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 13:18:35 +0000 Subject: [PATCH 2/4] Add AGENTS.md with PR template instructions for AI agents --- AGENTS.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000000..f3e400ef95f --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,36 @@ +# AGENTS.md + +## Pull Request Descriptions + +When creating or updating a pull request, you **must** follow the PR template in `.github/pull_request_template.md`. Every PR description must include these four sections in order: + +### `## Summary` + +- Describe what changed and why. Be outcome-focused. +- Call out architectural changes explicitly. +- Include enough context for a reviewer unfamiliar with this code area. +- Keep it concise. Do not pad with generic filler. + +### `## Verification` + +- List the checks you actually ran during development (tests, typecheck, lint, build, manual checks). +- Include command names and pass/fail outcomes where available. +- **Do not fabricate verification steps.** Only list testing you actually performed. Reviewers rely on this section to assess risk — dishonest verification is worse than none. + +### `## Visual Changes` + +- If UI or visual behavior changed, include a before/after screenshot table. +- If there are no visual changes, replace the section content with `N/A`. + +### `## Reviewer Notes` + +- Add concise context that helps reviewer efficiency: risk areas, tricky logic, rollout notes, or edge cases. +- If there is nothing noteworthy, keep this section brief or write `N/A`. + +### General rules + +- Preserve section headings and order exactly as they appear in the template. +- Do not add sections that are not in the template. +- Do not leave HTML comments from the template in the final description — replace them with actual content. +- PR descriptions must be accurate and valuable to reviewers. Generic or boilerplate descriptions waste reviewer time. +- Review all commits on the branch (not just the latest) when writing the summary. From 00a8517ddc6b5953abc9d7ecc1b3b93e30f329b2 Mon Sep 17 00:00:00 2001 From: "kiloconnect[bot]" <240665456+kiloconnect[bot]@users.noreply.github.com> Date: Wed, 4 Mar 2026 19:07:41 +0000 Subject: [PATCH 3/4] Add PR title conventions, draft PR rules, and title validation workflow - AGENTS.md: add PR title format (type(scope): description) and draft PR instructions - PR template: add title convention guidance comments - prepare-pr workflow: add PR title section and draft flag - pr-title.yml: new CI workflow to validate PR title format, length, and trailing period --- .github/pull_request_template.md | 3 +++ .github/workflows/pr-title.yml | 40 +++++++++++++++++++++++++++++++ .kilocode/workflows/prepare-pr.md | 8 ++++++- AGENTS.md | 13 ++++++++++ 4 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr-title.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7ce09c7aa62..d6c3d59e029 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,3 +1,6 @@ + + + ## Summary diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 00000000000..80118176def --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,40 @@ +name: PR Title + +on: + pull_request: + types: [opened, edited, synchronize] + +permissions: + pull-requests: read + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - name: Check PR title format + env: + TITLE: ${{ github.event.pull_request.title }} + run: | + # type(scope): description OR type: description + pattern='^(feat|fix|refactor|docs|test|chore|ci|style|perf)(\([a-zA-Z0-9_-]+\))?: .+' + if ! echo "$TITLE" | grep -Eq "$pattern"; then + echo "::error::PR title must match the format: type(scope): description" + echo " Allowed types: feat, fix, refactor, docs, test, chore, ci, style, perf" + echo " Example: feat(auth): add SSO login" + exit 1 + fi + + # No trailing period + if echo "$TITLE" | grep -Eq '\.$'; then + echo "::error::PR title must not end with a period." + exit 1 + fi + + # Length check + length=${#TITLE} + if [ "$length" -gt 72 ]; then + echo "::error::PR title must be 72 characters or fewer (currently $length)." + exit 1 + fi + + echo "PR title is valid: $TITLE" diff --git a/.kilocode/workflows/prepare-pr.md b/.kilocode/workflows/prepare-pr.md index a2385fbda40..7d1afbd5596 100644 --- a/.kilocode/workflows/prepare-pr.md +++ b/.kilocode/workflows/prepare-pr.md @@ -8,6 +8,12 @@ Prepare a pull request description using this repository's PR template and then - Preserve section headings and order exactly as they appear in the template. - Do not add sections that are not present in the template. +## PR title + +- Use the format `type(scope): ` (e.g., `feat(auth): add SSO login`). +- Common types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `ci`, `style`, `perf`. +- Keep the title under 72 characters, use imperative mood, and do not end with a period. + ## Build the PR description 1. Collect branch context. @@ -44,5 +50,5 @@ Prepare a pull request description using this repository's PR template and then 1. Check whether a PR already exists for the current branch. 2. If a PR exists, update the PR body using `gh pr edit --body`. -3. If a PR does not exist, create it using `gh pr create` with the generated body. +3. If a PR does not exist, create it as a **draft** using `gh pr create --draft` with the generated title and body. 4. Return the PR URL. diff --git a/AGENTS.md b/AGENTS.md index f3e400ef95f..462643933b6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,5 +1,18 @@ # AGENTS.md +## Pull Request Titles + +- Use the format: `type(scope): ` + - Common types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `ci`, `style`, `perf` + - Scope is optional but encouraged (e.g., `feat(auth): add SSO login`) +- Use imperative mood (e.g., "Add feature", not "Added feature"). +- Keep titles under 72 characters. +- Do not end the title with a period. + +## Draft PRs + +When creating a pull request, **always create it as a draft** (`gh pr create --draft`). Let the author mark it ready for review. + ## Pull Request Descriptions When creating or updating a pull request, you **must** follow the PR template in `.github/pull_request_template.md`. Every PR description must include these four sections in order: From 23b9e402c3366a8c161e36fe70f9976703748fee Mon Sep 17 00:00:00 2001 From: Jean du Plessis Date: Wed, 4 Mar 2026 21:17:42 +0200 Subject: [PATCH 4/4] chore(ci): remove pr-title validation workflow --- .github/workflows/pr-title.yml | 40 ---------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/pr-title.yml diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml deleted file mode 100644 index 80118176def..00000000000 --- a/.github/workflows/pr-title.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: PR Title - -on: - pull_request: - types: [opened, edited, synchronize] - -permissions: - pull-requests: read - -jobs: - validate: - runs-on: ubuntu-latest - steps: - - name: Check PR title format - env: - TITLE: ${{ github.event.pull_request.title }} - run: | - # type(scope): description OR type: description - pattern='^(feat|fix|refactor|docs|test|chore|ci|style|perf)(\([a-zA-Z0-9_-]+\))?: .+' - if ! echo "$TITLE" | grep -Eq "$pattern"; then - echo "::error::PR title must match the format: type(scope): description" - echo " Allowed types: feat, fix, refactor, docs, test, chore, ci, style, perf" - echo " Example: feat(auth): add SSO login" - exit 1 - fi - - # No trailing period - if echo "$TITLE" | grep -Eq '\.$'; then - echo "::error::PR title must not end with a period." - exit 1 - fi - - # Length check - length=${#TITLE} - if [ "$length" -gt 72 ]; then - echo "::error::PR title must be 72 characters or fewer (currently $length)." - exit 1 - fi - - echo "PR title is valid: $TITLE"