Skip to content

[Refactor][Build] Remove dead code and add dev toolchain (knip, coverage, Renovate, VSCode)#176

Merged
samzong merged 1 commit intomainfrom
refactor/dev-toolchain
Mar 26, 2026
Merged

[Refactor][Build] Remove dead code and add dev toolchain (knip, coverage, Renovate, VSCode)#176
samzong merged 1 commit intomainfrom
refactor/dev-toolchain

Conversation

@samzong
Copy link
Copy Markdown
Collaborator

@samzong samzong commented Mar 26, 2026

Summary

Remove 52 dead code items identified by knip static analysis, then add three dev toolchain enhancements: automated dependency updates (Renovate), test coverage visibility (vitest v8), and contributor DX (VSCode workspace settings).

Type of change

  • [Refactor] internal cleanup
  • [Build] CI, packaging, or tooling change

Why is this needed?

ClawWork had zero dead code detection — unused exports, dead files, and orphaned types accumulated silently. As an open-source project with growing contributors, the codebase needs automated guardrails to prevent dead code from re-entering, dependency rot from going unnoticed, and test coverage from being invisible.

What changed?

Commit 1 — Dead code cleanup + knip:

  • Installed knip, configured for the monorepo (shared/desktop/website with Electron multi-entry)
  • Removed 1 dead file (useTheme.ts), 2 dead functions (removeDeviceToken, useTheme/useResolvedTheme hooks), 1 dead component (TabsContent), 1 dead constant (EMPTY_ARTIFACTS), 8 dead types
  • Removed unnecessary export from 39 symbols only used file-internally
  • Stripped dead re-exports from shadcn/ui barrel exports (dialog, scroll-area, tabs, button)
  • Added pnpm check:dead-code to pnpm check gate and CI pipeline

Commit 2 — Renovate + Coverage + VSCode:

  • Added renovate.json: weekly schedule, patch automerge, Electron major pinned, Radix UI grouped
  • Added @vitest/coverage-v8 to both shared and desktop, CI now runs pnpm test:coverage
  • Added .vscode/settings.json and .vscode/extensions.json with Prettier, ESLint flat config, TS workspace SDK, Tailwind IntelliSense

Architecture impact

  • Owning layer: shared / main / preload / renderer (all touched — dead export removal only)
  • Cross-layer impact: none — pure deletion of unused exports, no behavior change
  • Invariants touched from docs/architecture-invariants.md: none
  • Why those invariants remain protected: only export keywords removed or dead code deleted; zero runtime behavior change

Linked issues

N/A

Validation

  • pnpm lint
  • pnpm test
  • pnpm check:ui-contract
  • pnpm check (full gate: lint + architecture + ui-contract + renderer-copy + i18n + dead-code + format + typecheck + test)
  • pnpm test:coverage (coverage reports generated successfully)
pnpm check — all gates pass, 98 tests green
pnpm test:coverage — shared: 54.8% stmts, desktop: coverage report generated
pnpm check:dead-code (knip) — zero findings

Screenshots or recordings

N/A — no UI changes.

Release note

  • No user-facing change. Release note is NONE.
NONE

Checklist

  • The PR title uses at least one approved prefix: [Refactor], [Build]
  • The summary explains both what changed and why
  • Validation reflects the commands actually run for this PR
  • Architecture impact is described and references any touched invariants
  • Cross-layer changes are explicitly justified
  • The release note block is accurate

@github-actions
Copy link
Copy Markdown
Contributor

Hi @samzong,
Thanks for your pull request!
If the PR is ready, use the /auto-cc command to assign Reviewer to Review.
We will review it shortly.

Details

Instructions for interacting with me using comments are available here.
If you have questions or suggestions related to my behavior, please file an issue against the gh-ci-bot repository.

@samzong samzong force-pushed the refactor/dev-toolchain branch from ce577b4 to 87d414c Compare March 26, 2026 04:11
Add knip as dead code detection tooling, integrated into `pnpm check`
and PR CI pipeline. Remove 52 dead code items found by initial scan:

- Delete unused file (useTheme.ts), function (removeDeviceToken),
  hooks (useTheme/useResolvedTheme), component (TabsContent),
  constant (EMPTY_ARTIFACTS), and types (ThemeMode, SurfaceKind, etc.)
- Remove unnecessary `export` from 39 symbols only used file-internally
- Strip dead re-exports from shadcn/ui barrel exports (dialog, scroll-area, tabs, button)

Zero behavior change. All checks pass (lint, typecheck, 98 tests).
@samzong samzong force-pushed the refactor/dev-toolchain branch from 87d414c to 913df17 Compare March 26, 2026 04:17
@samzong samzong merged commit cd834af into main Mar 26, 2026
7 checks passed
@samzong samzong deleted the refactor/dev-toolchain branch March 29, 2026 14:11
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