@ooples/token-optimizer-mcp
Version:
Intelligent context window optimization for Claude Code - store content externally via caching and compression, freeing up your context window for what matters
195 lines • 4.69 kB
TypeScript
/**
* Smart Install Tool - Package Installation with Dependency Analysis
*
* Wraps package managers (npm/yarn/pnpm) to provide:
* - Package manager auto-detection
* - Dependency analysis and conflict detection
* - Installation progress tracking
* - Token-optimized output
*/
import { CacheEngine } from '../../core/cache-engine.js';
interface SmartInstallOptions {
/**
* Force reinstall (ignore cache)
*/
force?: boolean;
/**
* Project root directory
*/
projectRoot?: string;
/**
* Package manager to use (auto-detect if not specified)
*/
packageManager?: 'npm' | 'yarn' | 'pnpm';
/**
* Packages to install (if empty, installs all from package.json)
*/
packages?: string[];
/**
* Install as dev dependency
*/
dev?: boolean;
/**
* Maximum cache age in seconds (default: 3600 = 1 hour)
*/
maxCacheAge?: number;
}
interface SmartInstallOutput {
/**
* Installation summary
*/
summary: {
success: boolean;
packageManager: string;
packagesInstalled: number;
conflictsFound: number;
duration: number;
fromCache: boolean;
};
/**
* Installed packages
*/
packages: Array<{
name: string;
version: string;
type: string;
}>;
/**
* Dependency conflicts
*/
conflicts: Array<{
package: string;
requested: string;
installed: string;
severity: string;
resolution: string;
}>;
/**
* Installation recommendations
*/
recommendations: Array<{
type: 'security' | 'performance' | 'compatibility';
message: string;
impact: 'high' | 'medium' | 'low';
}>;
/**
* Token reduction metrics
*/
metrics: {
originalTokens: number;
compactedTokens: number;
reductionPercentage: number;
};
}
export declare class SmartInstall {
private cache;
private cacheNamespace;
private projectRoot;
constructor(cache: CacheEngine, projectRoot?: string);
/**
* Run installation with smart analysis
*/
run(options?: SmartInstallOptions): Promise<SmartInstallOutput>;
/**
* Detect which package manager is in use
*/
private detectPackageManager;
/**
* Run package installation
*/
private runInstall;
/**
* Parse installed packages from output
*/
private parseInstalledPackages;
/**
* Detect dependency conflicts
*/
private detectConflicts;
/**
* Generate installation recommendations
*/
private generateRecommendations;
/**
* Generate cache key
*/
private generateCacheKey;
/**
* Get cached result
*/
private getCachedResult;
/**
* Cache result
*/
private cacheResult;
/**
* Transform to smart output
*/
private transformOutput;
/**
* Format cached output
*/
private formatCachedOutput;
/**
* Estimate original output size (full npm install output)
*/
private estimateOriginalOutputSize;
/**
* Estimate compact output size
*/
private estimateCompactSize;
/**
* Close cache connection
*/
close(): void;
}
/**
* Factory function for dependency injection
*/
export declare function getSmartInstall(cache: CacheEngine, projectRoot?: string): SmartInstall;
/**
* CLI-friendly function for running smart install
*/
export declare function runSmartInstall(options?: SmartInstallOptions): Promise<string>;
export declare const SMART_INSTALL_TOOL_DEFINITION: {
name: string;
description: string;
inputSchema: {
type: string;
properties: {
force: {
type: string;
description: string;
default: boolean;
};
projectRoot: {
type: string;
description: string;
};
packageManager: {
type: string;
enum: string[];
description: string;
};
packages: {
type: string;
items: {
type: string;
};
description: string;
};
dev: {
type: string;
description: string;
default: boolean;
};
maxCacheAge: {
type: string;
description: string;
default: number;
};
};
};
};
export {};
//# sourceMappingURL=smart-install.d.ts.map