chore: remove dead code (59 unused files + ~125 unused exports) (#1835)

* chore: remove dead/unreferenced files across ui, vscode

Remove 59 unused source files (components, hooks, lib utils, stores,
barrels, and orphaned vscode github modules) that are not imported by
any entry-reachable code. Also drop a stale test mock for the removed
execCommands module.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>

* refactor: remove unused exported symbols (types, functions, consts, hooks)

Remove exported symbols whose identifier is referenced nowhere in the
repository (verified via repo-wide search), across ui types/contracts,
lib utilities, sync layer, stores, and components. Also drop the few
imports/private helpers orphaned by these removals.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>

* refactor: remove more unused exports (desktop, shortcuts, worktree, vscode)

Continue removing repo-wide unreferenced exported functions, consts and
types across lib/desktop, shortcuts, worktreeSessionCreator, sync, and
vscode gitService, with cascading orphaned helpers/imports cleaned up.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>

* chore: add dead-code cleanup tooling

* refactor: checkpoint dead-code cleanup

* refactor: remove dead-code suppressions

---------

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
Serhii Dziupin
2026-06-26 19:27:53 +03:00
committed by GitHub
co-authored by Serhii Dziupin Bohdan Triapitsyn
parent 4a37b9a005
commit 00821700de
324 changed files with 444 additions and 14876 deletions
@@ -7,7 +7,6 @@ This module fetches quota and usage signals for supported providers in the web s
- `packages/web/server/lib/quota/index.js`: public entrypoint imported by `packages/web/server/index.js`.
- `packages/web/server/lib/quota/routes.js`: Express route registration for quota endpoints.
- `packages/web/server/lib/quota/providers/index.js`: provider registry, configured-provider list, and provider dispatcher.
- `packages/web/server/lib/quota/providers/interface.js`: JSDoc provider contract used as implementation reference.
- `packages/web/server/lib/quota/providers/google/`: Google-specific auth, API, and transform modules.
- `packages/web/server/lib/quota/utils/`: shared auth, transform, and formatting helpers.
@@ -42,6 +41,9 @@ All providers should return results via shared helpers to preserve API shape:
- Optional field: `error`
- Unsupported provider requests should return `ok: false`, `configured: false`, `error: Unsupported provider`
Provider modules must export `providerId`, `providerName`, `aliases`, `isConfigured(auth?)`, and `fetchQuota()`.
`fetchQuota()` should return a quota result with `usage.windows` keyed by window name (for example `5h`, `7d`, `daily`) and optional provider-specific `usage.models` data.
## Add a new provider (quick steps)
1. Choose module shape based on complexity:
- Simple providers: create `packages/web/server/lib/quota/providers/<provider>.js`.
@@ -10,7 +10,7 @@ import {
export const providerId = 'claude';
export const providerName = 'Claude';
export const aliases = ['anthropic', 'claude'];
const aliases = ['anthropic', 'claude'];
export const isConfigured = () => {
const auth = readAuthFile();
@@ -11,7 +11,7 @@ import {
export const providerId = 'codex';
export const providerName = 'Codex';
export const aliases = ['openai', 'codex', 'chatgpt'];
const aliases = ['openai', 'codex', 'chatgpt'];
export const isConfigured = () => {
const auth = readAuthFile();
@@ -40,7 +40,7 @@ const buildCopilotWindows = (payload) => {
export const providerId = 'github-copilot';
export const providerName = 'GitHub Copilot';
export const aliases = ['github-copilot', 'copilot'];
const aliases = ['github-copilot', 'copilot'];
export const isConfigured = () => {
const auth = readAuthFile();
@@ -21,7 +21,7 @@ const STATE_DB = join(homedir(), 'Library', 'Application Support', 'Cursor', 'Us
export const providerId = 'cursor';
export const providerName = 'Cursor';
export const aliases = ['cursor'];
const aliases = ['cursor'];
const readJwtPayload = (token) => {
try {
@@ -39,7 +39,7 @@ export const resolveGoogleOAuthClient = (sourceId) => {
};
};
export const resolveGeminiCliAuth = (auth) => {
const resolveGeminiCliAuth = (auth) => {
const entry = normalizeAuthEntry(getAuthEntry(auth, ['google', 'google.oauth']));
const entryObject = asObject(entry);
if (!entryObject) {
@@ -64,7 +64,7 @@ export const resolveGeminiCliAuth = (auth) => {
};
};
export const resolveAntigravityAuth = () => {
const resolveAntigravityAuth = () => {
for (const filePath of ANTIGRAVITY_ACCOUNTS_PATHS) {
const data = readJsonFile(filePath);
const accounts = data?.accounts;
@@ -1,30 +1,3 @@
/**
* Google Provider
*
* Google quota provider implementation.
* @module quota/providers/google
*/
export {
resolveGoogleOAuthClient,
resolveGeminiCliAuth,
resolveAntigravityAuth,
resolveGoogleAuthSources,
DEFAULT_PROJECT_ID
} from './auth.js';
export {
resolveGoogleWindow,
transformQuotaBucket,
transformModelData
} from './transforms.js';
export {
refreshGoogleAccessToken,
fetchGoogleQuotaBuckets,
fetchGoogleModels
} from './api.js';
import { buildResult } from '../../utils/index.js';
import {
resolveGoogleAuthSources,
@@ -29,7 +29,7 @@ export const parseGoogleRefreshToken = (rawRefreshToken) => {
};
};
export const resolveGoogleWindow = (sourceId, resetAt) => {
const resolveGoogleWindow = (sourceId, resetAt) => {
if (sourceId === 'gemini') {
return { label: 'daily', seconds: GOOGLE_DAILY_WINDOW_SECONDS };
}
@@ -168,7 +168,7 @@ export const fetchCopilotAddonQuota = copilot.fetchQuotaAddon;
export const fetchKimiQuota = kimi.fetchQuota;
export const fetchOpenRouterQuota = openrouter.fetchQuota;
export const fetchZaiQuota = zai.fetchQuota;
export const fetchZhipuaiCodingPlanQuota = zhipuaiCodingPlan.fetchQuota;
const fetchZhipuaiCodingPlanQuota = zhipuaiCodingPlan.fetchQuota;
export const fetchNanoGptQuota = nanogpt.fetchQuota;
export const fetchMinimaxCodingPlanQuota = minimaxCodingPlan.fetchQuota;
export const fetchMinimaxCnCodingPlanQuota = minimaxCnCodingPlan.fetchQuota;
@@ -1,55 +0,0 @@
/**
* Quota Provider Interface
*
* Defines the contract for implementing quota providers.
* @module quota/providers
*/
/**
* @typedef {Object} UsageWindow
* @property {number|null} usedPercent - Percentage of usage (0-100)
* @property {number|null} remainingPercent - Percentage remaining (0-100)
* @property {number|null} windowSeconds - Window duration in seconds
* @property {number|null} resetAfterSeconds - Seconds until reset
* @property {number|null} resetAt - Unix timestamp when quota resets
* @property {string|null} resetAtFormatted - Human-readable reset time
* @property {string|null} resetAfterFormatted - Human-readable time until reset
* @property {string|null} valueLabel - Optional label for display (e.g., "$10.00 remaining")
*/
/**
* @typedef {Object} ProviderUsage
* @property {Object.<string, UsageWindow>} windows - Usage windows by key (e.g., '5h', '7d', 'daily')
* @property {Object.<string, Object>} [models] - Model-specific usage (provider-specific)
*/
/**
* @typedef {Object} QuotaProviderResult
* @property {string} providerId - Unique identifier for the provider
* @property {string} providerName - Display name for the provider
* @property {boolean} ok - Whether the fetch was successful
* @property {boolean} configured - Whether the provider is configured
* @property {ProviderUsage|null} usage - Usage data if successful
* @property {string|null} [error] - Error message if not successful
* @property {number} fetchedAt - Unix timestamp when the result was fetched
*/
/**
* @typedef {Function} ProviderQuotaFetcher
* @returns {Promise<QuotaProviderResult>}
*/
/**
* @typedef {Function} ProviderConfigurationChecker
* @param {Object.<string, unknown>} [auth]
* @returns {boolean}
*/
/**
* @typedef {Object} QuotaProvider
* @property {string} providerId
* @property {string} providerName
* @property {string[]} aliases
* @property {ProviderConfigurationChecker} isConfigured
* @property {ProviderQuotaFetcher} fetchQuota
*/
@@ -12,7 +12,7 @@ import {
export const providerId = 'kimi-for-coding';
export const providerName = 'Kimi for Coding';
export const aliases = ['kimi-for-coding', 'kimi'];
const aliases = ['kimi-for-coding', 'kimi'];
export const isConfigured = () => {
const auth = readAuthFile();
@@ -10,6 +10,6 @@ const provider = createMiniMaxCodingPlanProvider({
export const providerId = provider.providerId;
export const providerName = provider.providerName;
export const aliases = provider.aliases;
const aliases = provider.aliases;
export const isConfigured = provider.isConfigured;
export const fetchQuota = provider.fetchQuota;
@@ -10,6 +10,6 @@ const provider = createMiniMaxCodingPlanProvider({
export const providerId = provider.providerId;
export const providerName = provider.providerName;
export const aliases = provider.aliases;
const aliases = provider.aliases;
export const isConfigured = provider.isConfigured;
export const fetchQuota = provider.fetchQuota;
@@ -12,7 +12,7 @@ const NANO_GPT_DAILY_WINDOW_SECONDS = 86400;
export const providerId = 'nano-gpt';
export const providerName = 'NanoGPT';
export const aliases = ['nano-gpt', 'nanogpt', 'nano_gpt'];
const aliases = ['nano-gpt', 'nanogpt', 'nano_gpt'];
export const isConfigured = () => {
const auth = readAuthFile();
@@ -7,7 +7,7 @@ const COOKIE_PATH = join(homedir(), '.config', 'ollama-quota', 'cookie');
export const providerId = 'ollama-cloud';
export const providerName = 'Ollama Cloud';
export const aliases = ['ollama-cloud', 'ollamacloud'];
const aliases = ['ollama-cloud', 'ollamacloud'];
const readCookieFile = () => {
try {
@@ -8,11 +8,11 @@ import {
toTimestamp
} from '../utils/index.js';
export const providerId = 'openai';
export const providerName = 'OpenAI';
export const aliases = ['openai', 'codex', 'chatgpt'];
const providerId = 'openai';
const providerName = 'OpenAI';
const aliases = ['openai', 'codex', 'chatgpt'];
export const isConfigured = () => {
const isConfigured = () => {
const auth = readAuthFile();
const entry = normalizeAuthEntry(getAuthEntry(auth, aliases));
return Boolean(entry?.access || entry?.token);
@@ -10,7 +10,7 @@ import {
export const providerId = 'openrouter';
export const providerName = 'OpenRouter';
export const aliases = ['openrouter'];
const aliases = ['openrouter'];
export const isConfigured = () => {
const auth = readAuthFile();
@@ -12,7 +12,7 @@ import {
export const providerId = 'wafer';
export const providerName = 'Wafer.ai';
export const aliases = ['wafer', 'wafer-ai', 'wafer_ai', 'wafer.ai'];
const aliases = ['wafer', 'wafer-ai', 'wafer_ai', 'wafer.ai'];
const WAFER_QUOTA_URL = 'https://pass.wafer.ai/v1/inference/quota';
const WAFER_WINDOW_SECONDS = 5 * 3600;
@@ -13,7 +13,7 @@ import {
export const providerId = 'zai-coding-plan';
export const providerName = 'z.ai';
export const aliases = ['zai-coding-plan', 'zai', 'z.ai'];
const aliases = ['zai-coding-plan', 'zai', 'z.ai'];
export const isConfigured = () => {
const auth = readAuthFile();
@@ -38,7 +38,7 @@ import {
export const providerId = 'zhipuai-coding-plan';
export const providerName = 'Zhipu AI Coding Plan';
export const aliases = ['zhipuai-coding-plan', 'zhipuai', 'zhipu'];
const aliases = ['zhipuai-coding-plan', 'zhipuai', 'zhipu'];
function getApiKey() {
const auth = readAuthFile();