refactor: calibrate knip + remove dead code (27 unused exports)#43
Merged
Conversation
knip (calibrated in the previous commit) reported 27 unused exports + 2 duplicate exports, all confirmed unused inside the repo, none documented, and none part of the public surface (no "exports" field; the package exposes only the MCP server + CLI).
- Remove 8 fully-unused functions: createBatchDeployScript, createHookScript, createProfile, mergeProfiles, createDefaultAliases, handleSSHKeyError, getToolConfigManager, closeServerSessions.
- Drop the "export" keyword from 9 symbols used only within their own module (saveCommandAliases, RESPONSE_FORMAT, saveHooksConfig, READONLY_DENY_REGEX, loadAliases, saveAliases, cleanupSessions, TUNNEL_STATES, ToolConfigManager, monitorTunnels, serverGroups).
- Remove 4 unused "export default" (logger, server-groups, session-manager, tunnel-manager) and the unused {debug,info,warn,error} re-export, clearing the duplicate-export warnings.
Verified: knip now reports zero dead code; npm test + validate.sh green; all 22 src modules import cleanly; MCP server boots and answers tools/list.
…d code Gets `eslint src/` to zero errors and zero warnings while keeping knip at zero. - Auto-fixed 5 quote-style errors (eslint --fix). - Removed unused imports in index.js and ssh-manager.js (health-monitor / database-manager / config / session / group / tunnel / backup helpers that were imported but never called there). - Cascade on the now-orphaned exports: un-exported 16 symbols still used internally, deleted 5 dead functions + 3 dead consts (configLoader, DB_PORTS, getGroup wrapper). - Fixed 11 unused local vars: dropped unused destructured bindings (database), skipped unused loop keys ([, x]), removed an unused callback param (reject) and an unused arg (hashedKey); kept side-effecting awaits by discarding their unused result (ssh, stream, sftp). Verified: eslint clean, knip zero, npm test green, all 22 src modules import, MCP server boots and answers tools/list.
Adds a 'Run knip' step (knip@5, using the calibrated knip.json) to the quality job, right after ESLint. Unlike the eslint step it is NOT continue-on-error: it fails the build if dead code (unused exports/files/deps) is reintroduced. Safe to make blocking because this PR also brings knip to zero, so the workflow change and the clean tree land together.
bvisible
added a commit
that referenced
this pull request
Jun 18, 2026
Dead-code cleanup (PR #43) + knip dead-code CI gate. Declares knip as a devDependency so the binary is recognized and its version is stable across CI runs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to the v3.6.3 release: add a calibrated knip config and remove the dead code it surfaced. No version bump / no publish in this PR — that happens at release time once reviewed.
Changes
1. Calibrated
knip.jsoncli/**,tests/*,debug/*), scopes analysis tosrc/**, whitelists system binaries. Removes all structural false positives so knip reports only genuine dead code. Excluded from the npm tarball via.npmignore.2. Dead-code removal — knip flagged 27 unused exports + 2 duplicate exports:
createBatchDeployScript,createHookScript,createProfile,mergeProfiles,createDefaultAliases,handleSSHKeyError,getToolConfigManager,closeServerSessions.exportfrom symbols used only within their own module (kept as private):saveCommandAliases,RESPONSE_FORMAT,saveHooksConfig,READONLY_DENY_REGEX,loadAliases,saveAliases,cleanupSessions,TUNNEL_STATES,ToolConfigManager,monitorTunnels,serverGroups.export default(logger,server-groups,session-manager,tunnel-manager) and the unused{debug,info,warn,error}re-export → clears the duplicate-export warnings.Net: −215 lines.
Why it's safe
tests/cli/debugas entry points).exportsfield — its public surface is only the MCP server (src/index.js) + the CLI. No behavioral change.Verification
npm test— full suite, incl. 46 sync-stats assertionsknip→ zero dead code remaining./scripts/validate.sh→ all checks passedsrc/modules import cleanly (no broken imports from removed exports)tools/listquoteserrors (already onmain; the CI step iscontinue-on-error)Next steps (not in this PR)
knipstep to.github/workflows/quality.ymlto prevent dead code from creeping back in.