codex-multi-auth icon indicating copy to clipboard operation
codex-multi-auth copied to clipboard

chore: add a tuned knip config and drop the unused @fast-check/vitest

Open ndycode opened this issue 5 months ago • 2 comments

Summary

Follow-up to #554: makes dead-code detection repeatable instead of a one-off manual audit. Raw knip output on this repo was untrustworthy — it flagged lib/index.ts itself as unused because nothing declared the entry points — which is exactly why #554 needed every finding hand-verified.

Stacked on #554 (claude/audit-37-dead-code). Merge #554 first; this PR then shows only the config commit. (The runtime/session-affinity.ts orphan this config surfaced was added to #554, where it belongs thematically.)

Changes

  • knip.json (new): declares the real entry points — the plugin-host index.ts, the lib/index.ts facade, the auth/, request/, codex-cli/, ui/ subpath index files that back package.json exports, the scripts/ bins, and the test suites; ignores bench/, vendor/, dist/, docs/; ignores the host-resolved @openai/codex peer, the editor-only typescript-language-server, and the platform clipboard/locator binaries; downgrades export-level findings to warnings, so the blocking signal is unused files and dependencies only. With this config, knip exits clean on the current tree (94 unused-export warnings remain as an explicit pruning backlog rather than noise).
  • @fast-check/vitest removed from devDependencies: zero imports anywhere — the property/chaos suites import fast-check directly, which stays. Both package.json and the tab-indented package-lock.json were edited surgically; the lockfile diff is exactly the one removed entry (24 lines), no formatting churn.

Deliberately no npm script: knip is not a devDependency, and whether to add and pin it (this repo SHA-pins its CI actions) is a maintainer decision. Until then it runs via npx knip and picks the config up automatically.

Validation

  • [x] npx knip exits 0 with zero error-level findings on this tree
  • [x] npm ci --dry-run validates the hand-edited lockfile
  • [x] npm run typecheck; the fast-check property suite still passes (4/4)

Risk / Rollback

Tooling config + one unused devDependency; revert the single commit.

https://claude.ai/code/session_01XNtnkLbBiXZxfQQYLMpucB


Generated by Claude Code

note: greptile review for oc-chatgpt-multi-auth. cite files like lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.

Greptile Summary

this pr adds a knip.jsonc config that declares entry points and demotes export-level findings to warnings, and removes the @fast-check/vitest devDependency which has zero imports across the repo (property tests use fast-check directly).

  • knip.jsonc: pins entry points for the plugin-host, lib facade, subpath exports, scripts, and test suites; ignores bench/, vendor/, dist/, docs/; lists platform-specific binaries (powershell.exe, pbcopy, where) and runtime-resolved deps (@openai/codex, typescript-language-server) explicitly; keeps files/dependencies at error severity.
  • @fast-check/vitest removal: confirmed unused — all property and chaos test files import from fast-check directly; both package.json and package-lock.json are updated surgically with no collateral formatting churn.

Confidence Score: 5/5

safe to merge — tooling config and one unused devDependency removal, no runtime code touched

the change is entirely in tooling config and lockfile; all declared entry points were verified to exist on disk; @fast-check/vitest has zero imports across the codebase; the lockfile diff is surgical with no collateral churn

no files require special attention

Important Files Changed

Filename Overview
knip.jsonc new knip config — entry points verified against repo structure; ignoreBinaries covers windows/mac platform binaries; schema pinned to 6.16.1; no issues found
package.json removes @fast-check/vitest from devDependencies — confirmed no imports anywhere in the codebase
package-lock.json removes the single @fast-check/vitest lockfile entry (24 lines); no formatting churn; lockfile remains consistent

Reviews (3): Last reviewed commit: "chore: convert the knip config to jsonc ..." | Re-trigger Greptile

ndycode avatar Jun 10 '26 16:06 ndycode

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. Credits must be used to enable repository wide code reviews.

📝 Walkthrough

Walkthrough

pr adds knip static analysis configuration to detect unused code and exports, and removes the now-unused @fast-check/vitest plugin from dev dependencies.

Changes

Tooling and dependency updates

Layer / File(s) Summary
Knip static analysis configuration
knip.json
introduces knip configuration targeting index.ts, lib/**, scripts, and test entry points. ignores bench/vendor/dist/docs directories and specific binary commands (powershell.exe, pbcopy, where). excludes typescript-language-server and @openai/codex from analysis. sets exports, types, nsExports, nsTypes, duplicates, and enumMembers to warning level.
Remove unused vitest plugin
package.json
deletes @fast-check/vitest from devDependencies, suggesting the property-based testing framework is no longer integrated with vitest.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed title follows conventional commits format (chore: summary), is 69 chars (<=72), uses lowercase imperative voice, and accurately describes both main changes: adding knip config and removing unused @fast-check/vitest.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed pr description covers summary, changes, and validation checklist; however, it lacks the structured docs/governance and risk/rollback sections from the template.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • [ ] Create stacked PR
  • [ ] Commit on current branch
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Commit unit tests in branch claude/audit-38-knip-config
✨ Simplify code
  • [ ] Create PR with simplified code
  • [ ] Commit simplified code in branch claude/audit-38-knip-config

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Jun 10 '26 16:06 coderabbitai[bot]

Closing as superseded — the substance of this stack is already on main:

  • knip.jsonc is present on main (byte-identical to what #555 proposed).
  • @fast-check/vitest has already been removed from devDependencies.
  • The unused-export / unused-type backlog that #556 and #557 pruned is already clean on current main (verified by running knip against today's tree — no unused files, no unused deps; only a handful of intentional warn-level export/type/enum keepers remain).

Because the bases were ~159 commits behind main, replaying the original deletions would risk removing code that has since become live, with no net benefit. The one genuinely still-valid finding from reviewing this stack — a broken dashboard-settings.js import in test/settings-preview.test.ts that knip surfaced — has been split out into #616. Thanks!

ndycode avatar Jun 19 '26 07:06 ndycode