@llm-translate/cli 1.0.0-next.1 → 1.0.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -807,6 +807,8 @@ interface TranslationEngineOptions {
807
807
  verbose?: boolean;
808
808
  /** Disable caching (--no-cache mode) */
809
809
  noCache?: boolean;
810
+ /** External CacheManager instance (for server mode shared cache) */
811
+ cacheManager?: CacheManager;
810
812
  }
811
813
  interface TranslateFileOptions {
812
814
  content: string;
package/dist/index.js CHANGED
@@ -3208,20 +3208,28 @@ var TranslationEngine = class {
3208
3208
  }
3209
3209
  this.provider = getProvider(this.config.provider.default, providerConfig);
3210
3210
  }
3211
- const cacheDisabled = options.noCache || !this.config.paths?.cache;
3212
- if (cacheDisabled) {
3213
- this.cache = createNullCacheManager();
3214
- if (this.verbose && options.noCache) {
3215
- logger.info("Cache disabled (--no-cache)");
3216
- }
3217
- } else {
3218
- this.cache = createCacheManager({
3219
- cacheDir: this.config.paths.cache,
3220
- verbose: this.verbose
3221
- });
3211
+ if (options.cacheManager) {
3212
+ this.cache = options.cacheManager;
3222
3213
  if (this.verbose) {
3223
3214
  const stats = this.cache.getStats();
3224
- logger.info(`Cache initialized: ${stats.entries} entries`);
3215
+ logger.info(`Using shared cache: ${stats.entries} entries`);
3216
+ }
3217
+ } else {
3218
+ const cacheDisabled = options.noCache || !this.config.paths?.cache;
3219
+ if (cacheDisabled) {
3220
+ this.cache = createNullCacheManager();
3221
+ if (this.verbose && options.noCache) {
3222
+ logger.info("Cache disabled (--no-cache)");
3223
+ }
3224
+ } else {
3225
+ this.cache = createCacheManager({
3226
+ cacheDir: this.config.paths.cache,
3227
+ verbose: this.verbose
3228
+ });
3229
+ if (this.verbose) {
3230
+ const stats = this.cache.getStats();
3231
+ logger.info(`Cache initialized: ${stats.entries} entries`);
3232
+ }
3225
3233
  }
3226
3234
  }
3227
3235
  }