/** * Cleanup Stale Plugin References * * Removes plugin references from ~/.claude/settings.json that no longer exist * in the SpecWeave marketplace. This prevents "Plugin not found" errors for * plugins that were removed/renamed. * * @module cleanup-stale-plugins * @since 0.35.2 */ /** * Result of cleanup operation */ export interface CleanupResult { success: boolean; removedCount: number; removedPlugins: string[]; /** Cache directories removed from disk during Phase 2 cleanup. */ removedCacheDirs: string[]; error?: string; } /** * Clean up stale plugin references from Claude settings * * This function: * 1. Reads ~/.claude/settings.json * 2. Loads marketplace.json to get current plugin list * 3. Removes any enabled plugins that don't exist in marketplace * 4. Writes back the cleaned settings * * @param marketplaceJsonPath - Path to marketplace.json * @param verbose - Show detailed output * @returns Cleanup result */ export declare function cleanupStalePlugins(marketplaceJsonPath: string, verbose?: boolean): Promise; /** * Result of user-level plugin scope migration */ export interface ScopeMigrationResult { success: boolean; migratedCount: number; migratedPlugins: string[]; error?: string; } /** * Migrate user-level SpecWeave domain plugins and LSP plugins to project scope * * Prevents global pollution: sw-*@specweave and *-lsp@* should NEVER live in * ~/.claude/settings.json (user scope). They belong in .claude/settings.json * (project scope) to avoid leaking across projects. * * Exempt: sw@specweave (core plugin, intentionally user-scoped) * * Sources of user-level pollution: * - Claude Code's own plugin discovery (installs at user scope by default) * - Older SpecWeave versions (pre-v1.0.210) * - Manual `claude plugin install` / `vskill install` without --scope flag * * @param projectDir - Project directory with .claude/settings.json (optional, skips project migration if not provided) * @param verbose - Show detailed output * @returns Migration result */ export declare function migrateUserLevelPlugins(projectDir?: string, verbose?: boolean): Promise; /** Options for stale lockfile cleanup functions. */ export interface StaleFileCleanupOptions { verbose?: boolean; /** Override for testing: inject a custom fs module. */ customFs?: typeof import('fs'); /** Mtime threshold in ms — files modified more recently than this are skipped. Default: 5000. */ mtimeThresholdMs?: number; /** Maximum directory depth to descend when scanning (root = 0). Default: DEFAULT_MAX_WALK_DEPTH. */ maxDepth?: number; } /** Result of a stale lockfile cleanup operation. */ export interface StaleFileResult { success: boolean; removedCount: number; skippedCount: number; removedPaths: string[]; skippedPaths: string[]; errors: Array<{ path: string; error: string; }>; } /** * Maximum directory depth for recursive walks (the root is depth 0). * Legacy lockfiles only ever lived at a project root or at a nested repo root * (`repositories///`), so a small bound loses nothing and keeps the * scan cheap even in a large monorepo. */ export declare const DEFAULT_MAX_WALK_DEPTH = 6; /** * Remove all `skills-lock.json` files from the project tree. * This is a dead legacy format with no code references. * * @param projectRoot - Root of the project to scan * @param options - Cleanup options (verbose, fs override, mtime threshold) */ export declare function cleanupLegacyLockfiles(projectRoot: string, options?: StaleFileCleanupOptions): StaleFileResult; /** * Check if there are stale plugins without removing them * * @param marketplaceJsonPath - Path to marketplace.json * @returns List of stale plugin keys */ export declare function detectStalePlugins(marketplaceJsonPath: string): Promise; //# sourceMappingURL=cleanup-stale-plugins.d.ts.map