chore: add react-doctor and knip dev tooling

Add react-doctor 0.0.31 and knip 6.1.0 as dev dependencies with
matching scripts (doctor, doctor:score, doctor:verbose, knip,
knip:full). Port a knip config from 5chan with seedit-shaped
paths.

Update AGENTS.md task router and verification rules so that
React UI logic changes run yarn doctor and dependency changes
run yarn knip.
This commit is contained in:
Tommaso Casaburi
2026-04-27 13:23:40 +07:00
parent f3fb5fd8c0
commit 660adc161f
5 changed files with 1022 additions and 7 deletions

View File

@@ -26,9 +26,10 @@ seedit is a serverless, adminless, decentralized Reddit-style client built on th
| Situation | Required action |
|---|---|
| React UI logic changed (`src/components`, `src/views`, `src/hooks`, UI stores) | Follow React architecture rules below; review the changed diff with `vercel-react-best-practices` and `vercel:react-best-practices` when available; run `yarn build`, `yarn lint`, and `yarn type-check` |
| React UI logic changed (`src/components`, `src/views`, `src/hooks`, UI stores) | Follow React architecture rules below; review the changed diff with `vercel-react-best-practices` and `vercel:react-best-practices` when available; run `yarn build`, `yarn lint`, `yarn type-check`, and `yarn doctor` |
| Visible UI or interaction changed | Verify in browser with `playwright-cli` across Chrome/Blink, Firefox/Gecko, and WebKit/Safari; test desktop and mobile viewport |
| `package.json` changed | Run `corepack yarn install` to keep `yarn.lock` in sync |
| Dependencies or import graph changed | Run `yarn knip` as an advisory manifest/import audit |
| Translation key/value changed | Use `docs/agent-playbooks/translations.md` |
| Bug report in a specific file/line | Start with git history scan from `docs/agent-playbooks/bug-investigation.md` before editing |
| `CHANGELOG.md`, `scripts/release-body.js`, or package version changed | Run `yarn changelog` if release notes need regeneration |
@@ -114,6 +115,8 @@ src/
- Never mark work complete without verification.
- After code changes, run: `yarn build`, `yarn lint`, `yarn type-check`.
- After React UI logic changes, run: `yarn doctor`.
- Treat React Doctor output as actionable guidance; prioritize `error` then `warning`.
- After adding or changing tests, run `yarn test`.
- Do not commit or force-add local rebuild output. `build/` is the main generated build output in this repo; remove or restore generated output directories after local verification before committing.
- For UI/visual changes, verify with `playwright-cli` across Chrome/Blink, Firefox/Gecko, and WebKit/Safari.
@@ -167,6 +170,7 @@ src/
Use the format playbook: `docs/agent-playbooks/commit-issue-format.md`.
- When stuck on a bug, search the web for recent fixes/workarounds.
- After user corrections, identify root cause and apply the lesson in subsequent steps.
- Use `yarn knip` when adding/removing dependencies or introducing new direct imports; treat findings as advisory, but resolve real issues before finishing.
## Local Development URL
@@ -185,6 +189,11 @@ yarn test
yarn prettier
yarn electron
yarn changelog
yarn knip
yarn knip:full
yarn doctor
yarn doctor:score
yarn doctor:verbose
./scripts/create-task-worktree.sh chore ai-workflow-improvement
./scripts/agent-init.sh
```

47
knip.jsonc Normal file
View File

@@ -0,0 +1,47 @@
{
"$schema": "https://unpkg.com/knip@6.1.0/schema-jsonc.json",
"ignoreBinaries": [
// These are intentionally invoked through package scripts / commit hooks rather than local package bins.
"cz",
"source-map-explorer"
],
"ignoreFiles": [
// Tool-owned config and runtime entry files are resolved by Vite/Electron rather than the app import graph.
"electron/preload.mjs",
"electron/vite-config.js",
"electron/vite.preload.config.js",
"forge.config.js",
"src/sw.ts"
],
"ignoreDependencies": [
// This package is satisfied transitively through bitsocial-react-hooks rather than listed directly.
"@plebbit/plebbit-js",
// These packages are consumed by native Capacitor/Gradle config rather than JS imports.
"@capacitor/status-bar",
"@capawesome/capacitor-android-edge-to-edge-support",
// These packages are used by build/config/html entrypoints Knip does not fully trace in this repo.
"@electron-forge/maker-dmg",
"@electron-forge/maker-squirrel",
"@electron-forge/maker-zip",
"@reforged/maker-appimage",
"assert",
"babel-plugin-react-compiler",
"buffer",
"crypto-browserify",
"cz-conventional-changelog",
"react-grab",
"stream-browserify",
// The PWA service worker entry is injected by vite-plugin-pwa, which Knip does not trace here.
"workbox-core",
"workbox-expiration",
"workbox-precaching",
"workbox-routing",
"workbox-strategies"
],
"ignoreIssues": {
// This import is intentionally satisfied transitively through bitsocial-react-hooks.
"electron/start-plebbit-rpc.js": ["unlisted"],
// Knip falsely infers v8 coverage for Vitest config even though this repo uses Istanbul.
"vitest.config.ts": ["unlisted"]
}
}

View File

@@ -82,7 +82,12 @@
"lint": "oxlint src electron",
"type-check": "tsgo --noEmit",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"android:build": "yarn build && npx cap sync android && npx cap run android"
"android:build": "yarn build && npx cap sync android && npx cap run android",
"knip": "knip --production --include dependencies,unlisted,binaries --no-progress",
"knip:full": "knip --no-progress --no-exit-code",
"doctor": "react-doctor . -y",
"doctor:score": "react-doctor . --score -y",
"doctor:verbose": "react-doctor . --verbose -y"
},
"browserslist": {
"production": [
@@ -127,10 +132,12 @@
"glob": "10.5.0",
"husky": "4.3.8",
"isomorphic-fetch": "3.0.0",
"knip": "6.1.0",
"lint-staged": "12.3.8",
"oxfmt": "0.24.0",
"oxlint": "1.39.0",
"progress": "2.0.3",
"react-doctor": "0.0.31",
"react-grab": "0.1.28",
"react-scan": "0.5.3",
"stream-browserify": "3.0.0",
@@ -209,5 +216,8 @@
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"reactDoctor": {
"diff": false
}
}

6
react-doctor.config.json Normal file
View File

@@ -0,0 +1,6 @@
{
"diff": false,
"ignore": {
"files": ["**/__tests__/**", "**/*.test.*"]
}
}

953
yarn.lock
View File

File diff suppressed because it is too large Load Diff