Commit Graph

1865 Commits

Author SHA1 Message Date
Cursor Agent ade5803beb refactor(core): move scattered magic numbers into constants.ts
Per AGENTS.md, all magic numbers belong in constants.ts using
SCREAMING_SNAKE_CASE with unit suffixes. Three holdouts were still
declared at module-scope in services/runners:

- CONFIG_CACHE_CAPACITY (16), CONFIG_CACHE_TTL_MS (5 * 60 * 1000)
  from services/config.ts
- PREVIEW_COUNT (3) from runners/oxlint/spawn-batches.ts

Hoist all three into constants.ts with descriptive docs. Renamed
PREVIEW_COUNT to OXLINT_PARTIAL_FAILURE_PREVIEW_COUNT to make its
ownership clear from the global namespace.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
2026-05-25 11:37:36 +00:00
Cursor Agent d23fac41db refactor(core): wire Progress service into runInspect; drop spinner Ref plumbing
The Progress service (core/src/services/progress.ts) defined layerOra,
layerNoop, and layerCapture but the CLI bypassed it: spinner state lived
at module scope (setSpinnerSilent), spinner handles flowed through
runInspect's hooks via Ref<SpinnerHandle | null>, and the dead-code
spinner ran post-orchestrator in the CLI shell.

Finish the migration:

- runInspect now requires Progress and owns the lint + dead-code
  spinner lifecycle. Each phase is a separate Stream.runCollect so
  the progress lifecycle can render a per-phase status line; the
  per-element pipeline (auto-suppress / severity / ignore / inline /
  rn-no-raw-text suppression / reporter.emit) applies uniformly to
  env + lint + dead-code streams.
- CLI provides Progress.layerOra wired to the existing ora-backed
  spinner() helper, or Progress.layerNoop for --silent / --score-only /
  lint-skipped runs.
- api provides Progress.layerNoop (programmatic callers don't want
  stderr frames).
- Drop the Ref<SpinnerHandle | null> + finalSpinnerHandle plumbing
  from react-doctor/inspect.ts. The CLI's post-orchestrator code only
  needs the supplementary 'upgrade Node X' / failure-reason hint
  lines now.
- Drop the post-orchestrator dead-code spinner — the orchestrator
  renders it via Progress.
- run-inspect.test.ts layer stacks updated with Progress.layerNoop.

setSpinnerSilent / isSpinnerSilent remain in cli/utils/spinner.ts
because printProjectDetection still calls spinner() directly for its
'static checklist' lines (Detected framework, etc.). That callsite
isn't going through the Progress service yet; a follow-up can migrate
it.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
2026-05-25 11:35:00 +00:00
Aiden Bai 1b91fcf597 Add issue reporting links to agent guidance 2026-05-25 04:32:49 -07:00
Cursor Agent 92a54ac2f5 refactor(core): add resolveScanTarget + share restoreLegacyThrow
The config-redirect + project-discovery dance (loadConfigWithSource +
resolveConfigRootDir + resolveDiagnoseTarget) was duplicated in three
places: api/diagnose.ts, react-doctor/inspect.ts, and the CLI's
cli/commands/inspect.ts. Each shell loaded its own config and then
the orchestrator's Config.layerNode loaded it again via its own cache.

Centralize the entry-point translation:

- New core/src/resolve-scan-target.ts exports resolveScanTarget() that
  loads the config, honors rootDir, and walks into a nested React
  subproject (raising AmbiguousProjectError as before).
- All three shells call it once at the top. The CLI command shell
  surfaces `didRedirectViaRootDir` directly instead of comparing
  pointers.

The legacy thrown-class round-trip (plain Error -> tagged
ReactDoctorError -> plain Error) was also duplicated verbatim in
inspect.ts and api/diagnose.ts via two identical restoreLegacyThrow
closures.

Centralize the boundary:

- Move restoreLegacyThrow into core/src/errors.ts. Both shells import
  it.
- The orElse clause now re-dies the ReactDoctorError instance itself
  (instead of `new Error(error.message)`). Legacy grep-stderr
  callers still see the same `error.message`; advanced callers can
  now narrow on `error.reason._tag` without losing the tagged
  shape across the api/CLI boundary.

api dist shrank from 3.82 kB -> 2.34 kB (39% smaller).

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
2026-05-25 11:21:57 +00:00
Cursor Agent 544a00b42d refactor(core): unify the dual diagnostic-filter pipelines
The streaming buildDiagnosticPipeline (used by runInspect) and the
array-shaped merge-and-filter-diagnostics + filter-diagnostics +
combine-diagnostics + array-form apply-severity-controls implemented
overlapping logic. The array path had rn-no-raw-text textComponents /
rawTextWrapperComponents short-circuiting that the streaming path
lacked — so tests asserted behavior production didn't have.

Collapse to one pipeline:

- buildDiagnosticPipeline is now the single source of truth. The
  rn-no-raw-text textComponents + rawTextWrapperComponents enclosure
  checks moved into the streaming pipeline (runtime now matches the
  previously-test-only behavior).
- Shared raw-line scanners live in core/src/utils/
  jsx-text-component-matchers.ts. resolveCandidateReadPath moved into
  core/src/utils/ alongside.
- mergeAndFilterDiagnostics is now a 10-line array-shaped wrapper
  over buildDiagnosticPipeline. It is the only legacy entry point we
  keep, for back-compat with tests + advanced programmatic callers.
- Deleted filter-diagnostics.ts (filterIgnoredDiagnostics,
  filterInlineSuppressions, the JSX wrapper helpers), combine-
  diagnostics.ts (test-only consumer), and the array form of
  apply-severity-controls (applySeverityControls). restampSeverity +
  SEVERITY_FOR_OVERRIDE remain because the pipeline uses them.
- clearAutoSuppressionCaches is preserved as a no-op for back-compat
  (the streaming pipeline holds caches in per-pipeline closures).
- Tests for the removed array helpers migrated to mergeAndFilterDiagnostics.

