CLI Internals
Architecture
Caching System

Caching System

Module Fetch Optimization

The CacheManagerService optimizes blueprint loading by caching marketplace modules locally.


Purpose

Avoid redundant network requests or file system scans when loading blueprints.


Implementation

// src/core/services/infrastructure/cache/cache-manager.ts
export class CacheManagerService {
  private cacheDir: string;
  
  async getCachedBlueprint(moduleId: string): Promise<Blueprint | null> {
    const cachePath = join(this.cacheDir, moduleId, 'blueprint.ts');
    
    if (existsSync(cachePath)) {
      return await import(cachePath);
    }
    
    return null;
  }
  
  async cacheBlueprint(moduleId: string, blueprint: Blueprint): Promise<void> {
    const cachePath = join(this.cacheDir, moduleId);
    await fs.promises.mkdir(cachePath, { recursive: true });
    await fs.promises.writeFile(
      join(cachePath, 'blueprint.ts'),
      JSON.stringify(blueprint)
    );
  }
}

Cache Strategy

  1. First load: Fetch from marketplace → cache locally
  2. Subsequent loads: Load from cache
  3. Cache invalidation: On marketplace update or explicit clear

Location: ~/.architech/cache/


Next: Blueprint System Overview →