Skip to content

feat(cli): "Add to CI" handoff option + default CI setup in install#658

Open
aidenybai wants to merge 5 commits into
mainfrom
feat/handoff-add-to-ci
Open

feat(cli): "Add to CI" handoff option + default CI setup in install#658
aidenybai wants to merge 5 commits into
mainfrom
feat/handoff-add-to-ci

Conversation

@aidenybai
Copy link
Copy Markdown
Member

@aidenybai aidenybai commented Jun 2, 2026

Summary

  • Post-scan handoff now leads with an Add to CI choice (the new default). Selecting it installs the react-doctor dev dependency + doctor script and writes .github/workflows/react-doctor.yml, then shows a short value pitch + link to react.doctor/ci.
  • When handing off to an agent instead, the generated prompt asks the agent to offer CI setup first (same incremental/trust framing).
  • The install subcommand now pre-selects the GitHub Actions workflow, and install --yes writes it by default (mirroring the git-hook behavior).
  • Extracted the workflow writer into install-github-workflow.ts and pinned the action to the @v1 floating major (never @main, per Consider using a release tag instead of @main in GitHub Actions examples #299). The workflow write now degrades gracefully instead of throwing, and never overwrites an existing workflow.

Notes

  • installReactDoctorPackageSetup is now exported and reused by the handoff path (it already degrades gracefully on package-manager failure).
  • agent.handoff telemetry gains a new "ci" outcome.
  • Behavior change: pressing Enter at the post-scan prompt now sets up CI (installs deps + writes a workflow file) — intentional, CI is the new primary call to action.

Test plan

  • pnpm typecheck
  • pnpm lint (0 errors)
  • pnpm format:check
  • react-doctor package suite (1623 tests; the lone failure is the ambient CURSOR_AGENT env leaking "Agent guidance" into a spawned-CLI assertion — passes with env -u CURSOR_AGENT)
  • Updated build-handoff-payload.test.ts (CI ask + link) and install-react-doctor.test.ts (@v1)
  • Manual: confirm react.doctor/ci page exists before/at release (PR only links to it)

Note

Medium Risk
The CLI now writes repo files and changes the default post-scan action to CI setup; the workflow still grants PR/issue write permissions, though pinning @v1 reduces supply-chain risk versus @main.

Overview
Post-scan handoff now asks “What would you like to do next?” with Add to CI first and selected by default. That path installs the dev dependency + doctor script (reusing exported installReactDoctorPackageSetup) and writes .github/workflows/react-doctor.yml, with failures degrading to the react.doctor/ci guide instead of failing the scan.

install pre-selects the GitHub Actions workflow in the optional-setup prompt, and install --yes installs it by default (like the git hook). Workflow generation moves to install-github-workflow.ts with shared report-workflow-result messaging/metrics; existing workflows are never overwritten.

Generated agent prompts now lead with offering CI setup (trust copy + CI_URL) before the top-issue fix list. The workflow pins millionco/react-doctor@v1 instead of @main. agent.handoff telemetry adds a ci outcome.

Reviewed by Cursor Bugbot for commit 6ae7007. Bugbot is set up for automated code reviews on this repo. Configure here.

…tall

The post-scan handoff prompt now leads with an "Add to CI" choice (the new
default) that installs the dev dependency + `doctor` script and writes a
`.github/workflows/react-doctor.yml` workflow so every PR is scanned. The
agent-handoff prompt asks the agent to offer CI setup first. The `install`
subcommand pre-selects the workflow and `install --yes` now writes it by
default.

Extract the workflow writer into `install-github-workflow.ts` and pin the
action to the `@v1` floating major (never `@main`, per issue #299).
@react-doctor-evals
Copy link
Copy Markdown

react-doctor-evals Bot commented Jun 2, 2026

Parity OK — no diagnostic differences.

Baseline: main · This PR: feat/handoff-add-to-ci (6ae7007)

ℹ️ Re-run this parity check by commenting /rde parity on this PR.

trace d5b98c6524dc0a541733e64ae6916c68 · rde

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 2, 2026

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@658
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@658
npm i https://pkg.pr.new/react-doctor@658

commit: 6ae7007

Comment thread packages/react-doctor/src/cli/utils/handoff-to-agent.ts
Comment thread packages/react-doctor/src/cli/utils/install-react-doctor.ts Outdated
Comment thread packages/react-doctor/src/cli/utils/install-react-doctor.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

React Doctor

React Doctor found 10 files changed in this pull request, but none matched the files covered by its enabled checks.

Scope: 10 files changed on feat/handoff-add-to-ci vs. main.

View workflow run

Generated by React Doctor. Questions? Contact founders@million.dev.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cfc8878. Configure here.

Comment thread packages/react-doctor/src/cli/utils/handoff-to-agent.ts Outdated
aidenybai added 3 commits June 2, 2026 15:55
Address thermo review findings on the "Add to CI" change:
- Record `install.workflow` for handoff-initiated CI setups (was only the
  install command), via a shared `reportWorkflowResult` helper that both
  paths use, so the spinner wording + metric stay in one place.
- Guard `setUpCi`'s package install so a read-only/permission-denied FS can't
  turn a successful scan into a crash; correct the misleading comment.
- Make `buildWorkflowContent` module-private, rename the result interface to
  `InstallGitHubWorkflowResult`, and drop the redundant `!skipPrompts` guard.
…root

Address Bugbot findings on the "Add to CI" change:
- setUpCi resolves the nearest package root before installing (mirrors
  install), so a nested scan dir no longer drops the workflow in the wrong
  place.
- On a failed workflow write, the handoff points to the setup guide instead
  of claiming CI is scanning every PR.
- install.completed reports the actual workflow outcome (from
  reportWorkflowResult) rather than intent, so a failed write isn't logged as
  installed.
Switch `execFileSync` → async `execFile` in the dependency installer so
the ora spinner can tick while the package manager runs. Also reduce the
welcome-scene explanation hold from 2s to 800ms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant