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:
committed by
GitHub
co-authored by
Serhii Dziupin
Bohdan Triapitsyn
parent
4a37b9a005
commit
00821700de
@@ -685,12 +685,6 @@ function deleteAgent(agentName, workingDirectory, scope) {
|
||||
}
|
||||
|
||||
export {
|
||||
ensureProjectAgentDir,
|
||||
getProjectAgentPath,
|
||||
getUserAgentPath,
|
||||
getAgentScope,
|
||||
getAgentWritePath,
|
||||
getAgentPermissionSource,
|
||||
getAgentSources,
|
||||
getAgentConfig,
|
||||
createAgent,
|
||||
|
||||
@@ -327,11 +327,6 @@ function deleteCommand(commandName, workingDirectory) {
|
||||
}
|
||||
|
||||
export {
|
||||
ensureProjectCommandDir,
|
||||
getProjectCommandPath,
|
||||
getUserCommandPath,
|
||||
getCommandScope,
|
||||
getCommandWritePath,
|
||||
getCommandSources,
|
||||
createCommand,
|
||||
updateCommand,
|
||||
|
||||
@@ -13,6 +13,33 @@ import { registerPluginRoutes } from './plugin-routes.js';
|
||||
import { getNpmInfo, clearCache as clearNpmCache } from './npm-registry.js';
|
||||
import { parseNpmSpec, parsePathSpec, isExactSemver } from './plugin-spec.js';
|
||||
import { registerOpenCodeRoutes } from './routes.js';
|
||||
import { getProviderSources, removeProviderConfig } from './providers.js';
|
||||
import { getAgentSources, getAgentConfig, createAgent, updateAgent, deleteAgent } from './agents.js';
|
||||
import { getCommandSources, createCommand, updateCommand, deleteCommand } from './commands.js';
|
||||
import { listMcpConfigs, getMcpConfig, createMcpConfig, updateMcpConfig, deleteMcpConfig } from './mcp.js';
|
||||
import { listSnippets, getSnippet, createSnippet, updateSnippet, deleteSnippet, expandSnippets } from './snippets.js';
|
||||
import {
|
||||
listPluginEntries,
|
||||
getPluginEntry,
|
||||
createPluginEntry,
|
||||
updatePluginEntry,
|
||||
deletePluginEntry,
|
||||
listPluginDirFiles,
|
||||
readPluginDirFile,
|
||||
writePluginDirFile,
|
||||
deletePluginDirFile,
|
||||
encodePluginId,
|
||||
decodePluginId,
|
||||
} from './plugins.js';
|
||||
import { SKILL_DIR, SKILL_SCOPE, readSkillSupportingFile, writeSkillSupportingFile, deleteSkillSupportingFile } from './shared.js';
|
||||
import { getSkillSources, discoverSkills, mergeDiscoveredSkills, createSkill, updateSkill, deleteSkill } from './skills.js';
|
||||
import { getCuratedSkillsSources } from '../skills-catalog/curated-sources.js';
|
||||
import { getCacheKey, getCachedScan, setCachedScan } from '../skills-catalog/cache.js';
|
||||
import { isClawdHubSource, parseSkillRepoSource } from '../skills-catalog/source.js';
|
||||
import { scanSkillsRepository } from '../skills-catalog/scan.js';
|
||||
import { installSkillsFromRepository } from '../skills-catalog/install.js';
|
||||
import { scanClawdHubPage } from '../skills-catalog/clawdhub/scan.js';
|
||||
import { installSkillsFromClawdHub } from '../skills-catalog/clawdhub/install.js';
|
||||
|
||||
export const createFeatureRoutesRuntime = (dependencies) => {
|
||||
const {
|
||||
@@ -63,8 +90,6 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
||||
writeSseEvent,
|
||||
} = routeDependencies;
|
||||
|
||||
const { getProviderSources, removeProviderConfig } = await import('./index.js');
|
||||
|
||||
registerSettingsUtilityRoutes(app, {
|
||||
readCustomThemesFromDisk,
|
||||
refreshOpenCodeAfterConfigChange,
|
||||
@@ -111,40 +136,6 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
||||
writeSseEvent,
|
||||
});
|
||||
|
||||
const {
|
||||
getAgentSources,
|
||||
getAgentConfig,
|
||||
createAgent,
|
||||
updateAgent,
|
||||
deleteAgent,
|
||||
getCommandSources,
|
||||
createCommand,
|
||||
updateCommand,
|
||||
deleteCommand,
|
||||
listMcpConfigs,
|
||||
getMcpConfig,
|
||||
createMcpConfig,
|
||||
updateMcpConfig,
|
||||
deleteMcpConfig,
|
||||
listSnippets,
|
||||
getSnippet,
|
||||
createSnippet,
|
||||
updateSnippet,
|
||||
deleteSnippet,
|
||||
expandSnippets,
|
||||
listPluginEntries,
|
||||
getPluginEntry,
|
||||
createPluginEntry,
|
||||
updatePluginEntry,
|
||||
deletePluginEntry,
|
||||
listPluginDirFiles,
|
||||
readPluginDirFile,
|
||||
writePluginDirFile,
|
||||
deletePluginDirFile,
|
||||
encodePluginId,
|
||||
decodePluginId,
|
||||
} = await import('./index.js');
|
||||
|
||||
registerConfigEntityRoutes(app, {
|
||||
resolveProjectDirectory,
|
||||
resolveOptionalProjectDirectory,
|
||||
@@ -193,32 +184,6 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
||||
isExactSemver,
|
||||
});
|
||||
|
||||
const {
|
||||
getSkillSources,
|
||||
discoverSkills,
|
||||
mergeDiscoveredSkills,
|
||||
createSkill,
|
||||
updateSkill,
|
||||
deleteSkill,
|
||||
readSkillSupportingFile,
|
||||
writeSkillSupportingFile,
|
||||
deleteSkillSupportingFile,
|
||||
SKILL_SCOPE,
|
||||
SKILL_DIR,
|
||||
} = await import('./index.js');
|
||||
|
||||
const {
|
||||
getCuratedSkillsSources,
|
||||
getCacheKey,
|
||||
getCachedScan,
|
||||
setCachedScan,
|
||||
parseSkillRepoSource,
|
||||
scanSkillsRepository,
|
||||
installSkillsFromRepository,
|
||||
scanClawdHubPage,
|
||||
installSkillsFromClawdHub,
|
||||
isClawdHubSource,
|
||||
} = await import('../skills-catalog/index.js');
|
||||
const { getProfiles, getProfile } = await import('../git/index.js');
|
||||
|
||||
registerSkillRoutes(app, {
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
export {
|
||||
AGENT_DIR,
|
||||
COMMAND_DIR,
|
||||
SKILL_DIR,
|
||||
CONFIG_FILE,
|
||||
AGENT_SCOPE,
|
||||
COMMAND_SCOPE,
|
||||
SKILL_SCOPE,
|
||||
readConfig,
|
||||
writeConfig,
|
||||
readSkillSupportingFile,
|
||||
writeSkillSupportingFile,
|
||||
deleteSkillSupportingFile,
|
||||
} from './shared.js';
|
||||
|
||||
export {
|
||||
getAgentScope,
|
||||
getAgentPermissionSource,
|
||||
getAgentSources,
|
||||
getAgentConfig,
|
||||
createAgent,
|
||||
updateAgent,
|
||||
deleteAgent,
|
||||
} from './agents.js';
|
||||
|
||||
export {
|
||||
getCommandScope,
|
||||
getCommandSources,
|
||||
createCommand,
|
||||
updateCommand,
|
||||
deleteCommand,
|
||||
} from './commands.js';
|
||||
|
||||
export {
|
||||
getSkillSources,
|
||||
getSkillScope,
|
||||
discoverSkills,
|
||||
mergeDiscoveredSkills,
|
||||
createSkill,
|
||||
updateSkill,
|
||||
deleteSkill,
|
||||
} from './skills.js';
|
||||
|
||||
export {
|
||||
getProviderSources,
|
||||
removeProviderConfig,
|
||||
} from './providers.js';
|
||||
|
||||
export {
|
||||
readAuthFile,
|
||||
writeAuthFile,
|
||||
removeProviderAuth,
|
||||
getProviderAuth,
|
||||
listProviderAuths,
|
||||
AUTH_FILE,
|
||||
OPENCODE_DATA_DIR,
|
||||
} from './auth.js';
|
||||
|
||||
export { createUiAuth } from '../ui-auth/ui-auth.js';
|
||||
|
||||
export {
|
||||
listMcpConfigs,
|
||||
getMcpConfig,
|
||||
createMcpConfig,
|
||||
updateMcpConfig,
|
||||
deleteMcpConfig,
|
||||
} from './mcp.js';
|
||||
|
||||
export {
|
||||
listPluginEntries,
|
||||
getPluginEntry,
|
||||
createPluginEntry,
|
||||
updatePluginEntry,
|
||||
deletePluginEntry,
|
||||
listPluginDirFiles,
|
||||
readPluginDirFile,
|
||||
writePluginDirFile,
|
||||
deletePluginDirFile,
|
||||
encodePluginId,
|
||||
decodePluginId,
|
||||
parsePluginRaw,
|
||||
serializePluginEntry,
|
||||
} from './plugins.js';
|
||||
|
||||
export {
|
||||
listSnippets,
|
||||
getSnippet,
|
||||
createSnippet,
|
||||
updateSnippet,
|
||||
deleteSnippet,
|
||||
expandSnippets,
|
||||
} from './snippets.js';
|
||||
|
||||
export { getNpmInfo, lookupNpmPackage, clearCache as clearNpmCache } from './npm-registry.js';
|
||||
export { parseNpmSpec, parsePathSpec, isExactSemver } from './plugin-spec.js';
|
||||
@@ -2,9 +2,9 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
export const NPM_CACHE_TTL_MS = 3_600_000;
|
||||
export const NPM_FETCH_TIMEOUT_MS = 5_000;
|
||||
export const NPM_REGISTRY_BASE = 'https://registry.npmjs.org';
|
||||
const NPM_CACHE_TTL_MS = 3_600_000;
|
||||
const NPM_FETCH_TIMEOUT_MS = 5_000;
|
||||
const NPM_REGISTRY_BASE = 'https://registry.npmjs.org';
|
||||
|
||||
/**
|
||||
* @typedef {Object} NpmPackagePayload
|
||||
|
||||
@@ -50,7 +50,7 @@ export const normalizeForwardedDirectoryHeaders = (headers) => {
|
||||
return headers;
|
||||
};
|
||||
|
||||
export const waitForSseDrain = (res, signal) => new Promise((resolve) => {
|
||||
const waitForSseDrain = (res, signal) => new Promise((resolve) => {
|
||||
if (signal?.aborted || res.writableEnded || res.destroyed) {
|
||||
resolve();
|
||||
return;
|
||||
@@ -132,7 +132,7 @@ const SESSION_LIST_ALLOWED_FIELDS = [
|
||||
'project',
|
||||
];
|
||||
|
||||
export const sanitizeSessionListItem = (session) => {
|
||||
const sanitizeSessionListItem = (session) => {
|
||||
if (!session || typeof session !== 'object' || Array.isArray(session)) {
|
||||
return session;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ export const sanitizeSessionListItem = (session) => {
|
||||
return sanitized;
|
||||
};
|
||||
|
||||
export const sanitizeSessionListPayload = (payload) => {
|
||||
const sanitizeSessionListPayload = (payload) => {
|
||||
if (!Array.isArray(payload)) {
|
||||
return payload;
|
||||
}
|
||||
|
||||
@@ -507,20 +507,14 @@ export {
|
||||
COMMAND_DIR,
|
||||
SKILL_DIR,
|
||||
CONFIG_FILE,
|
||||
CUSTOM_CONFIG_FILE,
|
||||
PROMPT_FILE_PATTERN,
|
||||
AGENT_SCOPE,
|
||||
COMMAND_SCOPE,
|
||||
SKILL_SCOPE,
|
||||
ensureDirs,
|
||||
parseMdFile,
|
||||
writeMdFile,
|
||||
getProjectConfigCandidates,
|
||||
getProjectConfigPath,
|
||||
getConfigPaths,
|
||||
readConfigFile,
|
||||
isPlainObject,
|
||||
mergeConfigs,
|
||||
readConfigLayers,
|
||||
readConfig,
|
||||
getConfigForPath,
|
||||
|
||||
@@ -594,8 +594,6 @@ function deleteSkill(skillName, workingDirectory) {
|
||||
|
||||
export {
|
||||
getSkillSources,
|
||||
getSkillScope,
|
||||
getSkillWritePath,
|
||||
discoverSkills,
|
||||
mergeDiscoveredSkills,
|
||||
createSkill,
|
||||
|
||||
@@ -240,5 +240,3 @@ export function expandSnippets(text, workingDirectory) {
|
||||
const expanded = expandText(text || '', registry, new Map(), collector).trim();
|
||||
return [...collector.prepend, expanded, ...collector.append].filter(Boolean).join('\n\n');
|
||||
}
|
||||
|
||||
export { assertValidSnippetName };
|
||||
|
||||
Reference in New Issue
Block a user