Skip to content

cleanup dead code and imports with knip#1673

Open
pranaygp wants to merge 3 commits intomainfrom
pranaygp/codex/knip-cleanup
Open

cleanup dead code and imports with knip#1673
pranaygp wants to merge 3 commits intomainfrom
pranaygp/codex/knip-cleanup

Conversation

@pranaygp
Copy link
Copy Markdown
Collaborator

@pranaygp pranaygp commented Apr 9, 2026

Human: attempt at cleaning up the codebase using knip.dev. this ended up splitting into three parts: a conservative baseline to make Knip usable in this monorepo, a stricter cleanup pass to remove genuinely dead package code, and a CI pass to keep the baseline from regressing.

Summary

  • add a checked-in knip.jsonc baseline and root pnpm knip script for this monorepo
  • add a stricter knip.strict.jsonc plus pnpm knip:strict so we can include package code more aggressively without drowning in framework false positives
  • add pnpm knip:ci / pnpm knip:ci:github and run Knip in GitHub Actions via lint.yml
  • trim unused package metadata entries, add the missing server-only dependency in the Next.js workbench, and expand the changeset to cover the additional published packages touched here
  • remove an unused docs alias and delete genuinely unused code in @workflow/web and @workflow/web-shared
  • trim a set of internal unused UI exports in packages/web/app/components/ui/*

Code Removed

  • delete 10 unused files across packages/web and packages/web-shared
  • remove unused package metadata from @workflow/web, @workflow/web-shared, @workflow/ai, and workflow
  • remove a batch of unused internal UI exports/components in packages/web/app/components/ui/*
  • combined follow-up cleanup after the original baseline pass removed another 951 lines

Knip

  • original raw run: 787 findings
  • current conservative baseline: 177 issue entries, with 0 file findings
  • current strict pass: 177 issue entries, with 0 file findings
  • current remaining issue-entry breakdown:
    • 127 export entries
    • 64 type entries
    • 7 dependency entries
    • 3 devDependency entries
  • CI now runs against the conservative config with caching, GitHub Actions annotations on PRs, and a --max-issues 797 guard so new findings fail CI without requiring this PR to drive the repo all the way to zero first

Verification

  • pnpm dlx knip --config knip.jsonc --reporter json
  • pnpm --filter @workflow/next build
  • pnpm --filter @workflow/typescript-plugin build
  • pnpm --filter @workflow/world-postgres typecheck
  • pnpm --filter nextjs-turbopack build
  • pnpm install --lockfile-only
  • pnpm --filter @workflow/web-shared build
  • pnpm --filter @workflow/web build
  • pnpm --filter @workflow/ai build
  • pnpm --filter workflow build
  • pnpm knip:strict --reporter json
  • pnpm knip:ci

Notes

  • the conservative CI config still ignores convention-based entrypoints that Knip does not discover well in this repo: oclif command loading, React Router/Nuxt entry files, Vitest setup hooks, generated runtime wrappers, and workbench/docs app surfaces
  • existing build warnings remain, but builds pass: the packages/serde/dist/index.js.map warning in the Next.js workbench and the current Vite chunk/dynamic-import warnings in @workflow/web

Copilot AI review requested due to automatic review settings April 9, 2026 20:11
@pranaygp pranaygp requested a review from a team as a code owner April 9, 2026 20:11
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 9, 2026

🦋 Changeset detected

Latest commit: 9cbce7e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@workflow/next Patch
@workflow/ai Patch
@workflow/typescript-plugin Patch
@workflow/web Patch
@workflow/web-shared Patch
workflow Patch
@workflow/world-postgres Patch
@workflow/cli Patch
@workflow/world-testing Patch
@workflow/core Patch
@workflow/builders Patch
@workflow/nitro Patch
@workflow/vitest Patch
@workflow/astro Patch
@workflow/nest Patch
@workflow/rollup Patch
@workflow/sveltekit Patch
@workflow/vite Patch
@workflow/nuxt Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

🧪 E2E Test Results

All tests passed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 890 0 67 957
✅ 💻 Local Development 73 0 14 87
✅ 🪟 Windows 79 0 8 87
Total 1042 0 89 1131

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 80 0 7
✅ example 80 0 7
✅ express 80 0 7
✅ fastify 80 0 7
✅ hono 80 0 7
✅ nextjs-turbopack 85 0 2
✅ nextjs-webpack 85 0 2
✅ nitro 80 0 7
✅ nuxt 80 0 7
✅ sveltekit 80 0 7
✅ vite 80 0 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ vite-stable 73 0 14
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 79 0 8

📋 View full workflow run


Some E2E test jobs failed:

  • Vercel Prod: success
  • Local Dev: failure
  • Local Prod: failure
  • Local Postgres: failure
  • Windows: success

Check the workflow run for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

No benchmark result files found in benchmark-results

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Apr 10, 2026 6:04am
example-nextjs-workflow-webpack Ready Ready Preview, Comment Apr 10, 2026 6:04am
example-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-astro-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-express-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-fastify-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-hono-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-nitro-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-nuxt-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-sveltekit-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workbench-vite-workflow Ready Ready Preview, Comment Apr 10, 2026 6:04am
workflow-docs Ready Ready Preview, Comment, Open in v0 Apr 10, 2026 6:04am
workflow-swc-playground Error Error Apr 10, 2026 6:04am

@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 9, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​server-only@​0.0.11001004779100

View full report

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a repo-wide Knip baseline and a root pnpm knip script to track unused files/deps across the monorepo, alongside a small dependency/metadata cleanup prompted by Knip results.

Changes:

  • Add checked-in knip.jsonc baseline and a root knip script.
  • Clean up unused dependency metadata and add server-only to the Next.js turbopack workbench.
  • Remove an unused docs export alias and add a changeset for published package metadata cleanup.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
workbench/nextjs-turbopack/package.json Adds missing server-only dependency for Next.js workbench.
pnpm-workspace.yaml Removes unused catalog entry.
pnpm-lock.yaml Lockfile updates reflecting dependency cleanup/additions.
packages/world-postgres/package.json Removes unused devDependency metadata entry.
packages/typescript-plugin/package.json Removes unused devDependency metadata entry.
packages/next/package.json Removes unused devDependency metadata entry.
package.json Adds root pnpm knip script.
knip.jsonc Adds repo-level Knip configuration/baseline.
docs/lib/worlds-data.ts Removes unused backwards-compat export alias.
.changeset/knip-cleanup.md Publishes patch changes for package metadata cleanup.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"test": "turbo test",
"clean": "turbo clean",
"typecheck": "turbo typecheck",
"knip": "pnpm dlx knip --config knip.jsonc",
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The knip script uses pnpm dlx knip (unversioned), but knip.jsonc pins its schema to knip@6. If dlx installs a newer major (or different schema), the baseline/config can drift or become incompatible. Consider pinning the executed Knip version (e.g., pnpm dlx knip@6 ...) or adding knip as a devDependency and invoking it via pnpm knip/pnpm exec knip for reproducible runs.

Suggested change
"knip": "pnpm dlx knip --config knip.jsonc",
"knip": "pnpm dlx knip@6 --config knip.jsonc",

Copilot uses AI. Check for mistakes.
@pranaygp pranaygp marked this pull request as draft April 9, 2026 20:22
@@ -1,25 +0,0 @@
import * as React from 'react';
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

maybe it's better to keep all these shadcn components even if they're unused - so that agents know about them? wdyt? if so, then we can ignore this folder from knip's checking and put them back in @karthikscale3 @mitul-s

"radix-ui": "1.4.3",
"react": "19.2.4",
"react-dom": "19.2.4",
"server-only": "^0.0.1",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this is a dummy package that react owns. it's harmless to include but we can ignore it too if we want

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 32 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +35 to +38
"knip": "pnpm dlx knip --config knip.jsonc",
"knip:strict": "pnpm dlx knip --config knip.strict.jsonc",
"knip:ci": "pnpm dlx knip --config knip.jsonc --cache --max-issues 797",
"knip:ci:github": "pnpm dlx knip --config knip.jsonc --cache --max-issues 797 --reporter github-actions",
Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

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

The new knip* scripts run pnpm dlx knip without a version pin. Since pnpm dlx fetches the latest Knip at runtime, CI can start failing (or producing different results) when Knip releases a new major/minor—especially since the config schema URLs are explicitly knip@6. Consider pinning the version (e.g. pnpm dlx knip@6 ...) or adding knip as a root devDependency and invoking it via pnpm knip/pnpm exec knip to make runs reproducible.

Suggested change
"knip": "pnpm dlx knip --config knip.jsonc",
"knip:strict": "pnpm dlx knip --config knip.strict.jsonc",
"knip:ci": "pnpm dlx knip --config knip.jsonc --cache --max-issues 797",
"knip:ci:github": "pnpm dlx knip --config knip.jsonc --cache --max-issues 797 --reporter github-actions",
"knip": "pnpm dlx knip@6 --config knip.jsonc",
"knip:strict": "pnpm dlx knip@6 --config knip.strict.jsonc",
"knip:ci": "pnpm dlx knip@6 --config knip.jsonc --cache --max-issues 797",
"knip:ci:github": "pnpm dlx knip@6 --config knip.jsonc --cache --max-issues 797 --reporter github-actions",

Copilot uses AI. Check for mistakes.
@pranaygp pranaygp marked this pull request as ready for review April 10, 2026 07:17
@pranaygp pranaygp changed the title Add a repo-level knip baseline cleanup ded code with knip Apr 10, 2026
@pranaygp pranaygp changed the title cleanup ded code with knip cleanup dead code with knip Apr 10, 2026
@pranaygp pranaygp changed the title cleanup dead code with knip cleanup dead code and imports with knip Apr 10, 2026
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.

3 participants