From f45f853736e4d3bb5c5b2183a0b14b1bdf2e3562 Mon Sep 17 00:00:00 2001 From: lightforgelabsdev Date: Mon, 5 Oct 2026 15:29:12 +0100 Subject: [PATCH 1/2] Deliver implementation through draft PRs and external review handoffs --- docs/agents/PLACEHOLDER_CONTRACTS.md | 2 ++ docs/agents/PROJECT_WORKFLOW.md | 23 ++++++++++++ skills/check-pr/SKILL.md | 6 ++-- skills/implement/SKILL.md | 46 ++++++++++++++---------- skills/pr-ready/SKILL.md | 4 +-- skills/pr-review/SKILL.md | 53 +++++----------------------- skills/quality/SKILL.md | 6 ++-- 7 files changed, 69 insertions(+), 71 deletions(-) create mode 100644 docs/agents/PROJECT_WORKFLOW.md diff --git a/docs/agents/PLACEHOLDER_CONTRACTS.md b/docs/agents/PLACEHOLDER_CONTRACTS.md index fde1530..bcd9263 100644 --- a/docs/agents/PLACEHOLDER_CONTRACTS.md +++ b/docs/agents/PLACEHOLDER_CONTRACTS.md @@ -2,6 +2,8 @@ Placeholders that AIDE skills and docs expect projects to define. Declare mappings in `AGENTS.md`. +Implementation, validation and review also accept the project's linked workflow document; see [PROJECT_WORKFLOW.md](PROJECT_WORKFLOW.md) for the complete validation command and external-review handoff. Project constraints override template documentation paths and label conventions; ticket-only projects do not need to create unused documents. + ## Required Placeholders | Placeholder | Purpose | diff --git a/docs/agents/PROJECT_WORKFLOW.md b/docs/agents/PROJECT_WORKFLOW.md new file mode 100644 index 0000000..deeff1d --- /dev/null +++ b/docs/agents/PROJECT_WORKFLOW.md @@ -0,0 +1,23 @@ +# Project workflow configuration + +Before implementing, validating or reviewing, read the consuming project's root AGENTS.md. If it points to a workflow document, read that document too (convention: `docs/agents/workflow.md`). Project configuration and user instructions override AIDE defaults. + +Resolve these values from those sources before dependent work: + +| Value | Meaning | +| --- | --- | +| `MAIN_BRANCH` | PR base branch; default `main` | +| `VALIDATE_COMMAND` | Complete project gate, including any lint/smoke checks it owns | +| `LINT_COMMAND` | Separate lint command, only when needed outside the complete gate | +| `RUN_UNIT_TESTS_COMMAND` | Optional focused rules/unit command | +| `REVIEW_MODE` | `external` (default) or `independent-agent` | +| `REVIEWER` | External tool/session or configured independent reviewer | +| `REVIEW_COMMAND` | Project wrapper for submitting a review with decision, body file and reviewed SHA, if supported | + +Existing `{{RUN_ALL_TESTS_COMMAND}}` mappings also resolve the full validation command. An unresolved required command is missing configuration, not a reason to guess a command or silently skip a gate. Run an identical resolved command once; do not rerun full validation under a second placeholder name. Focused checks do not replace the complete delivery gate. + +**External review:** implementation ends with a draft PR and a head-specific review handoff. Another tool/session reviews and posts on GitHub. Accepted findings return to the implementation workflow. This supports Codex implementation and Claude review without sharing private conversation state or changing the active GitHub account. + +**Independent-agent review:** only use separate-agent review when the project or user selects it. Supply the PR, reviewed SHA, requirements and project constraints. Its report and a posted GitHub review are separate artifacts. + +Project exceptions are scoped: a rule allowing notes straight to the base branch applies only to the named paths. Keep code on a feature branch unless explicitly authorized otherwise. Implementation does not merge or close tickets; those actions require their own authorized delivery step. diff --git a/skills/check-pr/SKILL.md b/skills/check-pr/SKILL.md index 2f4931c..33bf3bd 100644 --- a/skills/check-pr/SKILL.md +++ b/skills/check-pr/SKILL.md @@ -15,13 +15,13 @@ Inspect an existing pull request for reviewer feedback and summarize the actiona ## Workflow 1. **Verify context** - Use `gh api user --jq .login` if identity matters. The author is expected to use this skill to inspect reviewer feedback on their own PR, so do not block on matching identities unless a separate reviewer context is explicitly required by the user. -2. **Load PR** - Run `gh pr view ` and `gh pr diff `. Read the linked issue if the PR references one. +2. **Load PR** - Run `gh pr view ` and `gh pr diff `. Record the current head SHA, checks, review decision and draft state. Read the linked issue and its current comments if the PR references one. 3. **Read feedback** - Inspect PR review threads and comments. Treat existing external review findings as the source of truth for this skill. -4. **Triage** - Group findings by severity and note whether each item is blocking, non-blocking, or already resolved in the branch. +4. **Triage** - Group findings by severity and note whether each item is blocking, non-blocking, or already resolved in the branch. Identify the reviewed commit: approval of an earlier head is not verification of new changes. Confirm claimed fixes against the current diff without replacing the external reviewer. 5. **Report** - Return a concise summary with file and line references, plus a clear answer: needs changes, needs clarification, or no actionable feedback. 6. **Stop or hand off** - Do not change code in this skill. If the user wants fixes applied, switch to the implementation workflow and address only the accepted findings. ## Reference -- [AGENTS.md](../../AGENTS.md) for repo invariants and review boundaries +- The consuming project's root AGENTS.md for invariants and review boundaries - [`pr-review`](../pr-review/SKILL.md) for the full PR review workflow diff --git a/skills/implement/SKILL.md b/skills/implement/SKILL.md index 6e8a505..280c7f5 100644 --- a/skills/implement/SKILL.md +++ b/skills/implement/SKILL.md @@ -1,36 +1,44 @@ --- name: implement -description: Execute a GitHub issue or spec end-to-end. Inline two-layer plan, code, verify. +description: Implement a ticket, validate, and deliver a draft PR for review. Apply accepted PR findings on the same branch. --- # Implement -Execute a GitHub issue or spec. Read AGENTS.md if not in context. +Read the project's AGENTS.md and [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). User instructions and project constraints govern the workflow. ## Inputs -Issue number (`gh issue view `) or pasted spec text. If no spec exists, refer to the existing design document at `/design` for guidance on creating a new spec. +A ticket, pasted requirements, or an existing PR with accepted findings. Tickets can be the complete decision source; create a spec only when the project requires one. Read the ticket and its comments, plus any existing findings file. -## Review-aware +## Before code -Before starting, first check if `.findings.md` exists. If it does, read it. Then, incorporate findings into your plan before proceeding. -If CI or a test is red, compare against `main` and inspect the full PR commit range before classifying the failure. If the failure appears anywhere in the PR range, treat it as branch-owned and fix it in this PR. +1. Confirm goal, success criteria and scope from the available requirements. Ask only for missing decisions. +2. State a narrow two-layer plan: applicable project constraints (at most eight bullets), then steps with checkable exit criteria. Name the files to inspect. +3. Record the base branch and starting commit. Create a feature branch before implementation when currently on the base branch; use an isolated worktree if another task owns the checkout. Preserve unrelated changes. For an existing PR, use its head branch. Explicit user authorization or a project path-specific exception can allow work on the base branch; a notes-only exception never applies to code. -## Before touching code +## Implement and validate -1. Confirm: Goal / Success Criteria / Scope. Ask if missing or ambiguous. -2. State which files you plan to read before reading them. -3. **Layer 1** — filter applicable constraints from AGENTS.md (≤8 bullets): which invariants, authoritative systems, and boundaries govern this task. -4. **Layer 2** — ordered steps with exit criteria: `[Step] → Exit: [how to verify]`. State this plan explicitly before writing any code. +- Keep the diff within the accepted scope. Follow the project's test policy, including any approval requirement for changing existing tests. +- Run focused checks as needed, then the configured full validation command once on the final implementation. Run a separate lint command only when full validation does not include it. +- If validation fails, compare with the base branch and inspect the full PR range before attributing it. Fix branch-owned failures; report proven baseline failures precisely. +- Re-read the current ticket and comments before delivery. Account for every acceptance criterion with implementation and evidence, or mark it unresolved. Automated checks, inspected visual evidence and human play acceptance are distinct results. -## Implementation +## Deliver for review -- Follow patterns in AGENTS.md. Load Tier 2 refs only when the task requires them. -- Do not modify existing tests without explicit approval. -- Keep diffs small and single-purpose. +1. Inspect the final diff and status, then commit only this task's changes. Review tools comparing committed HEAD must run after this commit. +2. Push the feature branch and follow [pr-draft](../pr-draft/SKILL.md) to create or update its draft PR. Keep the description aligned with the current scope and outstanding acceptance work. Do not close the ticket or merge the PR as part of implementation. +3. Record the PR URL, head SHA and current CI status. In **external** review mode, return this handoff: -## After coding + ```text + Review at head against using pr-review. + Read the project workflow configuration; post findings through its review command. + If the head changed, review the new complete head and state its SHA. + ``` -- Verify each Layer 2 exit criterion is met. -- Run: `{{RUN_ALL_TESTS_COMMAND}}` and `{{LINT_COMMAND}}` -- Report: what changed, which criteria are satisfied, any gaps. + The configured external reviewer (for example Claude) owns that pass. Do not substitute the implementation agent's own review or wait indefinitely for another session. In **independent-agent** mode, use a separate review agent only when configured or requested; include the pinned head and ticket. A report is not a submitted GitHub review. +4. Report what was delivered, acceptance gaps, CI status and the review handoff. Green checks alone do not imply approval. + +## Accepted review findings + +When asked to address a PR's findings, read all reviews, threads and relevant comments at its current head. Resolve the accepted items on the same branch, preserve behavioral coverage, revalidate, commit and push. Update the PR description and return a fresh head-specific handoff. Previous approval does not establish review of new commits. Merge only on explicit user instruction after checking the current head, CI and review state. diff --git a/skills/pr-ready/SKILL.md b/skills/pr-ready/SKILL.md index 45c9216..e07f6dd 100644 --- a/skills/pr-ready/SKILL.md +++ b/skills/pr-ready/SKILL.md @@ -13,13 +13,13 @@ PR number or URL. Optional: `-Fast` (lint + unit tests only), `-DryRun` (print a ## Workflow -1. **Run validation** — Use project placeholder mappings to extract: +1. **Run validation** — Read [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). Prefer the complete validation command, running it once. If separate gates are required, resolve: - `{{LINT_COMMAND}}` - `{{RUN_UNIT_TESTS_COMMAND}}` - `{{RUN_ALL_TESTS_COMMAND}}` - `{{SMOKE_TEST_COMMAND}}` (optional) - Default: lint + all tests + smoke (if defined). `-Fast`: lint + unit tests only. + Default: the complete delivery gate. `-Fast` gives focused feedback only; it cannot mark the PR ready unless the project explicitly permits it as the delivery gate. Do not rerun an identical command under multiple mappings. 2. **Check CI** — Run `gh pr checks --watch`. Wait for green. diff --git a/skills/pr-review/SKILL.md b/skills/pr-review/SKILL.md index 5c81e59..693201a 100644 --- a/skills/pr-review/SKILL.md +++ b/skills/pr-review/SKILL.md @@ -1,56 +1,21 @@ --- name: pr-review -description: Review a pull request for spec alignment, architecture, tests, and docs. No code changes. +description: Review a PR against its current ticket and project constraints, then submit findings for the reviewed commit. No code changes. --- # PR Review -Review a PR against its linked issue and project constraints. Do not push fixes. +Read the project's AGENTS.md and [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). The reviewer can run in a different tool or session from the implementer; GitHub holds the shared review record. ## Inputs -PR number or URL. Reviewer GitHub login (must not be PR author). Any custom concerns. +A PR URL or number, optionally an expected head SHA and particular concerns. Respect any user request to discuss findings before submitting. ## Workflow -1. **Verify identity** — Run `gh api user --jq .login`. If reviewer == PR author, stop and request an identity switch. - - If you need a separate reviewer identity (for example, a work account versus a personal account), do this in order: - 1. Check whether a separate identity is needed. - 2. If yes, complete the one-time reviewer setup: - ```bash - # One-time setup for a reviewer account - GH_CONFIG_DIR=~/.config/gh-reviewer gh auth login - # Then prefix all gh commands with GH_CONFIG_DIR=~/.config/gh-reviewer - GH_CONFIG_DIR=~/.config/gh-reviewer gh api user --jq .login - ``` - 3. If `gh` is configured with multiple accounts in the default config, inspect `gh auth status`, identify the reviewer account for this repo (typically `lightforgelabsdev-review`), and switch to it: - ```bash - gh auth switch -u lightforgelabsdev-review - ``` - 4. Re-check the active identity before reviewing. - - Important: in Codex shell sessions, the GitHub account may be reset at the start of each new shell command. When you need to switch accounts for a review, perform the switch, identity verification, and `gh pr review ...` submission inside the same shell invocation rather than separate commands. - -2. **Load PR + spec** — Run `gh pr view ` and `gh pr diff `. Extract linked issue (`Fixes #X`) and read its full spec. - -3. **Review** — Check: - - Spec alignment (goals, scope, success criteria) - - Architecture compliance (AGENTS.md invariants, authoritative systems) - - Testing posture (new tests where appropriate; no unjustified test edits) - - Docs drift or duplication - - Git hygiene (commit structure, no debug leftovers) - - If a check is red, compare against `main` and inspect the full PR commit range before classifying the check as a regression or a pre-existing issue. If the failure appears anywhere in the PR range, treat it as a branch-owned regression and review it as part of the PR. Do not label a failure as `pre-existing` unless that baseline comparison proves it. - -4. **Report findings** — Group by severity (Critical/Major/Minor) with `path:line` references. State a clear decision: approve / request changes / non-blocking. - -5. **Submit** — Post findings directly as a GitHub PR review: - ``` - gh pr review --request-changes --body "..." - ``` - (Use `--approve` or `--comment` as appropriate.) Do not review as the PR author. - - In this repository, if you had to switch to a reviewer account first, prefer a single shell invocation such as: - ```bash - gh auth switch -u lightforgelabsdev-review && gh api user --jq .login && gh pr review --request-changes --body "..." - ``` +1. **Pin the head.** Load the PR's URL, author, base/head SHAs, draft state, checks and review decision. Compare with the handoff's expected SHA. If it changed, review the complete new head and clearly report that SHA. Inspect the full diff against the base; on re-review, recheck original findings and all new changes. +2. **Load requirements.** Read linked tickets and their current comments, project constraints and the test policy. Tickets may be the entire decision source; a separate spec is not required unless the project requires it. +3. **Review.** Account for every acceptance criterion. Identify missing behavior, wrong behavior, scope creep, architecture violations and weak evidence. Check that tests exercise the intended behavior and that claimed visual evidence was inspected. Separate mechanical checks from judgment calls. Compare red checks with the base and the full PR range before calling a failure pre-existing. +4. **Report.** Group findings by severity with file/line references and supporting requirement or observed behavior. State approve, request changes, or comment, and include the reviewed full SHA. Distinguish automation from visual inspection and human acceptance. +5. **Submit.** Recheck the head immediately before posting. If it changed, refresh the review; never approve an unreviewed head. Use the project's configured review command and a body file. Pass the reviewed SHA when the command supports it. Verify the resulting review's author, commit and decision. The reviewer must not be the PR author. Leave the shared machine's active GitHub account unchanged: use a process-scoped reviewer credential or configured wrapper. If neither is available, report the missing setup without switching the shared account. +6. **Return the handoff.** Give the review URL, reviewed SHA, decision and unresolved findings. Make no code changes and do not merge. The implementer can read the posted review in another session and return a new head for re-review. diff --git a/skills/quality/SKILL.md b/skills/quality/SKILL.md index c6384e1..1551749 100644 --- a/skills/quality/SKILL.md +++ b/skills/quality/SKILL.md @@ -9,7 +9,7 @@ Run project quality gates and report results. ## Inputs -Ask the user for scope. Choose one of the following options: +Use the requested scope, or default to full when none is supplied: - **default**: lint + unit tests (fast feedback) - **full**: all tests + smoke tests - **dry-run**: print commands without executing @@ -18,13 +18,13 @@ If the user provides an invalid scope option, respond with an error message indi ## Workflow -1. **Load commands** from project placeholder mappings: +1. **Load commands** using [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). Prefer its complete validation command for full scope. Otherwise resolve the project mappings: - `{{LINT_COMMAND}}` - `{{RUN_UNIT_TESTS_COMMAND}}` (optional) - `{{RUN_ALL_TESTS_COMMAND}}` - `{{SMOKE_TEST_COMMAND}}` (optional) -2. **Execute** in order: lint → tests → smoke (if full scope). +2. **Execute** the complete validation command for full scope, or lint → tests → smoke as configured. Run identical commands once. A complete gate already including lint and smoke replaces separate invocations. 3. **Report:** ``` From e917c2f18f9a913de40a398da6e7edebafab295f Mon Sep 17 00:00:00 2001 From: lightforgelabsdev Date: Mon, 5 Oct 2026 15:55:07 +0100 Subject: [PATCH 2/2] Fix installed workflow skills and draft PR delivery --- README.md | 6 +++--- docs/agents/COMMAND_CATALOG.md | 16 ++++++++++------ skills/README.md | 6 +++--- skills/implement/SKILL.md | 6 +++--- skills/pr-draft/SKILL.md | 18 ++++++++++++------ skills/pr-ready/SKILL.md | 2 +- skills/pr-review/SKILL.md | 2 +- skills/quality/SKILL.md | 8 ++++---- 8 files changed, 37 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 3455f3c..3ca78b9 100644 --- a/README.md +++ b/README.md @@ -158,8 +158,8 @@ All changes require tests. No exceptions (unless you document why). AIDE provides self-contained skills that define what the agent is doing, not who it is: -- **`/implement`** — Build features end-to-end: spec intake, code, tests, verify, push -- **`/pr-review`** — Review code for quality, architecture, and standards +- **`/implement`** — Implement requirements on a feature branch, validate, and deliver a draft PR with a review handoff +- **`/pr-review`** — Review the current PR head against its ticket and project constraints, then submit findings for that commit - **`/design`** — Design exploration → Architecture Decision Record (ADR) - **`/scope`** — Decompose an ADR into GitHub issues via issue-creator - **`/codebase-review`** — Holistic codebase health audit @@ -174,7 +174,7 @@ AIDE provides self-contained skills that define what the agent is doing, not who The canonical implementation workflow is inlined in the `/implement` skill: -- `skills/implement/SKILL.md` — two-layer plan (constraint check + ordered steps), code, verify +- `skills/implement/SKILL.md` — two-layer plan, feature branch, implementation, validation, draft PR, and head-specific review handoff Start by invoking `/implement` in your AI chat session and providing a GitHub issue number or spec. diff --git a/docs/agents/COMMAND_CATALOG.md b/docs/agents/COMMAND_CATALOG.md index 2587573..cd6fe71 100644 --- a/docs/agents/COMMAND_CATALOG.md +++ b/docs/agents/COMMAND_CATALOG.md @@ -13,12 +13,12 @@ Tool-agnostic skill definitions. Authority lives in each skill's `SKILL.md`; thi | Skill | Intent | | --- | --- | -| `/implement` | Execute a GitHub issue or spec end-to-end | +| `/implement` | Implement a ticket or requirements through a draft PR and review handoff | | `/design` | Design a feature into a reviewed ADR | | `/scope` | Decompose an accepted ADR into GitHub issues | | `/findings` | Cross-cutting review protocol that writes reviewer findings files | -| `/pr-review` | Review a PR for spec alignment, arch, tests, docs | -| `/pr-draft` | Create a draft PR with validated body | +| `/pr-review` | Review the current PR head against its ticket and submit commit-specific findings | +| `/pr-draft` | Create or update a draft PR with validated body | | `/pr-ready` | Validate and flip a PR from draft to ready | | `/codebase-review` | Holistic read-only codebase health review | | `/doc-review` | Documentation accuracy and drift review | @@ -32,9 +32,13 @@ Tool-agnostic skill definitions. Authority lives in each skill's `SKILL.md`; thi ## Chaining Flow ```text -/design → ADR → /scope → GitHub issues → /implement → /pr-draft → /pr-ready - ↑ ↓ - /findings /pr-review +/design → ADR → /scope → GitHub issues → /implement (includes draft PR) + ↓ + /pr-review + ↓ + accepted findings → /implement + +/pr-ready marks the validated PR ready when requested; merging is a separate action. ``` ## Implementation Guidance diff --git a/skills/README.md b/skills/README.md index 5e29ad1..df881b0 100644 --- a/skills/README.md +++ b/skills/README.md @@ -185,12 +185,12 @@ Check tool documentation for skill installation. Most support the same `SKILL.md | Skill | Command | Description | |-------|---------|-------------| -| **implement** | `/implement` | Execute a GitHub issue or spec end-to-end. Inline two-layer plan, code, verify. | +| **implement** | `/implement` | Implement a ticket or requirements on a feature branch, validate, and deliver a draft PR with a head-specific review handoff. | | **design** | `/design` | Design a feature or change into a reviewed ADR. Outputs a decision record ready for /scope. | | **scope** | `/scope` | Decompose an accepted ADR into GitHub issues using the issue-creator tool. | | **findings** | `/findings` | Write reviewer findings to a `.findings.md` file for any scoped review target. | -| **pr-review** | `/pr-review` | Review a PR for spec alignment, architecture, tests, and docs. No code changes. | -| **pr-draft** | `/pr-draft` | Create a draft PR with a validated body template and issue linkage. | +| **pr-review** | `/pr-review` | Review the complete current PR head against its ticket and project constraints, then submit findings for that commit. No code changes. | +| **pr-draft** | `/pr-draft` | Create or update a draft PR with a validated body and issue linkage when applicable. | | **pr-ready** | `/pr-ready` | Run validation, post a summary, and flip a PR from draft to ready. | | **codebase-review** | `/codebase-review` | Holistic read-only codebase health review to find drift, dead code, and test gaps. | | **doc-review** | `/doc-review` | Review documentation for accuracy, drift, and duplication. No code changes. | diff --git a/skills/implement/SKILL.md b/skills/implement/SKILL.md index 280c7f5..a5da016 100644 --- a/skills/implement/SKILL.md +++ b/skills/implement/SKILL.md @@ -5,7 +5,7 @@ description: Implement a ticket, validate, and deliver a draft PR for review. Ap # Implement -Read the project's AGENTS.md and [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). User instructions and project constraints govern the workflow. +Read the consuming project's root AGENTS.md and any workflow document it names (convention: `docs/agents/workflow.md`, relative to the project root). Resolve required commands there before acting; report missing configuration instead of guessing or skipping a gate. User instructions and project constraints govern the workflow. Resolve `MAIN_BRANCH` (default `main`), the full validation command (`VALIDATE_COMMAND` or `RUN_ALL_TESTS_COMMAND`), and `REVIEW_MODE` (`external` by default; `independent-agent` only when selected by the project or user). ## Inputs @@ -19,7 +19,7 @@ A ticket, pasted requirements, or an existing PR with accepted findings. Tickets ## Implement and validate -- Keep the diff within the accepted scope. Follow the project's test policy, including any approval requirement for changing existing tests. +- Keep the diff within the accepted scope. Follow the project's test policy, including any approval requirement for changing existing tests. Without a project test policy, do not modify existing tests without explicit user approval. - Run focused checks as needed, then the configured full validation command once on the final implementation. Run a separate lint command only when full validation does not include it. - If validation fails, compare with the base branch and inspect the full PR range before attributing it. Fix branch-owned failures; report proven baseline failures precisely. - Re-read the current ticket and comments before delivery. Account for every acceptance criterion with implementation and evidence, or mark it unresolved. Automated checks, inspected visual evidence and human play acceptance are distinct results. @@ -32,7 +32,7 @@ A ticket, pasted requirements, or an existing PR with accepted findings. Tickets ```text Review at head against using pr-review. - Read the project workflow configuration; post findings through its review command. + Read the project root AGENTS.md and its linked workflow document; post findings through the configured review command. If the head changed, review the new complete head and state its SHA. ``` diff --git a/skills/pr-draft/SKILL.md b/skills/pr-draft/SKILL.md index e3d2d7e..ec7aba0 100644 --- a/skills/pr-draft/SKILL.md +++ b/skills/pr-draft/SKILL.md @@ -1,23 +1,25 @@ --- name: pr-draft -description: Create a draft PR with a validated body template and issue linkage. +description: Create or update a draft PR with a validated body and issue linkage when applicable. --- # PR Draft -Create a draft PR using a consistent template. Validate body locally before opening. +Create or update a draft PR using a consistent template. Validate its body locally before publishing. ## Inputs -Base branch (default `main`), head branch (default current), PR title, issue number, summary bullets (between 1 and 4), implementation checklist items, validation checklist items. +Read the consuming project's root AGENTS.md and any workflow document it names. Resolve the base branch from explicit input or `MAIN_BRANCH` (default `main`). Inputs also include head branch (default current), PR title, requirements or linked issue, summary bullets (between 1 and 4), implementation checklist items, and validation checklist items. ## Workflow -1. **Confirm branch state** — Verify not on `main`. Verify at least one commit exists. Push if needed: +1. **Confirm branch state** — Verify the head differs from the resolved base branch and has commits beyond it. Use an existing PR's head when updating it. Push if needed: ``` git push -u origin ``` + Look for an existing PR for this head and base with `gh pr list --head --base --state open --json number,url,isDraft`. Update that PR rather than creating a duplicate. Do not silently convert a ready PR back to draft. + 2. **Build PR body** — Write a temporary markdown file: ```markdown Fixes # @@ -32,6 +34,8 @@ Base branch (default `main`), head branch (default current), PR title, issue num - [ ] ``` + Include `Fixes #` only when a linked issue should close on merge. For pasted requirements without an issue, omit that line and capture the requirements in the summary and checklists; do not invent an issue. + 3. **Validate body** — Locate the validator from the repository root before running it. Check both the repository-level path and the AIDE-submodule path; this repository may keep it under `.aide/tools/`: ``` $validator = @("tools/validate_pr_body.ps1", ".aide/tools/validate_pr_body.ps1") | @@ -44,13 +48,15 @@ Base branch (default `main`), head branch (default current), PR title, issue num ``` If neither path exists, search the repository including hidden files and inspect submodules before calling the validator unavailable. Do not replace the validator with manual checks. Fix and re-run until green; if validation fails, provide the specific errors and suggest corrections. -4. **Create draft PR** — Run: +4. **Publish** — For a new PR, run: ``` gh pr create --draft --base --head --title "" --body-file <tmpfile> ``` + For an existing PR, run `gh pr edit <pr> --title "<title>" --body-file <tmpfile>` instead. + 5. **Verify & cleanup** — Run `gh pr view --json number,url,body`. Confirm formatting persisted. Delete the temporary body file. ## Output -PR URL, linked issue number, validation result. +PR URL, current draft/ready state, linked issue number if applicable, validation result. diff --git a/skills/pr-ready/SKILL.md b/skills/pr-ready/SKILL.md index e07f6dd..1a1fa43 100644 --- a/skills/pr-ready/SKILL.md +++ b/skills/pr-ready/SKILL.md @@ -13,7 +13,7 @@ PR number or URL. Optional: `-Fast` (lint + unit tests only), `-DryRun` (print a ## Workflow -1. **Run validation** — Read [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). Prefer the complete validation command, running it once. If separate gates are required, resolve: +1. **Run validation** — Read the consuming project's root AGENTS.md and any workflow document it names (convention: `docs/agents/workflow.md`, relative to the project root). Prefer `VALIDATE_COMMAND` or `RUN_ALL_TESTS_COMMAND`, running the complete gate once. Resolve required commands before execution; report missing configuration instead of guessing or skipping a gate. If separate gates are required, resolve: - `{{LINT_COMMAND}}` - `{{RUN_UNIT_TESTS_COMMAND}}` - `{{RUN_ALL_TESTS_COMMAND}}` diff --git a/skills/pr-review/SKILL.md b/skills/pr-review/SKILL.md index 81a5fd0..7293a13 100644 --- a/skills/pr-review/SKILL.md +++ b/skills/pr-review/SKILL.md @@ -5,7 +5,7 @@ description: Review a PR against its current ticket and project constraints, the # PR Review -Read the project's AGENTS.md and [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). The reviewer can run in a different tool or session from the implementer; GitHub holds the shared review record. +Read the consuming project's root AGENTS.md and any workflow document it names (convention: `docs/agents/workflow.md`, relative to the project root). Resolve required commands there before acting; report missing configuration instead of guessing or skipping a gate. User instructions and project constraints govern the workflow. Resolve the reviewer identity and `REVIEW_COMMAND` from those sources. The reviewer can run in a different tool or session from the implementer; GitHub holds the shared review record. ## Inputs diff --git a/skills/quality/SKILL.md b/skills/quality/SKILL.md index 1551749..de784cb 100644 --- a/skills/quality/SKILL.md +++ b/skills/quality/SKILL.md @@ -10,15 +10,15 @@ Run project quality gates and report results. ## Inputs Use the requested scope, or default to full when none is supplied: -- **default**: lint + unit tests (fast feedback) +- **fast**: configured lint + unit tests (focused feedback; not a delivery gate) - **full**: all tests + smoke tests - **dry-run**: print commands without executing -If the user provides an invalid scope option, respond with an error message indicating valid options: default, full, or dry-run. +If the user provides an invalid scope option, respond with an error message indicating valid options: fast, full, or dry-run. ## Workflow -1. **Load commands** using [project workflow configuration](../../docs/agents/PROJECT_WORKFLOW.md). Prefer its complete validation command for full scope. Otherwise resolve the project mappings: +1. **Load commands** from the consuming project's root AGENTS.md and any workflow document it names (convention: `docs/agents/workflow.md`, relative to the project root). Prefer `VALIDATE_COMMAND` or `RUN_ALL_TESTS_COMMAND` for full scope. Resolve required commands before execution; report missing configuration instead of guessing or skipping a gate. Otherwise resolve the project mappings: - `{{LINT_COMMAND}}` - `{{RUN_UNIT_TESTS_COMMAND}}` (optional) - `{{RUN_ALL_TESTS_COMMAND}}` @@ -29,7 +29,7 @@ If the user provides an invalid scope option, respond with an error message indi 3. **Report:** ``` ## Quality Gate Results - Scope: default | full | dry-run + Scope: fast | full | dry-run Results: ✅/❌ Lint: passed | failed