chore: add React Doctor maintenance workflow
Adds a React Doctor batching script for targeted diagnostics cleanup Adds OpenCode commands for cleanup and review follow-up workflows Ignores generated local React Doctor reports
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
---
|
||||
description: Create a React Doctor diagnostics cleanup PR from the next generated batch
|
||||
agent: build
|
||||
---
|
||||
|
||||
You are working in the OpenChamber repository.
|
||||
|
||||
Goal: reduce React Doctor diagnostics in a small, reviewable maintenance PR.
|
||||
|
||||
Start by running:
|
||||
|
||||
`bun run doctor -- next-batch --min-issues 75 --max-issues 120`
|
||||
|
||||
Use the command output as the source of truth for this task scope.
|
||||
|
||||
Workflow:
|
||||
- Before generating the batch, switch to `main` and pull the latest remote changes.
|
||||
- Read the `next-batch` output carefully.
|
||||
- Use the exact `Run ID`, `Batch name`, `Branch name`, and `PR title` printed by the command.
|
||||
- Create the branch using the printed `Branch name`.
|
||||
- Work only on the selected files listed in the batch output.
|
||||
- Treat the selected files as complete-file scope. Do not cherry-pick only the first N diagnostics.
|
||||
- Fix as many diagnostics as practical in the selected files. Your default should be to fix selected diagnostics, not to skip them.
|
||||
- Prefer direct, behavior-preserving fixes: missing effect cleanup, mutable effect dependencies, accessibility issues with semantic fixes, local performance improvements, Tailwind shorthand replacements, component extraction when the boundary is clear, dead-code removal after verifying no references, and reducer or derived-state cleanup when the state relationship is local and clear.
|
||||
- Handle larger diagnostics deliberately instead of skipping them: for component splits, extract the smallest coherent subcomponent that reduces the diagnostic while preserving props/state flow; for dead code, verify references with search before deleting exports, types, or files; for state architecture issues, prefer the smallest local reducer or derived-state simplification that preserves behavior; for render-function extraction, extract only stable render helpers that do not depend on large implicit closure state, or pass explicit props; for behavior-sensitive diagnostics, read the surrounding code first and preserve existing runtime behavior.
|
||||
- Skip a diagnostic only when the fix would require broad architectural changes, unclear behavior changes, or changes outside the selected batch scope. If skipped, mention it in the PR body.
|
||||
- Do not suppress React Doctor diagnostics unless there is a clear false positive.
|
||||
- If a listed diagnostic requires changes outside the selected files, make only the minimal required supporting change. Do not expand the cleanup scope.
|
||||
|
||||
After edits, run:
|
||||
|
||||
`bun run doctor -- check-batch --run <run-id>`
|
||||
|
||||
Then run:
|
||||
|
||||
`bun run type-check`
|
||||
|
||||
`bun run lint`
|
||||
|
||||
Validation and delivery:
|
||||
- Confirm selected files have fewer diagnostics than before.
|
||||
- If validation fails, fix failures only if the fixes stay within the task scope. Otherwise stop and report the blocker.
|
||||
- Commit the changes with a concise message.
|
||||
- Push the branch.
|
||||
- Create exactly one PR with `gh pr create` using the exact printed `PR title`.
|
||||
- After the PR is created, switch back to `main` and pull the latest remote changes again.
|
||||
|
||||
PR requirements:
|
||||
- Use the exact printed `PR title`.
|
||||
- Include the `Run ID`, `Batch name`, and `Branch name`.
|
||||
- Include selected files.
|
||||
- Include diagnostics fixed according to `check-batch`.
|
||||
- Include remaining diagnostics in selected files.
|
||||
- Include validation results for `bun run type-check` and `bun run lint`.
|
||||
- Include any skipped diagnostics and why.
|
||||
|
||||
Constraints:
|
||||
- Keep the PR small and reviewable.
|
||||
- Do not auto-merge.
|
||||
- Do not modify unrelated files except minimal supporting changes required by selected-file fixes.
|
||||
- Do not run broad formatting.
|
||||
- Do not fix diagnostics outside the selected files.
|
||||
- Leave `.tmp/react-doctor/runs/<run-id>/` intact after creating the PR. These files are the handoff for the review follow-up task.
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
description: Follow up on a React Doctor PR by addressing Greptile review feedback
|
||||
agent: build
|
||||
---
|
||||
|
||||
You are working in the OpenChamber repository.
|
||||
|
||||
Goal: follow up on an existing React Doctor maintenance PR, address Greptile/review bot feedback, and clean up the local batch handoff files when done.
|
||||
|
||||
Inspect local React Doctor batch handoff files:
|
||||
|
||||
`find .tmp/react-doctor/runs -maxdepth 2 -name batch.json -print 2>/dev/null || true`
|
||||
|
||||
Workflow:
|
||||
- Read the available `.tmp/react-doctor/runs/*/batch.json` files.
|
||||
- Find the most recent batch that has `branchName`, `batchName`, and `prTitle`.
|
||||
- Read its `Run ID`, `Batch name`, `Branch name`, `PR title`, and selected files.
|
||||
- Use `gh` to find the open PR for that branch or title.
|
||||
- If no open PR exists for the batch, stop and report that there is no PR to follow up.
|
||||
- Switch to the batch branch using the exact `branchName`.
|
||||
- Pull or update the branch from remote if needed.
|
||||
- Use `gh` to inspect PR review comments, PR issue comments, review threads if available, and check run summaries if relevant.
|
||||
- Focus specifically on Greptile/review bot feedback and actionable reviewer comments.
|
||||
- Address actionable comments with minimal follow-up fixes.
|
||||
- Keep changes within the original selected files whenever possible.
|
||||
- If a review comment requires changes outside the selected files, make only the minimal required supporting change.
|
||||
- Do not perform unrelated cleanup.
|
||||
- Do not rewrite the original PR.
|
||||
- Do not force-push.
|
||||
|
||||
After fixes, run:
|
||||
|
||||
`bun run doctor -- check-batch --run <run-id>`
|
||||
|
||||
`bun run type-check`
|
||||
|
||||
`bun run lint`
|
||||
|
||||
Delivery:
|
||||
- Commit follow-up fixes with a concise message.
|
||||
- Push the branch.
|
||||
- Reply to addressed review comments using `gh`.
|
||||
- For each specific review comment you addressed, reply with what was changed and the follow-up commit hash.
|
||||
- If the feedback was a general PR comment, add one general PR comment summarizing what was addressed, commit hashes, and validation results.
|
||||
- If a comment is intentionally not addressed, reply with a concise reason.
|
||||
- After successful push and replies, delete only the completed batch handoff directory: `.tmp/react-doctor/runs/<run-id>/`.
|
||||
- After the follow-up is complete, switch back to `main` and pull the latest remote changes.
|
||||
|
||||
Constraints:
|
||||
- Work on exactly one React Doctor batch PR.
|
||||
- Prefer the most recent batch with an open PR.
|
||||
- Do not auto-merge.
|
||||
- Do not close the PR.
|
||||
- Do not delete handoff files until comments are addressed, validation passes, and follow-up commits are pushed.
|
||||
- Do not delete unrelated `.tmp/react-doctor/runs/*` directories.
|
||||
- If validation fails and cannot be fixed safely within scope, do not delete the handoff directory.
|
||||
Reference in New Issue
Block a user