Net deletion: ~380 lines, plus a misleading 'single source of truth'
doc comment that is now factually correct.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
2026-05-25 11:15:53 +00:00
Aiden Bai 138862e42d Add automated agent guidance to inspect output (#478) 2026-05-25 04:09:57 -07:00
Cursor Agent e444f69c4b refactor(core): push score-surface filtering into runInspect
The orchestrator's Score service was wired up but always disabled by the
production CLI via Score.layerOf(null) so the CLI could apply
filterDiagnosticsForSurface("score", ...) and recompute the score
outside the Effect pipeline. api/diagnose() used Score.layerHttp without
surface filtering, so api and CLI returned different scores for the
same project + config.

Push the surface filter into runInspect:
- Add scoreSurface?: DiagnosticSurface to InspectInput, default "score"
- Apply filterDiagnosticsForSurface before scoreService.compute inside
  the orchestrator
- CLI provides Score.layerHttp (or layerOf(null) when --no-score) and
  consumes output.score directly; the post-orchestrator calculateScore
  re-run is gone
- api inherits the "score" default, aligning api and CLI numbers

Deletes the HACK-commented Score.layerOf(null) sidecar in
build-runtime-layers.ts and the calculateScore call in
react-doctor/inspect.ts. The orchestrator now owns scoring end-to-end.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
2026-05-25 11:05:13 +00:00
Aiden Bai 906d8b8876 fix 2026-05-25 03:21:52 -07:00
Aiden Bai f380ad1fcc 0.2.6 2026-05-25 02:28:56 -07:00
Aiden Bai cdb542b7ac fix 2026-05-25 02:18:22 -07:00
devin-ai-integration[bot] 9f81e68062 feat: remove design-no-bold-heading rule (#474)
Co-authored-by: nisarg@million.dev <awesomenisarg@gmail.com>
2026-05-25 01:53:03 -07:00
Aiden Bai 08b8514d18 fix 2026-05-25 01:12:04 -07:00
Aiden Bai 41bb4a9725 0.2.5 2026-05-25 00:56:24 -07:00
devin-ai-integration[bot] 0393a6c049 feat(core): add require-pnpm-hardening environment check (#470)
Co-authored-by: nisarg@million.dev <awesomenisarg@gmail.com>
Co-authored-by: Nisarg via Devin <nisarg@million.dev>
2026-05-25 00:38:35 -07:00
Aiden Bai 058f15e443 fix 2026-05-25 00:31:38 -07:00
Aiden Bai 3bde0309e8 fix 2026-05-24 19:48:02 -07:00
Aiden Bai 9d6200cd15 fix 2026-05-24 19:38:38 -07:00
Aiden Bai f04a2f406a install react doctor agent hook 2026-05-24 19:24:05 -07:00
Ray Arayilakath e9a752974d feat: add onboarding on first run (#467)
* Prompt setup after scored scans

* Add React Doctor setup prompt

* Add React Doctor dev dependency setup

* Handle setup prompt failures

* Handle setup prompt edge cases

* Format setup prompt changes

* Avoid repeated setup prompts after acceptance

* Preserve scan exit code on setup cancel

* Handle setup prompt review feedback
2026-05-24 22:21:08 -04:00
Aiden Bai 4db7c4b7e5 fix 2026-05-24 19:17:06 -07:00
Aiden Bai fbbdfd9264 fix 2026-05-24 19:13:43 -07:00
Aiden Bai 87981e9018 fix v0.5.3 2026-05-24 18:58:22 -07:00
Aiden Bai 6ac928383d Fix Node 20 runtime dependency support (#469) 2026-05-24 18:44:44 -07:00
Aiden Bai 5726307443 fix 2026-05-24 17:45:10 -07:00
Aiden Bai 9dca7f6a4d fix 2026-05-24 17:40:53 -07:00
Aiden Bai 61e87ebc9d Cover child workspace diff include paths (#466) 2026-05-24 17:32:49 -07:00
Aiden Bai 75407012a6 Stop jsx-key from flagging shorthand fragments (#465) 2026-05-24 17:32:37 -07:00
Aiden Bai 11bf41ede5 Normalize static template literal handling (#464) 2026-05-24 17:32:29 -07:00
Aiden Bai c944d3e55f fix 2026-05-24 16:31:32 -07:00
Aiden Bai 6b51ea6241 test on multiple version for ci 2026-05-24 16:28:44 -07:00
Aiden Bai e642d461cc fix 2026-05-24 16:20:47 -07:00
Aiden Bai 26b66b45d5 0.2.4 v0.5.2 2026-05-24 02:49:37 -07:00
Aiden Bai d311557642 fix 2026-05-24 00:32:22 -07:00
Aiden Bai d840f39226 fix 2026-05-24 00:30:09 -07:00
Aiden Bai 55d66c6481 fix 2026-05-24 00:29:38 -07:00
Aiden Bai a7ac0c4a08 fix 2026-05-24 00:26:14 -07:00
Aiden Bai 8870528af9 fix 2026-05-24 00:25:52 -07:00
Aiden Bai 2899b5be12 fix 2026-05-24 00:22:47 -07:00
Aiden Bai cb6139e603 fix 2026-05-24 00:20:36 -07:00
Aiden Bai 47e69feab5 fix 2026-05-24 00:17:43 -07:00
Aiden Bai 5d7db1b135 fix 2026-05-24 00:13:12 -07:00
Aiden Bai 81cc3d3d24 fix 2026-05-24 00:10:54 -07:00
Aiden Bai a65e5f0b68 fix 2026-05-24 00:08:19 -07:00
Aiden Bai 5f336cecaf fix 2026-05-24 00:08:10 -07:00
Aiden Bai 281c64d7fd fix 2026-05-24 00:06:56 -07:00
Aiden Bai ddc0e73f70 fix 2026-05-24 00:06:22 -07:00
Aiden Bai 6d37c5ee3b fix 2026-05-24 00:05:53 -07:00
Aiden Bai e501cc693d fix 2026-05-24 00:05:15 -07:00
Aiden Bai d4431fb7c7 fix 2026-05-24 00:05:07 -07:00
Aiden Bai a73ba4d180 fix 2026-05-24 00:04:23 -07:00